After the post Fetching RSS Feed and Outputing Feed Items as HTML in PHP was originally published, there are some updates such as adding a simple RSS feed caching mechanism and supporting scanning content parts of the feed items for images. Recently, Webucator makes a great tutorial video on introducing the RSS to HTML PHP
Read more
Tag: Programming
Which Checksum Tool on Linux is Faster?
Posted onIt is common practice to calculate the checksums for files to check its integrity. For large files, the checksum computation is slow. Now I am wondering why it is so slow and whether choosing another tool will be better. In this post, I try three common tools md5sum, sha1sum and crc32 to compute checksums on
Read more
How to Run a Command Upon Files or Directories Changes on Linux
Posted onDoing actions upon changes of files and directories is very useful. Examples like compiling a project after the source code files are changed, sending emails after important configuration files are modified, building the PDF after a TeX file is modified. On Linux, the inotify-tools provide good support for trigger actions after changes. In this post,
Read more
How to Regenerate Grub2 Config Files on Linux
Posted onGrub2 config file may need to be re-generated after changing Grub2 configurations such as configuration changes and setting default boot entries. The Grub2’s config file may be at different locations depending on your Linux distro and whether your Linux is booted in BIOS or UEFI mode. This makes regenerating Grub2 config file not easy for
Read more
How to Get Rid of DTS/AC3 Audio using ffmpeg on Linux to Play MKV Files on iOS or Android
Posted onI encountered the problem on iPhone that MKV video files with AC3 are played with no sound. The OPlayer reports to me that “According to DTS patent, DTS is forbidden to play , None of the media player on iPhone/iPad can play DTS”. However, the video file can be played in MPlayer on Linux just
Read more
How to Get Available Filesystem Space on Linux: a C Function with a C++ Example
Posted onIt is common for programs to write to files in filesystems on disks. However, what if the disk was almost full when your program writes to the filesystem on a disk? For systems software and mission critical programs, it is a better or must-to-do practice to check the available filesystem space before actually writing to
Read more
Profiling Vim to Find Out Which Plugin Makes Vim Slow
Posted onVim is pretty fast and powerful. However, the core of Vim is (yet) single-threaded (some discussions and tries on porting Vim to be multi-threading, but not yet there). This means some functions that are slow will block Vim there and you have to wait for it. While Vim is fast, some plugins are not. When
Read more
Fetching RSS Feed and Outputing Feed Items as HTML in PHP
Posted onIt is useful to show the feed items directly on the webpage as HTML content. In this ost, we will show one single PHP function that fetches an RSS feed and outputs the feed items as HTML elements in the web page. One example to fetch an RSS feed and output the itmes as HTML
Read more
How to Turn GNOME terminal to a Pop-up Terminal
Posted onA pop-up terminal is great and handy on Linux and similar OS. On KDE, Yakuake is great. On Gnome or GTK, I ever tried Guake. It is quite good. However, it has not been as mature, stable and figure-rich as gnome-terminal. One day, I got this idea: why not using a script/program to manage the
Read more
How to Make Chrome Accept Self-Signed Certificates on Linux
Posted onIf your website uses a self-signed certificates, Chrome will show a warning every time and you need clicks to continue. In this post, I will introduce how to make Chrome accept self-signed certificates for sites on Linux. This post is made short on purpose and you need to search the Web and learn if you
Read more
How to Configure Linux Kernel Video Mode for 32-bit and 16-bit Boot Protocols
Posted onThe Linux kernel has a generic driver for a graphic framebuffer named vesafb on intel boxes. It provides a nice large console for most of modern displays. Setting VESA modes for Linux kernel with 32-bit and 16-bit boot protocol are different. We introduce both methods here. Linux kernel with 32-bit boot protocol For machine with
Read more
Creating a Child Process using posix_spawn in C in Linux
Posted onThe posix_spawn() and posix_spawnp() functions create a new child process from the specified process image constructed from a regular executable file. It can be used to replace the relative complex “fork-exec-wait” methods with fork() and exec(). However, compared to fork() and exec(), posix_spawn() is less introduced if you search on the Web. The posix_spawn() manual
Read more
Hadoop Installation Tutorial (Hadoop 2.x)
Posted onHadoop 2 or YARN is the new version of Hadoop. It adds the yarn resource manager in addition to the HDFS and MapReduce components. Hadoop MapReduce is a programming model and software framework for writing applications, which is an open-source variant of MapReduce designed and implemented by Google initially for processing and generating large data
Read more
Extending Mounted Ext4 File System on LVM in Linux
Posted onLVM is a great tool to manage hard disks on Linux—you can abstract the hard drives away and manage logical volumes from volume groups, you can dynamically add or remove hard drives while the file systems on the logical volumes need not to backed up and recovered, and you may create many snapshots of the
Read more
Keyboard Key Mapping for Emacs: Evil Mode and Rearranging Alt, Ctrl and Win Keys
Posted onCtrl keys are important and possibly most frequently used in Emacs. However, it is painful on today’s common PC keyboards since Ctrl keys are usually in the corner of the keyboard main area. Why the key mappings in Emacs are designed like this? After it was designed, Emacs was commonly on the Lisp Machine keyboards
Read more
Git Merging FAQs
Posted ongit merge is frequently used during development of projects managed by git. There are many common questions about git merge and I find most are solved and discussed on StackOverflow. Here, I summarize useful ones so that others who want to learn git merge need to do the search again. Merge, rebase, fast forward and
Read more
Cheatsheet: Git Branching with a Git Server
Posted onIt is common to set up git servers to host git repositories. Branching is lightweight in git and a very friendly mechanism to manage code. Here, I summarize a cheatsheet of common git branching commands for working on repositories from a git server. This post assumes that you have basic knowledge with git. If you
Read more
Useful Git Submodule Commands
Posted ongit submodule is a very useful tools in git to include other git repositories in one repository to handle cases such as library dependencies. In this post, I summarize some commonly used commands that I find useful for working with git submodule. For the list of full commands, check the git submodule manual. Add a
Read more
Git through SSH Tunnel as Proxy
Posted ongit is a great tool and it is common to have a git server over SSH possibly managed by gitolite. However, there are situations that we can not directly connect to the git server but be able to SSH to another node that can connect to the git server. The git server may allow only
Read more
Accelerating WordPress with WP Super Cache, Opcache and Autoptimize
Posted onWordPress can be very fast after some effort on performance optimization with the help from its plenty of plugins. Possible ways include using cache to cut down the number of database queries, improves HTML/JavaScript/CSS code, and optimizing PHP’s performance with opcode cache. In this post, we introduce how to speed up WordPress with OPcache, page
Read more