Thursday, May 15, 2008

Mysore Pak

I'm sure if you've come here, it is in search of the perfect Mysore Pak Recipe. I myself had been hunting for it for a while, and it took me as much as 6 attempts to finally get one that I liked eating. The recipe mentioned here will result in a firm Mysore Pak, that is crumbly enough to melt in your mouth, and whose cross-section shows 3 distinct layers, with the 2 outer layers being golden-yellow, and the middle one being light-brown. There are many parameters that affect the way the Mysore Pak will turn up. Mysore Pak is made using Gram Flour(besan), sugar syrup, and ghee(clarified butter). Varying the proportions of these ingredients will affect the "quality"(by quality I mean taste and texture) of the produced result. Let's discuss them in detail.

  1. Amount of Gram flour: We shall assume this to be kept constant and all other ingredients are chosen relative to this one ingredient.

  2. Amount of Sugar: This is typically taken to be anywhere between 1 to 2 times the amount of Besan used. More sugar will result in a softer final product. I personally take sugar to be about 1.4 times the amount of Besan used.

  3. Amount of Ghee: This mainly dictates the fattiness of the sweet. The more ghee you have, the smoother the texture, the more well cooked it will be and the more fatty your final produce will be. The ratio varies anywhere between 1 to 3 times the amount of Besan used. I personally try to restrict it to about 1.5 times the amount of Besan. However, I generally let the recipe dictate how much ghee to add. More on this below. You will also need(extra) 1 Tbsp Ghee per cup of Besan.

  4. Amount of Water in the sugar: Water should be about 1/4th of the amount of sugar used, or just enough to wet the sugar so that it can be heated uniformly.

So, my ratio would look something like this:


BesanSugarGheeWater
11.41.50.35

You may optionally add about 1/2 Tbsp of ground cardamom powder per cup of Besan to the mysore pak for that extra flavour and aroma.

You will need 2 medium sized pans, one large pan for cooking, one large steel plate and one sieve for sieving.

  1. Take the Ghee and heat it on a low flame till it is really hot.

  2. Drop about 1 tbsp of this hot Ghee on the besan and mix it well. Roast the Besan and Ghee mixture on a low flame till it starts giving off an aroma.

  3. Now sieve this mixture so that there are no or very few lumps.

  4. Take the sugar and the water mixture and heat it on a medium-low flame till it forms a single thread consistency. This can be checked by periodically taking this(very hot) sugar syrup) and pressing it between your index finger and thumb, and trying to separate them slowly. If the syrup at room-temperature(or slightly warmer) forms one single thread, then it is the right consistency. The sugar syrup will be bubbling. It is these air bubbles that the besan will trap and help create the holes in the final product. More viscous mixtures will result in a more crumbly Mysore Pak, and less viscous mixtures won't form as good a texture.

  5. Now add the sieved Besan to the sugar syrup, and stir till it is completely mixed and there are no lumps. This shouldn't take too long. Less than a minute.

  6. Add the cardamom to the mixture now if you are using it, because you won't have time later!!!!

  7. Now, add the very hot Ghee, about 1-2 tbsp at a time to the Besan and sugar mixture, and keep stirring. As the hot ghee falls on this mixture, it cooks the besan because of it's very high temperature, and will form a frothy mass. This is normal.

  8. Keep stirring continuously, and adding ghee every 20 sec, till the mixture lets go of the pan, and stops absorbing more ghee. This is generally when I stop adding ghee. (I start off with a little more ghee than I think I would need, and save the rest for later.)

  9. Do NOT let your concentration waver, since this is a very critical period in the preparation of Mysore Pak. Any lapse of concentration now will spell certain doom.

  10. You need to keep stirring till you see a distinct change in texture and colour of the Besan. The Besan will darken slightly(it will just start changing colour) and will form a thready molten-rock like mass. When this happens, quickly remove the Mysore Pak, and place it into a tray to cool. If you remove the Mysore Pak from the heat too early, then it won't solidify and will form a burfi, and if you heat it for too long, it will over-cook, and lose it's texture and will fail to solidify into a sturdy mass. Instead it will become a gooey mass, which will not solidify.

  11. (coming back)It will solidify in a few seconds, but will internally continue cooking for about 10 min, or until cooled sufficiently. You will know it is done if you don't hear a spurting/bubbling sound when you put your ear over the Mysore Pak. When you remove the Mysore Pak to cool, it is actually cooking inside because of all the heat trapped in the ghee. It is because of this latent cooking that the Mysore Pak is able to get a light brown center.

  12. Cut it into pieces and enjoy :-)



