Posts

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