Installing phpmyadmin on linux

April 17, 2009 by pravin2006

I was writing this post after a very long time …. Now here i faced a problem installing phpmyadmin on linux …

Access denied error …..

For those whose geeting while logging through phpmyadmin should include following lines in config.inc.php

$i=0;
$i++;

$cfg['PmaAbsoluteUri']=’localhost/phpmyadmin/’;
$cfg['Servers'][$i]['host'] = ‘Localhost’;

$cfg['Servers'][$i]['AllowNoPasswordRoot'] = ‘true’;

// This will definitely solve the problem ….

:)

install internet explorer in linux

February 18, 2009 by pravin2006

Following are the steps which will install ie in linux machine.

sudo apt-get install wine cabextract

Now you need to download IEs4Linux script from here

wget http://www.tatanka.com.br/ies4linux/downloads/ies4linux-2.0.5.tar.gz

tar xzvf ies4linux-2.0.5.tar.gz

cd ies4linux-2.0.5

Once you are inside ies4linux-2.0.5 directory you need to run the following script to install internet explorer

./ies4linux

You will get ie icon on ur desktop… Restart the computer if needed….

How to get first and last record in mysql

January 6, 2009 by pravin2006

Hey , its very easy . Its just using two queries and a simple UNION…

for simplication , i m diving the query, the first one is

select A.id from (select id from graph order by id asc limit 1) A // this will give the lowest id , similarly

select B.id from (select id from graph order by id desc limit 1) B // this will give the highest id , similarly

Now , joining the two queries with UNION will serve the purpose

select A.id from (select id from graph order by id asc limit 1) A UNION

select B.id from (select id from graph order by id desc limit 1) B // will give two records

+——+
| id |
+——+
| 1 |
| 1078 |
+——+

Longest query of my life

December 17, 2008 by pravin2006

mysql -H -u mauj -p mauj -e “select count(*) as DownloadCount,W.phone as PhoneModel,sum(W.un) as NumberOfUser from (select count(*) as un,mo ,phone from wap_tran_1 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_2 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_3 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_4 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_5 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_6 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_7 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_12 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_13 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_14 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_32 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_33 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_57 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_172 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_171 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_173 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_203 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_204 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_205 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_206 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_207 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo UNION select count(*) as un,mo ,phone from wap_tran_208 where servid=1 and type=3 and ts like ‘%2008-01%’ group by phone,mo) as W group by W.phone” > /home/pravin/vodaphone.html

26/11 terror attack

December 9, 2008 by pravin2006
Glittering and Glowing Taj

Glittering and Glowing Taj

array_multisort in php

December 9, 2008 by pravin2006

Today i have used array_multisort function of php , its very easy …

I got a array, may be assoaciative example $name_array = (

[0] = array

(

[id] => 1,

[name] = > pravin

)

[1] = array

(

[id] => 2,

[name] = > navin

)

// and so on

)

// for sorting is by name alphabetically , we will use array_multisort();

first we will store all the names from the array in another array

$names = array(’pravin’,'navin’);

// now we will array_multisort to sott by name

$sort_array = array_multisort($names, SORT_ASC , SORT_STRING, $name_array)

// this will change the sequence of array and return navin first with all details then pravin bcoz , ‘n’ comes before ‘p’

// if we want reverse just use SORT_DESC

Thats all … its easy to use …

Important php links

November 26, 2008 by pravin2006

1) http://www.smashingmagazine.com/2008/11/18/10-advanced-php-tips-to-improve-your-progamming/

2) http://ferruh.mavituna.com/sql-injection-cheatsheet-oku/#AboutMySQLandPHP

3) http://www.cs.wcupa.edu/~rkline/perl2php/#stringops

Perl array , hashes example

November 25, 2008 by pravin2006

#!/usr/bin/perl
#here is something interesting to calculate occurence of same word in an array

#lets start
# lets make a simple array , in perl for array @ is used

my @words = (”I”,”love”,”perl”,”programming”,”I”);

#to get the length of the array, simply equate it to a variable
$no_of_words = @words; #this will give u 5 (length)

#now make some hashes (hashes are simple associative array with key and value)
%occurence_of_word = ();

for my $i(1..$no_of_words)
{
$occurence_of_word{$words[$i-1]}++;
}
#print($occurence_of_word{”I”}); // this will give you 2

for my $wordss(keys %occurence_of_word)
{
print “$wordss \t”.” $occurence_of_word{$wordss}\n”; # this will give u the number of occurences of words

}

Beautiful quote from Ghajini

November 20, 2008 by pravin2006

ab bhi kisika khoon na khaula , khun nahi wo pani hain , jo desha ke kam na aaya uski bekar jawani hain ……..

Pravin pics

November 17, 2008 by pravin2006

pravin_shukla-dc892a-album1