Posts

Showing posts with the label web

Logging messages to Javascript console

Image
If you have had experience of web development and have hands on javascript coding, you will know how difficult it becomes at times when you have to debug javascript code. And it gets worse when you have multiple browsers rendering the javascript in their own ways. I could remember debugging the javascript code manually by putting those crappy and irritating alert() messages in the code to know how the code is being executed to root cause the issue. And if you know what I am talking about, you will know what I am talking about. But browsers have evolved a lot is the last five years and so as the tools for web development. When I first started using the Web Developer addon , it was like I had waited for it since ages for it. And I still feel there is no match for it. Even though the javascript console was available in Firefox, with usage of Web Developer, it was more accessible than ever. Okay. Too much theory. Lets get to point. You need to debug javascript pages and get rid of those al...

Twitter's secret

If you think this is going to be the some secret way to connect to Twitter, then you are wrong. This is about the how twitter got huge attention of the developers and bloggers. The softwares have become more than means to earn. They have incorporated into our lives so much that at times we cannot imagine any life without them. There would be hardly anyone in the industry who does not know Google. Why Google. Take twitter. Who is not on it. Even Sachin Tendulkar finally came to it. With twitter, our links with the virtual world have got even stronger. So, what the success stratergy behind the Twitter's success. Initially when I heard about twitter and tweeting, I thought - What sort of application is that. Just scribbling some 140 characters to let friends know whats happening in someone's life. But we know what capabilities it has. The stratergy for Twitter's success is letting the user decide the interface what suits him/her. They focussed more on the core of the system. T...

Javascript - parseInt bug

Working in javascript on the my project, I found an interesting thing which I would like to share with you all. parseInt() method in javascript is used to parse a string text into integer. For example to convert String “8” as integer 8 for processing, you will use it as follows: var parsedValue = parseInt(“8”); You can find more details about the parseInt() method on W3C Schools. http://www.w3schools.com/jsref/jsref_parseInt.asp However, there is an interesting bug with parseInt(). When you try to parseInt("08") or parseInt("09"), it returns 0. This is because the leading zero tells the parseInt() method that it is an octal number and 08 is not a valid octal value. Hence the parsing returns 0 as output. So, you might get this scenario when you trying to parse date values or month values containing leading zeros. Workaround: - Use the alternate form of parseInt(value, radix). This form forces the parsing of the string value as per your radix value. 10 indicate for de...