The End of MSDE?

Not to worry, no bad news here. The next version of MSDE is just going to be called something else: "SQL Server 2005 Express".

It looks like it has some nice improvements over MSDE 2000.

Style By Section

I have, for some time now, been using CSS to style sites that I have been working on. I typically use a style sheet named "all.css" to indicate that it is for all pages and all media. I then have a "print.css" for the print media.

Occasionally a site has multiple sections that each have slightly different styles. I typically create an additional style sheet for each section and link to the relevant style sheet conditionally.

This technique works well, but seems wasteful in situations where the styling for each section takes very few lines. I have, in the past, included the relevant styles on directly on each page (avoid this as it is a maintenance nightmare). Ideally, I could include styles for a given section in my primary style sheet and have them only apply to the correct pages automatically. Is such a thing even possible in CSS? Yes! (read on)

First thing's first. How does the browser know which page is in which section? For this, I use the often-ignored body tag. Although rarely used, the body tag (like most other tags) does have "class" and "id" attributes.

In this case, I will use the "class" attribute of the body tag (the "id" attribute would work just as well, but I reserve it for a similar use - more on that in a future post). Simply set the class attribute to the name of the section and then use the cascade to apply your styles to children of a body tag with a style matching that section.

Clear as mud? How about we look at some examples.

Let's say that I have a section called "Careers" (keep in mind that if your section names don't work as a valid CSS class that you will have to modify them so that they do - ditch spaces for example).

<body class="Careers"gt;

Now, I want to style the color of every h2 tag on any page in the careers section (without changing the appearance of h2 in any other section):

body.Careers h2 {color:#9b6340;}

Basically, what this tells the browser is that it should apply the given color (#9b6340) to any h2 tag that is enclosed by a body tag with a class of "Careers".

That's it! Let me know how you make out.

UPDATE (3/06/2005)

This technique can also be used to set current menu state.

Extracting Date from SQL Server datetime

I was working on a project yesterday that required me to get a date from a SQL Server datetime field. I needed it to return just the date (not the time), but for the life of me I couldn't figure it out (don't worry about why, just go with me here).

I called my good friend (and local SQL Server answer-man), Will Spurgeon. As usual, he came through for me. I never would have guessed the answer:

[More]

I've Been Published!

ColdFusion Developer's Journal saw fit to publish an article that I submitted to them. I am pretty excited about it and I actually think it is a pretty good article (me, biased?).

As I am unlikely to write anything particularly interesting here, you may as well read my article. Let me know what you think.

Reusable (and Maintainable) Presentation Code

My First Entry

Well, I have decided to join the party and start my own blog. I am not convinced that I have anything worthwhile to say, but I thought it would be interesting experience (even if I am the only person who ever reads it).

I am basically planning for this to be a log of my journey to become a better web programmer. Who knows what it will end up being? Maybe I will even say something interesting along the way.

BlogCFC was created by Raymond Camden. This blog is running version 5.8.001.