A place to breathe

Thursday, December 25, 2008

-- THE ABC'S OF UNIX

Found this poem amusing, thought to share with you all.

A is for awk, which runs like a snail, and
B is for biff, which reads all your mail.
C is for cc, as hackers recall, while
D is for dd, the command that does all.
E is for emacs, which rebinds your keys, and
F is for fsck, which rebuilds your trees.
G is for grep, a clever detective, while
H is for halt, which may seem defective.
I is for indent, which rarely amuses, and
J is for join, which nobody uses.
K is for kill, which makes you the boss, while
L is for lex, which is missing from DOS.
M is for more, from which less was begot, and
N is for nice, which it really is not.
O is for od, which prints out things nice, while
P is for passwd, which reads in strings twice.
Q is for quota, a Berkeley-type fable, and
R is for ranlib, for sorting ar table.
S is for spell, which attempts to belittle, while
T is for true, which does very little.
U is for uniq, which is used after sort, and
V is for vi, which is hard to abort.
W is for whoami, which tells you your name, while
X is, well, X, of dubious fame.
Y is for yes, which makes an impression, and
Z is for zcat, which handles compression.


-- THE ABC'S OF UNIX

Monday, December 22, 2008

IJN privatisation is BS

I saw the trend that our current government is selling every piece of properties that they could sell either through JV, privatization through shady deals,etc.

The latest deal? Privatization of IJN.

First of all, IJN is a world-class, state-owned institution that caters the public. It's a world-class, that's a fact.

The only reason why they want to privatize IJN is that, as usual, someone somewhere in the government will benefit from it.

Once privatized, IJN can be sold to any business entity, and I know who they can sell to: Singaporeans.

Then charge the public ridiculous amount of money and earn huge profits. They don't care about the welfare of the poor. OK, that's unfair. Maybe they do. But company is not a welfare organization!. Shouldn't that the job of the government?

You can argue that the poor should be competitive and go high up social ladder but the fact is, not everyone is lucky, regardless of races.

The Bumis (Malays and aborigins) are relatively luckier due to their special rights, but that doesn't mean that many of them are rich. Many of them are poor, have a lot of kids to feed, lack of education and earning just enough to survive.

If the government does privatized IJN, the impact will be a pain to the poor. I wouldn't want to say only poor - even middle class can't afford thousands of ringgit of heart operations. They go to IJN.

Not all of us are Lim Goh Tong who can go to Mayo Clinic for medical check-up.

So enough ranting -

NO to PRIVATIZATION OF IJN!

If the deals goes through, get yourself an insurance and cover yourself up.
And you know who to vote next election.

Wednesday, December 10, 2008

Winamp's Signal Processing Studio

Last Raya Haji break, I was playing around with Winamp with my little brother.
It first started when he asked how his friend could improve the quality of his songs on his Nokia phone.

I told him, you can just play around with the Equalizer (I've never really tried it on Winamp, but I did it on my previous car's stereo).

And guess what, I found a DSP effect studio built into Winamp!.

I told my brother to play around with the number (I myself have slightest idea of the algorithm, but I know roughly because I took a DSP class before).

Download Winamp, go to Options -> Preferences -> Plug-ins -> DSP/Effects

Enjoy!

Thursday, December 4, 2008

C++: Pre-increment v. Post-increment

Point: Favor Pre-increment over post-increment whenever possible.


In C++, pre-increment means “increment this var and give me that incremented var”, whereas post-increment means “give me the var value, and increment the var”. We agree that they behave differently, but somewhat similar (increment the value of a var).

We don’t want to get confused when we use it in this kind of code:


int ch = arr[ i++ ]

int ch = arr[ ++i ]


Both will give different results and therefore, are not similar (why?).
However this doesn’t mean that we have to use pre-increment all the time.


But why we care?

Basically, the idea would be we can save some instructions generated by the compiler by using pre-increment operation.

Pre-increment and post-increment don’t matter much for built-in types like “int”. Most likely, the compiler knows how to optimize it away anyway.


