$number = 15; printf("Decimal: %d", $number); //Decimal: 15 printf("Binary: %b", $number); //Binary: 1111 printf("Double: %f", $number); //Double: 15.000000 printf("Octal: %o", $number); //Octal: 17 printf("String: %s", $number); //String: 15 printf("Hex (lower): %x", $number); //Hex (lower): f printf("Hex (upper): %X", $number); //Hex (upper): F
Autore: Andrea Falco
Watermark in PHP
$main_img = "Porsche_911_996_Carrera_4S.jpg"; //immagine principale $watermark_img = "watermark.gif"; //use GIF or PNG, JPEG has no tranparency support $padding = 3; //distance to border in pixels for watermark image $opacity = 100; //image opacity for transparent watermark $watermark = imagecreatefromgif($watermark_img); //create watermark $image = imagecreatefromjpeg($main_img); //create main graphic if(!$image || !$watermark) die("Error: main image or watermark could not be loaded!"); $watermark_size = getimagesize($watermark_img); $watermark_width = $watermark_size[0]; $watermark_height = $watermark_size[1]; $image_size = getimagesize($main_img); $dest_x = $image_size[0] - $watermark_width - $padding; $dest_y = $image_size[1] - $watermark_height - $padding; //copy watermark on main image imagecopymerge($image, $watermark, $dest_x, $dest_y, 0, 0, $watermark_width, $watermark_height, $opacity); //print image to screen header("content-type: image/jpeg"); imagejpeg($image); imagedestroy($image); imagedestroy($watermark);
Tratto da http://www.sastgroup.com/tutorials/aggiungere-un-watermark-alle-vostre-immagini-con-php
Contare il numero di files in una directory
$count = 0; $hd = opendir("percorso/vostra/directory"); while(($file = readdir($hd)) !== false) { //Se i file sono nascosti non gli conta if ($file[0] != ".") $count++; } echo $count; //stampa a video il numero totale di files
Tratto da http://www.sastgroup.com/tutorials/php-contare-il-numero-di-files-in-una-directory
Gestire BBCode in PHP
function BBCode($text) { /** * The following array has the structure Key => Value. * The key is the item that will be typed e.g [b] the value will be the html equivilant. */ $BBCode = array("&" => "&", "< " => "<", ">" => ">", "[b]" => "<b>", "[/b]" => "</b>", "[i]" => "<i>", "[/i]" => "</i>", "[u]" => "<u>", "[/u]" => "</u>", "[img]" => "<img src='", "[/img]" => "'/>"); // Comment Above $parsedtext = str_replace(array_keys($BBCode), array_values($BBCode), $text); //This function will get the input string. and then the keys and values of the array above. It will then replace them with the html equivilant. return $parsedtext; // Return $parsedtext. }
Esempio Applicato:
$text = BBCode("[b][u]HELLO[/u][/b]"); // Execute Function echo $text; // Echo $text.
Ripristinare grub
sudo grub find boot/grub/stage1 -> (la risposta sarà hdx,y) root (hdx,y) setup(hdx) quit
Web Server su Mac 10.5.7
- Abilitare Apache 2:
“Preferenze di Sistema -> Condivisione” Spuntare “Condivisione Web”. - Abilitare PHP 5.2.8:
Digitare nel terminale:cd /etc/apache2 sudo vim httpd.conf
Con l’editor Vim trasformare la stringa
#LoadModule php5_module libexec/apache2/libphp5.so
in
LoadModule php5_module libexec/apache2/libphp5.so
Call of Duty 4 Mod Tools
Scaricare Call of Duty 4 Mod Tools e scompattare nella cartella di installazione del gioco.
array_slice
Recupera una parte di un array:
array array_slice ( array $array , int $offset [, int $length [, bool $preserve_keys = false ]] )
Splashimages GRUB
su # - inserire la password di root - convert - geometry 640x480 -colors 14 wall.jpg splash.xpm gzip splash.xpm cp splash.xpm.gz /boot/grub/
http://skydiamond.org/wiki/index.php?title=Splashimages_GRUB
Cominciato A.S. 2009/2010
Anche quest’anno è ricominciata la scuola.