Latest Publications

Blogging Haitus for a Few Days or Weeks

Hey everyone. Dad had a heart attack a few days ago. Thanks for all your thoughts and well wishes. I’m keeping count and there are about close to 100 different individuals up to now who have expressed their concern and well wishes to my family. I appreciate it. I would just like to inform everyone that there won’t be any blog posts until my dad gets out of the hospital. Follow me on twitter for the latest updates of what’s happening to my dad if you’re interested. I hope to be blogging again soon.

My List of Tools for Visual Studio 2010

This is just a compilation of tools and software for Visual Studio 2010 for my own use to keep track of what I’m interested in. It might help someone out there. I’ll sort it out when I have the time, and put some descriptions. If you have any others, please comment and I’ll add to the list.

Why don’t MRT stations have 2 escalators going up instead?

One fine evening heading out after a day’s work, I was at the MRT station (that’s what they call trains or subways in Singapore) heading somewhere and a woman behind me proclaimed loudly in an irritated manner, “Why don’t they have 2 escalators going up instead?”

I’m sure everyone noticed this at Clementi MRT station with 3 escalators that 2 escalators are always going down in the evenings (I’m not too sure about mornings), and 1 is going up. Many have complained many times while going up the escalator that the other 2 escalators going down are empty. Just to give some context, 2 escalators are going downwards to the exit of the station, and 1 escalator going upwards to the platform.

Here is the rationale of why it might have been done this way, instead of 2 escalators going upwards to the platform.

Logically speaking, you do not want to your platform to be filled with people. If you have 2 escalators going up, that means for every 4 people going up, 2 people are going down (hypothetically speaking), assuming 2 people can get onto the platform per escalator. If you do the math with a normal constant distribution across a period of time, your platform will eventually get filled up. However, this is not a normal distribution, because we have to take in account the number of people getting on the train and off the train.

Assuming that every time a train comes, the number of people exiting the train into the platform is lesser than the number of people entering the train. This means the replacement rate is lesser and less people are exiting. It does not make sense to have 2 escalators going downwards. However, during the evenings after work, since Clementi is a heartland, i.e. residential area, we can assume that the number of people exiting the train will be more than the number of people entering the trains. Therefore it make sense to have 2 escalators going downwards to allow these people to exit.

Does that mean that in the morning while people boarding the trains at this station will be more than the people exiting the trains? Does that justify the 2 escalators going downwards? Since I do not take the train in the mornings, I cannot comment on the current situation. However, it still make sense to have 2 escalators going downwards to channel more people to exit the station.

Do you want to take the risk of overcrowding your train platform if you were in charge of the station? No. How about if there is a sudden influx of passengers into the station from the trains, which happens every 1 minute or so during peak hours? You need to channel them out of the station quickly. So it only makes sense that the station is designed to prefer channelling more people out of the station rather than into the station.

That, is why MRT stations don’t have 2 escalators going up instead.

High-Level Analysis of iPhone OS 4.0 Multitasking

iPhone OS 4.0

Apple recently announced iPhone OS 4.0 enabling “multitasking” of a sorts. I want to dig slightly deeper into understanding what they actually mean by this “multitasking”, without talking too much about the nitty gritty details.

There are 7 kinds of “services” they expose for multitasking:

  • Background Audio
  • Voice over IP
  • Background Location
  • Push Notifications
  • Local Notifications
  • Task Completion
  • Fast App Switching

Among all 7 “services” exposed, 6 of them are somewhat already available in the system itself, one way or another, with hidden APIs not exposed for public developer usage. Let’s take a look at each of them, and how they might “save battery” without “slowing down the system”.

(more…)

Refactoring and Extracting XML Literals

I was recently given a task to refactor and extract the XML Literals and here’s my solution, which isn’t the best, but it is good enough for now.

Let’s say you have this code:

Dim number1 As Integer = 5
Dim number2 As Integer = 10
Dim xml = <MyXml><%= number1 %><%= number2 %></MyXml>

