adamyeager.com
It’s Thursday the eve of Friday the 21st. We all know what happens on Friday the 21st…

I’m coming to the conclusion that I’ll never be happy with my code. I’m currently looking at Feed Watchdog’s source and I’m not happy. At all. In the past month, I’ve learned so many new tricks and ways of organizing my code that I’m honestly thinking about rewriting the application from the ground up. This will be version 3.

No Comments »
Happy 4th

I thought this was kind of funny. Found it posted on Dueling Analogs.

2009-07-02

No Comments »
Create RSS and Atom Feeds with LINQ and WCF Syndication in .NET 3.5

Ok this seriously makes syndication simple in the .NET world. I found this while trying to create an Atom feed for user’s search alerts in Feed Watchdog. Read through this article if you’re interested in creating RSS or Atom feeds for your ASP.NET website. In case the site ever goes down, I’ve also attached a PDF of the website as of right now.

http://nayyeri.net/blog/create-rss-and-atom-feeds-with-linq-and-wcf-syndication-in-net-3-5/

Create RSS and Atom Feeds with LINQ and WCF Syndication in .NET 3.5 _ Keyvan Nayyeri.pdf

No Comments »
Elmah… where have I been?

This morning I’ve been adding some new features to Feed Watchdog. I haven’t really been able to work on the project very much lately. But this morning, I added ELMAH. As described by the ELMAH website:

ELMAH (Error Logging Modules and Handlers) is an application-wide error logging facility that is completely pluggable. It can be dynamically added to a running ASP.NET web application, or even all ASP.NET web applications on a machine, without any need for re-compilation or re-deployment.

I initially built Feed Watchdog with my own error logging system, but it pales in comparison to ELMAH. If you have an ASP.NET web application, you really need to give ELMAH a try. It doesn’t take too much time to set up. I followed the DotNetSlackers documentation that is posted on ELMAH’s wiki.

One thing that I will say, is that if you do end up allowing ELMAH to be viewable on your production application, be sure to add this to your web.config file somewhere between the tag.

<location path=elmah.axd>
    <system.web>
        <authorization>
            <allow users=YourUserName/>
            <deny users=?/>
            <deny users=*/>
        </authorization>
    </system.web>
</location>

You don’t want anyone to be able to view potentially dangerous errors, do you?

No Comments »
PrettyTime.NET

Today I released a .NET version of an open source java project created by my friend Lincoln. His project is called PrettyTime (java), and mine is PrettyTime.NET(C#).

Ever since Lincoln told me about PrettyTime, I’ve been salivating at the idea. I actually had PrettyTime converted and up and running on FeedWatchdog within the same day as its release. But I’ve waited a week to clean up the code just a bit and to add a little bit as I saw fit.

The main difference between PrettyTime and PrettyTime.NET is the language. Under the hood, the .NET version:

  • Implements properties instead of getters and setters
  • It uses DateTime objects instead of Date objects (which leads to using TimeSpans to calculate the difference in milliseconds)
  • The PrettyTime class implements IDisposable (which will make sense in just a second)

You can download the source, which includes the same test cases Lincoln used on the OcpSoft website. Or you can just download the release DLL and include it in your BIN folder of your project.

Either way, once you’ve added the DLL file to your BIN folder of your project, here is the most basic example of PrettyTime.NET’s use:

private string PrettyItUp(DateTime Date)
{
    using (PrettyTime.PrettyTime p = new PrettyTime.PrettyTime())
        return p.format(Date);
}

As I mentioned earlier, the .NET version of the PrettyTime class implements IDisposable, which allows you to use the using statement.

And here are a few examples of the test methods that are included in the source:

/// <summary>
/// A test for minutes from now
/// </summary>
[TestMethod()]
public void MinutesFromNow()
{
    using (PrettyTime p = new PrettyTime())
    {
        Assert.AreEqual(“12 minutes from now”, p.format(DateTime.Now.AddMinutes(12)));
    }
}

/// <summary>
/// A test for days ago
/// </summary>
[TestMethod()]
public void DaysAgo()
{
    using (PrettyTime p = new PrettyTime())
    {
        Assert.AreEqual(“3 days ago”, p.format(DateTime.Now.AddDays(-3)));
    }
}

Currently FeedWatchdog.com is using it. Here is a screen shot of its implementation:

fwdpt

Please feel free to download the source or just the dll and start using PrettyTime.NET.

http://code.google.com/p/prettytimedotnet/

No Comments »
Older Posts »