CSS Comma-separated Lists

If you’re writing semantic HTML, a list should be an HTML list.  But what if you want to display it as a comma-separated list of values?

Here’s our HTML.

<ul class="example">
	<li>Item One</li>
	<li>Item Two</li>
	<li>Item Three</li>
</ul>

Here’s the CSS.

ul.example {
	list-style: none;
	margin: 0;
	padding: 0;
}
ul.example li {
	display: inline;
}
ul.example li:after {
	content: ", ";
}
ul.example li:last-child:after {
	content: "";
}

And here’s the result.

  • Item One
  • Item Two
  • Item Three

Lost in the Corn

What would you do if you and your family lost your way in a corn maze?

From USA Today:

“I don’t see anyone, and I’m really scared, it’s really dark and we got a 3-week old baby with us,” a woman told the 911 operator.

Watch the video behind the link.  They even have some of the audio from the 911 call.

These people sound like real winners.  After getting lost in a corn maze with signs and maps posted all over the place, they panic so much that they call 911 rather than just walk through the corn.  Also, I admittedly don’t have kids, but 3 weeks old seems a bit young to take to a corn maze.  I feel sorry for those kids.

The 42-year-old husband, who did not want to be identifiedtold The Boston Globe they called 911 around 7 p.m., about an hour after the maze closed when they realized they were the only ones inside.

[Emphasis mine.]

No shit!  I wouldn’t want to be identified either.  This guy can’t even protect his family from corn.  Can you imagine what his friends would say?

Range Budgeting

Shelley over at Gun Nuts has a good post about budgeting for range practice.

5. Put down the Starbucks and go to the range

When it comes to practice putting 50 rounds down range once a week is all it takes to maintain a pretty decent skill level with a firearm. Look at the dry fire routine above, it gives you a way to work one day live-fire practice a week in. The cost is only $10-$15 a week – the cost of a daily coffee, a weekly pack or two of cigarettes, or a couple trips to a fast food joint. Seriously, put down the Starbucks and go to the range.

This is what keeps me from practicing more than anything else.  I go to the range so infrequently that I feel like I need to spend three hours and $100 in ammo, which keeps me from going more often. It’s a vicious circle.  Planning on a thirty-minute range trip that costs $15 once a week is a much easier pill to swallow.

Another good way to keep the costs down is to shoot more .22.  I think the best money I ever spent on a gun was when I bought my 22/45.  You can shoot that all day for $20.

Truncate SQL Server Time

Today we needed to truncate the time portion of a DATETIME field.  In the past I’ve always used the method of converting it to a FLOAT, truncating the fraction and then converting the result back to a DATETIME.

SELECT CAST(FLOOR(CAST(GetDate() AS FLOAT)) AS DATETIME)

This works because when you convert the DATETIME to a FLOAT the integer portion contains the date and the fractional portion contains the time. The call to FLOOR truncates the fractional portion, leaving only the integer representation of the date.

However, if you are worried about performance, there is a faster way.

SELECT DATEADD(dd, DATEDIFF(dd, 0, GetDate()), 0)

The DATEDIFF(dd, 0, GetDate()) will get the number of days since 0, SQL Server’s minimum DATETIME value. Adding that back to 0 using DATEADD will result in the date without the time portion.

I like the DATEADD method better than the FLOAT method and will use it from now on.

  1. For maintainability, the DATEADD method is much clearer.
  2. When you convert a DATETIME to a FLOAT you lose some precision, which is okay when you are truncating.  Using the second method prevents the unintended use of a FLOAT conversion when precision does matter.

No Internet Explorer 6 Support

I am still tweaking the theme of this site and today I started verifying the layout of the site in other browsers.  I use Chrome daily, so the site naturally looked fine in Chrome.  Safari, Firefox, Opera and Internet Explorer 8/9 all looked fine too.  I had to fix a small Internet Explorer 7 bug, but it wasn’t a big deal.

Then I tested Internet Explorer 6.  Wow!  It’s been years since I’ve dealt with pre-IE7 browsers and I’d forgotten how bad it is.

Natural Jenius Rendered by IE6

I hate IE6

According to NetMarketShare, IE6 still has 8.6% of the desktop browser market.  I suspect this is primarily corporations reluctant to upgrade because they still use internal legacy web applications that will break on newer browsers.  (You shouldn’t be reading my blog at work anyway.)

For now, I have decided to drop IE6 support from this site.  The content is still readable, even if it looks terrible.  I will reevaluate in the future when I have enough visitor statistics to see how many are using IE6.

If you’re reading this in IE6, what are you waiting for?  Upgrade to Chrome, Firefox or Safari!

Behind the Scenes of Natural Jenius

I was going to spend the first post introducing you to the blog and telling you about me, but I blew my wad on the About page.  Check it out if you want to learn more about me.  Instead, I am going to give a few details about this site’s setup and my experience getting it up and running.  Let me know your thoughts in the comments.

Software

We are running the latest version of WordPress (v3.2.1 at the time of this writing).  This is my first blog, so I don’t have any previous experience with blog software.  I chose WordPress because of its popularity and so far I haven’t been disappointed.  The setup was very easy and I had test posts in the system within a few minutes.

The theme, designed over the weekend, is custom for this site.  I’m using a few plugins, including Jetpack, Akismet and Quick Cache.  There are so many choices in plugins it’s hard to know where to start, but these seemed pretty crucial.

One of the benefits of WordPress is the massive amount of available information to solve almost any problem. The documentation is excellent, and there is plenty of extra help available by searching Google.  I definitely have a lot of reading ahead of me.

Hosting

GoDaddy is our hosting provider.  How can you go wrong with a company that spends millions on risqué Super Bowl commercials?  We already had an account there, so I stuck with them because it was the fastest way to get this joint up and running, but I’m not a huge fan.  Their site is plastered with so many ads and attempts to up-sell it’s like a used car salesman is my web host.  Their tools are as slow as molasses, and I’m on a shared host with over 6,500 other domains, which really slows the site down.

The biggest hurdle was that the domain wouldn’t transfer over to the host correctly, giving me the dreaded “Sorry, this page is not currently available” page.  I double-checked all the DNS settings and verified that the DNS changes had propagated to me.  No dice.  It was definitely something on their end.

On the plus side, their customer service is very good.  I had a real human, named Todd, on the phone within two minutes.  Todd found the problem immediately and told me that they were working on it.  By the time I woke up in the morning everything was working perfectly.  Thanks, Todd!

I will eventually move over to a different host when our current account is up for renewal.  If anyone can suggest a good web host, please let me know in the comments.