Friday, July 30, 2010

Auto update Database from one server to another or developement database to live database

The below shell script will take the database backup and uploaded to the svn server. Call this script through cron job so that it will auto execute and send the dbbackup to the svn repo where ever you want. From svn you should auto deploy code to the sever, so run the cron tab in the target server and execute a script which empty the current database and update with this new one. Mostly usefull in while working with drupal, In drupal many things are stored in database instead of files, so that while you developing application, database also updated daily for each module addtion and upgradation etc., So developement database and live database are varies frequently. You can update the files easily using svn but can't update db because we don't know the every change in db while working. In this situation use the below shell script it will update the live database with your development database.

#!/bin/bash
#
# Configuration
#

# Database connection information
dbname="db_name"
dbhost="localhost" # leave as is unless have specific reason to change
dbuser="db_user"
dbpw="db_pass"

# Dump associated information
dump_directory="/path/to/sql/directory" # path to dump dir NO FILE NAME, note end slash
dump_name="dumpname.sql"
logfile=$dump_directory"dumpandcommitt.txt" # name of log file to use

#
# dump db and log on screen and in log file
#
cd $dump_directory
mysqldump --user=$dbuser --password=$dbpw --add-drop-table $dbname > $dump_name
echo " Dumped drupal database, using user:$dbuser; database:$dbname host:$dbhost"
echo " Dumped drupal database, using user:$dbuser; database:$dbname host:$dbhost" >> $logfile

#
# commit the newly dumped db - note you'll need to svn add to repository first before this will work
#
svn commit -m "auto committed db"
echo " Committed new db"
echo " Committed new db" >> $logfile

endtime=`date`
echo "Backup completed $endtime" >> $logfile

Save the above script as db_import_upload.sh
In terminal call as
$ ./db_import_upload.sh

Change mysql table storage engine

Using sql query:
ALTER TABLE products ENGINE = innodb

Using phpmyadmin (GUI) select the table and then do as below images



About Foxycart

Foxycart is a third party service which offer ecommerce solution for your products by just creating account in foxycart and small configurations. After that we should integrate simple form in our own application and submit product details to the foxycart. Then it will take care of the checkout and payment process and send back the transaction details as xml datafeed. And logged all errors and complete information, so that we can see them through foxycart admin section by login and can maintain multiple stores.
Features list: http://www.foxycart.com/features-of-web-20-seo-ecommerce.htm

Thursday, July 29, 2010

Puzzle




Can you find how many faces are there in this tree.

Detect website virus using firefug

Hi Friends,

If your website get attacked with virus, then you can detect it using the firefox's firebug addon. The common virus attack on websites are adding some unnecessary scripts or iframes within your source code. You can open the site and open the firebug and click on net tab. It will show the un related code in red color with border as show in the below image



Useful URLs for Drupal

Easy Version Control with Git
http://net.tutsplus.com/tutorials/other/easy-version-control-with-git/


http://drupal.org/node/670460

http://www.mig5.net/content/drupal-deployments-workflows-version-control-drushmake-and-aegir

Drupal Development Best Practices: Tools
http://www.chapterthree.com/blog/matt_cheney/drupal_development_best_practices_tools_part_i

Unit testing
http://www.lullabot.com/articles/introduction-unit-testing

Test driven development in drupal
http://groups.drupal.org/node/9412

http://drupal.org/project/drush_make

http://www.workhabit.com/labs/svn-repository-structure-drupal-projects

Deploy with capistrano
http://data.agaric.com/node/2682








Bookmarks

Bookmarks Menu


Recently Bookmarked
Recent Tags

Get Bookmark Add-ons

Ubuntu and Free Software links

Information and resources about Ubuntu, Debian and Free Software in general

Ubuntu
Ubuntu Wiki (community-edited website)
Make a Support Request to the Ubuntu Community
Debian (Ubuntu is based on Debian)

Mozilla Firefox

Help and Tutorials
Customize Firefox
Get Involved
About Us

jCarousel Lite
jCarousel Lite is a jQuery plugin that carries you on a carousel ride filled with images and HTML content. Put simply, you can navigate images and/or HTML in a carousel style widget. It is super light weight, at about 2 KB in size, yet very flexible and customizable to fit most of our needs.
nyroModal :: jQuery Plugin
jQuery UI - Dialog Demos & Documentation
jQuery UI is the official jQuery user interface library. It provides interactions, widgets, effects, and theming for creating Rich Internet Applications.
[SOLVED] strip out image attributes using preg_replace
[SOLVED] strip out image attributes using preg_replace
Home | 10.0.0.1
Resetting a forgotten MySQL root password
Tips for a Debian GNU/Linux System Administrator.
Wilderness | drupal.org
odd behavior when checking if radio button selected in jQuery - Stack Overflow
How to disable directory browsing , APACHE
Blue Flame | Drupal Themes by TopNotchThemes
Page overview with mission statement and three column layout, also content top regionAn alternate page layout, with single left sidebarLower regions, comments, and footer menu and messageHeader showing secondary links, as well as alternate layout with
Drupal Commans
http://localhost/drupal-moodle/course/10
Modules | Drupal Moodle Integration Demo
Using Rss
Overview of Google Reader and RSS

