I use Emacs in consoles and start Emacs frequently (like check a file, edit it, close it and loop). However, Emacs seems take some time to start up especially some modes/extensions are used. How to make Emacs start up faster? I summarize my solution at this post: Making Emacs Startup Faster. The key is to
Read more
Tag: time
How to prevent roommates from hogging bandwidth
Posted onI share a ADSL modem via a Wifi router with several roommates. Sometimes, I find the network bandwidth left is too little. Suspiciously, some one is using BT, Thunder, eMule or other P2P tools. These tools can easily use up all the bandwidth and left little for others. How to prevent some roommates from hogging
Read more
Domain registration coupons
Posted onThis page lists some domain registration coupons that users can use. The best that I can find currently the the $2.95 .com domain from godaddy: If you want to buy hosting from Godaddy at the same time, you can check this one which provides a free domain:
utop key bindings / key shortcuts
Posted onutop is an improved toplevel for OCaml supporting line edition, history, real-time and context sensitive completion, colors and etc. utop is convenient to use. However, the key bindings are a little bit different from the ones with GNU readline. What are all the key bindings? The #utop_bindings command will print all the key bindings. Here
Read more
How to delete a disk from a LVM group while keeping the data
Posted onThis is the scenario: I want to remove a old hard disk which is a LVM PV and contains data. There is free space available on other PVs in the VG. It should move the data from the disk to be removed to other PVs and then remove the disk. The process to remove sdb
Read more
How to convert seconds since the epoch to a date in Linux?
Posted onHow to convert seconds since the epoch (1970-01-01 UTC) to a date in Linux? For example, Convert the time stamp 1349361711.169942 to Thu Oct 4 22:41:51 HKT 2012 You can use the date command on Linux to convert the time formats. For converting the time stamp 1349361711.169942 to the normal data format: $ date -d
Read more
How to set the geometry for Gnome 3 under a VNC Server
Posted onWith Gnome 3, I try to start a vncserver with $ vncserver -geometry 1024×768 to start a vnc server with geometry 1024×768, which works well with Gnome 2 before. This also works for twm. However, after I connect to the vnc server, the resolution is not 1024×768. I change the geometry to other resolution and
Read more
HTML form generation from the database and store value into the database
Posted onI have a “t_form” table and a “t_attribute” table. It looks a little bit like below. Form table form_id | form_name | description ———————————– 1 | Laptop | Possible attributes are Model, Screen Size, OS, Cd Player 2 | Mobile | Possible attributes are Model, OS 3 | Tablet | Possible attributes are Model, Screen
Read more
How to count the number of page view
Posted onI have seen the question Better way to count total page views? I think, the better way is.. We can save the number of page views in the database. It is acceptable. But, it is not fulfilling my requirement, if many different users can appear to have the same IP Address (e.g, if they are
Read more
How to change the maximum execution time and memory size allowed for PHP
Posted onI see this message in the error log of httpd: PHP Fatal error: Maximum execution time of 30 seconds exceeded in and PHP Fatal error: Allowed memory size of 268435456 bytes exhausted How to change them to a longer and larger value? To change the allowed maximum memory usage of PHP: Set memory_limit = 256M
Read more
How to install Scala on Fedora Linux
Posted onThis tutorial introduces how to install Scala 2.9.2 on 64-bit Fedora Linux 17. There are some changes needed to make scala work on Fedora Linux 17. Please check it out in the answer. Install Java Scala depends on Java, so please install Java first. In this tutorial, we installed JDK to: /usr/java/jdk1.6.0_24/lib/. Install Scala from
Read more
Question2answer: show excerpt in the RSS feed
Posted onThere is a “Include full text in feeds:” option in the “RSS feeds” configuration panel but no options/method to only show excerpt instead of the “full text” or nothing for RSS feeds. This need to hack the question2answer source code. Details are in the answer. The changes based on Question2asnwer 1.5.4: diff –git a/qa-include/qa-index.php b/qa-include/qa-index.php
Read more
Is cin much slower than scanf in C++?
Posted onI frequently hear that cin is significantly slower than scanf in C++. Is this true? And how to improve the efficiency of cin? It is really nice to use most of time. One discussion about that cin is very slow is here: http://apps.topcoder.com/forums/?module=Thread&threadID=508058&start=0&mc=7 In short: cin is not always slower (can be faster actually, see
Read more
How to restore a Gnome 3 session?
Posted onHow to restore a Gnome 3 session? Which means: opening all the programs running last time when I log out in Gnome 3. If your purpose is to automatically start programs after logging in Gnome, another possible method is using the autostart script: https://www.systutorials.com/qa/119/how-to-write-a-autostart-script-for-gnome Run gnome-session-properties. In the “Options” tab, select “Automatically remember running applications
Read more
SQL layers on NoSQL databases
Posted onWhat are the SQL layer solution over NoSQL databases such as key/value stores? Phoenix: A SQL layer on HBase: https://github.com/forcedotcom/phoenix They also show some performance results: https://github.com/forcedotcom/phoenix/wiki/Performance F1 – The Fault-Tolerant Distributed RDBMS Supporting Google’s Ad Business: http://research.google.com/pubs/pub38125.html With F1, we have built a novel hybrid system that combines the scalability, fault tolerance, transparent sharding,
Read more
How To Find Out When Photos in The iPhone Were Taken
Posted onHow To Find Out When Photos in The iPhone Were Taken? The default viewer in iPhone seems do not show these information. The iPhone has no native mechanism to see the photo taken date information. However there is the information. You need a 3’rd party application to view the EXIF data (time taken, GPS coordinates,
Read more
Chrome reports “Adobe Flash Player was blocked because it is out of date.”
Posted onOn Linux (Fedora 17 x86-64), Chrome keeps reporting “Adobe Flash Player was blocked because it is out of date.” every time I browse a page that contains Flash. How to fix this? I did this and it turned to be working for me: Disable the libpepflashplayer in Chrome by run chrome://plugins/ in the URL bar.
Read more
How to revert a merge in Git
Posted onI merge a branch, say b1, from another branch, say b2. Both b1 and b2 have some commits. Say, b1: c1 —> c2 —> c3 b2: c1 —> c4 —> c5 Now, if I merge b2 to b1 and there is no conflicts, b1’s history includes b2’s commits (c4, c5). How to revert this merge
Read more
Make changes to sysctl.conf take effect without rebooting Linux?
Posted onI made some changes to /etc/sysctl.conf. I know it will take effect next time Linux boots. However, how to make the changes to sysctl.conf take effect without rebooting Linux? You can force Linux to reload the new configuration in /etc/sysctl.conf by: execute the following command as root: sysctl -p For more details, check the manual
Read more
How to make a swap partition
Posted onHow to make a swap partition on Linux? First, make a new partition (or reuse an existing one if you like). I suggest using cfdisk to create it: https://www.systutorials.com/docs/linux/man/8-cfdisk/ Then, turn the new partition (say, /dev/sdc1) to a swap # mkswap /dev/sdc1 Lastly, turn it on # swapon /dev/sdc1 You can check whether its status
Read more