However, it may have some performance impact when we increment an instance of a class that defines the operator “++”. In C++, we call this “operator overloading”. Operator overloading of “++” are being used extensively in STL (standard template library). If you're using STL extensively, you should get the habit of doing pre-increment.


The following shows how it differs:


// preincr. Operator overloading:

class Obj

{

// pre-inc

// “increment this var and give me the incremented var”

Obj & operator++ ()

{

++blah;

return *this;

}



Private:

type blah;

}



//postincrement. Operator overloading:

class Obj

{

// post-increment

// “give me the var value, and increment this var”

Obj & operator++ ()

{

Obj copy (*this) // copy this object

++(*this) ; // call pre-increment operator

return copy; // return the original value being copied

}



Private:

type blah;

}


You can see that above that eventually, post-increment operator would call the pre-increment operator anyway. So there are some extra steps being done here for post-increment. When we compile, this translates into even more instructions need to be executed.


Almost always, you just want to increment the variable and pre-increment does no harm.

Wednesday, December 3, 2008

Tan Sri Lim Goh Tong is the man

I just finished up reading the late Lim Goh Tong's book, "My Story" and man, i feel that the guy really rocks.

I think everyone should read his book, and I'm pretty sure you're all inspired by his story. It's a story worth telling to the younger people like me, so that I can be inspired and do something great like what he did. The book is easy reading and it's entertaining too.

Oh by the way, I got to know from his book that it's not his idea to create the casino - it's our first prime Minister Tunku Abdul Rahman's idea. His idea is just to build a resort up on the hill.

GohTong Jaya is something that Dr M proposed.

Anyway, you should read up the book. (I'm not Lim Goh Tong to tell all the stories)

Tuesday, December 2, 2008

Philips monitor is a piece of shit

If you're shopping for a monitor, there's one monitor that you should never ever buy: Philips.

First of all, don't be tempted by the the price. Because you're gonna get what you pay for. Go for something a little more expensive like Samsung or LG or BenQ, aim for a better deal.

The problem with Philips' monitor is not the hardware, but software. Yes my friend, no matter how wonderful your hardware is, if the software is crap, that shiny piece of hardware is a total useless.

Philips has a built-in software in its monitor called "SmartImage". What it does is it tries to calibrate the settings according to the environment you are in. I don't exactly know how it works, but it's basically tries to calibrate a little bit when you watch movies to this "Entertainment" mode,etc. Anyway, the software is really not needed. It's something that they add and you need to live with it.

When you seem to be working on document or spread sheet, it will try to do it's own settings, Lock the IO control and try to be smart.

The problem with their SmartImage software is the opposite - it's the DumbImage. I would also like to call that kind of software as a CrapImage.

When I first encountered the problem, I thought this was an easy fix. So I played a little bit with the Graphics settings, and the monitors appears to be fine.

After a while, it pops up again, do it's own calibration thing, and then locks the control. I can't even turned off the monitor and at that time, I thought this is probably the SmartImage software. I thought it could be removed, but it cannot!. It's embedded into the monitor and there's no way to control it.

So by now, I knew already that the software has a bug that let it run loose on a nasty infinite loop.

I called up a friend who's really good at PC fix, and he recommend me to return the monitor.

I wasn't really given up when I found a way to fool the monitor into thinking that I was doing some settings, and the stupid setting pop-ups (you know, those pop-ups when you try to adjust monitor brightness, Contrast, etc) would only reappear about 1/2 hour later.

Finally, the time has come. When the SmartImage trying to do its own thing, it goes into "Input" selection, and it selects "DVI" as the input. Since I'm using VGA, there's no way I could reset the input back!. And since the monitor controls are locked, there's nothing I can do except staring at the blank monitor looking at the warning that says "Please check your cable connector".

What a piece of shit.

Monday, December 1, 2008

what a geeky video

I browsed through one of the newsletters that I subscribed, and I found this video:

http://www.ti.com/corp/docs/landing/thank-an-engineer/index.htm

It's from Texas Instruments, what a geeky video.

About Me

I'm currently a software engineer. My specific interest is games and networking. I'm running software company called Nusantara Software.