I hope you enjoy making this mouth-watering sweet, and I hope it turns out well. Mysore Pak is a very delicate dish to prepare, and requires precise timing of operations. Remember to not lose your concentration, and always start off with a patient mind :-)

In case you are wondering how I know what happens when you over/under-do something -- well, I've tried it out!!!! And wasted so much of my ingredients doing so.... In case your Mysore Pak has formed a burfi(won't solidity but has a smooth texture), all is not lost. You can still re-heat it (on a medium-low) flame, and keep stirring till you see forthing, and a molten-rock like texture of the mass. Turn off the heat, and let it solidify.

Note:
  1. The ghee has a higher boiling point than water, and hence is hotter than the sugar mixture(which at single-thread consistency is about 105C). Hence, it is able to cook the Besan better than the sugar mixture. If you use cool/room temperature ghee, you will have to wait for the mixture to become hot, and all the heat will be absorbed by the ghee instead of the Besan, and the Besan will be left under-cooked.

  2. Some people suggest using a 50% - 50% mixture of Vegetable Oil and Ghee instead of pure Ghee. DO NOT do that under any circumstances. I tried it, and it leaves quite a horrible after-taste of oil in your mouth. To bring out the real taste of Mysore Pak, use ONLY 100% Pune Cow's Ghee. Cow's Ghee is slightly yellow in colour, and I've had success with a brand called Dynamix. or make your own [1] [2] from Pure Butter.

  3. If you skip the roasting step, the Besan may not give off the proper taste.

  4. If the Ghee is not piping hot, the Besan will not get froth every time you pour the Ghee over it. This is Okay. However, it will take a while too cook the Mysore Pak, and you need to know how much Ghee to add in advance. The recipe will no longer dictate the amount of Ghee to be used. You will need to patiently cook the mixture on a medium flame. DO NOT use a high flame or you will burn the Mysore Pak, since Besan cooks very easily.

  5. Try to use a thick(18 gauge) stainless steel vessel in which to cook the Mysore Pak, since it will ensure equitable heat distribution and will not react with the mixture's contents. Using a larger pan(kadhai) will help, since it will help air the mixture.

Wednesday, March 05, 2008

Once bitten, twice backed.

Have you ever seriously thought about backing up your data? If not, chances are that you haven't been the victim of a system/hardware/disk failure. Most of the people who seriously think backing up their data and maintaining snapshots is an important part of their routine are the ones who have spent countless hours of their time trying to recover/rebuild their lost data after a system crash. Why does it require someone to suffer before they start becoming cautious with their precious data? Maybe the reason for it is; to quote from Shakespeare's The Merchant of Venice: "For sufferance is the badge of all our tribe".

Whatever, it may be, I would like to say that it's important to always back up your important data and protect it against system failure(s). In fact, I have set up an RAID-1(mirrored) array at home where I store my important data and my home directory. This way, even if one of my Hard Disks were to crash, I'd have the data safely backed up on the other one in the mirrored array. However, this solution does not prevent against:
  1. Accidental file deletion,

  2. Accidental Disk formatting.

  3. File System corruption.


To prevent against such problems, I'd want to have a separate backup(or preferably snapshotting) utility which saves versions of files as you save them. Ideally, the solution would be to introduce a surrogate file system such as a one written using the fuse file system, and have that file system save versions of the files as you save them. So, changes between an open() and close() on a file should be logged and saved as a file version. This way, the user will be able to recover files by how old it is and also get a fairly fine granularity control over the changes that happened. An optimization that could be done is to store only the changes to a file if only edits were made to it, whereas save a complete copy if the file size was changed.

I'm looking for more ideas and people interested in helping me develop such a solution, so if anyone is interested in helping out, please let me know and we'll try to work something out.

Hacking after a very long time!!!!

After very many months did I finally get down to doing some actual hacking on a program that I wanted to fool into thinking it something else. Please note that I'm use the word work hacking in the true sense of the word, and not to illegally gain access to a system. Please read this page to get a low-down on that controversy.

