Monday, March 15, 2010

Running .NET 4.0 in IIS 7.5 for the First Time

Today, I tried my hand at running an asp.net 4.0 (release candidate) web app for the first time in IIS 7.5.  I was getting all kinds of errors, the latest one being
Handler "PageHandlerFactory-Integrated" has a bad module "ManagedPipelineHandler" in its module list
Anyhow, I thought I’d mention on this blog how I got it working.   Turned out .Net Framework 4.0 was not registered properly.  After I did run %windir%\Microsoft.NET\Framework\v4.0.21006\aspnet_regiis.exe –i, everything is working fine.

Saturday, March 13, 2010

Turning a DateTime into a Friendly String

Over at http://www.primershee.com/Forum.aspx, the date column shows a friendly string version of when each post was last updated.  I used the following extension method…

        public static string ToFriendlyString(this DateTime date)
{
if (date.DayOfYear < DateTime.Now.DayOfYear)
return date.ToString();
else
{
TimeSpan span = DateTime.Now.Subtract(date);
if (span.Hours >= 1)
return span.Hours + " Hours Ago";
else if (span.Minutes >= 1)
return span.Minutes + " Minutes Ago";
else return span.Seconds + " Seconds Ago";
}
}

Thursday, March 11, 2010

AddWeekDays Extension Method

Ever need to add week days to a date?  Use this extension method…

 public static DateTime AddWeekDays(this DateTime startDate, int days)
{
DateTime d = startDate;
int i = 1;
while (days >= i)
{
d = d.AddDays(1);
if (d.DayOfWeek != DayOfWeek.Saturday & d.DayOfWeek != DayOfWeek.Sunday)
i++;
}
return d;
}

www.Mild.net Gets A Facelift!

Checkout the new Mild.Net homepage, especially the logo (design by Mona Hennes)!

Tuesday, March 9, 2010

Primershee Free For Now!

I would like to announce that Primershee, my professional project management solution for the self-employed, independent contractors and other solo professionals, is going to be free for now – that is, until we decide it is not going to be free anymore.
So, go ahead and signup and take advantage of this offer.  Primershee is great for estimating and tracking time against your estimates.  It’s also great for keeping track of what your customers owe you.