I needed to add some declarative error checking to some XSLT templates
recently. Specifically, I wanted to throw an error if my selects yielded an
empty string, indicating that the input XML was wrong.
Unfortunately, there seems to be no easy way of doing this in XSLT, nor in
XslTransform. The approved way is to validate against an XSD schema,
but for various reasons, I didn't want to go to the hassle of creating one.
I found a partial solution using xsl:message with the
terminate="yes" attribute. Under XslTransform.Transform() the
following code throws an exception if the XPath expression is empty.
<xsl:if test="not(/some/xpath/expression)">
<xsl:message terminate="yes">Missing expression</xsl:message>
</xsl:if>
<xsl:value-of select="/some/xpath/expression" …continue.
I installed dasBlog
at Emma's The Wheel site,
so that she and the other knitters
in Team Ireland
can blog during the 2006 Knitting Olympics.
What an ordeal that was!
But that's a post for another time.
(It's not working yet, due to permissions issues that require
the intervention of support at our
hosting site.)
I decided today to create a favicon for The Wheel,
based on the logo that I drew last year with Inkscape.
A favicon is a 16x16 icon which shows up in the tab in a tabbed browser,
such as FireFox or IE with MSN Search.
For example, the little gvr icon that shows up if you're reading this on …continue.
I've been trying to make Vim 7
compile with the
Microsoft Visual C++ 2003 Toolkit,
as a favor to Bram Moolenaar, the primary author of Vim.
He wants to be able to use the free compiler as the
primary build tool for the Win32 version of Vim.
Oh. My. God.
The VC2003 toolkit may include a full optimizing compiler,
but it's certainly far from a complete system for building
Windows binaries.
First, I discovered that it came only with the C library headers,
but not the Windows headers. That was easily rectified. Download the
Platform SDK.
Just the Windows Core SDK subset. This also got me nmake.
At this point, I was able to …continue.
I re-read Scott Hanselman's blog post on
using Consolas as the Windows Console Font,
and I decided to put together a
registry file
to make it a little simpler.
(You'll have to rename the file to console-font.reg after downloading.)
The registry file includes entries for:
- As Scott says:
- (I'm afraid I can't distribute Consolas online
or provide a download out of abject fear.
That said, you can find it in any version of the Longhorn bits.)
Or Office 12, I believe.
Update, 2008/01/15.
The Consolas Font Pack is the easiest way to get Consolas,
if you don't have Office 2007 or Vista.
Technically, you are supposed to …continue.
A year ago, I ran into a problem with Skype squatting on port 80,
which I had long forgotten about.
Today, I ran into one with Skype squatting on port 443.
I was trying to set up SSL on my Windows Server 2003 dev box.
My ultimate goal is to experiment with client certs and server certs for SOAP,
but that's a story for another time.
I was running into all kinds of strange problems,
exacerbated by the relatively strange IIS configuration on my machine.
I tried SslDiag.
In hindsight, it pointed me towards the underlying problem,
but I couldn't see it at the time.
I did a lot of digging …continue.
I learned a really clever trick at our workparty on Sunday.
We were using a dolly that we had borrowed from our neighbor Mary
to haul a heavy credenza up from the basement.
One of the tires was flat, which made the exercise even more difficult.
I got out my bicycle floor pump and started pumping,
but it was a waste of time.
The tire was tubeless and without any air,
so it just slipped loosely around the rim.
After a few minutes of futility,
Dale remembered something he had seen years before at a gas station.
He got a bowl of soapy water and a sponge,
and coated the metal …continue.
It may be old-fashioned, but I still find printf (and sprintf
and _vsnprintf) incredibly useful, both for printing debug output
and for generating formatted strings.
Here are a few lesser-known formats that I use again and again.
See MSDN for the full reference.
%04x - 4-digit hex number with leading zeroes
A quick review of some of the basics.
%x prints an int in hexadecimal.
%4x prints a hex int, right-justified to 4 places.
If it's less than 4 digits, it's preceded by spaces.
If it's more than 4 digits, you get the full number.
%04x prints a hex int, right-justified to 4 places.
If it's less than 4 digits, it's preceded …continue.
« Next