Skip to main content

Posts

Patent for a single shared profile service

I have faced this problem multiple times. And its damn frustrating. Yes, I'm talking about the ten different places my profile is or was on the web. Google, Google apps account, LinkedIn, Twitter, FB and heaven knows where else. Any change in status or the way I want my profile to be worded, I have to remember and go and update all these places. Its a pain in all the wrong places. Trust me. Then I thought, someone must be providing such a shared profile service. You update your profile just one place and then push it to all these various social networks and web sites. I searched. Found nothing. I searched hard, asked my friends about this. Nothing! Zilch!! There were a few websites, that were almost there, but not exactly what I wanted. Gravatar has this for one's avatar. So why not something for profiles? Nopes. Then I had an enlightenment! Why not build this service and provide to the users on the web. I had an even better idea, why not patent it. Provide such a wonde

Developing for Android: HTML5 and Qt

Recently read a post by my friend and ex-collegue Sai Geetha on her very famous Android blog . I am now reading her blog to start learning a bit about Android development. In her most recent post, she has listed 4 ways for developing in Android. 1. Using the Software Development Kit (SDK) with Java 2. Native Development Kit using C / C ++. 3. RenderScript using C99 - used to write faster graphics code like the Google Books page turn animation etc. 4. Android Scripting Layer using Python etc. Just thought I'll extend the above further and add a couple of thoughts to this list... The trend now and what is gaining a lot of traction is developing cross platform apps. So you develop once and can deploy it on multiple platforms. Java showed this promise earlier, but is slowly making way for the newer and greater things out there. One should see how the recently released Java7 will perform. And Java is still the greatest thing for Android development today. Java is also the reco

Pageviews: FF vs Chrome vs IE

http://blog.chetankjain.net is a new blog and so the page visits are gradually picking up. Recently crossed a 1000 page views and Google stats throws up a nice picture on how the platform and browser split amongst the audience is.   Overall the ratio generally follows the current market trends. I've been following the trend regularly on my site and not surprising to see how Chrome is raising almost every week.

Solutions: Object Oriented JavaScript: 3. Functions

Previous: Chapter 2: Primitives Chapter 3: Functions 1. Write a function that converts a hexadecimal color, for example blue "#0000FF", into its RGB representation "rgb(0,0,255)". Name your function getRGB() and this it with this code:   var a = getRGB("#00FF00");   a;          rgb(0,255,0)   //Simple logic for getRgb()     var getRGB = function f(hexColor) {     var result = "rgb(";        result += parseInt("0x"+hexColor[1]+hexColor[2]) + ", ";     result += parseInt("0x"+hexColor[3]+hexColor[4]) + ", ";     result += parseInt("0x"+hexColor[5]+hexColor[6]) + ")";     return result;   }       >> getRGB("#0000FF");   "rgb(0, 0, 255)"   >> getRGB("#00FF00");   "rgb(0, 255, 0)" 2. What does each of these lines print in the console?     >> parseInt(1e1)     10    //1e1 is evaluated first     >> parseInt('1e1'

Solutions: Object Oriented JavaScript: Chapter 2: Primitives

JavaScript experts can skip this.   While reading the book, Object Oriented JavaScript by Stoyan Stefanov , I thought it would be a good idea to just solve the exercises presented in the book and store the solutions away. Takes me back to my school days when I was serious about learning stuff :) This will be a multi-part blog, with each blog entry solving exercises presented in one chapter of the book. The entire set of solutions will be eventually made available in my JavaScript site. So here goes ...   Chapter 2: Primitive Data Types, Arrays, Loops and Conditions   1. What is the result of executing each of these lines in the console? Why? >> var a; typeof a; undefined  // a has not been defined with any value >> var s = '1s'; s++; NaN  // converting 1s to a number is ambiguous with addition   >> !!"false" true  // "false" is a valid string   >> !!undefined false  //undefined is a falsy   >> typeof -Infinity "

Node.js and reckless console.log() statements

