Vim is a fast and handy editor on *nix systems. Like Emacs, Vim has a steep learning curve as you get constantly get new things. However, the effort deserves it as you efficiency is highly improved. Here, I summarize the tips and howtos I learned using Vim. Some previous posts on vim are tagged with
Read more
Tag: Tip
How to Find Out Failed Disks’ SATA Ports in Linux
Posted onThe Linux disk names (e.g. sda1, hdb3, etc.) are not reliable—they may be changed if there are hardware changes, such an adding or removing a disk. Additionally, the order for the Linux device names is not always the same as the order of SATA poets. For example, the disk connected to SATA port 0 (first
Read more
Changing Linux User Password in One Command Line
Posted onIn Linux, we use passwd to change password, but passwd requires input from stdin to get the new password. It is common case that we may want to change the password non-interactively, such as creating new user accounts and change or set password for these accounts on a number of Linux boxes when the new
Read more
HP Compaq BIOS Crisis Recovery from a Failed BIOS Flashing Using a USB Flash Disk
Posted onI tried to flash my HP Compaq CQ35-240TX’s BIOS to F.15 but unfortunately failed. The computer turned to white screen. When I restarted (powered off then boot again), this is no response any more: the hard disk and caps lock’s LED keep blinding. I thought “Oh my God! I must send it to HP to
Read more
Keep Firefox Open After Closing the Last Tab
Posted onFirefox should always be ready there for us, right? Even after we closing the last tab, we would like firefox to be still open. At least I like to treat it in this way. But unfortunately, Firefox will close after we closing the last tab as default in version 3.5. But the good news is
Read more
Thunderbird Tips: Default Descending Email Sort Order and Inline Quote When Reply
Posted onThunderbird is a great email client and what make it special is deeply configurable like Firefox. For me, I like to view email in the descending sort order and inline quote relied email content when replying emails. Let’s look at how to set the default order as descending sort order and quote mode as inline
Read more
Hashing Library for C
Posted onI try to find some Hashing libraries for C and find several good ones. The hsearch function in the GNU C library. There are other methods to organize information which later should be searched. The costs of insert, delete and search differ. One possible implementation is using hashing tables. The following functions are declared in
Read more
Vim Indenting C/C++ Code
Posted onVim provides some basic formatting commands. A combination of these commands with the editing commands will make the programmer happy. A list of basic text formatting commands in Vim: = is an operator that formats/indents text. i{ is a text object that specifies the surrounding code block. It should be used together with v, =,
Read more
Vim + cgdb
Posted onI begin to use vim for programming. I like the tools that focus on one function. I used to use emacs. But I think I like vim more. For debugging, I use gdb. But I use the front end cgdb. I can see the codes with the cursor when debugging. I can use F8 for
Read more
Controlling Display of WordPress Widget with PHP Code
Posted onI am always wondering how to display different Widgets in WordPress depending on the page/post/category etc. I ever tried some plugins that is for specific purpose. However, they are not flexible enough for all my needs. For example, I want a widget that contains AdSense ad not display on certain posts that I selected and
Read more
Put the Categories, Archives and All Posts into Pages
Posted onI prefer putting pages that contains all the categories, archives and even all the posts in one page to putting these links in the side bar. Actually, most of time it needn’t to stay on every pages. And if it is in the side bar, the search engine will see these links in every page
Read more
Change WordPress’s Excerpt Length
Posted onThe default excerpt length of WordPress is 55 words. Some one like me may want to change the excerpt length. I like the have a smaller excerpt length for the homepage. WordPress provides a interface for changing the default excerpt length. The method is very simple and easy. Put these codes into the function.php file
Read more
Using noindex Meta Tag in WordPress to Prevent Search Engines Indexing Categories, Tags and Archives
Posted onWordPress may show “duplicate” content which may potentially confuse search engines. Duplicate content won’t hurt much, unless it is spam or keyword stuffing, as said by Matt Cutts, and Google may just ignore the duplicate content. However, instead of letting the search engines decide which pages of the duplicate ones are important, we may only
Read more
Using “META” Tag in HMTL HEAD to Redirect Pages
Posted onIt is quite simple to redirect pages using the “meta” tag in HTML head, I just give the example to redirect the page to https://www.systutorials.com after 1 second. <html> <head> <meta http-equiv=”Refresh” content=”1; url=https://www.systutorials.com/”> </head> <body> This page is redirected to: <a href=”https://www.systutorials.com/”>systutorials.com</a>.<br /> </body> </html>
Emacs Tips and Howtos
Posted onWith Emacs, I feel happy. I love the rich functions of Emacs, such as compiling, quickly jumping to the lines with compilation error and debugging with gdb, and more. I ever wrote small tips posts about Emacs before. But it is a good idea to put them together and keep adding new ones. Here comes
Read more
Changing MTU to Make WiFi Faster on Linux
Posted onI experienced very slow WiFi network on Linux, while my iPhone seems surf the Internet quit fast. I pinged a site and the RTT is more than 1000ms! There must be something wrong with my Linux configuration. I tried to change the MTU from “Automatic” to “1400” on my Linux box. Surprisingly, it fix the
Read more
Quickly Copying Text to a File
Posted onCopying some text to a new file is a common operation on Linux. I usually do this by opening the file with ‘vim’, pasting the text in ‘vim’, and then saving the file. I learned a more efficient and quicker way from my advisor during one discussion with him when I show him some results.
Read more
How to Flush Linux File System Caches
Posted onWe may drop the file system caches on Linux to free up memory for applications. Kernels 2.6.16 and newer provide a mechanism via the /proc/ to make the kernel drop the page cache and/or inode and dentry caches on command. We can use this mechanism to free up the memory. However, this is a non-destructive
Read more
Vim as KMail’s External Editor
Posted onVim is my favourite text editor and I also prefer to use Vim to compose Email. I ever used Vim as Thunderbird’s External editor with the help of plugin. I started to use KMail as my email client on KDE and I find it is not hard to configure KMail to use Vim as email
Read more
How to Take Screenshots in MPlayer
Posted onTaking screenshots in mplayer is simple. mplayer can also take continuous snapshots. Enable screenshot filter When we want to take screenshots when playing video, first we need to set the “-vf screenshot” option: $ mplayer -vf screenshot video.file If we want to enable the screenshot filter by default, we may put the option by adding
Read more