• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics in ~comp with the tag "javascript". Back to normal view / Search all groups
    1. Node's "Single Threaded, Event Driven" programming model seems highly deceptive and farcical

      The more I think about it, the more I'm convinced of it. The biggest selling point of Node folks has been the "single threaded, event driven" model, right? Unlike JavaScript, other languages work...

      The more I think about it, the more I'm convinced of it.

      The biggest selling point of Node folks has been the "single threaded, event driven" model, right? Unlike JavaScript, other languages work on a "blocking" basis i.e. you run a statement or command and the program "waits" until the I/O is complete. For example, you issue open('xyz.txt', 'rb').read() in python and the program waits or blocks until the underlying driver is able to read that whole text file (which could take arguably long time if said file is too large in size).

      But with the Nodejs equivalent, you just issue the statement and then pass the "event handler" so that your program is never in the "waiting state". The whole premise of Node/JS event-callback is that "you don't call us, we will call you".

      This is all nice in theory but if this were indeed true then Nodejs scripts should be blazing fast compared to Python and even Java considering that most programs we write are I/O heavy and 99% of time, they're just waiting for an input from a File/URI/User? If this event callback model indeed worked as effectively as claimed, Node would have been the numero one and only language being used today?

      I think I'm starting to understand why that isn't the case. This whole "single threaded, event driven" thing is just a farce. You can also replicate the same thing that Node.js is doing in your Java or Python too by applying multi-threading (i.e. one thread just "waits" for the I/O in the background while the other keeps doing its job). All you've done here is just handed or delegated that complexity of multi-threading to Node.js?

      Realistically, it's impossible to wait or block an I/O request while at the same time also letting the other part of the code engage in other tasks, that's the very definition of multi-threading. Doing "async" is impossible without multiple threads in that sense. Node must have a thread pool of sorts where one of them is engaged in the wait/block while another is running your JS code further. When the wait is over, the control is then passed to the "event handler" function it was bound to in that other thread.

      What Node is selling as "single threaded" applies to application or business logic we are writing, node itself can't be single threaded. I feel it's better to just implement multi-threading in your own code (as needed) instead of using something convoluted and confusing like Node.js. What say you?

      8 votes
    2. What is the present state of NPM Packaging System?

      As I recall, about 2-3 years ago I had experimented with what is called the npm install xyz through some tutorials, etc. The objective was to improve my tooling or toolchain at least with things...

      As I recall, about 2-3 years ago I had experimented with what is called the npm install xyz through some tutorials, etc. The objective was to improve my tooling or toolchain at least with things like css/js minification, etc. along with Bootstrap customization. The idea was to then move on to other newer learnings like react, etc.

      But I was soon disgruntled by the whole process! Neither bootstrap turned out to be an easy horse to tame, and NPM was like this astronomical universe of packages that keep on downloading into your folders! I soon lost taste of the whole thing and kept using my tried and tested stack of PHP scripts and using stock Bootstrap through CDNs.

      But today, I want to give it another shot. Has NPM improved than earlier days? What is the best way to go about building a toolchain using it? Are there any useful guides that make the whole process easier to digest?

      6 votes
    3. Looking for a Simple WYSIWYG Editor for my Blog

      I'm going to be building a simple blog for myself. Partially I just want something really simple and customizable, and also it will be a fun little programming project. I'll be using PHP and mySQL...

      I'm going to be building a simple blog for myself.

      Partially I just want something really simple and customizable, and also it will be a fun little programming project.

      I'll be using PHP and mySQL for the backend. I won't be using any sort of framework as it shouldn't be necessary for a very simple blog. I'm fairly comfortable with JavaScript.

      What I'm imagining is some sort of JavaScript library I can just download, link to my html and then turn a textarea into a simple wysiwyg editor. It could be as simple as a markdown editor or something with a little more features.

      It has to be free. Open source would be a plus.

      If anyone has any recommendations or advice I would be very grateful. Thanks!

      5 votes
    4. What features do you want to see in a userscript manager?

      I'm currently developing a minimal userscript manager who's main goal is to be fully auditable by any user in only ten minutes or so - my prototype uses less than 300 lines of javascript, and I'm...

      I'm currently developing a minimal userscript manager who's main goal is to be fully auditable by any user in only ten minutes or so - my prototype uses less than 300 lines of javascript, and I'm trying to keep it that way.

      To get the codebase this small, however, I have to be very picky with what features I implement - most notably, the code editor has to be very barebones. Are there any features that I'd be shooting myself in the foot by not including?

      For example:

      • syntax highlighting
      • cloud sync
      • regex url matching
      • fullscreen editor (currently, it's just a browser popup - the intention is that you write code elsewhere and paste it in)

      Any feedback is greatly appreciated!

      7 votes