I've seen code that over uses, nah rather abuses the logger. Many times teams use it in the wrong way or sometimes over use it and then struggle to improve performance. This simple test will show the effect. From the synopsis of Node.js doc, this is my server code: var http = require('http'); http.createServer(function (request, response) {     response.writeHead(200, {'Content-Type': 'text/plain'});     response.end('Hello World\n'); }).listen(8124); console.log('Server running at http://127.0.0.1:8124/'); Now I use JMeter to test the performance. I fire a 1000 HTTP requests within a time frame of 2s, with a wait of 1ms duration in between each new request. In my environment the median response time was 2ms for each request. Now I add a single console log statement for the callback function in the above server code. var http = require('http'); http.createServer(function (request, response) {     response.writeHead(200, {'Content

parseInt() galore

After the Falsy  post, here is another interesting table listing various values as evaluated by parseInt() . Some are quirky indeed :) Free lunch to anyone who shows me another table that covers parseInt() in such detail :P Expression Value Remarks parseInt("23") 23 parseInt(" 23") 23 Leading white space is dropped parseInt("-23") -23 parseInt(23) 23 parseInt(023) 19 Radix 8 is used parseInt(0x23) 35 Radix 16 is used parseInt("23",4) 11 Radix 4 is used parseInt("23",4.99) 11 Radix is always converted to int32 parseInt("23",36) 75 Radix 36 is used parseInt("z",36) 35 Radix 36 is used parseInt("23",37) NaN Max Radix is 36 parseInt("23",1) NaN Min Radix is 2 parseInt("23",0) 23 Radix used is 10 parseInt("23",-1) NaN Min Radix is 2 parseInt("23",3) 2 Radix 3 can use only 0,1,2 parseInt("023") 19 Radix defaults to 8 parseInt("0x23") 35 Radix defaults to

Compress your HTML files

Updated: 2012-02-24 This is probably what every web developer knows. A very basic performance improvement for your HTML pages. You should remove all the white spaces and line breaks before you publish your html page. You can view the effect directly in a DOM inspector and this post touches the same. Consider this example available from the HTML5 spec (pg 21): <!DOCTYPE html> <html>   <head>     <title>Sample page</title>   </head>   <body>     <h1>Sample page</h1>     <p>This is a <a href="demo.html">simple</a> sample.</p>     <!-- this is a comment -->   </body> </html> Save it in a .html file and open in your favorite browser. Next view the DOM created by this file. You can use the DOM inspector available in most of the browsers today (launch with CTRL + SHIFT + I). You will see the below DOM tree created: DOM Tree with white spaces So a lot of extra te

Sync Chrome versions and Chrome Extensions that I love

I just decided to live a little more on the edge and downloaded the Google Chrome Canary build, v13.0.x which is the developer build. But be warned, it could cause crashes though I've not faced any so far. Flash does seem to misbehave a bit ummm. Page loads are now definitely fast. Or do they seem fast to me :) Meanwhile, between various versions of Chrome, one just needs to enable sync to automatically update bookmarks, extensions .. Its easily done as follows: Click on the Wench icon on the top right and select Options->Personal Stuff Click on Set up Sync ... Enter your Google user name and password when prompted. You will be asked to Choose what to sync Select the options you prefer. I checked them all. Click on Ok and thats that. Repeat this on your new browser version and you should have all the settings, apps, extensions, themes, bookmarks everything imported, rather synced. Now here is the list of Chrome Extensions that I like and regularly use (no Orkut or Facebook her

My Bookmarks fly to the Cloud

