Skip to content

Author Archives:

New MFC App with ATL, VC6.0

11-Jan-09

OK, so we’re still using VC6.0.   Gluttons for punishment, I guess. I recently created a new MFC app and had some… opportunities getting it to compile, so I thought I’d document them here for the three other people in the world not on VC9. First: when you start a new MFC app and switch […]

STL lower_bound: set vs. list

01-Oct-08

Commentor Paul asks why we would use a list instead of a set, since a set has an efficient lower_bound() method and has cheaper insertion/deletion than a sorted vector; set insertion also preserves iterators. First, recall the the lower_bound() on a list problem is purely a hypothetical, and I’m not using this data structure anywhere. […]

Snapback2: –link-dest arg does not exist: ../hourly.1

19-Sep-08

I added a new host to snapback a while ago and started getting these horrible messages mailed to me by cron every six hours.  The entire body of the email was: —link–dest arg does not exist: ../hourly.1 I finally fixed it today. The problem?  Snapback was backing up an empty directory.  One solution would be to […]

You’ve been coding for the Intel platform too long when…

03-Sep-08

You know you’ve been coding for the Intel platform too long when “eax” looks more like a word than “wax”. I typed “wax”; it looked wrong, so I semi-consciously backspaced out and retyped it as “eax”. Which looked more correct. Then my conscious mind realized I really did want “wax” so I changed it back.

Problems with Redundant dhcpd/dns (part 2)

25-Aug-08

As I mentioned last time, I ran into some challengesincredibly annoying problems setting up a dhcpd failover server. 1. Dhcpd doesn’t record full data for foreign leases. At first I thought it would be enough to run dhcpd with a failover peer and use djb_update.pl to create the host list for tinydns.  But then I […]

Redundant DHCPd and Tinydns Setup (part 1)

22-Aug-08

Here are the before and after pictures. We used to have two independent single points of failure. If boris was down, nobody could get an IP address, and internal name resolution didn’t work because the cache couldn’t see the tinydns server (on boris) that is authoritative for the internal network. If draco the firewall was […]

djbdns and DHCP server

19-Jul-08

There is a script for extracting DNS data from dhcpd.leases that I’ve been using for a few years.  It generates a tinydns data file which can be merged with the static file. But I am not content with only one DHCP server.  I have implemented a backup/failover server.  Now I have twice the problems! The […]

DHCP and djbdns

17-Jul-08

DHCP assigns IPs to hosts; DNS reports IPs by hostname. The popular dhcp server is even written by the folks who brought you BIND. But in our shop, we run djbdns. I am not a full convert to the djb way. (We run postfix, for example.). I have never met the man in person. I […]

Use STL lower_bound even though it’s slower

03-Jul-08

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

02-Jul-08

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 […]