Fix of crash after suspend in Ubuntu 11.04 (Natty)

My work laptop runs Ubuntu 11.04 (Natty), which is nice, but I found it keeps crashed after I turn it back from suspend or hibernate. All I got was a black screen with tons of error messages I don’t know how to deal with. That’s very annoying because all I can do is to shut it down (by pressing power button for four seconds) then turn it on again.

After a simple search, I found it’s not just me. There are different solutions suggested in some Linux forums. I tried some of them but most of them didn’t work for me until I found a very simple that finally worked! The solution is to create a text file /etc/pm/config.d/unload_module with this line:

SUSPEND_MODULES="xhci-hcd"

So far the crash has not happened since this fix.

Using Google Voice in Canada

Google Voice (GV) can be used to make FREE calls to US and Canada, however it’s not open to Canadian users yet. But with some workaround, it’s not difficult to enjoy the free offering from Google in Canada.

Here are some steps I followed to use Google Voice to make and receive phone calls to US and Canada with ATA and phone, no computer required and free of charge.

  • Register a free account at SipSorcery. SipSorcery (SS) was open again for free account with some limitations, but it’s adequate for Google Voice calling purpose. After the simple registration, you will get your SS username ss_username.
  • Log in your ATA, input following information to make it register to SipSorcery: User ID: ss_username, Password: ss_password, Proxy: sip.sipsorcery.com. Save and make sure it registers to SipSorcery.
  • In SipSorcery account, replace the dial plan with this Simple dial plan. You will need to make necessary modifications to it later. For more information regarding dial plan, please refer to my another post.
  • Register a free accont at IPKall. After the registration, you will get a US phone number ipk_number and you can forward all calls to this number to a SIP URI, which can be set in the account setting. Put your ss_username in the SIP Phone Number and sipsorcery.com in the SIP Proxy.
  • Get a GV phone number. Assuming you already have a Gmail account gmail_account with corresponding password gmail_password. In order to get a GV phone number, you will need to visit Google Voice from a US IP address because of the reason aforementioned. You can do this by using a US proxy server. A simple Google search will help you on this matter. Now you will be asked to select a new GV number and to verify it. Google voice will call you at a US phone number and you will be asked to enter a code that’s displayed on your screen. Just use the IPKall number ipk_number here.You will be called at ipk_number and the phone connected to your ATA will ring. Pick up the phone and follow the instruction to enter the two-digit verification code and you are all set.
  • Now go back to your SipSorcery account and modify your dial plan. You need to change GV_USER, GV_PASS and CB_NUMBER to your gmail_account, gmail_password and ipk_number respectively.

If you follow all above steps correctly, you are now able to make calls to US and Canada via Google Voice for free. And, all calls to your GV number will be forwarded your IPKall number then forwarded to your SS SIP URI, i.e., received at your ATA and your connected phone.

By tweaking the dial plan in SipSorcery, it’s easy to route calls to another VoIP provider according to numbers dialed. For example, I use voip.ms to make international calls as well as other features such as voice mail, E911 etc. Meanwhile, I forward calls to my Canadian DID at voip.ms to my SS SIP URI so I can receive all calls made to all three numbers (GV number, IPKall number and Canada DID) on the same phone; and calls made from the same phone will be routed to Google Voice or voip.ms automatically. As a backup, I register the line 2 of my ATA (Linksys PAP2T-NA) to voip.ms so I can still receive phone calls to my DID in case GV and/or SS and/or IPKall are down.

Google Voice SipSorcery dialplans

Wiki Pages – google-voice-sipsorcery-dialplans – Tips and Tricks for free or inexpensive calling with Google Voice over VoIP – Google Project Hosting.

Dropbox tips and hacks

WordPress database clean up

I tried to upgrade my blog to WordPress 2.5 days ago so I had the chance to check my MySQL database closely in PhpMyadmin. And I was astonished because the size of my database is over 4MB! That’s huge for a small scale blog. When I checked the tables in the database, I found there are two tables were uncommonly large: wp_comments and wp_options, both are over 1MB or more. When I checked them out by browsing their contents, I found that in the wp_comments table, there are tons of spam comments (marked “spam” in the “comment_approved” field). In the wp_options table, there are lots of unused options from uninstalled plugins left and there are lots of items begin with rss_. With a simple search on the net, I learned those spam comments and trackbacks are stored in the wp_comments table even though they are marked as spam and not posted to the blog. And for those options with rss_ prefix, they are RSS feeds contents used in WordPress dashboard, etc. So basically I don’t need them, especially when they make the database so fat and make the blog significantly slow.

To clean them, I just simply delete the spam comments and trackbacks in wp_comments table and rss_ items in wp_options table. The SQL query is like this:

DELETE FROM `wp_comments` WHERE `comment_approved` = 'spam'

After the clean up, my database is just about 900KB, what a difference! If you are not comfortable to edit in PhpMyadmin directly (like regedit in Windows), fortunately there are some plugins out there do the job well. CJD Spam Nuke and Clear Options are two of them and very easy to use. The latest Akismet plugin also can delete the spams from database manually or automatically.

WordPress and .htaccess problem

This is an old problem has existed for years, but I just encountered it days ago. In short, the symptom is that access to all password protected regular folders will be directed to the 404 page of WordPress, where “regular” means it’s not a WordPress page. I played around with both .htaccess files in my www root directory and in the protected directory, and found it should be caused by something within the Apache itself but I don’t know what exactly the reason is.

