Node.js - Writing an image to a USB/SD on Windows - node.js

So I've written a program in Electron that will download the latest version of our image and then write it to the selected device.
I've got this working fine for Linux and OSX as I'm able to call a sub process and just run the dd command directly.
My issues come when trying to make this work on Windows, I've not been able to find a node package that does dd or something similar, and natively writing it for Windows doesn't want to work due to the chaining of commands etc.
Does anyone have any suggestions? My next idea would be to write a .bat script that is called by the sub process and try to do it that way. However if there is a platform universal approach with node that would be ideal! Thanks.

I wouldn't start rolling my own approach for this using Node.
Rufus is the current go-to app on Windows for burning images to various media. It has limited command line support – the author says you should try rufus -h to see what's possible.
There's also Etcher CLI, which is "experimental, proceed with caution and report issues". (Also, the Etcher GUI is actually an Electron app, so you might want to peek into what it's doing. https://github.com/resin-io/etcher)
Hope these help.

Related

libVNC implement remote desktop

I am trying to implement remote desktop server using libvnc, I have downloaded the libvnc and build the library and able to run sample code. And in the example code I can see the function rfbGetScreen http://libvnc.github.io/doc/html/libvncserver_doc.html which display plain background not the desktop. Does that mean I have to find some other library to get desktop and share using vnc, or vnc has some inbuilt function to do this.
it does seem so. You need to put into rfbScreenInfoPtr::framebuffer screenshots. I've never saw any inbuilt functions yet. May be I've poorly searched.
Try SDL2. May be it will help.

I wonder if this is Python IDLE

At first, I'm not good at English but I'm doing my best, thank you.
I connected Amazon Lightsail and installed python36.
It is the list I installed.
python36.x86_64
python36-devel.x86_64
python36-libs.x86_64
python36-pip.noarch
Then I entered shell as shown in picture below after typing 'python3'.
At https://realpython.com/python-idle/#what-is-python-idle, How to Use the Python IDLE Shell's first image, it looks very similar to the image I uploaded.
So I think it is Python IDLE but I'm not sure yet.
Because at https://www.centos.org/forums/viewtopic.php?t=53908, 'python34-tools' contains idle3.
What? I'm not installed 'python36-tools'!
I installed 'python36-tools' and typed 'idle3' but there's an error, 'command not found'.
Even according to https://centos.pkgs.org/7/puias-unsupported-x86_64/python36-idle-3.6.6-1.sdl7.x86_64.rpm.html, it is definitely Python IDLE!
What's the right thing? I'm so confused.
I wanted to know more, so visit https://docs.python.org/ko/3.6/whatsnew/3.6.html and find this, 'The IDLE features formerly implemented as extensions have been reimplemented as normal features.'
It can be translated like this?
'Starting with version 3.6.3, you don't have to install idle3 separately. Just type python3 for use Python IDLE.'
I searched the information related to the above and couldn't find anything.
Please help me!
IDLE is a GUI application, with menus and windows. So you need to use a Linux/macos/windows desktop environment, it does not run in a terminal window.
It actually looks like this: https://www.youtube.com/watch?v=bOvqYw1SZJg
It starts in a standard python interactive shell, such as your screen shot.
But being a desktop app, it allows you to have multiple editor windows open with source files, and it has GUI debugging tools. IDLE is rudimentary, but also very simple (which can be a good thing).
I think there is a lot to be said for learning python in a real desktop environment, with multiple windows and friendly, easy to use debuggers.
There are cloud IDEs for python, but I don't think they are a good step for newcomers. The debugging is not very good, for instance.
However, jupyter is a good option for learning python, I think.
E.g.: https://realpython.com/jupyter-notebook-introduction/
Jupyter runs a webserver and you edit python in interactive workbooks which you open in a browser. I suppose it is a cloud IDE.
This is a short video of running it on Windows ... https://www.youtube.com/watch?v=jZ952vChhuI
jump to about the 2m mark to see it running.
To be honest, it is arguably a better place to start than IDLE.You could run the server part of this from lightsail, but you will probably need to configure your lightsail instance to open the ports needed to server jupyter's web pages.
But if you want to start with IDLE, you need python running on a desktop. A linux desktop is a very good choice. You can set up a desktop linux, such as ubuntu, in virtualbox if all you have is Windows.
However, if after all of that, you are going to do python from the command line, you should learn about
* virtual environments
* once you set one up, do pip install ipythonto get a better version of the python shell.
As others said, python3 on a non-Windows command line starts python in interactive mode. To start IDLE on a command line, use python3 -m idlelib.

run Python script program-like

again a beginners question...I got a Python 3.5 script i want to run on a windows server. I found that thread and some links like this one but stil are not clear.
I got my sript on my laptop and I am importing some packages like boto3 from AWS. Now I want to execute on a windows server and also have an option to stop it.
My script has a thread that is running in an infinity loop until some break conditions occur.
How to package my "program" so I can run it on the server right away without using pip to install all the packages I imported?
Should I turn my thread into a deamon?
How to add a start/stop automatic? I think once Python is added to the path a doubleclick can start it or u are using a bat file to call it...but how to stop it?
Can someone outline the steps I need to perform?
Referring to your first question, I would recommend you to look into Docker. Docker is a containerization technology that makes it easier to run your software on any OS. It also "orchestrates" the installation of your dependencies by building an image so that you don't have to it manually every time. See https://runnable.com/docker/python/dockerize-your-python-application

linux or windows terminal over the web

I'm planing to make a web app which will allow you to have a Linux Terminal on a web page so that you can execute any command an get the response as if you were in front of your linux terminal.
I planed to use NodeJS as it is server side JavaScript, asynchronous and fast.
Also I saw this wich does exactly what i'm trying to do, I peeked in the source code, but didn't found something useful, I also analysed it with google chrome developer tools on the network tab, but there is absolutely nothing even while executing some commands and getting responses. How is this possible ? what technology do you think they used ?
So I wanted to get your advice, your experience in order to start it the right way.
I firstly decided to use NodeJS, but if there is another programming language or Framework more appropriate for this kind of application please let me know.
If you want a real terminal in the browser using node.js on the backend, you might give tty.js a try.
Alternatively you can use the pty.js module manually which is used by tty.js. Along with that, you could also use xterm for doing the browser-side terminal emulation.

Linux application project for zynq7000 in the Xilinx SDK

I'm trying to create a Linux application to run on my Zynq7020. However I don't understand how the Xilinx SDK generate the executable file.
When I create a hello world, for instance, it creates one .elf file and under the debug it creates one object (.o) and one dependency (.d). I want to run it under the Linux that is running on my board, how do I do it?
Thank you very much.
I want to run it under the Linux that is running on my board, how do I do it?
Most likely, you just need to copy/download the .elf file to your target board and run it.
If that doesn't work, try editing your question to supply more info. In particular, what commands "create a hello world" actually executes?
When creating the project in the Xilinx SDK, select that it runs on linux rather than standalone. See this official tutorial for an in-depth explanation.

Resources