Thursday, November 08, 2007


nice place to be right now (winter)


Originally uploaded by coulportste.

Tuesday, September 25, 2007

Some truth about software consulting

Somehow this poster [from Despair, Inc.] always makes a lot of sense.

Saturday, September 15, 2007

Accidents de voiture : Tunnels Russe

It must be the vodka!

The Bus Lane

Always respect the bus lane .. or else ... well, see for yourselves

Wednesday, September 12, 2007

How to get a random date in C#

I looked everywhere for a sample on generating random dates in C# but could find any so I wrote mine.

private static DateTime getRandomDate(Random rand,
DateTime minDate, DateTime maxDate)
int totalDays = (int)DateTimeUtil.DateDiff(
DateInterval.Day , minDate, maxDate);
int randomDays = rand.Next(0,totalDays);
return minDate.AddDays(randomDays);


This function uses the DateTime utility class below which I found somewhere on the web.

public enum DateInterval


public sealed class DateTimeUtil

#region DateDiff Methods

public static long DateDiff(DateInterval interval,
DateTime dt1, DateTime dt2)

return DateDiff(interval, dt1, dt2, System.Globalization


private static int GetQuarter(int nMonth)
if (nMonth <= 3)
return 1;
if (nMonth <= 6)
return 2;
if (nMonth <= 9)
return 3;
return 4;

public static long DateDiff(DateInterval interval,
DateTime dt1, DateTime dt2, DayOfWeek eFirstDayOfWeek)

if (interval == DateInterval.Year)

return dt2.Year - dt1.Year;

if (interval == DateInterval.Month)

return (dt2.Month - dt1.Month) +
(12 * (dt2.Year - dt1.Year));

TimeSpan ts = dt2 - dt1;

if (interval == DateInterval.Day ||
interval == DateInterval.DayOfYear)
return Round(ts.TotalDays);

if (interval == DateInterval.Hour)
return Round(ts.TotalHours);

if (interval == DateInterval.Minute)
return Round(ts.TotalMinutes);

if (interval == DateInterval.Second)

return Round(ts.TotalSeconds);

if (interval == DateInterval.Weekday)
return Round(ts.TotalDays / 7.0);

if (interval == DateInterval.WeekOfYear)
while (dt2.DayOfWeek != eFirstDayOfWeek)
dt2 = dt2.AddDays(-1);
while (dt1.DayOfWeek != eFirstDayOfWeek)
dt1 = dt1.AddDays(-1);
ts = dt2 - dt1;
return Round(ts.TotalDays / 7.0);

if (interval == DateInterval.Quarter)
double d1Quarter = GetQuarter(dt1.Month);
double d2Quarter = GetQuarter(dt2.Month);
double d1 = d2Quarter - d1Quarter;
double d2 = (4 * (dt2.Year - dt1.Year));
return Round(d1 + d2);
return 0;

private static long Round(double dVal)
if (dVal >= 0)
return (long)Math.Floor(dVal);
return (long)Math.Ceiling(dVal);

Thursday, September 06, 2007

Visual Studio is a memory hog - uses 1/2 a gig of memory

Visual Studio (2005) and ASP.NET server are using more than 1/3 (765,304k) of all my memory. Has Microsoft lost its mind?

Tuesday, July 03, 2007

C# - How to check if a property type is an Enum

class EnumTests
public static void Run()
// convert a string into a color Enum
Colour c = (Colour)Enum.Parse(typeof(Colour), "Red", true);
Console.WriteLine("Colour Value: {0}", c.ToString());

// Picking an invalid colour throws an ArgumentException. To
// avoid this, call Enum.IsDefined() first, as follows:
string nonColour = "OrangeGreen";

if (Enum.IsDefined(typeof(Colour), nonColour))
c = (Colour)Enum.Parse(typeof(Colour), nonColour, true);
Console.WriteLine("'{0}' is an undefined Color", nonColour);

//Check if c is an Enum
Console.WriteLine("c is an Enum = {0} ", c.GetType().IsEnum);

#region Helper Classes

enum Colour


Wednesday, May 30, 2007

Yande, almost 10 weeks later.

It's been almost 10 weeks since Yande was born, and he has almost double in size - about 16 lbs now. Anyway he wore shoes today and I thought I should take him some pictures.

Tuesday, March 20, 2007

Apollo Extensions for Flexbuilder 2.0.1 won't Install/Run

After painstakingly downloading the new Apollo runtime and Apollo extensions for Flex Builder from Adobe Labs, I now have to deal with errors nobody at the Apollo forums seems to have any clue about. (Except another few 10s of developers who have the same problems).

I am running WinXP Pro SP2. During the Flex extensions install, I get to select the location of the Flex Builder folder and then I get an Eclipse Folder Error as shown below:


And I do not have Eclipse installed on this computer. I know Flex is built on Eclipse, but common, Adobe should be able to do better - I've been waiting for Apollo for too long.

The when I start Flex Builder, Apollo is present but still won't run.

I'm still watching the forums hoping somebody will answer this one.

Monday, March 19, 2007 is just Unacceptably TOO SLOW

As a matter of fact, this site doesn't even load.

Today I received an email from adobe to download the alpha release for the highly anticipated Apollo SDK for building desktop apps that will run on Windows & Mac. But unfortunaly for the last 10 minutes, the site still hasn't loaded. is notoriously slow especially when compared to other tech company sites such as and

Adobe, I have 2 questions.
1. Why should I even bother about your software when your site would load?
2. Is your site running on ColdFusion?
3. Add I hear you want to put Photoshop on the web, good luck.

Sunday, March 18, 2007

Yande's Home Coming

Yande and mother (Philo) finally came home on Thursday (3/15/2007). I will be putting up hist first home pictures later.
Apart from the Wheel Chair incident I still give Prince George's Hospital Center a solid “A” for their service. PG Hospital Center currently is run by Dimensions Healthcare System and I salute them for the excellent experience we had with their services. KUTGW.

Wednesday, March 14, 2007

Yande Franklin Anyangwe - First Pictures


Since blogger does not provide a way to upload or manage a simple photo gallery, I have uploaded the pictures to my personal website at

Tuesday, March 13, 2007

Yande Franklin Anyangwe 03/12/07

Philo and I hereby welcome Yande F. Anyangwe into our family who arrived yesterday March 12th 2007 at 8lbs. 10oz.

Monday, January 08, 2007

Best Comparism: Ruby vs Java et al

This is probably the best analogy I've seen comparing dynamic languages (like Ruby & JavaScript) to static object oriented languages (like C# & Java) by Joel on Software.

Also a good start to understand how to map (ConvertAll) and reduce (Fold) your code - MapReduce