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
Say I have an application that is connected to a database, with its own forms that present data and allow data to be changed & entered, how would one extend the program to be extensible by a third party?
For example a third party would be able to write scripts that the user can run that would prompt the user for input. Part of the script would then take what the user inputed (integer/string/boolean) and do some basic programmatic things to it, math on integer values, concatenation on string values (and other string functions), and logical tests to trigger further user prompts etc etc, the scripting environment would also support reading/writing to the application's database.
Would this be done simply by having text files the program could run, with each line corresponding to a certain command? Then the application would read each line, figure out what command the line represents, and equate that to C# code? Are there any already existing solutions to this problem?
The question is fairly open, here some proven great extension tools:
Compiled Plugins written in C# would use Managed Extensibility Framework (MEF), a great and well designed extensibility option.
Scripted Extensions in C# might be possible soon when Roselyn is ready.
Scripting could also be accomplished by integrating Jurassic into your application.
There are several good choices if you want to embed a scripting language into a c# app. IronPython, IronScheme and IronRuby alL support the Dynamic Language Runtime so they can access objects from the host code. There's also Boo, which is a strongly typed CLR language that looks a lot like Python but can be easily embedded in a C# application and, like to the others, can interact with the host application. In general the embedding process is pretty simple - Michael Foord's IronPython site has a good example.
There's also NLua which is supposed to be a CLR friendly lua wrapper, but I have no personal knowledge of that one.
Out of all of the above, I'd expect the main thing driving your choice will be the preferences of the user base. Especially for the lightweight application you've described all of these choices should be well suited. If you wanted users to be able to do extensive programming on their own it's more complex, since the CLR ports of these languages dont usually support the same binary extensions as their C-based counterparts - for example, IronPython can't use the regular Perforce API module because it is built on a C-based binary extension module. All Iron* languages can use the same base class library as C#, though - you can import System.Windows.Forms into any of them to create GUI and so on.
Related
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 4 years ago.
Improve this question
I am attempting to create my own version of a cryptocurrency by using a BlockChain in a P2P network. I would like users to access my website then download an executable that allows them join the network and mine for currency. I also would like my website(c#) to display the updated ledger of the blockchain. I have done a lot of research, with little success, attempting to understand how to construct the P2P network.
What would be the recommended language to construct this executable? Are there any tutorials or examples that are suggested? In addition, how would my website access the universal ledger? Is it feasible to have my website's server also join the P2P network, or should the P2P network continuously send the ledger to my server?
I believe this is language agnostic. Any language that can be built on different platforms. Actually, I saw a book about blockchain implementation in python. But also there are courses on Java.
Blockchain is a very complex technology to understand not to mention inventing something like that with C# language.
I might want to start with Ethereum which uses solidity language similar to JavaScript.
If you would like to use C#, you might want to look at Nethereum (.Net integration library for Ethereum).
As Dmitry mentioned this is language agnostic.
Regarding C#: we have Bitcoin and Stratis full node implementations in .NET, which may be your best reference. As Win said, it's a complex technology, so expect years of development until you can roll out a buggy alpha version, assuming you are doing it alone.
You may also want to get some experience first, for that, take a look at the book: Programming the Blockchain in C#.
Then go and try building your product based on the above mentioned reference implementations.
What would be the recommended language to construct this executable?
Historically lazy altcoin devs just cloned Litecoin and changed some parameters so C++ is what most alts are written in, but again: it's language agnostic.
In addition, how would my website access the universal ledger?
That's your smallest problem. If you succeed to roll out an alt, then by the time you will know it.
The choice of language depends on networking requirements and validation requirements.
For a completely decentralized use case, faster cryptographic verification is a need & thus languages native to the machine offer a speed advantage (like c++, golang).
If there is any element of centralization like private blockchain, permissioned blockchain, premined, asset-backed token, virtual machine blockchains like evm, colored coin etc. then access control and development requirements overtake permissionless and security requirements & thus language with available human resource should be chosen like c#, java etc.
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
I want to deliver a huge amount of data around 30 times each second from a C# application to my Unity Application. Since mapped memory and pipes aren't supported in Unity i thought about a tcp socket. Would this be fast enough if the communication is in the scope of one machine only?
Possibly as of 2017, Unity also supports Managed plug-ins.
Unity3D supports c++ too.
Native plugins are platform-specific native code libraries. They can access features like OS calls and third-party code libraries that would otherwise not be available to Unity. However, these libraries are not accessible to Unity’s tools in the way that managed libraries are. For example, if you forget to add a managed plugin file to the project, you will get standard compiler error messages. If you do the same with a native plugin, you will only see an error report when you try to run the project. More...
...and:
Unity has extensive support for native Plugins, which are libraries of native code written in C, C++, Objective-C, etc. Plugins allow your game code (written in Javascript or C#) to call functions from these libraries. This feature allows Unity to integrate with middleware libraries or existing C/C++ game code. More....
With c++ code you are free to do anything you want including writing a native name pipe server through which your c# app could send data to.
Local named pipes are incredibly fast because they run in Kernel mode and don't go through the network layer unlike TCP which does.
I would recommend named pipes over TCP if comms is for local machine only.
Alternatives
Alternatives to named pipes are:
COM
DDE
File mapping (including shared memory, thanks Ben!)
Mailslots
Tell me more...
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
EDIT - I'm sorry that I made this post more complicated than it should. I won't delete this post in case someone with a similar question needs help.
I recently became interested in building my own Linux distro(probably just for family and friends). I have researched extensively on whether I should customize an existing distro(eg. Arch Linux, Debian) or build from scratch(LFS). I have come to the conclusion that building from scratch would best fit my needs(Im on no time constraint).
My main question is:
Would it be possible to build an application that functions as a full OS, and just program the linux distro to run it at launch?
Second main question:
Would doing this way restrict programs from being installed? Would developers have to make a custom version of their software to run on this mock OS?
Problems I see in this:
-If I use a language like c#, would that work? or does it require windows natives?
-If I use java(probably not), but if I would, would I have to package JRE with the distro?
-If I use something like java, can I use libraries like LWJGL(for openGL for stuff like window frames)
-Does java or c# use special file system methods? Would I need to make the Linux base build the file system for the VM language to use? Or can I arrange all that in the mock Os itself?
-Performance problems with VM languages?
-Are there any legal problems with packaging things like JRE or if I find a way to use windows natives?
Additional notes:
-I have no concern on time, even if just the file system takes me 3 years.
-If building this from scratch would not be possible, would I be able to customize a distro in order to function like this?
-I understand that I would have to make linux handle stuff like hardware drivers, because communicating with hardware is not something in my ballpark. Would this mean that I have to customize something like Arch Linux?
I am very sorry there are so many questions in this, and if I had enough reputation to add a 500 rep bounty I would.
An operating system is really a huge undertaking. There have been attempts to build a system to create custom OSs in C# called Cosmos, which I've considered looking into several times. In most cases though, applications probably would have to be specifically built for the OS. I may actually bother, now that you've reminded me.
Obviously, the result would not be Linux, but rather a custom OS built using Cosmos. That's probably the closest you can manage using C#.
So in summary: If your goal is to execute managed code on a machine at the most basic level, Cosmos is probably what you want. You will still be doing almost everything, but you'll have some insulation from the actual guts of the machine.
EDIT: Alternatives include Mosa, which does not use Visual Studio, and Singularity, which you can only use for research, but was produced by Microsoft directly.
The short answer is add this to your kernel command line:
init=/path/to/my/application
Typically the first process a Linux kernel will start is the init process. init takes care of running the startup scripts for everything else that needs to start at boot-time - e.g. kernel modules, daemons, console login/x desktop.
You can tell the kernel to use any userspace binary you like instead of the default of /sbin/init, as above, though you may still want some of the startup script to run.
Though more likely, you'll want to edit the startup scripts to just run one application (Is your application text or X-based?)
Alternatively you could hack the kernel to run your application in kernel space, and possibly never even start any processes. But that would be a nightmare to debug/maintain.
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 8 years ago.
Improve this question
Can anyone help me how to do UI Automation in WPF? I want to check the operation of a Grid.
If you just want to automate WPF and NOT WinForms, check out Telerik's free framework. There's also a paid version if you want more features like record-and-playback.
Two open-source C# libraries that support automation of both WPF and WinForms controls are:
White
I've used this, and found it to not always be reliable.
QAliber
I've used this, and found it to be good but needing work.
Both are open-source, so they'll show you how to use Microsoft's API's, and you can modify them to meet your needs.
I've also used Coded UI Test and Ranorex, but they're both $$, and I don't care for record-and-playback because I feel it's a maintenance issue. (Although QAliber does have a record-and-playback feature and White also has an alpha-quality recorder.)
Of course you could always go it directly from Microsoft's API's if you really want to get down and dirty.
Use the tools built into Visual Studio - Coded UI Tests:
http://msdn.microsoft.com/en-us/library/dd286681.aspx
There are two methods of doing this: Record and generate code (tends to be a good starting point, but often doesn't give you reproducible tests), and manually coding them up via UI object tree.
I ended up doing the second option most often, because I liked the code I wrote much better than what the recorder functionality offered.
You can try PROJECT SIKULI:
Sikuli is a visual technology to automate and test graphical user
interfaces (GUI) using images (screenshots). Sikuli includes Sikuli
Script, a visual scripting API for Jython, and Sikuli IDE, an
integrated development environment for writing visual scripts with
screenshots easily. Sikuli Script automates anything you see on the
screen without internal API's support. You can programmatically
control a web page, a Windows/Linux/Mac OS X desktop application, or
even an iphone or android application running in a simulator or via
VNC.
Here is a good blog post to get you started on UI Automation:
Silverlight UI Automation Testing using Prism 4.0
It's Silverlight based, but the Silverlight is very close to WPF, and the UI Automation concepts involved are exactly the same.
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 7 years ago.
The community reviewed whether to reopen this question 7 months ago and left it closed:
Original close reason(s) were not resolved
Improve this question
I maintain an old PC-only application written in Delphi 7. Although Delphi has served me very well in the past I now only use it for this one application and find my skills with the language diminishing. Its syntax is too different from my 'day job' languages of Java/Ruby so it takes me longer to get into the groove of writing new code, plus it is so old I have not used many interfaces so the code is not managed which seems ancient to me now!
Many of my users are moving to Vista which may run the app in compatibility mode or may have GPF problems depending on how their PC is configured by their IT department, so I have to do some maintenance on the application. I'm wondering if I should jump to a more familiar stack.
Is there an automated tool that will do the legwork of converting the code base to C#, leaving me to concentrate on the conversion on any non-standard components? I'm using an embedded database component called AbsoluteDatabase which is BDE compatible and using standard SQL throughout, and a native Delphi HTML browser component which can be swapped out with something from the Microsoft world.
How good are these conversion tools?
I am not aware of any automated tools for making that conversion. Personally I would suggest you stick with Delphi, maybe just upgrade to a new version. I have seen a couple code DOM's that attempt to convert from Delphi to C#, but that doesn't address the library issue.
CodeGear (formally Borland) has a tool for going from C# to Delphi that works OK. I would assume the tools that go the other direction will work the same (requiring a lot of editing). Here is a Swedish tool that works on the same CodeDOM principle to go from Delphi to C# (and a number of other languages). There are others, I just can't find them right now.
Another option would be to upgrade to a more resent version of Delphi for .NET and port your code to .NET that way. Once you get it working in Delphi for .NET (which will be pretty easy, except for the embedded DB, unless they have a .NET version) you can use .NET Reflector and File Disassembler reverse the IL to C#. You will still be using the VCL, but you can use C# instead of Object pascal.
Another similar solution would be to port it to Oxygene by RemObjects. I believe they have a Delphi Win32 migration path to WinForms. Then use .NET Reflector and File Disassembler reverse the IL to C#.
In short, no easy answers. Language migration is easier then library migration. A lot of it depends on what 3rd party components you used (beyond AbsoluteDatabase) and if you made any Windows API calls directly in your application.
Another completely different option would be too look for an off shore team to maintain the application. They can probably do so cheaply. You could find someone domestically, but it would cost you more no doubt (although with the sagging dollar and poor job market you never know . . . )
Good luck!
There has been a scientific report of a successfull transformation of a 1.5 million line Delphi Project to C# by John Brant. He wrote a Delphi parser, a C# generator and lots of transformation rules on the AST. Gradually extending the set of rules, doing a daily build, lots of unit tests, and some rewriting of difficult Delphi parts allowed him with a team of 4, among which some of the original developers, with deep Delphi & C# knowledge, to migrate the software in 18 months. John Brant being the original developer of the refactoring browser and the SmaCC compiler construction kit, you are unlikely to be able to go that fast
Many of my users are moving to Vista
which may run the app in compatibility
mode or may have GPF problems
depending on how their PC is
configured by their IT department, so
I have to do some maintenance on the
application. I'm wondering if I should
jump to a more familiar stack.
Unless you are doing something non standard, D7 applications should run fine in Vista.
As for conversion to C#, I would think that most conversion tools would be a waste of time. A better approach may be to rewrite the application from scratch.
There is no easy answer, but bear in mind that the Delphi.net variant of the language targets the .net runtime, and that different languages on .net can interoperate closely.
You could try getting it to compile in Delphi.Net, factoring into different assemblies and then converting the assemblies by hand one by one. Reflector could help be reverse-engineering compiled code into a skeleton of C# code - equivalent but without comments, internal variable names etc.
On the other hand, Delphi.net may be good enough (TM) for this project.
But unless you have a good test suite (I'm guessing probably not, given the state of the art in Delphi 7) you're going to introduce bugs.