Thank God its Friday, is a phrase used quite frequently, especially software professionals. After all the preoccupation with work for 5 days, its time to relax and enjoy! However, the way I spent this weekend makes me think otherwise!!! Whether its because of lack of planning or some other factor is hard to tell. Got up early morning on Saturday (Trust me, 8.am is really early), dropped my friend to the airport and suddenly I realize I'm running short of ideas to spend the weekend.
Well, this has never happened to me before. So I take out a book and start reading. Its been hardly 15 minutes of reading when I realize I have to hunt for a new place to stay! Supposed to vacate our current flat at the end of this month. So I take my bike out, and set out on a wild goose chase! I had no intentions of hunting for a new place, so no effort made in this respect. After loafing around on the Bangalore streets, I finally have lunch and come back to the flat. Sit idly for about an hour then head straight to office. Office? on a weekend? I was never a workaholic. Well, atleast I can surf the net. And thus, I spent the entire evening in office, doing nothing! Nothing at all!!! Came back at night, watched TV till midnight, but wasn't getting any sleep! Nor was in a mood to read. So just lie down, waiting for the sleep Gods to be pleased. Fortunately, they were helpful and responded soon. The next day I hoped should be better. I get up at 10.30 and decide to indulge in my favorite activity! Take my bike, go on a long ride, not knowing where to go! Just follow the road, take a random direction at a junction, take a tea break at a tea shop and move on!!! Finally after travelling around 80-100 km, I reach back to the flat and again go back to office :( in the evening, this time with a genuine intention to work (Not really). I just play some online games for about half an hour. Then I find a friend online on gtalk. A friend whom I always enjoy chatting with :) Well thats it! The evening ended
with chatting. After dinner, I head to office again, this time with Shivam and Roshan, both of whom, currently loaded with work. And what do I do? Just give them company and chat again!!! And finally decide to write this! To remind me to plan things, to avoid boring times :) After all, boredom is a really nasty bug!!!
Monday, December 17, 2007
Wednesday, November 28, 2007
Addiction to work or procrastination???
Well friends, its been a very long time since the last post! Obvious excuse is a lack of time! Although that's a blatant lie, I don't generally enjoy lying, so let me confess. Laziness has become an integral part of me and I'm finding it hard to part with it. Hey, wait a minute, what is this post supposed to be about? I couldn't think of a title which would justify the following, so I just stuck to one which would sound less harsh...
I've been in the office from 10am to 3am ie 17 hours today! Let me reflect on what I've done in those hours... Well, here is the work flow. Check my mails, go out for tea, check my mails (this time obviously no mails to reply to), start working for about an hour, spend some time in the restroom, go out for tea, browse the internet, work for another hour or so, have lunch (a late lunch), go out for tea, work for another half an hour, browse the internet, then work for another half an hour. Its dinner time by now. So I go out and have dinner. Then I don't feel sleepy, so come back to office, work for another half an hour (work is almost done, but not yet complete), browse the internet. Finally, at about 2am, I decide to finish whatever is left (hardly 1-2 min job). Then start the orkut business! Eventually, tired of orkut, I think of posting this piece of gibberish!!! If you have taken the trouble to read so far, then take some more to leave your comments, giving me and other like minded people some advice on how to rid oneself of this dangerous habit. I'll try my best not to repeat this thing. Bye for now.
I've been in the office from 10am to 3am ie 17 hours today! Let me reflect on what I've done in those hours... Well, here is the work flow. Check my mails, go out for tea, check my mails (this time obviously no mails to reply to), start working for about an hour, spend some time in the restroom, go out for tea, browse the internet, work for another hour or so, have lunch (a late lunch), go out for tea, work for another half an hour, browse the internet, then work for another half an hour. Its dinner time by now. So I go out and have dinner. Then I don't feel sleepy, so come back to office, work for another half an hour (work is almost done, but not yet complete), browse the internet. Finally, at about 2am, I decide to finish whatever is left (hardly 1-2 min job). Then start the orkut business! Eventually, tired of orkut, I think of posting this piece of gibberish!!! If you have taken the trouble to read so far, then take some more to leave your comments, giving me and other like minded people some advice on how to rid oneself of this dangerous habit. I'll try my best not to repeat this thing. Bye for now.
Tuesday, August 14, 2007
Places to visit in India I - Shivasamudram Falls

