For this post, I'm looking for more conceptual help than a specific technical solution (although anything helps).
Basically, I've been asked to automate an XML HTTP POST through an application layer. I've never done anything like this before, so I'm a bit confused where to even start on a high level. It would be great if someone could share with me what steps I would need to take to accomplish this task. Here is some more background information:
Currently, our company uses an application (we'll call it Program.exe) on a daily basis to design front-end interfaces with a visual editor. Once the interface is completed, Program.exe creates JSP files and submits them to the server. Unfortunately, the process of creating and sending the files takes an awfully large number of clicks, so management would like to automate this process by running a script that would take the project files from Program.exe, convert them to JSP and accurately submit them through the application layer of Program.exe to the appropriate server.
So far I have used WireShark to sniff the packets of a simple transaction using Program.exe and discovered a number of HTTP/XML POST packets that contained XML data with information like "Current File Name" "User name" and more. Curiously, all of these data items were submitted in different packets, not all in one. There are also multiple references to SOAP. (I have almost no knowledge of SOAP, except that it exists)
At this point, this is all of the information I have. I am unsure what steps I should take from here. I would really like to understand this process on a high level, so any conceptual information would be greatly appreciated.
Finally, we use C# primarily for these sorts of tasks, so if someone would like to share a technical solution feel free to use C#.
Thank you all very much.
I would tackle this by completely ignoring the expected method of solving the problem (generating an HTTP POST) and instead focusing on what the actual problem is.
What are your inputs? A bunch of JSP files by the sound of it.
What are your outputs? The same bunch of JSP files.
What has to be accomplished? Moving the inputs from one know location to another.
Now with a well defined problem, a solution is much more likely to clearly present itself.
For example, by looking at the problem I've defined I would think that XCopy would be an elegant solution to the problem.
Any time I get handed a solution and then told to go solve a certain problem, I am always highly suspicious of the tool I've been given. If they knew that this was the best solution to the problem, why didn't they do it themselves?
My advice: Find your own solution.
Hope that helps!
Related
I have a Beowulf cluster running Ubuntu 12.04LTS and am trying to set it up so I have a program running on the master where essentially I can ask it a question (for example, 8-2), it sends it to a predetermined node, that node receives and answer's the question, and sends the answer back to the master which then displays the answer. I know this sounds completely overly complicated and in the case of a math problem as simple as that it would be faster to just have the master answer it (or do it in my head...) but it's more of a proof-of-concept that I will build a lot more on in the future.
I already have MPI and SSH and all that jazz to make the cluster work with parallel problems, so if I can use them in any way that would be great, but I'm fine with installing new software as well.
I'm writing the program in C# and I'm very new to that language (as in, under a week new), so please just have patience with me because I'm probably not going to understand right away.
Any help provided will be much appreciated, thanks a bunch!
-Eric
I'm trying to create a system that will be very modular. with the idea in mind that no module should really know about any other module (each running in it's own process).
There will be another program that will open, and will be able to tell what these modules will send and receive(this I largely have covered).
the issue I'm having at the moment, is there a way for me to be able to interrogate the application inside another process, or app domain? and in so doing late bind these modules together.
EG:
A module that can broadcast 'X' at runtime will be liked to a module that can accept 'X'.
This may be quite vague, and if so please ask me to clarify on anything I have not covered.
Right now, I Just need to know if it is possible to interrogate a process, and if so how? I Am fairly new to this but my initial research hasn't taken me to far.
I modeled a system like this recently for a personal home automation system. Basically, I'd want to be able to have certain sensors (microphones, cameras, etc.) broadcast what they have, and have other computers or programs get that information whenever they need it, without knowing exactly who is going to be getting the data at compile time.
If this sounds like what you're looking for, I'd look into a Pub-Sub style architecture.
http://en.wikipedia.org/wiki/Publish%E2%80%93subscribe_pattern
You're not really interrogating the process in this kind of architecture, but I think you get a similar result. Basically, you'll have one main pub-sub server.
In the Diagram above, Clients 2 and 3 "subscribe" to receive a specific kind of message. The server knows who is subscribed to what, so that when Client 1 sends that message, the server knows it needs to route it to the correct clients.
I hope this helps.
EDIT: After re-reading your question, I feel that you may have already gotten this far. Maybe all you need is something like
http://msdn.microsoft.com/en-us/library/bb546102(v=vs.110).aspx
Pipes allow you to pass some information between processes. You'll have to serialize and de-serialize the data across the pipe, but this (coupled with a pub-sub architecture) should give you what you need.
There was a similar-ish question here on SO https://stackoverflow.com/questions/9475795/how-do-you-share-code-across-teams-working-on-very-different-projects but mine is about writing documentation.
Scenario:
Let's say my team is working on a software project, a Fany-WordPad like application which has a feature called Fancy-Word-Art ( just like MS Office's word Art). Now I wrote the code for the main window( using WPF in .Net, or using Window Builder in Java, doesn't matter which tool/language).
Now if my colleague Mr Spongebob is writing the Word-Art part, how would I tell him what functions to call / Api to use to draw on my window? i.e. How do I let Mr SpongeBob know that he needs to call GetWindow() method to get a reference to the drawing surface, the parameters he needs to pass along , and so on?
I hope I am being clear here. Is this the procedure?
Step 1 : Use your company wiki site to understand your colleague's written code
Step 2 : Write the GetWindow() method so that it works well with the rest of the project
Step 2 : Now put a wiki on your intranet with the method parameters/ data type requirement for your GetWindow() method or use Doxygen/ Confluence as suggested below
Step 3 : Now its your colleague Mr Spongebob's headache how to find how to draw his word-art on my window.
This just doesnt sound right .. With tons of functions, Spongebob's life will be hard, just as mine. Both of us rummaging through documentation to find the right functions to do our job. What if then I change GetWindow() to GetWindow(string title).. Now how do I literally tell the poor spongebob he needs to redo his code.
Am I missing something here? Please share your experience, how do you tackle this problem in a real world software house environment? If your fellow developer is on the next table , do you actually show them how to implement a certain method as they get stuck, or how do you deal with this situation?
thank you
Thanks
A good question. Of course i do not have the universal solution. Code documentation in msdn/sun style is a good base. But for concepts, architecture and so one you need more than this. In some projects we use wikis for that. For customer requests, we have a kind of ticket-system where we also store some (no-code) information to solution. All in all there is no central place for all the documentaion stuff.
Edit: Your code in self is often the best documentation, following clean code guidelines or something else is a real best practice :-)
Wikis are a cracking idea (good suggestion #Micha!). I used to use one in a previous company for a large engineering software/hardware project. It obviously spanned hardware and software guys and so it was a great way to share info across all teams. It's really useful if it's a long term project too - you can keep track of changes to functionality/API as things inevitably morph over time.
We used a paid service - Confluence if I remember rightly; but there are free wiki hosting sites too e.g. wikihost (just a quick google search, I can't vouch for them).
On another note though - have you thought about self documenting code at all? For example "Doxygen" or similar? Takes a lot of pain out of documenting every single function and also sets up a decent framework that can be padded out with more info where necessary. It also creates a nice UI for stepping through all the functions /class etc.
Edit: I've actually just started using Google Sites (sites.google.com) to create a wiki for a dev team I'm not working with. It's free (as in 'beer') and seems pretty good so far, although it does lack auto code formatting.
IMO you need both API documentation and plenty of examples.
You might get some mileage out of documenting your code of course, but if you're truly writing a system properly, your clients will never see your code. (That goes for clients in the calling sense, not necessarily in the "paying for your services" sense).
That's a fundamental of good practice and SOA, so you should really discard the "self documenting code" approach.
An alphabetic list of functions/methods/properties/whatever has value once the client has "got it" but until then, it's not immediately useful.
So that leaves you with having to showcase your creation. Give a bunch of immediately useful examples that demonstrate the kind of thing you envisaged. Make sure you have a simple example that demonstrates every function in its basic form with minimal interaction with the rest of the system (too many required interactions and you've probably not got a clean system anyway).
Once you have that, put it on a Wiki and encourage your users to enhance it. Consider using something interactive like a Stack-Overflow-like platform. MSDN is a good model but their examples often suck and can lack context. You might have the luxury of having more tight and specific uses than, say, the entire .NET framework. Early response to questions and updates to your examples/documentation will ensure your message gets across in the vital early days. This will help your documentation burden tail off quickly by looking after your clients and giving them useful, practical help.
Hope that helps.
In my projects I use a short description in my class files at the top, like:
//======
//
// modul: fileRunner.cs
// ...
// what: for playing audio/video
// depends on: consoleOutput.cs (Form)
//
//=======
#region HowToUse
//=======
//
// HowToUse
//
// 1. create instance of fileRunner:
// fileRunner p = new fileRunner();
// 2. run console program [progPath] with arguments [cmdsString]
// string output = p.RunExternalExe(progPath, cmdsString);
// 3. handle [output]
// if (output == "anyError"){do something;}
//
// [OUTPUT]
// "0" : process ended w/o errors
// "C" : canceled by user
// else: output is the string of the StdError, the called program submitted + StdOut after "Std output:"
//
// IMPORTANT
// Mention, this file depends on consoleOutput.cs to parse the output for gui.
// It doesn't support input ways, because the way ffmpeg is outputting doesn't allow it, it's not active
//=======
#endregion
For other classes I just named the public functions, that are self-describing.
An other option is to write on the top that they should look an the comment in the code and on the top of the public functions I use similar explanations:
#region convert an audio or video file from a drop
// FUNCTION: convertTo
// DOES: converting a file from a drop
// does not delete the original
// INPUT1: [path] as string,
// path to the destination file
// INPUT2: [e] as System.Windows.Forms.DragEventArgs,
// the args, the drop-object submits
// path of source file is in here
// OUTPUT: isConverted as bool,
// true if not (canceled or error raised)
public bool convertTo(string pWorkingFile, DragEventArgs e)
{
...
}
#endregion
If something changes you can mention it at the top too.
I think with SCM software it's a good option to mention the most important w/o wasting too much time on documentation.
as Stupid as it sounds, I would write him (Spongebob) a mail, or just tell him what he will need. If you already know who will need something in the near future, it is great if you can inform those peope before they strat to search and get headaches. Not everything in a project needs a technical Solution very often a human to human is much better.
Your documentation can also be in a wiki and then you can simply send Spongebob a link.
To reduce the pain involved in changing specifications over a large api, I'd suggest you follow the msdn/javadoc convention as mentioned earlier and also advice your team mate to use a modern IDE with autocompletion/autosuggest feature. Most of the common editors that provide auto suggestion also display documentation for the method/member to be used.
If you are seeking agile here, then docs and wikis are slight overkill; my 2 cents.
Why don't you just put your work in one git/svn project instead of working on the project parts independently? Then when you change a core function, you will see what it breaks and be responsible for fixing the methods that call it before committing your changes.
I am not a big fan of documenting extensively during development. It slows you down too much and you will have to redo it over and over again. Just create descriptive method names and be generous with you in-code comments.
For starters:
To help the situation between spongebob and yourself working together you will need some sort of Code Asset Management software (GIT, TFS, etc).
What if then I change GetWindow() to GetWindow(string title).. Now how do I literally tell the poor spongebob he needs to redo his code.
You should always start your day coding by "GET LATEST", meaning download code from the repository. If spongebob does this he will immediately see that he now needs to pass in string title as his code will stop compiling. It would be preferable that you literally tell spongebob that you have changed your code and he now needs to pass in a value, but if you are both checking in code every night and getting latest when you start coding for the day you should be both informed.
As far as the use of a WIKI or if you use Sharepoint doesnt matter. I would say to make it a little more efficient why not do this:
In your document repository (Wiki/Sharepoint) call the files by the page name so one is WordArt, the other is MainDocument, maybe one is PrintDocument (assuming these are different pages) and in the code you can simply put:
For more information on this visit the ___site at :http://yourrespositoryname.com/nameofprocedure
I have several projects that require me to monitor files, and then edit them as they are getting written to disk. I have a feeling that what I am looking for is operationally the same as how anti-virus tools operate. Let me give more details:
1) I need to trap all files saved by Office application, and then add specific company tags to the headers/footers of each document as they are getting written to disk.
2) I need to know immediately when an editable file (of pretty much any type) is written to disk, so that I can undertake some scanning operations to check if files content meets certain company policies.
In short, you can see that I need to process any user files as they are being written to disk.
Here is my problem. I want to use C# for this task, but I am not sure if it has the ability to meet my requirements. Everything I have seen on the net is geared towards lower-level C programming, which I specifically want to avoid due to time constraints for this project. Anyone aware of how to easily do this task in C#? Is it even feasible (ie too high-level a language, too slow a language etc.)?
Performance won't be the issue. I guess I'd question the entire process- it sounds like a recipe for disaster. You can easily hack something together in C# using a FileSystemWatcher in a matter of minutes, but it will be fraught with issues. AV software is bad enough about locking files and screwing up various software, and it's not even trying to modify the file. How do you know when the other app is "done" writing the file? What do you do when you've got the file locked and something else breaks because it can't get access?
Have you looked at the FileSystemWatcher?
C# can easily do this. Look at the FileSystemWatcher class (http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx).
i am creating my own CMS frame work, because many of the clients i have, the have same requirements, like news module, newsletter module, etc.
now i am doing it fine, the only thing that is bothering me, is if a client wants to move from my server he would ask me to gibe him his files, and of course if i do so the new person who will take it he will see all my code, use it and benefit from i, and this is so bad for me that i spend all this time on creating my system and any one can easily see the code, plus he will see all the logic for my system, and he can easily know how other clients of mine sites are working, and that is a threat to me, finally i am using third party controls that i have paid for their license, and i don't want him to take it on a golden plate.
now what is the best way to solve this ? i thought it is encrypting, but how can i do that and how efficient is it ?
-should i merge all my CS files and Dlls in bin folder to one Dll and encrypt it, and how can i do that ?
i totally appreciate all the help on this matter as it is really crucial for me.
you should read this
Best .NET obfuscation tools/strategy
How effective is obfuscation?
In my experience, this is rarely worth the effort. Lots of companies who provide libraries like this don't bother obfuscating their code (Telerik, etc).
Especially considering what you are writing (CMSes are everywhere), you'd likely see more benefit from your time spent implementing features that put your product/implementation in a competitive advantage and make companies see that the software you are capable of writing has value, rather than the code itself.
In the end, you want to ensure you are a key factor in making software work for a company, not the DLLs you give them.
You'll need to precompile your site and obfuscate dlls.
Visual Studio has something like Dotfuscator Community Edition shipped with it. You could give it a try.
Of course, HTML output, CSS declarations, database structure and stored procedures code cannot be encrypted.
You can however try to compress CSS which will also reduce its readbility by humans.
Check here: The best approach to scramble CSS definitions to a human-unreadable state throughout an ASP.NET application
One other idea would be to use a frame in your HTML and put the most of the site pages inside of it. This way, it will not be visible when doing "View source".
Or just state it clearly that you offer whatever you're doing as a service and do not provide source codes of your work. I somehow doubt salesforce would be willing to give their sources to anyone who asks.