Tuesday, January 30, 2007

Windows 2003 Boot Error
Have anyone of you installed Windows XP on a machine which is having Windows 2003. If you have, you may have noted that after Windows XP installation Windows 2003 stops booting up. If you do try to start Windows 2003 in safe mode it will stop at CRCDisk.SYS.
The reason behind this is that when Windows XP installs it will replace some of the required common files with Windows XP version. When Windows 2003 tries to start it will fail since it cannot find the required files.

To start Windows 2003 again you have to replace 'NTDETECT.COM' and 'ntldr' on the boot drive (C:). These two files are located in the Windows 2003 CD inside I386 folder.

If this does not start Windows 2003 try running Windows 2003 setup again up until the first restart. When the system restarts Windows 2003 should start as normal.

In the worst case if that also wont solve your problem then you have to repair your Windows 2003 installation by continuing Windows 2003 setup and selecting Repair mode.

Thursday, January 25, 2007

Creating a folder named Prn

Do you know that you cannot create a folder named Prn in Microsoft Windows operating systems?

It is true that you cannot create folder as such visually (Using Windows Explorer). Instead you can create the folder by using command prompt.

Just open the command prompt and type

mkdir file://.c:/prn to create a folder named con in the C drive.

If you need to remove the created folder, type
rd file:////C:/prn
So if you only needed to create a folder named prn this is it, but if you would like to know further read on.

This restriction is because printer is referred by prn in device level (Printer is considered as a virtual folder.). So if you are permitted to create a folder named prn Windows will get confused when it is told to print a document since there are two folders/devices.
What we do here is we are making the directory a network associated folder by using '\\.\'.

Prn is not the only word which is blocked by Windows. Following words are also blocked because they are also representing some device in device level as I have mentioned below.

Word - Represented Device
prn - Printer
con - Console
lpt1 to lpt9 - Parallel Port Interfaces on IBM PCs (Named because at that time this port is heavily used by Line Printers)
com1 to com9 - Communication Ports
aux - Serial Ports
nul - Null (Not 100% sure)

If you need to create folders with the above names you have to create them as network associated folders.

Saturday, January 13, 2007

Setting up Networking in the Device Emulator

The method to connect the new Device Emulators that come with Visual Studio 2005 is different from the Emulators that came with Visual Studio 2003. The earlier version of emulators were able to connect to the external world by just clicking the Open and giving the network path to be opened in the File Explorer. But the new one if you try the same way it will give you and error saying there are no modem entries and also there are no network card present.
So if you would like to connect your emulator to the external world, please continue reading.

First thing you need to do is to install the Virtual Machine Network Driver for Microsoft Device Emulator.
To download that visit,
http://www.microsoft.com/downloads/details.aspx?familyid=DC8332D6-565F-4A57-BE8C-1D4718D3AF65&displaylang=en.

Then install it in your machine.

After installing it, new item will come under your network connection properties named "Virtual Machine Network Services". To make the emulator use your current network connection, you have to select the "Virtual Machine Network Services" check box. Afterwards it will use this connection when connecting out side.
To configure the Device Emulator to use the network, start the emulator of your choice, then go to File->Configure... . In the network tab select "Enable NE2000 PCMCIA network adapter and bind to" check box and press Ok. Now the emulator has a connection to use but to properly connect we need to set the network settings in the emulator.

Go to Click on Start->Settings and select Connections in the emulator. Then select "Network Cards".

Select "NE2000 Compatible Ethernet Driver" from Configure Network Adapters screen.


From here onwards you need to setup the settings as required by your network. The easiest way is to open the Network connection properties of your machine and set the emulator according to it.

After doing the settings you have to restart the device emulator to make the changes effective by clicking File->Reset->Soft from the emulator screen.

When the device restarts your emulator will have the ability to access the network.

To test the connectivity open the File Explorer from the Programs. Then click on Menu -> Open Path-> New Path.... Then type a valid path in your network and press Ok. Then you will be prompted for a User name, Password and a Domain. Fill the applicable details and press Ok.

If it doesn't get connected check the emulator connection settings. Check whether you need to setup proxies. To setup proxies click Start->Settings and go to Connections tab and select Connections and click on the "Set up my proxy server". Select "This network connects to internet" check box to make the emulator access internet. If proxies are used then enter the proxy details also.

