Monday, February 27, 2006

How to Avoid Memory Leaking in VB.NET

IN CODE after all code

If (Environment.OSVersion.Platform = PlatformID.Win32NT) Then
SetProcessWorkingSetSize(Process.GetCurrentProcess().Handle, -1, -1)
End If

FUNCTIONS that needs to be declared

#Region "Stuff for Closing the Processes"
'# to close all the resources
Private Declare Auto Function SetProcessWorkingSetSize Lib "kernel32.dll" (ByVal procHandle As IntPtr, ByVal min As Int32, ByVal max As Int32) As Boolean

Public Sub SetProcessWorkingSetSize()
Dim Mem As Process
Mem = Process.GetCurrentProcess()
SetProcessWorkingSetSize(Mem.Handle, -1, -1)
Catch ex As Exception
End Try
End Sub
#End Region

Thursday, February 23, 2006

Create XML object and post it ovet HTTP to a URL

Dim oxmldoc As New XmlDocument

Dim xmlHttp As Object
Dim strXMLResponse As String
xmlHttp = Server.CreateObject("MSXML2.ServerXMLHTTP")
xmlHttp.Open("POST",, False)
strXMLResponse = xmlHttp.responseText

Friday, February 17, 2006

Running Procedure Asynchronously

Sub ShowSearchForm()
Dim x As New frmSearching
End Sub


Dim t As System.Threading.Thread
t = New System.Threading.Thread(AddressOf [ShowSearchForm])

Tuesday, February 14, 2006

ASUS P4S800-MX MotherBoard

Hi all,

I have a ASUS P4S800-MX and I am using it in a windows media center PC. I was having lots of trouble with getting it installed in fact i wasnt sucessfull at all. I keep getting errors like after start before booting it says no HDD present however the HDD is there and if i turn it off and leave it for cca 1 min and start again it works perfect.

Another thing is that the USB ports at the back of the board stopped working but in a very strange way.

If i plug my USB mouse into them or USB IR reciever for the MCE they act like they dont work. Nothing appears in windows as a new HW nothing works. However if i stick my USB Wifi dongle into them that works fine... its the same for a USB memory key

Also the machine sometimes freezes completely. I have checked all the other HW and i cant see anything else beeing wrong

This behaviour only started when i changed PCI cards in it around and the mouse works perfectly in other PC so does the IR reciever.

All this leads me to a conclusion that there is something wrong with the motherboard itself so I have updated the BIOS to the latest version that is 1011 but it still didnt help.

Are there any known issues with this Motherboard or are there any chipset drivers I should install to windows?

It has a SIS chipset do I need to install anything else to windows?

Anyone has a similar issue?

thanks for any help

Monday, February 13, 2006

IIS 404 error when viewing ASPX pages;EN-US;315122

By default, when IIS is installed on any version of the Windows Server 2003 family, IIS only serves static content (HTML).
To permit IIS to serve dynamic content, the administrator must unlock this content in the Web service extensions node in IIS Manager. To do this, the administrator must either enable a pre-existing Web service extension or add a new Web service extension. Enable a Pre-existing Web Service Extension in IIS 6.0 To permit IIS to serve content that requires a specific ISAPI or CGI extension that is already listed in the Web service extensions list, follow these steps:
Open IIS Manager, expand the master server node (that is, the Servername node), and then select the Web service extensions node.
In the right pane of IIS Manager, right-click the extension that you want to enable. In this example, this is Active Server Pages.
Click to select the Allow check box.
Add a New Web Service Extension to IIS 6.0To permit IIS to serve content that requires a specific ISAPI or CGI extension that is not already listed in the Web service extensions list, follow these steps:
Open IIS Manager, expand the master server node, and then select the Web service extensions node.
In the right pane of the IIS Manager, click Add a new Web service extension under Tasks.
In the Extension name box, type a friendly name for the extension that you want to add (for example, FrontPage Server Extensions).
In the Required files box, click Add, and then select the path and the name of the file that will handle requests for the specific extension. After you select the path and the file name, click OK.
If the extension must be enabled immediately, click to select the Set extension status to allowed check box.
Click OK to save your changes.
Additional steps for Common Gateway Interface (CGI) applicationsFor CGI applications, you must also follow these steps:
Right-click Default Web Site or the Web site that you want, and then click Properties.
On the Home Directory tab, click Scripts and Executables in the Execute Permissions list.
Make sure that the Everyone group has the following NTFS file system permissions on the C:\InetPub\wwwroot folder or on the folder that has the Web content for the site that you want:

Read & Execute

List Folder Contents

Right-click Default Web Site or the Web site that you want, and then click Properties.
On the Home Directory tab, make sure that DefaultAppPool is selecting in the Application pool box. If another application pool is selected, follow these steps in IIS Manager:
Expand Application Pools, right-click the application pool that you want, and then click Properties.
On the Identity tab, make sure that one of the following conditions is true:

The Network Service account is selected.

The account that is selected is a member of the IIS_WPG group.
This behavior is by design.
For more information about Web service extensions, search for "Enabling and Disabling Dynamic Content" in the IIS 6.0 Help documentation.For more information, click the following article number to view the article in the Microsoft Knowledge Base:
332124 ( ASP.NET is not automatically installed on Windows Server 2003

Uninstalling Windows Service

To uninstall the service

Go to its BIN folder example:


Then RUN

C:\WINDOWS\Microsoft.NET\Framework\v1.1.4322\installutil /u servicename.exe

Requested Registry Access is not allowed


1. Give the ASPNET user permission to read the Security eventlog registry entry.Run regedt32 Navigate to the following key:HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Eventlog\Security Right click on this entry and select Permissions Add the ASPNET user Give it Read permission

2. Change settings in machine.config fileRun ExplorerNavigate to WINDOWS or WINNT folderOpen Microsoft.NET folderOpen Framework folderOpen v1.1.4322 folder (folder name may be different, depending on what dotnet version is installed)Open CONFIG folderOpen machine.config file using notepad (make a backup of this file first)Locate processmodel tag (approx. at line 441)Locate userName="machine" (approx. at line 452)Change it to userName="SYSTEM"Save and close the fileClose Explorer

3. Restart IIS Run IISReset

Production Solution

Go to the application pool and select IDENTITY leave it Network Service

Go to the registry it is accessing and select the permission
Add the NETWORK SERVICE user to it


Debugging VB Script

  1. Create the script in text editor
  2. Save it to c:\script.vbs
  3. Run: cscript.exe //x "c:\script.vbs"

SQL Server CASE statement

case when CQ.AccountNo is NULL then IMP.AccountNo
end as AccountNo

, CQ.Staff_ID, CQ.DateOfEntry,IMP.BalanceDue, IMP.BrokerRef, IMP.Note FROM tblCancelationQueue AS CQ RIGHT JOINtblimportcan AS IMP ON CQ.AccountNo = IMP.AccountNoWHERE IMP.processed = 0ORDER BY CQ.dateofentry DESC

SQL Server US / UK Date HELL !

If you using VB and a SA login to connect to SQL server and want to write date to it using VB function like TODAY or NOW you need to execute this statement before doing that:

System.Threading.Thread.CurrentThread.CurrentCulture = New System.Globalization.CultureInfo("en-US")

It makes all the regiona stuff US so if you are sending something to a field like MONEY it would come as USD

Another way of doing this is to create a SQL server Login (Server/Security/Logins) and setup a new login set its language to British

use it for any connections and pass in normal date