Tuesday, March 31, 2009

How to install Skype on a Canadian iPhone/iPod touch

- Open iTunes, go to iTunes Store, scroll to the bottom and change "My Store" to USA

- Get a coupon code from http://www.tunecore.com/freealbum for free

- Redeem it in the "Quick Links" section of the iTunes Store home page

- Create a new account and select "None" to skip the credit card information and make up some address in the US

- Search for Skype, download it and sync your iPhone/iPod touch


Thanks to JP from http://www.slaw.ca/2009/03/31/no-skype-for-iphone-in-canada/

Friday, March 20, 2009

How to duplicate a MySQL database

Let's say the original database is db1 and the duplicate is db2

- Create a new database, db2
- Run this command:
mysqldump -h [server] -u [user] -p[password] db1 | mysql -h [server] -u [user] -p[password] db2


Note: there is no space between -p and the password.

Done!

Monday, December 15, 2008

Stupid TV!

Thursday, November 20, 2008

Where's the Love?

Wednesday, November 12, 2008

Microsoft Ergonomic Keyboard 4000 & Logitech TrackMan Wheel

100_1632 [800x600] 100_1619 [800x600] 100_1624 [800x600] 100_1627 [800x600]100_1629 [800x600]100_1630 [800x600]

Tuesday, November 11, 2008

Part V: Web Pages

Now that we have the classes ready let's create the web pages and finish up this project.

We'll start with the categories page, create a new web form and uncheck the "Place code in separate file" check box, call it "Categories.aspx"

The page has a grid view control and an object data source control. The grid view has template fields for viewing, editing and adding items. The object data source points to the category class and its methods.

The view and edit are handled by the object data source and grid view but he insert command needs some extra code. Here the code to add a new category:

<script runat="server">
    protected void btnAdd_Click(object sender, EventArgs e)
    {
        TextBox title = grdCategories.FooterRow.FindControl("txtTitleAdd") as TextBox;

        odsCategories.InsertParameters["title"].DefaultValue = title.Text;
        odsCategories.Insert();
    }
</script>

I have the text field at the footer of the grid view so the first line creates a new field pointing to the grid view field, the second line gets the field text value and the third line inserts the category into the table.

The same concept is applied to the bookmarks page. Create a new web form, uncheck the box and call it "Default.aspx", calling it default to be the startup page.

Here's the add button code:

protected void btnAdd_Click(object sender, EventArgs e)
{
     TextBox title = grdBookmarks.FooterRow.FindControl("txtTitleAdd") as TextBox;
     TextBox url = grdBookmarks.FooterRow.FindControl("txtUrlAdd") as TextBox;
     DropDownList categoryId = grdBookmarks.FooterRow.FindControl("ddlCategoriesAdd") as DropDownList;

     odsBookmarks.InsertParameters["title"].DefaultValue = title.Text;
     odsBookmarks.InsertParameters["url"].DefaultValue = url.Text;
     odsBookmarks.InsertParameters["categoryId"].DefaultValue = categoryId.SelectedValue;
     odsBookmarks.Insert();
}

A bookmark has a title, url and a category id. The first three lines create the fields we need to get the values of the new bookmark. The next three lines sets the parameter values and the last line insert the record into the bookmark table.

The complete code can be found here:
Categories.aspx
Default.aspx

If the code doesn't show up then view the source code of the page.

I didn't get into the grid view asp and html code because the main goal of this tutorial is how to use .NET with MySQL. I hope this tutorial will help get started. Have a look at the grid view code, it's quite interesting what you can do with this powerful control.

Monday, November 10, 2008

Family Guy - Visiting Ground Zero