Archive

Archive for September, 2017

[android] Mobile C

September 18, 2017 Leave a comment

If you want to develop a C or Python program on your Android device, try Mobile C. Write your program, press a button, and it’s compiled (or interpreted) and executed. Several languages are supported: C, C++ 11, Python 3, JavaScript, Lua.

Advertisements
Categories: android, python Tags:

web server on localhost

September 14, 2017 Leave a comment

Problem
I wanted to share a 3.3 GB big zip file with my students.

Python
I love Python, so I chose this simple trick: “python3 -m http.server“. It starts a web server and makes the content of the current directory available. I shared the URL with my students (10 people) and they started to download the big file at the same time. And it turned out that Python was not a good choice here since only 1 person could download the file and the others had to wait. This solution is single-threaded :(

Node.js
I hate Node.js but this time it provided the winning solution. Node.js’s async nature was perfect for the job, it could serve several clients. The download rate was not super fast, but at least it worked (and it worked well).

The following tip is from here.

$ sudo npm install http-server -g
[sudo] password for jabba: 
/trash/opt/node-v5.1.0-linux-x64/bin/http-server -> /trash/opt/node-v5.1.0-linux-x64/lib/node_modules/http-server/bin/http-server
/trash/opt/node-v5.1.0-linux-x64/bin/hs -> /trash/opt/node-v5.1.0-linux-x64/lib/node_modules/http-server/bin/http-server
/trash/opt/node-v5.1.0-linux-x64/lib
...

I couldn’t launch it with “http-server“, but the full path “/trash/opt/node-v5.1.0-linux-x64/lib/node_modules/http-server/bin/http-server” did the trick.

Categories: python Tags: , ,