Posts

Showing posts from 2008

Music And Lyrics

Music and Lyrics is one of the movies, one should watch.It depicts how two people with different opinions about life and talented in their own ways come together to create a successful song.The movie illustrates this with a romantic touch. And by the end of the movie you know, how for a song melody and lyrics are equally important.Its a story where Alex (Hugh Grant) who is a pop star meets Sophie (Drew Barrymore) , a former English literature university major. They get together to write a song for Corra (Haley Bennet).The best part of the movie is the song they compose together. Alex believes for a song to be popular needs melody and is good at creating it, whereas Sophie believes that lyrics are the soul of a song and are important to a song. Together they combine their talents to create a beautiful song..."Way back into Love" which is worth listening once. Happy Listening...!!

RSA Security Token

When I saw an RSA Security Token for the first time, I wondered how this small device could ensure enhanced security.I had read about financial institutions using it but didn't exactly know how it works. The token generates a 6 digit number every min or 30 seconds , on pressing a button and all you need to do is key this passcode along with your password like: new password= password + token passcode This form of authentication is known as 2FA i.e. two factor authentication. Now, I kept on wondering, how the server will know this new password as passcode was generated randomly based on an algorithm. The alogorithm in the token basically takes the current time and seed to generate the passcode. The server side also knows the current time and the seed and hence can generate the same passcode and hence be able to authenticate the user. Now the problem could occur if the time of the server and token is not synchronized.Hence the server opens a 3 minute window and accepts time +

Fields Vs Properties

In .NET, we can define attributes of a class as a field like: public class Employee { private System.Int32 employeeId = 0; ... } And if, we want this attribute to be accessed by other clasess, we make it public like : public System.Int32 EmployeeId = 0; We, also have an alternate way of declaring the same thing, as a property like: public class Employee { private System.Int32 employeeId = 0; public System.Int32 EmployeeId { get { return employeeId ; } set { employeeId = value; } } } Now, EmployeeId is a property, which is exposed to other classes. We can think and figure out the difference between the two approaches - of defining it as a public field or a property. If we declare the attribute as a property , we can go ahead and modify the get-set section like: public class Employee { private System.Int32 employeeId = 0; public System.Int32 EmployeeId { get { return employeeId ; } set { if (value>0) { employeeId=value; } } } } What is be

ArrayList Vs HashTable

