Wednesday, November 28, 2007

Short Week in Singapore

Last week, I had to head back to Singapore to help out and attend my brother's wedding. Past that initial rush during the first few days up till the wedding, I did manage to get a breather to do a bit of 'sightseeing' before returning back to work.

So quickly another year has passed since I was last back, yet within a single year, there seems to be remarkable amounts of changes throughout the island. The first thing that I observed is that the effects of population increase seems to be manifesting itself already: out of the few days that I have been travelling on the roads, there is not a single day that I have not encountered traffic delays.

Peak hour commute on the trains seems to be filled to the brim too, and while trains during non-peak hours are slowed down to 20-minute intervals, which is really annoying. But on the etiquette side, Singaporeans seems to have improved a little, given that they sometimes do adhere to the rule of giving way and standing to one side of the escalator now, if they are not moving.

The increase in foreigners is noticeably apparent too, but the difference since last year, is that it has not just been an increase of the Chinese from the PRC, but also the 'Ang Mohs', who have started to move into the traditional 'heartland' areas too. In fact, I was rather surprised to see one sitting down in a Yishun coffeeshop reading 'The New Paper' one morning while I was taking a walk! Maybe that was an isolated case, but I did still observe that there is an increasing concentration of Caucasians travelling to Ang Mo Kio, which I guess is where they are living.

Two thoughts that I have:

One, the increase in rental prices around the island must have hurt, even for the stereotypical  'well-paid' westerner expats, hence resulting in their move into the heartlands. Maybe more so for the Americans, given the US dollar has been rapidly depreciating the past year.

Two, some of these Caucasians aren't your typical 'foreign talents' that you may be expecting. I think at least half the number of them I saw are typical working-class people. Ceding executive positions to 'foreign talents' isn't enough anymore these days, so now we're having to cede mid-level jobs too?!

And if you held the belief that westerners are generally much better dressed than us locals, think again. I saw one shabbily dressed Caucasian fella carrying a number of cases while travelling on the MRT, and another one strolling along Orchard road. With the way they dressed, I would have thought of him as a 'karung guni' man! If he is the kind of 'foreign talent' who has recently immigrated to Singapore, we're in trouble!

Blame me for judging a book by the cover you may, but lest I be accused of being xenophobic, having lived in foreign countries for almost 7 years, I'd be surprised that I'm any less tolerant than anybody else. One thing I'm certain about, is the point of attracting quality people, irrespective of where you come from. Talents are talents, and riff-raffs are riff-raffs, foreign or not. I'm just concerned about making the numbers for 2.5m more people, which without more stringent quality control in the immigration policy, may result in having more riff-raffs in the future.

On physical changes, there are massive redevelopments all around the island. I've seen lots of upgrading works around in Bedok, perhaps stemming from their concern about the possibility of losing their wards since the last election? Besides the covered walkways, the addition of new lifts to every floor seems to be the predominant type of upgrades, probably in the anticipation for our aging society.

There's also a large number of condominium projects around the island, especially areas that are in close proximity to the CBD, like Somerset and Tiong Bahru. The number of condos around the Tiong Bahru area are just staggering! Another trend I've noticed is that pockets of land close to MRT stations have also quite popular for condominiums projects too. With the condo projects sprouting up like mushrooms, they must be building in anticipation of the influx of foreigners, given that they ineligible to public HDB apartments.

Shopping centres too, which the AMK centre is the latest I've seen. Even with older shopping malls, like Bugis Junction and Raffles City, are being retrofitted to utilize every free inch of free space available, to the level of absurdity! Just take a look the retail space outside Kinokuniya bookstore outside Bugis Junction. It's just a bloody pane of glass! Some may think it is 'creative use of space', but I digress. The tranche of land beside Wisma Atria is also in development now, where I read somewhere that it'll be one of those 10-storey shopping buildings modelled after Shibuya.

Pfft... like we don't have enough shopping centres already!

Rather than increasing the number of shopping areas, I much rather that steps be taken to slow the increases in consumer prices instead. Dense shopping complexes will only push up the rents for increasingly limited spaces, the inevitable result of the 'hub' concept that the entire island is redeveloping itself into.

