Pogoplug and Raspberry Pi

CRW_0592

Pogoplug POGO-E02, my very cheap ($17) home file server. I installed Debian Linux and Samba on a flash drive, a 2TB hard disk derive is attached to it via USB so I can stream music and movies to any computers in my home network: HTPC, laptop, iPad and iPhone. With PHP, MySQL and Cherokee (a light-weight, very fast web server) it can do more than a file server but I will keep it as a file server exclusively considering its horsepower. And it only consumes about 3W power.

CRW_0606

This tiny computer, Raspberry Pi model B, performs surprisingly well on streaming and playing videos, even HD ones. I installed Raspbmc , a nice integration of Debian and XBMC (my favorite media center application!), then it becomes a little media player attached to a bedroom TV. An old Linksys router flashed with Tomato firmware working in bridge mode is used to provide network access. A pc-remote is used to remote control the XMBC as I always do with my HTPC.

 

Firefox 15 cannot save TiddlyWiki changes

I just upgraded Firefox to version 15 for Ubuntu 11.04. Everything went smoothly except that TiddlyWiki won’t save changes in Firefox 15. It’s been working well in the old Firefox 6. This is the error message I got while trying to save:

It's not possible to save changes. Possible reasons include:
- your browser doesn't support saving (Firefox, Internet Explorer, Safari and Opera all work if properly configured)
- the pathname to your TiddlyWiki file contains illegal characters
- the TiddlyWiki HTML file has been moved or renamed

After some searches online, I found the solution that works for my case. Locate prefs.js in ~/.mozilla/firefox/<some random text>.default/ folder, then add these two lines to this file:

user_pref("capability.principal.tiddlywiki.granted", "UniversalXPConnect");
user_pref("capability.principal.tiddlywiki.id", "file://<path to tiddlywiki file>");

This change will grant per file permission for the TiddlyWiki file and problem solved.

The deck project

Finally, I built the deck! This project has been postpone for 3 years actually. I spent about four days to finish it, all by myself except the post setting. Post caps were installed but not pictured here. This summer has been so hot and dry and my lawn was almost gone.

deck

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.

Upgraded to WordPress 3.1.2

It’s been a little while since my last upgrade of WordPress for this blog, the last version is an old 2.2.2. WordPress has changed and improved a lot since then, so I decided to upgrade it to the latest version 3.1.2. Also, I also changed the theme to give it a new look. Hopefully this is a new chance for me to post more.

The migration was basically smooth, but I still got several small problems.

  • Post revision is a new feature comparing with older versions. But it will make the database bloated and sometimes it’s not really needed. It can be disabled by adding this line to wp-config.php just before the last line:
    define('WP_POST_REVISIONS', 0);

    The number defines the number of revisions will be kept in the database’s posts table, 0 is for disabled.

  • The structure of table wp_posts is changed. I backed up my old database then restored to the new installation, but I found there’s no trash link for me to retrieve or delete posts or pages I trashed. When I checked in phpMyAdmin, I found the post_status can not be set to trash. The trashed posts or pages are still in the database but you cannot delete them, this will cause some problems, e.g., I cannot generate a new post or page with the same slug that’s used by a trashed post or page. I solved this problem by backing up the old database by its data only without selecting the structure. So that the structure of the new database will not be changed.
  • In this new version, seems the problem for Chinese support is still there. As before, I need to change the following section in wp-config.php to make it display Chinese characters correctly:
    from 

    define('DB_CHARSET', 'utf8');

    to

    define('DB_CHARSET', '');

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.