Lab Tips


Hits: 2828  

Database:
1. Delete all information from databse related to, if deleting user or any content from CMS.
2. Use PDO, ADO, Pear, Zend etc. library to connect to database.
3. Take regular backup for database.
4. Use better naming convension.

Folders:
1. Use better naming convension.
2. Take regular backup for folders.
3. Protect project’s folder to unauthorized access, just put index.html or use apache security.
4. Folder name are case sensitive on servers like linux.
5. Don’t use 0777 permission on any folder use 0755.

Files:
1. Use better naming convension.
2. Use better documentation for web files, apply comments for coding and indent it.
3. Make consistency in DB, Filesnames, Variables, Page design.
4. Take regular backup for files.
5. Use caching for file to make site speed more fast.
6. Create debug files .txt, .log, .html etc. (fopen() | fwrite()) for tracking logical bugs.

Images:
1. Use version number in image URL to avoid image caching.
(<img src=”san.jpg?ver=123″ alt=”san” />)
2. Images should have Etags, Max Age and far future expired header for caching.
3. Use a global funtion to display images ( draw_images($src, $attr); )

Class:
1. Use better naming convension.
2. Use encryption class (md5, sha, base64 etc. with salt) for storing password and important data into database.
3. Spidering web page (Curl, Pear etc.) is used for getting content of web page.

Functions:
1. Use function or include files for multiple use of web data to make reusability, integrity and productivity.
2. Use PHP session ID, remote IP and page name on increment views/hits.
3. Make function to load CSS, JS, Links, Forms & Elements, Images, Iframes etc. on webpage. (load_css_file(), load_js_file()….)
4. Looping should be start from Left to Right…

Variables:
1. Use better naming convension.
2. Use defined variables/constants for folder names, DB table names, Files and global variables (avoid hard coding, be happy coder).

CSS:
1. Avoid inline CSS on pages because it effect the page load time & speed also it matter in W3C validation.
2. Combine multiple CSS file in a single file with cached version.
3. Avoid conflict in CSS.
4. Avoid CSS expressions.
5. Use CSS Sprite for images.

JS:
1. Avoid inline JS on pages because it effect the page load time & speed also it matter in W3C validation.
2. Combine multiple JS file in a single file with cached version.
3. Use valid syntax for browser checking in javascript.
4. Avoid duplicate JS function.

Ajax:
1. Minimize the errors in HTML closing tags etc.
2. Use proper hyrarchy for HTML tags.
3. Use Math.random() in Ajax URL as parameter.
4. Send URL as parameter after encodeURIComponent() similar to urlencode() in PHP.
5. Use file_get_contents($url) for first time filling Ajax DIV.
6. Use new window to display javascript alert debug messages as append messages in log files.
7. Use Ajax Cached version.

WebPage:
1. On login page username/password should be case sensitive.
2. Open terms of use page in popup window on registration page.
3. Use better UI for Errors/Success messages.
4. Use cancle button near submit button.
5. Use captcha code on pages by session value to avoid Spams.
6. Put valid ALT values in IMG tags.
7. Use Enter button event on form’s submit control.
8. Use scrolling DIV on webpages for better GUI.
9. Use returnto parameter for redirecting page after login.
10. Use remember option on login page.
11. Use valid/correct statements in error/success/warning messages.
12. Use dynamic Title and Meta tags on page.
13. Use error pages like 404, 500 etc. by .htaccess
14. Use good NO/Blank image for image not found.
15. Use htmlspecialchars() in strings displayed on webpages for W3C validations.
16. Use favicon for webpages for better GUI.

Emails:
1. Use good words like Dear, Regards, Thanks etc. in emails.
2. Attach some links, images, videos etc. for proper understanding.
3. Use reference and ref. # in emails.

Tools:
1. Use IDE like APTANA, Dreamweaver, Zend Editor.
2. Use DW’s context menu for HTML/PHP code to avoid W3C errors/warnings.
3. Use FireFox plugins for development (Web Developer, Firebug, Scribefire, ColorZilla, FireFTP, S3Fire, ElastoFox, Gtalk, GrabScreen, YSlow, FireShot etc.) for site’s speed, performance and optimization.
4. Make sure we are using secure FTP, Email Client….
5. Command Line tools (putty, CMD etc.) are very good utilities for batch processes and large files.

Search:
1. View source and display function (echo, print etc.) are very useful for finding bugs and faults.
2. Try to search visual concept like jQuery, Ajax etc. on google images search engine.
3. Use google operator for getting better results.

Keep browsing, happy coding…………

Published by

Sandeep Verma

I’m an Entrepreneur. I’m proud to work as Blogger, LAMP Programmer, Linux Admin, Web Consultant, Cloud Manager, Apps Developer, Searcher. Concentrate > Observe > Imagine > Launch