IE not going along very well with bind function

This is actually rather a note to myself.

I am doing some client-side these days. JQuery,datatables,Backbone,Underscore etc..

I was using $.getJSON like below which works perfectly on firefox:

$.getJSON(“/api/sar/?_=” + Math.random() + “&” + query, function(data) {

//do some stuff here

}.bind(this));

However,it didn’t work on IE.Plus, no error message as you can imagine.I did lots of research and just before starting banging my head against walls,i found that there is an incompatibility between IE and jquery bind method. I don’t think it is valid for all cases but that’s why i found out thanks to this entry in stackoverflow.

As a quick solution,JQUERY spec recommends to use $.proxy function when binding this value of the function.So the code makes both browsers happy is:

 $.getJSON(“/api/sar/?_=” + Math.random() + “&” + query,  $.proxy(function(data) {

   // do some stuff here

     },this));

 

Advertisements

Book Review:Learning Android

Last week i’ve read the book  Learning Android by Marko Gargenta.

It is a really very “neat” one,probably most suitable one to start with Android development. It is like a big tutorial walking you through the whole process of development a twitter-like app starting from environment set-up till a complete application where you can read and post tweets. Neither a reference book nor providing an in-depth look to android stack components,however it is supplying theoretical basis and putting you in action for a very rapid development experience.
The book starts with an overview of Android stack and the summarizes main building blocks;activities,intents,services,broadcast receivers and content providers. Right after this relatively short introduction,it dives into development and you grasp insightful understanding of main blocks and UI artifacts on the fly as you develop.Application code is satisfactorily detailed -even line by line in some cases- so you do not miss anything and end up having no questions by the end of each chapter.Moreover,lots of hints and tips take place to make better use of Eclipse IDE and to avoid some chronical exceptions. I also should add that it is fairly easy to read since structured very well into chapters and each chapter boiled down to sections in a concise manner.Even it includes a considerable amount of code (listing) it is a joy to read it.

As to downsides, as i said,it is more like a tutorial enriched by conceptual side knowledge.But not sure if this is a true disadvantage if you would like to make a  fast start to Android application development.

All in all,i definitely recommend this book to beginners.It is really a great feeling to have an application up and running already  just after you finished the first book you read about Android,if you are a beginner.If you already develop Android Apps and need some more low level structured and more detailed one or a  reference book, this might not be the best choice.

JSR Watch

New year’s activity review  of  Java Community Process is published.

There are currently 70 JSRs active. According to the report, 27 of them were aimed at J2ME, 20 of   them target J2SE and 15 of them target JavaEE.

As to the new ones, 6 new JSRs  come to the field at 2009,only one of which was realized by Sun : JSR 322: Java EE Connector Architecture 1.6

If we take a lokk at spec leads; Sun stands ahead as usual with 27 JSRs. The others are:Nokia (11), Oracle (8), Motorola (5), and IBM (4)

Servlet 3.0-Innovative!

The Proposed Final Draft for Servlet 3.0 is published.
There are quite a few  new feautures and enhancements.
To sum up in general;

  • No more need to web.xml.Simply use annotations.  You just add @WebServlet  at the top of your Java class and that’s it!  For example:  @WebServlet(urlPatterns=“/foo”,  name=”MyServlet”, asyncSupported=true)
  • Dynamic servlet registration. Programmatically configure and map servlets
  • Configuration  frameworks by another xml ,web-fragment.xml, not touching web.xml.
  • resources of web app like jsp’s and static pages are located in bundled jar files as well. They do not need to be in webb app’s root.
  • Asynchronous servlet support
  • Annotation-based security
  • Cookie configuration by web.xml

Here is a very concise and informative presentation about servlet 3.0

Less Projects Succeed

According to  CHAOS Summary 2009 report published by  The Standish Group success rates in projects show a serious amount of decrease in 2009. %32 of projects were delivered on time, on budget with all the requirements matched.

%44 of them were delivered but not on time or over budget or with lack of  needed functionalities. Personally , in case of software projects, i don’t think a project should be   supposed as failed if it was delivered eventually :)Another statistic state that in 2009, %24 of the projects failed completeley,meaning never delivered or never used.

This is what i call failed!