Tuesday, January 17, 2012

Should I use GWT ( Google web toolkit) or JQuery?, My answer is JQuery

Google Web toolkit is powerful tool for creating rich web application using Java as development language and eclipse as IDE. When GWT was launched, it was great idea for Java folks to qucikly write code in Java which GWT tool will translate to corresponding Javascript code. It was making sense for Java folks, and making sense for the time when browser based debuging is pain and non existing. GWT provide cross browser ability and boilerplate code, so it is easy to bring rich AJAX based widgets.

There are tradeoffs,
* you code in Java
* you code in they way GWT ask you to code
* I like to use HTML5 data-* api and Wensockets - you need to depend on GWT team to release supporting API or you need to learn Java to implement those in GWT way-- it introduces one more impediment/dependancy to code upgrate path ( or fragements the development)
* You many not use HTML or HTML5 etc, you use Java. I would have been happy in year 2000 but  not in 2012 :)
* You gradually diluted out of web :)

I am not pro to GWT, I like to code in Javascript and wanted to utilize beauty of JS programing. I wanted to control what I write, however I don't want to code for various browsers. My biggest pain is not pure JS coding but browser specific code and DOM scripting. So JQuery fits nicely here.

JQuery shines at
* You code in Javascript and not in Java so I don't depend on Java
* Simplifies DOM scripting
* Fosters plugin based reuse and mostly you find it from somebody who already written it somewhere (there is plugin repository from JQuery website)
* Micro updating through Ajax is simple and closely write code to the specific APIs and normally you write it in a line of code
* Very popular and hence you find support of any kind of issues is milliseconds (that's what google search tells you)
* Everybody supports including Microsoft, I like their contribution to JQuery template
* There are available from many CDNs -- Google, Microsoft, AOL etc
* Taking dynamic coding to the next level, Do the template in the browser -- I do lot,
* I can use HTML5, CSS3 etc in a way that's close to specs

Wednesday, January 11, 2012

Playing with Hotmail oauth

Hotmail is very friendly unlike Facebook to access their info.  Use https://manage.dev.live.com/ and create your app and get client id and secret. It also allows you to specify callback/return to URL in the dashboard.

It is funny that URI component for mobile app is touch.

It is interesting to see it support localization but there should be a way to pass localization info dynamically otherwise it is of no use.

Very elaborate documentation about how to access live oauth 2.0 based service is here http://msdn.microsoft.com/en-us/library/hh243649.aspx.

Tuesday, January 10, 2012

Erlang Facebook API

I am exploring way to get into user's graph using Facebook API, my language of interest is Erlang. With quick search, unlike Yahoo API, I found couple of erlang module available to do the job. I will go over it and if I find anything cryptic, I will update it on next post.
My requirement

  1. User wanted to bring their user graph but not need to provide their userid/password (oauth)
  2. Once loggedin, they choose people who they are to be invited 
  3. Choose selected one.
This is kind of interesting flow, in fact, others following.  

  1. What is the API user agreement?
  2. No of calls limit
  3. Constrain to post message to Facebook using API
  4. Retrieve Events 
I will research these topic and post it here if anything interesting.

[Update] Facebook API doesn't allow contact email addresses of friends but found that there are greater API level integration with different graph API. But clue is "it is easy with oauth" but facebook notoriously stoping me to verify my account using phone no :)  So I am hibernating this effort.

Sunday, January 08, 2012

Yahoo oauth and Erlang

I successfully implemented or more aptly integrated yahoo oauth.
Points to note,

  • You must sign in and get 
    • Consumer key embeds what kind of service you are enlisted 
    • Secret 
    • App ID (you don't need it for YQL)
  • For accessing private data -- it is 3 legged process -- 
    • Get request token
    • Use that to bring yahoo sign in page to ask user to give authorization to access services 
    • Once user accepts, callback URL will be called and with query param 
    • Once callback is complete, access actual DATA API using YQL
  • YQL determines what service (like contact or connection etc) you are accessing but consumer key tells whether you have that service enabled. 
  • If you later add or modify service access, you will get new consumer key
  • diagnostics=true is handy to see what is wrong with your request
  • Most of the oauth parameters are sent as query string
  • Mostly more than 3 requests fired to yahoo to get a data
  • window.opener will not work to communicate back to parent window because it is shifting to 2 different domains
  • I used ugly timer to track popup window to closing status. I felt window.close event would have been handy.
I used nice little library for erlang (https://github.com/tim/erlang-oauth) 

Open source winning because of all of us

I saw hacker news today that Nginx become most (sorry second most) popular web server putting Microsoft IIS into its rear view mirror, and now it is behind Apache web server --- first 2 are Open source projects.

Middle or before end of this year Google Chrome is going to do that for Internet explorer, again it is based on chromium open source project.

Android did better and put iPhone into second place.

It is all great news and we never know how many people behind this effort, there are lot.

Again, younger generation are getting charges into big IT role into corporate environment and will see more churn soon in enterprise sector.

I am seeing Open source started winning the game.  Software are commoditized and it good thing that it is going to impact huge into people's life.

Linux made or commoditized server and which in turn revolutionized into Cloud,
Web started growing big because of lots of open source projects like Apache, Linux in the server side and
programing tools like PHP, Python, Perl and others made development  or building product or web apps easy. I never heard any startup using C# or .Net.

Android to iPhone and Windows --- Anybody can built anything using Android, there is no barrier to software availability, so hardware is getting cheap and all the corners of the world is benefitting.

When I heard OLPC's $100 PC, I could not imagine how it is possible, but now seeing under $50 tablets like India's Akash.  It is possible because these product vendor no need to develop OS which is free and saving that cost to shave hardware cost make sense. It is not only money but effort and fear of adoption, if it doesn't have appeal or market share like Android which pulls people to think and be confidant to go ahead with product.  I am not denying other factors - thanks to ARM processor  for its cheap  processor and mass manufacturing of LCD which driven cost down -- these are happening  because of mass effect.

Saturday, January 07, 2012

Apple and Apple TV

Everybody is gushing and guessing that it is going to be from 32-55 inch with SIRI based interface etc etc. But I am thinking "Will Steve Jobs think that that is going to be a good idea?" It sounds negative to me.
But Apple is going to release TV. Surely. What I am thinking that Steve would have thought "Take already existing product which really sucks now and if it put under "Steve Jobs Treatment" it is not going to suck, it is going to be fantastic product -- in terms of simplicity, aesthetics and sale" -- Is current LCD TV going to create such magical overhaul? I am not comfortable to say yes.

But what if Steve picks up "PICO" projector and combine that with Apple TV with toch LCD on top to touch control and iDevices act as remote, Camera for face time and little more sensible SIRI?

SIRI will sound cancel the sound coming out of TV??? in order to understand user voice (hunt for patents), it is Apple TV version 2 :)

Just opposite of proximity sensor in iPhone -- move your hand to the top senses your hand and turn on LCD, to do touch to control -- so it can independently operate. It can gel together with iDevices, it is already built into apple tv.

Totally I hate TV because it is not portable, it is not magical

Thursday, January 05, 2012

Steve Jobs Treatment

Today, I am introducing the term "Steve Jobs Treatment".

Usage: "Give a Steve Jobs Treatment"

What is it convey?

It is to "convey feedbacks and force to act on those feedbacks" of particular product or work in general -- to making it  
  • Simple, 
  • Aesthetically appealing,
  • Useful and 
  • Pleasing to use in and out

What is it going to be?

After those implicit feedbacks and acting on those action items, product or work should be

  • Simple, 
  • Aesthetically appealing,
  • Useful and 
  • Pleasing to use in and out and 
  • Feel faster in overall experience against raw performance numbers

Hm.. I also put this blog entry into "Steve Jobs Treatment".

[Please note that it is not about medical or health related treatment]


Wednesday, January 04, 2012

Websockets, Well done Apple!

Websocket is now standardized in RFC6455. With IE10 on board all Desktop browsers supports Websocket.
Desktop Browsers versions which supports websocket:
  1. Google Chrome
  2. Firefox 7+
  3. Opera 11+
  4. IE10
  5. Safari 
Mobile OS:
  1.  iOS (Safari -- personally tested) which includes iPhone, iPad and iPod touch. The very noticeable point is, Apple is supporting it from iOS 3 on wards. 
Android OS:
      None of the browsers including Firefox (I tested with FF beta)
         Google is very poor at implementing websocket in Android, considering fragmentation and it's track record of upgrading OS in the Android land, it is going to be another year or 2 to support websocket in Android.  It is blow to Android and Google suffers "Microsoft" syndrome. 

Apple is leading by example in implementing Html5 and Websocket protocol, Android lacks severely in this area.  For web developer, will it be a fight and pain supporting Android devices similar to how it was to IE6?

Well done Apple!.

Mochiweb 2.3.1 and cygwin on windows

I just want to setup plain webmachine and mochiweb latest (2.3.1) from their respective github (git) repository. Webmachine clearly not compatible with mochiweb 2.3.1, at least for simple not dependent (no Riak) instance,
These are the additional services should be started,
here is the code which webmachine likes,


ensure_started function is nothing but webmachine's, this is a kind of paradigm followed by all well written Erlang apps. 

After these changes, webmachine is started and flashed "Hello, new world" when I hit http://localhost:8000, may be I will push these changes to webmachine. 

Tuesday, January 03, 2012

Erlang DNS TXT, MX record look up

I was exploring how to query DNS and do some probing on various types of information like MX and TXT records.
Here is the simple API
 Step:1         inet_res:nslookup("domain.com", 1, txt).                                                                           
It is always advisable to use another function, to convert it from internal record type to list,
 Step:2        inet_dns:msg(Return_from_Step1)                                                                                                    

 Step:3        inet_dns:rr( Return_from_Step2)                                                                                                           

Step:2 always return list or tuple of error message. So return value from the Step:2 should be processed.

Here is the complete code which returns "TXT" rr record, you can substitute mx for "MX" records,
lookup(Domain, VerifyingText) ->
 case inet_res:nslookup(Domain, 1, txt) of 
  {ok, Record} ->
   DnsRr = case inet_dns:msg(Record, anlist) of 
           DnsRrList when is_list(DnsRrList) -> hd(DnsRrList);
     _ -> []
   io:format("IS of type ~p ~n", [is_list(DnsRr)]),
   inet_dns:rr(DnsRr, data);
  _-> false
Pass the domain name to the lookup, you will get the list of records.

 More here http://www.erlang.org/doc/man/inet_res.html

Sunday, January 01, 2012

Google API using cURL or wget or plain http

I was researching to use Google API for certain activities.
There are 2 kinds of access
  1. oauth 
  2. clientlogin (username and password) 
I am mostly interested in clientlogin.

Client Login:

Thing to Note:
  1.     Service Type: More here http://code.google.com/apis/gdata/faq.html#clientlogin for contacts, service type is "cp"
  2. There are 2 request to fetch the actua value
    1. First Request URL:  curl https://www.google.com/accounts/ClientLogin --data-urlencode Email=YOURID@gmail.com --data-urlencode Passwd=PASSWORD -d accountType=GOOGLE -d source=Google-cURL-Example -d service=cp
    2. Response for the above Request will be: SID=DQ...........A
    3. Make second Request by using Auth param from the above response: 
      1. curl --silent --header "Authorization: GoogleLogin auth=AUTH_TOKEN_FROM_ABOVE_RESPONSE" "https://www.google.com/m8/feeds/contacts/YOURID@gmail.com/full"
  3. Second response will be the address details, thats it.