Author: William

Introduction to Foster Care

I’m going to go a little off-topic for this blog today and talk about something that’s not technology related but is important to me: foster care. My wife and I have been certified foster parents for several years now, and I find that there are a number of common misconceptions about what foster care is and how it works. What is foster care? Foster care is a way to provide homes and families for children who, for whatever reason, do not have parents who are able to care for them. Sometimes that means no living parents or parents who are currently unable to care for children; other times, this is children who have been removed from their homes due to abuse or neglect. Generally foster care is intended to be a short term solution until the children can be reunited with family members – if not their parents, then other relatives who would be willing to adopt. The actual length of “short term” may vary – children may be in the foster care system for days or years. There are approximately 400,000 children in foster care in the United States, including nearly 7,000 in Wisconsin. Who can be a foster parent? To be a foster parent, you must be at least 21 years old, have sufficient income to cover your own needs, have sufficient room in your home for...

Read More

Parsing doubles in Finland

One problem I had this week is that a piece of code which had, for the previous few years, been perfectly behaved suddenly started crashing for a new customer. This was the first time I’d seen the code run on a Finnish system, so a problem with internationalization seemed like the obvious place to start. Running the software on a fi-fi system, I found that a call to Double.Parse was causing a FormatException: Input string was not in the correct format. The issue here was that the code was attempting to parse a string which contained a software version number, e.g., “2005.100”. In a US English environment, this works fine – that gets parsed as 2005.1. In a German environment, this works fine – that gets parsed as 2005,100. Finnish, however, doesn’t use the period as either a decimal separator or a thousands separator, so when the system tried to parse the string, it didn’t recognize it as a number. The solution is to pass in the second parameter for Parse, which (at least in C#) is an IFormatProvider. When no IFormatProvider is given, the system defaults to InstalledUICulture, which means it was trying to interpret the string according to the system’s locale settings. By passing in InvariantCulture, I force it to ignore the locale settings and interpret the input as an English (no country) string. Double.Parse(version, CultureInfo.InvariantCulture) As...

Read More

On work, burnout, and recovery

A while back, I was asked what I would change about my job. My answer was that I would like to have more vacation time. In other words…what I would like to have for my job…is less of it. The funny thing is, I like my job. It’s consistently challenging. I have to do and learn new things all the time. The hours are semi-flexible, the dress code is practically non-existent, and the cafeteria is a major perk. All that – and it’s still easy to get burned out. I’ve been in the same job for seven years, now. There have been a few title changes – software developer to software developer II to senior software developer – the people are different, the languages are mostly different..but I’m still programming. Now, I like programming – I like technology in general – but I’ve never done the same thing for so long. I get bored and want to move on to something else. So why not move on from programming? A big part of it is the money, of course – being a software developer pays really well. I’m getting older and I have a family to support, which makes jumping around harder. On top of that, this is something that I CAN do long-term – there are new challenging all the time, which is what makes it interesting. And...

Read More

Improving query performance in SQL Server with recompile

This week I ran across a new-to-me option in some T-SQL code I was reviewing: OPTION (RECOMPILE). It turns out that this option improves performance by forcing SQL Server to recompile the query rather than using the plan it already generated. Wait, what? Don’t we save time by saving a query plan and reusing it? Generally, yes. When you first run a stored procedure, the SQL engine will figure out a plan for that procedure and cache the plan for reuse, thus saving the time of recomputing the it each time the procedure is run. The problem comes in when a plan is generated that makes sense for the current database state and parameters, but doesn’t make sense when those change. For example, suppose you have a table with ten million rows; different approaches are required if you want to retrieve ten of those rows vs seven million of them. Generating the query plan When the stored procedure is executed, SQL Server looks at the distribution statistics it has about the data in the tables the procedure references and uses this data to guess at the best way to run the query. Assuming that the statistics are up to date, it can generally make a fairly good guess; for example, it may choose an index seek if it expects to return a small number of rows, but a table...

Read More

Goals for 2018

I’ve never been a believer in New Year’s resolutions; there’s a reason it’s a cliche to start a new exercise program in January and abandon it by February. Resolutions tend to be things that people would like to do…and by the end of the year, they become things that people would have liked to have done. At the same time, goals can be worthwhile – especially if they’re SMART goals. A SMART goal is one that is specific, measurable, actionable, realistic, and time-bound. SMART Goals Specific: It is clear exactly what the goal is. Measurable: It is clear whether the goal has been achieved. Actionable: It’s clear what actions need to be taken to achieve the goal. “I will be a millionaire in a year” isn’t actionable; “I will spend at least two hours per week writing” is. Realistic: The goal is something you can realistically achieve within the given time bound. Time-bound: There is a deadline for when the goal will be accomplished. For 2018, I’ve decided to set New Year’s commitments. Why commitments instead of resolutions or goals? Because I’m committing that these are things I will get done this year (and I’ve actually set up a penalty for if I fail to accomplish any of them). In 2018, I am committing that: I will publish at least one book – this will probably be either my...

Read More