Redirect Feed Links to follow.it using .htaccess

Posted on

Feedburner used to a powerful tool for RSS feeds publishing and subscriber management. However, feedburner will unlikely leave its maintenance mode because there has been no new features yet less features for quite some years. But RSS feed is still an important part of the Web supported by many software such as WordPress. follow.it is
Read more

Add Inline Comments for Multi-line Command in Bash Script

Posted on

In Bash script, it is common that multiple small commands run together connected by pipes (|) and the whole command is quite long. For clarity, we may write the command in multiple lines. How to add comments for these long multi-line commands? In Bash, the content after # in a line is the comment. Using
Read more

How to Match Multiple Lines using Regex in Perl One-liners

Posted on

Perl one-liners with perl’s regular expression statement can be a very powerful text processing tools used as commands in a terminal or a script. By default, the input to the perl one-liner with -p or -n options is passed line by line. However, when we want to match multiple lines, it gets us some trouble.
Read more

How to Query Transaction By ID in Hyperledger Fabric 2.0

Posted on

Querying transaction content out from a blockchain network is a common practice used by common scenarios like exploring the blockchain history or verifying the blockchain transaction content from a known ID. In Hyperledger Fabric, the transaction can be queried using a special system chaincode QSCC (Query System Chaincode) which is for ledger and other Fabric-related
Read more

How to Install Go 1.13.x on Ubuntu 18.04

Posted on

In Ubuntu 18.04 LTS, the default Go lang version is 1.10. For compatibility reason, the Ubuntu LTS will usually keep the major release version numbers for packages. However, many applications, such as Hyperledger Fabric 2.0, require a newer version of Go. In this post, let’s take a look at how to install a system level
Read more

GCC May “Save” You Some Recursive Functions Calls: an Analysis of a Function Call Stack Length Example

Posted on

We know compilers like gcc can do lots smart optimization to make the program run faster. Regarding functions call optimization, gcc can do tail-call elimination to save the cost of allocating a new stack frame, and tail recursion elimination to turn a recursive function to non-recursive iterative one. gcc can even transform some recursive functions
Read more

Bash Learning Materials

Posted on

Bash (GNU Bourne-Again SHell) the default shell for many Linux distributions. It is very common for scripting languages in Linux. Bash is easy and straightforward for writing small tools. However, as most tools, it has its grammars that could easily cause bugs if they are not used correctly. Here I summarize a list of good
Read more

How to Install Wine 32-bit on CentOS 8

Posted on

Since version 7, RHEL and CentOS only have 64 bit versions. For some reasons, it’s better to run many Windows applications under 32 bit wine. Like How to Install Wine 32-bit on CentOS 7, this post introduce how to install 32-bit Wine on CentOS 8. Most of the mechanisms are similar yet there are differences.
Read more

How to Convert Integers to Strings and Strings to Integers in PHP

Posted on

Conversion from integer to string and from string to integer are common operations in most applications such as C++. PHP has its uniqueness in language and standard library design. In this post, we will check methods to convert integers to strings and vice versa. Convert string to int in PHP You can cast a string
Read more

A StoneWall Solution in C++

Posted on

StoneWall is an interesting problem that requires some brain cycles yet not too complex. It is good software engineer interview question. Here is a C++ solution whose complexity is O(N). #include <stack> int solution(std::vector<int> &H) { int stones = 0; std::stack<int> heights; for (auto h: H) { while (!heights.empty() && h < heights.top()) { heights.pop();
Read more

How to Statically Link OCaml Programs

Posted on

Static linking is preferred for some cases although it has its own various problems. Static building/linking is not always possible for some languages on some platform. For OCaml, the answer to this question is yes. In this post, we will introduce 2 methods to statically linking OCaml: static linking with runtime glibc required and static
Read more

5 necessary PC hardware that a programmer needs to upgrade

Posted on

The world of technology has evolved drastically over the last few decades. Almost every aspect of our lives is dominated by technology. At the heart of technology lies computer programming. Computer programming is what dictates the success of the technology. I mean think about it, your smartphone, PC, ETC they all rely on programming. This
Read more

New Linux Kernel 5.0: Features and Improvements

Posted on

Linux is the most used and well-known open-source operating system for computers, mobile devices, servers, and mainframes, etc. Linux has so many awesome features to serve its users like Live CD/USB. And it is fast, easy and free to use by computers around the world. The kernel is referred to as the essential component of
Read more

What can we expect in Java update 2019?

Posted on

Java is the most regularly used programming language for the creation of web applications. This high-level programming language develops by the Sun Micro-system. This language was designed for use in the world of internet and known for fastest, secure, and most reliable language of the computing platform. One interesting fact is that Java programmers are
Read more

Installing Zlib from Source Code in Ubuntu Linux

Posted on

Zlib is a popular open-source compression library used by many software applications to compress and decompress data. While it can be installed in Ubuntu using the apt package manager, you may need to install it from the source code if the version available in the Ubuntu repositories is outdated or if you need to customize
Read more

Handling Sparse Files on Linux

Posted on

Sparse files are common in Linux/Unix and are also supported by Windows (e.g. NTFS) and macOSes (e.g. HFS+). Sparse files uses storage efficiently when the files have a lot of holes (contiguous ranges of bytes having the value of zero) by storing only metadata for the holes instead of using real disk blocks. They are
Read more

How to get the full path and directory of a Python script itself?

Posted on

In a Python script, how to get the full path and directory of the Python script itself? To get the path of the current file (the script itself), you can use __file__. To resolve any symbolic links in the path, you can use os.path.realpath(). Putting them together, you can do os.path.realpath(__file__) to get the full
Read more