This is however, making retailing more expensive. I've been told that those 'push carts shoplets' rent around $1800 a month at the cheapest and rent for a single foodcourt stall is at least $2500 and up. It is unsurprising why things are getting more expensive by the day. And it'll become increasingly more so. Travel to Yew Tee, and you'll have a taste of what the future will be like: the centralised 'hub', dominated by only a single food-court operator, have prices starting at $4.00 and up. Landlords increasingly have coercive monopolistic powers on rent, which will ultimately trickle down to the average consumer. No wonder  some "Singaporeans are fed, up with progress!"

And finally, what's with Singaporeans' latest fad with doughnuts?! After chasing after 'Hello Kittys', going through the bubble-tea mania and yearning for kopi buns, and now, doughnuts? It's one of those deja vu moments for me, since I have heard of this hare-brained idea from a friend a couple of years ago. He was rather enthused by the idea of importing the 'Krispy Kreme' franchise to Singapore. He should have recently graduated and returned to Singapore, surely, this doughnut 'bubble' can't be part of his handiwork?

PS:Oh, one more thing, I've lost my Motorola Razr phone sometime out at my brother's wedding. It has a US T-Mobile SIM card in it, which makes it easily identifiable, so if any kind Samaritan who manages to pick it up, please do return it! Much appreciated! Namaste! Gam Sia!
Sunday, November 25, 2007

Efficient Market Theory applied to Relationships

I know of a friend who keeps associating relationships with market talk. Well here's another one:
Okay, I'm tired of beating around the bush. I'm a beautiful (spectacularly beautiful) 25 year old girl. I'm articulate and classy. I'm not from New York. I'm looking to get married to a guy who makes at least half a million a year. I know how that sounds, but keep in mind that a million a year is middle class in New York City, so I don't think I'm overreaching at all.

Are there any guys who make 500K or more on this board? Any wives? Could you send me some tips? I dated a business man who makes average around 200 - 250. But that's where I seem to hit a roadblock. 250,000 won't get me to central park west. I know a woman in my yoga class who was married to an investment banker and lives in Tribeca, and she's not as pretty as I am, nor is she a great genius. So what is she doing right? How do I get to her level?

Here are my questions specifically:

- Where do you single rich men hang out? Give me specifics- bars, restaurants, gyms

- What are you looking for in a mate? Be honest guys, you won't hurt my feelings

- Is there an age range I should be targeting (I'm 25)?

- Why are some of the women living lavish lifestyles on the upper east side so plain? I've seen really 'plain jane' boring types who have nothing to offer married to incredibly wealthy guys. I've seen drop dead gorgeous girls in singles bars in the east village. What's the story there?

- Jobs I should look out for? Everyone knows - lawyer, investment banker, doctor. How much do those guys really make? And where do they hang out? Where do the hedge fund guys hang out?

- How you decide marriage vs. just a girlfriend? I am looking for MARRIAGE ONLY

Please hold your insults - I'm putting myself out there in an honest way. Most beautiful women are superficial; at least I'm being up front about it. I wouldn't be searching for these kind of guys if I wasn't able to match them - in looks, culture, sophistication, and keeping a nice home and hearth.

* it's NOT ok to contact this poster with services or other commercial interests

PostingID: 432279810

THE ANSWER

Dear Pers-431649184:

I read your posting with great interest and have thought meaningfully about your dilemma. I offer the following analysis of your predicament. Firstly, I'm not wasting your time, I qualify as a guy who fits your bill; that is I make more than $500K per year. That said here's how I see it.

Your offer, from the prospective of a guy like me, is plain and simple a cr@ppy business deal. Here's why. Cutting through all the B.S., what you suggest is a simple trade: you bring your looks to the party and I bring my money. Fine, simple. But here's the rub, your looks will fade and my money will likely continue into perpetuity...in fact, it is very likely that my income increases but it is an absolute certainty that you won't be getting any more beautiful!

So, in economic terms you are a depreciating asset and I am an earning asset. Not only are you a depreciating asset, your depreciation accelerates! Let me explain, you're 25 now and will likely stay pretty hot for the next 5 years, but less so each year. Then the fade begins in earnest. By 35 stick a fork in you!

So in Wall Street terms, we would call you a trading position, not a buy and hold...hence the rub...marriage. It doesn't make good business sense to "buy you" (which is what you're asking) so I'd rather lease. In case you think I'm being cruel, I would say the following. If my money were to go away, so would you, so when your beauty fades I need an out. It's as simple as that. So a deal that makes sense is dating, not marriage.

