Archive for 2015

Convert html code to image PNG, JPG

by in 0

You can use this code to convert html code into images.
Switch imagepng to imagegif, imagejpg as your purpose.



$html_code = "this is the body";


$my_img = imagecreate( 200, 80 );
$background = imagecolorallocate( $my_img, 0, 0, 255 );
$text_colour = imagecolorallocate( $my_img, 255, 255, 0 );
//$line_colour = imagecolorallocate( $my_img, 128, 255, 0 );
imagestring( $my_img, 4, 30, 25, "$html_code",$text_colour );
imagesetthickness ( $my_img, 5 );
imageline( $my_img, 30, 45, 165, 45, $line_colour );

header( "Content-type: image/png" );
imagepng( $my_img );
imagecolordeallocate( $line_color );
imagecolordeallocate( $text_color );
imagecolordeallocate( $background );
imagedestroy( $my_img );


Css to the children nodes based on the number of siblings they have

by 0

Some one ask me "how can style element based the number of children it has?"


in CSS3, styles cannot be applied to a parent node based on the number of children it has. However, styles can be applied to the children nodes based on the number of siblings they have.




/* one item */
li:first-child:nth-last-child(1) {
    width: 100%;
}

/* two items */
li:first-child:nth-last-child(2),
li:first-child:nth-last-child(2) ~ li {
    width: 50%;
}

/* three items */
li:first-child:nth-last-child(3),
li:first-child:nth-last-child(3) ~ li {
    width: 33.3333%;
}

/* four items */
li:first-child:nth-last-child(4),
li:first-child:nth-last-child(4) ~ li {
    width: 25%;
}

Create a phpFox module

by in , 0

This tutorial help you get the basic concept & knowledge about phpFox module structure and how it communicate with others.

module_3.png

Read more »

Patch fix for Replay in Live HTTP Headers

by in 2

Live HTTP Headers  is very useful addon for developer on firefox

But Replay option doesn't work in new FF! since September 2014

How to make "Replay" work again?
Easily, please following these steps

  1. Close firefox if it's opened
  2. Run : Type: %APPDATA%\Mozilla\Firefox\Profiles\ Enter
  3. CLick on extension folder, Ex: yourprofile.default\extensions\
  4. Search for "livehttpheaders.jar", then open the folder contained livehttpheaders.jar
  5. Download this patch: Patch fix Replay Live HTTP Headers 
  6. Uncompress the downloaded file into that folder
  7. Done.



How to disable updatedb? /usr/bin/updatedb

by in , 0

Sometimes you can see /usr/bin/updatedb running cause high load.
a question is posed. is It necessary to keep updatedb?

Just do the following step to find out the answer

  1. First find out where the program is located on disk.
    $ type updatedb
    updatedb is /usr/bin/updatedb
    
  2. Next find out what package provides updatedb.
    $ rpm -qf /usr/bin/updatedb
    mlocate-0.26-3.fc19.x86_64
    
  3. See if anything requires mlocate.
    $ rpm -q --whatrequires mlocate
    no package requires mlocate
    
  4. Nothing requires it so you can remove the package.
    $ yum remove mlocate