Anyways, so there was this utility very similar to the UNIX cat utility that read in a file, and wrote it to some other location. However, this utility also performs a check to determine if:
  1. There is sufficient space on the destination disk.

  2. The destination file is on a special file system

Only if both the conditions are met does the utility go ahead with the task of creating the destination file. A special feature of this utility is that it will create sparse files if the source file contains many holes in it. So, it is not strictly required that the destination file system contain as much space as the source file size. Also, the second check is made to make sure that the destination file system supports sparse files. However, if we know that there is another file system which supports sparse files, we can do away with that check as well.

All said and done, I did not have the source code to the utility that I am talking about, so I decided to do something else. I used the LD_PRELOAD environment variable available on all Linux machines to load in a custom compiled shared object file which overrides system calls such as statfs(), statvfs() and ioctl() that are the typical calls used to get this sort of information from the underlying OS, and viola! there it was. My hooks worked, and I was able to see what was being returned for each request. The only thing I had to do was fool the program into thinking it was getting the information it needed to go ahead with the file conversion. That again was just a matter of inspecting and inserting the correct values for each over-ridden system call. the whole process took about 4hrs, but it was time well spent. It felt good to get back to doing this sort of hacking-programming after a while....

Friday, February 29, 2008

A bug-fix.

I was writing a small php script to recursively delete all files and directories in a particular location that are more than a few hours old. I thought it wouldn't take more than 30min to do the whole thing. Additionally, I thought I'd use the Standard PHP Library(SPL) and the RecursiveDirectoryIterator class provided with it to implement directory scanning instead of the normal opendir(), readdir(), closedir() approach.