If you correctly setup, the emulator will connect to the network and internet without problems.

Saturday, December 30, 2006

Enabling Remote Connections on SQL Server 2005

If you do the default installation of SQL Server 2005 the remote connections wont be enabled. The result of this will be that no one else wont be able to access to the SQL server instance of your machine resulting your databases to be used only from your machine. All the connections from outside to the databases hosted in your SQL server instance will be denied.

To make your databases accessible you have to do the following.

Step 1 - Right click on your SQL server instance in the Server Management Studio and click properties and get to the server properties.

In the left pane select Connections.

Check whether Allow remote connections to this server check box is selected under Remote Server Connections (this is defaultly selected).

Step 2 - Open SQL Server Surface Area Configuration Tool.

Click Start -> Programs -> Microsoft SQL Server 2005 -> Configuration Tools -> SQL Server Surface Area Configuration.

or

Browse to your Program Files directory and go to the path Microsoft SQL Server\90\Shared (For example C:\Program Files\Microsoft SQL Server\90\Shared).

There you need to find the executable named SqlSAC.exe and double click on it.

It will open SQL Server 2005 Surface Area Configuration screen.


Step 3 - Click on the Surface Area Configuration for Services and Connections link to open the configuration screen.

Select the Local and remote connections radio button.

Then choose accordingly the next radio button. For example if you need to make your server accessible through both TCP/IP and named pipes select the last radio button or else just select TCP/IP only if you only needs TCP/IP as illustrated in the image.

Then press Ok to save the changes.

Step 4 - We need to restart the SQL Server to apply the changed settings.

  • If you have installed SQL Server 2000 in your machine, double click on the SQL Server icon on the system tray area.
Select the SQL Server 2005 Server and click the Stop button to stop the database server and once it is successfully stoped press on the Start/Continue button to restart the database server.


  • If you have only installed SQL Server 2005 in your machine open SQL Server Configuration Manager by going to Start->All Programs->Microsoft SQL Server 2005->Configaration Tool->Configuration Manager.

Then select SQL Server 2005 Services from the left pane and select SQL Server from the right pane, right click on it and click Stop. Once it is successfully stoped press on the Start button to restart the database server.


When the SQL Server database engine restarts successfully you will be allowed to connect to the databases on your server from remote locations.

Thursday, December 07, 2006

My UK Trip

Last week I went to UK to attend my graduation. Following are some of the photos of the trip.

One evening in the university.

Working in the university.
Infront of the Stadium Of Light.
(From Right - Mr. M. H. A. Zufer - Study Center Administrator, Dr. Albert Bokma - Senior Research Fellow, Me)

In the ceremony. (Notice that I am the only one who got the degree in my batch whole row is empty :-).)

With my acedamic dress.



With some of my friends from Sri Lanka.
See the famous football ground. Isn't it beautiful?


We had a photo taken with some Lecturers and Doctors of the university.
Ohhh, The bus is waiting. Have to run.

Did some shopping in Heathrow airport duty free.


On my way back I browsed internet at the Heathrow airport.


World's biggest duty free - Dubai



Dubai - How rich and organized these countries are...

I stayed in Mid West hotel, It was really comfortable.

Day start on my way home 35000 feet above ground.

Friday, November 24, 2006

Results not sorted Correctly when System.Data.DataTable.Select(Filter, Sort) is used

If you are using Windows 2003 SP1 there is an issue in System.Data.dll in .NET Framework 1.1 SP1 which will cause the resulted data to be incorrectly sorted. This is a bug of .Net Framework 1.1.


DataSet1.Table1.Select("Filter1=1 AND Filter2=2 AND Filter3=3", "SortColumn1")

The result of the above statement wont be sorted according to the SortColumn1. But it will be sorted using the Column 1 of the dataset. But if you remove the AND operators used then the result will start to sorting again.
If you really want to sort the things while using AND operators, try making the required sorting column (SortColumn1) the first column in the datatable.

At the moment there is no download and install solution from Microsoft but they said to contact them to find out a solution.

If you like to know more on this you can visit the related Microsoft support center from the following link.
http://support.microsoft.com/Default.aspx?id=900468

Thursday, November 16, 2006

Disabling the Shutdown Event Tracker in Windows 2003

