Pray

Pray for all the lovely people in my home province, Sichuan, who are currently suffering the terrible disaster.

Best wishes to everybody!

p.s. The data of this earthquake is available here.


Delicious Add-on For Firefox 3

del.icio.us logo jaux.netdel.icio.us is my primary (actually, it’s the only) social bookmarking tool. I used to use del.icio.us with del.icio.us add-on in Firefox, which was very convenient to do bookmarking.

However, Ubuntu 8.04 came with Firefox 3.0 beta 5, where the old del.icio.us add-on would not work, so I needed to keep a del.icio.us page open in order to post something quickly. That was actually painful, sometimes. I frequently went to Firefox’s add-ons site to check whether there was a new version for Firefox 3 came out, but I always got disappointed.

Fortunately, when I open del.icio.us’ homepage today, I spotted a notification on the top of the page said that there is a “Beta del.icio.us extension for Firefox 3 now available”!

Woohoo, the wait is end, download the new del.icio.us add-on here.


LMAO, What a Mistake!

I’d gotten a “spam” (not totally, I found some real great deals from them) Email from TigerDirect.ca today and I really couldn’t help myself from LOL.

TigerDirect.ca Flyer Mistake


Swap without Temporary Variable

When we’re programming, if we want to swap values of two integer values, the “normal” way we do it would look like:

x = 5
y = 3
 
temp = x
x = y
y = temp

We need a temporary variable as a container to hold a value first then do the swap.

What if in some situation you can’t use the extra variable? How would you do it?

Well, let’s forget computer programming but pick up some little math we learned in elementary school:

x = 5
y = 3
 
x = x - y (=2)
y = x + y (=5)
x = y - x (=3)

Here we go!


A Math Problem and the Answer

Problem: Two prime numbers (>=5) and there are one and only one number between them, such as (5, 7), (11, 13), (17, 19), etc.. Prove the sum of such two prime numbers can always be divided by 6.

Answer: All the natural numbers can be expressed as 6n+0, 6n+1, 6n+2, 6n+3, 6n+4, 6n+5, n >= 0. 6n+{0,2,4} are all even and 6n+3 can be divided by 3, so they are not prime numbers (2 is prime, but the problem is asking prime >= 5, so we ignore 2 here). Therefore, prime numbers can be only in two forms: 6n+1 and 6n+5.

Let p1 = 6n+5 and p2 = 6(n+1)+1, there is only 6(n+1)+0 between them, which satisfies the constraint in problem description. Then, p1 + p2 = 6n+5 + 6(n+1)+1 = 6(2n+2) which obviously can always be divided by 6. Note that p1 and p2 can be any two natural numbers satisfy that constraint, therefore two prime numbers. This example concludes our proof.


Solution to Lenovo Y410 Sound Problem On Ubuntu 8.04

Update 30/04: This script will only make speaker work, but not headphone. As Sam mentioned, there is another easy way to get sound work without installing anything: Suspend your machine and resume. The drawback is you have to do it every time after you (re)boot.

Ubuntu Logo Linux jaux.netWell, this is another post about Ubuntu 8.04!

As I mentioned before, Lenovo Y410 laptop’s sound card wouldn’t work out of box on Ubuntu 8.04, which is very disappointing for Y410 owners like me.

Fortunately, we can solve this problem in the same way as on Ubuntu 7.10 and the most intuitive solution I could find on Internet is “Getting Sound to work on your Ubuntu 7.10 installation on Lenovo Y410 Series laptop”. Thanks the author, Ambuj Varshney, for the good job!

The solution is straightforward, but it’s kind of verbose there are too many steps to perform, kind of; so I wrote a bash script to do the job. You can download the script from my box.

After you downloaded this script (y410_sound-20080427.sh), run it as follow:

chmod +x y410_sound-20080427.sh
sudo ./y410_sound-20080427.sh

This script may take a long time to finish since it will download all the required packages and compile the driver, so please be patient.

After it’s done, reboot your Y410 and then you should be able to enjoy your music!

Note: I only tested this script on my Lenovo Y410. If you have any problem while applying this script, please leave comments.


How to Play Rmvb Files In Ubuntu 8.04 (Hardy Heron)

Ubuntu Logo Linux jaux.netIf you experienced this topic earlier, you know that it’s tough to solve. Playing Real video format files (e.g. rmvb files) is still a problem in Ubuntu 8.04, but don’t worry, it’s now much easier than before.

So, here we go:

  1. Follow the official instruction to install all the restricted formats:

    sudo apt-get install ubuntu-restricted-extras
  2. Install MPlayer:

    sudo apt-get install mplayer
  3. Download MPlayer binary codecs package from here.
  4. Install MPlayer binary codecs package: (Note: the package name may differ from yours.)

    tar xjvf essential-20071007.tar.bz2
    sudo mkdir /usr/lib/codecs
    sudo cp essential-20071007/* /usr/lib/codecs

At this point, you should be able to play rmvb files now. In case you still can’t, install libstdc++5 as follow:

sudo apt-get install libstdc++5

Bonus: I highly recommend you to give SMPlayer a try. You can get SMPlayer by:

sudo apt-get install smplayer

Huge Mistake

Doctor Adson

Everybody is recommending everybody to upgrade to Wordpress 2.5.1, and I did, but I made a huge mistake during the process:

I deleted the uploads directory! All my blog images were located there and the even worse situation was that I didn’t have any backup of those images…

Anyways, if you cannot see those pictures in my previous posts, I would say that I am really sorry about that. I’ll be very careful next time and I hope such accident won’t happen again.

p.s. Cron seems interesting, I’m going to do some researches and ask it to backup my files periodically.


Hardy Heron

This post is composed under Ubuntu 8.04 — Hardy Heron.

Ubuntu Logo Linux jaux.netI installed Hardy in my Lenovo Y410 half an hour ago. Most hardware (monitor, video card, wireless card, wireless mouse, webcam, etc.) work out of box, but like 7.10, the sound card still requires some efforts to make it work. In software, Gimp is upgraded to 2.4.5, OpenOffice.org now is in version 2.4 and Firefox 3 beta 5 is installed as default.

A lot of improvements, but pretty much no excitements for me (Firefox 3 can be counted as a “Wow”, but I’m using it at work everyday, so…). I’m kind of disappointed tonight. However, I heard that Hardy has a feature which lets user to install this Linux distro on top of Windows; this could be interesting, but I haven’t gotten chance to try it yet.


Demonoid.com Is Back!

Demonoid.com Logo jaux.netYes, it’s BACK! We’d waited for so long.