The Facebook game Animal Swapping has caused me much anguish in my bid to best everyone. Now, I’m only third place. It took me a long time to get there and recently I’m reminded why I don’t want to play it anymore.

Image Overlay Error
Some time into the game, I always encounter this error where two animals will overlap and that makes it difficult to solve the puzzle. I don’t know if it’s due to me using Linux, but it’s a good excuse to say why I can’t be first =P
Tags: facebook
During the lifetime of using the computer, I believe everyone will inevitably face the scenario where you will want resize multiple images to a certain size.
In Linux, you can do it will such ease that makes you wonder what you use Windows for.
This effect can be easily done using the command line. Naysayers will probably disclaim the effectiveness of this tip but it really is easy for those who know Linux. All you have to do is to go into the directory where the images are stored and run the following command:
for k in $(ls *.jpg); do convert $k -resize 1024x768 -quality 100 re_$k; done
When I was writing my post “Setting a Static IP Address in Ubuntu“, I encountered a strange problem.
In the post I was describing the location of of a directory and it contained the following:
/ etc/network
Notice that there is a space between the word “etc” and the preceding forward slash? If I were remove the space between these two characters, I will get the following error message when I preview or publish the post:
Method Not Implemented
POST to /wordpress/wp-admin/post.php not supported.
I don’t know if this is an isolated incident or a Wordpress vulnerability. I wonder if anyone else has encountered this problem.
Just recently I had to set up a few workstations for developer work. I installed them with Ubuntu 9.04 (Jaunty Jackalope). I had originally installed them with 9.10 (Karmic Koala) but for some bloody reason, Eclipse, both Ganymede and Gallileo, don’t work on Koala. Anyway, that’s another story for another time.
So the workstations are used for Web development, each has to have a static IP address. Being a small outfit, we don’t have a DNS server. Therefore we need to set each machine’s IP address as static. I thought that it could easily be done with the Network Manager tool in the menu bar, but I was wrong.
The server holding the project files for the e-learning application that I’m developing just died on me today. The cause of the server dying is the insertion of a faulty RAM chip. What flabbergasted me was that the chip was idenfitied as faulty before. Why my colleague knowingly placed the RAM into the server I don’t know. I haven’t gotten a chance to ask.
The result of that action was that the server could not boot up. In fact, the problem was so different from what I’ve encountered before that it didn’t even occur to me that RAM could be the problem. The CPU was supposed to be a headless node that our developers access over the network to the repository and the wiki. What tipped me off was that the CPU was not reachable even after turning on. Network cable seems fine, and are connected at both ends properly. The system was working fine the Friday last week. Then I connected a monitor to the server to try to resolve the issue. Strangely, what came up on the monitor is an image that is akin to static noise you see on TV (during the analog days).
A few days ago, I had to set up a mail client to retrieve mail from a hosted Google mail account. Setting the mail client should be a very simple affair that can be done in a few minutes. I never imagined it would take me more than 10 minutes to get it working.
Tags: gmail
As any respectable JavaScript developer will know, JSON has become the de facto method of holding objects and passing arguments, even using it as a name-spacing mechanism.
Being the conscientious (and careless) programmer that I am, in my e-learning application that I’m developing at the moment, where I’m heavily using JSON, I made a conscious choice to always leave a comma at the end of the last member-value pair like so:
return {
func1: function() {
return "function1";
},
func2: function() {
return "function2";
},
}
(Of course this is a simple example. In my actual code, the JSON object is several hundred lines long.)
This way, I’ll always be reminded that a comma is needed in between my function definitions, and it also acts as a way to identify the closing brace.
Sounds like a good idea right? Wrong. Turns out, it completely broke in IE7. The variable that is returning this JSON object was declared “undefined” in IE7, though the script worked fine in both Chrome and Firefox – even IE8.
Well, after some investigation, it appears that leaving a trailing comma in JSON is a wrong notation. The reason why the script worked in Chrome and FIrefox is that they treat this wrong notation as a warning, and continues to parse the object as though the comma isn’t there, whereas IE7 treats the trailing comma as an error and halts the interpretation of the object. Lo and behold, removing the comma brought peace, joy and laughter to IE7 world – while remaining sane in Chrome and Firefox.
return {
func1: function() {
return "function1";
},
func2: function() {
return "function2";
}
}
So lesson to learn here is: trailing commas are bad in JSON.
Tags: javascript