Monday, July 25, 2011

Reasons to love geeks

For the geeks out there, here's something that you might find interesting.

Here are some of my favourites ("some" turned into "several" after some time :P ). They're from both the article and the forum thread it links to.

(I've highlighted the comments in red, while my own comments are in blue)

First, some simple ones:

//When I wrote this, only God and I understood what I was doing
//Now, God only knows

// drunk, fix later

// Magic. Do not touch.

//Code sanitized to protect the foolish.

return 12; // 12 is my lucky number

// TODO: Fix this. Fix what?
(I'm guessing that the "Fix what?" was added by a different person...)

// Author: If this code works, it was written by Paul DiLascia. If not then I don't know who wrote it.
(seems that this guy is famous)

// (c) 2000 Applied Magic, Inc.
// Unauthorized use punishable by torture, mutilation, and vivisection.

Some funny comments from frustrated programmers:

// John! If you'll svn remove this once more,
// I'll shut you, for God's sake!
// That piece of code is not “something strange”!
// That is THE AUTH VALIDATION.

/*
This isn't the right way to deal with this, but today is my last day, Ron
just spilled coffee on my desk, and I'm hungry, so this will have to do...
*/

Comments that go well with the actual code (my favourite type!):

} catch (PartInitException pie) {
// Mmm... pie
}

long long ago; /* in a galaxy far far away */
/* Halley's comment */
(like the comet!)

public boolean isDirty() {
//Why do you always go out and
return dirty;
}

if (/*you*/ $_GET['action']) { //celebrate

$you = live("free") or die("hard");
(I'm not sure about this one...it's really a valid code, I think.)

Catch (Exception e) {
//eat it
}

// some sport psychology
if (!focused)
Focus();

raise InvalidChild() # e.g. no legs

Then there are those who tell stories:

/* Emits a 7-Hz tone for 10 seconds.
True story: 7 Hz is the resonant frequency of a
chicken's skull cavity. This was determined
empirically in Australia, where a new factory
generating 7-Hz tones was located too close to a
chicken ranch: When the factory started up, all the
chickens died.
Your PC may not be able to emit a 7-Hz tone. */
(I love the story! :D )

int MyFunction()
{
// There once was a man named Dave
int Result = 0;
// Whose code just wouldn't behave
MyObject *Ptr = new MyObject();
// He left to go to a meetin'
Result = Ptr->DoSomething();
// And left his memory a leakin'
return Result;
}

// //3.4 JeK My manager promised me a lap dance if I can fix this release //3.5 JeK Still waiting for that dance from my manager //3.6 JeK My manager got changed, the new manager is hairy, dont want the dance anymore //3.7 Jek Got that dance, yuck! //
(Not sure whether this is a true story :P )

A "scary" one:

From the 2004 Windows leak,

__inline BOOL
SearchOneDirectory(
IN LPSTR Directory,
IN LPSTR FileToFind,
IN LPSTR SourceFullName,
IN LPSTR SourceFilePart,
OUT PBOOL FoundInTree
)
{
// // This was way too slow. Just say we didn't find the file. //
*FoundInTree = FALSE;
return(TRUE);
}

Ouch! So the file was actually there and Windows lied to us?!

Then this is not quite a comment but a goto label:

ICantBelieveImUsingAGoto:
(and a comment recommended this xkcd comic: GoTo (saying "Look out for the raptors.") )

An anecdote someone shared:

An old boss of mine was always going on about how we had to use our own products internally i.e. "Eat our own dog food..."

Many years later I found embedded in some source that a temporary coworker had done, every function he touched is tagged with:

/* NOT FIT FOR HUMAN CONSUMPTION */

Then there is the safety pig.

Some of these people love drawings...there are lots of comments about dragons (which seems to be a common joke to refer to an awful piece of code) and even a dragon drawing. But...the dragon comments get stale after a while.

Sunday, July 24, 2011

Of strange laws

I saw this article in The Star last Thursday.

I'm not writing this to share the article's talk on Malaysian outdated laws, but the funny US and UK laws mentioned.

But first, a comment on "grammar". (Sorry, I've been grumbling about that quite a bit lately, haven't I?) The article starts with

"THE phrase “the law is an ass” is attributed to Charles Dickens.

It originates from Oliver Twist after the character Mr Bumble is told: “The law supposes that your wife acts under your direction”.

What one of the foremost classical writers of English literature actually wrote was: “If the law supposes that, the law is an ass, an idiot.”

No, he wasn’t using grammar akin to the Manglish being taught in our schools today. It was just that the rules of the language were not quite defined during his era."

I don't understand. WHAT IS WRONG WITH THAT SENTENCE? The grammar looks perfect to me. After all, the "that" in "If the law supposes that" refers to "your wife acts under your direction”.

Okay, grumbling aside, here are a few funny laws mentioned in the article:

In New York, adultery is still a crime and one can be fined US$25 (RM75) for flirting.

I'm guessing that the fine for flirting only applies to married individuals?

It is illegal for a woman to be on the street wearing body-hugging clothes but she can go topless in public, provided she is not doing it for any business.

(That's still in New York)

In Denver, Colorado, the law states that dog catchers must notify dogs of impounding by posting for three consecutive days, a notice on a tree in the city park.

Now this is a good one :D

Apparently it is also unlawful to lend one’s vacuum cleaner to a next-door neighbour.

This I do not understand...

More than eight women are not allowed to live in the same house in the state of Tennessee because that would constitute a brothel, while Encyclopaedia Britannica is banned in Texas because it contains a formula for making beer at home.

Now that second part sounds a bit like something that could happen in Malaysia :P

In President Barack Obama’s home state of Illinois, it is now illegal to wear sagging pants. A new law requires pants to be “secured at the waist to prevent the pants from falling below the hips, causing exposure to the person or the person’s undergarments.”

A new law?? How new? I thought sagging pants were the new fashion...

And in the UK:

[...] it is illegal to die in Britain’s Houses of Parliament and sticking a postage stamp bearing the Queen upside down is deemed an act of treason.

I can sort of understand the second one...but the first one is ridiculous. By the way, I would like to know what the punishment is for dying in the Houses of Parliament :P

In Liverpool, where footballers and fans tend to strip off their shirts in celebration of goals, it is illegal for a woman to be topless – unless she is a clerk in a shop selling tropical fish.

Why a clerk? And, WHY tropical fish?? Hahaha...I really wonder since when this law has been around. Probably before the footballers started stripping off their shirts?

All this as an introduction to criticism of certain Malaysian laws. If you want to read more about that, go and read the article...I'm only sharing the feel-good stuff ;P

(Though how true these are, I have no idea...)

Tolong bagi sayap ayam satu...

This morning I went to buy nasi lemak at this Malay stall for breakfast. There were two pieces of chicken left, a wing and what looked like the breast part. I wanted to ask for the wing, and my brain told me, wing is sayap. But somehow that didn't seen right. I dug around for the right word but couldn't find it. In the end I just pointed to the piece, because I didn't dare to ask for the sayap. :P

It wasn't until I got home that I found the word. What I should have asked for was kepak ayam! Haha...good thing I didn't ask for sayap ayam...

Saturday, July 23, 2011

My five stages of ulcer

Lately I noticed a certain pattern to my ulcers. For those who don't know, I am highly prone to ulcers...and all the remedies I have tried have failed. I have practically given up on trying to find a cure, and I usually let the ulcer run its course.

But lately I have heard of two possible remedies. One is a certain mouthwash (I shall only advertise its name here if I find that it works), and another is a leafy herb (same thing, as long as I have no proof that it works, I'm not going to advertise it here).

So each time I got an ulcer, I started wondering whether I should do something about it. It happens like this:

Stage 1
I get an ulcer.
Reaction: Oh no, another ulcer!

Stage 2
It gets a bit worse (actually starts to hurt)
Reaction: Maybe I should put something on it. ... Nah, just let it be...

Stage 3
It gets even worse (it really hurts!)
Reaction: I should have put something on it earlier! Now...nah, it's too late anyway, it'll get better soon.

Stage 4
It gets progressively worse
Reaction: Ouch ouch ouch... Repeat stage 3 as many times as necessary. (usually at least 5 times)

Stage 5
It gets better!
Whew... *relieved*

There you go. This time I have bought the recommended mouthwash. Last night I used it and the tip of my tongue was numb for hours. As of now my ulcers (I have two at the moment) don't seem any better...if anything one of them seems to have gotten worse (not sure if it was going to get worse anyway, or whether it was the mouthwash). But it's not a problem if it gets worse more quickly and heals more quickly. (I would actually welcome that!) I just hope it's not going to get worse than it usually does. I shall give the mouthwash another go tonight...

Edit: Argh, I usually try to only schedule posts that don't have any time references (like today, tomorrow, yesterday...) in it. My brain must have been too tired last night when I scheduled this one; I totally forgot all about that. So...for all time references, this post was written last night.

Friday, July 22, 2011

Half-boiled eggs

The Star takes letters from readers asking about grammar. Today this was the first letter:

IN his story "Good excuse for indulgence" (Sunday Metro, May 15), Kevin Kam drew our interest to the Kemaman Kopitiam serving a breakfast set "comprising hot crisp toasts slapped liberally with homemade kaya and butter, and half-boiled eggs".

I have two questions. Were the eggs still whole when served? If so, which half of the eggs were actually boiled? Kemaman Kopitiam must be unique because elsewhere I am served soft, medium or hard-boiled eggs. – EZA

Well, excuse me, EZA, I don't know whether you're a local or a "native speaker", but I do not think that this column is for sarcastic e-mails asking rhetorical questions. I'm surprised The Star published it at all...but then again, The Star is getting stranger and stranger...


For the full article, go here.

Bad customer service

I just found out something strange last night about the iPhone. It turns out that there is a lamp inside the iPhone you buy, but to switch it on, you have to go and download an app (which is free).

I think that if I buy something with a lamp, I'd like the lamp to work right away...


The circumstances of this discovery? We were having a barbecue. It was rather dark and A and B were taking photos of food with their respective iPhones. A has a light on his iPhone switched on to shine on the food. Suddenly B exclaims, "Hey, how come you have a light?" (Okay, I think what he actually said was "How come your place is so bright?" :P )

And then...after B downloaded the app, we had several moments of brightness as he shone it over everyone, just to make sure everyone noticed that he had a light too!

Wednesday, July 20, 2011

A list with two heads

An article in The Star today was titled "Two head Sultan's birthday list", referring to the Sultan of Terengganu and current Agong.

But...how can TWO head a list? There is only one person at the head of a list.

The first sentence of the news article reads: Rural and Re­­gio­­nal Development Ministry secretary-general Datuk Ibrahim Muha­mad and Malaysian Armed Forces Chief of Staff Lt-Gen Datuk Raja Mohamed Affandi Raja Moha­med head the list of award recipients in conjunction with the 49th birthday of the Sultan of Terengganu Tuanku Mizan Zainal Abidin today.

Now this I agree with. A few people can head a list, but only if we say who they are. This would mean that these people are the first few on the list. But the title of the article doesn't make any sense...in a list of 10 for example, we can cite two, three, four or even nine! (if we want to be really particular :P ) people who head the list. (Though saying "Nine head the list" would really draw raised eyebrows...)

The second sentence reads: They received the Darjah Seri Paduka Mahkota Terengganu (SPMT) which carries the title Datuk.

And then: Four others received the Darjah Dato' Setia Sultan Mizan Zainal Abidin Terengganu (DSMZ) which carries the title Datuk.

Ah...clarification at last! So the two who "headed" the list received the highest award?

*groan* I really don't like this title. It just contains practically no information at all. "Two receive highest award from Sultan" would be clearer.

Oh, and I get the feeling that The Star tries a little too hard to inject puns into its titles. They try so hard that I've gotten tired of seeing their (stale) puns. (there's at least one every day!) Puns work best when they are almost accidental and really fit the situation.

Tuesday, July 19, 2011

Is it really fasting?

...if someone has to stitch your mouth shut to prevent you from eating?

The other day we heard that Kedah wants to close down all entertainment outlets during Ramadan. Of course, people complained. And now they say that the outlets will remain open but Muslims cannot be allowed in.

I wonder, is there any need to enforce laws to make sure people do as their religion dictates? If you don't sin not because you do not want to, but because you are prevented from doing so, is that any good?

I don't know much about religion, but isn't it generally better to be able to resist temptation, rather than to have someone remove that temptation for you?

Any thoughts?

Monday, July 18, 2011

Suspicious advertising

You know how radio stations get singers to say stuff like "I'm [put celebrity's name here], and I love [put radio station's name here]" ? Lately I noticed something peculiar, though. (The last I heard was on Red.fm, though I'm not sure whether I also heard it on other stations) Instead of having the celebrity say the whole sentence, they have the celebrity saying everything up till the station's name, which they insert in a "special", advertisement-style voice.

Does this mean that the celebrity was actually saying something else? And they cut out the voice to insert the name of their radio station? Are they allowed to do that kind of thing??

But if that's not the case, and they actually asked those celebrities to say that...it's really dumb to insert the station's name like that. It just lacks authenticity...and you get people questioning whether you didn't steal the voice from somewhere else (like I'm doing :P ).

Sunday, July 17, 2011

How to kill a butterfly

Last Thursday a butterfly flew into my living room. I had seen it on the mosquito net (sliding door) to the balcony, and I told myself, when I go out later, I must remember to scare it away before opening the door.

But I forgot. And it was the one that gave me a scare when it fluttered at my legs while coming in. -_-

It stopped near my living room lamp. A pretty specimen it was...the type that has "eyes" on the backs of its wings to scare off predators.

I think that was the first time I actually saw this kind of butterfly.

I didn't think of it at the time, but of course it couldn't get out after I had closed the door again.

On Friday night it was on the ceiling. I wanted to let it out, but I didn't want mosquitoes to come in in its place, so I decided to leave it till the next day, when I would be home in the daytime.

Saturday morning I opened the door for it for a while. It was on the wall quite close to the balcony...but it didn't go out :/

Then I had to leave for badminton, so I closed the door again. By the time I got back later, I didn't see the butterfly anywhere. I left the balcony door (it was always the balcony door that I opened for it) for a while, but since I didn't see it anywhere, I later closed it again.

And this morning it was lying on the floor near my bedroom door. I swept it up and put it on the balcony...and even poured some water on it in case it was just dehydrated. But no, it hasn't gotten up since this morning, so I guess it's really dead.

dead body on my balcony :s

So...I guess it was dehydrated or starved to death. Most probably dehydrated...don't blame me for not wanting to breed aedes mosquitoes.

Fool! You shouldn't have come in in the first place!

Moths (or butterflies) don't fare well on my turf. The last one desperately tried to drink poison to survive (I found it in my dishwashing liquid).

And this reminds me of the rabbit-killers...maybe I'm turning into a moth-killer. :s Though I wouldn't mind if I could kill other disgusting bugs. And lizards.