mad4Java - By Developers For Developers
Friday, February 11, 2011
Saturday, January 29, 2011
Maximum length for MySQL TEXT data types
TEXT data types are also able to store much more data than VARCHAR and CHAR text types so TEXT types are what you need to use when storing large amount of content in a database table.
The maximum amount of data that can be stored in TEXT data types are as follows:
TINYTEXT 256 bytes
TEXT 65,535 bytes (64kb)
MEDIUMTEXT 16,777,215 bytes (16MB)
LONGTEXT 4,294,967,295 bytes (4GB)
- Payal Maru
Team Lead - J2EE Application Development
NAVSYA Technologies Pvt. Ltd.
www.navsya.com
mySQL Database Backup and Import
c:\>mysqldump -u [USER] -p -P [PORT] --all-databases > [FILE]
For example, the command will look like this:
c:\>mysqldump -u root -p -P 3306 --all-databases > mydump.sql
After you press enter you will be asked for password and then your backup file will be created.
You can also choose to export/backup only select databases.
For restoring the backup:
mysql -u root -p -P 3306 < mydump.sql
Note that in this case while restoring the databases all the existing databases / tables with the same names will be dropped and recreated with the data in the dump file.
Note: If your mySQL bin directory is not specified in the PATH variable you will need to go to the directory where mySQL is installed and then fire this command
- Siddhesh Prabhu
Team Lead - J2EE Application Development
NAVSYA Technologies Pvt. Ltd.
http://www.navsya.com
Multiple File Upload with PHP
Create HTML form as mentioned in the code below:
<html>
<body>
<form action="addPhotoAction.php" method="post" enctype="multipart/form-data">
<input type="hidden" name="rowCount" id="rowCount" value="2">
<table>
<tr>
<td>Photo 1</td>
<td><input type="file" name="photo0" id="photo0"></td>
</tr>
<tr>
<td>Photo 2</td>
<td><input type="file" name="photo1" id="photo1"></td>
</tr>
</table>
</form>
</body>
</html>
Copy & paste following code to create addActionPhoto.php:
<html>
<body>
<?php
$rowCount=$_POST[‘rowCount’];
for($i = 0; $i < $rowCount; $i++) // where rowCount is the No. of uploads
{
$target_path = "FolderName_to_store_images/";
$target_path = $target_path . basename( $_FILES[photo'. $i]['name']);
$file_name = stripslashes($target_path);
$file_name = str_replace("'","",$file_name);
$copy = move_uploaded_file($_FILES[photo'. $i]['tmp_name'],$file_name);
// prompt if successfully copied
if($copy!="")
{
//here comes the insert query
echo “Images uploaded successfully.<br>”;
}
else
{
echo "$file_name | could not be uploaded!<br>";
}
}
?>
</body>
</html>
NAVSYA Technologies Pvt. Ltd.
www.navsya.com
Friday, January 28, 2011
jQuery Calendar / Widgets are displaying too large?
Team Lead - J2EE Application Development
Tuesday, October 12, 2010
Handling JDK Version Compatibility in Eclipse
How to compile the Java Source files of a Web Project made in Eclipse according to the JDK insatalled in the client / production server machine?
A dynamic web project made in eclipse can be recomplied to lower versions of JDK using the following steps:
- Right Click the project and click on Properties
- Then Click on Java Complier
- In the Java Complier Node there is a section called as JDK Compliance. In that there is a field called as Complier Compliance Level that has the JDK version feilds. Accordingly select the JDK version then click on Apply.
- Once Apply is clicked, It will ask do you want to ReBuild your project now to apply the changes. Click on Yes, the project will get reComplied.
Using the steps above you can make your web project compatiable with any version of JDK you require.
- Payal Maru
Team Lead - J2EE Application Development