Prevent my node.js app to be killed by the OS - javascript

I m creating a web tv on a Raspberry Pi
Since the RPi will not always be connected to the net, I need to download the file it will have to play before playing them.
I can download the file, but when I m starting too much download, either by starting them all-at-once or one after another (wich take a lot more time), my app end up killed by the linux system.
Is there any way, in javascript, in node.js, in bash or by editing my algo, to prevent the app from being killed?

as I commented ...
Look inside system log files (e.g. /var/log/messages or /var/log/syslog, or the output of dmesg command) for messages relative to your application (or to the node.js processes). You may have gotten out of resources....

Related

use Genero Shortcut By Html

I have a question now because IE was not maintained after 2022/6/15 also as the ActiveX
We have the ERP system only can use ActiveX By GDC(Genero Desktop Client), But now it can't use.
I google for it and found that I can create a shortcut By GDC, than export the shortcut on my desktop, that I can double click the shortcut to run my ERP system not using any browser(IE、chrome、EDGE...etc)
Now I want to create a webpage include this shortcut, let my co-worker can click the button on the webpage to run ERP system
If I use href to call the chortcut, it always show 404, but on the server I can double click shortcut to run the ERP system.
Can anyone tell me the problem or how can I do for it?
(ps. the shortcut like xxxx.gdc)
Thank you for your Reading, if anything I missed Please tell me
You don't state the Genero version you are using but given the use of ActiveX it is probably an old version.
The GDCAX (Genero Desktop Client ActiveX) version was deprecated with the release of Genero 2.50 in November 2013 (http://4js.com/online_documentation/fjs-gdc-manual-html/#gdc-topics/c_gdc_MI25x_250.html). This was coincident with Microsoft treatment of ActiveX. If you were still using GDCAX from version 2.40 or earlier you are missing out on 10 or more years of development. This is the equivalent of continuing to run iPhone 4, Android 4, Windows 7 or earlier.
Genero including both the Genero Desktop Client (GDC) and the Genero Web Client (GWC) (now renamed Genero Browser Client (GBC)) has continued to be maintained and developed since then with releases every two years.
The documentation for current supported versions can be found here https://4js.com/download/documentation/. For older documentation, look for the section Archived Releases on the right.
The standard GDC is an executable (Windows, Linux, OSX) that sits on the users workstation and communicates to the fglrun Genero process on the back end server.
When referring to "shortcut" you need to distinguish between GDC shortcut and Desktop shortcut.
The 'GDC shortcut' is the instructions to connect to the back end server and start the fglrun process using the GDC to render it on the front-end.
This can be configured as a 'Desktop shortcut' which can be placed on the desktop, this will start the GDC executable and then initiate connection to the back end server. (just the same as clicking on a Desktop shortcut for an Excel spreadsheet will start Excel executable and open the spreadsheet). If you are putting a link on a webpage expecting it to start the GDC executable this is where you are starting to go wrong, see plenty of stack overflow posts such as Open an exe file through a link in a HTML file? on why you can't start an executable from a web page.
If you want to run a Genero application in a browser you should be using the Genero Browser Client or what was probably the Genero Web Client in the version you are using. The URL used in the GDC-AX configuration was pointing to the Genero Application Server (GAS) and to an .xcf file. (This URL probably would be of the form .../wa/r/... , the bit before the /wa/r/ helps to find the web server and application server, the bit after the /wa/r/ finds the application .xcf or entry in the .xcf configuration file. What you probably need to do is point to a different application, one that is configured to use the GWC and not the GDC.
Have a look inside FGLASDIR/etc/as.xcf. Find the entries '<APPLICATION Id="gwc-demo" ...', '<APPLICATION Id="gdc-demo" ...'. These both start the demo program, one using the GWC, one using the GDC. So just as your ActiveX could be configured .../wa/r/gdc-demo to start the demo program in the GDC, you could also type .../wa/r/gwc-demo into a browser to start the demo program in the GWC, the difference in the <APPLICATION entries being the value in the Parent node which point to different OUTPUT nodes GDC-AX vs GWC.
So find the URL in your ActiveX config, find the entry it is pointing to in your GAS config, either inside the main .xcf or it has its own .xcf, and then create a new entry in the main.xcf or create a new .xcf that uses GWC and not GDC.
Your Four Js support contact should be able to assist you in this.

Play game developed with HTML5, CSS and JavaScript without an internet connection

I have developed a game using the technologies mentioned above, however I would like the game not to need a web server to play it, but to run as if it were a desktop application.
I have read that with node js you can create a local web server and with that to run the game, but I don't know how to achieve it.
The idea is that the game has an icon on the desktop and after executing it, it can be played, that is, everything is integrated and the person who has the game does not need to download external programs such as xampp.
Final note: is this possible for smartphones?
Your best bet is ElectronJS, it is a NodeJS library that lets you package browser code as a desktop app. It works for macOS, Linux, and Windows.
Website: https://electronjs.org
Edit: Also once the app is packaged and in your computer you won’t need an internet connection. Final note, it turns it into an actual app so like app for macOS and exe for windows. So they won’t need a web server on their computer to run it.

Discover local webservers from JavaScript?

I want to set up a bunch of raspberry pies that each run a webserver, and then allow people to simply go to a website on their laptop and get an overview of all of these raspberries on the network (and then of course they'll be able to do stuff with them by calling the web server).
Is it possible to set up the raspberry pies in such a way that they are discoverable on the local network from JavaScript? Without the need of a server? Or is this only possible from native apps?
Allow devices an access to your local network (Just Google OSX local network port, Raspberian network access)
Then use any discovery library that you want.
I'd suggest using something like Cote NodeJS (easly runs on raspbery and any device) - it discovers any other process running cote on local network automaticly;
You can also build your own discovery script or just configure in advance
You could install node.js on your raspberry pies and install socketio on your pies. Then you could simply interactive with them from the client side

want to disable / enable usb3 host controller

Looked here first on how to do that and found a lot of references but not up-to-date (windows 10)
Tried "net start usbstor" but that is not supported it seems.
It appears I need devcon.exe which is part of a huge windows 10 sdk download includeing visual studio
This is my problem, maybe there is another solution:
I have a number of USB 3 external drives they are not used all the time so they go to sleep (the drives, not the computer). This is fine but occasionally one or more of them never wake up when I tried to access them. They are on a server and I access them through the file manager on my desktop. When they do not wake up I have to use remote desktop to run "device manager" and disable "Renesas USB 3.0 eXtensible..." and then enable that host controller. Immediately, all the sleeping drives wake up. I would like to run a program from the command prompt preferably from my desktop and not have to log in using splashtop or VNC. From googleing it seem devcon needs to be on that server.
Maybe there is a service I can start or stop remotely? I did not see usbstor listed as a service.
Thanks for looking!
[EDIT] Wanted to to follow up on this post. I read harvey263 suggestion but I decided I wanted the disks to sleep as they are used rarely and I have no interested in buying a 2TB replacement disk anytime soon. However, I did want to post about that devcon program. I was unable to located the device kit for win10. It was not in
Directory of C:\Program Files (x86)\Microsoft SDKs
after downloading a huge amount of stuff I did not need, but I discovered that splashtop remote (or server which I already had in all my systems) includes devcon support in its free download and the program is tiny and easy to install. I did have to move their devcon support from
C:\Program Files (x86)\Splashtop\Splashtop Remote\Server\Driver\Monitor\utils
into my personal download directory as I wanted to execute it upon login and I could not do that from the task scheduler on account of permissions or authorizations. For example, I put
devcon64.exe remove "PCI\VEN_10DE&DEV_026D*"
devcon64.exe rescan
into a task executed once on startup and it disabled the USB controller connected to the drives and then re-scanned, reinstalling the driver and wakening the drives. It also removed the yellow bang that was always on the driver every time I rebooted.
You might be able to alleviate the sleep issue by changing the USB setting in Advanced Power Options (control powercfg.cpl,,1). I think "selective suspend" is normally Enabled by default.
For devcon.exe you only need to download the Windows Driver Kit. It's not that big and you can copy devcon.exe out to run standalone and uninstall the rest if you want. I have scripted devcon to "re-enable" a device like this:
devcon disable *ROOT\NDISVIRTUALBUS*
timeout /t 5 /nobreak
devcon enable *ROOT\NDISVIRTUALBUS*
You could put this in say "\\RemotePC\c$\Scripts\EnableUSB.bat". Then call it with psexec like lit mentioned:
psexec \\RemotePC cmd /c ("C:\Scripts\EnableUSB.bat")

Running complex web apps locally

I downloaded a chat template online called shout. When I upload the chat template to heroku, it works fine. However, when I simply doubleclick its index.html in my local browser, it doesn't work. The page refreshes every milisecond. Is this an error specific to what I downloaded, or this is a common phenomenon? If so, is there a way around it?
You need to start a local server to do the http requests.
If you are on a PC download mamp:
http://www.mamp.info/en/
If you are on OSx check out tutorials by the coolest guy on the planet blog:
http://coolestguidesontheplanet.com/get-apache-mysql-php-phpmyadmin-working-osx-10-10-yosemite/
Nothing is wrong with your browser or computer. Based on the language of that chat template, you need to run a server on your local machine to test your app in localhost environment. Most of the popular languages like PHP, Java, ASP, etc run fine on XAMP and WAMP. Just google for one of them, install and voila, you have a server running. Then you can open the index.html as usual and get it working like on Heroku.

Categories