Of the many picnic spots in and around Bangalore, I would rate Shivasamudram as one of the best. This waterfall is located around 120 km from Bangalore, towards Mysore (Mandya district). Though the road is very good for most part of the journey, it becomes terrible during the last 20km or so. Although you can go through the shorter Kanakapura route, I would recommend people to take the Mysore road till Maddur and then take a left at Maddur junction cause of the terrible road! After about an hour long bike ride from Maddur, you will reach a 3 way junction. The left goes to Gaganchukki (also known as eastern falls) while the road going straight takes you to Bharachukki (western falls)
Gaganchukki
There is a watchtower on this side of the waterfall which gives you a panoramic view of the waterfall. On the way to the watchtower, you will be greeted by a huge board shown in the photograph!

Well be wary of the monkeys near the watchtower! Towards the left of the watchtower, you will see a hydroelectric plant which is said to be the first to be built in Asia. There is nothing much to be seen here.

Bharachukki
This is the place where you can enjoy to the fullest! If you belong to the adventurous lot, then u can take a dip in the turbulent Cauvery waters. Sitting underneath the falls and letting the water current massage your body is a great experience! However you need to be extra cautious. A slight step in the wrong direction can turn you into an offering to the Gods of adventure!!!
Overall, Shivasamudram is a must visit place!
Thursday, July 26, 2007
Credit cards, the unnecessary evils
Thank God, its the last week of the month! With salary just a few days away, its time to party! Alas, not enough funds!!! Does this situation sound familiar? If yes, then you probably have fallen prey to the necessary (or unnecessary) evil called the credit card.
Well, credit card is the first hurdle to effective wealth management especially for salaried people. The credit card business is really flourishing these days. How many times have you received calls from credit card companies, offering lifetime free credit cards? The calls won't stop coming until you accept one of their offers! Its really hard to reject their offers. 'I am calling from xxxx, and we are offering you a lifetime free credit card. You will get 20% cash back on booking air tickets. You also get one rupee back on every hundred rupees spent on your credit card. In addition, you also get blah, blah, blah...'. You don't want a credit card, so you say, 'Thank you, but I am not interested right now'. 'Why sir? You are getting it free for lifetime. You get this, and this, and this, and that on the card...'. Well, you just cannot refuse, especially if the person at the other end has a sweet female voice ;) Chances are that you will go for one of the cards eventually...
Initially, we are a bit tentative to use the dreaded card. But alas, once we use it, we get into the habit. Now, we end up using the credit card for each and every transaction, however small or big it may be, mostly because of the seemingly attractive offers you get. The result? A long monthly bill statement, consuming more than half of your monthly salary...When you analyze your bill statement, you agree with all the billing details. But you just keep wondering, how it adds to so much. I myself have once paid a bill of 32k(without interest), but have stopped using it. Now, I just use it for booking travel tickets... If you have absolutely no control over your credit card, then chances are that you can't pay your bill on time, and you end up paying a hefty interest the next time...
Some people will use 2-3 credit cards and then use one to pay the bill of another. While they continue to repeat this cycle, they end up paying a transaction charge every time. Little do we realize that we become used to staying in debt.
I won't say you should not use a credit card. Use it only when needed, for example when booking travel tickets. For making general purchase, get into the habit of using a debit card. Atleast, you will stop spending wastefully when your account balance reaches a certain threshold. Still better use hard cash! Atleast you would know how much you have in your wallet and how much you can spend at that moment. This seems like an obvious and useless advice at first. But it certainly ain't as useless as it might seem to be! I hope this post will make you think twice before swiping!!!
Well, credit card is the first hurdle to effective wealth management especially for salaried people. The credit card business is really flourishing these days. How many times have you received calls from credit card companies, offering lifetime free credit cards? The calls won't stop coming until you accept one of their offers! Its really hard to reject their offers. 'I am calling from xxxx, and we are offering you a lifetime free credit card. You will get 20% cash back on booking air tickets. You also get one rupee back on every hundred rupees spent on your credit card. In addition, you also get blah, blah, blah...'. You don't want a credit card, so you say, 'Thank you, but I am not interested right now'. 'Why sir? You are getting it free for lifetime. You get this, and this, and this, and that on the card...'. Well, you just cannot refuse, especially if the person at the other end has a sweet female voice ;) Chances are that you will go for one of the cards eventually...
Initially, we are a bit tentative to use the dreaded card. But alas, once we use it, we get into the habit. Now, we end up using the credit card for each and every transaction, however small or big it may be, mostly because of the seemingly attractive offers you get. The result? A long monthly bill statement, consuming more than half of your monthly salary...When you analyze your bill statement, you agree with all the billing details. But you just keep wondering, how it adds to so much. I myself have once paid a bill of 32k(without interest), but have stopped using it. Now, I just use it for booking travel tickets... If you have absolutely no control over your credit card, then chances are that you can't pay your bill on time, and you end up paying a hefty interest the next time...
Some people will use 2-3 credit cards and then use one to pay the bill of another. While they continue to repeat this cycle, they end up paying a transaction charge every time. Little do we realize that we become used to staying in debt.
I won't say you should not use a credit card. Use it only when needed, for example when booking travel tickets. For making general purchase, get into the habit of using a debit card. Atleast, you will stop spending wastefully when your account balance reaches a certain threshold. Still better use hard cash! Atleast you would know how much you have in your wallet and how much you can spend at that moment. This seems like an obvious and useless advice at first. But it certainly ain't as useless as it might seem to be! I hope this post will make you think twice before swiping!!!
Thursday, July 12, 2007
Getting and setting cursor position in Design mode HTML controls
Well this post is for people who have used or might use Javascript in their life. Imagine you creating a WYSIWYG text editor in javascript and wanting full control over how the text should be displayed. Say for example you display the text after processing the user input. The processing is done as the user types. One approach which immediately comes to the mind is to use a hidden textarea control to capture the key events and display the processed text inside a div element. You will have to create a custom cursor inside the div for the user to know where he is typing. The cursor problem can be best solved using some character like say '|' inside an absolutely positioned div and then toggling the display of the div with the help of a timer. So far good! But now, imagine you want to go to the middle of a previously typed word and edit it. Where would you show the cursor? You will need to calculate the position of the cursor when the user presses any key, or clicks the mouse button. Needless to say, it is not easy to manipulate the cursor position. Say for example you had the word "foobar" and wanted to insert a 't' before 'b'. You will somehow need to calculate the desired cursor position in pixels and then display it accordingly. How to calculate? Well, not my cup of tea...
In such situations, the only feasible approach seems to be to turn design mode on for the control. So you use an iframe and set its design mode property to true. You no longer need a hidden textarea control to capture the keystrokes. You can capture the key events, process the user input and then display it inside the design mode iframe. Now the big question of reading and setting cursor position! Gecko based browsers support the W3C specified API. For example in firefox, you have the properties anchorNode, anchorOffset, focusNode and focusOffset which help you to determine and set the cursor position wherever you want to. You get the DOM reference and also the offset required. So pretty fine! (The details can be found in the Midas specification). But what about IE? IE's API doesn not even come close to the W3C API in this case (as in most cases). I was playing around with the design mode control last month and was stuck here. I did a lot of search on the internet but could not find any satisfactory way to get and set the cursor position in IE. One inefficient way found over the internet, to read the cursor position was to move the cursor to the left by some arbitrarily huge number, using the method moveStart on a selection object. This method will then return the number of characters moved which will give you the cursor position. You will use something like
document.selection.createRange().duplicate().moveStart(1000000, "characters");
This method will work fine for small text. But as you keep typing, the editor will become slower and slower. Setting the cursor position is also another problem. You will need to calculate the offset in characters from the start of the editable iframe and then use moveStart followed by collapse. This is doubly slow. The complexity of this technique would be O(n) where n is the offset number of characters from the start position. This is clearly unacceptable for large text input. I continued to hunt for a better approach. Eventually, my friend Shivram suggested a unique hack. He found a post on the internet where some person was using the method pasteHTML of the range object in IE to insert some image at the cursor position. You can paste HTML at the current cursor position using this method. The hack was to create a dummy DOM node and insert at the current cursor position using pasteHTML. Then using the DOM attributes, you can get the required DOM reference. The dummy node can then be removed from the DOM tree. So the following hack solved the problem with a complexity of O(1)
getNodeAtCursor = function() {
var range = document.selection.createRange().duplicate();
range.pasteHTML('<span id="foo"></span>');
var temp = getElementById("foo");
var n = temp.parentNode;
removeElement(temp);
return n;
};
The offset can be obtained by finding the length of the previousSibling of the dummy span.
Thus you get the DOM reference as well as the offset number of characters relative to the node without having to iterate over all the nodes before the one under consideration. Not a clean way, but certainly quite efficient for large text. Let us hope future versions of IE conform to the W3C standard as in Firefox and eliminate the need to use such hacks.
Well, I hope this post helps somebody who might be stuck with getting and setting cursor position in design mode controls especially in IE 7 and below. Cheers!!!
In such situations, the only feasible approach seems to be to turn design mode on for the control. So you use an iframe and set its design mode property to true. You no longer need a hidden textarea control to capture the keystrokes. You can capture the key events, process the user input and then display it inside the design mode iframe. Now the big question of reading and setting cursor position! Gecko based browsers support the W3C specified API. For example in firefox, you have the properties anchorNode, anchorOffset, focusNode and focusOffset which help you to determine and set the cursor position wherever you want to. You get the DOM reference and also the offset required. So pretty fine! (The details can be found in the Midas specification). But what about IE? IE's API doesn not even come close to the W3C API in this case (as in most cases). I was playing around with the design mode control last month and was stuck here. I did a lot of search on the internet but could not find any satisfactory way to get and set the cursor position in IE. One inefficient way found over the internet, to read the cursor position was to move the cursor to the left by some arbitrarily huge number, using the method moveStart on a selection object. This method will then return the number of characters moved which will give you the cursor position. You will use something like
document.selection.createRange().duplicate().moveStart(1000000, "characters");
This method will work fine for small text. But as you keep typing, the editor will become slower and slower. Setting the cursor position is also another problem. You will need to calculate the offset in characters from the start of the editable iframe and then use moveStart followed by collapse. This is doubly slow. The complexity of this technique would be O(n) where n is the offset number of characters from the start position. This is clearly unacceptable for large text input. I continued to hunt for a better approach. Eventually, my friend Shivram suggested a unique hack. He found a post on the internet where some person was using the method pasteHTML of the range object in IE to insert some image at the cursor position. You can paste HTML at the current cursor position using this method. The hack was to create a dummy DOM node and insert at the current cursor position using pasteHTML. Then using the DOM attributes, you can get the required DOM reference. The dummy node can then be removed from the DOM tree. So the following hack solved the problem with a complexity of O(1)
getNodeAtCursor = function() {
var range = document.selection.createRange().duplicate();
range.pasteHTML('<span id="foo"></span>');
var temp = getElementById("foo");
var n = temp.parentNode;
removeElement(temp);
return n;
};
The offset can be obtained by finding the length of the previousSibling of the dummy span.
Thus you get the DOM reference as well as the offset number of characters relative to the node without having to iterate over all the nodes before the one under consideration. Not a clean way, but certainly quite efficient for large text. Let us hope future versions of IE conform to the W3C standard as in Firefox and eliminate the need to use such hacks.
Well, I hope this post helps somebody who might be stuck with getting and setting cursor position in design mode controls especially in IE 7 and below. Cheers!!!
Subscribe to:
Posts (Atom)