Like all the libraries of this type also jQuery allows you to extend its basic functionality using real plugins. Respecting the rules of its operation, that is, return it is always a pointer to the selected item or jQuery itself, you can write a plugin with a few lines of code. Take for example the proposed code in jQuery against everyone: a benchmark with 5 browser , which was (after the correction reported by Luca ):
1 2 3 4 5
| ) . css ( 'cursor' , 'pointer' ) . click ( $ ('H2.dropdown'). Css ('cursor', 'pointer'). Click ( function () { $ ( this ) . next ( ) . is ( ':hidden' ) ) $ ( this ) . next ( ) . slideDown ( ) ; else $ ( this ) . next ( ) . slideUp ( ) ; if ($ (this). next (). is (': hidden')) $ (this). next (). slideDown (); else $ (this). next (). slideUp (); } ); |
Continued ...
Delimits a portion of text to the number of "words":
1 2 3 4 5 6 7 8 9 10 11
| / ** * String word cut * * @ Private * / $c , $l ) { wordCut function ($ c, $ s) { explode ( ' ' , $c ) ; $ C = explode ('', $ c); $i = 0 ; $i < $l ; $i ++ ) $r [ $i ] = $c [ $i ] ; for ($ i = 0; $ i <$ l $ i + +) $ r [$ i] = $ c [$ i]; implode ( ' ' , $r ) . '...' ; $ R = implode ('', $ r).'...'; ; return $ r; } |
Continued ...
A good developer has no problem to switch from one programming language to another. The choice to focus on a particular language, framework or development environment, is dictated more by the availability of time and the type of work that takes place. However, an important factor that may influence the choice of "frameworks" such is the sympathy and affection that can mature over time.
Specifically, I wanted to analyze some - certainly not all - JavaScript frameworks available today, because even "advised" to take a look especially at jQuery .
The creators of mootools (one of the most popular JavaScript frameworks) have made available a tool to run a speed test and validity of five well-known JavaScript frameworks: Slickspeed . This test, the outcome is not discounted at all, it is important to operate as client-side Javascript frameworks, that are executed by your browser. It is precisely for this reason that some find Safari faster than Internet Explorer or Google Chrome faster than Firefox . However, this often depends on the type of page you are viewing. Indeed, it may well happen that a particular site is really more "fast" when viewed in Safari, but this does not mean that "all sites" will be faster with Safari! Obviously this is true for any other browser.
The benchmark
In the test I made with Slickspeed I compared the browsers available on my machine (Windows Vista 64bit Utilmate - Intel Core 2 Quad 2.4GHz with 8Gb RAM).
Unfortunately, the tests are not able to run with Internet Explorer 7, as the car crashed, even going out of scale with the results! Once again, congratulations Microsoft.
I crercato to maintain the same status of the PC during the test run, opening the browser and not individually by sending no other processes running.
Note: If you feel like you also run one or more of these tests, you can comment this post in case of "curious" and several results.

