Is it possible to write a Windows service entirely in node.js? - windows

I'm experimenting with using node.js beyond the server as a general-purpose scripting and application programming language.
One project on my TODO list would be a Windows service so I'm considering tackling it with node.js
I believe I have seen some kind of Windows API bindings for node.js but I don't know how complete or mainstream they are. (I'm willing to contribute!)
What would it take to implement a Windows service in node.js? (Trivial example appreciated.)

You should be able to do this very easily using Winser.

Try node-windows. It's similar to WinSer, but has more options.

Related

Fastest/easiest way to build a WebKit based Windows application?

I am a web developer. I don't know how to build native Windows applications. I recently built a Mac desktop application (using MacRuby) which is a WebKit wrapper around one of my web applications. I'd like to do the same thing for Windows (preferably in Ruby, but whatever is easiest).
Since this is not the core of the application, I'd rather not spend a lot of time trying to build and maintain it. I just need a Windows application that can:
Open a specific website on application launch using an embedded WebKit WebView
Trigger Growl notifications via JavaScript (with some sort of named bridge)
What is the easiest, fastest, cleanest way to do this?
Update: So far I've come across some frameworks like Qt and Awesomium. I don't know how these frameworks compare to other options available, so if you have any opinions or advice, I would appreciate it.
Check out http://appjs.org/ it's built with NodeJS at its core! And it uses chromium webkit at it's core :D
Well, this is a very old question, but if you are still interested...
I'd recommend Qt. There are some very good books available with a lot of boilerplate code and wizard-type tools. You will be able to find example code demonstrating the embedded Webkit that you can modify to suit your needs. It is free and redistribution is free (last I knew). You won't have to know anything about native Windows development, nor even use any native Windows dev tools.
Good luck!

why use Google V8

I don't get it. I'm a C/C++ programmer, what's the possible use of V8 for me? There are few examples and tutorials out there, and they all lack substance - I don't want to use another library to just add a couple of numbers or print something in a console window.
My question is: is there a real use for this technology, and if yes, then would be the scenario?
Also, can I do any part of GUI this way?
Help is appreciated.
"V8 is Google's open source JavaScript engine"
So the whole point is ability to write code in JavaScript, and run it quite fast (for an interpreted dynamic language). Google Chrome, which is written in C++, uses it for internal scripting — not only for regular web page scripting, but also for extension code. Let's consider this as a 'real use'.
So, if your app needs scripting, V8 may be good for you (JS is not a perfect language, but stil quite decent). As for GUI, you'll need to bind your GUI components with JS first, there's no built-in UI components (as Tk in TCL).
One real use of v8 is node.js. I hope that is good enough
Google V8 is a JavaScript engine.
I don't really think it is what you are looking for.
V8 is a JavaScript engine. The most common use for it is to allow users of your software to write scripts in simpler language than that your software was written with (C++ in your case).
It´s the same approach of Matlab, AutoCad, Microsoft Office, and etc.
If you write any kind of commercial application, you can expose some APIs and allow other developer to create addons for your applications without require them to know C/C++.
How about this for real use: You can use javascript as a debugging or testing tool - add a javascript console to your app and bind the commands of your GUI application to javascript functions, and you'll be able to test your UI application using javascript scripts. This way you'll reduce the amount of manual testing needed - manual testing would only have to verify that a correct command was excutes as a result of user action.
You can do GUI in javascript the same way that Qt is being used in Python and other scripting languages (see PyQt, and QtRuby, PerlQt, etc.). For how to create bindings for V8 you may want to check out this

Is there any alternate way to supply similar functions as COM does?

Window's COM allow us to wrap our application function for out-of-process invocation. If the COM interfaces are well defined and design, it is certainly great to consume the services via scripts and any programming platform that support COM/Automation/Active-X.
I am just wondering if there exist any alternate methods to design of what COM does? Or something close or similar methodology?
I am using Delphi in Win32 platform.
I'm not entirely sure, but it seems that you're talking about an alternate to COM for creating plug-ins for your software?
If so, there are myriad options:
TMS Software's Plugin Framework
RemObject's Hydra
Project JEDI's JVCL includes a plugin system
You can also roll your own. I wrote an article many years ago that provides the fundamentals (though the linked source is long since gone to the great bit bucket in the sky).
Corba
or
IBM's SOM
I'm sure there are others as well but those are the 2 others i can think of off the top of my head ...
If you want a TCP/IP (over the internet or over a LAN) interface for your objects, consider SOAP, and REST.
If you want to write plugins for your delphi app and not use COM/OLE-Automation, consider RemObjects SDK.

Can Ruby be used to develop simple Windows applications?

