Developer Blog

You are currently browsing the ash.MVC Blog weblog archives for November, 2006.


Archive for November, 2006

Why a web page needs to be XHTML & CSS validated?

Saturday, November 11th, 2006

While developing a web page, we normally go for XHTML (preferably, Strict 1.0)  & CSS2 validation. This is due to the following reasons:

  • All browsers are competing to comply to the W3 standards. Suppose, for example, an updated version of a browser is released. Our web page may not look as expected if the page does not comply to w3 standards. If we have validated it then it will look fine in the new versions of browsers without making any further changes to the source code.
  • There are lot of browsers in web world. While developing a web page we don’t get chance or time to test our pages in all browsers. But if we have made our page XHTML & CSS validated then we can well be assured that the web page will retain most of its original look & feel in all browsers.
  • Search bots find complied (or validated) pages easy to index.

We can check our web page against XHTML validation at:

  1. XHTML: http://validator.w3.org/
  2. CSS: http://jigsaw.w3.org/css-validator/

 

Underline on mouse rollover

Wednesday, November 8th, 2006

Underline on mouse rollover

There are two ways of achieving this functionality

1. Javascript
2. CSS

Javascript:
By using “onmouseover” and “onmouseout” events which calls two user defined functions “blockStyle(’param’)” and “displayStyle(’param’)”,where param is a unique id for that hyperlink when the event occurs.
Eg. <a onmouseout=”blockStyle(’link’)” onmouseover=”displayStyle(’link’)” href=” ” mce_href=” ” >click here</a>

CSS:
By using hover.
Write this source code in the css file.
 a:hover
 {
      text-decoration:underline;
  color: blue;
 }
This above code will affect all the hyperlinks(anchor tag) in the same webpage.

Trim function applied to Javascript

Monday, November 6th, 2006

The following code will help to apply “Trim” function in javascript. Here is an example where we are retriving data from a prompt message box then applying “Ltrim” & “RTrim” like functions. 

var sData = prompt(”Enter The Name”,”");           // Receives data from user
 var sLeft = /\s*((\S+\s*)*)/;
 var sRight = /((\s*\S+)*)\s*/;
 sData = sData.replace(sLeft, “$1″);              // Removes blank spaces from left
 sData = sData.replace(sRight, “$1″);           //  Removes blank spaces from right

Time calculation of various Timezones

Monday, November 6th, 2006

function calcTime(sCity, offset)
{

    // create Date object for current location
    d = new Date();
   
    // convert to msec
    // add local time zone offset
    // get UTC time in msec
    utc = d.getTime() + (d.getTimezoneOffset() * 60000);
   
    // create new Date object for different city
    // using supplied offset
    nd = new Date(utc + (3600000*offset));
   
    // return time as a string
    sDateTime = nd.toLocaleString();   // It is total datetime format
    
    document.write(sCity+” : “+sDateTime);    
   
}

// Set the time for countries
calcTime(’London’, ‘+0.0′);              // ‘+0.00′ is the standard timezone of London
calcTime(’Sydney’, ‘+10.0′);
calcTime(’New York’, ‘-5.0′);

Refresh the parent browser when the popup is closed

Monday, November 6th, 2006

When you click on a hyperlink on the popup window the popup closed & the parent window needs to be refreshed.

 To satisfy this need you have to write the following code in the hyperlink (”close window”) of popup window.

javascript:self.close();         // closes the current window (Popup).

opener.location.reload();     // Reloads the content of the parent window.

Security in PHP Applications

Sunday, November 5th, 2006

Some of the important links are:

  1. http://phpsec.org/ – PHP Security Consortium
  2. PHP Security Mistakes
  3. PHP Security
  4. Top 7 security Blunder while using PHP

First one is the most important one.

Programming Mistakes And Avoid Them

Sunday, November 5th, 2006

Three important articles:

  1. http://www.zend.com/zend/art/mistake.php
  2. http://www.zend.com/zend/art/mistake1.php
  3. http://www.zend.com/zend/art/mistake2.php

 

MVC for ash.MVC

Sunday, November 5th, 2006

Adopting MVC, Model-View-Controller, to create a PHP programming framework always looks straight-forward. It is a successful design pattern (a set of general rules regulating the program design and implementation process to achieve a programming task). Again, the design of PHP language encourages MVC pattern — look at the documents at http://www.zend.com/php5/zend-engine2.php for further details. So, we adopt MVC – it is as simple as that.

RBAC Helps!

Sunday, November 5th, 2006

RBAC stands for Role-Based Access Control. The basic concept of the scheme is that it separates user’s attributes (roles) and user’s action of the system (actions/methods). In the whole process, the attributes are independently bound to a set of privileges of the system or application.

The PHP Development Tools

Sunday, November 5th, 2006

UML Design:
There are two excellent freewares:Dia: http://www.gnome.org/projects/dia/This program helps in drawing class diagrams and has an extension to convert the class diagram into PHP code. However, the drawing functionality of this tool is very much limited to class diagrams.
The other is AgroUML: http://argouml.tigris.org/

Database Design and Administration:
DB Designer: http://www.fabforce.net/dbdesigner4/
This tool is indispensable for database modeling and maintenance. The database structure and schema can be designed and exported into MySQL DB. The existing database tables can be imported into this tool too. The saving format is XML.
Other is the very popular PHPMyAdmin. The latest version offers many good features like stability in import and export functions and documentation and indexing utilities.
MySQL AB also offers an utility for MySQL database administration; but it’s not stable as it’s an ALPHA release. The features looks promising however!

Unit Testing in PHP:
http://phpunit.sourceforge.net/
Another hyperlink provides comprehensive details on the unit testing with PHP source code: Simple Test

Documentation:
PHP Documentator: http://www.phpdoc.org/
This tool provides documentation tool for PHP source codes. This is also used to document Pear classes.
A browser framework called PHPOBrowser (http://gogogadgetscott.info/computers/scripts/phpob.php) is used to scan the PHP classes and other source code in an aplication.

Editors:
There is studio application to develop large PHP applications. The leading one among them is Zend studio. Apart from this, there are good text editors like Crimson Editor (http://www.crimsoneditor.com/) and Vim - a GUI variant of most powerful text editor (http://www.vim.org/).

Ion Cube PHP Accelerator: http://www.php-accelerator.co.uk/
This tool is used for improving performance of PHP systems.

Bug Tracking: Mantis (http://www.mantisbt.org/)

Job Scheduler: http://www.thedemosite.co.uk/phpjobscheduler/
Cron job handler through PHP Script

NOTE: The software, documentation for each of the above is available on the corresponding Web site.

Get Download Files Review Project Dashboard Know Plan And Wishlist