just another programmer blog

Main menu

Post navigation

I present to you some well-typed programs along with associated run-time and compile-time errors for pondering the meaning of well-typed. The context was me trying to understand the meaning of the quote “Well-typed programs cannot go wrong”. The exercise was illuminating for me but when I started writing explanations they got a little too philosophical so I’m just going to present the code and the errors. Continue reading →

The Ideal

You wake up full of ideas about new features and capabilities that can theoretically be added to the product you are working on. Several of these new features generalize existing functionality and get rid of corner cases that have been getting consistently flagged as bugs by users. The features and their underpinnings have been incubating for a while now and you’ve been working on sketches, mock-ups, and prototype code over the last few weekends. –

So it turns out that mv is an atomic operation if the source and destination are on the same device. This means that transforming and shuttling data between files can in theory be done in a transactional manner at the cost of some extra space. Here is an example workflow that came up at work: Continue reading →

Recently I had to build a chroot for CentOS 6.4 and I kept getting RPM DB errors. The errors were because I was building the chroot on a CentOS 7 box. After banging my head against the wall for a while I discovered that once yum is installed in the chroot it is much better to change into the chroot, rebuild the RPM DB to fix the errors, and then install all further packages from within the chroot. The finished chroot can be used as-is or imported into Docker.

Shell

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

#!/bin/bash

# NOTE: Seems like different versions of rpm build the database slightly differently and that causes

# some problems so once yum is there install everyting from inside the chroot.

# that forces the right version of rpm to be used and the db is no longer corrupted.

So it turns out making “broken things” and then “fixing” them by heeding the opinion of some person higher up in the social/corporate hierarchy is nothing new

According to Vasari Pier Soderini (the Mayor of Florence) was standing beneath the statue as it was put into place. The Mayor complained to Michelangelo that the nose was too thick. Michelangelo tricked Soderini by climbing the statue with a chisel and some marble dust concealed in his hand, pretending to work on the nose and sending down a shower of dust, he asked Soderini if it was improved, the Mayor replied “I like it better, you have given it life”.

I wish I could say that this kind of trickery is unnecessary in software but I would be lying.

In the previous post I covered deep copying and override merging two hash maps. This time I want to do something a little different. Instead of copying keys and values I’m going to provide a class definition that does look-ups without merging anything. Let’s begin with a skeleton and fill things in as we go along Continue reading →

The motivation for this one is that configuration for various development and production environments is often expressed in some kind of key/value format. Yaml and Json are the popular choices. You can also imagine at some point thinking that you can provide some kind of override mechanism for taking a development configuration and turning it into a production configuration by providing overrides for the keys you want to change in production. I’m not convinced this is a good way of doing things but let’s follow along anyway. Continue reading →

Update: Patrick McKenzie, Erin Ptacek, and Thomas Ptacek actually have a pretty good way of hacking the problem. I recommend heading their way and signing up for whatever it is they have in the works because there is no way it will be as bad as the usual technical interview process.

I’ve been trying to hack around the technical interview process but so far I’ve been unsuccessful. That’s not to say the experience has not been worthwhile. My ability to discriminate between professional software shops and amateur ones has increased a little bit. Here are the criteria I’ve settled on. Continue reading →

It is possible to do configuration management right but it is also possible to do it wrong. One way to do it wrong is to combine the provisioning and deployment logic into various cookbooks and isolate them from the applications that depend on them. The reason this is wrong is because to understand how the application works in production you now have to chase down dependencies somewhere else and once you get there the cookbooks will not make much sense because they will make assumptions about the application. This is all a long-winded way of saying you are keeping track of two contexts when in reality there is really just one context, the application and its associated infrastructure logic. Continue reading →