I've been developing Windows based applications for a long time and most of my present clients still desire a desktop or client/server Windows application. Is it possible to use Ruby for such applications as opposed to its primary purpose of being a Web-programming language?
Ruby is not primarily a web programming language even though Ruby on Rails is certainly suited for web development. Ruby is a general purpose scripting language.
The FXRuby and WxRuby frameworks are the most fully featured GUI frameworks for Ruby. You can write the apps in Ruby and then generate a Windows executable. The frameworks are cross-platform, so you could also run the apps written in these on other platforms, like Linux or Mac OS X.
There are also a few other less popular approaches like QtRuby and Shoes, and you can even use IronRuby (a CLR Ruby implementation) to write a .Net application.
Ruby is a general purpose object oriented scripting language. Ruby on Rails is a web application framework. Ruby predates Rails by about ten years. Don't confuse the two.
Yes, you can. Ruby is a full scripting language. You might want to start with the Ruby language homepage to see the capabilities and libraries that are available.
However, just because you can doesn't mean that you should. Before jumping in and using Ruby for a project, see if Ruby can give you things that other languages can't or if there are any disadvantages to using Ruby.
I know this thread is old, but for future reference to anyone who's looking into options for using Ruby for a GUI app, don't use QtRuby. I had developed a project for school in about a week, fully functional and pretty, only to find out that I could not release it. There was simply no way to package and distribute the application without having your users simulate your exact environment (install all the gem dependencies, build Qt development libraries etc). I tried using:
Crate: supposedly cross-platform, but I found only 1 usage example that's written in 2008 out of ~2 hours of googling, and the example basically covers a very specific subset of applications (some ssl/https authentication gem or w/e...)
Ocra: this looks like a candidate, but it's windows-only and didn't meet my requirements, as I had to target the three primary platforms
tar2rubyscript + rubyscript2exe: I had spent most of my time trying to get this to work because I've come across many who claimed that this is the way to go for distributing GUI apps built in ruby (albeit using other toolkits, Tk/GTK/wxRuby) but it didn't work either; I was endlessly faced with a cryptic error that basically breaks Qt::UiLoader functionality, in other words, you can't load .ui sheets you create with QtDesigner so...
Yes I'm angry and frustrated honestly, because I don't see the point of creating software that you just can't release for anyone to use. Now I'm left with a deadline coming up in a week, and I just hope I make it in time porting the app to C++.
So my answer is, don't use QtRuby. At least for now.
On a mac, you can use the Ruby Cocoa lib to create (what appear to be) native applications. If you want something more cross platform then you might consider a wrapper like shoes or qt.
The Qt toolkit seems the most popular way to do it. The website is http://www.darshancomputing.com/qt4-qtruby-tutorial/
I'm currently writing a little app in a wrapper called Shoes. This seems to make it as simple as pie to create windowed apps in ruby. http://shoes.heroku.com/ is the website.
At the moment Shoes looks suitable only for small personal apps. I say this because it's author recently went AWOL and it's not clear whether it will be developed further. I'm using it to write a game log parser to generate statistics from a flight sim. It's ticking along nicely.
Ruby can be used for developing GUI applications, whether Windows specific or cross-platform.
For Windows targetted you should look at the work going on with IronRuby since they have good integration with the .NET framework overall and with Silverlight, in the event you want to do apps that can bridge web and desktop. At this point IronRuby can be used to develop for Windows Presentation Foundation (WPF) or WinForms.
For cross-platform you have Ruby bindings for QT, FOX and others.
You should look at IronRuby - WPF and windows forms are both supported:

How do you port a Windows-based application written in Delphi to different platforms such as Mac, iPhone and into a web-based application?

Currently, it is just a windows-based application (slowed down guitar software) written in Delphi. However, I do have plans to port them to the following platforms :
Mac
iPhone
Web-based
How do I go about this? What is the bes programming language to use? What kind of developers do I need to look for? And how long will these projects be?
If you want to keep the Delphi code, then take a look at Lazarus/FreePascal. I have to say that I don't have used it for more than a Hello World yet, so you have to evaluate yourself if it can help you, but it's free and it supports Windows/Mac/Linux. Windows Mobile is also supported.
For 1 and 2 you'd be looking at Cocoa, for 3 you could either go Flash/Java Applet/Silverlight depending on how complex the software is. Obviously Flash would not be the best to use for large projects. But Silverlight and Java Applets are capable platforms that can suite just about any need.
I'm afraid you can not simply "port" Delphi code into all those enviroments. Ok, moving Delphi logic via Delphi.NET to web based may be simple, but using delphi code for Mac or iPhone... Harder. Probably you will have to rewrite it from scratch, most probably in Java.
Thanks for that. I was already thinking along those lines. Yeah, I am thinking of dropping Delphi for the Web-based and start from scratch for the web-based because I have heard so much of the power of Java. Although my only constraint is the whole Delphi (windows) application will be put to waste, especially now that its being enhanced on some features. Aren't there some codes in Delphi that can be salvaged for Java?

Resources