Skypemote version of Adobe AIR: 1000 download

Monday 24 November, 2008

Skypemote version of Adobe AIR

Related Post

Very short trick: 3 output function in PHP

Tuesday, 18 November, 2008

Within a PHP function you can print in three different ways:

PHP:
  1. <? php
  2. $valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') (
  3. >
  4. <ul>
  5. ; ?> --> <! - <li> <? Php echo $ value;?> ->
  6. <li> <? = $ value> </ li>
  7. </ ul>
  8. <? php
  9. )
  10. >

Or:

PHP:
  1. $valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') (
  2. . $valore . '</li></ul>' ; $ o = '<ul> <li>'. $ value. '</ li> </ ul>';
  3. ; echo $ o;
  4. )

Or:

PHP:
  1. $valore = 'Ciao' ) { miaFunction function ($ value = 'Hello') (
  2. ; $ o = "<ul> <li> $ value </ li> </ ul>";
  3. ; echo $ o;
  4. )

Related Post

Actionscript 3.0 for beginners: lesson # 4

Tuesday, 11 November, 2008

Resume our sample code of TicTacToe (which is entirely on Google Code) and we start to analyze it in detail.

Import definitions

With Actionscript 3.0 has been done a great job of cleaning and arrangement of classes nell'alberatura (contained in the package package) used during development. In other programming languages, like C for example, when you want to use a feature must explicitly "import" in the code. This operation "import" is necessary to allow the compiler to have all the codes and definitions related features that we want to use. In Actionscript 3.0, however, Education import should not be confused with the standard C / C + #include # #include Actionscript 3.0 provides education include that is identical to #include the C / C + +. The latter include "actual code that, if used or not, is compiled into the final. Education import is the highest level and is more "intelligent" being compiled. It serves primarily to access classes without having to specify the full name. In Alré words instead of using forms like this:

Actionscript:
  1. . MovieClip = new flash. display . MovieClip ( ) ; var myMC: flash. display. MovieClip = new flash. display. MovieClip ();

Continue reading ... "

Related Post

Wordpress: remove the menu

Saturday, November 1, 2008

It may be useful, sometimes, "obscure" some of the menu of Wordpress, especially if you developed a website / blog for a client and do not want to allow access to sensitive features. There Plugin already performing this function, but to have a personal and complete control, we see in detail how this feature.
As always exploit the useful Action made available by Wordpress, in this case admin_menu Through the global variable $menu can access the list of the menu. We can find the menu to "remove" in two ways: through the label or via the link that it points (see commented shares in the example below). The proposal is "obscured" menu items Design, Settings and Plugins:

PHP:
  1. remove_menu_item function () (
  2. ; global $ menu;
  3. / / By label
  4. ( 'Design' , 'Impostazioni' , 'Plugins' ) ; $ removes = array ( 'Design', 'Settings',' Plugins');
  5. / / Through links
  6. / / $ Removes = array ( 'themes.php', 'options-general.php', 'plugins.php');
  7. $removes as $todel ) foreach ($ removes as $ todel)
  8. $menu as $key => $sm ) if ( $sm [ 0 ] == $todel ) { unset ( $menu [ $key ] ) ; break ; } foreach ($ menu as $ key => $ sm) if ($ sm [0] == $ todel) (unset ($ menu [$ key]); break;)
  9. / / Through links
  10. / / Foreach ($ menu as $ key => $ sm) if ($ sm [2] == $ todel) (unset ($ menu [$ key]); break;)
  11. )
  12. / /
  13. , 'remove_menu_item' ) ; add_action ( 'admin_menu', 'remove_menu_item');

Using the links as key to the removal $sm[2] in parts commented code surprise here), is useful when there is certainty of language - location - with which you installed Wordpress. With this technique, however, the menu is removed only at the interface, so you can still access the page via a direct link.

Related Post

Wordpress: write a personal logout

Monday, October 27, 2008

Starting from post Wordpress: step by step how to create a login, performed the login procedure could be useful to indicate in our blog a link to the disconnection, or logout. We will not use again the standard procedures of Wordpress, but we'll see how to log out low level. First of all we must understand whether a user is logged on or not. This is possible simply querying the variable $user_ID of Wordpress. For example:

PHP:
  1. $user_ID != '' ) { // oppure if( is_user_logged_in() ) { if ($ user_ID! ='') (/ / or if (is_user_logged_in ()) (
  2. / / User is "logged" ...
  3. )

Once we know that a user is logged in the system, we can insert a simple link to our page logout. Then we create a page, for example logout.php and inserting the following code:

PHP:
  1. / **
  2. * Performs logout
  3. *
  4. * @ Author Giovambattista Fazioli
  5. * @ @ Email g.fazioli undolog.com
  6. * @ Web http://www.undolog.com
  7. * /
  8. / / Invoke WordPress bootstrap
  9. 'wp-config.php' ) ; @ Require_once ( 'wp-config.php');
  10. 'wp-includes/pluggable.php' ) ; @ Require_once ( 'wp-includes/pluggable.php');
  11. / / Wp logout
  12. wp_logout ();
  13. / / Load any other page
  14. "Location: /" ) ; header ( "Location: /");

And just then "link" to our page to provide a logout procedures:

PHP:
  1. $user_ID != '' ) { if ($ user_ID! ='') (
  2. ; echo 'Run the <a href="logout.php"> logout </ a>';
  3. )

Related Post

FireFox: management profiles

Thursday, October 23, 2008

Mozilla Firefox lets you manage multiple profiles, features useful to those who, like me, develops Web sites and requires a series of extensions dedicated to debug and analysis of Web pages. Through the use of profiles you can configure different settings FireFox:

Firefox save your personal information such as bookmarks, passwords and preferences in a file called profile in a different location than the program files for Firefox.

On Windows Vista (see here for other operating systems) allows access to management profiles from Esegui command using:

CODE:
  1. firefox-ProfileManager

Managing profiles

One of the advantages in the use of profiles is to have a FireFox to navigate, without any toolbar and extensions for debugging and FireFox to develop, together with Firebug and all other development tools.

Related Post

Very short trick: undefined values in Javascript

Wednesday, 22 October, 2008

There is an abbreviated form for assigning "in flight" a value to a variable if another is not defined (undefined), using the logical OR operator (| |) - Double-pipe:

JavaScript:
  1. / / Pluto is undefined
  2. var pluto;
  3. ; var foo = pluto | |'5 ';
  4. pippo ) ; alert (foo);
  5. / / Result: 5

This technique is useful for writing functions with parameters:

JavaScript:
  1. param ) { miaFunc function (param) (
  2. ; var p1 = param | | 'benchmark';
  3. / / ...
  4. )

But we must be careful to use this form as zero values such as 0 false are misinterpreted, because of "guilt" of the OR logic used:

JavaScript:
  1. ; pluto var = 0;
  2. ; var foo = pluto | |'5 ';
  3. pippo ) ; alert (foo);
  4. / / Result: 5
  5. ; pluto var = false;
  6. ; var foo = pluto | |'5 ';
  7. pippo ) ; alert (foo);
  8. / / Result: 5
  9. ; pluto var = 1;
  10. ; var foo = pluto | |'5 ';
  11. pippo ) ; alert (foo);
  12. / / Result: 1

Related Post

Variety of coding and coding

Tuesday, October 14, 2008

Someone argues that programming is an art and, ultimately, I can only agree especially when solutions are found very different for the same problem. To understand how true this is like an identical need in medisimo language (Javascript) can be resolved with approaches quite different and original.

Left zero Pad

A number, but the speech is also valid for any string, such as 123 can be filled on the left - to draw - with a number of zeros, for example: 00123 This need is presented on several occasions and is useful for aligned - or show - a number cleanly, implicitly indicating its maximum value. In the video, for example, the classic score (the score) is often indicated by 001234 indicating that at most it comes to 999999 Here's how the problem was solved by various developers:

JavaScript:
  1. / **
  2. * Left Pad String
  3. *
  4. * @ From http://snipplr.com/view/8423/left-pad-string/
  5. * @ Author web-http://www.mechanicmatt.com/
  6. *
  7. * @ Param num - to fill Striga
  8. * @ Param totalChars - Total number of characters, including the "zeros"
  9. * @ Param padWidth - Character used to fill, default "0"
  10. * /
  11. num, totalChars, padWith ) { leadingZeros function (num, totalChars, padWith) (
  12. num num + = "";
  13. ? padWith = (padWith)? padWith: "0";
  14. num. length <totalChars ) { if (length internal reference number <totalChars) (
  15. num. length <totalChars ) { while (length internal reference number <totalChars) (
  16. padWith + num = num;
  17. )
  18. { } Else ())
  19. num. length > totalChars ) { //if padWith was a multiple character string and num was overpadded if (length internal reference number> totalChars) (/ / if padWith was a multiple character string and num was overpadded
  20. num. length - totalChars ) , totalChars ) ; = num num. substring ((internal reference number length - totalChars), totalChars);
  21. { } Else ())
  22. return num;
  23. )
  24. leadingZeros ( "asdf" , 10 , "0" ) ) ; alert (leadingZeros ( "asdf", 10, "0"));

This solution is extremely articulate, but can add an indefinite number of 0 number num also choosing the font used by padWidth instead of the default 0
Definitely original, however, this solution:

JavaScript:
  1. / **
  2. * String_pad
  3. *
  4. * @ From http://snipplr.com/view/700/stringpad/
  5. * @ Author http://d.hatena.ne.jp/brazil/20060721/1153489937
  6. *
  7. * @ Param str - to fill Striga
  8. * @ Param len - Total number of characters, including the "zeros"
  9. * @ Param ch - Character used to fill
  10. * /
  11. str, len, ch ) { return new Array ( len- ( '' +str ) . length + 1 ) . join ( ch ) + str } function pad (str, len, ch) (return new Array (len-(''+ str). length + 1). join (ch) + str)
  12. pad ( 56 , 4 , '0' ) ) ; // 0056 alert (pad (56, 4,'0 ')); / / 0056

Same result, with a completely different approach. Again we have the opportunity to decide the number of characters padding through the parameter len and the font used by ch Fails to use the default provided in the previous function.
What I use instead ...:

JavaScript:
  1. / **
  2. * String_pad
  3. *
  4. * @ Author Giovambattista Fazioli
  5. * @ Web http://www.undolog.com
  6. *
  7. * @ Param s - to fill Striga
  8. * @ Param l - A string that indicates the character is that the length
  9. * Such as "0000" character = "0" length 4
  10. * /
  11. s,l ) { return ( l. substr ( 0 , ( l. length -s. length ) ) +s ) ; } padding function (s, l) (return (l. substr (0, (l-s length. length)) + s);)
  12. padding ( '123' , '0000' ) ) ; alert (padding ('123 ','0000'));

If you have other interesting solutions please comment : D

Related Post

A class countdown in Javascript

Monday 13 October, 2008

In the post with 3D CountDown FIVe3D (See How I Did It: write a countdown in Flash), was a class proposal for the creation of an object CountDown in Actionscript, here's a version similar in Javascript:

JavaScript:
  1. / **
  2. * CountDown Class
  3. *
  4. * @ Author Giovambattista Fazioli
  5. * @ @ Email g.fazioli undolog.com
  6. * @ Web http://www.undolog.com
  7. *
  8. * @ Param dd (string) 'day month, year'
  9. *
  10. * /
  11. dd ) { function countdown (dd) (
  12. / / Init target time
  13. Date ( dd ) ; var target = new Date (dd);
  14. = target. getTime ( ) ; this. targetTime = target. getTime ();
  15. / **
  16. * Refresh countdown
  17. * /
  18. = function ( ) { this. refresh = function () (
  19. Date ( ) ; var today = new Date ();
  20. ( ) ; var = currentTime today. getTime ();
  21. / / Time left
  22. this . targetTime - currentTime ) ; this. _leftMilliseconds = (this. targetTime - currentTime);
  23. ( this ._leftMilliseconds / 1000 ) ; this. _leftSeconds = Math. floor (this. _leftMilliseconds / 1000);
  24. ( this ._leftSeconds / 60 ) ; this. _leftMinutes = Math. floor (this. _leftSeconds / 60);
  25. ( this ._leftMinutes / 60 ) ; this. _leftHours = Math. floor (this. _leftMinutes / 60);
  26. / / No module
  27. = Math. floor ( this ._leftHours / 24 ) ; this. leftDays = Math. floor (this. _leftHours / 24);
  28. / / For print
  29. = this ._leftMilliseconds % 1000 ; this. leftMilliseconds = this. _leftMilliseconds% 1000;
  30. = this ._leftSeconds % 60 ; this. leftSeconds = this. _leftSeconds% 60;
  31. = this ._leftMinutes % 60 ; this. leftMinutes = this. _leftMinutes% 60;
  32. = this ._leftHours % 24 ; this. leftHours = this. _leftHours% 24;
  33. )
  34. ( ) ; this. refresh ();
  35. )

Example

JavaScript:
  1. countDown ( '1 1, 2009' ) ; var so = new countdown ('1 1, 2009 ');
  2. / / Show how many days, hours, minutes, seconds and milliseconds in the first January 2009
  3. cd. leftDays + "," + cd. leftHours + "," + cd. leftMinutes + "," + cd. leftSeconds + "," + cd. leftMilliseconds ) ; document. write (ie leftDays + "," + cd. leftHours + "," + cd. leftMinutes + "," + cd. leftSeconds + "," + cd. leftMilliseconds);

Related Post

Very short trick: avoid error message in PHP

Wednesday, October 8, 2008

If we do not want a PHP issue any error or warning, just enter the first call to the function of the snail - or at - (@):

PHP:
  1. / / Instead of using the canonical form
  2. ; $ res = miaFunc ();
  3. / / You can use
  4. ; $ res = @ miaFunc ();

Related Post