A passionate programmer’s findings in the world of internet.

Configure WEP Wireless on XBian (XBMC)

November 13th, 2012

This could be something extremely easy for the pro, but it took me hours to set this up. I'm using an old TP-Link wireless adapter. After installing the latest XBian (1.0 alpha 2) on my Raspberry Pi, I found no way to get myself to the terminal, even after pressing "Exit" from XBMC screen.

I had to plug in a network cable and ssh into it. For this version, the login details are:

user: xbian
password: raspberry

Whenever you run sudo, the password is "raspberry" too.

Once logged in, exit the blue setup screen. Then run the following command:


You should see a new "wlan0" on top of the existing "eth0" and "lo" entries, if the wireless adapter was detected and installed correctly. I'm not sure what to do if it's not!

Run the following command to install the wireless tool.

sudo apt-get install wireless-tools

Then run the following command to set your WEP settings.

sudo /sbin/iwconfig wlan0 essid <ssid>
sudo /sbin/iwconfig wlan0 key <key>
sudo ifup wlan0

You should get your WEP wifi working by now. Alternatively, you can configure by editing your /etc/network/interfaces to something similar to the following:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wireless-essid <ssid>
wireless-key <password>

#wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
wireless-power off
iface default inet dhcp

Hope somebody would find this helpful. Do note that WEP is not secure enough for your wifi, always go for WPA2 whenever possible.

Using wget for Server Migration

January 19th, 2012

I thought wget is solely good for downloading stuff when you ssh to your server, it can also be used to access FTP account and recursively pull everything over!

wget -r -l 100 ftp://login:password@domain.com/public_html

-r for recursive
-l 100 for 100 level of depth, wget has a default depth of 5 levels only

I learned about this from this site, but he didn't mentioned about depth. I have to redo the whole process and my client had to wait longer.

Hope you find this useful.

Redirect a Directory to New Location using .htaccess

October 19th, 2011

After migrating system from temporary server to a new server, we will have to request all users to go to the new site.

I am not an expert in Apache rewrite rules, but finally found this way to redirect everything from a specific directory to a new location.

RedirectMatch 301 / http://blog.enrii.com

Save the file as .htaccess, then put the file into the folder you want to redirect (should be somewhere inside your htdocs folder). Replace http://blog.enrii.com with the new site that you want to redirect.

In case it doesn't work, see if the following line in httpd.conf is commented:

LoadModule rewrite_module modules/mod_rewrite.so

Un-comment it if necessary.

That's how I finally got it working. Please let me know if I am not doing it correctly.

Mac OS X Lion

September 11th, 2011

One Apple product after another. Just upgraded to Lion from Snow Leopard on my Macbook Air. Postponed the upgrade for until now due to limited space on my 64GB SSD, also partly due to new process spawned in my personal life.

Although most of the new features are exciting, I find some features in Lion annoying. Apple likes to make decision and thinks that everyone would be happy with their product, either they like or they will have to get use to it then like it. I agree that this approach is the only way to keep things simple and nice.

One such annoying feature would be "Reopen windows when logging back in". I have heard about Mac users who never shuts down the machine because they want to keep their halfway work. This feature will be a great addition for these people. It's not for me, I always like to turn off everything and shut down at the end of day and start from fresh the next day. This feature does not allow me to do something as simple as this!

I will have to untick the checkbox on every shut down. I really need Mac to remember my last input during previous shut down.

As for the good, one main exciting feature for me would be the enhancement to Mail.app that made it works like a real email client.

Other notable feature would be the "natural" scrolling. It actually feels very unnatural in the beginning. Only after you recall how iPad works, it feels much more natural. But scrolling backwards with a mouse doesn't feel natural at all. Had to get the free Scroll Reverser to reverse mouse scroll.

So, was it worth my USD29.90? Maybe. At some point I think Apple is charging more than Microsoft because this is merely increment of 0.1 version instead of a whole new version.

Would be very interested to know what is the conversion ratio from Snow Leopard!

iPad from Singapore

September 6th, 2010

Apple iPad

Apple products are really tempting. I can't imagine myself being one of those geeks who would travel all the way to another country to purchase an Apple product just because I couldn't get it in my country.

Before I left for Singapore 2 days ago, we (my wife and I) have decided not to get iPad, reasons being:

  1. The first version of everything could potentially has undetected flaws. As a developer myself, I always believe end user testing would be the best testing, and iPad has not been in the market long enough and I don't want to be white rat.
  2. There are much more iPad competitors coming up very soon, mainly the Samsung Galaxy Tab that runs on less restricted Android platform.
  3. There are also rumours saying Apple is going to launch a mini iPad which could be much more convenient to bring around.
  4. There is no reason to get an brand new device and jailbreak it the second day, then lose it warranty. I have subscribed to home broadband, office broadband and BlackBerry unlimited packages, and I will need to get another 3G broadband for my iPad. I need to get iPad to tether with BlackBerry and that is not possible unless you jailbreak it.
  5. There are also rumours saying iPad will be in Malaysian Apple store very soon. Why the hassle?

There are much more reasons for not getting iPad at this moment.

All the reasons suddenly dismissed from our mind when we saw the Singaporeans travelling in MRTs surfing net with iPad. We saw some GeekCamp attendees surf net with iPad.

We also thought it wouldn't be easy to find iPad as it could have been wiped out by the Singaporeans, especially the entry level 16GB wifi units.

However, we really can't deny our luck when we found it at the fourth Apple store, and we have to get ourselves the iPad which damaged us SGD729. Not too expensive but not cheap too.

After owning it for less than 48 hours, I have a mixed feeling with the device.

It really changed the way people uses computer. Apple has done it again. It makes me feel like laptops will not stay for long, or the market share of laptop will drop tremendously.

I believe there are more than 50% of the users who are using computers solely for internet (or Facebook). Big portion of this user group will definitely go for iPad or similar device if they did not fall for netbooks earlier when it hit the market a year ago.

The only downside of the device, is the touch screen keyboard which I was unable to get used to it yet. Although it's hard to type on screen and I keep on getting typos, can see that the iPad is working hard to help me correct the spelling as I type. If much more effort were to be put on typo corrections, users will definitely enjoy the device more.

With all that being said, I don't think it suits me. The problem is not the device, the problem is me.

I do not see it replacing my BlackBerry or MacBook Pro. I'd still prefer to read on my BlackBerry while I commute on public transport because it's not small enough to be carried around. I will still have to use my MacBook to get my work done. There is no point adding a third device into my already heavy bag.

It shall only serve as a device for some light surfing at night, or for some urgent work in the shopping mall, on a non-working day. It's much more for my wife (for her favourite Angry Bird game) than myself.