Wednesday, December 19, 2007

Hype of Windows OS 7 started!

While the developments of Windows OS 7 is still in infancy state, ppl have already started monitoring its development, as usual. More info at Of course, how can we forget the MinWin:

Wednesday, December 5, 2007

SQL Server 2008 introduces new data type : HierarchyId

I think this introduction of new data type is to help to re-construct the records back to hierarchical view easily (remember the "Using APPLY" sample that need to call the function recursively ?). With the syntax like GetAncestor(), GetDescendant(), IsDescendant() , etc, you can discover the level of the records easily (why it seems gearing towards CLR coding??).

There're few articles with samples:

  1. SQL Server 2008 - HierarchyID - Part I
  2. SQL Server 2008 - HierarchyID - Part II

The CTP version of MS SQL 2008 can be downloaded from here.

Friday, November 23, 2007

Make remote connection for MS SQL Express 2005

When one of my company's client uses the application that tries to connect to MS SQL Express 2005 in the main server that resides in LAN, he keeps receiving this error message:

An error has occurred while establishing a connection to the server. When connecting to SQL Server 2005, this failure may be caused by the fact that under the default settings SQL Server does not allow remote connections.

After a thorough search using Google, I found the MS SQL Express, Evaluation and Developer editions only allow to local connection, be default.

By setting the steps (from MSDN, using "SQL Server Surface Area Configuration") to allow it to make remote connection from remote PC, it works fines for some of the PCs only, using connection string likes:

Data Source=[pc name]\SQLEXPRESS; database=[database name]; uid=[user name]; pwd=[user password]

, when there's only MS SQL Express 2005 resides on PC.

But those PCs which have both MS SQL 2000 & MS SQL Express 2005 and the default instance is MS SQL 2000, it still hits the error message when I try to connect to MS SQL Express 2005:

SQL Server does not exist or access denied.
If connect to MS SQL 2000 using the IP, it works fine again. So I found the root cause again. This time the solution is from By giving the port number used by MS SQL Express 2005 to the connection string, it works and here are the steps:

1) Go to: All Programs>Microsoft SQL Server 2005>Configuration Tools>SQL Server Configuration Manager

2) Then under: SQL Server 2005 Network Configuration>Protocols for SQLEXPRESS

3) Double-click the "TCP/IP", under the "IP Addresses", find the "TCP Dynamic Ports".

4) Use the port number (I think port no. 1433 is used by default MS SQL instance) as part of the connection string likes:

Data Source=[pc name]\SQLEXPRESS, [port number] ; database=[database name =]; uid=[user name]; pwd=[user password]

5) Success!

Thursday, November 22, 2007

My CodeProject's article being referred!

While googling on other developers create clock application, I found my CodeProject's article being referred. :-) But it is only read 60+ times at the time of reading :-( . I think this read all the news (or RSS) from CodeProject and channel it to all their audience.

Anyway, I MUST continue to come out new application.

Wednesday, November 14, 2007

Which OS are You?

I just found this BBspot website. This is the result of the personality test:

You are Debian Linux. People have difficulty getting to know you.  Once you finally open your shell they're apt to love you.

Wah, there're few more test can be conducted :
Which File Extension Are You?
Which Nigerian Spammer Are You?
Which Programming Language Are You?
Which Website Are You?

Monday, November 5, 2007

Halo 3 Flash tour

I come across this Halo3 website and found interesting stuff! You can navigate in 3D environment. It's a good website for those avid gamers, before you play the game in XBox.
After entering your DOB,
You can choose to autoplay :Or you can browse with your mouse and keyboard.
And even better, you can take the screenshot at any point, and make it as your wallpaper.

Here's the one I made:

Thursday, October 25, 2007

My article published on CodeProject!

In order to boost the site-visit , I posted my old blog to CodeProject, haha. Thanks to the guys at CodeProject, to allow my article published, although it's a simple one. Hope can exchange valuable pointers with rest of the developers from all over the world.

p/s: My monitor have sent to repair, due to roof leaking. Got to post this blog using company's PC. Also not so free to develop new program or enhance existing article, sigh!

Wednesday, September 26, 2007

My first .Net app : C# Analog Clock

Finally, my first try on a simple .NET app is done. I created a analog clock widget using C#. I think it's quite challenging for a beginner because it will require simple background of Math, image processing, and 3D graphics programming.

With the mouse hit-test, anti-aliasing graphics and flicker-free double buffering, you couldn't even tell the difference between it and Sidebar gadget. Yet it is in C#, and it reduces the pain to deal with Win32 API directly.

To draw the hour-hand, minute-hand and second-hand needs a little trick.

