April 2004 - Posts

Link Interface 26.

A nice quote : A fanatic is one who can't change his mind and won't change the subject !

Link Interface 25.

The most incomprehensible thing about the world is that it is at all comprehensible !

The clicking sound from your computer...

A tip i found from a newsletter recently about a small hardware problem which many of you would have encountered i'm sure. It's about the irritating 'clicking sound' that comes from one of the fans in your computer.. Read on this snippet by Nata, the moderator at Experts Exchange site.

My mother-in-law called me the other day to ask me what that "clicking sound" coming from the back of her computer was. She said it wasn't coming from her hard drive -- but she wondered what it might be.

There are two fans, and usually the clicking sound is a sign that one of them is about to give up the ghost. One of the fans is in your power supply -- it will probably keep on cliking until the power supply stops ticking, at which point you replace it and move on (don't even think about fixing it). I've seen power supplies click for months, or even years, but it can get annoying. On the other hand, if it's your CPU fan, your problem can become a lot more serious a lot more quickly.

If you hear a strange clicking, shut down your computer, and wait until it has completely cooled down. Then take the cover off, turn the computer on, and see if you can figure out which fan is making all the racket. If it's the little one on your CPU, shut the computer down and go visit your local computer store NOW, because if you fry your CPU, you'll be visiting them later and spending a lot more money.

And don't think for a minute that running your computer with the cover off will take the place of the fan. The case is designed to pull air through in a given pattern, and without it, the air flow won't be correct, and you can overheat your mother board (or something else) pretty quickly

via Experts Exchange Newsletter !

Constructors ( Default and more ? )

Did everyone else other than me know that in .NET, any custom type has a default constructor ? I was under the impression till now that only value types have a default constructor, a parameterless constructor supported by default if there is no other constructor declared in the type. But while doing a code review yesterday, i saw that the developer had written a Factory that creates types based on the runtime request. The types that he was creating implemented a single Interface. Till here it is crystal ! But then i stepped into the type definition and found that there was no constructor defined for the type. The app works perfectly to my surprise !

Learned something useful but at this point i was stuck with a very weird question !

Why do we need constructors ? What is its sole purpose ?

Now if you are going to point out that they are used for allocation of memory, then you are wrong. That's what someone whom i work with did but the whole point of the constructor is that it gets called after the allocation of memory has happened. If that is not so, then how will you initialize the member data in the constructor ?

Basically when i say

Object myObj = new Object() ;

I mean that the variable myObj needs to be allocated the memory actually required ( as specified in the metadata for Type Object ) so that further usage of the variable from then on is possible. But why call again a constructor there if new is the keyword handling the allocation of memory part ? The way i see it, new is like one of those operators ( +, -= etc. ) which takes in as argument the object which needs to be allocated some memory and the Type to which the object belongs to. hmm does anybody else see my point here ? Why the constructor ?

The way i see it ( with my limited knowledge ofcourse ! ) is that the constructor is part of the event mechanism, wherein the allocation of the memory for the particular Type based on its metadata by the runtime is the event, and on completion of which the object of the specific Type is subscribed by default to the kind-of MemoryAllocationComplete handler and eventually the constructor gets invoked after memory allocation ! Does that make sense ?

I've been asking this particular question for quite sometime to myself. Why do all memory allocations to objects have to involve the usage of a constructor ? Was such a concept used because there needs to be a definite entry point and a destructor was used because there needs to a definite end point of the object usage ? What is it ?

Or is it because a constructor is required to initialize the pointer to the Virtual Method Table which is used to find the virtual methods for the Type. If there is no pointer, the system might jump off to some unknown location and might try to execute whatever code happens to be there in that location and probably could do almost anything at that unknown and undefined point in the code. But couldn't the initialization of the pointer be done somewhere else ?

On a sidenote, i might have answered my own question here by saying constructors are used for initialization. But aren't there other ways to do the same ? Aren't there other patterns that can be used to initialize data members of a particular Type without the usage of constructors ?

I know here that i've questioned the basics of OOP but IMHO many people including me, do not really understand the specifics behind the pattern. There is probably nothing that i hate about constructors as such but this particular question as to why we've been using a construct such as this, a construct which nothing but shrinks two statements from a layman's perspective.

Object myObj as new ;

myObj.Init();

Into

Object myObj = new Object() ;  // Which might in turn call Init for all we know ;)

Probably, i'd be at peace and might get more work done if i had just accept blindly the fact that Constructor pattern is the only best pattern suitable for the situation but aha that's not been the case. If anyone has had some enlightening insights about this, then feel free to post them :)

Premier League Photo of the Decade

This photo is such a great illustration of the empathy (if not outright identification) of the sports fan with the athlete, all the more evident in English soccer because of the unique proximity of the stands to the fields, one of the things -- along with Manchester United :-) -- that make English soccer special.

Owen, Fowler, Heskey and the Liverpool faithful dispair.

The photo is from the Premier League web sites Ten Seasons Awards section.

I think I recognize Fowler, Owen and Heskey for Liverpool.  Can anyone confirm that the keeper is Massimo Taibi in his brief and troubled cameo as Manchester United goalie?  How ironic if he ended up in the photo of the decade...

via Blog Curioso

Crypto-Gram and Social Engineering !

There is another new Crypto-Gram newsletter that has been sent out now. Bruce Schneier's newsletters are full of information regarding various ways of protecting information, cryptography, security stories and lots more ... And i just discovered that he's got a feed up too !!!

Subscribed !

Somehow i suddenly remembered a book called “The Art of Deception: Controlling the Human Element of Securityby Kevin D. Mitnick which deals with the absolute human element involved in various systems and how simple communication with people involved with security systems is good enough to help you to break the system. He calls it “Social Engineering”. I haven't read it yet but just caught a glimpse of it at a friend's place ... Definitely a must read !

Link Interface 24.

Wow ! Its been a really long time since i've posted anything at all ... I've been under orders from my Doc to stay away from typing too much away 'cause i got stuck with RSI ( Repetitive Stress Injury ). Will post in detail about that later ...

For now, some cool links i read today ...