Skip to main content

RS and XSLT, pt1: Applying a Basic Transformation

· 2 min read

It was driving me nuts — my transforms just wouldn't apply. I tried working with some fake data, from my little-used O'Reilly XML in a Nutshell, and that worked fine. So why couldn't I transform my Reporting Services output? After banging my head against this one for a while, I finally decided to mess around with the root <Report ... /> node, first by removing all the extra elements (because my samples did not have any elements in the root node). Voilà, the transform now works. Why is that?

SSIS: Suddenly Can't Write to Buffer

· 2 min read

Problem

periodically, one of my SSIS packages was throwing an error saying "The buffer manager cannot create a temporary storage file on any path in the BufferTempStoragePath property. There is an incorrect file name or no permission." The package in question then would hang, locking a file that it was trying to import.

Warning About User Defined Functions in SQL Queries

· 2 min read

I was looking at a query today that has an inline expression in it, something similar to

CASE WHEN myTable.myColumn < 5 THEN NULL ELSE myTable.myColumn END

This particular piece of business logic is used in many different places (well, not literally, since I made up a fake example), so I created a UDF to simplify the queries that use this statement. Suppose that UDF is called dbo.fnNulifyMyColumn.

Validating XML Via Embedded XSD Schema

· 2 min read

Problem

You have some XML, and you need to validate it against a custom schema that you want to deploy with your .Net 2.0 assemblies. Issues addressed: opening the file and handling the schema validation.

Solution

The XmlSchema class contains a Read method that takes a stream as a parameter. Nicely matching up to that, you can open a stream from an embedded resource (dead link removed; SF 2025).So, embed the schema. In Visual Studio's Solution Explorer, right-click the schema file and choose properties. Change the Build Action to "Embedded Resource".

Viewing Embedded Images in HTML E-mail (Base64)

· One min read

Problem

you have image data from an HTML e-mail, but don't know what to do

with it. When you save it to disk it comes out with a weird string instead of binary data.

Solution

pretty simple, you just have to know the terms. This string of data is actually Base64 encoded, which means that the binary data has been converted to a text string for easy transmission over text protocols. .Net Developer's Journal (dead link removed; SF 2025) has a good full explanation. All you have to do is convert the string over to a byte array using Convert.FromBase64String, then save your new byte[].

NUnit Ignores App.Config

· One min read

Problem

You want to run NUnit tests in a class library (dll). These test rely on an application configuration file (app.config) for some settings, i.e. custom appSettings or database connection strings. The code compiles and runs fine by itself, but your unit tests always fail. Attaching the Visual Studio debugger to NUnit and stepping through the code, you see that the config seems to be ignored.

Threading and Waiting with Delegates

· 3 min read

One of the casualties of not having a full computer science education is that I was barely exposed to threading. In my two Java classes we touched upon it, and wrote some basic examples in the second semester, but that could hardly be called extensive use. Thus, a number of years on, it has been a bit of a struggle for me to use threads in a practical manner. Further complicating the matter is that I've wanted to use anonymous methods (aka delegates) and generally want to do some work after all threads have finished executing.

Windows Keyboard Shortcuts

· One min read

I've always been a fan of keyboard shortcuts, using them whenever possible. Today I accidentally pressed the Windows key and D at the same time — and suddenly found that my whole desktop was revealed. How did I not know about this? A quick search led me to a great page with another 8-10 shortcuts I didn't previously know. Now you too can be enlightened about the many uses of the Windows key.

safnet logo