Finally I worked it out by asking on Site5′s forum and got the solution from this site. Because I installed WordPress in a sub-directory /blog under my root, so the solution is to modify the index.php file under the root folder from

< ?php
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./blog/wp-blog-header.php');
?>

to

< ?php
/* fix password protected folder access */
$request_filename = $_SERVER['DOCUMENT_ROOT'].$_SERVER['REQUEST_URI'];
$this_dir = dirname(__FILE__).'/';
if($request_filename!=$this_dir && $request_filename!=__FILE__ && (is_file($request_filename) || is_dir($request_filename))) {
  // we are not supposed be here!
    die;
                    }
/* Short and sweet */
define('WP_USE_THEMES', true);
require('./blog/wp-blog-header.php');
?>

After this modification, everything works well now.

Secure USB key on the go

It’s very convenient to have your favorite programs and data at hand when you are away form your own computer. With a large capacity USB flash drive, it’s very easy to store lots of files as well as portable applications in the tiny key drive. But it’s so tiny and it’s really easy to get lost and your sensitive data will be at risk. Here’s my solution to build a very well secured USB flash drive with all my favorite programs with settings, my frequently used documents and even all my easy-to-forget passwords.

  • Use TrueCrypt to protect all data on the drive. Though most space on the USB key is encrypted, I still reserve a small mount of space to put TrueCrypt executable files for self-decrypt and autorun.
  • Intall (copy) portable applications. I installed portable web browser (Firefox), email client (Thunderbird), office suite (OpenOffice), antivirus (ClamWin), IM client (Pidgin), media player (VLC), game (Sudoku) etc. Most of them can be downloaded from PortableApps.com. You can use their PortableApps Suite as well, but I just found a better alternative, PStart, it’s more flexible and quicker.
  • Install KeePass for password management. Because it’s inside the encrypted part, which needs a password to decrypt, so your passwords will be double-secured.
  • Have a copy of TiddlyWiki for notes. My favorite notebook utility so far. You can easily turn it into an address book by Twab plugin. There are many plugins out there that can enhance TiddlyWiki, but I prefer to keep it simple and quick, and most importantly, get things done.

Five reasons to use TiddlyWiki as a notebook

TiddlyWiki is an innovative, intuitive and versatile tool can be extended to many useful applications. Besides personal WiKi, I found it’s very handy to be a personal notebook. It can be used to record your random thoughts, wild ideas, notes and anything you want to write down on a notepad with a pen. I ever used ATnotes as a notebook as well as an alarm reminder. But it supports plain text only and it’s for local only. Then I used Google Notebook to save materials from the web during research. But it’s saved online so you cannot retrieve it when you are offline. And finally I realized TiddlyWiki is the best tool for me to take notes the other day, when I opened the file that has been saved on my hard drive for couple years.

I think there are several reasons why I think it’s the best notebook tool, at least for myself.

  1. It’s powerful yet simple. Everything is included in a single HTML file and it gets things done. No those fancy bells and whistles, only your content and necessary controls there and they really do the job. It supports all general text formattings, images, links, tables, lists, etc and even inline HTML and custom CSS.
  2. It’s portable. Because everything is in a single HTML file, you can put it either on local computer or remote web server to access from everywhere. You can even put in on a flash drive and bring it with you. As long as there’s a computer with a USB port and a web browser with JavaScript support (actually you can install one on the very same flash drive!), you are ready to go.
  3. It’s versatile. The limit is your imagination. It can be used as a personal WiKi, a weblog, a diary, a project presentation, and yes, a notebook. By changing the main menu and default tiddlers, it can be turned into a nice looking homepage too.
  4. It’s very handy. It supports tags and full text search, that means you can find your old notes very quickly. I just put a link on the Firefox bookmarks bar so I can open the notebook by one click. And after another click, I am ready to input. I also put a copy on my web server in case I want to look it up when I am away from my desk. Handy enough for me.
  5. It’s open source and free. Do I need to say anything more?

Go and grab your copy now.

Resources:

Flickr widget

Flickr widget, one of Yahoo! Widgets (formerly Konfabulator Widgets), is a handy tool to display your or others’ Flickr photos on your desktop in a very elegant manner, and more. Besides your own photos, it can also display photos from your favorites, your sets, your groups and your contacts. What’s more, it’s also a very powerful tool to upload photos to Flickr and this is what I like the best. First of all, it is capable of batch upload by drag-and-drop. Though Flickr provides a fancy AJAX-ized upload form, I think what this widget provides is much better and intuitive. And, it also allows you to edit basic information such as title, description, tags, privacy, etc. You can even post photos to your sets, groups, or even your blog directly. All these are in a very beautiful interface right on your desktop.

To give it a try, you need:

  • have Yahoo! Widgets engine installed;
  • have Flickr widget installed, and
  • a Flickr account.

Google Reader theme

Google Reader is my favorite daily online RSS reader, and it’s getting better and better recently. Some of the new features just added include a nice search box (finally!) and some small improvements. But what I am not satisfied is its somewhat boring and long-time-no-change user interface.

There were some tweaks to Google Reader’s interface and I tried some but none of them satisfied me until recently I found this one: OS X Style Google Reader by Jon Hicks. As the name tells, it mimics the Mac OS X Mail.app look to Google Reader. I feel this one is better than Google Reader’s default appearance by removing some items and changing fonts and colors. In order to install this style, you need to install the Stylish extension for Firefox, then load the script into Stylish. After all the installations, reload Google Reader and you will see the difference! You can find more styles for Google Reader here.

UPDATE: Google Reader just graduated from Google Labs and now is official.