Separately, I was taught early in my career about efficient markets. So, I wonder why a girl as "articulate, classy and spectacularly beautiful" as you has been unable to find your sugar daddy. I find it hard to believe that if you are as gorgeous as you say you are that the $500K hasn't found you, if not only for a tryout.

By the way, you could always find a way to make your own money and then we wouldn't need to have this difficult conversation.

With all that said, I must say you're going about it the right way. Classic "pump and dump." I hope this is helpful, and if you want to enter into some sort of lease, let me know.
Wednesday, November 21, 2007

Random Ruby Notes

I have been using Ruby much more than Perl these days to do all my dirty work in scripting most text handling tasks, which I find it is much better at doing these days. My only problem is mainly just the learning curve, which is typical of learning any software language, irregardless of how much conceptual and ideological similarities both languages may share.

Each language comes with it's own 'best practices', little idiosyncrasies and conventions that are unique, and so I'll try to present the following points that I've picked up for Ruby. Pardon me when I litter my subject headings with the 'right way' of doing things, it just means it's the conventional practice usually adopted by Ruby programmers.

The '?' or '!' behind the names of methods

They are both just a language convention. For the question mark, it is normally only for calls that return 'true' or 'false'. For the exclamation mark, it is used to mark that the method modifies 'self', rather modifying a copy while leaving the original unchanged.

It's helpful to note that having the punctuations behind the method names has no other significance besides that, something which is helpful to starters, especially if one is actually looking for an operational difference where there is none.

How do I know what class an object belongs to?

Either by:
object.class == Class

Or:
object.kind_of? Class

This applies only to Ruby being a full object oriented language. Perl does have OOP glued onto it, but seems quite ill-conceived that I hardly use it compared to the usual quick and dirty un-OOP that I'm used to.

The difference between the '==' operator and 'kind_of?' is that the former only matches the exact class, where kind_of? (probably) matches ancestor and descendant classes. I guess that's similar to the 'instanceof' keyword that I'm rather familiar in Java.

The right way for checking if a variable is defined
if defined? variable
puts "right way of checking variable is defined"
end

Where I've originally have been checking for 'defined-ness' by comparing to nil:
if variable == nil
puts "wrong way of checking variable is defined"
end

The right way for checking for array emptiness or non-emptyness

Rather than using arr.size == 0 or arr.size != 0, the two methods in ruby is arr.empty? or arr.any?. A comparison that checks the presence of an array is not a valid comparison for emptiness, i.e:
if [] then
puts "not the right way to check emptiness"
end

The above code is incorrect, because it will always return true as it checks for an array being defined, which is always true (for an empty array), rather than checking for the length of the array being zero.

Class loading mechanism in Ruby

If you needed to load a class definition dynamically, usually by passing the string of the class at Runtime, in Java the facility is:
Class c = System.getSystemClassLoader().loadClass("String");

The equivalent in doing this for Ruby:
s = Object.const_get("String");
Saturday, November 10, 2007

Changing Gmail SSL certificate

I was curious why I couldn't fetch my mail to my laptop from Google's gmail service, when it has been promptly dropping my mail onto my Blackberry. I tried running the 'fetchmail' command manually where I was greeted with the following message:

fetchmail: pop.gmail.com fingerprints do not match!
9203:error:14090086:SSL
routines:SSL3_GET_SERVER_CERTIFICATE:certificate verify failed:s3_clnt.c:894:
fetchmail: SSL connection failed.
fetchmail: socket error while fetching from
[my email]@pop.gmail.com
fetchmail: Query status=2 (SOCKET)
Seems like Gmail has changed their certificates! The way in solving the problem is to pull the new certificate and update the MD5 key in .fetchmailrc:

