-
A week ago I blogged about calculating the date for Easter . I found the original C++ code to do this on the Code Project web site, a web site I regularly check if I need code samples. Today I gave them something back in return. I posted an article on Code Project on how to calculate a number of Christian...
-
We needed to know when Easter Sunday was in a given year for my current project. I found C++ code to do this at Code Project and converted it to a C#. I then reposted the code on Code Project. But someone found a bug in the original algorithm and posted an improvement as a response to my code. The code...
-
I needed to find the IP address for the local machine on of the webservices I'm responsible for is running. I found the following piece of code which solved that problem. Might come in handy for others, I think: void temp() { ManagementObjectSearcher moSearch = new ManagementObjectSearcher("SELECT *...
-
A few weeks back, I was given a WSDL for a webservice. The service itself was not available at the time. So all I could do was develop against a dummy with code generated using the WSDL tool. But last Wednesday I recieved an email informing me the webservice was now available. I opened Visual Studio...
-
On David Lem's blog I found a link to the Enterprise Library 1.0 Hands On Labs . This download includes 8 labs in C# and VB.Net that explain how the library can be used. Each lab takes about 30-60 minutes to complete. A great way to get started with the Enterprise Library (if you haven't already).
-
Starter kits To help get you started with developing stuff in Visual Studio 2005, Microsoft has developed a few starter kits which you can download here . At the moment, there are 6 starter kits available. One of the kits is a Card Game Starter kit. This Visual C# Starter Kit is a complete Black Jack...
-
A few weeks back, I blogged about using the SqlCommandBuilder object to create Create, Update and Delete objects for a table. This method does however have one drawback. When your table contains an auto-identifier then SqlCommandBuilder does not handle that very well. Usually, you'd want to have that...
-
In most situations, at least in my case, when you need to build an application that consumes a web-service, that particular web-service is already up-and-running. Creating a webreference is then usually sufficient to use it in you .Net application. This week however, I was given a WSDL file and told...
-
I have done a performance test to compare VB.Net Collection against C# Queue and SortedList. I was triggered to do this, because of a response to my previous post about using VB.Net Collection. The response argued that the performance of Collections are abysmal, because of the way it is implemented....
-
I talked to Patrick about the problem he had with hashtables and how good he thinks the VB.Net collections are. He wanted to add objects to a list and retrieve them in the order in which they were entered. Hash tables are organized using the hash code of the key. A SortedList could work, but then you...
-
This morning I wrote the NUnit test class for a WebService method I am currently building. This method stores data in different data stores and uses other webservices to do this. All these services were running on my machine. But when I started NUnit, the test failed when I tried to make a call to one...
-
There are circumstances where you need to add schema information regarding a table to a DataTable object. You might want to know which columns define the primary key, or you want to know which column is an identify column. Well, here is one option. Create a command object that the following query: SqlCommand...
-
For the project I'm working on now, I needed to convert customers from one database to another. While converting, I had to check the customer name against that of a customer retrieved using a webservice. If the name did not match, then that customer was not to be converted to the new database. Not a...
-
At the moment, I'm working on a conversion between 2 databases. I was looking for a way of avoiding the tedious job of creating command objects for each of the tables I needed to insert data into. In most projects I worked on over the last couple of years, I was able to use code generation to do this...
-
For the project I work on now, I needed to know if the string contained a valid dutch postcode value. Best way to do this is using a regular expression. For example: int IsPostcode(string value) { Regex regex = new Regex(@" ^[1-9][0-9]{3}\s?[a-zA-Z]{2}$ "); Match m = regex.Match( value ); return m.Success;...