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 …
Category | programming
-
-
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.exportsobject. On the other hand, ES2015 addsimportstatements 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-Cor even kill the shell … -
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 …
-
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
.gitignorefile and list the … -
Comparison and Sorting in Python3
Although I have written Python for several years, I am still not very familiar with its idioms. In particular, I don't quite understand how to compare and sort the objects in Python. That's the reason why I am writing this article.
The rest of this article consists of following sections …
-
Check Code Coverage with Clang and LCOV
Code coverage is a metric to show the code being untested. It can be considered as a hint to add more test cases. When we are writing C/C++, the most notable code coverage testing tool is gcov, which is a GCC built-in coverage testing tool. Besides, we can collect …
-
Trace Source Code with Vim and Ctags





