Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have a question about changing an variable of an application from another application.
For example: If in 1.exe I have defined string a="a", how will I be able to change a="a" to a="b" by using another application?
Do I have to get the memory address of string and then change it's content to b? Or Is there any another easier way?
You can set up a shared resource for the two applications and read the values from there. It could, be a database, cache or even a simple text file.
Refresh the variables from the shared resource when appropriate.
Given the scenario you have mentioned (i.e. you do not control the code for the 1st application).. The general idea of opening the target process with admin privileges, finding the memory location you want to update, and then updating it applies..
However, be warned that it will generally not be that simple. For example,
It can be extremely hard to predict, how many copies, of the variable are maintained by the applications logic, and where?
Without disassembling the code (no way a trivial task.. none of this is), scanning for the value and guessing the memory location is the only option which comes to mind. But it has the risk of making wrong guesses, and corrupting the entire process.
PS - There are freely available software, which attempt to do exactly what I've described above.. I'd advise that you try to examine how they work (scenarios they support), to get better idea of what you are trying to accomplish.
PPS - Also be careful what you download.. Applications like these, if downloaded from un-reliable sites, can be damaging / security risk.
I think the easiest way is communication with network sockets in localhost via UDP or TCP. It gives you a good event mechanism so you can easily handle your data without checking the new data changes frequently, also will be doesn't matter how amount of application communicating each other in same time. Other solutions like shared memory etc. will be hard to control especially when you running three and more apps.
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 5 years ago.
Improve this question
I want to share data between programs that run locally which uses different languages, I don't know how to approach this.
For example, if I have a program that uses C# to run and another that uses python to run, and I want to share some strings between the two, how can I do it?
I thought about using sockets for this but I'm not sure that this is the right approach, I also thought about saving the data in a file, then reading the file from the other program, but, it might even be worse than using sockets.
Note that I need to share strings almost a thousand times between the programs
There are a lot of ways to do so, I would recommend you reading more about IPC (Inter Process Communication) - sockets, pipes, named pipes, shared memory and etc...
Each method has it's own advantages, therefore, you need to think about what you're trying to achieve and choose the method that fits you the best.
Any kind of IPC (InterProcess Communication) — sockets or shared memory. Any common format — plain text files or structured, JSON, e.g. Or a database.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I have written a windows form app in C#, but I want to turn it into native code for ASP.NET so I can build a webapp around it. However, I've never used ASP.NET and I'm not sure how to approach this. I've looked around and seen libraries such as VisualJS.Net, but it looks confusing and I'm not sure if I can seamlessly integrate it into my app without causing problems later on. Could someone lead me towards the right direction?
Thanks!
So if I well understand, you would like to "transform" a Windows Forms app into a ASP.NET. The problem with this approach, is that those two technologies are like day and night. They don't have the same lifecycle at all. Windows applications are by definition stateful. This means that they keep their state in memory and they don't need to rebuild it often (maybe at the loading of a file). Web applications however are completely stateless. The server receives a request, processes it and returns web content (HTML, JSON and whatever is needed). If the server is again contacted with new information, the state must be rebuilt (with the help of cookies, sessions, etc).*
However, what you can do the ease those problems is the following. If you separate your concerns, you can more easily reuse your business logic and your data and just re-code the view of your application. This means that you must separate what belongs to a View technology (WinForms, ASP.NET) from the model itself. There are numerous patterns to support this : MVC, MVP, MVVM. Respecting GRASP patterns also helps.
With that in mind, you could have three solutions : One containing your common code, one containing the logic that belongs to WinForms and another one that contains your ASP.NET logic. It's easier said than done, but this should be the way to go.
You can't turn an apple into an orange. Those two technologies are so different, that you will be better off rewriting the application from scratch, and taking advantage of all the goodies available in ASP.Net MVC 5.
Technically speaking one could devise some type of a converter, but it would potentially promote bad coding practices, something you should avoid.
Start learning MVC 5, you will be better off in the end.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 8 years ago.
Improve this question
I'm not sure if I'm going to be able to explain it right since I'm quite sure I don't know the correct terminology involved with it, which is also why I'm having a difficult time Googling for answers.
Essentially, I'm looking to develop a program that serves as a web site. It'll run constantly (like a service) and will return HTML when an outside user sends an HTTP request thru a browser or similar to a specific port on the computer this program runs on. Basically, this program will perform various background errands throughout the day but I want to be able to expose a web front end (almost like how you would with standard WinForms, but I want to be able to access it remotely) to be able to configure it, check the status of tasks, and otherwise interact with it.
I'm looking to use .Net, but I'm open to using something more universal like Java too. Someone with experience in this area would be helpful to explain any pain points you've encountered and suggestions on how to get started.
You can do it in C# with the HttpListener class.
I published an example some time back. See A Simple Http Server.
Although you might consider whether you really want to operate at that low level. I have written a fairly complex server based on HttpListener, and if I had it to do over again I'd probably just bite the bullet and use ASP.NET. There is a bit of a learning curve, but unless your server is incredibly small and simple, an ASP.NET application will be a lot easier to write and will likely be more robust.
Here is a simple example on how to do it in C# using the HttpServer class:
http://www.codeproject.com/Articles/137979/Simple-HTTP-Server-in-C
You are doing at least 2 different things, so you should probably create a Solution in Visual Studio.NET with one project for each purpose (You can have many projects in a solution), probably with at least one Data Access project as well (of type Class Library). If the solution does things at certain times of the day, then those can be Console Applications that run through task scheduler, rather than one of more services. Services are better suited to things other than simple scheduled tasks. A Web Application project can serve up your html.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
If you are copying many folders with files inside it can be usually better to just create a ZIP/RAR with the folder and files, copy it to network path and unzip it. This usually works much faster than copy paste
Is there a way to do this programatically and embed it into windows so that It can try to detect which way is faster and use that one (normal way or "compress on the fly") to improve speed
"compression on the fly" is a waste unless there is something on the other end that can perform the decompress OR if the compressed state is acceptable. That said:
Yes, you can write an app that zips/rars files.
Yes, you can have that app copy the zip/rar to a network directory.
Yes, you can have an app on the other end wait for the file and unzip it locally...
Can you have it detect "which way is faster"?? Although possible it is unlikely to be of benefit for anything other than large files... at which point you should always zip/rar and transfer...which would make the entire exercise rather pointless. Of course, you should probably evaluate the data that is likely to be transferred using your app to see if it is even a candidate for compression. Video, for example, might not be...
More to the point here, each end would have to have an application that is aware of each other (or at least the protocols involved). One app (we'll call it the client) would zip and post the file to another app (we'll call that one the server). When the server receives the file it would unzip it and store it on the file system.
update
I thought of another situation for zipping: transferring LOTs of little files at one time. Normal network file copy routines go much faster for a single large file vs lots of little files. So, if they are selecting a few hundred files to go at once you might be better off always zipping. Which, incidentally, doesn't change the requirement of having something on the other side able to decompress it.
Have you tried using robocopy ? It's built-in on Windows, robust, multi-threaded and features a lot of options, including mirroring and retries in case of failure. I use it with all copy to network locations. Give it a try.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
Imagine, I create an application ASP.NET MVC for a customer. This application is running an a local server of my customer (I call it customer1). Is there a way to make this application impossible to run foranother customer if customer1 give application to customer2 ?
Thanks,
Why are you bothering and wasting your time with things like this? Make sure you license your code, probably obfuscate it, and sell it to a customer. If he violates the license agreement and gives it to someone else that's his problem. Sue their asses and that's it, end of the story. But remember that no matter what you do they will find a way :-)
So focus on delivering a good product and customers will come by themselves to you asking you to buy it.
You could hardcode in a check for the domain it's running on perhaps. Simple but crude.
I think adding some checking to application start is not a bad idea. checking Computer name and Mac address doesn't seem bad.
1- check in your code for a value placed in a file has an encrypted data.
this file generated on windows root or some root the customer1 not know it.
this file will generate in activating through online connection or by yourself.
in runtime read file and decrypt, you may read values for expired date, some configuration you want.
you may check for as friends said for computer name, ip address anything difference customer1 from customer2
2- also you need to protect dll files from decompilation methods
My Regards
It's a Web Application -- the easiest way is to host the application for your customer, that way they won't be able to get the source for it.
Most applications use business rules, naming conventions, assets, etc. that are unique to their business. Hard code those values into your app so that a shared app just doesn't apply to another customer.
Beyond that, you can look into a real copy-protection package like DeployLX, Infralution or Desaware.
Take a look at Rhino Licensing.
James Gregory wrote a nice post on how to get started with it.
Also the link to a post by Balsamiq in James' article is well worth a read.