Tutorial and Code snippets

Clam Antivirus Installation for Linux
ClamAV is a free antivirus that you can use on your website for scanning files, you can use ClamAV to scan also uploaded files using PHP below is the procedure for the installation, take note that you must have a \'root\' access to your server in order to do this.

Download the latest ClamAv from http://www.clamav.net, the latest version during I wrote this procedure is version 0.95.3

#tar -xvzf clamav-0.95.3.tar.gz 
#cd clamav-0.95.3 #groupadd clamav
#useradd clamav
#/configure
#make 
#make install 
#cd ..

After the installation when there is no error, you may run and test ClamAv

#clamscan -r -l scan.txt clamav-0.95.3

Updating the Database virus definition

#touch /var/log/clam-update.log
#chmod 600 /var/log/clam-update.log
#chown clamav /var/log/clam-update.log
#freshclam -d -c 6 -l /var/log/clam-update.log

Now you are ready to use ClamAV to your PHP script below is my sample script to scan files on my site, you can use the eicar_com.zip from www.eicar.org its a test virus file but its harmless.

$filetoscan="eicar_com.zip"
$output = shell_exec("/usr/local/bin/clamscan ".$filetoscan);
echo $output;
if (eregi('FOUND', $output)) {
    echo "Virus found on the file!"
}else{
    echo "no virus and file is safe"
}
Ok hopefully this is useful to you, on my case I use VPS Linux RedHat and I don\'t get any error during installation, I just posted it here for my own reference only
Java Installation in Linux (CentOS 5.2)
During the installation I just search the internet of guide on installing java in linux, and I took down a note for the procedure, this is only my personal reference information but if you want to follow this then you can do so.
1. goto http://java.sun.com/javase/downloads/index.jsp and 
download JDK 6

2. on the download page select Linux OS, just skip the create 
account window and click the download link for  jdk-6u18-linux-i586.bin

3. upload the jdk-6u18-linux-i586.bin to your linux server

4. create a folder for the java :   mkdir java

5. move the file to java folder :   mv jdk-6u18-linux-i586.bin java/

6. set he owner to root :  chmod +x  jdk-6u18-linux-i586.bin

7. execute the installer: ./jdk-6u18-linux-i586.bin  , press space bar 
to continue with more prompt and enter yes for agree

8. to test if java is installed just enter javac , if error command 
not found this means your java is not yet register in global path 
or environment

9. to set the path to Java enter this :  
export PATH=$PATH:/root/java/jdk1.6.0_18/bin

10 to reload the environment enter this: source /etc/profile
To set the path permanently you can do the step below

change to your home directory (ie: /home/myname) and type....

vi .bash_profile (note the fullstop before \'bash\'. This \'.\' makes it a hidden file)
then arrow down until you find the line that looks similar to this.....

PATH=$PATH:$HOME/bin

type i to enter \'insert\' mode,
(remember to use the \':\' between directory names).
Press the escape key to exit \'insert\' mode,
type :w to write the file
type :q to quit the vi editor

Ok hopefully this is useful to you, on my case I use VPS Linux RedHat and I don\'t get any error during installation, I just posted it here for my own reference only

Embed your own font to your website using CSS3
If you are running a modern CSS 3 compliant web browser, or Internet Explorer, you should see your custom font embedded in the paragraph below:

The quick brown fox jump over the lazy dog near the bank of the river

How to do this?

  • Convert your font (ttf) to eot (web embedable font) using WEFT from Microsoft or ttf2eot online coverter and upload your fonts together with the eot file to your website.
  • Place a CSS3 code on the head section of your site like the sample below
    
    
  • And on your web content do the normal css thing

    The quick brown fox jump over the lazy dog near the bank of the river

    Note that MyCustomFont can be in any name you like, the Arial and Tahoma is just a safe font just in case your browser does not support CSS3
  • Saving UTF8 Character (Arabic) in MySQL database with PHP

    Ever wanted to save arabic text on your mysql database with PHP? here are some few tips you need to do to get rid of ??? character

    Make sure that you are using UTF8 everywhere!
  • The browser:
    ("Content-type: text/html; charset=utf-8"); ?>
    

    You can also use a meta tag that is redundant in theory:
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    

    Also, note that the the
    element has an 'accept-charset' attribute which should also be set:
    <form accept-charset="utf-8" ...>
    
  • Mysql:
    Make sure that your table's collation is utf8_general_ci and that all string fields within the table also have the utf8_general_ci collation. And here's the really important bit: make sure your client connection is also using UTF-8:
    For mysql:
    mysql_set_charset('utf8');
    or execute the SQL immediately after connection:
    SET NAMES UTF8;
  • Remote MySQL of Wamp server using SQLyog
     

    I sometimes forgot how to configure my SQLyog program to remote the MySQL database so I decided to put it here on my site just for reference

    As default the MySQL database can be access locally on the same pc but how about you are going to access it from other pc on your network, a very simple steps are the following:

    SETUP new user and GRANT previleges
     
    GRANT ALL ON *.* TO \'user2\'@\'localhost\' IDENTIFIED BY \'pass1\';
    
    Comments: 76 Add a comment
    stankenniamFirst entered on: 2012-02-03 18:24:22
    Sorry, no links allowed.
    adult webcamFirst entered on: 2012-01-31 17:47:36
    Sorry, no links allowed.
    kamagraFirst entered on: 2012-01-30 21:32:46
    Sorry, no links allowed.
    KethanFirst entered on: 2011-11-25 11:26:13
    Keep these articles coming as they've oneped many new doors for me.
    FrankieFirst entered on: 2011-11-25 10:54:53
    These pieces really set a satndrad in the industry.
    IrishFirst entered on: 2011-11-25 10:34:17
    I actually found this more etnreatniing than James Joyce.
    BelleFirst entered on: 2011-11-25 10:30:34
    Now we know who the sneisble one is here. Great post!
    JacklynFirst entered on: 2011-11-25 09:38:55
    Tip top stuff. I'll exepct more now.
    JacieFirst entered on: 2011-11-25 08:32:29
    None can doubt the veratciy of this article.
    ForeverFirst entered on: 2011-11-25 08:23:30
    Great post with lots of importnat stuff.