Updated “Google Reader Unread Count in Gmail” Script

Nearly 3 years ago I wrote a Greasemonkey script to show Google Reader’s unread count in Gmail’s top navigation bar. I was quite satisfied at first and shared it on userscripts.org, but later I found that it was too time-consuming for me since I always wanted to monitor the number and click through when it turned “1”. So I disabled it and forgot about it.

But today after cleaning up the spam comments, I found a comment about this script. In fact someone also posted in the userscripts.org forum and even named it as one of the favourates. Thanks dear users! I knew I had to make an update and it turned out to be quite simple.

So go to the script page and install it. Should you have any problem with it, just leave a comment below.

Mac OS X 10.6.5 PHP Problem

Earlier today, I wanted to setup a PHP development environment on my MacBook Pro. It was expected to be very simple. As many tutorials said, I just uncommented the “LoadModule php5_module libexec/apache2/libphp5.so”, enabled web sharing in system preferences, and expected to see PHP working by visiting http://localhost/~myusername/.

But no luck. Firefox just can’t connect to the web server. Then instead clicking the checkbox in system preferences window, I tried to type commands in Terminal – “sudo apachectl start”. But the execution of the command just completed with no output or any warnings. Also, nothing appeared in /var/log/apache2/error_log. That’s really weird – on Linux platform, there should be something if the server fails to start. But by appending an argument to the command:

Continue reading “Mac OS X 10.6.5 PHP Problem”

Kindle PDF Support

Native PDF support was initially introduced by Kindle DX and later Kindle 2 also had native support for PDF format.

Why PDF on Kindle?

Of course if you don’t want the PDF format, you can always send it to Amazon and let them convert it into Kindle’s native .azw format (mobi, actually). But there are some pros of reading PDF on Kindle:

  1. You can embed fonts in PDF files. Kindle’s font selection is very limited, but if you read PDF format, you can create the PDF file with your own choice of font. For example, you can choose some beautiful handwriting font. It’s even more useful for CJK language readers.
  2. When reading a technical document with a lot of graphs, data tables, or code snippets, you’d better use PDF to completely preserve the original type setting. Especially for a code snippet, Amazon will convert it into a mess.
  3. If the book has lots of foot notes, PDF preserves the positioning of foot notes well because of its fixed pagination. Mobi or azw formats support font size adjusting and they adapt to different sizes of screen so they can’t guarantee foot notes are still at the footer.
  4. [update on 2011-09-19] After switching to landscape view (press the Aa key on the right of space bar and select screen rotation), Kindle automatically cuts the margins and white areas so they don’t waste the screen space. I don’t know if it was a feature since Kindle 3 or it’s introduced by some firmware update.

Continue reading “Kindle PDF Support”

Lighttpd fastcgi – How to Restart a Specific Site Without Affecting Others

Having used fastcgi in lighttpd for a while, I wondered if there was a way to restart one fastcgi site/application without affecting other sites. Because I have many fastcgi sites hosted in a single lighttpd instance, and I don’t want them all to be shut down for a little while each time I want to restart a site after deployment.

The solution turned out to be very simple –

  1. Find out the process of the application that you want to restart and kill it.
  2. Access your web site from a web browser and the restart is done.

Continue reading “Lighttpd fastcgi – How to Restart a Specific Site Without Affecting Others”