/* Internet Addiction */

Learn it, Live it, Love it.

Archive for the ‘Javascript’ Category

Google closure compiler

without comments

Google recently release Closure Compiler service (labs version)

use for optimising a few simple functions in the service’s web UI for JavaScript.

You can try to execute JavaScript for optimisation, check for warning and error, compressed into small files, see what is the post data looks like and more. It is worth to check it out.

Written by Charles Ling

14 November, 2009 at 11:34 PM

Posted in Javascript

Tagged with ,

JQuery get $.getJSON data

with one comment

Imagine you have server side data return to your Javascript client side.

   1:  var groupid = null;
   2:  
   3:  $.getJSON(url, data,
   4:      function(result){
   5:  
   6:       groupid = result.groupid;
   7:       //do whatehever you like here
   8:  
   9:      // you wanted to return the data that you have been parsed or assign
  10:      }
  11:  );
  12:  
  13:  alert(groupid ); //error : will return null

So instead of that, we need to use delegate or callback function that JQuery have provided to us. Remember the $.fn. thing.

Now let see how we can use the delegate function to return us the data:

   1:  $.getJSON(path + "?request=url.here",
   2:  function (data)
   3:  {
   4:     var selectOption = '';
   5:  
   6:     //do what ever you like with the json data
   7:     selectOption =  selectOption + "testing" + data; //example only
   8:     $.fn.delegateJSONResult(selectOption );
   9:  });
  10:  
  11:  $.fn.delegateJSONResult = function(data) {
  12:    alert(data);
  13:  }

Written by Charles Ling

27 June, 2009 at 6:42 PM

Posted in Javascript, jQuery

Tagged with ,

My Favourite Web Development tools.

with 6 comments

Every few months, i will be googling or check out new web development tools for my work and personal projects. Unbelievably,  new cool and fantastic tools kept poping up, something you even have problem which best tool to used. The tools i meant here, are tools like IDE, plug-in, library, framework, cms, test-suite and more. Below, are the list of tools that currently i am using and found it very useful and increasing my productivity. All the tools are OPEN  SOURCE which i am a very big fan of.

Firefox Add-ons

——————-

1.  Again, Firebug win my heart. This tool let you inspect and edit CSS on the fly. Not only css, debugging javascript with it, save tons of your time to look for javascript errors.

Firebug screen shot

Firebug screen shot

2. iOpus iMacros – from a Firefox add-ons : to record form filling and replay the task you had been recorded. Save your time kept repeating testing for web forms, useful for web testing, web scraping and more.

IMacro

IMacro

3. Web development- from a Firefox add-ons : Great tools with lots of functionality for web developers. Such as markup validation,  cookies management, http header management and more.

Web Development toolbar (Firefox add-ons)

Web Development toolbar (Firefox add-ons

4. XDebug for Javascript

5. Yahoo YSLOW – Javascript profiler : A great tools to check how to faster up your website. Their also provide best practice and guideline how to improve website loading performances.

Framework

————–

1. Zend framework : started using recently and fall in love with it. Strong MVC architecture support and database adapter.

2. jQuery : Javascript framework that i will use in every project that in the future. LOVE IT!!

CSS

—-

1. 960 Grid System from MIT. Very easy to use and faster up your layout  design for a new website without worrying if the new row or column will expand accordingly.

Forum

——–

1. Although this part is a bit not relevant, but i insist to introduce the best question and answer programming/IT forum : www.stackoverflow.com

2. Slashdot : Ah!!..sometimes you need a break from your IDE or notepad.

Time Tracker

—————-

1. I use RTM : Remember the Milk task list which integrate well with Gmail Task List.

2. Google Calendar : Use it for weekly planner and task remimder which sent free sms reminder to your mobile phone.

Written by Charles Ling

2 April, 2009 at 8:29 PM

jQuery

without comments

Have been using jQuery since my new projects. As a results, i am very satisfy with the Javascript framework and external UI Plug-in.

I used the guidelines provided by reindel blog to choose the best javascript framework to meet best for my new projects. My first round-up choice are between Mootools, Prototypes/script.aculo.us and jQuery. I use Slickspeed website to run and check how fast the website run, and jQuery gave me the best results. Since jQuery run much more faster than others, except Mootools (on the version that i had tested).

The reason why i choose jQuery over other javascript frameworks ——————————————————————–

1. The learning curve for jQuery are much more short and there are tons of tutorials for jQuery.

2. One of my requirements, is to optimise the performance when running on client side.

3. Slow staging server (no budget), cause slow execution of scripts at client side if i am using other javascript framework.

4. Both Microsoft and Nokia have decided to add jQuery in their .Net and Symbian OS. (Future mobile implementation).

5. jQuery official website provide more demo type tutorials compare to others, which are very handful when it comes to using new functions.

Quite like the syntax and idea of Prototypes/script.aculo.us features and might be consider it with my own personal project.

These reasons were only my personal opinions, which i do not mean that other javascript framework are bad. It really depends on how it is going to fit with your best need such as environment, learning curve, your own coding style and more.

Written by Charles Ling

30 March, 2009 at 11:47 AM