1 2 3 |
For RAID0, "Used Dev Size" does not exist. For RAID1, "Used Dev Size" equals to half of total disks' size. For RAID5, "Used Dev Size" equals to size that are used for parity. |
TESTED !
1 2 3 |
For RAID0, "Used Dev Size" does not exist. For RAID1, "Used Dev Size" equals to half of total disks' size. For RAID5, "Used Dev Size" equals to size that are used for parity. |
TESTED !
1 2 3 4 5 6 7 8 9 10 11 12 13 |
# Enabling mounting. sudo modprobe nbd max_part=8 sudo qemu-nbd --connect=/dev/nbd0 /mnt/kvm/wordpress-sites.qcow2 sudo fdisk /dev/nbd0 -l sudo mount /dev/nbd0p1 /mnt/somepoint/ sudo umount /mnt/somepoint/ sudo qemu-nbd --disconnect /dev/nbd0 |
Example 2:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
losetup /dev/loop0 raw-image-file.raw ## # kpartx: # Recognise and activate partitions in the image: kpartx -a /dev/loop0 ## # Check partitions available to this image under /dev/mapper/loop0* # ls /dev/mapper/loop0* /dev/mapper/loop0p1 /dev/mapper/loop0p2 /dev/mapper/loop0p3 /dev/mapper/loop0p4 /dev/mapper/loop0p5 /dev/mapper/loop0p6 ## # mount each partition to a mount point: mount /dev/mapper/loop0p1 /mnt ## # umount and delete created objects. umount /mnt kpartx -d /dev/loop0 losetup -d /dev/loop0 |
1 2 3 4 5 |
nano /etc/ssh/sshd_config FROM: PermitRootLogin without-password TO: PermitRootLogin yes |
1 |
# /etc/init.d/ssh restart |
It is perfect template lib for php developers, Easy to develop specific projects and increase speed of the project.
Code Example :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
Example 7.17. Simple {include} example <html> <head> <title>{$title}</title> </head> <body> {include file='page_header.tpl'} {* body of template goes here, the $tpl_name variable is replaced with a value eg 'contact.tpl' *} {include file="$tpl_name.tpl"} {include file='page_footer.tpl'} </body> </html> |
Of course you should install your smarty to your server.
Quick Smarty Install
In Debian Etch:
1 2 3 |
apt-get install smarty edit php.ini (mine's at /etc/php5/apache2 and set include_path to ".:/usr/share/php:/usr/share/pear:/usr/share/php/smarty/libs" restart apache2 with /etc/init.d/apache2 restart |
Now you have a Smarty install. To use it, you’ll need PHP code to drive Smarty. I’ll include a sample bit of PHP code that I was working on with Mike A:
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 |
<?php require("Smarty.class.php"); $smarty = new Smarty(); $dir = '/var/www-sites.d/malborn.kutayzorlu.com'; $smarty->template_dir = $dir . '/smarty/templates'; $smarty->compile_dir = $dir . '/smarty/templates_c'; $smarty->cache_dir = $dir . '/smarty/cache'; $smarty->config_dir =$dir . '/smarty/configs'; $content = implode('', file($dir . "/index.txt")); $head = implode('', file($dir . "/head.txt")); $footer = implode('', file($dir . "/footer.txt")); $navbar = implode('', file($dir . "/navbar.txt")); if(preg_match('/<title>(.*?)<\/title>/is', $head, $m)) { $title = $m[1]; } else { $title = "Default Title"; } $smarty->assign("title", $title); $smarty->assign("head", $head); $smarty->assign("footer", $footer); $smarty->assign("content", $content); $smarty->assign("navbar", $navbar); $smarty->display("default.tpl"); ?> |
Now, for Smarty to operate you need to supply some directories (i.e. template_dir, compile_dir, cache_dir, config_dir). compile_dir and cache_dir need to writeable by the web server user so in Debian something like:
1 2 3 4 5 6 7 8 9 10 11 12 |
#!/bin/bash DIR=/var/www-sites.d/malborn.kutayzorlu.com mkdir $DIR/smarty mkdir $DIR/smarty/cache mkdir $DIR/smarty/configs mkdir $DIR/smarty/templates mkdir $DIR/smarty/templates_c sudo chown -r :www-data $DIR/smarty/cache sudo chown -r :www-data $DIR/smarty/templates_c |
Write default.tpl into $DIR/smarty/templates/default.tpl . For example,
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 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd"> <html> <head> {$head} <meta http-equiv="content-type" content="text/html; charset=iso-8859-1"/> <link rel="stylesheet" type="text/css" href="default.css" media="screen"/> <title>{$title}</title> </head> <body> <div class="body"> <div class="title">{$title}</div> <div class="subnav"> <h1>Navigation</h1> {$navbar} </div> <div class="main"> {$content} </div> <div class="footer"> {$footer} </div> </div> </body> </html> |
* 1. Download smarty packages
* 2. Extract them somewhere else
* 3 . Write extration path to inside of php.ini file, include_path
* 4. then restart httpd
5 . Create php file , (write template folder path )
6. Create Template file .
7.
Now, moving from here would be something like:
1. Writing code to check for a navbar.txt in the current direction. If not found, stuff navbar Smarty tag with “Back up a level” that moves up one subdirectory (i.e. go to /directory/index.html if you were are /directory/author.html, and go to /index.html when you were are /directory/index.html, etc.)
2. Could proceed by designing a number of templates in Smarty for the same basic content – i.e. skin-bluesteel.tpl and then providing a user interface to switch templates.
3. Perhaps eliminate filesystem reliance and put URL’s into a database.
Map /directory to /directory/index.html, similar with /.
If not in database, display a generic 404 error. You can develop this script by calling it like
/database-script-were-writing.php/directory/index.html and then looking into
PATH_INFO from the server which will contain /directory/index.html .
Once you have this perfected, you set up apache with something like
“Alias / /var/www-sites.d/malborn.kutayzorlu.com/database-script-were-writing.php”
and everything should pretty much just work.
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 |
$key = 'password to kutayzorlu.com'; $string = ' string to be encrypted '; // note the spaces To Encrypt: $iv = mcrypt_create_iv( mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC), MCRYPT_DEV_URANDOM ); $encrypted = base64_encode( $iv . mcrypt_encrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), $string, MCRYPT_MODE_CBC, $iv ) ); # ----------------------------------------------------------- To Decrypt: $data = base64_decode($encrypted); $iv = substr($data, 0, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)); $decrypted = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_128, hash('sha256', $key, true), substr($data, mcrypt_get_iv_size(MCRYPT_RIJNDAEL_128, MCRYPT_MODE_CBC)), MCRYPT_MODE_CBC, $iv ), "\0" ); |
Use PHP’s explode.
1 2 3 4 5 6 7 |
$str = "1,2,3,4,5,6"; $arr = explode("," $str); // array( '1', '2', '3', '4', '5', '6' ); foreach ($arr AS $index => $value) $arr[$index] = (int)$value; // casts each value to integer type -- array( 1, 2, 3, 4, 5, 6 ); |
1 |
array_walk($arr, 'intval'); |
.
http://www.jqplot.com
http://www.highcharts.com/stock/demo/compare/grid-light
http://www.sitepoint.com/11-best-jquery-charting-libraries
http://www.highcharts.com/docs/working-with-data/getting-data-across-domains-jsonp
http://www.sitepoint.com/ajaxjquery-getjson-simple
http://api.jquery.com/jquery.getjson