Where you have an embedded variable using XML Literals within this block of XML. You want to extract that XML out to a file, instead of embed it into the language. Here’s a solution I came up with, and will definitely be thinking of how to solve this problem a little less “hack-ishly”.

<MyXml>{0}{1}</MyXml>

So I extracted out the XML and replaced all embedded XML Literal code with {0}..{1}..{n}. Or anything that’s unique for replacement.

Public Shared Function GetXml(ByVal number1 As Integer, ByVal number2 As Integer)
    Dim template = New StringBuilder(XElement.Load("myxml.xml").ToString())
    Return XElement.Parse( _
            template.Replace("{0}", number1) _
            .Replace("{1}", number2) _
            .ToString())
End Function

Then I read the xml file and spit it out as a string, replace all the {0}..{1}..{n} with the actual parameters. I was actually going to use String.Format (hence the chosen {0}..{1}..{n} replacement) but couldn’t seem to get it to work.

Dim number1 As Integer = 5
Dim number2 As Integer = 10
Dim xml = GetXml(number1, number2);

So all I do is just replace that entire block of XML Literal with a call to the method. That’s how you can refactor and extract out the XML Literals from Visual Basic .NET code. If you know of a better way to do this, please post a comment with your solution.

Note: Please mind my Visual Basic .NET code. It’s not my first language.

BarcampSG5: The Future of Porn

2010-03-27 15.50.58

Last week at BarcampSG5, I had the opportunity to do a cool discussion/presentation with DK on “The Future of Porn”.

2010-03-27 17.58.30

Here’s what came out from the discussion:
- 3D TV
- 30 Rock (Porn for Women)
- Interactive 3D
- Modality (Senses)
- Porn as a Service
- Augmented Reality
- JibJab (Replace sexy photos with your favorite faces)
- Avatar, Matrix
- Gesture
- Porn Games
- Aibo (Electronic Robotic Porn)

Photos

Acer Liquid Review

DSC08193

Introduction

The Acer Liquid was just released in Singapore in mid March. I had a chance to have the Acer Liquid for a few days to play with, and my first impression is that it isn’t all that great in terms of software, but it has comparable hardware of any top Android phone out in the market right now (e.g. Nexus One). I keep emphasizing that the wonders of owning an Android phone is that you can depend on the community to improve the software OS for you. In this case, if you are looking to buy the Acer Liquid, I highly recommend you to flash a new custom Android 2.1 rom instead of staying with the vanilla 1.6 rom. With that said, let’s go into the specifications.

Specifications

DSC08216
As usual, I will only post those specs that are interesting.

Acer Liquid
CPU 768 Mhz (1 Ghz down-clocked) Snapdragon
OS Android 1.6 (Donut)
RAM 256mb
Connections MicroUSB, 3.5mm Headphone Jack
Buttons Physical – Power, Camera, Volume
Touch – Home, Search, Back, Menu
Screen & Camera 3.5″ WVGA (800×480) Capacitive Screen & 5MP Camera
Custom Task Manager Shows Real-time Screenshots of open apps (up to 9)
Custom Apps RoadSync Mail + Calendar (MS Exchange), Acer Sync, etc.

I Like

DSC08221

The phone is about the same size as the Nexus One, just slightly thicker and bigger, but it does have a nice plastic casing which some people like. The few small customizations like the custom task manager when you press and hold the home button pops up a realtime screenshot of the current running applications. Other “normal” application aesthetics like integrating with your social networks are now becoming the norm for most phones, so this isn’t anything interesting.

DSC08220

However what is surprising is that for the OpenGL ES 1.1 test I ran (Neocore), beat the Nexus One for FPS as shown above. This is shocking because it is essentially the same CPU, and even down-clocked.

DSC08198

I like the position of the power button at the side, as opposed to the power button at the top for the Nexus One. It makes it easier to unlock the phone, since the touch-only buttons are deactivated when the phone is locked.

DSC08203
DSC08204

I think quite a lot of people might wonder how to open the Acer Liquid to get to the battery. There is a small gab at the top left back corner that you need to use your fingers to pull it out.

