node.js

Displaying 1 - 7 of 7

Cross-platform node scripts: better-npm-run to the rescue

We know that Node.js is awesome and JavaScript is the ultimate cross-platform language. Node has support for Windows despite the node command being a command line program. Windows users can use the command line shell for node. But the Windows shell environment isn't completely compatible with what Unix/Linux/Mac users are used to (i.e. Bash). The npm package Better-npm-run helps deal with running tasks with node across platforms including Windows.

Get it here: https://www.npmjs.com/package/better-npm-run

This...

What is Package.json

If you're looking at some JavaScript code you got from elsewhere, probably Node.js packages, you'll notice each has a file called 'package.json'. This will be in the module's base or root directory. This file is a sort of manifest file for the module, most likely an npm module/package. Any package listed at npmjs.com needs a package.json, and the absolute minimum the file should contain is the package's name and version. The name and version make up a unique key for the package within npmjs.

The file usually contains much more than name and version. You can guess by the...

Scala vs Javascript (ES6, TypeScript, Node.js)

Now with Scala.js allowing isomorphic Scala code to run on both browser and server. Scala contends with JavaScript in the web domain. But assuming we are talking about web, how do the two languages compare?

First, JavaScript comes in a few flavors. There's ES5 which is currently running in all browsers. There's Node.js, which is the same Google V8 JavaScript engine but running outside the browser and thus without browser/web apis included, but which can run ES6 (EcmaScript 6). And then there are the many languages that compile or transpile down to plain old ES5 JavaScript,...

Random number generation in JavaScript

Generating a random number in JavaScript is simple if you don't care about quality, more complicated if you do. When I say "in JavaScript" I mean both of the JavaScript runtimes - the browsers with their DOM/window, and Node.js without those things - and without all the modern browser APIs.

  1. The default, old-fashioned way to get a random number in JavaScript is by using Math.random(). However, the numbers produced from Math.random() are not secure for crypto applications as they are known to contain predictable patterns. The reason for this non-randomness isn't simply

  2. ...

MEAN vs LAMP stacks defined and compared

The long popular web development stack LAMP is slowly being chipped away from its dominant position by newer, trending technologies, letter by letter. MEAN is one total replacement which has been gaining ground lately.

What do those acronyms mean?

  • MEAN: MongoDB, ExpressJS, AngularJS, Node.js
  • LAMP: Linux, Apache, MySQL, PHP

MongoDB is a NoSQL database which won't support your existing applications because they would require some sort of relational database with SQL querying capability, probably including a whole lot of very custom...

The Difference between JavaScript and Java

Many non-programmers and young programmers are confused by the names Java and JavaScript. In fact, JavaScript was renamed to JavaScript as an afterthought and a co-marketing campaign together with Sun (the creator of Java). But there are succinct jokes for this naming coincidence: Java and JavaScript are the same like car and carpet, or ham and hamster.

First, the similarities. On a cursory look, some of the syntax of Java and JavaScript code look alike. This is because they're somewhat descended from C (putting them in the Algol family but they are both more similar to C than...

Choosing Shell script vs Python vs Node.js vs PHP for Server-side Command Line Scripting

After decades of improvements in graphical user interfaces, the Unix command line interface still remains the most powerful way to get things done for a lot of workflows. This is due to many reasons: the difficulty of quickly and precisely moving the mouse cursor compared to the ability of touch typists to select exactly what they want (even when it's via hotkey combinations), but mainly (IMO) the expressive power of composing separate Unix commands into one pipe-separated command operating on standardized files (usually text).

It's also easy to write your own Unix commands which...