When you change any modifications in models or configuration files, then changes will not apply in server some times, in that situation you need to restart the server by connecting your hosting server through telnet. Follow the below process
Login through telnet and enter into the application root path
Ex:# ssh root@example.com
Goto application path
Ex: cd /var/www/example.com
Then run the following commands
# mongrel_rails stop
# mongrel_rails start -d
Friday, July 23, 2010
Tuesday, July 20, 2010
Check session expiration in php
/* The below script will check for users inactivity on page, If use open one page, then store the current time on $_SESSION['start'] variable. If he doesn't move cursor or click any key from keyboard for some time, and then if he click on any link it will check his inactive time. if it is greater than the limited time we set here 5 minutes as exmple, then he will redirected to inactive.php page */
?>
session_start(); // NEVER FORGET TO START
$inactive = 300; //means expire within 5 minutes
if(isset($_SESSION['start']) ) { // if session start set
$session_life = time() - $_SESSION['start'];
if($session_life > $inactive){ //if session time expired
header("Location: inactive.php"); //session expired message page
}
}
$_SESSION['start']=time(); //in pageload current time stored in session.
?>
?>
session_start(); // NEVER FORGET TO START
$inactive = 300; //means expire within 5 minutes
if(isset($_SESSION['start']) ) { // if session start set
$session_life = time() - $_SESSION['start'];
if($session_life > $inactive){ //if session time expired
header("Location: inactive.php"); //session expired message page
}
}
$_SESSION['start']=time(); //in pageload current time stored in session.
?>
Recommended discussions forums for php
http://www.w3schools.com/
http://www.phpfreaks.com/forums/
http://forums.digitalpoint.com/forumdisplay.php?f=37
http://forums.devshed.com/php-development-5/
http://phpbuilder.com/board/
http://www.phpfreaks.com/forums/
http://www.weberforums.com/
http://www.phpbb.com/community/viewforum.php?f=1
http://www.sitepoint.com/forums/forumdisplay.php?forumid=34
http://phpdebutant.com/
http://www.phpfreechat.net/forum/
http://www.phpfreaks.com/forums/
http://forums.digitalpoint.com/forumdisplay.php?f=37
http://forums.devshed.com/php-development-5/
http://phpbuilder.com/board/
http://www.phpfreaks.com/forums/
http://www.weberforums.com/
http://www.phpbb.com/community/viewforum.php?f=1
http://www.sitepoint.com/forums/forumdisplay.php?forumid=34
http://phpdebutant.com/
http://www.phpfreechat.net/forum/
Enable SSH access for you shared hosting account in godaddy server
To Enable SSH on Your Linux Shared Hosting Account
1. Log in to your Account Manager.
2. From the Products section, click Web Hosting.
3. Next to the hosting account you want to use, click Launch.
4. In the Settings section of the Hosting Control Center, click the SSH icon.
5. Type your Country Code, Phone Number, and Extension (if applicable) in the corresponding fields and click Enable.
NOTE: SSH requires a strong password. If prompted to change your password, click Change Password, type a new password, and click OK.
6. We call the phone number provided within 10 minutes. Once the connection is established, an automated message plays a message containing a PIN. Type the PIN number into the You will be called with your PIN field and click Verify.
Once verified, it may take 24-72 hours for SSH to be enabled for your account. During this time, you are locked out from the account as it is moved to a new server.
1. Log in to your Account Manager.
2. From the Products section, click Web Hosting.
3. Next to the hosting account you want to use, click Launch.
4. In the Settings section of the Hosting Control Center, click the SSH icon.
5. Type your Country Code, Phone Number, and Extension (if applicable) in the corresponding fields and click Enable.
NOTE: SSH requires a strong password. If prompted to change your password, click Change Password, type a new password, and click OK.
6. We call the phone number provided within 10 minutes. Once the connection is established, an automated message plays a message containing a PIN. Type the PIN number into the You will be called with your PIN field and click Verify.
Once verified, it may take 24-72 hours for SSH to be enabled for your account. During this time, you are locked out from the account as it is moved to a new server.
(QA) Testing, Staging and Production environments are now available with Heroku
Hi There,
Deploying application in multiple environements is a better approach for a successfull appliation. This is the default behaviour of the rails application to maintain deployment in development, testing and production environments. Development and testing versions are live on developer's local system and production environement lives on actual server.
Now heroku offers us to maintain the application with these three evnironments in live server withing heroku so that clients and your colleagues can provide feedback and suggestions on your application before pushing them to production.
Ex: If you want to deploy an application called "myapp" in Heroku. First create the production,staging and testing(QA) versions of the application, should use --remote option to override the defaults for the git repository names.
$ heroku create myapp-production --remote production
$ heroku create myapp-staging --remote staging
$ heroku create myapp-qa --remote qa
Now, if you want to deploy code to a particular environemt, do so by specifying the appropriate option
Ex:
$ git push staging master
and if you need to run db migrations use below
$ heroku rake db:migrate --remote staging
Finally, If you probably want to periodically copy your production data into your staging environment:
$ heroku db:pull --remote production
$ heroku db:push --remote staging
Now, when you want to deploy code to a particular environment, do so by specifying the appropriate remote:
$ git push staging master
And if you need to run migrations:
$ heroku rake db:migrate --remote staging
Finally, you will probably want to periodically copy your production data into your staging environment:
$ heroku db:pull --remote production
$ heroku db:push --remote staging
Note: Keep in mind that any environment variables you create or add-ons you add must be duplicated across environments for a consistent experience. For example, if you begin using memcache on your staging app, be sure to install it on your production app before you deploy your new code.
For more details
http://jqr.github.com/2009/04/25/deploying-multiple-environments-on-heroku.html
http://stackoverflow.com/questions/1279787/staging-instance-on-heroku
Deploying application in multiple environements is a better approach for a successfull appliation. This is the default behaviour of the rails application to maintain deployment in development, testing and production environments. Development and testing versions are live on developer's local system and production environement lives on actual server.
Now heroku offers us to maintain the application with these three evnironments in live server withing heroku so that clients and your colleagues can provide feedback and suggestions on your application before pushing them to production.
Ex: If you want to deploy an application called "myapp" in Heroku. First create the production,staging and testing(QA) versions of the application, should use --remote option to override the defaults for the git repository names.
$ heroku create myapp-production --remote production
$ heroku create myapp-staging --remote staging
$ heroku create myapp-qa --remote qa
Now, if you want to deploy code to a particular environemt, do so by specifying the appropriate option
Ex:
$ git push staging master
and if you need to run db migrations use below
$ heroku rake db:migrate --remote staging
Finally, If you probably want to periodically copy your production data into your staging environment:
$ heroku db:pull --remote production
$ heroku db:push --remote staging
Now, when you want to deploy code to a particular environment, do so by specifying the appropriate remote:
$ git push staging master
And if you need to run migrations:
$ heroku rake db:migrate --remote staging
Finally, you will probably want to periodically copy your production data into your staging environment:
$ heroku db:pull --remote production
$ heroku db:push --remote staging
Note: Keep in mind that any environment variables you create or add-ons you add must be duplicated across environments for a consistent experience. For example, if you begin using memcache on your staging app, be sure to install it on your production app before you deploy your new code.
For more details
http://jqr.github.com/2009/04/25/deploying-multiple-environments-on-heroku.html
http://stackoverflow.com/questions/1279787/staging-instance-on-heroku
Thursday, July 15, 2010
PHP For Android
Hi Friends,
PHP For Android project was launched recently and the complete information available in phpclasses.org site in the form of interview with the inventor. The information url: http://www.phpclasses.org/blog/post/125-Developing-PHP-applications-to-run-natively-on-Android-phones.html
PHP For Android project was launched recently and the complete information available in phpclasses.org site in the form of interview with the inventor. The information url: http://www.phpclasses.org/blog/post/125-Developing-PHP-applications-to-run-natively-on-Android-phones.html
Wednesday, July 14, 2010
Free online php code encryption
If you want to encrypt your source to avoid others to modify your code and stealth your code try this one.
http://www.byterun.com/free-php-encoder.php
http://www.byterun.com/free-php-encoder.php
Easy Drupal version upgradation
The standard to upgrade your drupal application is download the latest version from drupal.org and follow the instructions from UPGRADE.txt file.
Some information regarding version upgrade for drupal is avalible here : http://fuerstnet.de/en/drupal-upgrade-easier
And for quality assurance testing find the information here: http://qa.drupal.org/
Some information regarding version upgrade for drupal is avalible here : http://fuerstnet.de/en/drupal-upgrade-easier
And for quality assurance testing find the information here: http://qa.drupal.org/
Agile method in software development
Agile method is nothing but building software with incremental or interactive work strategies known as sprits i.e building application by involving number of people or teams and push the work into public when considerable amount of work done. And can be able to roll back to any previous version of the application if found any thing wrong or unhappy with the new version of the appliction when some one or team push their work recently.
This approach is the better one when compare to waterfall, or traditional sequential development.In older days A project could be developed much like an automobile on an assembly line, in which each piece is added in sequential phases. This means that every phase of the project must be completed before the next phase can begin. Thus, developers first gather all of a project's requirements, then complete all of its architecture and design, then write all of the code, and so on.
In this scenario, If any thing went wrong in the development stage, can't revert it back and company has spent time and money to create a software that no one wants.
Whereas agile methodology helps a lot to the interactive development mode.
This approach is the better one when compare to waterfall, or traditional sequential development.In older days A project could be developed much like an automobile on an assembly line, in which each piece is added in sequential phases. This means that every phase of the project must be completed before the next phase can begin. Thus, developers first gather all of a project's requirements, then complete all of its architecture and design, then write all of the code, and so on.
In this scenario, If any thing went wrong in the development stage, can't revert it back and company has spent time and money to create a software that no one wants.
Whereas agile methodology helps a lot to the interactive development mode.
Build IPhone native appliactions with PHP or Ruby code
If you wanna develop IPhone native applications and don't have the time to learn completely new language i.e Objective - C, Now it is possible for the PHP and Ruby developers. By using one third party service you can write code in either PHP or Ruby and build native IPhone application also can use Html and CSS for UI Design.
You can download the source from here : http://www.appcelerator.com/
Other available tools to develop Iphone and wap applications.
You can download the source from here : http://www.appcelerator.com/
Other available tools to develop Iphone and wap applications.
Build smartphone applications using Rhodes framework
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/
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/
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.
Subscribe to:
Posts (Atom)