Richard Tallent’s occasional blog

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 →

Political post ahead…

I was trying to explain yesterday why my beliefs lean to left libertarianism (i.e., somewhat close to democratic socialism), and how that has absolutely nothing to do with Marxist Socialism or Communism. In short, it’s because I believe the government is not the enemy, nor is business. Instead, the enemy is *unfettered* corporate power and *unchecked* government. We check corporate powers through a combination of free-market capitalism (voting with our feet), unions, and where those are ineffective (and they are in a number of broad classes of corporate abuse), we use the law and the courts to regulate them. Read more →

“Take Our Country Back”

When someone says that, this is what I hear: TAKE — providing nothing in return, using force, manipulation, mob rule, bribery, obstruction, or any other means to achieve the goal. OUR — WASPs, aka “real” Americans. COUNTRY — militant nationalists, willfully ignorant of anything else going on around this tiny blue dot. BACK — back to the days when non-comformists and minorities of every kind were enslaved, ridiculed, railroaded, interred, denied the right to vote, and ignored in the courthouses and statehouses. Read more →

Ten Reasons I Hate Local News

Let me preface this by saying (a) I used to work in local television, and (b) I have friends who are or have been part of the industry, so I don’t really blame the on-screen talent or even some of the people behind the scenes. I hate local newscasts. I still record one newscast a day, and skim it about 75% of the time, usually during dinner. I’ve chosen the least objectionable local newscast, which for me is KFDM, but it’s still pretty terrible. Read more →

A Meaningful Backup Strategy for Photographers

For the second time in the past few weeks, I’ve heard of a photographer who lost many years’ worth of work due to their computer and drives being stolen. This has caused me to start re-evaluating my own backup strategy, and I thought I would share a few notes about what I’ve already learned and how I’m planning to improve my own data security. IMHO, a good backup strategy involves five prongs: good drives, local live backup, local online backup, remote backup, and portable backup. Read more →

Why House Batteries are an Unsustainable Idea

I greatly admire Elon Musk. He’s like one part Steve Jobs, one part Tony Stark, and he has a knack for making the impossible both possible and profitable. And usually just plain damned cool. But his latest idea, batteries for houses to store solar energy, makes zero economic sense for the vast majority of US homes. The sale pitch is as follows: Make energy while the sun shines but you’re at work. Read more →

Zero Tolerance for DWI

A friend of a number of my friends was killed yesterday by a drunk driver. Not just any run-of-the-mill drunk, but one that had at multiple DWIs on his record. As a result, my Facebook feed is full of calls for Texas to get stricter on sentencing for intoxication manslaughter, and comments range from “no parole” to “death penalty.” IMHO, this may serve our collective need for revenge, but it doesn’t address the core problem — drunk drivers are generally habitual, and tough sentencing for murdering someone with their car will absolutely not deter them. Read more →

Making Word 2010 Show ONE PAGE AT A TIME

I’ve been fighting with Word 2010 at work for months, trying to figure out how to simply view a document the way I want — ONE page at a time (not side by side), but also zoomed in to a comfortable reading level. Unfortunately, some asshole code weenie at Microsoft decided that Word 2010 would ALWAYS show pages side by side UNLESS you either (1) zoom in too far for two pages to fit (which is too wide), (2) resize your window to do the same (too distracting), or (3) choose a “one-page” view that zooms out so the entire page is on-screen (too small). 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 →