If you try to Shutdown or Restart a computer running Windows 2003 OS you always have to give a reason for the shutdown or restart. This is because Shutdown Even Tracker is enabled. This will be great if it is a server, but this may be annoying if this is a normal PC. If anyone likes to stop this below I am discussing how to accomplish it.

1. In the Run Window (Start -> Run) type GPEdit.MSC and press enter.
2. Expand the Computer Configuration then Administrative Templates and then select System.
3. Double click on Display Shutdown Event Tracker to get the properties of it and select Disabled and click ok.

After these steps you will be able to shutdown the system as normal.

Sometimes your group policy settings may not apply immediately due to various reasons. To force apply the settings open the command window (Type Cmd in the run window) and type GPUpdate /force
This will force the changes made and any errors will be logged to the system event log.
If the shutdown event tracker keeps on appearing then probably an error may have occurred while trying to apply group policy settings. Go to Event Viewer and check for errors.

Note - If you are in a domain then you needs domain rights to disable shutdown event tracker.

Tuesday, November 07, 2006

Registering Crystal Reports

Are you getting an exception
"Internal Exception: Cannot find KeycodeV2.dll or invalid keycode."
when you try to open a report done by Crystal reports?

Errors relating to KeycodeV2.dll can occur in VS.Net because of one of the following issues.
1. KeycodeV2.dll file is not accessible,
2. Does not have access to the registry keys which relate to KeycodeV2.dll,
3. Does not recognize the product Keycode stored in the registry.

Here I will address the last one, because most of the people doesn't know how to correctly register Crystal.

  • As the first step you have to add the licensing merge module which is Crystal_regwiz2003.msm (if you are using VS.Net 2002 the file will be RegWiz.msm) to your setup project.
  • Then get to the properties window of the Merge Module.
  • Expand the Merge Module Properties section in the Properties window and you will see a property called License Key.
  • Enter the License key of your Crystal reports there.

If any one is wondering what the License key is, read on,

To get a license key you have to register Crystal with Business Objects. After registering you will get an email containing a registration number and unique key code (If your copy is already registered you can get to the Product Code by going to menu Help -> About Microsoft Development Environment, in Visual Studio .NET. If it is registered the Product Code is the code besides Crystal Reports for Visual Studio .NET.) Copy the Product Code (Product Code consists of 19 characters and looks something like xxxxx-xxxxxxx-xxxxxxx.) into the License Key property of the above merge module.

Next time you build and install the project the error will vanish.

If you still get the error or if you are interested in reading more into this following URL might be useful to you.

http://support.businessobjects.com/communitycs/technicalpapers/crnet_keycodev2.pdf

Tuesday, October 31, 2006

Tech Ed 2006

Attended Tech Ed hear in Sri Lanka, met many old friends, it was a good time but I think Microsoft should have emphasized more on technical side.

Friday, October 20, 2006

Free Computer Education

We are planning to start a free Computer Training Centre based in my temple (Maithree Dharamayathanaya, Jayawadanagama Battaramulla) to educate the less previledged. On this matter the Rotary Club is helping us. So if you are interested in helping us please contact me.

Wednesday, October 11, 2006

Getting a Crystal Report Parameter value in VB.NET

After setting a parameter value of a crystal report there is no easy way of getting the value. So I found this to get the parameter value.


CType(CType (CType (CType (CType (CType (rpt.Parameter_paraArea, CrystalDecisions.Shared.IParameterField), CrystalDecisions.CrystalReports.Engine.ParameterFieldDefinition).CurrentValues, CrystalDecisions.Shared.ParameterValues).Item(0), CrystalDecisions.Shared.ParameterValue), CrystalDecisions.Shared.ParameterDiscreteValue).Value, Object)

rpt is the Crystal Report, paraArea is my parameter name which I needed to get the value of.

Hope this helps.

Monday, October 02, 2006

Playing Media Files in .Net Compact Framework 2.0

I have seen many people asking how to play media files in device applications. Here I am playing media files using Windows Media Player.



This is the ProcessHandler class which imports Coredll Dll and uses it's CreateProcess to create a seperate process with the required application.


This is the main form which has a button to start the Player, then it will ask the user to browse for a media file to play.


The ProcessHandler.CreateProcess function can be used to start any application which is installed in the device by simply replacing the 'WMPlayer' by the required application qualified name (IExplorer).