Posts

The unconquerable

Hercules was a strong man; a tall muscular perfect masculine figure. He moved boulders with his bare hands. He stopped elephants and swung them by their tusks. No doubt, he prevented battles by his mere presence. His body drew its strength from within. He was no less than unconquerable.

Even such a mighty Hercules was brought down to his knees. He was taken over by an invisible force that turned him weak and set him on a curse, a terrible painful experience. He started worrying deeply, and wept like a scared kid. There was a time when he fought elephants head on. But this was a battle within that he was losing. He could still win this battle only if he could meet eye-to-eye with the enemy.

More ...

JAR Tips: Loading dependencies

If you are writing a typical console based application in Windows, you would end up with an executable (exe). You might also have one or more dependent libraries (DLL). The question is where do we place these DLLs so that they are picked up at runtime by the application; loaded and consumed. Actually it is no brainer, just put them along side the console application executable. Or you could place the DLLs in the System32 directory. Or you could add the directory to the PATH. Well, my point was actually to say that the DLLs can be simply placed alongside the executable and it would be picked up. More ...

An Unfair World of Tuples, Anons., var and auto

It all began when I wanted to return more than one value from one of the methods. Although my attempts ended futile, it was fun exploring and musing how things could have been.

There are at least a couple of options to return multiple values from a method:-

  1. return an instance of a class that holds the values
  2. return a tuple
More ...

A funny moment of IoC

IoC - Inversion of control, is a design that enables fluid flow of control by decoupling tight dependencies between the portion of a code that exhibits behavior and another portion of code that provides required functionality. One form of IoC, as we know, is Dependency Injection (DI). For instance, a TextEditor could refer an ISpellChecker instead of direct coupling to a specific implementation of spell checker thereby enabling the text editor to switch spell checker or even use more than one. More ...

Mutating Strings

Today, we question our beliefs! Is string really immutable?

  
string message = "Hello World!";

Console.WriteLine(message); // Prints "Hello World!"

unsafe {
  int length = message.Length;
  
  fixed (char *p = message) {
    for (int index = 0; index < length; ++index) {
      *(p + index) = '?';
    }
  }
}

Console.WriteLine(message); // Prints what? See for yourself!
More ...

A time when time did not exist …

Those of us, non-physicists, we do seem to realize that time is eternal. Yet there was a time when time did not exist; tough to comprehend? For us, time is something running on a clock or tracked on a calendar. Let me share what I think about when time did not exist. More ...

Quiz: Choosing an array of integers !!!

In the recent interviews, I asked the candidates the following question:

Is there a difference that I need to consider in the following declarations? Both allocate fixed size array to store integers:

int[] na1 = new int[10];
Integer[] na2 = new Integer[10];
More ...

A-Team Library

A short while ago, I had to write a compelling document for a client about a library that I had developed during my tenure, call it A-Team Library or ATL. Having to learn the β€œeyes-wide-shut” culture to maintain the couples-of-decades old code and simultaneously develop on the top of it was very disheartening. It was time a lot of things were given fresh thoughts. Not the least of all duplication of code and functionality. But not just that. Like in a programming language, when there is more than one way of doing something, when those ways are opposing, it causes nothing but confusion. So was the case. The business seemed to be far from realizing it. More ...

The Secret behind Bjarne and Herb’s Papers on Unified Syntax

A long time back, in one of my posts here1, I had discussed about Extension Methods2 … in C++; sorta! It seems that the grand daddy, Bjarne Stroustoup3, had read my post, and was impressed. So he has published a paper – Call syntax4: x.f(y) vs. f(x,y). Good thing except I don’t like the idea of assuming x.f(y) for f(x, y) while the reverse is the actual idea of extension methods. You will know when you read his paper. It seems the commander, Herb Sutter5, also was impressed with my post. Not only that he too doesn’t seem to like the x.f(y) for f(x, y) idea. Great men think alike. LOL! So he published his paper – Unified Syntax6. How is that? More ...

A Simple Tree List View

Digging up stash is one of the best pass times. You know you never know what you will find. I had an article written quite some time back but had not posted it anywhere. Not sure why. I posted it at CodeProject – A Simple Tree List View.