1) Set the origin of form to center, from left-top (so that following rotation can be taken place)
2) Save the current state
3) Rotate the new graphics objects
4) Draw the second-hand (or any hands) at new origin, new orientation
5) Restore the saved state
6) Rotate the new graphics objects
7) Draw the minute-hand (or any hands left) at new origin, new orientation
8) Reload the identity / Reset the origin and orientation (Restore the saved state seems failed)
9) Rotate the new graphics objects
10) Draw the hour-hand (or any hands left) at new origin, new orientation

You can get the source here or get the exe here!

#p/s: thanks for the Fasticon for its free icon provided.

Tuesday, September 18, 2007

How to compete with Microsoft

I just happend to come across to this the Inquirer (It is famous of MS-bashing), ironic but true.

Plan B: Start by developing a killer ap. If you can't think of one, don't worry - simply write a copy of an existing piece of software. It doesn't even have to do anything. When people point out that your product is rubbish, issue a press release blaming Microsoft for refusing to give you its proprietary code for free.
If you persevere for long enough, you may even convince the European Union that your product would be a world beater if only those bastards at Microsoft would give you the code to make it work properly.

Monday, September 17, 2007

Wow, write an OS!!

While surfing on OSNews, I come across to this site. Know what, you also can write your own OS.

With the QEMU processor emulator, anyone one can write & test OS written. Start from doc here and here, now. I wish i could do it now, but not yet master ASP.NET, NET Framework, NET CF, ... , to name a few. OMG.

Sunday, September 16, 2007

Bumblebee I am?

While reading the Mike Hall's Windows Embeded blog, I also take part in the Which Transformer are you? quiz.
Haha, I get this:

Take the Transformers Quiz

But I still prefer the Bumblebee in the anime I watched during the time I was a kid.

Tuesday, September 11, 2007

SQL CE database upgrade

This blog will talk about SQL CE database upgrade.
Actually, SQL CE database upgrade is briefly discussed in BOL (Book On-Line). And this blog is just to fill the missing link.

Normally, You can create a brand new application to use .NET CF 2.0 & SQL CE 3.0. Then what's the big deal about the SQL CE database upgrade, you might ask. Well,What you actually face in real-life situation is you are .NET CF 1.0 & SQL CE 2.0 application developer. Due to performance issue (SqlCeResultSet Class) or new functionality that only available in SQL CE 3.0, you need to meet the new requirement yet need to maintain the records that already keep in existing SQL CE 2.0 database. You do not want to create a new SQL CE 3.0 database and import back all the records, ain't you? Then, this is where SQL CE database upgrade comes in.

How will one know the database file (*.sdf) is not workable in SQL CE 3.0 ? Simple, open it from MSSQL Management Studio (Sorry, you need full version to run it). If you see this message, clearly you need to upgrade your database.

Now I will show you how to upgrade it within the emulator environment, specifically for OS PPC 2003. It can be done in actual device in the similar way. First, copy all the cabinet files of SQL CE run-time components for SQL CE 2.0 and 3.0 into you emulator, using Windows CE Remote File Viewer. The default location of the SQL CE 2.0 run-time components is C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v2.0\[platform]\[processor] & the default location of the SQL CE 3.0 run-time components is C:\Program Files\Microsoft Visual Studio 8\SmartDevices\SDK\SQL Server\Mobile\v3.0\[platform]\[processor]. You also need a upgrade.exe. This files is located in the same folder with SQL CE 3.0 run-time components.

Then you need to download the Pocket Shell in Windows Mobile Developer Power Toys. It is the PPC version of you desktop command prompt. The default location is in C:\Program Files\Windows Mobile Developer Power Toys\PPC_Command_Shell\arm. Copy the console.dll to emulator's \WINDOWS directory and copy the shell to emulator root folder for less programming later.

So now you should have 5 cabinet files(,,,,, 3 executable files (upgrade.exe, cmd.exe & shell.exe from Power Toy) and one SQL CE 2.0 database (oldDB.sdf). Install all the 5 cabinet files & click on the cmd.exe to run it. You will be prompt to enter command.

Type something like: upgrade.exe /s oldDB.sdf /d newDB.sdf

viola! (You need to wait a while if your database is huge)

Try to open it with desktop MSSQL:

If you have missed any cabinet file during installation (eg. you did not install ""), you will get this error message:

Try to export the upgrade.log file to analyze:

In this case, you will get:

Connecting to source databaseCreating destination databaseUnable to instantiate SQL CE 3.0 provider
HRESULT: 0x80040154Database upgrade failed

First blog

Hi, this is my first blog. Since my hobby is programming, of course most of the blogs will relate to programming. Haha.