Bookmarks Toolbar

Add bookmarks to this folder to see them displayed on the Bookmarks Toolbar

Most Visited
Getting Started

Drupal

Using CVS to maintain a Drupal website | drupal.org
###Overriding themable output | drupal.org
How Drush Make Just Changed My Life | Drupaler | Drupal Blog, Collaborative Drupal Resource
This is a blog post about Drupal.
Drush - Drupal Shell utility | drupal.org
drush.ws | A command line shell and scripting interface for Drupal.
Customizing the login form | drupal.org
Customizing the login, registration and request password full page layout | drupal.org
Modifying Forms in Drupal 5 and 6 | Lullabot
How to theme a Drupal form | Open Data
####AJAX-ifying Drupal Node Forms | Stella's Website
####Features | drupal.org
Drupal - How to Theme CCK Input forms | Haro Street Media
Hottest 'drupal' Questions - Stack Overflow
Core templates and suggestions | drupal.org
Search config | drupal.org
Custom Search | drupal.org
#################Drupal Tutorial: Form Overrides and Element-Specific Validations | CHROMATIC
This step by step illustrated Drupal tutorial will teach you how to create custom form overrides and element-specific validations with Drupal 6.
###Custom role-dependent User Profies
####### Different Signups for Different Roles Auto Assign Role | drupal.org
Mastering Drupal
Starting Views 2 Documentation | groups.drupal.org
########15 Userful Views Module for Drupal - Ntt.cc
##########Views help index | Views online help
########Creating a module configuration (settings) page | drupal.org

New Folder

Comparison of Lightbox-type modules | drupal.org
Contributer stella | drupal.org

Latest Headlines

PHP

### Use the YouTube API with PHP
The YouTube video sharing site allows Web application developers to access public content through its REST-based developer API. The SimpleXML extension in PHP is ideal for processing the XML feeds generated by this API and using them to build customized PHP applications. This article introduces the YouTube Data API, demonstrates how you can use it to browse user-generated video content; access video metadata, comments and responses; and perform keyword searches.
How-To: Fix SimpleXML CDATA problem in php - Tech Thought
Developer's Guide: Data API Protocol – API Query Parameters - YouTube APIs and Tools - Google Code
Sky is not the limit...
Hacking SlideShare.net using PHP | The Storyteller

General

HowTo: Make Ubuntu A Perfect Mac File Server And Time Machine Volume [Update6] › Kremalicious
For quite some time I use my Ubuntu machine as a file and backup server for all Macs in my network which is perfectly accessible from the Finder in Mac OS X. There are some instructions available in the web for this task but all failed in my case so I wrote my own tutorial [...]
Ubuntu's two big advantages over Windows and Mac | ZDNet
There are two very important areas where Ubuntu Linux has significant advantages over both Windows 7 and Mac OS X. See what they are and join the disc
Useful Links | Stella's Website
### SlideShare » Developer Documentation

Jquery

Using jQuery with Other Libraries - jQuery JavaScript Library

Unsorted Bookmarks

http://10.0.0.1:6056/about

Using Drush to synchronize and deployment drupal sites

Hi Friends,

We can deploy drupal site with different stages like development, testing and production using drush (Drupal shell) and synchronize remote application with local development version.

Ex: drush sql-sync @dev @prod
The above command will Copy the DB defined in sites/dev to the DB in sites/prod.


More info.
http://drupal.org/node/670460
http://drupal.org/project/drush_make


Drush official website: http://drush.ws/

Other drupal useful development tools
http://www.mig5.net/content/drupal-deployments-workflows-version-control-drushmake-and-aegir
http://www.chapterthree.com/blog/matt_cheney/drupal_development_best_practices_tools_part_i

Unit testing
http://www.lullabot.com/articles/introduction-unit-testing

Tuesday, July 27, 2010

Artister - An automated web design tool for joomla, drupal and wordpress theming

Artisteer
It is the first and only tool for web design automation that creates fantastic eye appealing websites templates and themes for joomla, wordpress and drupal.

