Grouping child processes in node-webkit or atom/electron - node-webkit

I am doing some research into building a cross-platform desktop application using web technologies. Both node-webkit and electron/atom would be perfect for the job.
However, with it being a multi-window app, my clients aren't too keen on the vast number of processes which chromium creates (2 per window).
I've looked into passing some different command line switches, --single-process and a few others but they only seem to cause the app to crash on startup.
I then looked at node itself, the closest i got here was the process API exposes methods to set the group PID. Alas, this is unsupported on windows which is my primary target platform.
I don't know if you've ever googled "hide process from task manager", it's starting to look a bit scary and deep-webish. there must be an easier way.
Does anyone have some suggestions or maybe a different technology?

This isn't possible, sorry! The code that allows single-process in Chromium is busted and bitrotted

I've been dealing with the same issue and can confirm that as of Electron version 1.4.10 the --single-process flag is still crashing the app.
I ended up using --process-per-site. It groups the processes per web site/domain. If you are using Angular in your app (with the same index page), all Browsers will be launched with the same process.
https://www.chromium.org/developers/design-documents/process-models

Related

How to test/debug cross-platforms desktop apps(Windows, MacOS) with limited resources

I am trying to build a desktop app.
I am thinking of using electron on the recommendation of a web-developer friend of mine, but as I am the only sole developer, I don't have the means to test the software on different platforms(OS, hardware etc.).So I am anticipating that this will cause a problem later, in the end, to test/debug software on different platforms and different OS.
I have ruled out web-apps because of some privacy concerns of the users for the remote data hosting.
Software is pretty lightweight and is almost equivalent to the image viewer apps with some slight modifications.
How to solve the problem of variations of different platforms?
Any literature suggestions pointing me in the general direction are also welcome.
Sometimes it helps to think of Electron as two processes.
The renderer vs the main processes. Generally the renderer process which runs the HTML/CSS/JS is it's own isolated component, and you communicate to the main process using IPC.
So generally for the UI, you can use mostly any web based testing framework to test reliability. At Amna, for example, we use Cypress as our E2E testing platform. You an also use something like QAWolf. Both should work with localhost. In general, most website testing tools should work fine, and consistently across platforms.
Where this gets tricky is when a UI functionality makes a call to the OS or the main process. For example, saving to the disk, or launching a program.
The general flow is this, and I've yet to find radically simpler options:
Set-Up a VM or buy a machine with the corresponding OS. I used Spot VMs in Azure for this.
Manually test the scenarios you care about in each VM before you ship
If you have a lot of cases that rely on the OS, then you should be able to further optimize this by using an automated test runner like Spectron.
From experience, what I've realized is that most of the iterations I do happen more on the UI than the underlying functions with the cross-platform capabilities. And if your code has good separation (e.g. contextIsolation:true, nodeIntegration:false), it should be pretty obvious when you need to do an entire "cross-platform" test vs just UI tests.
I'm not familiar with a lot of large-scale electron testing frameworks, I do know that ToDesktop handles package building and generating binaries to perform a smoke test and verify things open across different operating systems.
It depends.
The answer depends on what you are building, so it makes sense to figure out what you actually want to build. Some questions you might ask yourself:
Do I need a database?
Do I need authentication?
Do I need portability?
Do I need speed to market?
Do I want to pick a language I'm familiar in?
These are all good questions and there are dozens more we all ask ourselves. However, back to your original question.
Electron is a fine choice
Yes, there are alternatives. But Electron is used for Visual Studio Code, Facebook Messenger, Microsoft Teams and Figma. Choosing Electron means there are other developers making apps and there are proven apps in the market so you don't have to worry about a dead ecosystem.
Electron is easy to onboard if you know web technologies, think js, html and css. If you know these, you can transfer your web dev knowledge and make a cross-platform app. You don't have to worry about learning each OS since the UI is the webpage which will look mostly* the same between each OS. (*some very minor differences, but essentially the same).
Cross-platform deployment is easy
There are a few ways of bringing your app to multiple platforms, I happen to be most familiar with electron-builder, but the other two solutions work as well.
Many templates to start with
I am biased, since I'm the author of secure-electron-template which is one of the many templates you can choose from when starting an app. However, I recently reviewed all Electron templates and found that only 4 do not have serious security vulnerabilities.
The Electron framework frequently is updated, and over the course of the past few years there has been a shift in the way Electron apps are made. Some earlier frameworks didn't have good secure defaults which some of the older Electron templates inherited and thus, aren't as secure as new frameworks that follow security guidelines.
If you decide on Electron, give my template a try. It's got a number of features I'm building out in order to help the community with features they might want (ie. internationalization (i18n), saving local data, custom context menus, page routing, e2e unit testing, and how one can use license key validation, to name a few things).

Inconsistent rendering results with Mobile site in IE10

I'm in the process of developing a Mobile version of some websites using the MVC4 *.mobile.cshtml system.
Everything is working great except when I try and view the sites on my HTC 8x. I get an outrageously large viewport, no javascript executing, offline touch regions and all-around incomplete pageload such that it doesn't function at all. I'm trying to diagnose/debug and not having any luck.
Using IE10 locally with a User Agent string for Windows Phone 8 doesn't show the same behavior. Further, using my exact UA string in any browser locally does not replicate the behavior. I've tried the various viewport workarounds posted on the internet and those have had no impact either.
I'm not on a Windows 8 machine, so I can't install the SDK/Emulator, but I suppose I could upgrade if no other options present themselves.
Anyone have any additional ideas as to how to test/diagnose/replicate this? I've been Googling for days and haven't been able to find any significant resource about this sort of thing.
This was a combination issue with Output Caching and the MVC DisplayModes bug.

