Richard Tallent’s occasional blog

Roman Numeral Conversion Library

Github didn’t have enough Excel macro modules, so I added one: my library for converting between decimal integers and Roman numerals. https://github.com/richardtallent/RT.Roman I spend a lot of time in Excel in my day job. While I’m a software developer, I work in a group of consultants on a variety of projects, sometimes using applications I manage written on ASP.NET, but also using complex spreadheets (and, for many project, a combination of the two). Read more →

SSL, Finally

Another “finally” post. I’ve wanted to convert this blog and my main site to SSL for awhile. I don’t do financial transactions through my sites, but some of the latest web tech (such as service workers and push notifications) requires SSL. Google seems to be heading in the direction of prioritizing secure web sites in its search results, and I also don’t want someone else’s ISP to inject ads on my site, recompress my images, etc. Read more →

Switching to Hugo

I’m finally free of WordPress! Don’t get me wrong. WordPress is an incredibly powerful platform for blogging. It was reasonably easy to set up, use, and update, and I only used a fraction of its capabilities for this blog. It served me well for the past decade. My issues with WordPress boiled down to: My blog was literally the only thing left on my server using PHP and MySQL. The rest of my site uses a . Read more →

ASP.NET Core Web API in Production on OS X

My main web site (http://www.tallent.us/), which is mostly comprised of galleries of my art photography, runs on a MAPP stack — Mac OS X, Apache, PHP, and PostgreSQL. I’ve been playing with ASP.NET Core and loving it, and I’ve been wanting to make the switch to using it for the web gallery API. I prefer C# over PHP, and it’s a good real-world project to learn the new bits, since my day job will be using legacy ASP. Read more →

A Silly Hack Around the Excel Cell Character Limit

Users will always find the limits of your application. I manage a web application where users primarily edit data by importing and exporting Excel files. This allows them to work on huge swaths of data without the limitations of a web-based interface. The workbooks store 1-to-many relationships using comma-delimited lists of integer IDs, and use macros, validation, etc. to maintain referential integrity. For almost all cases, this works perfectly, it’s unusual to have more than 100 relationships of a given type for any entity. Read more →

Managing EPPlus Macro Modules

I use EPPlus to create Excel workbooks server-side, and overall it does a great job — it’s far better than mucking around with OOXML file internals directly. While it supports adding VBA code modules to the workbooks you create (normal modules, or Workbook, Worksheet, or class modules), the VBA code itself that you want to insert is a string, and unless your VBA code is incredibly simple, using C# string constants is going to quickly become a pain. Read more →

Contracts are a poor substitute for strong typing

I was reading about some planned C# improvements on the Roslyn forum and decided to cross-post my thoughts here that I made in a comment on a thread that included a discussion about code contracts. The comment follows: Code contracts would be an improvement, but IMHO they treat the symptom, not the disease, as it were. Say your method only accepts whole numbers, but uses an `int` parameter, which can theoretically be negative. Read more →

Optimizing Character Replacement in C#

For some time, I’ve had a utility function that cleans strings of Unicode characters that can cause issues for the users of the applications I manage. It runs through a series of regular expression statements that replace problematic Unicode characters with replacement strings. In the examples below, I’m showing only the replacements related to single-quote characters. In the full code (which has 10 separate RegEx calls), some characters are simply stripped out, others are replaced with two-character strings. Read more →

SQL Server needs dynamic enums

I manage a number of databases at work that have varchar/nvarchar columns with very restricted values — usually fewer than a dozen valid choices. The problem is that storing and indexing these values in Microsoft SQL Server is highly inefficient. Enterprise Edition users can work around this by partitioning their tables on such a column, but (a) that only works for one column and (b) partitioning a table isn’t necessarily good for performance overall unless the partition function aligns well with the queries you tend to run on the table. Read more →

A replacement for evil outs

I was reading a post by Jon Skeet and he mentioned the evil of using “out” parameters. Anyone with a functional programming background understands what he’s referring to here — pure functions should have no side effects, they should only return a value. The problem is, the world isn’t pure, and it’s quite common to need to return multiple results. Probably the most common example in C# is the “TryGetValue()” pattern: Read more →