Thursday 5 June 2008

[Fun] searching google in a shell like

A funny web site allowing to request Google from a shell : http://goosh.org/


Thursday 14 February 2008

Generating doc on javascript a la javadoc

Javascript is a very fine language but contrary to Java there isn't any native documentation engine.
Some open source projects offer you ways to generate doc from javadoc like comment in your code :
  • JsDoc : It is a good perl generator for javascript doc but it impose upon user tgto follow a given way to write javascript because it tries to interpret some javascript instruction to generate documentation :
                      /**
                       * Shape is an abstract base class. It is defined simply
                       * to have something to inherit from for geometric 
                       * subclasses
                       * @constructor
                       */
                       function Shape(color){
                         this.color = color;
                       }
    
                       // Bind the Shape_getColor method to the Shape class
                       Shape.prototype.getColor = Shape_getColor;
                        
                       /**
                        * Get the name of the color for this shape
                        * @returns A color string for this shape
                        */
                       function Shape_getColor(){
                         return this.color;
                       }
                        
                       /**
                        * Circle is a subclass of Shape
                        */
                       function Circle(radius){
                         this.radius = radius;
                       }
                        
                       /**
                        * A very rough value for pi
                        */
                       Circle.PI = 3.14;
                       
                       /**
                        * Get the radius of this circle 
                        * @returns The radius of this circle
                        */
                       function Circle_getRadius(){
                         return this.radius;
                       }
                      
                       // Circle is a subclass of Shape
                       Circle.prototype = new Shape(null);
    
  • JGrouse : It is much better when you want to use frameworks, because it allows documenting of Javascript classes, regardless which approach or framework is being used for it - be it Prototype, Dojo, Dean Edward's Base, jGrouse or any other. And it is fully integrated as ant Task :
    exemple using dojo
                      dojo.provide("net.demay.geometry.Shape");
                      /**
                       * Shape is an abstract base class. It is defined simply
                       * to have something to inherit from for geometric 
                       * subclassesl
                       * @class net.demay.geometry.Shape
                       * @author Vincent Demay
                       */
                      dojo.declare("net.demay.geometry.Shape", null, {
    
                       /**
                        * Color of the shape
                        * @variable {net.demay.color.Color} color
                       color : null,
                       
                       /**
                        * @constructor Shape
                        * @param {net.demay.color.Color} color
                        */
                       constructor: function(color){
                         this.color = color;
                       },
                        
                       /**
                        * Get the name of the color for this shape
                        * @function {net.demay.color.Color} return a color string for this shape
                        */
                       getColor: function(){
                         return this.color;
                       }
                     }
    
    
    
                      dojo.provide("net.demay.geometry.Circle");
                      /**
                       * A circle is a specific {@link net.demay.geometry.Shape
                       * @class net.demay.geometry.Circle
                       * @author Vincent Demay
                       * @extends net.demay.geometry.Shape
                       */
                      dojo.declare("net.demay.geometry.Circle", [net.demay.geometry.Shape], {            
    
                       /**
                        * Circle radius
                        * @variable {Float} radius
                        */
                       radius :  null,
    
                       //private no doc
                       PI : 3.14,
    
                       /**
                        * @constructor Circle
                        * @param {Float} radius
                        */
                       constructor: function(radius){
                         this.radius = radius;
                       },
                       
                       /**
                        * Get the radius of this circle 
                        * @function {Float} getRadius
                        */
                       getRadius : function(){
                         return this.radius;
                       }
                     }		

Wednesday 30 May 2007

VI and javascript

No, this post is not about writing javascript in vi.

Actually, this post is about a vi editor written with javascript. Amazing! but also useless ;). but it is good fun!


see it in action.

Monday 16 April 2007

A scriptless day for the summer

As a css naked day, This day aim is to demonstrate how javascript is became mandatory on user interface feeling during last years. During this day some websites will remove all javascript on their pages. The scriptless day is also a good idea to show that well developped website can also work without any script ;). Come on board and try to remove your javascript for the july 07.

Friday 13 April 2007

A very light an easy-to-use javascript librairy

Effects in webpages are more and more used, but often packaged in a big librairy such as Dojo, Scriptaculous, etc... Animator.js is a single little js allowing to make advanced effect very easly :
ex15 = new Animator().addSubject(new CSSStyleSubject(
    $('ex15Button'),
    "width: 10em; background-color: rgb(256, 256, 256); font-style: normal",
    "width: 40em; background-color: #F39; font-style: italic"));
// note how you can use any unit, not just 'px'.
This simple code will make a fade between first styles attributes and second one.

Congratulation to the author for this very good library!

Tuesday 6 February 2007

Playing sounds in javascripts

Ajax and Javascripts allow developpers to make more and more awasone things in a web browser.
The last I found "exciting" is playing sound with very goog javascript APIs?. Take a look at Sound Manager 2 (Using backgrounded flash player to play sound) - Project Home page - , it is crazy what we now can do with Javascript

You can see also: