Articles Tagged 'Internet'
Microsoft now we really expect everything, especially when it comes to browsers. Offend the intelligence community, however, is a little 'ugly to accept.
On the Blog IE7 was released today, an article ( IE + JScript Performance Recommendations Part 3: JavaScript Code Inefficiencies ), if we can call Peter Gurevich, Performance PM for IE, with part III of his "advice" for developers.
First note: because Microsoft insists on implementing its own version of JavaScript - which they called JScript - complicating the lives of everyone?
Second fact: just because the JScript engine is owned by Microsoft, instead of wasting time to tell "us" how to work around the defects, why not settle them once and for all?
Leaving aside the first suggestion of this Part III, which can be read directly on the blog or on Ajaxian , the second is very striking, and sincerely do not diregisco own.
Do not use Property Accessor Functions
When you say progress! Right in 2007, a Project Manager, Microsoft is telling us developers not use getter and setter functions in JScript!
Madness, of course, is a strange evil that affects so sudden and misleading. JScript - JavaScript style - is implemented following an object model! It is an object-oriented language, in the wake of the C + +. The fact that the variables are accessible from the outside (as outlined in the article - obvious by the way) is absolutely not a boast, indeed. The encapsulation technique is its philosophy of OO programming. Encapsulate the properties, rising from virtually get and set method is a force of object-oriented language, not a limit. Recommend not to use them is nothing short of criminal, and any performance issues shall be borne by the interpreter and its authors, not the end-developer.
So in the end, JScript is used as a simple C, woe to treat it as C + +, otherwise "crashed" the browser or whatever.
Also, as noted on the blog, everything is a false problem because JScript does not implement the actual functions get and set, only JavaScript does!
But the problem, of course, remains. In JavaScript (JScript sorry but I just can not digest it), there are various techniques to create an object. For example, you can create on the fly like this:
1 2 3 4 5
| { myObject = {var , miaProprieta: 0,
( ) { alert ( "Hello" ) ; } mioMethodo: function () {alert ("Hello");} }; |
In this way I have not declared a class. The object is declared and created, so to speak simultaneously. It is a quick way when the object we need is unique.
Or, which is equivalent for all practical purposes:
1 2 3 4 5 6 7 8
| CMyObject function () { = 0 ; this. miaProprieta = 0;
= function ( ) { alert ( "Hello" ) } this. myMethod = function () {alert ("Hello")}
} / / new CmyObject ( ) ; var iMyObject CMyObject = new (); |
) e poi si crea esplicitamente l'oggetto con new . In this case we first define the class - using a function - ( CmyObject ) and then explicitly create the object with new .
Aside from stylistic issues relating to the individual developer, the problem of how to access the properties of a class remains. I highly recommend to all concerned, comumque, read the answers to Microsoft's blog, really interesting.
On the Blogs were three access modes: with get and set functions, direct and moving from the prototype. Eventually the nice thing was that on the blog there is a code to perform a Testdrive, a test of the three methods mentioned above. The code is present on the blog but I reproduce it here for completeness:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72
| <Script> / / Definition Slow Car SlowCar function () { = 17 ; this. m_tireSize = 17; = 250 ; // One can always dream! this. m_maxSpeed = 250, / / One can always dream! = SlowCar_get_tireSize ; this. GetTireSize = SlowCar_get_tireSize; = SlowCar_put_tireSize ; this. SetTireSize = SlowCar_put_tireSize; } SlowCar_get_tireSize function () { ; return this. m_tireSize; } value ) SlowCar_put_tireSize function (value) { = value ; this. m_tireSize = value; } </ Script>
<Script> / / Faster Car, no more property accessors FasterCar function () { = 17 ; this. m_tireSize = 17; = 250 ; // One can always dream! this. m_maxSpeed = 250, / / One can always dream! } </ Script>
<Script> / / Prototype car, use the language features! PrototypeCar function () { = 17 ; this. m_tireSize = 17; = 250 ; // One can always dream! this. m_maxSpeed = 250, / / One can always dream! }
= function ( ) { return this . m_tireSize ; } ; PrototypeCar. Prototype. GetTireSize = function () {return this. M_tireSize;}; = function ( value ) { this . m_tireSize = value ; } ; PrototypeCar. Prototype. SetTireSize = function (value) {this. M_tireSize = value;}; </ Script>
<Script> Testdrive function () { new SlowCar ( ) ; // Safe and reliable, probably not fast var = new slowCar SlowCar () / / Safe and reliable, fast Probably not new FasterCar ( ) ; // Lacks air-bags, probably faster var = new fasterCar FasterCar () / / Lacks air-bags, Probably faster new PrototypeCar ( ) ; // Can technology win the day? var = new PrototypeCar Protoc () / / Can technology win the day?
( new Date ( ) ) . getTime ( ) ; var start = (new Date ()). getTime (); var i = 0 ; i < 100000 ; i ++ ) { slowCar. SetTireSize ( slowCar. GetTireSize ( ) + 1 ) ; } for (var i = 0; i <100000; i + +) {slowCar. SetTireSize (slowCar. GetTireSize () + 1);} ( new Date ( ) ) . getTime ( ) ; var end = (new Date ()). getTime (); "Slow Car " + ( end - start ) + "<br>" ; output. innerHTML + = "Slow Car" + (end - start) + "<br>";
new Date ( ) ) . getTime ( ) ; start = (new Date ()). getTime (); var i = 0 ; i < 100000 ; i ++ ) { fasterCar. m_tireSize += 1 ; } for (var i = 0; i <100000; i + +) {fasterCar. m_tireSize + = 1;} new Date ( ) ) . getTime ( ) ; end = (new Date ()). getTime (); "Faster Car " + ( end - start ) + "<br>" ; output. innerHTML + = "Faster Car" + (end - start) + "<br>";
new Date ( ) ) . getTime ( ) ; start = (new Date ()). getTime (); var i = 0 ; i < 100000 ; i ++ ) { protoCar. SetTireSize ( protoCar. GetTireSize ( ) + 1 ) ; } for (var i = 0; i <100000; i + +) {Protoc. SetTireSize (protoCar. GetTireSize () + 1);} new Date ( ) ) . getTime ( ) ; end = (new Date ()). getTime (); "Prototype Car " + ( end - start ) + "<br>" ; output. innerHTML + = "Prototype Car" + (end - start) + "<br>"; } </ Script>
"TestDrive();" > Test Drive Cars !</ button > <Button onclick = "Testdrive ();"> Test Drive Cars </ button> "output" ></ div > <Div id = "output"> </ div> |
Now, this is the output (on my machine) with IE7:
Slow Car 515
63 Faster Car
547 Prototype Car
With Firefox (v.2.0.0.1):
Slow Car 156
47 Faster Car
172 Prototype Car
With Opera (v.9.10):
Slow Car 172
47 Faster Car
172 Prototype Car
In short
IE7 comes out really bad ... I do not know if you notice the huge difference. So I would say that JScript could be abolished, eliminated, erased, vaporized. We hope that Microsoft decides to take her too Javscript and surrogates.
Continued ...
It is time to take a decision. The year 2007 is well underway and it is useless to indulge further. Microsoft Vista is coming, and 2008 will be his year. Windows XP is about to give way to the last born at Gates, last - among others - of its kind.
So it is obvious - if someone does not realize it was still - some urgency in updating the major tool of the century (if not the millennium), or the browser.
Recently released as an automatic update - but optional for reasons of monopoly and antitrust - Microsoft Intrenet Explorer 7 for owners of Windows becomes an obvious choice. The update is strongly recommended especially for reasons of accessibility on the Web and sucurezza The discovery of flaws in the code is not new, but recent versions are known to be less vulnerable to attack because hackers have not had time to find the holes from which imply hacks and worms.
Here are 5 good reasons then, I think, to go immediately to the Internet Explorer 7 (IE7):
- It is the next generation of browsers, so better to just get familiar with its new features
- Improved stability and security
- Better care about updates and add-in support
- Improved navigability on the Web, where the technology used in IE7 is close to that already present in most other popular browsers like FireFox, Opera, etc. ... so - finally - be able to properly view some Web sites, now navigable only with FireFox
Why be left behind? 
Continued ...
Taking up the post Validate email in Javascript and PHP , here is a nice JavaScript class able to verify and check e-mail addresses. Its use is very simple, although it is a client-side control, and easy to bypass, you can just disable Javascript (propose petition against this possibility
now all browsers allow JavaScript to evade, and then all the controls associated with - in the short run is not anything on the Internet, see Ajax
).
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103
| / * ** @ Name: ckmail.js ** @ Description: Check email syntax ** @ Author: undo = = ** @ Author-Web: http://www.undolog.com ** @ Author-email: @ g.fazioli undolog.com - g (dot) Fazioli (at) undolog (dot) com ** @ Date: 21/09/2006 21:24 ** @ Ver: 1.0 * /
{ oCKMail = {var , __release: "1.0", , __filter: / ^ ([\ w-]+(?: \. [\ w-]+)*)@((?:[ \ w-] + \.) * \ w [\ w-] {0, 66}) \. ([az] {2.6} (?: \. [az] {2 })?)$/ i, , __username: "", , __domain: "", , __ext: "",
/ / TO DO ( e ) { GetUserName: function (e) { this .__init ( e ) ) return ( this .__username ) ; if (this. __init (e)) return (this. __username); false ) ; return (false); },
/ / TO DO ( e ) { getDomain: function (e) { this .__init ( e ) ) return ( this .__domain ) ; if (this. __init (e)) return (this. __domain); false ) ; return (false); },
/ / TO DO ( e ) { GetExtension: function (e) { this .__init ( e ) ) return ( this .__ext ) ; if (this. __init (e)) return (this. __ext); false ) ; return (false); },
/ / TO DO ( e ) { __init: function (e) { ! this .__filter. test ( e ) ) return ( false ) ; if (! this. __filter. test (e)) return (false); e. split ( "@" ) ; e. var t = split ("@"); t [ 0 ] ; this. __username t = [0]; t [ 1 ] ; this. __domain = t [1]; .__domain. split ( "." ) ; t = this. __domain. split ("."); t [ 1 ] ; this. __ext = t [1]; true ) ; return (true); },
/ / TO DO / / Synopsis / / Check (and extlist, domainlist); / / Runs a series of standard controls of an e-mail. / / Extlist - You can pass an optional second parameter that corresponds to an array of extensions that / / Are permitted or excluded (include / exclude extension) according to the first value in the array, all / / Other error will be considered. / / Eg. [True, "en", "com"] pass (includes list) / / Eg. [False, "en", "com"] NOT pass (exclude list) / / If -1 is not taken into account / / Domainlist - You can pass an optional third parameter that corresponds to an array of domains that / / Are permitted or excluded (include / exclude domain) according to the first value in the array, all the / / Other error will be considered. / / Eg. [True, "alice.it", "mac.com"] pass (includes list) / / Eg. [False, "alice.it", "mac.com"] NOT pass (exclude list) / / If -1 is not taken into account / / ( e ) { check: function (e) { this .__init ( e ) ) { if (this. __init (e)) { / / Check array domainExt check arguments. length > 1 ) { if (arguments. length> 1) { typeof ( arguments [ 1 ] ) == "object" ) { if (typeof (arguments [1]) == "object") { arguments [ 1 ] [ 0 ] ) { // include list if (arguments [1] [0]) {/ / include list var i = 0 ; i < arguments [ 1 ] . length ; i ++ ) { for (var i = 0; i <arguments [1]. length; i + +) { this .__ext == arguments [ 1 ] [ i ] . toLowerCase ( ) ) return ( true ) ; if (this. __ext == arguments [1] [i]. toLowerCase ()) return (true); } { // exclude list Else {} / / exclude list var i = 0 ; i < arguments [ 1 ] . length ; i ++ ) { for (var i = 0; i <arguments [1]. length; i + +) { this .__ext == arguments [ 1 ] [ i ] . toLowerCase ( ) ) return ( false ) ; if (this. __ext == arguments [1] [i]. toLowerCase ()) return (false); } true ) ; return (true); } false ) ; return (false); } } / / Check array domainName check arguments. length > 2 ) { if (arguments. length> 2) { typeof ( arguments [ 2 ] ) == "object" ) { if (typeof (arguments [2]) == "object") { arguments [ 2 ] [ 0 ] ) { // include list if (arguments [2] [0]) {/ / include list var i = 1 ; i < arguments [ 2 ] . length ; i ++ ) { for (var i = 1, i <arguments [2]. length; i + +) { this .__domain == arguments [ 2 ] [ i ] . toLowerCase ( ) ) return ( true ) ; if (this. __domain == arguments [2] [i]. toLowerCase ()) return (true); } { // exclude list Else {} / / exclude list
var i = 1 ; i < arguments [ 2 ] . length ; i ++ ) { for (var i = 1, i <arguments [2]. length; i + +) { this .__domain == arguments [ 2 ] [ i ] . toLowerCase ( ) ) return ( false ) ; if (this. __domain == arguments [2] [i]. toLowerCase ()) return (false); } true ) ; return (true); } false ) ; return (false); } } true ) ; // email correct return (true) / / correct email } false ) ; // error return (false) / / error } }; |
The object oCKMail provides several methods to carry out a parallel series of checks on the address, such as the extension, domain, etc. ...
To be really sure if you have PHP, you can add an additional and effective control before executing the command mail() . Here is the PHP class useful for this purpose:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107
| / * ** @ Name: cckmail.php ** @ Description: Check email syntax ** @ Author: undo = = ** @ Author-Web: http://www.undolog.com ** @ Author-email: @ g.fazioli undolog.com - g (dot) Fazioli (at) undolog (dot) com ** @ Date: 21/09/2006 23:58 ** @ Ver: 1.0 ** ** EXAMPLES ** ** / / Check for an address EXCLUDING the e-mail domain "e-lementi.com" and "mac.com" ** ** $ OCKMail CCKMail = new (); ** $ OCKMail-> check ($ email, NULL, array (false, "e-lementi.com", "mac.com")); ** ** / / Check the address INCLUDING e-mail domain "e-lementi.com" and "mac.com" ** ** $ OCKMail CCKMail = new (); ** $ OCKMail-> check ($ email, NULL, array (true, "e-lementi.com", "mac.com")); ** ** / / Check for an address EXCLUDING those e-mails with a "net", "en", "org" ** ** $ OCKMail CCKMail = new (); ** $ OCKMail-> check ($ email, array (false, "net", "en", "org")); ** ** HISTORY / CHANGE LOG ** * / ! function_exists ( 'checkdnsrr' ) ) { if ( function_exists ('checkdnsrr')) { ( $host , $type = '' ) { function checkdnsrr ($ host, $ type ='') { ! empty ( $host ) ) { if ( empty ($ host)) { $type == '' ) $type = "MX" ; if ($ type =='') $ type = "MX"; ( "nslookup -type= $type $host " , $output ) ; @ exec ("nslookup-type = $ type $ host", $ output); list ( $k , $line ) = each ( $output ) ) { while ( list ($ k, $ line) = Each ($ output)) { eregi ( "^ $host " , $line ) ) { if ( eregi ("^ $ host", $ line)) { ; return true; } } ; return false; } } } / / {class CCKMail = "1.1" ; var $ __release = "1.1"; = false ; var $ status = false; ; var $ username; ; var $ domain; ; var $ ext; / / CCKMail function () {} / / $e ) { function _test ($ s) { status = false ; $ This -> status = false; '/^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/' ; $ P ='/^.+ \ @ (\ [?) [A-zA-Z0-9 \ - \.] + \. ([A-zA-Z] {2,4} | [0-9] {1.3}) (\ ]?)$/'; preg_match ( $p , $e ) ) ) { if (( preg_match ($ p, $ e))) { explode ( "@" , $e ) ; $ T = explode ("@", $ s); username = strtolower ( $t [ 0 ] ) ; $ This -> username = strtolower ($ t [0]); domain = strtolower ( $t [ 1 ] ) ; $ This -> domain = strtolower ($ t [1]); explode ( "." , $this -> domain ) ; $ T = explode ('.', $ this -> domain); ext = strtolower ( $t [ 1 ] ) ; $ This -> ext = strtolower ($ t [1]); / / checkdnsrr ( $this -> domain . '.' , 'MX' ) ) $this -> status = true ; if ( checkdnsrr ($ this -> Domain.. '', 'MX')) $ this -> status = true; checkdnsrr ( $this -> domain . '.' , 'A' ) ) $this -> status = true ; if ( checkdnsrr ($ this -> Domain.. '', 'A')) $ this -> status = true; checkdnsrr ( $this -> domain . '.' , 'CNAME' ) ) $this -> status = true ; if ( checkdnsrr ($ this -> Domain.. '', 'CNAME')) $ this -> status = true; } } / / $m , $e = NULL , $d = NULL ) { function check ($ m, $ e = NULL, $ d = NULL) { _test ( $m ) ; $ This -> _test ($ m); $this -> status ) { if ($ this -> status) { / / Check array domainExt check ! is_null ( $e ) ) { if ( is_null ($ e)) { $e [ 0 ] ) { // include list if ($ e [0]) {/ / include list $i = 1 ; $i < sizeof ( $e ) ; $i ++ ) { for ($ i = 1; $ i < sizeof ($ s); $ i + +) { $this -> ext == strtolower ( $e [ $i ] ) ) return ( true ) ; if ($ this -> ext == strtolower ($ e [$ i])) return (true); } { // exclude list Else {} / / exclude list $i = 1 ; $i < sizeof ( $e ) ; $i ++ ) { for ($ i = 1; $ i < sizeof ($ s); $ i + +) { $this -> ext == strtolower ( $e [ $i ] ) ) return ( false ) ; if ($ this -> ext == strtolower ($ e [$ i])) return (false); } true ) ; return (true); } false ) ; return (false); } / / Check array domainName check ! is_null ( $d ) ) { if ( is_null ($ d)) { $d [ 0 ] ) { // include list if ($ d [0]) {/ / include list $i = 1 ; $i < sizeof ( $d ) ; $i ++ ) { for ($ i = 1; $ i < sizeof ($ d); $ i + +) { $this -> domain == strtolower ( $d [ $i ] ) ) return ( true ) ; if ($ this -> domain == strtolower ($ d [$ i])) return (true); } { // exclude list Else {} / / exclude list $i = 1 ; $i < sizeof ( $d ) ; $i ++ ) { for ($ i = 1; $ i < sizeof ($ d); $ i + +) { $this -> domain == strtolower ( $d [ $i ] ) ) return ( false ) ; if ($ this -> domain == strtolower ($ d [$ i])) return (false); } true ) ; return (true); } false ) ; return (false); } true ) ; return (true); } false ) ; return (false); } } ?> |
What ineteressante is the ability of this class to connect to MX servers (see checkdnsrr() ) to verify the presence of the domain. Thus in addition to perform a syntax check the e-mail runs a real ping domain before. We can safely say that this method is 80% ...
Continued ...
Although not done a site entirely in Flash, some components may still occur within the page, such as banners, claims, RSS viewers, etc. Eco ... then a simple way to check if Flash is installed and active. We propose here a method that does not need more pages, same as proposed by Adobe. We will make sure to solve all within a single page.
The class presented here allows to solve the last problem also born with Explorer, or the activation of an ActiveX control. To fix it just use JavaScript to insert the Flash, just what makes our class.
The first thing we need is a nice JavaScript class that will allow us to perform all the necessary controls:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
| <! - / * ** Detect Flash Class & Object Path insertFlash ** * /
{ df = {var , __release: "1.0", navigator. appVersion . indexOf ( "MSIE" ) != - 1 ) ? true : false ) , _isIE: ((navigator. appVersion. indexOf ("MSIE")! = - 1)? true: false) navigator. appVersion . toLowerCase ( ) . indexOf ( "win" ) != - 1 ) ? true : false ) , _isWin: ((navigator. appVersion. toLowerCase (). indexOf ("win")! = - 1)? true: false) navigator. userAgent . indexOf ( "Opera" ) != - 1 ) ? true : false ) , _isOpera: ((userAgent navigator.. indexOf ("Opera")! = - 1)? true: false)
( i ) { getSwfVer: function (s) { / / Versions of NS / Opera from 3 onwards check for the presence of the Flash plug-in array of plug-in navigator. plugins != null && navigator. plugins . length > 0 ) { if (plugins navigator.! = null & & navigator. plugins. length> 0) { navigator. plugins [ "Shockwave Flash 2.0" ] || navigator. plugins [ "Shockwave Flash" ] ) { if (navigator. Plugins ["Shockwave Flash 2.0"] | | navigator. Plugins ["Shockwave Flash"]) { navigator. plugins [ "Shockwave Flash 2.0" ] ? " 2.0" : "" ; var = swVer2 navigator. Plugins ["Shockwave Flash 2.0"]? "2.0": ""; navigator. plugins [ "Shockwave Flash" + swVer2 ] . description ; var = flashDescription navigator. Plugins ["Shockwave Flash" + swVer2]. description; flashDescription. split ( " " ) ; var = descArray flashDescription. split (""); descArray [ 2 ] . split ( "." ) ; var = tempArrayMajor descArray. [2] split ("."); tempArrayMajor [ 0 ] ; VersionMajor tempArrayMajor var = [0]; tempArrayMajor [ 1 ] ; VersionMinor tempArrayMajor var = [1]; descArray [ 3 ] != "" ) var tempArrayMinor = descArray [ 3 ] . split ( "r" ) ; if (descArray [3]! = "") var = tempArrayMinor descArray [3]. split ("r"); tempArrayMinor = descArray [ 4 ] . split ( "r" ) ; var = descArray tempArrayMinor else. [4] split ("r"); / / tempArrayMinor [ 1 ] > 0 ? tempArrayMinor [ 1 ] : 0 ; versionRevision tempArrayMinor var = [1]> 0? tempArrayMinor [1]: 0; versionMajor + "." + versionMinor + "." + versionRevision ; var = flashVer VersionMajor + "." VersionMinor + + "." versionRevision +; var flashVer = - 1 ; FlashVer} else var = - 1; } navigator. userAgent . toLowerCase ( ) . indexOf ( "webtv/2.6" ) != - 1 ) flashVer = 4 ; else if (userAgent navigator.. toLowerCase (). indexOf ("webtv/2.6")! = - 1) flashVer = 4; navigator. userAgent . toLowerCase ( ) . indexOf ( "webtv/2.5" ) != - 1 ) flashVer = 3 ; else if (userAgent navigator.. toLowerCase (). indexOf ("webtv/2.5")! = - 1) = 3 flashVer; navigator. userAgent . toLowerCase ( ) . indexOf ( "webtv" ) != - 1 ) flashVer = 2 ; else if (userAgent navigator.. toLowerCase (). indexOf ("webtv")! = - 1) = 2 flashVer; 1 ; else flashVer = - 1; / / flashVer return; },
( reqMajorVer , reqMinorVer , reqRevision ) { detectFlashVer: function (reqMajorVer, reqMinorVer, reqRevision) { parseFloat ( reqMajorVer + "." + reqRevision ) ; reqVer var = parseFloat (reqMajorVer + "." reqRevision +); var i = 25 ; i > 0 ; i -- ) { for (var i = 25; i> 0, i -) { this ._isIE && this ._isWin && ! this ._isOpera ) var versionStr = VBgetSwfVer ( i ) ; if (this. _isIE & & this. _isWin & &! this. _isOpera) = var versionStr VBgetSwfVer (s); versionStr = this . getSwfVer ( i ) ; versionStr else var = this. getSwfVer (s); versionStr == - 1 ) return false ; if (versionStr == - 1) return false; versionStr != 0 ) { else if (versionStr! = 0) { this ._isIE && this ._isWin && ! this ._isOpera ) { if (this. _isIE & & this. _isWin & &! this. _isOpera) { versionStr. split ( " " ) ; var = tempArray versionStr. split (""); tempArray [ 1 ] ; tempString tempArray var = [1]; tempString . split ( "," ) ; var = versionArray tempString. split (""); var versionArray = versionStr. split ( "." ) ; Var =} else versionArray versionStr. Split ("."); / / versionArray [ 0 ] ; VersionMajor versionArray var = [0]; versionArray [ 1 ] ; VersionMinor versionArray var = [1]; versionArray [ 2 ] ; versionRevision versionArray var = [2];
versionMajor + "." + versionRevision ; // 7.0r24 == 7.24 var = versionString VersionMajor + "." versionRevision + / / == 7.24 7.0r24 parseFloat ( versionString ) ; versionNum var = parseFloat (versionString); / / Is the major version> = requested major version is the minor version> = requested minor version versionMajor > reqMajorVer ) && ( versionNum >= reqVer ) ) return true ; if ((VersionMajor> reqMajorVer) & & (versionNum> = reqVer)) return true; versionNum >= reqVer && versionMinor >= reqMinorVer ) ? true : false ) ; else return ((versionNum> = & & reqVer VersionMinor> = reqMinorVer)? true: false); } } reqVer ? false : 0.0 ) ; return (reqVer? false: 0.0); },
/ / TO DO ( n , w , h ) { insertFlash: function (n, w, h) { this . detectFlashVer ( 8 , 0 , 0 ) ) { if (this. detectFlashVer (8, 0, 0)) { ; n + = ". swf"; '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,29,0" width="' + w + '" height="' + h + '"> \n ' ) ; document. write ('<object classid = "clsid: D27CDB6E-AE6D-11cf-96B8-444553540000" codebase = "# version = 7 http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab , 0,29,0 "width =" '+ w +' "height =" '+ h +' "> \ n '); '<param name="movie" value="' + n + '" /> \n ' ) ; document. write ('+ n + <param name="movie" value="''" /> \ n'); '<param name="quality" value="auto" /> \n ' ) ; document. write ('<param name="quality" value="auto" /> \ n'); '<embed src="' + n + '" width="' + w + '" height="' + h + '" quality="auto" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash"></embed> \n ' ) ; document. write ('<embed src = "' + n + '" width = "' + w + '" height = "' + h + '" quality = "auto" pluginspage = "http://www.macromedia. com / go / getflashplayer "type =" application / x-shockwave-flash "> </ embed> \ n '); '</object> \n ' ) ; document. write ('</ object> \ n'); document. write ( '<a id="flash_alternate" target="_blank" href="http://www.adobe.com/go/getflashplayer"></a>' ) ; Else} document. Write ('<a target="_blank" id="flash_alternate" href="http://www.adobe.com/go/getflashplayer"> </ a>'); } };
//--> |
As usual, Internet Explorer (7) is different and takes a specially structured code in VBScript:
[Vb]
[/ Vb]
Save these two files (and df.js df.vbs js folder) and in our includiamoli page (index.html, index.php or default.html, etc. ...) inside the head tag.
1 2
| "javascript1.2" type = "text/javascript" src = "js/df.js" >< / script > < script language = "JavaScript1.2" type = "text / javascript" src = "js / df.js"> </ script > "VBScript" type = "text/vbscript" src = "js/df.vbs" >< / script > < script language = "VBScript" type = "text / vbscript" src = "js / df.vbs"> </ script > |
Now we have everything you need and we can move on the page that contains the Flash object. Find the point where Flash will be displayed and enter the following code:
Here we have assumed that there is a file folder splash.swf Flash! Note that it is necessary to insert the swf. The two numbers are 900 and 122 sizes.
Even better would support the case - remote - where JavaScript is disabled. In this circumstance you can choose to proceed in two ways:
1. Insee code directly into the OBJECT / EMBED
2. Notify that JavaScript is disabled
In the first case we lose control on the presence of Flash and Explorer will prompt you to activate the ActiveX control. However, the movie will be visible if Flash is installed.
In the second case we can show a picture and / or with Javascript turned off notoficare it is not possible to verify the presence of the Adobe Flash plug-in. For example, choosing the solution number 1:
1 2 3 4 5 6 7 8 9 10
| "claim" > < div id = "claim"> < noscript > "movie" value = "flash/splash.swf" / > < param name = "movie" value = "flash / splash.swf" /> "quality" value = "high" / > < param name = "quality" value = "high" /> </ object > </ noscript > </ div > |
Flash Detect and manage the many alternatives, as explained on the Flash detect: how to detect Flash , is not quite comfortable, at least we hope that it will not deteriorate with time.
Continued ...
Write HTML code dynamically in a page is possible and useful. predisposto ad accettare codice inserito tramite innerHTML . The most direct way is to use and known documenti.write() or a container DIV prepared to accept code inserted via innerHTML . Alternatively you can attach to an existing tag and use the DOM to add or remove elements within the page. For example you want to load a new image has Javascript files without using server-side scripting and then reload the page. The functions below, for example, adds a JavaScript file on your page as a parameter (including path).
1 2 3 4 5 6
| s ) { addScripting function (s) { document. createElement ( 'script' ) ; scriptNode var = document. createElement ('script'); "head" ) [ 0 ] . appendChild ( scriptNode ) ; document. getElementsByTagName ("head") [0]. appendChild (scriptNode); 'javascript' ; scriptNode. language = 'javascript'; s ; scriptNode. src = s; } |
Similarly you can add a style sheet to our page, indicated by the variable cssfile :
1 2 3 4 5
| document. createElement ( 'link' ) ; cssNode var = document. createElement ('link'); 'rel' , 'stylesheet' ) ; cssNode. setAttribute ('rel', 'stylesheet'); 'type' , 'text/css' ) ; cssNode. setAttribute ('type', 'text / css'); 'href' , cssfile ) ; cssNode. setAttribute ('href', cssfile); 'head' ) [ 0 ] . appendChild ( cssNode ) ; document. getElementsByTagName ('head') [0]. appendChild (cssNode); |
Continued ...
How does one determine if a browser has the correct version of the Adobe Flash Plugin? To do this there is - notoriously - 5 techniques:
- Relying on self-running feature of the object and embed tags
- Use a script (JavaScript and / or VBScript) specifically provided by Adobe
- Use a contrivance with a single Flash movie
- Do not do anything

