Posts

Showing posts from 2010

XML Syntax Rules

XML Syntax Rules The syntax rules of XML are very simple and logical. The rules are easy to learn, and easy to use. 1.      All XML Elements Must Have a Closing Tag In XML, it is illegal to omit the closing tag. All elements must have a closing tag: <p>This is a paragraph</p> <p>This is another paragraph</p>   2.      XML Tags are Case Sensitive XML tags are case sensitive. The tag <Letter> is different from the tag <letter>. 3.      XML Elements Must be Properly Nested In XML, all elements must be properly nested within each other: <b><i>This text is bold and italic</i></b>   4.      XML Documents Must Have a Root Element XML documents must contain one element that is the parent of all other elements. This element is called the root element. <root>   <child>     <subchild>.....</subchild>   </child> </root>   5.      XML Attrib

PHP: setters and getters

/* * PHP: Using setters and getters * This clsss will show the usage of PHP setters and getters * */ class Employee { //This is private, so this can't be accessed from out side the class. private $name = "Dantha Elvitigala"; //public function.this can be access from outside the class //it's used to set the employee name into variable $name public function setName($name){ $this->name= $name; } //public function.this also can be access from outside the class //this use for get the emploee name stored in $name public function getName(){ return $this -> name; } }//end class //create an instant of the Employee class $employee = new Employee(); //set $name with another employee name $employee -> setName("Chandika Elvitigala"); // printout the employee name echo $employee->getName();

PHP arrays

* In PHP, there are three kind of arrays: * 1)Numeric array - An array with a numeric index * 2)Associative array - An array where each ID key is associated with a value * 3)Multidimensional array - An array containing one or more arrays 1)Numeric Arrays A numeric array stores each array element with a numeric index. There are two methods to create a numeric array. 1. In the following example the index are automatically assigned (the index starts at 0): $array1 = array(3,5,7,2); echo $array1[0]." "; $array2 = array(4,"dantha" ,"brown" ,array("x","y","z")); echo $array2[3][2]." "; $array2[3] = "Cat"; echo $array2[3]." "; 2. In the following example we assign the index manually: $cars[0]="Honda"; $cars[1]="Nissan"; $cars[2]="BMW"; $cars[3]="Toyota"; echo $cars[0]." and ".$cars[1]." are Japanese cars"; 2) ASSOCIAT

PHP Static modifiers

<?php // static modifier // with static methods you can't use $this // this : talking about current instance // self : talking about current class class Student{ static $total_students = 6; static public function add_students() { //here you can use either Student or self. //but self is better because it's inside the Student class. self::$total_students++;// self : talking about current class. } static function welcome_students($var="Hello") { echo "{$var} students"; } } //$student = new Student(); //$student-> total_students; // <- instance call echo Student::$total_students." "; // <- static call echo Student::welcome_students("Good bye")." "; echo Student::add_students()." "; //Student::$total_students = 1; echo Student::$total_students." "; /* -------- VERY IMPORTANT ---------- * static variables are shared throughout the inheritance tree * even if

Agile development

    http://www.agilemodeling.com/   http://en.wikipedia.org/wiki/Agile_software_development   10 Key Principles of Agile Software Development http://www.agile-software-development.com/2007/02/10-things-you-need-to-know-about-agile.html       Scrum Methodology http://scrummethodology.com/

JavaScript Comparison and Logical Operators

Comparison Operators Comparison operators are used in logical statements to determine equality or difference between variables or values. Given that x=5 , the table below explains the comparison operators: Operator Description Example == is equal to x==8 is false === is exactly equal to (value and type) x===5 is true x==="5" is false != is not equal x!=8 is true > is greater than x>8 is false < is less than x<8 is true >= is greater than or equal to x>=8 is false <= is less than or equal to x<=8 is true     Logical Operators Logical operators are used to determine the logic between variables or values. Given that x=6 and y=3 , the table below explains the logical operators: Operator Description Example && and (x < 10 && y > 1) is true || or (x==5 || y==5) is false ! not !(x==y) is true         Source: http://www.w3schools.com/js/js_comparisons.asp