Rory Primrose

Learn from my mistakes, you don't have time to make them yourself

View project on GitHub

ASP.Net Virtual Theme Provider 1.0

ASP.Net 2.0 is bundled with some great technology, especially what is available through the provider model. One of the new providers in 2.0 is the VirtualPathProvider. Scott Guthrie put out some information about this provider, as has David Ebbo in this post. My VirtualThemeProvider uses the ASP.Net VirtualPathProvider to provide flexible theme support for ASP.Net projects. There were two primary objectives for this provider. Firstly, I wanted to support the ability to filter directories and files that are available in a theme directory for a given named value. Secondly, I wanted to support a global theme concept that included the ability to merge the theme directory with the global directory.

Take the example of a web project that has mutliple themes that are assigned depending on the type of user. Each theme has a subset of styles that display that theme according to different accessibility requirements (such as vision impared users).

Read More

Triple grading

It has been quite a while since my last grading as I have spent this year focusing on the club and the students along with the other instructors. I was keen to move forward again, so my head instructor told me two weeks ago that I would be doing a triple grading, followed by a competition the week after that.

Yesterday was the grading/graduation. On the whole, it went really well. I graduated with three others, one beginner and two other advanced students. My wife and parents were there to support me which was really great.

The graduation started with kicking exercises which was a serious workout in itself. After the kicking exercises, we went into the patterns. We were asked to perform Gibbon Poomse and Taeguk Il Jang along with the beginner graduate. The other three of us were then asked to perform Taeguk Chil Jang and Taeguk Pal Jang. These last two are the ones that I have to perform at the competition next week. There were a few things that I could have done better with these yesterday so I will have the next week to work through that.

Read More

Styles come and go, but habits stick around much longer

I have been reading up on naming standards today. It has been quite a while since I challenged by naming convention habits.

This has all come about because I was using GhostDoc today to quickly put in the bulk of comments in an assembly for me to then go through and tweak.What I found was that GhostDoc didn’t like some of my parameter naming. This was the catalyst for my reading about naming standards after thinking about naming standards for quite a while.

I read Microsoft’s naming guidelines, but it seemed to not address the naming standards of member level variables. The closest discussion it seemed to get on the issue was guidelines for static fields. What standards are people using for member level variables? I read a recent post where it seems that everyone has a different opinion.

Read More

Code review amusement

I have recently fixed up some code from another developer. There were a few things in the code that I got a little chuckle about. The weird thing is that I have seen these coding behaviors in a few jobs that I have had.

First one that I have to laugh about (to avoid crying) is when developers comment out code blocks, then put a modified version of that code block below the commented version. Maybe this isn’t a bad idea, but seriously, if you are using a source control system then what is the point? Isn’t that what version control is all about? You can look at older versions of the same file, and usually, you can even compare the files to see what was changed.

The second one is when I come across code that basically says if true, do something, if false, then do something, else do something else. How is the else statement ever going to get hit? I’m all for defensive coding, but is this going too far?

I came across a third one last week, but I think I’ll keep that gem to myself.

Read More

Do movies to justice to geeks?

I just saw Dave saying his bit about representation of geeks in movies and TV. Overall, I think geeks get displayed in a way that is very unlike the majority of the geek population. While I agree with Dave, I think that some of the ideas in movies can also be the kind of things that geeks will want to use or build, no matter how impractical they are or difficult they would be to get.

Two things spring immediately to mind. The cool data searching tool used in Minority Report and the GUI compiler in Swordfish. While the GUI compiler offers no benefit at all, I just can’t go past a great UI no matter what it does or doesn’t do.

What’s your favorite piece of fictional movie/TV software?

Read More

Control registrations from web.config

Scott Guthrie posted some ASP.Net tips several weeks ago. There were heaps of great ideas that he put into his presentation, one of which was about registering controls for aspx pages.

User controls and custom controls that are used on a page need to be registered. The control registration allows a tag prefix to be defined and identifies the location where the control can be found. These control registrations are normally placed at the top of the aspx markup along with the page directive. If you drag and drop an unregistered control onto the page, the registration will be added for you (with the exception of dragging user controls onto the markup view).

If you happen to come across a situation where controls change location, assembly or namespace, then every registration for the controls affected will need to be changed. This means that, when using the typical control registration method, each aspx page that uses those controls needs to be changed. This maintenance problem is mostly solved by Scott’s tip of putting the control registrations into the web.config file by adding add elements under system.web/pages/controls.

Edit - Removed comment about this not working for master pages. Something must have gone wrong with my build as it was throwing compile errors with registrations missing from the master page. After emailing Scott and retesting this, I have found that it is fine and works with master pages as expected.

Read More

XML Intellisense in Visual Studio 2005

Last week, a colleague told me how to get intellisense support in xml documents in the VS2005 IDE. It is really easy, although there are some interesting quirks in the process.

To pull this off, you first need to get an xsd file that defines your xml file. The IDE uses the xsd file to know what elements and attributes are available for a specified location in the document.

The next step is to get at the property grid for your xml file. Just selecting the file in Solution Explorer and then displaying the Properties window doesn’t give you the property grid contents that you need. This property grid view just displays the generic properties for a file, rather than being more specific to the xml file type. To get at the property that needs to be changed, open the xml file and show the Properties window. You should now see that a Schema property is available.

Set the Schemas property value to the file path to your xsd file. I have found that the editor for the Schemas property is quite broken. The Add button doesn’t work and also has a few other issues. It’s easiest to just copy and paste the file path from explorer to the property grid rather than fighting with the editor dialog.


Read More

The goods are arriving

Just a couple of days ago, I went to the Perisher Blue site to see how the snow was going. There was nothing but grass apart from a light dusting at the top of the high mountains.

It’s a little different now.


Read More