With Artisteer YOU immediately become a Web design expert, editing and slicing graphics, coding XHTML and CSS, and creating Web Design Templates, Joomla templates, Drupal themes,
Wordpress themes, DotNetNuke skins, and Blogger templates all in minutes, without Photoshop or Dreamweaver, and no technical skills.

Official website: http://www.artisteer.com

Xcloner - For backup and restore Joomla, Drupal, Wordpress and All PHP/Mysql Websites

Hellow friends,

Xcloner is a tool to backup and restore feature for Joomla, Dupal, Wordpress and all PHP/Mysql Projects. You should should like xcloner for wordpress etc., in google for more info.

For Wordpress
http://www.devplug.net/

For Joomla
http://www.joomlaplug.com/Documentation/XCloner_Documentation/XCloner_-_Standalone_Backup_and_Restore.html

Wordpress Vs Joomla Vs Drupal

WORDPRESS
It is just for blogging systems and few cms pages manage through WYSIWYG Editor without more complex form fields integration.

Wordpress Pros
* Simple to use - No need for modifications
* Excellent for blogging or sharing thoughts in a sequential manner
* Even the most elderly of users can get the hang of it quickly

Wordpress Cons

* Not developer friendly
* The community seems to like to complain
* Upgrades bring more bugs than fixes sometimes


# DRUPAL
It is for developers and can hand-code the content of your pages than use a WYSIWYG Editor, or if you enjoy tweaking the code that makes up the framework of a website, then Drupal is probably for you.

Drupal Pros

* Extremely developer friendly. If I loved code more I would almost always pick this system.
* Strong community to help discern the dozens (hundreds) of functions and tags available.
* Can be used to create some really awesome websites that can outperform a majority of other sites out there.

Drupal Cons

* Not very designer and user-friendly. It's hard for someone with little code knowledge to make the leaps required to do the very cool things that Drupal is becoming known for.
* Theming of Drupal has been a huge case of fail (until recently). Probably because it has been developers, not designers, that are making the themes.
* Getting a Drupal website published could cost you more time, and thus more money, than Wordpress or Joomla.


# JOOMLA
It is userfriendly for all type of people i.e designers, developers and admins. Where as it is not so powerful as compare to Drupal.

Joomla Pros

* Friendly for all types of users - Designers, Developers and Administrators
* Huge community is awesome for assisting with creation of websites
* Has been rapidly growing and improving itself for the past three years

Joomla Cons

* Still not user-friendly enough for everyone to understand
* Not quite as powerful as Drupal, and can be a bit confusing for some to jump into
* Recently rebuilt the entire system from ground-up, and so there are still many out there sticking to the old versions (1.0.x)


Drupal Modules: Drupal.org DrupalModules Best Modules BestRank Noupe Appnovation GUI Designer


Drupal Themes: Drupal.org Theme Garden FreeDrupalThemes ThemeBot Mulpo MogDesign GeekTip

Joomla Modules/Extensions: Joomla.org 10 Best Free Joomla21 AJAXLine evoHosts


Joomla Templates: Joomla.org BestofJoomla TemplateMonster Joomla24 Freetemplates Templates.com

Wordpress Plugins: WordPress.org SiteSketch WPHacks VisionWidgets Sadhas BestWordPressPlugins


WordPress Themes: WordPress.org bestwpthemes PageLines TopWPthemes Themes2WP LeVoltz


Ref: http://www.goodwebpractices.com/other/wordpress-vs-joomla-vs-drupal.html

Joomla Vs Drupal

Comparison between Drupal and Joomla

Use Joomla if you want to get nice looking site up quickly and can deal with a slower system, rigid content categorization and limited design/configuration options.

Use Drupal if you want high performance, scalability, good content management and significant design flexibility. But, be prepared to spend a lot of time/money to get the site to look professional.

When caching is disabled Joomla can serve 19 pages per second, while Drupal can serve 13 pages per second. Hence, Joomla is 44% faster than Drupal.

However, when caching is enabled Joomla can serve 21 pages per second, while Drupal can serve 67 pages per second. Here, Drupal is 319% faster than Joomla.

In other words, Joomla's cache system improves performance by 12%, while Drupal's cache system improves performance by 508%.

Monday, July 26, 2010

Important URLs for RoR Developement

Official Website
http://rubyonrails.org/

Great Start
http://www.akitaonrails.com/2007/12/12/rolling-with-rails-2-0-the-first-full-tutorial

Examples
http://www.tutorialspoint.com/ruby-on-rails/rails-examples.htm

Sample applications with basic features like authentication and admin features
http://www.railsinside.com/elsewhere/100-7-barebones-rails-apps-to-kick-start-your-development-process.html

Many to Many Relationship with Multi select control in rails
http://blog.coryfoy.com/2008/02/multiselect-control-in-rails-with-a-many-to-many-relationship/

