Swap without Temporary Variable
Filed in Programming, April 30, 2008, 12:47 pmWhen 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 [...]
A Math Problem and the Answer
Filed in Discovery, April 27, 2008, 9:38 pmProblem: 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. [...]
Solution to Lenovo Y410 Sound Problem On Ubuntu 8.04
Filed in Linux, Programming, , 4:21 amUpdate 2008-11-20: In a comment, Ace pointed out that Ubuntu 8.10 already has this problem fixed.
Update 2008-10-6: please don’t use the y410_sound script from this article since I don’t own a Y410 anymore, so I couldn’t test and maintain the script. Instead, please follow the solutions given in the comments. They seem to work pretty [...]
How to Play Rmvb Files In Ubuntu 8.04 (Hardy Heron)
Filed in Linux, April 26, 2008, 8:55 pmIf 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:
Follow the official instruction to install all the restricted formats:
sudo apt-get install ubuntu-restricted-extras
Install MPlayer:
sudo apt-get install [...]
Huge Mistake
Filed in Personal, April 25, 2008, 11:29 pmEverybody 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 [...]