After writing the script, I tested it by making it spit out stuff saying Deleting file.... instead of actually making it delete any files/directories. The logic te script was used was that it checked the file/directory ctime which is the Inode Change time(not the file creation time as I earlier thought). Everything seemed to be working just fine when I uncommented the unlink() and rmdir() functions to test the real thing. Now, the script started saying different things, and wasn't even considering some directories for deletion. I was very surprised at this behaviour. I initially thought it was something to do with open directory handles or something, so went back to using the opendir(), readdir(), closedir() approach. However, even that approach yielded the same results. It's desperate times like these when you lose reason, and start to tinker with things which you know are not at fault in the hope of fixing the error. I inserted lots of debug output to be able to pin-point the error, but php kept saying that rmdir( was trying to delete a non-empty directory.

I'll give the directory structure below:

.
`-- aaa
`-- zzz
`-- hello.txt

2 directories, 1 file


The output indicated that the file hello.txt was being deleted, but the directory zzz wasn't even being considered for deletion. Further, the script was trying to delete the non-empty directory aaa. I couldn't understand why this was happening. It was after some more brainstorming that I realized that the operation unlink() on the file hello.txt was changing the ctime for the directory zzz which meant that the directory zzz was no longer being considered for deletion. However, the ctime for aaa was staying unchanged. This was happening because I was calling filectime() while scanning the directory instead of pre-computing all the ctimes for all the files.

So, I now decided to use the scandir() function to get the directory contents at one go, and get their ctimes before doing any further processing on that directory such as recursive scanning or deletion of files/directories within that directory. This fixed the error, and the script now started exhibiting the expected behaviour. Even though this may look silly, there were many things I learnt from it; the most important being to make sure I know the side-effects of any action that I may perform.

Sunday, November 25, 2007

Slave for life

Why do we need to pledge loyalty to some company? Yeah.... the usual answer is cause you want them to be faithful to you in return. But these days, the concept of staying with one company is alien to most. In fact, this attitude has percolated down to objects of daily use such as refrigerators, computers, telephones, and even relationships. People only so much of something. They feel overwhelmed if they get too much of anything. Speaking about jobs though, if you ask someone firms he/she has been in in the last 5 years, and if the answer is anything less than 2, then more often than not, the other person is saying to [him/her]self "what a loser"....

What is happening here people? There used to be a time in yesteryear India when people were happy to get just about any job as long as they took some money home at the end of the month. But things have changed a lot in the last few years. Jobs are much easier to come by because of the free economy, and spread of education. People are more educated; or lets just say they know more these days than they did a few years ago at their age. This argument is true of pretty much every successive generation though. Lets not confuse education with knowledge for some time now. There is a greater demand for knowledgeable people, and jobs for such kind of people in India at least, which is now driving the job market. You see industrial expansion all around these days. IPOs coming out pretty much every month these days is indicative of the industrial revolution happening here.

But the big questions I have is "Why should I be loyal to a company for a very long time, and thus enslave myself?" The answer may not be very simple; in fact, I don't know it myself, but at this point in time, I know that I don't need to be loyal to any company. If you look at people who are loyal, and are looking to grow in the company in which they are are doing it either because of the money, or the work, or the reputation of the company or the position they will attain in the next few years, or for come amount of satisfaction and job security, or because of peer pressure, or a certain combination of all of the above. Of course, there are many more reasons that I haven't mentioned or even thought of. However, may a times, these people are kind of under productive in nature. They seem to have settled into thinking that they can not be displaced from where they are now. If there's anywhere they are going, it's up the promotion ladder. In return, the company does them favours by giving them incentives, promoting them, and sending them on foreign trips, etc.... But, is the company acting in it's own benefit? I mean consider there is this under productive person (A), and a significantly more productive person (B). A is loyal to the company, and everyone knows it, but B is a carefree kind of person who doesn't care too much for anything/anyone. The company decides to send A to the client as their front, knowing well that they could have done better by sending B, but they don't cause they know that there is a greater chance of A staying with the company for longer than B. So, if they send B now, then they might temporarily get a good response from the client, but B will leave in a while, and A will be disgruntled because he/she wasn't sent, and will become even more under productive than before, and might even leave. However, if they send A, then A will probably grow up to the responsibility, and even though he/she might not create a great first impression, he/she will possibly stay back with the company, and will grow with the company providing it with a stable and possibly reliable front. I don't know if I agree with the philosophy. I don't even know if I disagree with it. In an age where employee retainment has become a buzz word, and companies pride themselves on their employee retention rate(which is inversely proportional to their attrition rate) this makes perfect sense. But is that a measure worth looking at with great amount of seriousness? Thinking about it from a rational perspective, it makes sense, since the attrition rates speaks a lot about the company. If people are leaving, it is generally true that their expectations haven't been met one way or the other. But is compromising company reputation for employee retainment justified at any cost?

Saturday, November 24, 2007

The one that got left behind

What comes to your mind when you read the title above? Make a quick list of a few things that do. It could be:
1. The ugly duckling
2. Some taste left behind in your mouth after having something utterly distasteful/pleasing
3. Some food speck left behind between your teeth
4. A good/bad memory, though more often than not, it's the latter that stays
5. The tune of some song that you just can't get out of your head
6. Some task on your list that you forgot to do

But, I ain't gonna to be talking about any of the above. What I'm going to focus my attention on today is on that last bit of poop left behind after you flush. No matter how hard your try, how many tumblers of water you put in, however fast, it just won't go down! It's like one of those resilient warriors; kind of reminds me of cockroaches. Every time you try a different angle to put the water in, and look in to see if you've managed to get rid of it, it just bobs up right back in your face. It's like as if it's there to stay. So, you try again, and again, and again, and before you know it, your bucket of water is over, and there's none left for you to wash your hiney!!!! You think "Now is a really bad time for me to run out of water". Reminds me of a few problems I've faced in my little life so far. They've mostly been self-created like this one, but more often than not, they just go away with time, or I find a solution if I think about it with a clear head; but not this one. No matter how much time you give it, it just stays there - probably soaking up more water, or doing whatever it does best. You know that the only way you are going to get rid of it is to flush again, or heave another full bucket of water in it, but you don't have the patience to wait till the flush tank is full again, and at the same time, don't want to waste another bucket of water, now that you've already used up one already. You start thinking and staring at that mass of excreta in a very contemplative way; but to no avail. Exasperated, you move on to let the next person clean up your shit.... Well, that's life....

Monday, October 22, 2007

The geek in you.

After reading the previous post(Of wed-locks and love-handles), a friend of mine pointed out a spelling mistake that I had made. However, when I went back and re-read the title, something very interesting struck me. If you notice carefully, the words locks and handles are technical terms used quite frequently in computer engineering ;-)

Sunday, October 21, 2007

Of wed-locks and love-handles.

I've been observing, examining, thinking, and concluding for quite a while now, and I've also discussed this theory with quite a few friends by now. However, many of them don't quite agree with it entirely or in part. I personally don't blame them for it. After all, it's just a theory and I haven't even bothered to take a sample space and conduct a proper examination. But you all must be wondering what it is that I'm theorising. Well, the thing that I've noticed is that people (both guys and gals) generally(not always) get plumper after marriage. So, I was just trying to think of reasons as to why this must be happening. This is true of most of the societies that I've been exposed to, so it made me think that is isn't a localised effect, but is more widespread. So, just before posting this, I did a quick google search for fat after marriage and was surprised with what turned up. Apparently, quite a few people before me had noticed it and also written about their findings. However, I decided to get done with my conclusions before reading theirs to avoid corrupting mine with theirs.
The explanation is actually quite simple, and the prelude might actually be longer than the actually reasons I want to present, but then again, every concise idea is also a very crisp one, and presents very few places it can go wrong in. According to me, people get fat after marriage because they no longer feel the need to attract people of the opposite sex, and hence begin neglecting their bodies, and indirectly their health. They feel that their job is over and they don't need to be at their best any more since their prey has been captivated. I on the other hand have very varied views. I feel that if you think that you don't need to look your best now, then it's because you either don't don't love yourself enough or you don't love your partner enough, because of which you don't want to put in the extra effort, and look your best for yourself and/or for someone who cares for you. This as far as I'm concerned is the primary reason for fatness after marriage. There may be others, which are mentioned in the pages given here(yes, I read them just before writing this line). However, after reading them, it may be the case that these reasons are equally important and it may be unjust to say that they aren't the main reasons.

  1. http://ezinearticles.com/?Why-Women-Gain-Weight-After-Marriage?&id=170650

  2. http://findarticles.com/p/articles/mi_m0NAH/is_3_33/ai_104836629

  3. http://forums.plentyoffish.com/datingPosts4342202.aspx

  4. http://answers.yahoo.com/question/index?qid=20070702022119AACDXLR

  5. And something on the lighter side. http://www.usaone.net/jokenet/jokes.asp?command=list&r=102


So as you can see my dear friends, I haven't been mistaken in thinking the way I did, and there are others who feel the same too.... An interesting side effect of this exercise is that it will make me use the web search features more often to try and validate my theories, or at least try and figure out if someone out there has already thought of and documented them online.
Ciao, and please keep in shape!!!!

A bumpy bus ride

A friend and I were returning to Mumbai from Pune on the MSRTC Volvo bus, and here is something that I wrote while on the bus.

We were sitting over the malfunctioning suspenders of a bus travelling at a relatively high speed(about 90km/hr) on a road littered with irregularities. The intermittent halt at the toll naka was a very welcome one. My hand writing did improve while we were stationary, but went back to its illegible self once the bus re-commenced its jerky ride back to Mumbai.

Sunday, September 23, 2007

An HTTP server with diff capabilities.

These days, there is a surge in the traffic content on the internet. Many sites are serving dynamic content to their users. However, the static content doesn't seem to have lost popularity. Many sites still serve a lot of their pages more or less statically. Furthermore, these static pages don't change very often even though clients are always re-requesting these pages, and asking them to be refreshed. An example would be google's home page. That apart, site administrators always want clients to not cache the page content, because they want clients to see the latest version of any static content that may have changed since the last time they visited. This makes them advertise HTTP headers which forbid the caching of web-pages by browser and proxy caches.

If you notice carefully, even if use wisely, the If-modified-since header involves sending the entire page back in case it was modified. What I'm suggesting here is to use a diff based scheme, wherein the client sends a request to the server indicating a previous page version that it already possesses, along with a flag indicating that it is willing to accept a diff to the current version of the page. The server will now(optionally) send back a patch to the client which it applies to the page that it already possesses. This sending of the patch is optional since the server may not have cached the page to which the client is referring, so that generation of the patch may not be possible at the server end. In this case, the server will send back the whole page as it would in the current scenario.

What this scheme will effectively do is reduce bandwidth consumption dramatically in places where a central proxy is being used to serve many users, and those users seem to be accessing the same static content repeatedly. If the content changes by a bit, or doesn't change at all, this scheme will result in a definite reduction in bandwidth consumption on the internet. However, the trade off here would be CPU time to network bandwidth, since the diff generation and application of the generated patch are both CPU intensive activities as compared to normally sending the whole page.

Bumping up the bandwidth usage.

Have you ever wondered how you can (without too much of effort) use a lot of bandwidth on your local LAN? Well, if you have a central proxy server(gateway machine) through which you connect to the internet or to other computers, then you could do this quite easily.

First of all, configure your browser to use the proxy server installed. Then change the settings so that the browser uses the proxy server even for localhost(your local machine). The browser defaults general bypass the proxy for localhost. On your machine, on port 80, configure a proxy server(squid) to use the proxy server on the gateway machine for making connections.

Now, type your machine's IP address on your browser's address bar, and hit enter, and watch while the packets keep bouncing to and fro the gateway machine and your machine. This happens because your browser will contact the proxy server for the request, which in turn will contact your machine, which will again contact the proxy at the gateway, and so on....

Residents of buildings without elevators live healthier, longer.

According to a recent survey conducted by research scientists at the Montgomery university at Timbaktoo, it has been observed that the average age of people living in buildings without elevators is greater than of those living in buildings with one. Scientists observed a group of people living in the northern part of Timbaktoo city where the buildings are old, do not have elevators and people have a generally lower standard of living as compared to those living in the south, where sky-scrapers abound, and the standard of living is considerably higher. It was expected that the richer would live longer, since they eat healthier food, and can afford costlier medication. The results however were not in accordance with that theory.

As it turns out, the poorer people, with their low standard of living, and simple eating outlive the rich by an average age of 6~7 years. The northers sample space had an average life expectancy of 89 years whereas the southern sample space recorded a mere 82 years. It is believed that this singular occurrence if because of the fact that people living in the poorer parts of the city do not have elevators in their buildings and are forced too use the stairs, which is considered to be a good exercise for the heart and kidneys. Researchers have yet to conclusively nail this as one of the main reasons as to why people in the north live longer.

Monday, September 17, 2007

Ampache

I was thinking about setting up a server for streaming music of their choice to users on the LAN, and also for writing software for such a purpose. However, I happened to chance upon this great software called Ampache that does just that and more. Have a look.... It might interest you. However, I feel that this software lacks certain statistics like showing you relations in songs such as those songs which are liked by people who like songs that you also like, but you haven't yet listened to. Otherwise, I feel this software is really well made, and promises to become much more.

Saturday, September 15, 2007

To Mother

You love with unforgiveness
You care with such vengeance

You hit with such love
And fire with determination

You always have a motive
Behind all your aggressive

And when you have a plan
Not even the leader's clan

Can do anything about
When it comes to your little pout

But fever when have I
It's you that night sits by

And happy when am I
It's you that dances by

I never as much notice
Your presence in the office

As when you are not around
And a problem I have found

But homecoming is a joy
To your scrubby little boy

As he is now quite able
To chat until he's stable....

Friday, June 01, 2007

Random stuff; About today.

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.... ;-)

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 on copy-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:

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.

Tuesday, May 22, 2007

Up yours

I'm sick and bored of working on the project I am on presently, and want a change. As affairs stand presently, I don't see it happening, neither does it promise to change in the very near future, so I guess I'll just have to live with it. Well, if this goes on for too long, I'll just work even lesser(I wonder how less that'll be :-p), and eventually become one of those blobs who just sits around and does nothing. Now, that's something I'm really scared about.

I do realize that I need to busy myself in some way or the other. I love programming; nay more so problem solving. This is something that will stay with me forever -- whether I like it or not. Thankfully, I really do like it. I'd like to think of it as something like muscle memory, except the only muscle involved here is the one in my head(or at least I would like to think of it as such).

Staying idle just bores and irritates me, and I get highly irritable, and restless. I don't like it, and if it's in my control, I would do away with idleness in my life unless I want it at any point in time. Yes, when you wish to relax, or just simply chill out, you want to remain idle, and not do anything. I'd go further and say that I wouldn't want to even think about anything.

I'm afraid of time, and what it can do. I'd rather not think about it now. That's been my way of living in defiance of reality, though I like to stay as close to it as possible.

My current employer hasn't been able to quench my thirst for whatever it is that I yearn for from a job/profession. That drives me nuts, and turns me off. I feel really irritable right now, and want to turn off and go to bed. Ok, maybe read some Calvin and Hobbes or Dilbert.... I just want to get away from this boring routing, and take a break. In the words of a friend do somehting new and different for a while -- just to get away from the routine.
[Which reminds me; I'm going to be this weekend. :-)]

Needless to say, the resource allocation policy(btw, humans are referred to as resources in the corporate world) at this place is worse than what a chimpanzee could do in a bee-hive. This happens to be one of the biggest reasons for employee dissatisfaction. And why not. If you have neanderthals controlling the place, you can expect nothing less than a messy cave at best -- if not a complete mess. There doesn't exist a word such as accountability or responsibility which is a major driving force for us homo sapiens. The lack of these renders this a majorly boring thing to be doing for a living. However, if you consider this as a day job(which is meant to be boring), then I guess it's okay.

Another thing that was being discussed was the flexi timings that companies enforce these days. If there is no goal, aim, or direction towards which you wish to work, then you just land up wasting more time in office being highly unproductive all the while. There is talk of young bachelors spending more time at the workplace than at home because they have all the luxuries and requirements that they yearn for at the office itself. This is tending to be true for those who live alone/away from home, and should be avoided at all costs. Especially since work hasn't anything spectacular to offer.

At times, even if you speak to the people concerned about your being uncomfortable about the kind of work you are doing, they turn a blind eye towards it because it would be less profitable for the company. Kiss my a$$ -- less profitable. I ask the question: "If the employee isn't happy, how do you expect him/her to deliver his/her best most of the time?" I think the short answer is "you can't!!!!", and the long answer is "you can't!!!!". How many years of experience, and or post-graduate learning does it take for one to understand this simple aspect of life? Well, apparently, 14 years of professional experience, and a post-graduate degree isn't enough for some. Others may even turn their eyes away from the existence of such a problem, but then it's them just behaving like me, and living in defiance....

Give a man money, and he can buy food. Give a man work, and he'll be able to work up an appetite to eat it.

Looking for a house mate

Yes, you read it correctly. I'm looking for a room house mate. Now don't get any thoughts in that dirty little mind of yours. All I'm saying is that I want someone to share the flat with. So, if any of you out there know of anyone who maybe interested, please let me know, or else I'll have to look for another place to live in.

Stuck in a lift

Today, we(shete, kunal, bharati, anupam, and myself) had gone home for lunch. Yes, occasionally, we try our hands at cooking -- just so that we don't lose that chef's touch. After heaving our stomachful, we decided to head back to office because it offered a cool and air-conditioned environment for us to sleep in we had a some work to complete by the end of the day. Like a diligent and obedient citizen of the state, I made sure all the lights and fans were switched off before we left the house. So, after performing the final round of checks, I entered the lift which was already populated by the other four. As soon as we closed the doors, and the lift started it motion downwards, I was reminded of an article I had read in the Reader's Digest a couple of weeks ago about the downward fall of a lift. There, all the occupants of the ill-fated elevator had managed to survive, but they all had broken bones, are couldn't resume their daily duties immediately. Anyways, all this continued till we reached the ground floow, when the lift stopped. I opened the inner door; but when I tried doing it for the outer one, it just wouldn't open.

Shete and I remembered that we had been stuck in such a situation before, and there was nothing really to worry about since we had been able to go to the first floor, and then come back down when the lift door had openeed the second time round. However, when we tried doing the samr thing again, the lift just refused to move up. Even after repeated attempts, it just wouldn't work!!!! Now, we were really stuck.

After a lot of poking and prodding we were able to find and unfasten a lever that held the outer door in place, and we manually undid it. That's when we were able to get out. The most scared of all the people was kunal, and he expressed it, by not losing a single minute in getting out when the elevator doors finally did open up....

Thursday, March 29, 2007

Vohuman's again.

As you may have already read, I was at Vohuman's Cafe on Tuesday, having breakfast. I had:
[1] single egg bhurji
[2] toast butter
[3] bun maska
[4] bournvita

Well, for the longest time, I used to call the waiter with the gay confident gait "Suresh". However, it turns out that his name is "Satish". I shall keep that in mind hence forth. The surprising thing is that he responds to both calls. Why didn't he tell me that the former wasn't his name? If I were him, I would surely have corrected anyone who called me any differently than my pre-assigned handle. Anyways, that isn't the case, and now I know. It's not a very good thing to get people's names mixed up.