4 ms·
Isn't C++ a bit overkill for a web app?
by benbristow 8y ago
Isn't C++ a bit overkill for a web app?
- sgt 8y agoNot necessarily. You see web servers running on microcontrollers all the time and they are mostly written in C.
- qzy 8y agoYou are right, C++ is overkill. It would be much better if it was a javascript application with thousands of dependencies.
- jordache 8y agoahh so you're in the camp of wanting to re-create a graphing library for every project..
- WrtCdEvrydy 8y agoahh so you're in the camp of outsourcing your development cost to the user's hardware.
- drngdds 8y agoThere are memory-safe languages that aren't Javascript, you know
- stackmad 8y agoDepends, this was a question I tried to answer for myself with this project. I did not easily find a good library for Python that would work on my Mac for reading the HID messages, so writing the device part in C++ was easier for me ( and an interesting excercise in c++17'ifying C code ). I thought about just having the c++ app be called from python, but wanted to try and see how hard it would be in c++ and found it extremely easy with the cpprestsdk.
- andor 8y agoDid you search for... "co2 meter python"? The pypi package called "CO2meter" (https://github.com/vfilimonov/co2meter https://github.com/vfilimonov/co2meter) not only works well as a library on Mac OS, but also comes with a web-based dashboard: $ pip install CO2meter flask pandas ... $ co2meter_server Edit: link
- stackmad 8y agoThat looks great as well! But for some reason the library they use (pyhidapi) would always crash on my Mac.
- stackmad 8y agoThough with your steps it at least starts, but the webserver fails, and CTRL+C doesn't work ^^ * Serving Flask app "co2meter.server" (lazy loading) * Environment: production WARNING: Do not use the development server in a production environment. Use a production WSGI server instead. * Debug mode: off INFO:werkzeug: * Running on http://127.0.0.1:1201/ (Press CTRL+C to quit) ERROR:flask.app:Exception on / [GET] Traceback (most recent call last): File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 2292, in wsgi_app response = self.full_dispatch_request() File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1815, in full_dispatch_request rv = self.handle_user_exception(e) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1718, in handle_user_exception reraise(exc_type, exc_value, tb) File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1813, in full_dispatch_request rv = self.dispatch_request() File "/usr/local/lib/python2.7/site-packages/flask/app.py", line 1799, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 64, in home data = read_logs() File "/usr/local/lib/python2.7/site-packages/co2meter/server.py", line 236, in read_logs with open(os.path.join('logs', name + '.csv'), 'r') as f: IOError: [Errno 2] No such file or directory: 'logs/co2.csv' INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET / HTTP/1.1" 500 - INFO:werkzeug:127.0.0.1 - - [25/Jan/2019 14:18:23] "GET /favicon.ico HTTP/1.1" 404 - ^C^C^C^C ^C^C
- 8y ago