Category: Tech, Code & AI

  • Welcome back

    As promised, I will attempt to revive my blogging.

    As I type, I’m actually watching “The Social Network”. Damn geeky, I know. Not the best movie of all time for a Saturday night.

    Anyway just to start off the new year – lots of shit happened in Q1 2011. My “Ultimate” Driving Machine™ had a cracked radiator which meant it needs to be replaced. Not too expensive but still ouch.

    A friend got into an accident with a bus that tried to flee the accident scene. Thank god he’s not injured at all – the bus hit the passenger side and he was alone in the vehicle. He was lucky he had a witness.

    My high BMI neighbours upstairs are still as annoying as ever, even right now at 1.25AM and I have another 3.5 years to put up with them and you bet I will.

    By the way, if you’re wondering – Singapore has no decent law against domestic noise. There’s nothing the government can really do if you have an imbecile neighbour like mine. All you can hope is to curse them to rot in their filthy home and get eaten by fleas so they’ll mixmash well with the herbs and spices they pound daily in their bedroom. I’m not sure if even an impending election would change anything since Bukit Panjang is still split into two.

    Just six hours ago I heard I got voted to be in the EXCO of KH. I’m puzzled how I got voted even when it was a no-show; I was at CGH and it wasn’t a lie. I don’t think I can commit and I will not bullshit my way into a role I cannot put quality effort into. This is precisely what I am going to tell them during the next meeting: Career, Family, Hobby. Choose two. You don’t need to be a rocket scientist to answer that.

    I’m also trying to adopt a minimalistic approach to life. I’m trying to get rid of shit I don’t need and just keep the necessary stuff at home. I’ve always believed in buying things of quality versus price since high quality stuffs tend to last longer. Also you’re likely to only need ONE good, say, shoe than ten cheap shoes.

    That’s it for today. I need to watch my movie. Stay tuned for more updates.

  • Offline HTML Mobile Apps

    Picking up iOS is quite a bit of work plus you need to buy a Mac to get Xcode running.

    Yes I know you Hackintosh folks are going to start making some noise but let’s keep this legal.

    So I’ve decided to build quick apps using jQTouch.

    To get an App icon on your home screen, simply… add the page to your home screen! Duh. It’s like adding a bookmark. Try it – it works!

    But here’s the next problem – how do we get the apps to work without network connectivity?

    HTML5 introduced something called the offline cache manifest. Here’s how to use it…

    Step 1 – Create a file called yourfilename.manifest with the following content

    CACHE MAINFEST
    demos/main/ajax.html
    demos/main/ajax_post.php
    demos/main/index.html
    demos/main/jqt_startup.png
    demos/main/jqtouch.png
    jqtouch/jqtouch.min.css
    jqtouch/jqtouch.min.js
    jqtouch/jquery.1.3.2.min.js
    themes/jqt/img/back_button.png
    themes/jqt/img/back_button_clicked.png
    themes/jqt/img/button.png
    themes/jqt/img/button_clicked.png
    themes/jqt/img/chevron.png
    themes/jqt/img/chevron_circle.png
    themes/jqt/img/grayButton.png
    themes/jqt/img/loading.gif
    themes/jqt/img/on_off.png
    themes/jqt/img/rowhead.png
    themes/jqt/img/toggle.png
    themes/jqt/img/toggleOn.png
    themes/jqt/img/toolbar.png
    themes/jqt/img/whiteButton.png
    themes/jqt/theme.min.css
    some/other/file.name

    Step 2 – Make sure your web server reports the MIME type correctly by adding the following config to Apache. You might need to contact your hosting provider to get this done.

    AddType text/cache-manifest .manifest

    Step 3 – Add the following tag to your HTML page so the browser knows where to find the manifest.

    <html manifest="yourfilename.manifest">

    That’s it!

    Original reference material here.

  • IPv6 over GRE in RHEL/CentOS

    Note: This article is not about 6-to-4 tunneling. This is about carrying IPv4 and IPv6 at the same time (aka Dual Stack) over a GRE tunnel in RHEL/CentOS

    I was configuring an existing GRE tunnel on my Linux router when I found that the initscripts in CentOS 5.5 didn’t support IPv6 for the tunnel devices.

    The quick hack was to edit /etc/sysconfig/network-scripts/ifup-tunnel and look for this line:


    /sbin/ip link set dev "$DEVICE" up

    Add these lines just after the line above:


    # Added to accomodate IPv6 in tunnel
    /sbin/ip addr add "$IPV6ADDR" dev "$DEVICE"

    Then modify /etc/sysconfig/network-scripts/ifcfg-tun0 (or whatever your device name is) and add the following lines to run dual stack over GRE:


    IPV6ADDR=2001:abcd:1a2b:3c4d::2/64

    If you need to use the tunnel as an IPv6 default gateway, create /etc/sysconfig/network-scripts/route-tun0 and add an entry


    ::/0 via 2001:abcd:1a2b:3c4d::1/64

    Then just restart the interface and bingo IPv6 and IPv4 dual stack on a GRE tunnel.

  • Review of iOS 4 on iPhone 3G

    I’ve just updated my iPhone with the new iOS 4 firmware yesterday and here’s a short review.

    There has been lots of commotion about multi-tasking but I’m not the least concerned — not because I am not getting it on my iPhone 3G, but because I don’t see a need for it with the type of apps I use. Mail and Google Maps in the background doesn’t make sense. I might change my mind if there’s a good IM client someday.

    For now, the only useful features are shown below.

  • IPv6 over IPv4 (6to4) all up and working

    Yes, I’ve set myself out to learn IPv6. I thought it was simple – or at least with my understanding of IPv4. I was completely wrong! IPv6 has a much more complicated addressing scheme and “rules”. It requires a change of mindset for a start. The worst part? Getting it all to tunnel through IPv4 when you’re running dynamic IP.

    Anyhow, I’ve got my Linux (CentOS 5) box working and my home network is now “IPv6 ready” (hooray!) but I’m still tweaking the settings so I’ll update the technical stuff later.

    Some little bits about IPv6 I’ve learnt so far is that DHCP servers aren’t really required anymore. Interfaces can self-assign an IP based on their MAC address and this will be almost certainly unique (since MAC addresses are unique). Even in a controlled network, the interface would assign it’s own address.

    Meanwhile, here’s my traceroute to ipv6.google.com. 😀

    traceroute6: Warning: ipv6.l.google.com has multiple addresses; using 2404:6800:8005::63
    traceroute6 to ipv6.l.google.com (2404:6800:8005::63) from XXXX:XXXX:XXXX:1:217:f2ff:fe40:3848, 64 hops max, 12 byte packets
    1  XXXX:XXXX:XXXX:1::1  0.534 ms  0.392 ms  0.410 ms
    2  2002:c058:6301::1  199.142 ms  199.858 ms  199.485 ms
    3  2001:470:0:13b::1  201.157 ms  200.728 ms  198.965 ms
    4  2001:504:d::1f  197.870 ms  199.858 ms  199.927 ms
    5  2001:4860::1:0:21  290.454 ms  203.619 ms  264.787 ms
    6  2001:4860::1:0:77d  220.451 ms  220.804 ms  436.060 ms
    7  2001:4860::1:0:75  511.964 ms  511.896 ms  320.166 ms
    8  2001:4860::1:0:16  703.447 ms  399.187 ms  624.945 ms
    9  2001:4860::2:0:119c  511.687 ms *
    2001:4860::2:0:119b  529.863 ms
    10  2001:4860:0:1::e3  403.409 ms  517.593 ms  400.969 ms
    11  * * *

    Hop 11 seems to have packet filtering and dropped my traceroute.

    I’ve also masked my internal LAN IP to XXXX:XXXX:XXXX otherwise somebody could connect back to my LAN segment. I haven’t had time to figure out the firewall yet. But you can say this is the beauty of IPv6. With a 128 bit address space, every machine has a public routable address.

    Once I have my home network all ready I will begin transitioning all my servers to IPv6. Embrace technology.

  • Second last CS3216 blog, lah!

    OK, Prof. Ben is chasing me for a blog and since I’m sitting here (at work, at this hour) waiting on a colleague, I shall write a short entry. I realized I haven’t been blogging for a while and my 105% honest excuse is that my manager went to Sungei Gedong Chalet (a.k.a. Reservist) so I was busy as hell covering some of his work.

    So here comes the second last blog entry. Aheem… (clears throat)

    I’d love to thank my wife, mother, father, etc. and of course Prof. Ben for inviting me to attend this class out of nowhere. I truly enjoyed my time and learnt a lot of things. Actually, I joined the class with the aim to learn anything, or what Prof would call “random stuff“, not to develop Facebook apps. I’ve actually had enough of Facebook apps back in 2007 where I worked in a small company dealing with some very first Facebook applications being made out of Singapore, although building an app for others and building an app for yourself is a different thing altogether.

    So what have I really learnt? I’ve learnt that my English sucks after four years of being bombarded by Singlish in the local workforce. I’m actually struggling to write a proper blog entry every time.

    I’ve also learnt that I’ve lost touch with the geek world. I didn’t even know what Google Wave was. I’ve never heard of Prezi, and I’ve never heard of DropBox. There’s probably about 100 other things I’ve never heard of that I found out during these 13 weeks.

    I’ve also found out that damn NUS students can talk and present! Sorry lah, but to the outside world NUS students are either like nerds or CMI. 😛

    I’ve also found out that a year 1 freshie can actually learn ActionScript 3 build a Flash game within 1 week.

    So there are super things that people can do that you’ve never thought was possible. But, now I know the power to create lies within, and I finally kicked myself in the ass and learnt how to build stuff in Flash. So, yes, I picked up a new language. Programming language, not French.

    I also face new challenges trying to get things done. I think it’s a little different everywhere. Back in Polytechnic, it was either nobody cares, or maybe I cared too much. Yufen once said doing project a with me gave her “满足感多多,成就感少少” (great sense of satisfaction, no sense of achievement. Did I translate right?) because I practically wrote most of the code and we’ll all get an ‘A’. 😛

    Then at work you could K people ‘cos they either deliver the goods or get fired. It was the root of all evil at work. $$$

    Then in NUS it was also different – everybody cared too much, but was too busy. Like Prof. Ben said, this is not the typical NUS class. OK, I buy his explanation.

    So anyway, CS3216 is a weird class, but I guess it’s weird in the right way.

    Back to work…