Updated: 15-Mar-2012 With latest version of Google Chrome (I'm using 17.x), you can now directly sign into Chrome from Options->Peronsal and access your bookmarks across computers. You no longer would need to export the bookmarks to Firefox using the Google Toolbar for Firefox, which is no longer supported by Google. The Google Toolbar is now available only for IE. Original (dated) article below ... ------- I have a queer problem of too many! I surf a lot, I subscribe to a lot and I bookmark a lot. Some numbers: 1 laptop and 1 netbook at home, 1 laptop and 1 desktop at office, sometimes its my Kindle and definitely my N900 when I'm on the move. So 6 devices out there and usually 2 browsers on most of them (yes Kindle only as one webkit based experimental implementation). So my bookmarks are all over the place, scattered over at least 10 different places. And each time I'm working on one box, I wish I had access to the bookmark I made a few hours ago on the other

A Custom Blog and 404 errors!

I struggled for over a day with 404 errors and domain mapping issues and finally figured out the simple steps to set up my Google blog mapped to my custom domain. I also managed to add an alias to this blog site. Just jotting down the steps here for future reference ... You would've created your blog under the name say: myblog.blogspot.com Now you want to move it to your custom domain which you just purchased say: www.mydomain.com Also you might want to map blog.mydomain.com and mydomain.com to land the user on your blog page directly. The latter is called a " naked " domain and has to be handled as this is not mapped by default. Steps to create custom blog at www.mydomain.com 1. Go to your blog Dashboard (link is on the top right of your screen) 2. Select the Settings  tab 3. Select the Publishing tab 4. Click on the Custom Domain  link and switch to Advanced Settings 5. Enter your domain name here   www.mydomain.com 6. Check the " Redirect myd

Falsy JavaScript

In continuation of my previous blog on the basic JavaScript expressions , this blog is about Falsy and Truthy values in JavaScript. When presented with a non boolean expression instead of a boolean value, JavaScript uses Truthy or Falsy values instead to determine the result. At first glance, this could be confusing and could lead to errors while scripting. var a = "someval"; var b; if (a) { // this is a truthy      // Block is executed } if (b) { // b is undefined and so a falsy      // Block is not executed } The Falsy Values All expressions, objects and values are Truthy by default. There are exceptions and they are called the Falsy values and are listed below:   # The empty string; ""   # null   # undefined   # The number 0   # NaN   # The boolean false It gets tricky If you see the below table, you will note that it gets tricky or rather one should be a little extra careful while dealing with Falsy values. Expression Value Falsy

JavaScript - Undefined Infinity or Not a Number?

Had a heated discussion with a friend about a particular expression and so this blog with ready references for some basic JavaScript expressions. Expression Value Infinity Anything beyond +/-1.7976931348623157e+308 typeof Infinity "number" typeof NaN "number" typeof undefined "undefined" typeof null "object" Infinity + Infinity Infinity Infinity - Infinity NaN -Infinity + Infinity NaN Infinity / Infinity NaN Infinity * Infinity Infinity Infinity * 1 Infinity Infinity / 1 Infinity Infinity / 0 Infinity Infinity * 0 NaN Infinity - 1e308 Infinity Infinity - 1e309 NaN -Infinity + 1e308 -Infinity -Infinity + 1e309 NaN Infinity / 1e308 Infinity 1 * "a" NaN 1 + NaN NaN 1 * NaN NaN undefined + 1 NaN undefined * 1 NaN undefined + Infinity NaN undefined * Infinity NaN undefined + NaN NaN undefined * NaN NaN undefined + null NaN undefined * null NaN 1 + null 1 1 * null 0 null + null 0 null * null 0 Infinity + null Infinity Infinity * null NaN NaN

India's first KDE conference

This article was published in Qt Blogs here . Thanks to Alexandra and Qt Community for the same! I recently attended conf.KDE.in at the RV College of Engineering in Bangalore. It was the first KDE conference ever held in India, and it was followed up with two days of code sprints attended by over 300+ people. I’m pretty late with this write up, but better now than never. KDE-India is a growing group of volunteers totally committed to contributing to and popularizing FOSS in India. The event was primarily focussed on introducing KDE and Qt to young developers still studying engineering butof course there were also a fair number of professionals like me. In short, above all else, it was tons of fun. I networked with people, shared knowledge, promoted the Qt DevNet India group and even had the chance to watch live break dancing on stage – not once but twice! That’s Knut Yrvin for you, a great speaker with some special gifts needed for a Community Manager. There were great sessions hel