Listen To Dot Net Rocks

19 February 2008

If you are not a regular listener of .NET Rocks!, you should checkout the recent episode done (in part) with Scott Guthrie. He discusses a lot of the very interesting things coming down the pipeline for .NET developers.

Comments:0

Graphe: A Manuscript Image Viewer Built With WPF

16 October 2007

So what do you do with your spare time at work? I built an image viewer. Specifically, this image viewer is for viewing jpg files of New Testament manuscripts, digital images taken by the Center for the Study of New Testament Manuscripts. I have decided to make an installer and the source available, with a little description on my page about the application, which I call "Graphe".

Where did that name come from? It is from the Greek word γραφη, which means "writing", or "scripture". That seemed appropriate for an application with this kind of focus.

If you have any thoughts on improving the application, or questions on how to use it, please contact me. You can find my contact information here.

Comments:1

Graphe: A Manuscript Image Viewer Built With WPF

15 October 2007

So what do you do with your spare time at work? I built an image viewer. Specifically, this image viewer is for viewing jpg files of New Testament manuscripts, digital images taken by the Center for the Study of New Testament Manuscripts. I have decided to make an installer and the source available, with a little description on my page about the application, which I call "Graphe".

Where did that name come from? It is from the Greek word γραφη, which means "writing", or "scripture". That seemed appropriate for an application with this kind of focus.

If you have any thoughts on improving the application, or questions on how to use it, please contact me. You can find my contact information here.

Comments:0

Stick This In Your C# Code Toolkit: The Null Coalescing Operator

27 August 2007

Ran across a post today on the null coalescing operator in C#. I can honestly say that I've never seen this one before. If you're a C#-er, you might find it useful as well!

Comments:2

Rent-A-Crawler

15 August 2007

A few months ago I drastically changed how the urls on my site were built. I moved to using the ASP.NET 2.0 virtual path provider to make more friendly urls. Because I changed the "directory" structure, havoc was wreaked upon my unsuspecting relative urls. I had to go through my posts and look for bad links. I figured I might had missed some.

So I decided to write a crawler, to crawl my site and look for bad urls. And sure enough...I did miss some. Just in case you want to use it yourself, I have it available for download, along with some notes on how you implement a crawler in C#.

Enjoy!

Comments:0

New Resources

22 May 2007

Along with the redesign comes a few new resources.

First, there is now an articles section. That's where I'll be putting article-type stuff.

Second, there are a couple new or improved resources there. My silverlight/inline xaml/firefox article has been updated for beta 1. There is also a little thing on the ASP.NET Ajax fade animation and editing Visual Studio 2005 templates.

Third, added a few reviews to the book reviews page. I think I had them referenced in my blog, but I forgot to put links to them on that page. 

Comments:0

MIX Thoughts

30 April 2007

No, I'm not there. But I just watched the keynote live :). I must say, Microsoft continues to blow the developer in me away...

  1.  Silverlight video streaming. They're starting to roll out a new server for streaming video for you. And it will be free... That's awesome.
  2. Expression studio is now out. Cool. I need to get me a copy of that...
  3. Silverlight 1.0 is now officially in beta. Woohoo!
  4. Silverlight 1.1 is now officially in alpha. Man this is going to get confusing...
  5. They just can't seem to rest. Blend 2 already has a previous out.
  6. So Silverlight WILL be distributed as a miniature .NET Framework install. That's right. .NET running on a Mac. But that doesn't come with 1.0. It comes with 1.1.
  7. Silverlight 1.1 will have linq. That is as surprising as it is cool.
  8. In Silverlight 1.1, the xaml files will have a code-behind. That's a very familiar metaphor, and a good idea for us dev types.
  9. So Scott Guthrie did a demo of a Silverlight app running on a Mac. He then set a breakpoint in Visual Studio on his windows machine. Then the Silverlight app running on the Mac hit that breakpoint. He then proceeded to interactively debug. That is FREAKY COOL.
  10. They announced a dynamic language runtime and that they'll be supporting"Iron Ruby", Ruby for .NET.

Man these guys just don't know how to quite. I've really got to get my day job to upgrade...

Also, Silverlight has its own site now, http://silverlight.net/. I tried to leave a message in the forums and it broke. Oops :). Apparently they have some bugs to fix!

Comments:3

.NET Dispose and Finalize

17 January 2007

I just found a really nice article on implementing IDisposable and finalization in .NET classes. Very detailed, useful information.

Comments:0

On Exposing Generic List Or Generic Collection

08 December 2006
So I was running FxCop on a library today and it decided to flag a problem, exposing List<T> publicly outside of a class. The recommendation was to use Collection<T>. The reasoning was sound, but there is something in the documentation that needs to be cleared up.

Just so you know, the reason is that List<T> is not really designed for inheritance. It can be inherited from (I have done that), but doing so has less value than inheriting from Collection<T>. Collection<T> has four protected virtuals, ClearItems (called by Clear), InsertItem (called by Add and Insert), RemoveItem (called by Remove and RemoveAt), and SetItem (called by the indexer set). If, for some reason, you were using List<T> and needed to change how any of these very essential methods of the collection work, you are up a creek without a paddle. Collection<T> uses List<T> internally and does basically nothing that List<T> does not do. It just allows for more flexibility. And in a public API, that is very important.