ArrayList and HashTables are data structures provided by .NET framework.Both are collections and are bundled under namespace System.Collections. To create an ArrayList : ArrayList employees = new ArrayList(); employees .Add("Ram"); To create a HashTable: HashTable employees = new HashTable(); employees .Add("E1001,"Ram"); To understand, the difference we need to understand the way they store objects. In case of an ArrayList, it keeps on incrementing the index and stores the objects as you add them.The elements stored will not be sorted automatically, unless you explicitly sort them, by using Sort() or ReverseSort() methods of arraylist.In case of a HashTable, hash value of the key is computed and the object is stored in respective bucket.So the elements are stored in a sorted order. This provides an advantage when it comes to searching a specific element. Incase of a hash table, it is faster as compared to the array list.Search is simplified by search

Email Templates in ASP.NET

Till recently, whenever it was required to send an email, through a web application using SMTP, I would go ahead and use SMTPClient, a class provided by .NET Framework.All I needed to do for this, is to include namespace System.Net.Mail and I am ready to go.I would read the SMTP host IP, port number and timeout value from the configuration file and write a code snippet like below: String hostIP=Convert.ToString(ConfigurationManager.AppSettings["SMTPHostIP"]); Int16 portNumber = Convert.ToInt16(ConfigurationManager.AppSettings["SMTPPort"]); Int32 timeout = Convert.ToInt32(ConfigurationManager.AppSettings["SMTPTimeout"]); SmtpClient smtpClient = new SmtpClient(); smtpClient.Timeout = timeout; smtpClient.Host =hostIP; smtpClient.Port = portNumber; My next steps are to instantiate MailMessage class provided under the same namespace and invoke Send method, as below: MailMessage mailMessage = new MailMessage (fromAddress ,toAddress ,subject ,mess

This Internet Age of Ours

Few days back, I was just wondering about this internet age of ours, the unlimited power of this invention. About a decade back, if I had to travel from my home (in Delhi) to my aunt’s place (in Mumbai), I would go to a ticket counter at a nearby railway reservation counter, stand in the queue for a long time waiting for my turn. And finally, when I reach the ticket window I would be sent back to change my train number as the reservation would not be available in the requested train. I cannot describe the disappointment, anguish and torture of booking a ticket. And did I mention I need to go at least a month in advance. But if, I have to travel today, all I need to do is just click, click and click. No waiting in long queues, no traveling involved to visit a nearby booking center. How convenient is all this. A lot of us have reading as a hobby and even if you don’t have, at least , if you belong to a typical middle class Indian family, reading daily newspaper is a customary. Knowing

To be or not to be

To be, or not to be, that is the Question: Whether 'tis Nobler in the mind to suffer The Slings and Arrows of outrageous Fortune, Or to take Arms against a Sea of troubles, And by opposing end them? To die: to sleep; And by opposing end them: to dye, to sleep No more; and by a sleep, to say we end The Heart-ache, and the thousand Natural shocks That Flesh is heir too? 'Tis a consummation Devoutly to be wish'd. To dye to sleep, To sleep, perchance to Dream; I, there's the rub, For in that sleep of death, what dreams may come, When we have shuffled off this mortal coil, Must give us pause: there's the respect That makes Calamity of so long life: For who would bear the Whips and Scorns of time, The Oppressor's wrong, the poor mans contumely, The pangs of despised love, the law's delay, The insolence of Office, and the Spurns That patient merit of the unworthy takes, When he himself might his Quietus make With a bare Bodkin? Who would these

The Eight O’Clock Cab

It is fifteen past eight. One look at the clock and I know I am late. I am going to miss it today for sure. In a flicker of seconds, I send the mail I am supposed to, lock my workstation, switch off the monitor and pick my bag up. I rush through the doors of the bays to reach the lift area, press the lift buttons and wait for it to come. Sometimes it may just take a minute but it will seem to be taking hours. As soon as the lift stops, I just get inside, smile at the people I know and press zero for ground floor. The lift opens and I just rush through the doors out to check if it has left. And just one glance of it brings back a smile on your face. You are relieved to find it still there. I am talking about this incredible eight o’clock cab which usually leaves daily from my office to drop people home. The scheduled time for this cab is eight o’clock but it leaves by fifteen past eight usually, unless the driver is in a real bad mood and decides to leave most of us behind. So if it i

Mesmerising Moon

Only yesterday I was wondering about wonderful Moon.As most kids in India, I knew it as Chanda Mama or Uncle Moon, till I grew up to understand the more scientific reason behind its existence.Yes, that sounds hilarious but we in India have a name for everything and everyone.Whether it is animals, trees, plants, lakes, rivers, mountains, heavenly bodies or anything else you can think of , it is considered holy,will have a name and some mythological story attached to it.Bottom line is you have to have respect for all. That is how in India a milkman is dhoodh wala bhaiya (elder brother selling milk) or vegetable vendor is kaka (uncle) and anybody you meet on streets and ask for address have to be addressed as uncle or aunty. But wherever you are ,whenever you look up in the sky during dusk or night, you see this familiar object, up in the sky, watching you all the time, smiling to you as if it knows all your secrets and all you have been upto. But this moon is visible to us in its diffe

Bangalore

It was year 2004, when I boarded my train to Bangalore,waving to my parents on the platform.This was not the first time I was going away from home, but those two pair of eyes watching me intently, from the platform, were filled with all worries and apprehensions. I came back to my seat and looked around to see whom I was travelling with, and I saw a friendly looking couple smiling at me,I smiled back.After some introduction, we finally settled in our spaces. I started with my book...Wings of Fire...but at the back of my mind there were thousands of thoughts from my past and worries about my future which kept on clouding my mind, as I skimmed through my book.After some time I was completely into the book and I travelled along with it. The train journey to Bangalore was a long one and I kept on taking breaks from my book.I watched the world outside.The train kept on moving as does this life....crossing through the green fields, then some barren land over the bridges making so much nois

Paradise on Earth

"Agar firdaus bar roo-e zameen ast, Hameen ast-o hameen ast-o hameen ast." This is a persian couplet which means " If there is a paradise on earth, It is this, it is this, it is this." Most of the people relate this couplet to Kashmir and believe that it was written for Kashmir. But this is not correct.This couplet was written by Amir Khusro who was a poet under Delhi Sultanat.Amir Khusro never visited Kashmir.He did not even write this for Kashmir but for Delhi (India). So then how did this couplet get related to Kashmir. It was actually Jahangir who when visited Kashmir was awestruck by its beauty and is said to have used this Amir Khusro's couplet to express his joy and wonder.