PHP Script to Optimize All Tables In A MySQL Database
October 22nd, 2008One Comment | Filed Under: Tutorials
In MYSQL OPTIMIZE TABLE should be used if you have deleted a large part of a table or if you have made many changes to a table with variable-length rows. Deleted rows are maintained in a linked list and subsequent INSERT operations reuse old row positions. You can use OPTIMIZE TABLE to reclaim the unused space and to defragment the data file.
OPTIMIZE TABLE statement requires SELECT and INSERT privileges for the table.
This PHP script will optimize all the tables in a particular mysql database.
//Database connection
$alltbls = mysql_query("show tables");
while ($table = mysql_fetch_assoc($alltbls))
{
foreach ($table as $db => $tablename)
{
mysql_query("OPTIMIZE TABLE '".$tablename."'")
or die(mysql_error());
}
}
?>
How to calculate the difference between two dates in java
October 17th, 2008No Comments | Filed Under: Tutorials
// end and start are timestamps
long noofdays=diffInMilleseconds/86400000;
long diffInSeconds = diffInMilleseconds/1000;
long diffInMinutes = diffInSeconds/60;
long diffInHours = diffInMinutes/60;
long diffInDays = diffInHours/24;
How to hide Files in a JPEG image
September 29th, 20082 Comments | Filed Under: Tutorials
create an archive(tar/rar/zip) etc file of the important files which has to be hidden.
then get an jpg image of your interest under which you want to hide the files.
then execute the following COPY command
> copy /b mysecretfiles.zip secretimage.jpg
b : represents the BINARY mode
it will create a file secretimage.jpg (image file should be there in path)
if u click on that it will be opened in ur default picture viewer
Delete those important files as we are having those in the hidden secretimage
To retrive the contents then open(extract) the file with the zip software that is present