Hello everyone. I know there aren't too many of you who read this blog, but to the few who do "Hiya!!!!"
Statutory Warning: I may get bored while writing this post, and it may just terminate abruptly; much like a road that ends(if you know what I'm talking about). You may also find paragraphs ending, and a new one starting out of nowhere. This is because my mind was filled with void for the time between.
Today on the way from Pune to Mumbai, I spotted(somewhere ar Lonavala) to the right a hotel called (forgot name), and to left was Lion's Den.
Further, was the new cricket stadium that was being build which, I think is at Khargar. Just beyond that was a Royal Enfield showroom. Well, you don't see to many of those these days. My room mate(KD) is a big fan of those and owns one. In fact, he is contemplating purchasing another one, just for the road while he plans to use the current one only for races. There's a guy with passion.
About 10mins down the road, I could see a traffic jam in the opposite direction which was(to say the least) a couple of kilometers long. I hate traffic jams, because if you are stuck in one, you are effectively getting nowhere. And I do get restless when I am stuck in one.
There was a sign on the divider which mentioned the safe upper bounds for the different vehicle classes such as buses, cars, trucks, etc.... However, you could very clearly that everyone was moving in unison, and that too at some speed greater than the globally maximum allowable for any type of vehicle. That kind of begged the quesion if those signs were just put up for fun or for that day when people wore helmets, and had their license, and their vehical's documents, etc.... and the only resort left for the police was to catch them of the count of over-speeding. This kinda begs the question if that's what American cops have been up to for so long....
I was just thinking about the link about writing style sent to me by [RS](not to be confused with in the class R or S), and a very strange thought crossed my mind. Is it possible for someone to have memorized all of those rules, and created a mental map to be called upon whenever they wrote an article? Well, I hope not. At least not immediately. Which then leads to the obvious question: "When????". Then it struck me like the lightening that was shuddering in the fair distance ahead: "When they are all old and experienced...." Is this all experienced people did? Go through their subordinate's articles checking for incorrect application of the rules mentioned on the document. Well, I hope not. At least not where I want to be working. My ideal job place involves hard core work along with a lot of fun and frolic. Not something that I've found yet, but hey, the search is still on....
I reached Dadar only to find out that my phone could not detect my service provider's network. I thought that it would work over time, but even after repeated trials, it refused to budge. That's when my other(as yet dormant) senses woke up to the realization that others in the bus were facing the same problem and I hadn't been singled out(It's always a relief to know that ;-)).
I got off the bus, and straight away entered the Monginis cake shop. Hehehe(The rest you all know). From there, my stomach beckoned me to stop at the first Arey outlet that my eyes could set their focus upon, and ask(very polietly) for a coffee flavoured energy. AFter that devouring that miracle of mankind, I marched off toward the station, and it began drizzing, so I hurriedly got my body under the station roof.
As luck would have it, I was able to get a CST fast local, which stopped only at Byculla. So that facilitated my more expedited approach home.
Now, I find myself writing this post and sipping on a cup of tea. I'll spare you people the details, and just let you enjoy the rest of the day.... Ciao.... ;-)
Friday, June 01, 2007
Sunday, May 27, 2007
How things go wrong.
I've been thinking; and thinking out loud.... "Why do things go wrong?"
Things go wrong almost all the time, and with many things. Work, people, tasks, relationships, food, etc.... they all have their share of problems. They all have their reasons. For example, if we take food, then things can go wrong if you take the wrong proportion of something, or miss something out, or forget you have something on the stove(while you show your guests around), and so on. With relationships, things can go wrong if you are expecting something else that what the other person is, or if you are betrayed, or if you overly trust the other person, and he/she doesn't live up to it, and so on. Actually, the last is a commonly occurring special case of the one before it.
With work on the other hand, all of the above, plus it's own set of problems have to be dealt with. You have lots of forces at work, namely: food, inter personal relationships, people; including peers, subordinates, bosses, boss' boss, boss' boss' boss, and so on, and so forth. Additionally, you have your tasks(the least important of all????) to complete. I work in the software industry, where we deal with code and the like. Our day typically relies oncopy-pasting other people's code and changing the name to our own writing lots of lines of code, and then testing it's correctness. We got to do this day in and day out with twitching, squeaking, or otherwise complaining about the inhumane working conditions such as air-conditions, free tea/coffee(that tastes almost the same), flexible-working hours(which entrust us with how long we want to work), and so on.
Let's consider a typical thing going wrong in a typical piece of code on a typical working day. The task at hand is to write a function that returns the file name given an open file descriptor to that file. Suppose we have written that function, and it's signature is:
int file_name_from_fd(int fd, char *buff, int buff_size);
Let's consider that all buffer-overflow problems in the function fine_name_from_fd have been taken care of.
The following piece of code is now written by the programmer:
Now, is this piece of code fine, or is there something missing?
If you think it's fine, think again.... There are so many things that could go wrong. Instead of pointing them all out, I'd like to show you by writing code that handles them all(well, almost all).
Now, only if we all were not in such a big hurry, and took time out think things through before doing them, or at least did them well while we were at it, our lives, and those of our fellow programmers would be much less bug-ridden.
Things go wrong almost all the time, and with many things. Work, people, tasks, relationships, food, etc.... they all have their share of problems. They all have their reasons. For example, if we take food, then things can go wrong if you take the wrong proportion of something, or miss something out, or forget you have something on the stove(while you show your guests around), and so on. With relationships, things can go wrong if you are expecting something else that what the other person is, or if you are betrayed, or if you overly trust the other person, and he/she doesn't live up to it, and so on. Actually, the last is a commonly occurring special case of the one before it.
With work on the other hand, all of the above, plus it's own set of problems have to be dealt with. You have lots of forces at work, namely: food, inter personal relationships, people; including peers, subordinates, bosses, boss' boss, boss' boss' boss, and so on, and so forth. Additionally, you have your tasks(the least important of all????) to complete. I work in the software industry, where we deal with code and the like. Our day typically relies on
Let's consider a typical thing going wrong in a typical piece of code on a typical working day. The task at hand is to write a function that returns the file name given an open file descriptor to that file. Suppose we have written that function, and it's signature is:
int file_name_from_fd(int fd, char *buff, int buff_size);
Let's consider that all buffer-overflow problems in the function fine_name_from_fd have been taken care of.
The following piece of code is now written by the programmer:
int main()
{
char buff[4096];
int fd = open("/home/dhruv/data.dat", O_RDONLY);
file_name_from_fd(fd, buff, 4096);
printf("The file to FD %d is %s.\n", fd, buff);
return 0;
}
Now, is this piece of code fine, or is there something missing?
If you think it's fine, think again.... There are so many things that could go wrong. Instead of pointing them all out, I'd like to show you by writing code that handles them all(well, almost all).
int main()
{
char buff[4096];
int fd = open("/home/dhruv/data.dat", O_RDONLY);
/* Check for open() error. */
if (fd < 0) exit(1);
/* Pass buffer size 1 less than maximum size, so that
* you can write out a terminating NULL character in
* case of a full buffer.
*/
int ret = file_name_from_fd(fd, buff, 4095);
/* Check for error. */
if (ret < 0) exit(2);
/* Write out the NULL character. Will come in useful
* if ret == 4095.
*/
buff[4095] = '\0';
printf("The file to FD %d is %s.\n", fd, buff);
return 0;
}
Now, only if we all were not in such a big hurry, and took time out think things through before doing them, or at least did them well while we were at it, our lives, and those of our fellow programmers would be much less bug-ridden.
Subscribe to:
Posts (Atom)