Tuesday, July 29, 2008

Find syntax error without executing PHP file


Command to check PHP files for errors without executing

find /path/to/code -name *.php | xargs -n1 php -l




Wednesday, July 23, 2008

Thursday, July 10, 2008

Date Object in JavaScript

Date Object in JavaScript

Method Description
Date() Returns today's date and time
getDate() Returns the day of the month from a Date object (from 1-31)
getDay() Returns the day of the week from a Date object (from 0-6)
getMonth() Returns the month from a Date object (from 0-11)
getFullYear() Returns the year, as a four-digit number, from a Date object
getYear() Returns the year, as a two-digit or a three/four-digit number, depending on the browser. Use getFullYear() instead !!
getHours() Returns the hour of a Date object (from 0-23)
getMinutes() Returns the minutes of a Date object (from 0-59)
getSeconds() Returns the seconds of a Date object (from 0-59)
getMilliseconds() Returns the milliseconds of a Date object (from 0-999)
getTime() Returns the number of milliseconds since midnight Jan 1, 1970
getTimezoneOffset() Returns the difference in minutes between local time and Greenwich Mean Time (GMT)
getUTCDate() Returns the day of the month from a Date object according to universal time (from 1-31)
getUTCDay() Returns the day of the week from a Date object according to universal time (from 0-6)
getUTCMonth() Returns the month from a Date object according to universal time (from 0-11)
getUTCFullYear() Returns the four-digit year from a Date object according to universal time
getUTCHours() Returns the hour of a Date object according to universal time (from 0-23)
getUTCMinutes() Returns the minutes of a Date object according to universal time (from 0-59)
getUTCSeconds() Returns the seconds of a Date object according to universal time (from 0-59)
getUTCMilliseconds() Returns the milliseconds of a Date object according to universal time (from 0-999)
parse() Takes a date string and returns the number of milliseconds since midnight of January 1, 1970
setDate() Sets the day of the month in a Date object (from 1-31)
setMonth() Sets the month in a Date object (from 0-11)
setFullYear() Sets the year in a Date object (four digits)
setYear() Sets the year in the Date object (two or four digits). Use setFullYear() instead !!
setHours() Sets the hour in a Date object (from 0-23)
setMinutes() Set the minutes in a Date object (from 0-59)
setSeconds() Sets the seconds in a Date object (from 0-59)
setMilliseconds() Sets the milliseconds in a Date object (from 0-999)
setTime() Calculates a date and time by adding or subtracting a specified number of milliseconds to/from midnight January 1, 1970
setUTCDate() Sets the day of the month in a Date object according to universal time (from 1-31)
setUTCMonth() Sets the month in a Date object according to universal time (from 0-11)
setUTCFullYear() Sets the year in a Date object according to universal time (four digits)
setUTCHours() Sets the hour in a Date object according to universal time (from 0-23)
setUTCMinutes() Set the minutes in a Date object according to universal time (from 0-59)
setUTCSeconds() Set the seconds in a Date object according to universal time (from 0-59)
setUTCMilliseconds() Sets the milliseconds in a Date object according to universal time (from 0-999)
toSource() Represents the source code of an object
toString() Converts a Date object to a string
toGMTString() Converts a Date object, according to Greenwich time, to a string. Use toUTCString() instead !!
toUTCString() Converts a Date object, according to universal time, to a string
toLocaleString() Converts a Date object, according to local time, to a string
UTC() Takes a date and returns the number of milliseconds since midnight of January 1, 1970 according to universal time

Tuesday, July 8, 2008

String Object in JavaScript

String Object in JavaScript

var str="Hello world!";

To get length of a string
var str_len = str.length;

To style strings
var str_big = str.big();
var str_small = str.small() ;
var str_bold = str.bold() ;
var str_italic = str.italics() ;
var str_blink = str.blink(); //(does not work in IE)
var str_fixed = str.fixed() ; //Displays a string as teletype text
var str_strike = str.strike() ;
var str_fc = str.fontcolor("Red") ;
var str_fs = str.fontsize(12) ;
var str_lc = str.toLowerCase() ;
var str_uc = str.toUpperCase() ;
var str_sub = str.sub() ;
var str_sup = str.sup() ;
var str_link = str.link("http://www.w3schools.com");

To get position of the first occurrence of a specified string value in a string
var str_pos = str.indexOf( "o" );

The lastIndexOf() method returns the position of the last occurrence of a specified string value, searching backwards from the specified position in a string.
var str_pos = str.lastIndexOf( "o" );

To use the match() method to search for a specified string value within a string and return the string value if found
var str_match = str.match( "world!" );

To use the replace() method to replace some characters with some other characters in a string.
var str_replace = str.replace( /world/, "JavaScript" );

The search() method is used to search a string for a specified value.
var str_search = str.search( /world/ );

The concat() method is used to join two or more strings.
var str_concat = str.concat("welcome", "to", "JavaScript");

The anchor() method is used to create an HTML anchor.
var str_anchor = str.anchor( "anchorName" );

The charAt() method returns the character at a specified position.
var str_charat = str.charAt( 1 ); //H

The charCodeAt() method returns the Unicode of the character at a specified position.
var str_charcode = str.charCodeAt( 1 ); //101

The fromCharCode() takes the specified Unicode values and returns a string.
var str_fromCharCode = String.fromCharCode( 72,69,76,76,79 ); //HELLO

The slice() method extracts a part of a string and returns the extracted part in a new string.
var str_slice = str.slice( 6 );

The split() method is used to split a string into an array of strings.
var str_split = str.split( " " );

The substr() method extracts a specified number of characters in a string, from a start index.
var str_substr = str.substr( 3 );

The substring() method extracts the characters in a string between two specified indices.
var str_substring = str.substring( 3 );

Thursday, July 3, 2008

Technical Books...!!!

Some useful technical books

http://docs.rinet.ru/

Wednesday, July 2, 2008

Regular Expression Patterns Examples

Regular Expression Patterns Examples...

http://regexlib.com/DisplayPatterns.aspx