Sunday, July 24, 2011

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 wonderful service that I attract users in thousands and maybe sell my startup. Dreams!! Day dreams!! You usually wake up soon :P 

I searched for a few hours, I finally found that there is already  patent number 7840690 taken out for this idea. Way back in 2008, by the Go Daddy Inc group. Exactly the same stuff :(

Damn! Double Damn!

Well if the US is taken, there are other countries. Why, India doesn't even recognize the concept of a software patent, the concept was squashed way back in 2005! Or maybe the whole concept of patent is not in the spirit of open source. Open Source is good isn't it?

So finally, is someone out there who is already building this service? Can they please publish it at the earliest? Anyways, me -- I'm now waiting for the next great idea.

Sunday, July 17, 2011

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 recommended way of development for S40, the most popular set of Nokia devices. But is the spectrum changing?

Extending point 2 listed by Sai Geetha above, I would also like to draw the reader's attention to the Qt framework developed by Nokia (which acquired Trolltech). Qt is a very easy to use cross platform development framework on C++. You basically write your apps once and can compile it to multiple platforms. Already well supported on desktops (Windows, Linux, Mac), mobiles (Symbian, MeeGo) and embedded Linux platforms.

Now the Qt community has also come up with Necessitas, the Android port of Qt. One just needs to Google on this topic and you'll see quite a bit already out there, and many great demos too. So imagine, you develop your apps with Qt and can target both Android and Symbian/MeeGo devices at the same time. Thats a huge number!

But Qt is not being supported on Nokia's new primary platform, the Windows phone. Would the community take this up too? Who can stop the community?

Extending her point 4 above, Nokia has has introduced Qt Quick (QML), a scripting layer on top of the Qt framework. Quick brings in very fluid and eye catching UX to Qt apps. Most of the logic would be written using JavaScript. Very rarely would developers have to tweak the underlying C++ components. At least that is the goal. So how well QML does on top of Android is something to look forward too.

In addition to the 4 ways listed above, there is a 5th way, which I think will supercede all the other ways eventually (at least for most of the use cases), and that is developing apps using HTML5, CSS and JS. So you write code once and thats it, it will work everywhere and no recompilation required too. HTML5 widgets are catching on very fast, and its no longer just restricted for web development! So with HTML5, its no plugins, no additional layers, but just pure JavaScript. One would revert to native code rarely, where absolutely no support is available with HTML5. This "not supported" list is shrinking by the day. Today people are writing very fast web servers like Node.js using JS, and one can only wait for how the whole thing will play out. I for one, am betting big time on this 5th horse.

It was Steve Jobs who set the ball rolling with his no Flash support in his famous open letter. Soon everyone was on board. Now with the recently announced Windows 8 platform, Microsoft too has jumped on the HTML5 bandwagon. HTML5 would be their primary development platform (with of course "backward compatibility" with Silverlight, .Net etc etc frameworks) :D I just love Adobe, they are totally into authoring tools and not married to anything, including flash. I'm seeing a lot of HTML5 authoring capabilities in their upcoming tools.

HTML5 still has a long way to go, many quirks to be sorted out. But to conclude, you would need to write code once with HTML5 technologies and you can target all desktop and all mobile platforms out there. Great! Just great!

So what do you think? Do you know of more ways doing Android development? Most importantly, have you started looking at HTML5 technologies?

Friday, July 15, 2011

Pageviews: FF vs Chrome vs IE 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.

Friday, July 1, 2011

Solutions: Object Oriented JavaScript: 3. Functions

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");

  //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')

    >> parseFloat('1e1')
    10    //parseFloat evaluates exponential in string
    >> isFinitie(0/10)

    >> isFinite(20/0)

    >> isNaN(parseInt(NaN));

3. What does the following code alert()?
  >> var a = 1;
  function f() {
    var a = 2;
    function n() {

    // It alerts 2. alert(a) has first access to the local variable a in f() which is defined as 2.

4. All these examples alert "Boo!". Can you explain why?

4.1  var f = alert; 

f is assigned the function alert and eval executes the script in string by passing 'Boo!' as parameter.

4.2  var e;
     var f = alert;
f is assigned the function alert and eval further assigns alert to e and executes the script in string by passing 'Boo!' as parameter.

4.3  (
       function() {
         return alert;
     )() ('Boo!');

function() is a self invoking anonymous function that returns the method alert which is executed immediately by passing 'Boo!' as parameter.

Next: 4. Objects coming soon ...

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
"number"  //this is the largest negative number supported by JS
>>10 % "0"
NaN  //Reminder or modulo of a number when divided by 0 is undefined
>> undefined == null
true  //both are falsy and compared for only equality of value

>> false === ""
false  //compared for equality and type

>> typeof "2E+2"
string  //enclosed within quotes

>> a = 3e+3; a++;
3000  //post increment

2. What is the value of v after the following?     

    var v = v || 10;
  Experiment by first setting  to 100, 0, null, or unset it (delete v)

>> var v = v||10;
10  //v is ORed with 10

>> var v = 100; var v = v||10;
100  //v is already defined as 100. Lazy initialization kicks in

>> var v = 0; var v = v||10;
10  //10 is ORed with 0

>> var v = null; var v = v||10;
10  //null is ORed with 10

>> delete v; var v = v||10;
10  //v is redefined with then ORed with 10

3. Write a script that prints out multiplication table. 
>> //The code snip below prints out tables from 1 to 10
var i, j;
var result = "\n";
for(i=1; i<=10; i++) 
  for(j=1; j<=10; j++) {
    result += i + " X " + j + " = " + (i * j) + "\n";
  result += "\n"; 
1 X 1 = 1
1 X 2 = 2
1 X 10 = 10

2 X 1 = 2
2 X 2 = 4
10 X 9 = 90
10 X 10 = 100

Next: Chapter 3: Functions