Skip to content

{ Category Archives } Programming

Dim Glimmers of Light

A lot of change this year. At the beginning of 2013 I said ‘goodbye’ to a longtime client (15 years).  It was time, and past time. Getting all my stuff sorted out and handed over took a while: I planned three months, it took only two, so I picked up and knocked off one more […]

ATL 3.0 (VS6.0) Control Creation Resource Leak

So yeah, this post isn’t about homeschooling.

Arrogance and humility

Arrogance and humility are two qualities that are essential to programmers (perhaps, to everyone?). It’s hard to maintain a balance between these two opposite behaviors, so practice is essential. Humility is important to prevent wasting your own and other people’s time. The simple manifestation of this is in troubleshooting. If something breaks in a system […]

Tagged ,

More about Python

I just realized that there is an (obvious) biblical objection to the language Python.  Adam and Eve used C, naturally.  The Python came into the Garden of Eden as a tempter, bringing dynamic language features.  Adam and Eve succumbed to temptation and were thrown out of the garden, and now they… uh… analogy breaks down. […]

Use STL lower_bound even though it’s slower

Summarizing the last few posts on STL lower_bound: instead of falling back to a naive algorithm when it’s not given a random-access iterator, STL’s lower_bound algorithm still performs binary search using bidirectional or forward-only iterators. This causes it to perform 2N list traversals, which is four times as many as the naive algorithm’s average case […]

STL lower_bound is better for complex keys, but still loses on large N

Testing a list<int> is pretty much the worst possible case for STL’s lower bound algorithm. Recall from the analysis that STL’s lower_bound uses a binary search algorithm even when the cost of advancing an iterator N steps is O(N). The advantage of this algorithm is that it only performs O( log N ) comparisons, as […]

STL lower_bound on lists four times slower than naive algorithm

Here is a comparison between the naive lower bound and STL’s version. Execution time reported in seconds was measured using the Windows high resolution timer. An STL list of integers 1-N was created by populating a vector, shuffling it, pushing the elements onto a list, and sorting the list. This was done so the list […]

Starting up a software solo practice

When I started contracting, I had just dropped out of grad school and was doing everything on a shoestring. I think we took an advance on my in-laws credit card just to buy me a machine, and my wife (who was still a grad student at that time) bought Visual Studio 6.0 Professional Edition at […]

Using precompiled headers in Visual Studio 6

I only learned how to use precompiled headers recently — even though I remember reading this paper about how to do it back in the late 90’s. It seemed like too much effort, then, and my then-blazing fast Windows NT 4.0 machine didn’t seem to need the help. Somehow, ten years later with a dual-core […]

Tagged

Why I hate python

I recently wrote a small internal program in python to automate our client’s builds: run everything overnight, collect the output, and generate some rudimentary web pages It wound up being 250 loc for the program, split into about three files; and 500 loc for the tests. I spent about 2-5 days on it, part time. […]

Tagged