by Damiaan Peeters
18. April 2008 17:02
I regularly have some clients with network problems. Using this article I solved a lot of problems. The article How to troubleshoot TCP/IP connectivity with Windows XP describes a lot of useful tools to determine where the network problem exists.
If you suspect problems with the Tcp/IP stack. You can use the article on TechNet: Reset the Internet Protocol (TCP / IP) stack in windows XP. Because the TCP/IP stack is considered a core component of the Windows XP operating system, you cannot remove it. You need to follow the instructions given in the article. Being...
netsh int ip reset c:\resetlog.txt
by Damiaan Peeters
12. April 2008 14:38
Today, I couldn't attach a database of my previous pc to my new MSSQL Server installation.
I got this strange error message in Microsoft SQL Server Management Studio.
[more]
I got this error message:
Attach database failed for Server 'STELLA'. (Microsoft.SqlServer.Smo)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.3042.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Attach+database+Server&LinkId=20476
------------------------------
ADDITIONAL INFORMATION:
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)
------------------------------
Unable to open the physical file "E:\MSSQL\InfoBase.mdf". Operating system error 5: "5(error not found)". (Microsoft SQL Server, Error: 5120)
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.3054&EvtSrc=MSSQLServer&EvtID=5120&LinkId=20476
Solution
The solution was very easy. Launch Microsoft SQL Server Management Studio as Administrator.
by Damiaan Peeters
4. April 2008 01:01
Problem
When i installed windows Vista, Live Messenger (and various other applications) where not working properly. They could not connect to the internet.
Using the Internet Connectivity Evaluation Tool might help detecting any problems at home networks. It did for me. I found out that my router is not supporting "Universal Plug and Play" (UPnP).
Solution
A long story short:
Apparently the problem is the TCP auto tuning feature of Windows Vista.
On technet I found this: "Network connectivity may fail when you try to use Windows Vista behind a firewall device". It helped.
Conclusion
Although everything is working for now, our router is still not "up-to-date". I'm consider buying a new router.
by Damiaan Peeters
22. March 2008 12:11
Today I looked at the ASP.NET 2.0 Themes. I've been using them for a long time, but I never knew that you can set a default theme in the web.config.
Just add this to the system.web section
<pages styleSheetTheme="Black"/>
Further more I needed to change my theme dynamically. I found an interesting article on this topic on CodeProject.
CodeProject: Dynamic themes in ASP.NET 2.0 (C#).
by Damiaan Peeters
21. March 2008 11:44
Ever wondered how to change or add code snippets to Visual Studio 2005? As you probably found out, you have to change or create some XML. On techRepublic you can find an article on "Creating custom Visual Studio 2005 Code Snippets".
But did you know codeplex is hosting a "Editor for creating and modifying Visual Studio 2005 Code Snippets". Snippy - Visual Studio Code Snippet Editor
by Damiaan Peeters
19. March 2008 16:05
On the internet you can find tons of information about exporting a dhcp reservationlist (from Microsoft DHCP server).
Today, I tried to do that using NETSH. Unfortunately i always received the following error:
The following command was not found: dhcp
If you see this error, you should check if the DHCP is available. To do this, enter the next command:
netsh show helper
If DHCP is not shown in the list, you can add it, by running the following command on your command prompt:
netsh add helper dhcpmon.dll
After you added the helper, you will be able to run all commands regarding the dhcp. For example get the server reservation list:
netsh -r MyDhcpServernameOrIpAddress dhcp server dump
by Damiaan Peeters
6. March 2008 11:38
I 've written some time ago a HTML scraper to search the VIES VAT number Validation web site of the European Union. The service offered no web service at that time, so I needed to use the HTTP POST method.
The code is not too difficult.
[more]
private readonly string Url = "http://ec.europa.eu/taxation_customs/vies/cgi-bin/viesquer";
private readonly string Referer = "http://ec.europa.eu/taxation_customs/vies/en/vieshome.htm";
List<Exception> Exceptions = null;
ASCIIEncoding encoding = new ASCIIEncoding();
string postData = "Lang=EN";
postData += ("&VAT=" + VatNumber);
postData += ("&MS=" + CountryCode);
postData += ("&ISO=" + CountryCode);
byte[] data = encoding.GetBytes(postData);
HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create(this.Url);
myRequest.ContentType = "application/x-www-form-urlencoded";
myRequest.Referer = Referer;
myRequest.ContentLength = data.Length;
myRequest.ProtocolVersion = HttpVersion.Version10;
myRequest.Method = "POST";
Stream newStream = myRequest.GetRequestStream();
// Send the data.
newStream.Write(data, 0, data.Length);
newStream.Close();
HttpWebResponse resp = null;
try
{
resp = (HttpWebResponse)myRequest.GetResponse();
}
catch (Exception ex)
{
Exceptions.Add(ex);
}
StreamWriter myWriter = null;
try
{
myWriter = new StreamWriter(resp.GetResponseStream());
myWriter.Write(data);
}
catch (Exception e)
{
Exceptions.Add(e);
return VatCheckOk.NotChecked;
}
finally
{
myWriter.Close();
}
HttpWebResponse objResponse = (HttpWebResponse)myRequest.GetResponse();
using (StreamReader sr = new StreamReader(objResponse.GetResponseStream()))
{
string result = sr.ReadToEnd();
// Close and clean up the StreamReader
sr.Close();
}
If i remember well, i used the result string to check for the string: "Yes, Valid number".
by Damiaan Peeters
2. March 2008 12:04
I found some design patterns about implementing Dispose & Destructors in C#.
Class instances often encapsulate control over resources that are not managed by the runtime, such as window handles (HWND), database connections, and so on. Therefore, you should provide both an explicit and an implicit way to free those resources. Provide implicit control by implementing the protected Finalize on an object (destructor syntax in C# and C++). The garbage collector calls this method at some point after there are no longer any valid references to the object.
Implementing Finalize and Dispose to Clean Up Unmanaged Resources
by Damiaan Peeters
27. February 2008 14:14
It can be very annoying if the "auto completion" method not not available in the Windows XP Dos Prompt (read: command prompt).
If you type: cmd /f it will be activated for the current session. If you want to activate it on a pc (or change the key which is by default TAB), then visit the link.
How To Use Automatic Completion with a Command Prompt in Windows XP
by Damiaan Peeters
21. February 2008 15:43
Ever wanted to change the VS2008 Color Schemes?
Tomas Restrepo posted VS2008 Color Schemes .