Develop Facebook application
http://www.liverail.net/articles/2007/6/29/tutorial-on-developing-a-facebook-platform-application-with-ruby-on-rails

Use mysql_real_escape_string() function to avoid mysql injections

// Query database to check if there are any matching users
$query = "SELECT * FROM users WHERE user='{$_POST['username']}' AND password='{$_POST['password']}'";
mysql_query($query);

// We didn't check $_POST['password'], it could be anything the user wanted! For example:
$_POST['username'] = 'admin';
$_POST['password'] = "' OR ''='";
// This means the query sent to MySQL would be:
echo $query;
?>

The query sent to MySQL as:

SELECT * FROM users WHERE user='admin' AND password='' OR ''=''

This would allow anyone to log in without a valid password.


Solution:
// Query
$query = sprintf("SELECT * FROM users WHERE user='%s' AND password='%s'",
mysql_real_escape_string($_POST['user']),
mysql_real_escape_string($_POST['password']));
?>
Here mysql_real_escape_string function prepends backslashes to the following characters: \x00, \n, \r, \, ', " and \x1a to make data safe before sending a query to MySQL. So user can't hack your database.

Friday, July 23, 2010

Wordpress Vs Drupal

Hi, here is my view about where to use wordpress and where to use drupal.

Wordpress
# If your application doesn't contain so many dynamic content forms and have to manage some static pages of information and need a bloging system.

It should suitable company portfolio sites and simple to medium level websites.

Drupal
# If you have multiple dynamic content types (press releases, news articles, blog posts, etc.). Drupal is great at allowing you to create this stuff on the fly, with Wordpress you are hacking things together.
# If your site has more than a two template design structure (homepage and second levels).
# If you have numerous content blocks on the homepage or in sidebars that you will be editing frequently. Drupal’s block system is great at this kind of stuff.
# If you are trying to start small and expect your site to add tons of features/content moving forward.
It should suitable for complex websites which involves so many modules.

How to get driving licence in Andhra Pradesh

The procedure to obtain a Driving License is simple. Follow the below mentioned steps.

Normally this is the process in any State across India. Well, Few Road Transport Authorities (RTA's) could be working as per the local governments periodic regulations.

1. Buy the Learning Licence Forms. These are Form 2, Form 1 & Form 1A(Form 1A is for people aged above

40 years and also depends if your RTA needs it). These forms are available in single click at www.drivingtest.in. Copy or Click the following link and try.

http://drivingtest.in/rta-forms.php

2. Once you are done with filling up of forms, find out with the Road Transport Authoritie’s office, if you have to book a slot for your learners license test. In Andhra Pradesh, one has to book the slot and then practice the questions to clear the test. In Andhra Pradesh the slot can be booked at the link below.

Visit :-

http://www.delhi.gov.in/wps/wcm/connect/doit_transport/Transport/Home/Driving+Licence/Learner+Licence(For Delhi)

http://rto.kar.nic.in/ (click on 'online appointment for LL' for Karnataka)

http://cfst.co.in/cfstonline/LL/TestCenter.aspx (for Andhra Pradesh only)

3. Once the slot is booked, you need to prepare for the online learners licence test which comprises of 20 questions (For Andhra Pradesh). In other cases, walk in to RTA office and pay fee and wait for your turn. The passing mark is 16 where each question carries 1 mark for AP. The number of questions may vary from State to State, however, the questions in this website are the ones normally in the syllabus. In order to practice online you may visit the following link. There are about 250 questions in this website and 10 are free sample learners licence questions. Register to access all the Driving Licence questions.

http://www.drivingtest.in/online-driving-license-sample-test.php

4. To get a hint on the road signs and the traffic signs go to

For knowing all the Traffic Signs http://www.drivingtest.in/road-signs.php

To know about driving tips etc http://www.drivingtest.in/resources.php

5. Once you clear your learners license, you may book a slot for the permanent licence (This is in case of Andhra Pradesh) on the same website as stated above. For other states call the RTA office to find out the availability
of track to be tested for the permanent License. While learning to drive a two wheeler or a four wheeler, kindly keep the road safety and its structure in mind. Read the signs in practical driving test carefully. For further driving tips click on the following links.

http://www.drivingtest.in/driving-tips.php

http://www.drivingtest.in/road-marking.php

http://www.drivingtest.in/offences-penalties.php

Restart live server for your rails application

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

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.
?>

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/

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.

Monday, July 19, 2010

(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

Wednesday, July 14, 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

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

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/

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.

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.

Tuesday, July 13, 2010

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/

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

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

Tuesday, July 6, 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/

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

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/

Monday, July 5, 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).