Can we package our existing HTML5 JS App for Windows 8

I have read some posts on S/O and also around the web. We are producing a HTML5 JS based web app that runs on the web. We are packaging it up for Google apps, and also for phonegap.
Can we package this app for windows 8? Of course, I appreciate it won't use the windows 8 features. But, will the app run none the less, as it stands. So that we can place it in the store and build out windows 8 features as we move forward.
I appreciate this is a slightly non-concise question, but I guess the real point is what is our quickest route to take our existing HTML 5, CSS, JS App and deploy it in the store and get it working on this platform.
In general, the answer is yes. The transition is not seamless, but you will be able to use a ton, if not all, of the application artifacts in Win8. A good test is if you can run it in IE10, you can run the app as a Win8 app. Again, this is a very broad brush - things you need to worry about are things like all scripts files need to be local (no CDN), changes to web and security contexts, and the fact that Win8 is a horizontal paradigm whereas most web apps are vertical. But in general, you should be able to make the move. Usual caveat - your mileage will vary.
Yes, although not recommended, you can package your existing app for Win8. You'll need to add a few bits of code though. The minimum would be to embed your app's start/init code within WinJS's first promise callback, like so:
args.setPromise(WinJS.UI.processAll().then(function () {
// your init code
}
You'll also need to create a couple of icons for the start screen and an image for your app's launch screen.
It is possible that you'll run into a few issues, like some security related restrictions, where you'll have to modify your code to use some native WinJS functions. This all depends on you app's implementation.
You can also check Microsoft's guidelines for migrating a web app to win8, here: http://msdn.microsoft.com/en-us/library/windows/apps/hh465143

Is there a decent, standalone, cross-platform webserver that will work in concert with Autorun on USB Jump Drives?

I'm trying to find a decent standalone webserver that I can load up on a jump drive.
My wife is a photographer, and I'd like to present the clients with their images on usb. When they plug it in, I'd like a web page to load up, and run some jQuery magic to show them a nice carousel of all there images.
So far, this is all fine since it can all be done client side and doesn't need a server at all.
The problem I'm facing is that I'd like some server-side code to be able to read the images out of the directory so that once the interface is built, I don't need to manually create all of the <img /> tags.
If it was primarily going to be used in a Windows environment, I'd have no problem going with IIS Express, since I'm mainly a .NET MVC developer and this would be perfect for me... However, the fact of the matter is that a large amount of our client base is also OS X users.
I did find this Java one jlHttp, and I also found this thread here on SO, but I don't think I understand enough about either one of them to accomplish what I'm looking for.
Thanks in advance for your suggestions.
I'm looking for the same thing, and the two best options I've found were Flying Ant cd web server and Stunnix. Of the two, Flying Ant is cheaper, and I've tested it with success on my project.
I found Mongoose very convenient for this exact purpose. It's crossplatform, lightweight and requires minimum configuration. You may be interested in this project that uses Mongoose to display pictures in a folder tree or FTP directory.
How about Node.js
It says it runs on Linux, OS X, and Windows.

What is the easiest way to install a R web application through RApache?

I use windows XP and R for my desktop use. And a shared hosting account (at some company) for my web hosting needs.
I wish to create an R web application and I understand that one such way is by using R with Apache through RApache , but since my current shared hosting plan doesn't allow me to install RApache I am a bit stuck.
So... (and here's my question) what would be the easiest/fastest/cost-effective way to get started?
Buying a more expensive hosting package ?
Hosting the thing myself? (on windows ?!)
switch to some other hosting company that permits the use of RApache?
Any suggestion will be most helpful.
Self-hosting is an option if you insist on using RApache. This might be easier than you think. Here's a link to a blog post i read a month ago before i decided to buy the hardware and server my own files. i just watched this seven minute YouTube video tutorial entitled "R Web Application–'Hello World' using RApache" I believe this was just posted today.
In seven minutes, the author walks through building a "hello world" Site using RApache then walks through a more ambitious example, building a user-input form to collect inputs then deliver them to a particular R function--pretty much a exemplary slice of what i suspect most people would want to use RApache for.
A second option is using a web framework. My recommendation here is Django. Why? It's written in Python so you can access R functionality via the python bindings (RPy2). Second, if you are not an experienced web developer, Django is in many ways, a great framework to begin with because it's truly a "full-stack" solution--it works more or less out of the box. In addition, there is a substantial and growing body of quality step-by-setp tutorials, code snippets, and even packaged django Sites, to learn from.
it seems they provide a VMWare image to get up and running quickly.
I suggest you download VMWare player and try the image. Since RApache isn't available for Windows, this is the most simple way, I guess. I wouldn't use that for hosting, but I would first try whether this stack is actually the right thing for your app. Also, this allows you testing things locally.
Doug,
Should I read your suggestion as saying that a Django app can call the RPy2 functionality without RApache? If so, that sounds like a solution for folks on shared hosting who can't install the RAPache module.