FEBRUARY 12TH, 2009
By MOHAMMAD SAJJAD HOSSAIN
Sometimes we need to reverse engineer our database. Microsoft Visio has an option for reverse engineering. But by default it does not support MySQL or in other words you cannot reverse engineer a MySQL database. I have faced this problem and got the solution and sharing here with you.

The steps involved in this process are described below:
- Download the latest MySQL ODBC connector from MySQL site. You may find it hereĀ http://dev.mysql.com/downloads/connector/odbc/5.1.html.
- After downloading install the connector.
- Now open Microsoft Visio and open Database Model Diagram template (you may find it under Software and Database group).
- From Database menu click on Reverse Engineer. You will see the Reverse Engineer wizard.
- Click on the New button.
- Select System Data Source.
- Click Next.
- Select MySQL ODBC driver from the list.
- Click Next and then Finish. MySQL Connector/ODBC Data Source Configuration window will open.
- Give a name to the datasouce, database server host, user name, password and select the database you want to reverse engineer. Remember, the list of database will be shown if you have provided correct information.
- Click on Ok. Now you will find the data source in Data Source list.
- Select the newly created data source and click Next. The regular wizard for reverse engineering will start.
NOVEMBER 1ST, 2008
By MOHAMMAD SAJJAD HOSSAIN
OCTOBER 31ST, 2008
By MOHAMMAD SAJJAD HOSSAIN
When working with JavaScript in one of my projects I needed to trim strings and pad them. I googled for a solution and many sources I have got the following codes and sharing with you.
Trimming:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
| //trimming space from both side of the string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
//trimming space from left side of the string
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
//trimming space from right side of the string
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
} |
//trimming space from both side of the string
String.prototype.trim = function() {
return this.replace(/^\s+|\s+$/g,"");
}
//trimming space from left side of the string
String.prototype.ltrim = function() {
return this.replace(/^\s+/,"");
}
//trimming space from right side of the string
String.prototype.rtrim = function() {
return this.replace(/\s+$/,"");
}
Using Trim Functions:
1
2
3
4
5
| //write the code given above
var str = " black ";
alert("a" + str.trim() + "b"); //result "ablackb"
alert("a" + str.ltrim() + "b"); //result "ablack b"
alert("a" + str.rtrim() + "b"); //result "a blackb" |
//write the code given above
var str = " black ";
alert("a" + str.trim() + "b"); //result "ablackb"
alert("a" + str.ltrim() + "b"); //result "ablack b"
alert("a" + str.rtrim() + "b"); //result "a blackb"
Padding:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
| //pads left
String.prototype.lpad = function(padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
}
//pads right
String.prototype.rpad = function(padString, length) {
var str = this;
while (str.length < length)
str = str + padString;
return str;
} |
//pads left
String.prototype.lpad = function(padString, length) {
var str = this;
while (str.length < length)
str = padString + str;
return str;
}
//pads right
String.prototype.rpad = function(padString, length) {
var str = this;
while (str.length < length)
str = str + padString;
return str;
}
Using Padding Functions:
1
2
3
| var str = "5";
alert(str.lpad("0", 5)); //result "00005"
alert(str.rpad("0", 5)); //result "50000" |
var str = "5";
alert(str.lpad("0", 5)); //result "00005"
alert(str.rpad("0", 5)); //result "50000"