Skip to Content


<b>Special thanks first.</b>


Yeah I know that is not usual.
I just
want to thank everyone
who ever helped me on SDN’s forum or encouraged me to start
my own blog (Thomas
Jung, Eddy De Clercq , Jürgen Mayer, Durairaj Athavan
Raja,…).


Let’s get started.


JavaScript is hot again, and if you want to be a cool kid, you have to use it,
do some and let everybody know You’re on it….
Lucky
you’all I’ve been checking out what you have to do
to be a fashionable BSP developer.


Introduction.


AJAX is the way that all the neat and cool web sites are made of.
Thus, I guess you all heard somewhere that AJAX, is some kind of mix between
JavaScript and XML. However for those who know some javaScript, you already
realized that doing such thing as handling XML can be pretty tricky.

Why should we stick with JavaScript then?


First because that’s the only thing you have to do some dynamic web pageswithout loading a plugin like flash.
Moreover JavaScript is supported by most of the browsers. For all that, you want it to be
easier to program (with more advanced functions), more consistent as a language and +browser
independent+
( try to use a window.showModalDialog with anything else than Internet Explorer).


Prototype.


Look for Prototype then.

It’s a very useful JavaScript library, it helps a lot, giving you a lot of new functionalities, shortcutsin other words making your life a lot easier
:

    •  $ instead of document.getElementById.
    •  $A to get the value of an element.
    •  Iterator functions.
    •  String and array functions.
    •  Full browser independent Ajax handler.
    •  And a lot more…


Here you can find
suggestive documentation of Protoype.

Besides prototype is not the only one existing; they are other good libraries like:

script.aculo.us and
Rinco are  more UI oriented.

Dojo makes it all.


JSMIN & Gzip.


Good JavaScript libraries can provide a great help, nevertheless they also can be +
pretty heavy+
(as much as 100k if you want it all). That’s
when JSMIN becomes handy, it takes your Javascript files and delete all
the unneeded stuff in a production environment (comments,
spaces,…). Using it can divideyour .js file by at most 4</b>.
In order to even save more space you can gzip your .js files and your .css files.
Nonetheless, it will only work with some browsers (I know that Internet Explorer 6 and Firefox can deal with it).


JSON.


I know JSON is the very first word of that paper and you
don’t even know what it is.So why should you use it?

Handling it, is just a lot lot easier.


With the JSON parser script (less than 1k
after JSMIN), You can parse a JSON text straight to a JavaScript object with the function JSON.parse.

Here a little sample :

//construction of you JSON text.
var json_txt  = '{';
json_txt  +=  '"myobject" : { "id" : "0000", "name" :  "john"}';
json_txt  += '}';

//getting your javascript object is as simple as that
var my_object = JSON.parse(json_txt );

You can also

transform a JavaScript object into a JSON text</b> with the
function JSON.stringify.

Ex:

var json_txt = JSON.stringify(my_object);


NEXT.


That’s all for now. In the next couple of days, I will post a
little tutorial, explaining how to build in 5 min your own BSP
application using those cool tools.

I hope you enjoyed the reading,

Great day to y’all.


To report this post you need to login first.

1 Comment

You must be Logged on to comment or reply to a post.

Leave a Reply