- Let the user choose
Continued ...
Like many Web developers know, before the advent of the XMLHttpRequest object, the problem of the reloading of a Web page was solved with the technique of hidden FRAME or IFRAME. This simple trick has allowed many people to solve some problems otherwise unsolvable interface. An advantage of using the hidden frame, among other things, was the ability to maintain the browser's HISTORY! Which does not allow the XMLHttpRequest object.
In addition to techniques which use HTML FRAME or IFRAME hidden, it is possible to use Flash as a sub-channel of communication between the page and the Server. Some experience in this direction are still in development (see for example Fjax ). The idea is to "hide" a Flash movie within the HTML page (as happened with FRAME) and communicate with it via JavaScript (or VBScript for Microsoft environment only).
However, this technique a number of hidden pitfalls. First of all forces the end user to install the Flash plugin, and then a solution is not HTML (pure) clean. It also requires, however, prompted the use of Javascript and Flash as an interface between the page, so much it's worth using the XMLHttpRequest object. Then when you start to write a framework in ActionScript want to do everything in Flash. Here is that the variation to the XMLHttpRequest object begins to have little sense.
Ultimately if you do not want to use the XMLHttpRequest object, we must rely on the now-established technique of hidden frame. There are even those who use just a mixed technique: XMLHttpRequest + IFRAME!
However, now, Ajax (in the form of the XMLHttpRequest object) has proved so successful that in the future will be the XMLHttpRequest object that is supported by improved browser vendors (Microsoft, Mozilla, Opera, etc ...). In practice, XMLHttpRequest will be a default component (as is already in FireFox) within the browser, accessible via Javascript! So why not use it?
Continued ...
On Ajaxan.com appeared an interesting article on the London really nice experience. Protopage is a small operating system dedicated to sharing. The engine environment is well written and the interface is extremely easy to use. This is certainly a fine example of how the Web is evolving. However there are still pitfalls of compatibility, see, eg, Explorer 7, but the road seems full of surprises.
Continued ...
On the Blog IE7 is released an article ( IE6 and IE7 Running on a Single Machine ) that could improve the sleepless nights of many Web developers! Microsoft has realized (thankfully) that the advent of the Internet Explorer 7 because, in fact, the abandonment of the previous version 6. In fact it is not possible to live both browsers on the same machine. For end users this is not a problem, but for Web developers who want to maintain compatibility with version 6 is a real disaster. The solution proposed on various other blogs, is to use a virtual machine like VMWare or Virtual PC setssa of Microsoft.
The indication is that the real machine to install the latest release of the main browser, version 7. Then acquire a player or a virtualization software so as to run in this environment virtually separated the old version 6 of explorer.
NOTE:
Microsoft also provides a file with an already virtualized, downloadable at:
http://go.microsoft.com/fwlink/?LinkId=70868
This translates into a file .vhd file can not be used with VMWare. Besides, who owns a Windows XP Home - how to see - can not use Virtual PC 2004 from Microsoft that requires at least Windows XP Professional (on site you can find this really bad!).
However, if to be an April Fool, April 1, 2007 this virtual machine will no longer be used! The Blog is however stressed that the development team hopes to release further updates in the future of these pre-packaged virtual machines.
Morality, however, this solution is approximate and does not meet all really! Should be allowed to use VMWare and then released a virtual machine compatible with this software, clearly competing to Virtual PC 2004 - Microsoft recently released free
- Or beam a way to convert the file. Vhd files from Microsoft in a VMWare acceptable. If you have any suggestions ...
Continued ...
In the era of mass distribution of information (video, audio, text, etc ...) there are those who attack without thinking, without realizing what is really happening. The Italian association Vivi Down , rightly resentful - like all civilized people - the "broadcast" the movie shot in a Turin school where some students bully and humiliate a fellow down, Google Video termination for failing a necessary and due control function.
Today it is impossible to check all video content freely forwarded in the network, due to its characteristics of "real time" and "whole". It is rather strange, and the attack of the Association of Italian PM against Goggle, a degradation that last piece of the Internet has nothing to do.
The boys of Turin school did what they did not the fault of Google. Indeed! Thanks to Google, at least, know who they are, how they work and we were able to recognize them and punish them. The boys, the teacher is absent and the other pupils, only shame and must be pursued with all the resources made available by the company, by the school and justice. Google in all this has nothing to do really anything. The video, shot with a phone (denuciamio so even the phone company?! ...) Could be spread in many other ways.
We do not have to spend time and energy towards a guilty "invented." The truth is that the real fault lies in education that society, through the school and the family, no longer able to give our children. The real obscenity is the video Turin professor who runs his eyes and goes, that's the crux of the problem! If the "controller" evades his duty is obvious that we will all lose cascade. If the professor had done his duty, would not have known anything.
How many acts of bullying are perpetuated to the detriment of the weaker all the time?
It is certainly not a novelty! They are the organs of local control to do the job more important and fundamental. This is true in general, where the supervisory teachers and principals are in school, parents in the family, the police in the city! And so on ...
They have to get our attention and our ear when things are not progressing in the right way. We should therefore try to figure out what went wrong in the control mechanism of the Turin school instead of attacking Google Video.
Continued ...
Latest Comments
Simon : It annoys disturbed again and use that space for these things ... however it does not work ...
Giovambattista Fazioli : @ Simon: what could be due to the syntax I used, specifically for PHP 5 +,...
Simon : I tried last night putting everything into functions.php, okay, jquery forms, and tabs jQueryUI them ...
Giovambattista Fazioli : @ Simon: I recommend cleaning to enter a code like that in ...
Simon : @ Giovambattista Fazioli: Thank you for your patience, it's all clear ... now I feel now, ...