3 JavaScript Regular Expression for Malaysia Data Format

Share

Question

Can you share with us the proper Regular Expression (RegExp) for Malaysia’s data format as the following:

  • Identification Card
  • Postcode
  • Phone Number

[Click here to read more...]

Copying JavaScript Object Without Adding Reference

Share

Question

How to copy a JavaScript Object without adding the reference to the object it copy from? For example:

var user = {
	name: "Mior Muhammad Zaki",
	age: 25
};
var programmer = user;
programmer.language = ["PHP", "MySQL", "JavaScript"];
alert(user.language);
// return ["PHP", "MySQL", "JavaScript"] (when expect undefined)

[Click here to read more...]

Combining Multiple Table Columns in MySQL

Share

Question

How to combine address1, address2, address3 and address4 in the following table to a single column such as address?

CREATE TABLE user (
`id` INT NOT NULL AUTO_INCREMENT ,
`name` VARCHAR( 255 ) NOT NULL ,
`email` VARCHAR( 255 ) NOT NULL ,
`address1` VARCHAR( 100 ) NOT NULL ,
`address2` VARCHAR( 100 ) NOT NULL ,
`address3` VARCHAR( 100 ) NOT NULL ,
`address4` VARCHAR( 100 ) NOT NULL ,
`postcode` VARCHAR( 6 ) NOT NULL ,
`state` VARCHAR( 100 ) NOT NULL ,
PRIMARY KEY ( `id` )
) ENGINE = MYISAM;

[Click here to read more...]