I Dislike

DSC08213

Naturally the first thing I do not like about the Acer Liquid is it is running Android 1.6. Currently there is no official statement regarding the eligibility of an upgrade for Acer Liquid, but I have high hopes that it will.

DSC08196

I do not like the flap covering the MicroUSB, but I guess in order to maintain the aesthetics of the phone, covering the MicroUSB is one option for them to do. But it does not make sense when you have to keep taking it out every time you charge every day, which will make it faster to wear and tear.

My Thoughts

With Nexus One already out there, HTC Desire and Legend coming out soon, Acer has released their phone at a bad time. There isn’t any official word whether Acer will be offering an Android 2.1 upgrade. I think you should wait for the HTC Desire or just get the Nexus One instead of Acer Liquid if you want to be on top of the game. If you still want to get the Acer Liquid, consider looking at a custom Android 2.1 ROM.

Summary

Ultimately, I cannot find many faults with Acer Liquid, yet there isn’t a lot of compelling reasons to get this phone over what might be released in a 2-3 months. However, if you can’t wait and would like to get an Android phone, I would say Acer Liquid is a smooth cell phone, balancing between power and affordability.

Acer Liquid is currently selling in Singapore at a retail price of S$788 (without contract).

+ Solid WVGA Android Phone
+ Good Hardware
- Android 1.6 (unknown if there will be a 2.1 upgrade)
- Down-clocked 1 Ghz Snapdragon to 768 Mhz

Photos

Do Not Be Alarmed – Be Back Soon

Hey, just thought I’ll update everyone. My MacBook Pro 13″ Mid 2009 is in the Apple Care Service Center and I’m trying to get the screen replaced because of a defect as mentioned: “White Ring of light in the middle of blank white screen“. The Apple Care Service Center is saying it isn’t a defect but a damage from “abnormal” usage, which is simply ridiculous. How can there be a perfectly circular ring in the middle of the screen ONLY when it is white? It is not the same symptoms as a bright spot, or burnt pixels.

I won’t be able to write much this week because of this, and I hope to get back my MacBook Pro by the end of the week with the screen replaced. Wish me luck. Sigh.

Windows 2000, XP SP2 and Vista End of Life Support

You heard me. Here are the dates:

Operating System End of Life Date
Windows 2000 Professional July 13, 2010
Windows 2000 Server July 13, 2010
Windows XP SP2 July 13, 2010
Windows XP SP3 Still Supported
Windows Vista April 13, 2010
Windows Vista SP1 & SP2 Still Supported

There you have it. For those still on older versions of your service packs, it is time for you to update your operating systems.

For more information: http://blogs.technet.com/lifecycle/archive/2010/02/24/end-of-support-for-windows-xp-sp2-and-windows-vista-with-no-service-packs-installed.aspx

Resources:
Service Pack 3 for Windows XP: http://www.microsoft.com/downloads/details.aspx?FamilyID=68C48DAD-BC34-40BE-8D85-6BB4F56F5110&displaylang=en

Service Pack 2 for Windows Vista: http://www.microsoft.com/windows/windows-vista/default.aspx

Don Syme – Introduction to F#

F# is Microsoft’s first functional programming language to be included as one of Visual Studio’s official set of languages. F# is a succinct, efficient, expressive functional/object-oriented programming language under joint development by Microsoft Developer Division and Microsoft Research.

Dr. Don Syme is a principal researcher in MSR Cambridge. He has a rich history in programming language research, design, and implementation (C# generics being one of his most recognized implementations), and is the principle creator of F#. Who better to lecture on the topic than Don? This three part series will serve as an introduction to F#, including insights into the rationale behind the history and creation of Microsoft’s newest language.

C9 Lectures: Dr. Don Syme – Introduction to F#, 1 of 3


Get Microsoft Silverlight

C9 Lectures: Dr. Don Syme – Introduction to F#, 2 of 3

C9 Lectures: Dr. Don Syme – Introduction to F#, 3 of 3