Google Chrome is really fast results, with a value of 68 (average) in the test with jQuery . The slower, however, was Flock , despite coming from the same "mother" Mozilla. This poor performance of Flock is really curious as its cutting social networks, because it is precisely the Social Network Web 2.0 to take advantage of many JavaScript frameworks available, so as to provide an experience of truly innovative navigation and interaction.
Surprisingly beats FireFox and Opera also has a nice little ', achieving even a 74 in the performance of Dojo ! FireFox and Safari, on balance, are similar, with Safari faster in tests with Mootools and jQuery.
Which framework to choose?
If you do not mind you testing the speed of execution and do not worry about the normal size in Kbytes of the same framework, the answer might be "what you like" or, if you like, "what you know better or is more harmonious with your style of programming. "
Ultimately, these frameworks will look a bit 'all (see for example the use of $), despite some important and substantial differences that can jump in the eyes of an expert or really pushed the use of a particular library. In principle, in fact, everything that can be done with jQuery, for example, you can do very well with mootools or prototype! If jQuery has a very compact syntax, as all methods always return the jQuery object basis, thus creating endless rows of oggetto.metodo().metodo().metodo()... is said that this is all costs a strength, especially for those who will have to debug!
Libraries like prototype.js sin, perhaps in the absence of effects, even simple, forcing the developer to implement as a spinoff scriptaculous.js , heavy and far from the library first choice.
An example
This last reason, for example, led me to replace the coupled prototype / scriptaculous with jQuery to create interactive panels / Animated undolog.com here in the sidebar. In fact, even using Google API to import libraries, it is wasteful to load all the library and scriptaculous for a slideDown slideUp. For information and an example, here is the Javascript code as it was coupled with the prototype / scriptaculous:
1 2 3 4 5 6 7 8 9 10 11 12 13
| / / Prototype / scriptaculous ) . each ( $ $ ('H2.dropdown'). Each ( element ) { function (element) { = "pointer" ; element. style. cursor = "pointer"; 'click' , element. observe ('click', event ) { function (event) { this . next ( ) . style . display == "" ) new Effect. BlindUp ( this . next ( ) , { duration : .5 } ) ; if (this. next (). style. display == "") new Effect. BlindUp (this. next (), {duration: .5}); Effect. BlindDown ( this . next ( ) , { duration : .3 } ) ; Effect else new. BlindDown (this. next (), {duration: .3}); event ) ; Event. Stop (event); } ) } ); |
and it is now with jQuery:
1 2 3 4 5 6 7 8 9 10
| / / JQuery ) . each ( $ ('H2.dropdown'). Each ( i ) { function (s) { ) . css ( 'cursor' , 'pointer' ) . click ( $ (This). Css ('cursor', 'pointer'). Click ( function () { $ ( this ) . next ( ) . is ( ':hidden' ) ) $ ( this ) . next ( ) . slideDown ( ) ; else $ ( this ) . next ( ) . slideUp ( ) ; if ($ (this). next (). is (': hidden')) $ (this). next (). slideDown (); else $ (this). next (). slideUp (); } ); } ); |
All in all, a closer look, I do not think there is a lot of difference! But as I said before ... the question is "also" of personal taste.
Continued ...
di Actionscript 3.0, con lo scopo di semplificare la manipolazione di Array lineari usati come matrice n x m . MatrixArray is an extension of the class Array of Actionscript 3.0, with the aim to simplify the manipulation of Array used as a linear n x m matrix. This class is part of the library Undolibrary (in the package undolibrary.utils.MatrixArray ) that you can freely download function via any Google code SVN client (Subversion) to:
svn checkout http://undolibrary.googlecode.com/svn/trunk/
Alternatively you can download the single file MatrixArray.as . An example of the use of linear matrix was given in Actionscript 3.0 for beginners: lesson # 2 where we saw one of his simple use in the production of the classic Tic Tac Toe game. ), proprio come una scacchiera. An array of this type is comparable to a rectangular area ( w x h ), just like a chessboard. With this class you can treat an array of this type just like a grid with its x and y coordinates. The MatrixArray I've used, for example, in the development of all the logic editor Emotions Icons for Skype: Skypemote .
Continued ...
Some curiosities of Actionscript 3.0 is not always known ...
trace ()
The instruction trace() , used for debugging, now supports multiple parameters:
1
| a , b , c ) ; trace (a, b, c); |
Continued ...
As promised here is the second lesson in ActionScript 3.0! Today we start the analysis of a simple project that reproduces the play or the Tic Tac Toe Tic Tac Toe. I tried to include some special features in this example, ActionScript 3.0, trying to give space to the understanding and not on style. It follows that if I had to write the "game" really, I probably would have structured very differently, but in this case I tried to mediate between a classical program with a compact, hermetic more understandable for newbies.
Continued ...
In these days (on the advice ...) I was browsing on jQuery , a great library in the style of prototype.js , scriptaculous.js , MooTools , so to speak ... and now here is the whole site has been completely redesigned:
Great start to broaden my horizons on this kind of libraries! Shortly publish some interesting article, especially about the differences between jQuery and other libraries "similar".
Continued ...
The code necessary and sufficient to send a simple email in HTML format using the command mail() in PHP is:
1 2 3 4 5 6 7
| / / Prepare the header to indicate HTML "MIME-Version: 1.0 \n " . $ Headers = "MIME-Version: 1.0 \ n". "Content-type: text / html; charset = utf-8 \ n". "From: Undolog.com <info@undolog.com> \ n". "Bcc: Copy <g.fazioli@undolog.com> \ n"; "Destinatario <info@e-lementi.com>" , "Oggetto della mail" , "<p>Corpo della mail in <strong>HTML</strong></p>" , $headers ) ; mail ("Recipient <info@e-lementi.com>", "Subject of mail", "Body of email <p> <strong> HTML </ strong> </ p>", $ headers); |
Continued ...
In Actionscript 3.0 for beginners: lesson # 1 we have seen the necessary steps for creating a project in Flash CS3. So I got the idea to automate, to some extent, this process due to the features of Adobe AIR .
Continued ...
Premise
Actionscript 3.0 can be a good starting point to become familiar, those unfamiliar with C programming and / or C + +, orioentata programming (OOP). In addition, this series of lessons will be useful to those coming from other rooms or from earlier versions of Flash.
Set a project
In this first lesson we will see how to set up a project Flash CS3 generic. It is good to use when the projects are expected to have to deal with at least more than one file. The use of the project was introduced - by Macromedia - already in versions prior to CS3, so it should be a subject known to developers Actionscript 2.0.
However with Actionscript 3.0 - as we shall see - it is possible to create a Actionscript (. Pbuh) to the document-root movie ours. Fla so to speak. This feature is very useful and also makes a project minimum of at least two files: the. Fla. As associated. For this reason, you will "always" from a project, so right now organizing the various files (. Fla,. As, ...) that will be part of our "package" of development.
Also, once you learn the dimesticazza with the philosophy to objects, instrinseca in this type of language, end up with many files will be normal, even for simple projects substantially.
Continued ...
Latest Comments
Mark : @ Mark: Thanks for the answer. For example, if you have a code to save / use the folder ...
Mark : Thanks for the answer. For example, if you have a code to save / use the folder ...
Giovambattista Fazioli : @ Mark: in principle, absolutely, a lot depends on how and what to download. La. ..
Mark : Hello, good guide! I wanted to ask, you can use the same code to run a sql database? Instead of ...
Joseph : Hi I wanted to ask you how you can do in the post I uploaded a gallery of 50 images, for example, ...