Archive for the ‘Development’ Category

Debugging ADO.NET Datatables

Do you ever had the famous error message :
“Failed to enable constraints. One or more rows  contain values violating non-null, unique, or foreign-key  constraints.”
when using ADO.NET Datasets ?
Tthis is an incredibly useful message isn’t it ?
So what can you do to spare you some headaches ? Retrieve a more useful message sure !
You have to [...]

More »

Use ASP.NET Validators with the SharePoint:DateTimeControl

If you want to use asp.net validation system with the SharePoint’s DateTimeControl, the first thing you need to know is that this control is “just” a wrapper around simple ASP.NET controls (textbox, dropdownlist).
If you want to set the ControlToValidate property of an ASP.NET validator to the DateTimeControl’s ID, it will throw an error!
As you can [...]

More »

A few lists …

The Joel Test: 12 Steps to Better Code
Top 10 Things That Annoy Programmers
10 Programming proverbs every developer should know
101 Ways To Know Your Software Project Is Doomed
Top 100 Blogs for Developers
–> Pragmatic Software Development Tips

More »

C#, check if a string is null or empty

In C# you can check if a string is null or empty in many ways :

string String1 = "testString";
if (String1== null || String1 == "")
{
// …
}
else
{
// …
}

string String1 = "testString";
if (String1 == null || String1.Length==0)
{
// …
}
else
{
// …
}

string String1 = "testString";
if (string.IsNullOrEmpty(String1))
{
// …
}
[...]

More »

How long need a portion of code to be executed ?

Use the Stopwatch object !

using System.Diagnostics;

// …

Stopwatch myStopWatch = Stopwatch.StartNew();

// some code

myStopWatch.Stop();

Console.WriteLine("{0} ms – {1} ticks", myStopWatch.Elapsed.TotalMilliseconds, myStopWatch.ElapsedTicks);

// …

More »