Javascript is a prototype-based object-oriented programming language. Unlike the conventional class-based object-oriented programming languages (e.g. C++ or Java), which ask programmers to write a class and then instantiate several similar objects from the class, Javascript adopts a different approach. In the world of Javascript, we have to craft a …
-
-
Read Lines from stdin in Node.js
It is easy to write a hello world program in Node.js:
console.log("Hello world!")
However, due to the asynchronous nature of Javascript, reading inputs and writing outputs are less straight-forward. We have to pass the callback functions or register event listeners.
First Attempt
For example, to read some …
-
Browserify
It is common to organize the code in several modules when we are developing Javascript applications. In Node.js ecosystem, we can import a module with the
require()
function and export symbols by adding them to themodule.exports
object. On the other hand, ES2015 addsimport
statements andexport …
-
Run ES2015 with Babel 6
ECMAScript 2015 (also known as ES2015 or informally ES6) is the latest standard for JavaScript. It has been released for a while. However, V8, the JavaScript engine for Node.js, has only limited ES2015 support. As of writing, according to ECMAScript 6 compatibility table, the feature coverage of each Javascript …
-
Bash Signal Handler and Traps
I would like to launch ssh-agent and add my private key at the beginning of my shell script and stop it before leaving the shell script. How do I guarantee that ssh-agent will be shutted down properly? What will happen if the user press
Ctrl-C
or even kill the shell … -
Autossh and Systemd Service
-
Fix Nautilus Video Thumbnails
-
Debug Multithreaded Program with GDB
GDB is a powerful debugger. Without a doubt, we can debug multi-threaded programs with gdb. In particular, we can switch between threads, inspect the stack, and dump the registers. In this post, I would like to start with the Dining Philosophers Problem, which was first coined by Edsger Dijkstra.
Here …
-
Discourse Installation Notes
-
Global Git Ignore File
There are some files that shouldn't be tracked by Git at all. For example, the temporary files created by the text editors, the Python bytecode, and etc.
How could we ignore those files? In the previous post, I have mentioned that we can create a
.gitignore
file and list the …