Thursday, February 22, 2007

Caught amidst Alkaline Tide

Ever wondered why do we feel drowsy or yawn frequently after lunch or a heavy meal? Well I just did and as once could expect as the most obvious reaction, I googled for the answer. After wandering over many sites I found that "Drowsiness & yawning after meals is caused by a phenomenon called Alkaline Tide."

Curiously I looked for Alkaline Tide on Wikipedia which defines it as “Alkaline Tide refers to a condition, normally encountered after eating a meal, when stomach acid is released into the stomach that causes a temporary increase in pH of the blood. This is a natural bodily function.”

Finally, I landed on a blog which had the complete scientific explanation of my question. Ironically I couldn’t make any sense out of the “scientific part”, But What I did understand is "Due to increased alkaline level in blood brain doesn’t get enough oxygen thus we feel drowsy and yawn frequently."

Now I am feeling like I have been caught in the Alkaline High Tide for last two days and just want to have a long siesta :)


Tuesday, February 13, 2007

Stopping by Woods on a Snowy Evening by Robert Frost

Whose woods these are I think I know.
His house is in the village, though;
He will not see me stopping here
To watch his woods fill up with snow.

My little horse must think it queer
To stop without a farmhouse near
Between the woods and frozen lake
The darkest evening of the year.

He gives his harness bells a shake
To ask if there's some mistake.
The only other sound's the sweep
Of easy wind and downy flake.

The woods are lovely, dark and deep,
But I have promises to keep,
And miles to go before I sleep,
And miles to go before I sleep.

Not a poetry fan but found this wonderful poetry by Robert Frost and I was amazed by its simplicity and efficacy. It won't be untrue to say that anyone can learn from and relate to it.


Friday, February 9, 2007

Solution of the problem posted in my previous blog

For scenario #1 & #2 there is not much to answer as it is very straight forward. So, I will directly provide you with the answer for the most tricky scenario #3.

The solution posted on the blog of Aaron Ballman -
"It turns out that the way you accomplish it is with an array of 256 function pointers. Every time you get a character, it's ASCII value is an index into the array of function pointers where the entries for '0' through '9' are calculating the value (with the help of a global position value). The entry for the null byte terminates the process and returns the proper value. All of the other entries point to an error function." - Ballman

The solution which I devised, uses a recursive function to achieve the looping functionality and '&&' (Logical And) operator to achieve the flow control functionality. Very simple and straight forward logic to solve a simple problem. Here goes the function StringVal...

int StringVal (const char *buf)
int value = 0;
static int index = 1;
const char *tbuf = buf;

(*tbuf != '\0') && (value = StringVal(++buf), value += (*tbuf - 48) * index, index*= 10);
(*tbuf == '\0') && (value = 0);

return value;

For interested audience, following links provide a good discussion of the problem and many solutions to it.

1. Original discussion of the problem

2. Answer to the problem


Wednesday, February 7, 2007

Interesting programming problem

Here is an interesting programming problem which is quite commonly asked in job interviews nowadays. You will ask me if its so common why am I posting it here. Because, this time It comes with a twist :)

There are various constraints put on the problem to make it tricky and interesting. This is a three part problem which goes like this.

Write a function which takes a string version of a number and converts it into an integer value. For instance, "100" will become 100. There are constraints placed on the function. You must use only legal C code (no assembly) and cannot use any helper libraries (such as ANSI C functions like strlen, etc) except for the pow function. Assume all inputs are positive and valid for the sake of keeping things brief.

Question 1:
Write the aforementioned function given that the declaration is: int StringVal (const char *buf)

Question 2:
Given the same declaration, write the same function without using any looping mechanisms (for, while, goto etc).

Question 3:
Given the same declaration, write the same function without using any looping mechanisms or flow control mechanisms (for, while, if, switch, goto etc).


Tuesday, February 6, 2007

Awesome ads by Budweiser featured at Super Bowl XLI

Bud Light: Hitchhiker

Bud Light: What would carlos do?

Budweiser: Beer-Stealing Crabs

Budweiser: Fake Dalmatian


Monday, February 5, 2007

Secure Surfing: The need of today

Motivated by the fate of a fellow developer, I delved into the issue of "Online security & privacy". Driving factor was the fact that your employer can, and generally does, track your browsing history, IM sessions and emails. In short, it spies on your each move in the online world. This manifestation was kind of creepy and thenceforth I set out to find out, if something can be done about it.

Later on I discovered that, this is a well known loop hole in the online world and there are thousands of "Peeping Tom" out there looking for a chance to invade your privacy. As one might imagine, there are also many tools and solutions readily available online to address this issue. But most of them provide you nothing but specious claims.

I googled on some of the solutions and landed on an article which actually enriched my networking knowledge and also suggested me a tool namely Tor. The article provides good insight in how Tor works and explains an interesting concept of Onion Routing. I found the article very informative, convincing and useful. In fact, Tor is by far the best tool to address this issue, which I could find. I haven't used it yet because I want to investigate further to see if it has some security implications. For that reason, I sought help from the online security experts and you.

For details on Onion routing please read the complete article on Onion Routing or visit the official website of Tor. You can also visit its wiki page.


About This Blog


  © Blogger templates The Professional Template by 2008

Back to TOP