Coding


Posts From The Archive

WPF: Zoom In An Image On Application Load

I recently decided to create a new image viewer for Windows. I'm not a fan of the default Windows Photo Viewer and think most third party image viewers are even worse. The only one I've liked quite a bit is the viewer that comes bundled with Google's Picasa. However, Picasa itself no longer really fits into my digital photo organization strategy and I really hate to install all of Picasa just so I can have the peripheral 5% that constitutes its image viewer. So I decided to roll my own using WPF... [Read More]

Unit Testing HostingEnvironment.MapPath()

Without getting into all the whys and wtfs, the other day I had a need to dynamically render and inject html snippets into various webpages at runtime. The project I’m working on originally created the html in C# by concatenating string fragments and formatting them with runtime values. With all the requisite escape sequences needed to create valid html (including encapsulated JavaScript), this approach struck me as a bit messy and I decided to take a different route. [Read More]

List All IIS Websites And Process Ids

Recently I’ve found myself looking up IIS process ids juuuuuuust infrequently enough that I haven’t been able to memorize either the command itself or the file location for appcmd.exe, meaning I’ve been looking them up every time I’ve needed them. That, I decided, was too much work, so I actually wrote The Simplest Console App Ever™ to spit out the information for me. Memorization, schmemorization. Yep, because I’m just that lazy. [Read More]

LocalProcessingException Rendering LocalReport To Excel

A while back I needed a way to extract values from a LocalReport object. I wrote a proof of concept application that rendered the object as Excel/Xml data, then parsed that data using OpenXml. This worked perfectly well within the very limited scope typical of a POC, but when I finally got the chance to put it to real world use there were a few predictable snags. Most were reasonably simple to resolve but one - and only one - of the reports I was rendering resulted in this lovely error... [Read More]

Get Rendered LocalReport Values with OpenXml

How oh how is one to get XML from a local (not server) SSRS report? As it turns out, via Excel. The LocalReport.Render() method only supports Excel, PDF, and Image formats, but since the Excel 2007+ file format is just compressed XML, it didn’t take too much finagling to get what I was really after. The only thing I needed was the Microsoft OpenXml SDK, easily acquired through nuget. This code snippet shows how to get the rendered values from a LocalReport in memory: [Read More]

C# File Rename

I don't have a direct need for this little class anymore, but I hate to delete it. Seems like something that would come in handy at some point in the future. [Read More]