Gonzo blogging from the Annie Leibovitz of the software development world.

Category: Programming (Page 2 of 4)

Good (free) ASP.NET components

I’m really struggling trying to find some good free ASP.NET components on the net. I’m a strong believer (and follower) of not re-inventing the wheel and will fully conceed to someone who has already gone through the pain and suffering of writing a module that did something simple, like a drop-down menu, calendar pop-up, etc. I love writing custom components, but in a crunch when you need to do an app I don’t have time to write a nice re-usable thing. Maybe after the project is finished but not as part of it. Too much of a hit on the momentum that you’re trying to achieve.

Right now I’m struggling to try to find a good tab navigation component. I like navigation through tab panels, as long as there’s only a few. Some good examples of sites that use the tab approach would be GForge, MSDN, and Experts Exchange. I’m currently building a simple ExtremeProgramming (XP) tool that would track stories, iterations, tasks, and show some metrics in an agile type project. There are a few tools out there, but some are overkill and this one needs so many dependant libraries and technologies that even my Linux box would have a hard time trying to run it. A tab panel would be great for that type of thing so each area is split up into a separate page and you can easily see what’s going on and access everything.

I did manage to hunt down the ZmodemControls which look great. However when you actually get your grubby hands on it, it doesn’t work right. You can go into the collection and define the tabs and all that jazz, but the control has a bad habit of reverting back to it’s empty self, losing all your configuration. I even hand coded the menu collection (rather than using the collection editor) but after reloading the page the component (or VS.NET, or both?) just decided to blow everything away. Hmmm. That’s just not right.

There’s a great one here, that looks exactly like what I want. It’s in all JavaScript. Ugh. For an ASP.NET application, that’s just not right either.

The quest continues.

Advanced .NET debugging and C# default parameters

Last week a bunch of us went on a .NET “advanced” debugging course. Well, suffice to say, the course was not what we were really expecting and ended up being a course on how to read MS .dump files, step through (assembler) code with WinDbg and generally get to know the IL code from a .NET assembly (see my Microsoft Lied blog earlier on the raw facts of how VB.NET and C# are not the same).

Anyways, one of the people who works on the QA team for C#, Min Kwan Park, has an excellent blog on .NET debugging and walks you though some ideas around what to do, what not to do, and how to deal with some funny .NET problems (like debugging web services from a web service client and what to do when remote debugging hangs). There are also some great links to other debugging docs so if you want to really get some advanced debugging tips check out the blog here.

Today I got into a bit of a language pickle. I was writing some code for someone to show them how to write Unit tests (using NUnit of course). When you write lots of little snippets of code for people day in and day out, you usually end up writing it in a language that the end developer is most comfortable with. This usually means flipping back and forth between VB, VB.NET, C#, C++, and so on. So I was writing up a test and went to implement the code for the test by writing this in C#:

public void TheMethod(string name, int rate=30)



This was the typical language guffah that we keep making. Whether it’s adding a semi-colon at the end of a line of VB/VB.NET code or putting in Dim statements in C# code it’s embarassing. In this case, I forgot why C# couldn’t handle default parameters. In C++ (and some other OO languages) the above code could be called like this:

TheObject.TheMethod(“NYSX”, 10);

or this:


The second example would set the rate to 30 automagically. C# doesn’t have this feature (it’s the first time I tried it in C# today, silly me). I did some digging and found out one reason why C# doesn’t have this feature. It’s related to a specific implementation of the feature.

In the C++ world, when the user writes:


the compiler generates

TheObject.TheMethod(“NYSX”, 30);

In other words, the compiler takes the default value that is specified in the method prototype and puts it into the method call – it’s just as if the user wrote ’30’ as the second parameter. There’s no way to change that default value without forcing the user of the class to recompile, which is unfortunate. The overloading model works better in this respect. The framework author just defines two separate methods, and the single-parameter one calls the two-parameter method. This keeps the default value in the framework, where it can be modified if necessary.

It would be possible for a compiler to take something like the C++ definition and produce the overloads, but there are a few issues with that approach.

The first one is that the correlation between the code that the user writes and the code the compiler generates is less obvious. Microsoft generally tries to limit magic when possible, as it makes it harder for programmers. The second issue has to do with things like XML doc comments and intellisense. The compiler would have to have special rules for how it generates doc comments for the overloaded methods, and intellisense would need to have smarts to collapse the overloaded methods into a single method.

Writing overloads yourself is a bit less convenient, but Microsoft thinks it’s an acceptable solution. Guess I’ll just have to get in the habit of being embarassed when I write code (or write more of it in a single language rather than bunny hopping all over the language garden).

Getting to know .NET and Microsoft samples

If you haven’t tried it already, C# and .NET is a pretty nice language/platform to work in. Some people are a little intimitated by the whole “OO” concept, but for old hacks like me who have been doing OO since the days of Smalltalk and Eiffel it’s just a walk in the park. Luckily there are two nice resources to get you going.

First, head on over to ASP.NET Web. There they have something called Web Matrix. It’s a free IDE that lets you build applications using .NET. There are also all kinds of tutorials and good stuff there. This would be the first place you should hit to get your feet wet on this whole .NET thing.

Next, Microsoft has got a nice download (just showed up last week) on their site. It’s a collection of 101 code snippets and examples in VB.NET and C#. There’s all kinds of good stuff here that will show you how to solve the most basic problems and give .NET a good run.

With these two toolkits in your hand, you should be well on your way in learning .NET. So what are you waiting for? Start coding!

Another new .NET app is born

As I was going through my old projects, one kept coming back to me. It’s an old script writing app that I created using MFC but never finished or released. There were a lot of these type of tools out there to help budding script writers get going, but in the end all they’re just glorified word processors. After spending some time with the GDI+ capabilities of .NET WinForms and the ease of creating Visio like applications I thought it might be a good idea to try something different.

StoryTime is a visual story editor where you can treat characters, locations, and interactions as objects. I’m taking the approach that everything is an object (well, that’s true of any OO developed system) where you can interact and “direct” it. Basically turn script writers into mini-directors, commanding characters and locations through speech and actions (which is what they do, but the intent is to get them doing it visually). It seems to make for a good paradigm with OO and takes a different look at writing scripts, rather than the typical word-processing formatting view of the world. Of course it’ll need to spit out the script as per the Hollywood standard, but that’s just a formatting thing that any XML programmer worth half his salt can do with a simple XSLT file.

Sure, another project to start that might take months (or years) to come to light. Oh well, back to some website work and Sims code this weekend as I try to practice what I preach and get some updates out there.

« Older posts Newer posts »