Flipkart

Wednesday, September 22, 2010

Install Adobe Reader (acroread) on Fedora 12 and Fedora 13

http://macintoshbrasil.com/2010/06/10/install-adobe-acrobat-pdf-reader-on-fedora-centos-red-hat-rhel/

Tuesday, September 14, 2010

Enable the New Google Search

1. Go to Google.com.
2. Once it loads, enter this code into your web browser's URL address field:

javascript:void(document.cookie="PREF=ID=20b6e4c2f44943bb:U=4bf292d46faad806:TM=1249677602:LM=1257919388:S=odm0Ys-53ZueXfZG;path=/; domain=.google.com");

There shouldn't be any http://google.com in front of that. Just that code.

3. Hit enter.
4. Reload or open a new Google.com page and you will have access to the new user interface.

Monday, September 6, 2010

get the Next Auto Increment number in Mysql

$query = mysql_query("SELECT MAX(id) FROM `table`");
$results = mysql_fetch_array($query);
echo $results["Auto_increment"];

Friday, September 3, 2010

Drupal l() With complex link with image Example

$img = '< img src="'.$base_path . $directory . '/images/rssIcon.png" >';
l($img, 'user/3', array('attributes' => array('class' => 'link', 'id' => 'xxx', 'title' => 'Title'), 'html' => 'true'));

Thursday, August 26, 2010

IEs4Linux (Fedora)

Open a terminal. Log in as root to install wine and cabextract:

yum -y install wine*
yum -y install cabextract

Logout and install IEs 4 Linux with your normal user account:

wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-latest.tar.gz
tar zxvf ies4linux-latest.tar.gz
cd ies4linux-*
./ies4linux

Tuesday, August 24, 2010

Installing rar and unrar programs in Linux or Unix

Under Debian Linux, you can use the same apt-get method as follows to install unrar program:

$ apt-get install unrar


If you are using Fedora core Linux then use yum command as follows:

$ yum install unrar


If you are using FreeBSD, you can use:

$ pkg_add -v -r unrar


If any of above, methods is not working, you can download binary package from official rarlab site and choose the right package for your machine... for example, i chose the latest (by the time i write this post):

$ cd /tmp
$ wget http://www.rarlab.com/rar/rarlinux-3.7.1.tar.gz


then untar the file:

$ tar -zxvf rarlinux-3.7.1.tar.gz


Both rar and unrar commands are located in rar sub-directory. Just go to rar directory:

$ cd rar
$ ./unrar


Now copy rar and unrar to /bin directory:

$ cp rar unrar /bin


Then you can use the same method on creating and extracting rar files in linux in my previous post.

Another thing to add, you can also test the integrity of archive, with this command:

$ unrar t filename.rar


or list the files inside the rar file using this command:

$ unrar l filename.rar

Thursday, August 12, 2010

Export Database Data to .XLS in PHP


$DB_Server = "localhost";        //your MySQL Server
$DB_Username = "username";         //your MySQL User Name
$DB_Password = "password";        //your MySQL Password
$DB_DBName = "databasename";            //your MySQL Database Name

 $DB_TBLName = "users";           //your MySQL Table Name
$ttype = $DB_TBLName;

 $sql = "Select * from $DB_TBLName"; 

$Connect = @mysql_connect($DB_Server, $DB_Username, $DB_Password)
    or die("Couldn't connect to MySQL:
" . mysql_error() . "
" . mysql_errno());
//select database
$Db = @mysql_select_db($DB_DBName, $Connect)
    or die("Couldn't select database:
" . mysql_error(). "
" . mysql_errno());
//execute query
$result = @mysql_query($sql,$Connect)
    or die("Couldn't execute query:
" . mysql_error(). "
" . mysql_errno());


    while($row = mysql_fetch_row($result))
    {
           $data = $row;

    }


function cleanData(&$str) {
$str = preg_replace("/\t/", "\\t", $str);
$str = preg_replace("/\r?\n/", "\\n", $str);
if(strstr($str, '"'))
$str = '"' . str_replace('"', '""', $str) . '"';

}

# filename for download $filename = "website_data_" . date('Ymd') . ".xls";
header("Content-Disposition: attachment; filename=\"$filename\"");
header("Content-Type: application/vnd.ms-excel");
$flag = false;
foreach($data as $row) {
if(!$flag) { # display field/column names as first row echo implode("\t", array_keys($row)) . "\n";
$flag = true;
}
array_walk($row, 'cleanData');
echo implode("\t", array_values($row)) . "\n";
}
exit;