The solution listed in the msdn documentation for this, in my opinion, needs to be changed a little. It says the following: "To fix a violation of this rule, change the System.Collections.Generic.List type to one of the generic collections designed for inheritance." This is true, but I think you probably need to go further. And I think this further step is implied, though not clearly stated. Instead of exposing Collection<T>, expose a class which inherits from Collection<T>. If you want extensibility you cannot extend Collection<T> without inheriting from it. So, if you have a class called "Foo", don't expose Collection<Foo> but FooCollection, which would inherit from Collection<Foo>.

Now, if you don't do this, you are still not in huge trouble. Let's say you expose Collection<Foo>, somebody uses it, and then you change it to a FooCollection. Everything should still compile and run fine. The runtime will cast FooCollection to Collection<Foo> without a problem. But that is not the ideal. Expose FooCollection initially and you stand less of a chance of confusing the consumers of your API.





Comments:1

Links for the Day

07 December 2006
A few things caught my attention today:

First, a joke. What if Microsoft made cars? Thanks Kirbli.

Second, an interesting post On Writing Maintainable Code.
Comments:0

NDDNUG Meeting Tonight

06 December 2006
The meeting tonight is on Watir. Information about this meeting of the North Dallas .NET User Group can be found here. If you're a geek like me and live in the area, maybe I'll see you there...
Comments:0

ASP.NET Time Tracker Starter Kit

06 December 2006
It can be found here. I am not as impressed as I would have liked to have been. I would like a nice time tracking/project management tool. I figured this would not have worked as a project management tool, but even for a time tracker I just found it unsatisfying.

I created a sample project, some users, etc. I started entering time. What struck me as odd is that I can't see where you can ever say a task is complete. That just seems like it would obviously belong in something like this.

Anyway, it is a starter kit, so it's not supposed to be too fancy. But I would have expected more.
Comments:0

A Few Notes on the Logging Application Block

05 December 2006
We are switching a project I'm working on from a custom logging solution to the one built into the Enterprise Library, the "Logging Application Block". This is nice, because it means we can get rid of quite a bit of custom code (that's code we no longer have to debug or maintain). The logging application block is very well done as far as I can tell thus far. It makes it very easy to configure logging without having to change code.

Because we do have a particular way of logging that doesn't fit exactly into what the app block does, I did have to create a custom trace listener. But even with that I was able to remove several hundred lines of unnecessary code.

I think there are really three main advantages for going this route. First, the logging is completely configuration file based, and in the app.config. This is excellent, because QA and our deployment team to change the logging for debugging's sake without having to have development mess with it.

Second, when you use a solution like this you have a much better chance of pulling off consistency across groups. If everyone is using the same logging solution, then everyone knows what to expect and what to do when they need to deal with any aspect of logging.

Third, as it was said above, it requires less code. Granted, it is probable that the enterprise library team did not write the application blocks without defects. There may be some bugs in the logging application block. But I can guarantee that their code was more extensively tested than our internal code. I trust it quite a bit more.

A temptation that we programmers can easily fall into is the desire to over-architect and write code we don't really need to write. I have that same temptation. I like programming. I like flexing my programming muscles. And sure, we all program extraneous things to learn more about our craft. That's very important. But as professionals, we need to think about what needs to be created, not necessarily what we want to create. We're lucky when those are the same. But when they are not, we shouldn't pretend that they are.

Now, a little nitty-gritty. There are a few important sections in the configuration of the logging application block. <listeners /> is the section where you define what listeners you want to use, whether that is a built in listener like the file or event log listener, or a custom listener. These are the things that "listen" for logging requests, and log appropriately.

The <formatters /> section is a little more boring, but can be useful for formatting the log messages.

The use of the <specialSources /> section is not immediately obvious, and took a little digging, and this posting was helpful. Essentially, the listeners listed here are used when the typical logging fails, and something needs to be logged about that.

The most important section is the <categorySources /> section. That is where you route different categories of log messages to different sources. For example, you can log "information" log requests to the event log, and "errors" to a database log. You can route things to email, a message queue, a text file, or a custom trace listener. If you want to go the custom route, you can maybe send an instant message or an sms message.

It is the last bit that I find most useful. Because it is configuration file based, anybody can change what goes to where anytime they want to, and no code needs to be touched. What a good idea that was...

If you want more information, I recommend reading the documentation and checking out this series of posts. That link is to part 4 in a 4-part series since it is only the last part that has links to all the other parts in the series.
Comments:0

Lot's O Releases Day at Microsoft

07 November 2006
Several interesting releases today:

ASP.NET Ajax beta 2. Not much time since beta 1. Must be working hard up there... I'm digging this particular programming framework.

.NET Framework 3.0. They RTM'd it today. That pretty much rocks. There's some useful stuff in there. I can't think of any personal use for the Workflow stuff, but WCF, CardSpaces, and WPF all have potential for me...

Last, and in my opinion, definitely least, is the release of VS tools for Office 2007. I don't really care at all about this, but since I was mentioning today's releases...

And, of course, Vista coming soon. Don't know when I'll upgrade, but that's still good news, I suppose.
Comments:0

.NET 3.0

04 October 2006
Not .NET Framework 3.0, just .NET 3.0. I found this both surprising and cool:

http://blog.ziffdavis.com/devlife/archive/2006/10/01/43487.aspx

In the words of my coworker Robert, this says something positive about the stability of the 2.0 Framework. Sure, VS is a little shaky at times, but the runtime rocks...

Comments:0