Monday, May 23, 2016

How to put Bootstrap icon in ASP.NET button?

The HTML code is like this:

<a class="quick-btn" href="#">
   <i class="fa fa-plus-square fa-2x"></i>
   <span>New Job</span> 

But I would like to use ASP.NET buttons instead of using HTML.
I found this solution, with using ASP.NET LinkButton.

<asp:LinkButton ID="lbtnNewJob" 
        CssClass="quick-btn" onclick="lbtnNewJob_Click">New <br />Job
        <span aria-hidden="true" class="fa fa-plus-square fa-2x"></span>

Monday, May 16, 2016

Error from mySQL: ERROR 1820 (HY000): You must reset your password using ALTER USER statement before executing this statement

I got this error when I was trying to use the mySQL command line. I can't even show my databases, because I was asked to reset my password.

I got this error earlier when I was connecting to mySQL using Visual Studio, and I did reset my password. I do not know why I got this again when I am using mySQL command line. I just searched for how to reset password, and it works fine again.

This is how to reset password in mySQL:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPass';
Reference: MySQL Reference Manual - How to reset root password?

Tuesday, April 5, 2016

How to align the button on the right in bootstrap?

This is something I always like to do, aligning to right or center.

With bootstrap, it's so much easier now.

<div class="row text-right">
    <div class="col-md-12 col-sm-12 col-xs-12">
        <asp:Button ID="btnAddNew" runat="server" 
CssClass="btn btn-success" 
            Text="Add New Member"></asp:Button>


If you want to centerize the button, just change the class to text-center instead of text-right.

Formatting your code in Blogger post

I always write some codes in Blogger post, but since it's not supported, the codes are not shown.

I finally took some time to go and find how I can achieve this, and I think does a good job.
It's simple to use and nice to see as well.

It's a simple page, but does a very good job.

Just copy and paste your code in the left section, choose your language and click "Hightlight!"
Then just copy the HTML codes in the right section and paste it in your Blogger post.

Just go to

What is your favorite tool or way to format your codes in the blog posts?

How to add a vertical blank space in bootstrap?

I am now using bootstrap framework for my web design. It really helps me a lot in front-end design. There are so many useful components, but if I didn't know about them, it'd take me lots of time to trying to do it myself or digging for it. So, I think it's good for me to write down what I have learned and found useful, even though a very simple tiny thing.

I was just looking for how to do this: add a vertical blank space.

I usually just use <br/> or sometimes <p>&nsbp;</p>

I am sure there's a simpler and better way to do so. I searched for it, and I decided to use this:

<div class="help-block"></div>

Saturday, February 20, 2016

Favicon not showing?

I am not sure why sometimes the favicon is not showing properly, or still using the old one even I have changed it. I am not sure if it's related to the cache issue, but I still couldn't get it right even if I have cleared the cache.

I had this issue when I am using an icon file with this code:

I changed it to PNG file, then it's fine. So, I just use the PNG file instead.

Monday, February 15, 2016

How to upload website to the server

After creating the website or application in my computer, I'd always like to upload it to the server, so I can demonstrate it to others before it is officially launched.

This is how I created a demo website:

1) Login to your control panel.

2) Select Web, then Web Sites.

3) You can create New Web Site if you want to or you can also create new virtual directory if you are parking the website under the existing website.

4) Copy the project or website folder into "wwwroot" folder under the existing website. (I prefer to use FileZilla to upload or download files)

5) To create a new virtual directory, click on the existing website in step 3, and click on "Create Directory".

6) Enter the Directory Name and select the Folder you just uploaded to the server, and click on "Create Directory".

7) Once you have successfully created the virtual directory, you can set the properties.
I usually change the Default Documents to my home page.

8) Once you have done, click Update. Then the demo site is ready to run!

Wednesday, May 27, 2015

Basic Sql Statements for MySQL

These are some basic Sql Statements I have used to work with MySQL database:

To insert new column in an existing table:

To add a column with data type equivalent to nvarchar in MSSQL
ALTER TABLE users ADD remarks varchar(1000) charset utf8;

To add a column after a specific column
ALTER TABLE users ADD status tinyint AFTER name;

To add a column at the first place

To delete a column from an existing table:


To rename a column from an existing table:


To delete a record from an existing table:


Saturday, May 23, 2015

Remember to include MySql.Data.dll

After I have uploaded the files to server, created the database and tables, when I accessed the website, I got the following error:

"Could not load file or assembly 'MySql.Data, Version=, Culture=neutral, PublicKeyToken=c5687fc88969c44d' or one of its dependencies. The system cannot find the file specified."

1. Go to the project.
2. Go to Reference folder, select MySql.Data.
3. Select True for Copy Local.
4. Then copy the bin folder (MySql.Data.dll is included) over to the server.

How to create table in server using script

I just learned how to create tables from scripts. This is really much faster to do.

1. Open Visual Studio, expand Server Explorer, and connect to MySQL database.

2. Right click on the table which you wish to generate the script, select Generate Table Script.

3. Copy the script to a text file, and save the script with extension .sql.

4. Go to phpMyAdmin.

5. Connect to the database and click on Import on the menu.

6. Choose the script file and click Go.