% openssl s_client -connect smtp.gmail.com:995 -showcerts
CONNECTED(00000004)
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc./CN=pop.gmail.com
verify error:num=20:unable to get local issuer certificate
verify return:1
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc./CN=pop.gmail.com
verify error:num=27:certificate not trusted
verify return:1
depth=0 /C=US/ST=California/L=Mountain View/O=Google Inc./CN=pop.gmail.com
verify error:num=21:unable to verify the first certificate
verify return:1
---
Certificate chain
0 s:/C=US/ST=California/L=Mountain View/O=Google Inc./CN=pop.gmail.com
i:/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
-----BEGIN CERTIFICATE-----
MIIC3TCCAkagAwIBAgIDCDijMA0GCSqGSIb3DQEBBQUAME4xCzAJBgNVBAYTAlVT
MRAwDgYDVQQKEwdFcXVpZmF4MS0wKwYDVQQLEyRFcXVpZmF4IFNlY3VyZSBDZXJ0
aWZpY2F0ZSBBdXRob3JpdHkwHhcNMDcxMDI1MTc1MzE2WhcNMDkxMjI0MTg1MzE2
WjBoMQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMN
TW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xFjAUBgNVBAMTDXBv
cC5nbWFpbC5jb20wgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGBAO03QxerFKZV
8yeomuL4zSl8Pr7hMWnKMMgp/CwhwadeBmL0LQHHbjL/6z/Z59ZQvrztqkwhchA2
APKzUwRVTyn7Shx6vBqk6oFmTqoOLmY6hbq6l8uVdUv0AfbHwio8CnLpK2+nbuFl
flPwx1DH0E3grD8+CrH5SmScfTWbDkcXAgMBAAGjga4wgaswDgYDVR0PAQH/BAQD
AgTwMB0GA1UdDgQWBBTJRG/OFpZt+BV43JM3NshHMjpwazA6BgNVHR8EMzAxMC+g
LaArhilodHRwOi8vY3JsLmdlb3RydXN0LmNvbS9jcmxzL3NlY3VyZWNhLmNybDAf
BgNVHSMEGDAWgBRI5mj5K9KylddH2CMgEE8zmJCf1DAdBgNVHSUEFjAUBggrBgEF
BQcDAQYIKwYBBQUHAwIwDQYJKoZIhvcNAQEFBQADgYEAOKr3mhxtwFCS3J6lbeaf
3KrHKi935BZkI75sRbON+hog0t2ovcM2i7fxs3xneH8USLsHgfxNBj9tkMogMK/K
sO/NUVZ/IfyqcNNkp2619qTQXthKRH42JKpAKgNhT1bdno3pxn+eDEpqmU3CE7IP
HDCjWOK1fGkZ/yFAuTxuxAc=
-----END CERTIFICATE-----

---
Server certificate
subject=/C=US/ST=California/L=Mountain View/O=Google Inc./CN=pop.gmail.com
issuer=/C=US/O=Equifax/OU=Equifax Secure Certificate Authority
---
No client certificate CA names sent
---
SSL handshake has read 891 bytes and written 314 bytes
---
New, TLSv1/SSLv3, Cipher is DES-CBC3-SHA
Server public key is 1024 bit
Compression: NONE
Expansion: NONE
SSL-Session:
Protocol : TLSv1
Cipher : DES-CBC3-SHA
Session-ID: BEE4859291CC8325784BE44785F2F705D47CD462B0A5ADC98B62A86A1851B41E
Session-ID-ctx:
Master-Key: 4E085FD56B0A36C4C278C7250BC1D5BC144CE8E7CF979D07086AA1D5E7C40D64DB76285057E16EAD027F789B9B0E1D84
Key-Arg : None
Start Time: 1194725790
Timeout : 300 (sec)
Verify return code: 21 (unable to verify the first certificate)
---
+OK Gpop ready for requests from [MY IP ADDRESS]
Copy the part coloured in red into a new file, e.g. '/etc/ssl/certs/new_gmail.pem' and then you have to recreate the symbolic links for their hash value, before generating the MD5 checksum to update in .fetchmailrc:

% c_rehash /etc/ssl/certs
... lots of other output ...
new_gmail.pem => 7f549ca4.0

% openssl x509 -fingerprint -md5 -noout -in new_gmail.pem
MD5 Fingerprint=44:A8:E9:2C:FB:A9:7E:6D:F9:DB:F3:62:B2:9E:F1:A9
Replace the old hash with the new hash value in .fetchmailrc, given in my example here:

poll pop.gmail.com with proto POP3
auth password user "myusername" there with password "mypassword" is vince here
options keep no fetchall sslcertck
# options keep ssl sslfingerprint '59:51:61:89:CD:DD:B2:35:94:BB:44:97:A0:39:D5:B4'
options keep ssl sslfingerprint '44:A8:E9:2C:FB:A9:7E:6D:F9:DB:F3:62:B2:9E:F1:A9'
Replace the old line in blue with the new MD5 checksum as shown above. Fetchmail should resume working now!