Hi Friends,
Today One of friend email me about the rhodes framework, I have gone through the rhodes framework, its an awesome framework by using this we can develop all smartphone native applications including iphone, android, blackberry etc.,
Have a look into http://rhomobile.com/products/rhodes/
Wednesday, July 14, 2010
Tuesday, July 13, 2010
Phonegap for Iphone applications
Phonegap will lets you build a native mobile applications as a locally cached and privileged mobile website. You can leverage existing mobile site code for the native app. It will still be better than a pure website experience. It lets you piggyback on skill web developers already have. It is a great way to make use of HTML5 local DBs, local data, and HTML templates. It encourages you follow best practices for building a mobile site that works offline and requests only minimal JSON so it can fast over slow internet.
15 Frameworks and Dev Tools for Creating iPhone Apps
http://www.howtounlockiphone.org/15-mobile-frameworks-and-development-tools-for-creating-iphone-apps.html
15 Frameworks and Dev Tools for Creating iPhone Apps
http://www.howtounlockiphone.org/15-mobile-frameworks-and-development-tools-for-creating-iphone-apps.html
Thursday, July 8, 2010
CHAR Vs VARCHAR In Mysql
CHAR datatype used when you know the exact length of the value, ex: US Zipcodes (CHAR(7)), Mobile phone numbers (10 numbers only CHAR(10)) etc., And its length should be 0 to 255
VARCHAR datatype used in variable length inputs. Ex; User_firstname (VARCHAR(20)), street_address(VARCHAR(100)) etc.,
Its length should be 0 to 255 before Mysql 5.0.3 version, After 5.3.0 and later versions it should be 0 to 65,535.
See the example below:
Value CHAR(4) Storage Required VARCHAR(4) Storage Required
'' ' ' 4 bytes '' 1 byte
'ab' 'ab ' 4 bytes 'ab' 3 bytes
'abcd' 'abcd' 4 bytes 'abcd' 5 bytes
'abcdefgh' 'abcd' 4 bytes 'abcd' 5 bytes
VARCHAR datatype used in variable length inputs. Ex; User_firstname (VARCHAR(20)), street_address(VARCHAR(100)) etc.,
Its length should be 0 to 255 before Mysql 5.0.3 version, After 5.3.0 and later versions it should be 0 to 65,535.
See the example below:
Value CHAR(4) Storage Required VARCHAR(4) Storage Required
'' ' ' 4 bytes '' 1 byte
'ab' 'ab ' 4 bytes 'ab' 3 bytes
'abcd' 'abcd' 4 bytes 'abcd' 5 bytes
'abcdefgh' 'abcd' 4 bytes 'abcd' 5 bytes
Wednesday, July 7, 2010
Website optimization
Hi Friends,
Below urls are very useful for website optimization techniques.
http://www.fiftyfoureleven.com/weblog/web-development/css/css-sprites-images-optimization
http://www.peachpit.com/articles/article.aspx?p=447210
http://www.die.net/musings/page_load_time/
http://www.webdevelopment2.com/easily-increase-page-load-time-10-fold-jquery/
Below urls are very useful for website optimization techniques.
http://www.fiftyfoureleven.com/weblog/web-development/css/css-sprites-images-optimization
http://www.peachpit.com/articles/article.aspx?p=447210
http://www.die.net/musings/page_load_time/
http://www.webdevelopment2.com/easily-increase-page-load-time-10-fold-jquery/
CSS Sprites -
If your web page had lot of images and it will take more time to load all images then you should use one technique called "CSS Sprites" which will load all your common UI images in one request so that your page loads much faster than ever before.
Another technique is place the below tag in head section of your page
Another technique is place the below tag in head section of your page
Use Firebug and Yslow plugins for Firefox to know the performancd of the page load
Use Firebug for Firefox from a realistic net connection to see a graphical timeline of what it is doing during a page load. This shows where Firefox has to wait for one HTTP request to complete before starting the next one and how page load time increases with each object loaded. YSlow extends Firebug to offer tips on how to improve your site's performance
Access the website with ip address and username instead of doman name when dns was not propagated correctly
After uploded files to hosting server, you need to set the dns to access files with domain name, if you didn't set the dns, you can also call the application as below.
http://ip-address/~username/gallery/ OR http://ip-address/username/gallery/
Ex: http://192.168.12.10/~venkat/gallery/
http://ip-address/~username/gallery/ OR http://ip-address/username/gallery/
Ex: http://192.168.12.10/~venkat/gallery/
Tuesday, July 6, 2010
Free SVN account from Google
Here are some very quick notes on getting a google svn hosting account set up with eclipse; as google is offering us all such an amazing resource, I have a feeling I'll be doing this again some time whilst working on other projects...
If you already have a gmail account, make sure you're logged in (that way, your repository and your account will be linked).
Start here:
http://code.google.com/hosting/
Go to the 'Create a new Project' link and create your project...
Install eclipse if you haven't already (current recent version is 3.5):
http://www.eclipse.org/downloads/
Now you need to install the subclipse plugin from within eclipse..
Here are some step-by-step instructions:
http://subclipse.tigris.org/install.html
Once that's done you should be able to open your repository as a new project within eclipse.
Within the package explorer (the panel on the left if you're in the java developer perspective), right click to get the context menu and go to 'New' and 'Other...'
expand the SVN folder and select 'Checkout Projects from SVN' and select Next
Select the Create a new repository location and select Next
The URL will be:
https://[YOUR_PROJECT_NAME].googlecode.com/svn
If you don't use https:// you'll check out the repository as read only
Select (highlight) the folder to check out as an eclipse project (e.g. trunk) and select Next.
Select the check out as a project configured using the New Project Wizard and select 'Finish'
For this exercise, I'm checking mine out as a java project, so I'm selecting Java Project and Next on the wizard box.
Give the Project a name (e.g. myProject), select Finish and OK
Let it check out your project...
You should see something like myProject [trunk] in the package explorer.
You can now right click on the folder and go to New > Folder and create a new folder
When you're ready, right click on the folder you've created, go to the Team context menu and select 'Add to Version Control'; you'll probably need to do this for any new files you subsequently add...
From then, commit will add new changes and update will refresh a stale repository.
One other note: to check out the project, I used my gmail username. The svn password isn't the same as your gmail password though.
I found the password for the code repository (when logged in) here - so hopefully this will help:
http://code.google.com/hosting/settings
NB: I've seen situations where subclipse (or subversion) would keep asking for a password; I managed to stop it from doing this by going into the Eclipse > Window > Preferences, expanding the Team folder, selecting SVN and ensuring that the SVN interface was selection was set to SVNKit (Pure Java).
If you already have a gmail account, make sure you're logged in (that way, your repository and your account will be linked).
Start here:
http://code.google.com/hosting/
Go to the 'Create a new Project' link and create your project...
Install eclipse if you haven't already (current recent version is 3.5):
http://www.eclipse.org/downloads/
Now you need to install the subclipse plugin from within eclipse..
Here are some step-by-step instructions:
http://subclipse.tigris.org/install.html
Once that's done you should be able to open your repository as a new project within eclipse.
Within the package explorer (the panel on the left if you're in the java developer perspective), right click to get the context menu and go to 'New' and 'Other...'
expand the SVN folder and select 'Checkout Projects from SVN' and select Next
Select the Create a new repository location and select Next
The URL will be:
https://[YOUR_PROJECT_NAME].googlecode.com/svn
If you don't use https:// you'll check out the repository as read only
Select (highlight) the folder to check out as an eclipse project (e.g. trunk) and select Next.
Select the check out as a project configured using the New Project Wizard and select 'Finish'
For this exercise, I'm checking mine out as a java project, so I'm selecting Java Project and Next on the wizard box.
Give the Project a name (e.g. myProject), select Finish and OK
Let it check out your project...
You should see something like myProject [trunk] in the package explorer.
You can now right click on the folder and go to New > Folder and create a new folder
When you're ready, right click on the folder you've created, go to the Team context menu and select 'Add to Version Control'; you'll probably need to do this for any new files you subsequently add...
From then, commit will add new changes and update will refresh a stale repository.
One other note: to check out the project, I used my gmail username. The svn password isn't the same as your gmail password though.
I found the password for the code repository (when logged in) here - so hopefully this will help:
http://code.google.com/hosting/settings
NB: I've seen situations where subclipse (or subversion) would keep asking for a password; I managed to stop it from doing this by going into the Eclipse > Window > Preferences, expanding the Team folder, selecting SVN and ensuring that the SVN interface was selection was set to SVNKit (Pure Java).
Free SVN account from Google
Ok - here are some very quick notes on getting a google svn hosting account set up with eclipse; as google is offering us all such an amazing resource, I have a feeling I'll be doing this again some time whilst working on other projects...
If you already have a gmail account, make sure you're logged in (that way, your repository and your account will be linked).
Start here:
http://code.google.com/hosting/
Go to the 'Create a new Project' link and create your project...
Install eclipse if you haven't already (current recent version is 3.5):
http://www.eclipse.org/downloads/
Now you need to install the subclipse plugin from within eclipse..
Here are some step-by-step instructions:
http://subclipse.tigris.org/install.html
Once that's done you should be able to open your repository as a new project within eclipse.
Within the package explorer (the panel on the left if you're in the java developer perspective), right click to get the context menu and go to 'New' and 'Other...'
expand the SVN folder and select 'Checkout Projects from SVN' and select Next
Select the Create a new repository location and select Next
The URL will be:
https://[YOUR_PROJECT_NAME].googlecode.com/svn
If you don't use https:// you'll check out the repository as read only
Select (highlight) the folder to check out as an eclipse project (e.g. trunk) and select Next.
Select the check out as a project configured using the New Project Wizard and select 'Finish'
For this exercise, I'm checking mine out as a java project, so I'm selecting Java Project and Next on the wizard box.
Give the Project a name (e.g. myProject), select Finish and OK
Let it check out your project...
You should see something like myProject [trunk] in the package explorer.
You can now right click on the folder and go to New > Folder and create a new folder
When you're ready, right click on the folder you've created, go to the Team context menu and select 'Add to Version Control'; you'll probably need to do this for any new files you subsequently add...
From then, commit will add new changes and update will refresh a stale repository.
One other note: to check out the project, I used my gmail username. The svn password isn't the same as your gmail password though.
I found the password for the code repository (when logged in) here - so hopefully this will help:
http://code.google.com/hosting/settings
NB: I've seen situations where subclipse (or subversion) would keep asking for a password; I managed to stop it from doing this by going into the Eclipse > Window > Preferences, expanding the Team folder, selecting SVN and ensuring that the SVN interface was selection was set to SVNKit (Pure Java).
You can find more information regarding this from http://blog.msbbc.co.uk/2007/06/using-googles-free-svn-repository-with.html
If you already have a gmail account, make sure you're logged in (that way, your repository and your account will be linked).
Start here:
http://code.google.com/hosting/
Go to the 'Create a new Project' link and create your project...
Install eclipse if you haven't already (current recent version is 3.5):
http://www.eclipse.org/downloads/
Now you need to install the subclipse plugin from within eclipse..
Here are some step-by-step instructions:
http://subclipse.tigris.org/install.html
Once that's done you should be able to open your repository as a new project within eclipse.
Within the package explorer (the panel on the left if you're in the java developer perspective), right click to get the context menu and go to 'New' and 'Other...'
expand the SVN folder and select 'Checkout Projects from SVN' and select Next
Select the Create a new repository location and select Next
The URL will be:
https://[YOUR_PROJECT_NAME].googlecode.com/svn
If you don't use https:// you'll check out the repository as read only
Select (highlight) the folder to check out as an eclipse project (e.g. trunk) and select Next.
Select the check out as a project configured using the New Project Wizard and select 'Finish'
For this exercise, I'm checking mine out as a java project, so I'm selecting Java Project and Next on the wizard box.
Give the Project a name (e.g. myProject), select Finish and OK
Let it check out your project...
You should see something like myProject [trunk] in the package explorer.
You can now right click on the folder and go to New > Folder and create a new folder
When you're ready, right click on the folder you've created, go to the Team context menu and select 'Add to Version Control'; you'll probably need to do this for any new files you subsequently add...
From then, commit will add new changes and update will refresh a stale repository.
One other note: to check out the project, I used my gmail username. The svn password isn't the same as your gmail password though.
I found the password for the code repository (when logged in) here - so hopefully this will help:
http://code.google.com/hosting/settings
NB: I've seen situations where subclipse (or subversion) would keep asking for a password; I managed to stop it from doing this by going into the Eclipse > Window > Preferences, expanding the Team folder, selecting SVN and ensuring that the SVN interface was selection was set to SVNKit (Pure Java).
You can find more information regarding this from http://blog.msbbc.co.uk/2007/06/using-googles-free-svn-repository-with.html
Monday, July 5, 2010
Multi line CSS
Single line css
#wrapper {
width:800px;
margin:0 auto;
}
#header {
height:100px;
position:relative;
}
#feature .post {
width:490px;
float:left;
}
Multiline css
#wrapper {width:800px; margin:0 auto;}
#header {height:100px; position:relative;}
#feature .post {width:490px; float:left;}
If you use, Multiline css then you can easily find the style for an element when ever you need to customise it also the number of lines per style sheet would be decreased.
#wrapper {
width:800px;
margin:0 auto;
}
#header {
height:100px;
position:relative;
}
#feature .post {
width:490px;
float:left;
}
Multiline css
#wrapper {width:800px; margin:0 auto;}
#header {height:100px; position:relative;}
#feature .post {width:490px; float:left;}
If you use, Multiline css then you can easily find the style for an element when ever you need to customise it also the number of lines per style sheet would be decreased.
Backup database using php code
Hello Frineds,
Below code would take entire database backup and store it in the current folder. You can run this script automatically using crop job, so that you would have your database backup for every day or every week as you wish.
//backup_tables('localhost','root','rot','database_name','table_name'); //To backup one specific table
backup_tables('localhost','root','rot','database_name'); // To backup entire database
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
//get all of the tables
if($tables == '*')
{
$tables = array();
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
foreach($tables as $table)
{
$result = mysql_query('SELECT * FROM '.$table);
$num_fields = mysql_num_fields($result);
$return.= 'DROP TABLE '.$table.';';
$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
$return.= "\n\n".$row2[1].";\n\n";
for ($i = 0; $i < $num_fields; $i++)
{
while($row = mysql_fetch_row($result))
{
$return.= 'INSERT INTO '.$table.' VALUES(';
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
if ($j<($num_fields-1)) { $return.= ','; }
}
$return.= ");\n";
}
}
$return.="\n\n\n";
}
//save file
$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
fwrite($handle,$return);
fclose($handle);
}
?>
Below code would take entire database backup and store it in the current folder. You can run this script automatically using crop job, so that you would have your database backup for every day or every week as you wish.
//backup_tables('localhost','root','rot','database_name','table_name'); //To backup one specific table
backup_tables('localhost','root','rot','database_name'); // To backup entire database
/* backup the db OR just a table */
function backup_tables($host,$user,$pass,$name,$tables = '*')
{
$link = mysql_connect($host,$user,$pass);
mysql_select_db($name,$link);
//get all of the tables
if($tables == '*')
{
$tables = array();
$result = mysql_query('SHOW TABLES');
while($row = mysql_fetch_row($result))
{
$tables[] = $row[0];
}
}
else
{
$tables = is_array($tables) ? $tables : explode(',',$tables);
}
//cycle through
foreach($tables as $table)
{
$result = mysql_query('SELECT * FROM '.$table);
$num_fields = mysql_num_fields($result);
$return.= 'DROP TABLE '.$table.';';
$row2 = mysql_fetch_row(mysql_query('SHOW CREATE TABLE '.$table));
$return.= "\n\n".$row2[1].";\n\n";
for ($i = 0; $i < $num_fields; $i++)
{
while($row = mysql_fetch_row($result))
{
$return.= 'INSERT INTO '.$table.' VALUES(';
for($j=0; $j<$num_fields; $j++)
{
$row[$j] = addslashes($row[$j]);
$row[$j] = ereg_replace("\n","\\n",$row[$j]);
if (isset($row[$j])) { $return.= '"'.$row[$j].'"' ; } else { $return.= '""'; }
if ($j<($num_fields-1)) { $return.= ','; }
}
$return.= ");\n";
}
}
$return.="\n\n\n";
}
//save file
$handle = fopen('db-backup-'.time().'-'.(md5(implode(',',$tables))).'.sql','w+');
fwrite($handle,$return);
fclose($handle);
}
?>
Difference between echo & return statements in function
Hi,
Here is the explanation about where we should use echo and where we should use return statements while working with functions.
If you want to print some thing on browser and continue execution of the process then you have to use echo statement.
Ex:
function test()
{
static $count = 0;
$count++;
echo $count;
if ($count < 10) {
test();
}
$count--;
}
test();
?>
Here static variable is initialised only once when first called the test function and then it will maintain the value of $count till the end of the process.
O/P:12345678910
When you use the return statement the program execution stopped in that line and output some thing to the variable. So Calling return in your script or function will either end the script or end the function and then return the value
Ex:
function test($arg)
{
if ( $arg == 'ban' ) {
return 'Banana';
}
else
{
// There's nothing else to do, so end execution of this function
return;
}
}
$fruit = test('banana');
if ($fruit=='Banana')
{
echo 'Banana';
}
?>
Here is the explanation about where we should use echo and where we should use return statements while working with functions.
If you want to print some thing on browser and continue execution of the process then you have to use echo statement.
Ex:
Recursive functions with static variables
function test()
{
static $count = 0;
$count++;
echo $count;
if ($count < 10) {
test();
}
$count--;
}
test();
?>
Here static variable is initialised only once when first called the test function and then it will maintain the value of $count till the end of the process.
O/P:12345678910
When you use the return statement the program execution stopped in that line and output some thing to the variable. So Calling return in your script or function will either end the script or end the function and then return the value
Ex:
function test($arg)
{
if ( $arg == 'ban' ) {
return 'Banana';
}
else
{
// There's nothing else to do, so end execution of this function
return;
}
}
$fruit = test('banana');
if ($fruit=='Banana')
{
echo 'Banana';
}
?>
Friday, July 2, 2010
PHP start session only once to prevent warnings
session_id() returns an empty string if there is no current session, so to test if a session already exists, its better to write this :
if(session_id() == "")
{
session_start();
}
else
{
// Anything you want
}
if(session_id() == "")
{
session_start();
}
else
{
// Anything you want
}
Thursday, July 1, 2010
Get current page URL along with SSL protocal and port number In PHP
Hi, Below code will get the current page URL along with SSL protocal and port number
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
echo curPageURL();
?>
function curPageURL() {
$pageURL = 'http';
if ($_SERVER["HTTPS"] == "on") {$pageURL .= "s";}
$pageURL .= "://";
if ($_SERVER["SERVER_PORT"] != "80") {
$pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"];
} else {
$pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"];
}
return $pageURL;
}
?>
echo curPageURL();
?>
Search features in eclipse editor
Simple search and replace
Ctrl + F
Advanced search and replace
Ctrl + H
When you press Ctrl + H then search window will open in eclipse editor
Containing text: which text do you want to find. Ex: if you don't know some function was defined, then simply you can search for function funname(
File name patterns
*.php will search in all php files
*.* will search win all files
Scope
Workspace OR Enclosing Projects
Workspace means search in all projects
Enclosing Projects means search in current working project
Ctrl + F
Advanced search and replace
Ctrl + H
When you press Ctrl + H then search window will open in eclipse editor
Containing text: which text do you want to find. Ex: if you don't know some function was defined, then simply you can search for function funname(
File name patterns
*.php will search in all php files
*.* will search win all files
Scope
Workspace OR Enclosing Projects
Workspace means search in all projects
Enclosing Projects means search in current working project
Phonegap - an opensource framework for developing iphone and other applications
Phonegap is an open source framework for developing different mobile applications. By using HTML, CSS and Javascript we can create appliations with core features of iPhone, Ipad, Android, Palm, Symbian, Blackberry etc.,,
Sample code
http://github.com/sintaxi/phonegap
Official website
http://www.phonegap.com/
Sample code
http://github.com/sintaxi/phonegap
Official website
http://www.phonegap.com/
Tuesday, June 29, 2010
Open new tab in browser using js
//open new tab with blank address
window.open('', '_blank', 'toolbar=0,location=0,menubar=0');
//open new tab with url
window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');
window.open('', '_blank', 'toolbar=0,location=0,menubar=0');
//open new tab with url
window.open('http://www.google.com', '_blank', 'toolbar=0,location=0,menubar=0');
Monday, June 28, 2010
Wordpress plugin development
Hi Friends,
Here is very good information provided for wp plugin developement, it explained in a very easy way.
http://www.problogdesign.com/wordpress/a-novice-guide-to-wordpress-plugin-development/
Here is very good information provided for wp plugin developement, it explained in a very easy way.
http://www.problogdesign.com/wordpress/a-novice-guide-to-wordpress-plugin-development/
Thursday, June 24, 2010
Visual way to provide feedback and ask your employee to do necessary changes
Visual way to provide feedback and ask your employee to do necessary changes either on design or content of the webpage. To get started sign up at http://www.notableapp.com/
Jquery selectors reference for beginners
Hi Friends,
Jquery selectors are used to apply effects for all elements or some or group of elements by using classes or IDs and tag names.
Ex: $(‘#id’); This selector selects an element with the given ID.
$(‘.class’) The class selector will gather all elements in the document with the given class name
:first $(‘ul li:first’); Returns the first element in a result set
You can see the complete information at below url.
http://www.pamaya.com/jquery-selectors-and-attribute-selectors-reference-and-examples/
Jquery selectors are used to apply effects for all elements or some or group of elements by using classes or IDs and tag names.
Ex: $(‘#id’); This selector selects an element with the given ID.
$(‘.class’) The class selector will gather all elements in the document with the given class name
:first $(‘ul li:first’); Returns the first element in a result set
You can see the complete information at below url.
http://www.pamaya.com/jquery-selectors-and-attribute-selectors-reference-and-examples/
Subscribe to:
Posts (Atom)