downloads, javascript comments edit

The new version has some pretty major restructuring and does lots of stuff better to allow for a more peaceful coexistence with other scripts:

Converted to “object oriented” JavaScript to avoid name clashes.

Fixed minor bug with positioning in newer browsers.

Safely attaching to all events (thanks to Phil Haack for this).

Updated so script is placed in HEAD of document.

Go get it!

Went to Target at lunch yesterday and saw they had, not one, but three of the Xbox 360 premium boxes in stock. Decided to wait until the next Tomb Raider came out before I picked it up.

Promptly returned after work and purchased it. Also got a second controller and Project Gotham Racing 3.

Hooked that bad boy up to the ol’ LCD TV when I got home and fired it up.

It’s awesome.

Jenn and I raced for quite some time and determined that it’s hella fun, but neither of us are really any good at that game. It doesn’t make it less fun, we’re just used to games like Burnout where the driving is vastly more arcade-oriented. It’ll just take a bit of practice, is all. The cool thing is that the two player [on the same screen] is so clear - it’s not like the other times we’re playing where you struggle to see where you’re going. The benefits of higher resolution, eh?

I didn’t join Xbox Live yet because I need to get the wireless network adapter (no network drop in that room), but once that happens, I’ll be in business.

I’m also looking forward to checking out some of the media capabilities. I’ve heard a lot about it; time to try it out firsthand.

Now I need to convince Stu and my dad to get one and we can all play together.

gists, csharp, net comments edit

A minor follow-up to my JavaScript and Unicode Character Validation entry (and sort of a reminder to myself):

Sometimes when working with characters in regular expressions it’s nice to be able to dump one or more characters as a line of Unicode hex escape sequences. For example, abc becomes \u0061\u0062\u0063.

Here’s a quick snippet for a console app that will let you input a series of characters and will dump out the list of characters entered as Unicode hex:

using System;
public class DumpHexChars{
  public static void Main(){
    Console.Write("Enter chars to convert to Unicode hex: ");
    string chars = Console.ReadLine();
    string output = "";
    for(int i = 0; i < chars.Length; i++){
      output += String.Format("\\u{0:x4}", Convert.ToInt16(chars[i]));

Got the cable phone hooked up on Saturday. Decided that we were tired of shelling out to Verizon for what has thus been sub-par service and that we’d go with the ol’ Comcast phone because we’ve always had good luck with their service and it’s actually cheaper for what we end up getting, all told.

While the guy was there he put in three new cable outlets (because not all of the rooms in the house had them… still not all of them have one, but I think there’s only one room that doesn’t that really might need one). That was cool. Plus, due to the new outlets, I can now put the cable modem right down next to the computer and connect directly to the network. Previously I was having to connect through wireless because, well, no cable drop was in the office. I’m movin’ up in the world, people!

Sunday I spent the day playing Paper Mario with Stu, which was hella fun since it’d been a couple of weeks since last we played. Made some good progress there and also tried the Papa John’s “Kong-Sized Pizza,” which was pretty ridiculously giant and filled us up nicely.

I would probably be remiss in not saying that there are a couple of friends of mine that are going through some hard times right now, so time was spent with them during the weekend as well. I won’t say more than that, since it’s not my place, but I hope they’re doing well and will continue to support them as needed.

Less serious: just found the Red Dwarf 8 DVD is coming out soon, and there’s a limited edition with a motorized scutter toy on it. Preordered!

gists, xml comments edit

Hanselman pointed out to me yesterday that Dan Suceava posted a VS add-in that finds duplicate RESX items by ID and prints out the duplicate names in a report.

Now, I’m all over VS add-ins and adding cool functionality to the development environment, but this feels a lot like overkill to me. I admit I didn’t go download the thing because, as neat as it sounds, it occurs to me that you could just jam a 10 minute XSLT together and find out the answer that way. (And who knows - the add-in may be doing just that.)

So, for those interested, here’s a quick-and-dirty XSLT that will go through a RESX file and print out a list of duplicate resources by ID along with a count of how many were found:

<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
  <xsl:template match="/root">
    <xsl:for-each select="data">
      <xsl:variable name="dataName" select="@name" />
      <xsl:variable name="currPosition" select="position()" />
      <xsl:variable name="numDups" select="count(/root/data[@name = $dataName])" />
      <xsl:variable name="numBefore" select="count(/root/data[@name = $dataName and position() &lt; $currPosition]/@name)" />
      <xsl:if test="$numDups &gt; 1 and $numBefore = 0"><xsl:value-of select="$dataName" /> (<xsl:value-of select="$numDups" />)&#0013;</xsl:if>

A sample report might look like this:

    ResourceID1 (3)
    ResourceID4 (2)
    ResourceID7 (4)

Used in conjunction with a command-line tool like nxslt, you’re set - specify your RESX file as the input XML, and the above as the style sheet. Done!