This site provides the following access keys:

Brandan Lennox's

Articles (Page 3)

Branches: A New EP from The Dear Hunter

Okay, it’s not new, but I just discovered it.

Last year, Casey Crescenzo’s masterpiece of a band, The Dear Hunter, released a limited-edition super-cool-fan package featuring an exclusive EP entitled Branches. Since I totally would’ve bought that package had I known about it (totally), I felt justified in downloading a copy of the EP. It’s only three songs, but they’re all of utmost TDH quality and the first two cuts are titled B. Linus and Isabella. LOST references! Yesssssss…

Here’s B. Linus:

Branches will have to hold me over until they release all nine of the Colors EPs to hold me over until they release Act IV.

Fifty Programming Quotes

From an e-mail I received today.

  1. Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the universe trying to build bigger and better idiots. So far, the universe is winning. — Rick Cook
  2. Lisp isn’t a language — it’s a building material. — Alan Kay
  3. Walking on water and developing software from a specification are easy if both are frozen. — Edward V. Berard
  4. They don’t make bugs like Bunny anymore. — Olav Mjelde
  5. A programming language is low level when its programs require attention to the irrelevant. — Alan J. Perlis
  6. A C program is like a fast dance on a newly waxed dance floor by people carrying razors. — Waldi Ravens
  7. I have always wished for my computer to be as easy to use as my telephone; my wish has come true because I can no longer figure out how to use my telephone. — Bjarne Stroustrup
  8. Computer science education cannot make anybody an expert programmer any more than studying brushes and pigment can make somebody an expert painter. — Eric S. Raymond
  9. Don’t worry if it doesn’t work right. If everything did, you’d be out of a job. — Mosher’s Law of Software Engineering
  10. I think Microsoft named .Net so it wouldn’t show up in a Unix directory listing. — Oktal
  11. Fine, Java MIGHT be a good example of what a programming language should be like. But Java applications are good examples of what applications SHOULDN’T be like. — pixadel
  12. Considering the current sad state of our computer programs, software development is clearly still a black art, and cannot yet be called an engineering discipline. — Bill Clinton
  13. The use of COBOL cripples the mind; its teaching should therefore be regarded as a criminal offense. — E.W. Dijkstra
  14. In the one and only true way, the object-oriented version of ‘Spaghetti code’ is, of course, ‘Lasagna code’ (too many layers). — Roberto Waltman
  15. FORTRAN is not a flower but a weed; it is hardy, occasionally blooms, and grows in every computer. — Alan J. Perlis
  16. For a long time it puzzled me how something so expensive, so leading edge, could be so useless. And then it occurred to me that a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are, in short, a perfect match. — Bill Bryson
  17. In my egotistical opinion, most people’s C programs should be indented six feet downward and covered with dirt. — Blair P. Houghton
  18. When someone says: ‘I want a programming language in which I need only say what I wish done,’ give him a lollipop. — Alan J. Perlis
  19. The evolution of languages: FORTRAN is a non-typed language. C is a weakly typed language. Ada is a strongly typed language. C++ is a strongly hyped language. — Ron Sercely
  20. Good design adds value faster than it adds cost. — Thomas C. Gale
  21. Python’s a drop-in replacement for BASIC in the sense that Optimus Prime is a drop-in replacement for a truck. — Cory Dodt
  22. Talk is cheap. Show me the code. — Linus Torvalds
  23. Perfection [in design] is achieved, not when there is nothing more to add, but when there is nothing left to take away. — Antoine de Saint-Exupry
  24. C is quirky, flawed, and an enormous success. — Dennis M. Ritchie
  25. In theory, theory and practice are the same. In practice, they’re not. — Yogi Berra
  26. You can’t have great software without a great team, and most software teams behave like dysfunctional families. — Jim McCarthy
  27. PHP is a minor evil perpetrated and created by incompetent amateurs, whereas Perl is a great and insidious evil, perpetrated by skilled but perverted professionals. — Jon Ribbens
  28. Programming is like kicking yourself in the face: sooner or later your nose will bleed. — Kyle Woodbury
  29. Perl — the only language that looks the same before and after RSA encryption. — Keith Bostic
  30. It is easier to port a shell than a shell script. — Larry Wall
  31. I invented the term ‘Object-Oriented,’ and I can tell you I did not have C++ in mind. — Alan Kay
  32. Learning to program has no more to do with designing interactive software than learning to touch type has to do with writing poetry — Ted Nelson
  33. The best programmers are not marginally better than merely good ones. They are an order-of-magnitude better, measured by whatever standard: conceptual creativity, speed, ingenuity of design, or problem-solving ability. — Randall E. Stross
  34. If McDonald’s were run like a software company, one out of every hundred Big Macs would give you food poisoning, and the response would be, ’We’re sorry; here’s a coupon for two more.’ — Mark Minasi
  35. Beware of bugs in the above code; I have only proved it correct, not tried it. — Donald E. Knuth
  36. Computer system analysis is like child-rearing; you can do grievous damage, but you cannot ensure success. — Tom DeMarco
  37. I don’t care if it works on your machine! We are not shipping your machine! — Vidiu Platon
  38. Sometimes it pays to stay in bed on Monday, rather than spending the rest of the week debugging Monday’s code. — Christopher Thompson
  39. Measuring programming progress by lines of code is like measuring aircraft building progress by weight. — Bill Gates
  40. Debugging is twice as hard as writing the code in the first place. Therefore, if you write the code as cleverly as possible, you are, by definition, not smart enough to debug it. — Brian W. Kernighan
  41. People think that computer science is the art of geniuses, but the actual reality is the opposite, just many people doing things that build on each other, like a wall of mini stones. — Donald Knuth
  42. First learn computer science and all the theory. Next develop a programming style. Then forget all that and just hack. — George Carrette
  43. Most of you are familiar with the virtues of a programmer. There are three, of course: laziness, impatience, and hubris. — Larry Wall
  44. Most software today is very much like an Egyptian pyramid with millions of bricks piled on top of each other, with no structural integrity, but just done by brute force and thousands of slaves. — Alan Kay
  45. The trouble with programmers is that you can never tell what a programmer is doing until it’s too late. — Seymour Cray
  46. To iterate is human, to recurse divine. — L. Peter Deutsch
  47. On two occasions I have been asked [by members of Parliament]: ‘Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?’ I am not able rightly to apprehend the kind of confusion of ideas that could provoke such a question. — Charles Babbage
  48. Most good programmers do programming not because they expect to get paid or get adulation by the public, but because it is fun to program. — Linus Torvalds
  49. Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live. — Martin Golding
  50. There are two ways of constructing a software design. One way is to make it so simple that there are obviously no deficiencies. And the other way is to make it so complicated that there are no obvious deficiencies. — C.A.R. Hoare

Machinist and :validates_uniqueness_of

I’ve lately been having a problem with Machinist while running specs on models using :validates_uniqueness_of. Sometimes an example will fail with a spectacularly unhelpful “Item is invalid” error message when it ran fine just moments before.

I eventually discovered that when an example fails, Machinist doesn’t always destroy all the records it created. This means that data may be left in your test database between examples or invocations of your spec task (if you’re using script/spec). I had been solving this problem by emptying a few important tables in a before(:all) block, but that destroys fixtures that other specs may depend on. So I couldn’t do that anymore.

The problem actually lies with Sham. It will attempt to generate unique values for the lifetime of a single invocation of a spec, but one of its selling points is replicability. Each invocation of a spec results in the same sequence of values for a given attribute. So if the first User generated by Machinist gets the login “buntaluffigus,” and the example fails for some reason, then that user persists to the next run of the spec, at which point Sham will generate the login “buntaluffigus” again, and assuming User logins must be unique, this new model will fail validation and you may simply see that some “Item is invalid.” Sucko.

So blah blah blah, ultimately I had to monkey patch Machinist::Lathe to check for any attribute who :validates_uniqueness_of itself. It depends on Christopher Redinger’s validation_reflection plugin and this file in spec/support:

# spec/support/machinist_monkey_patches.rb
module Machinist
  class Lathe
  
  private
  
    def generate_attribute_value_with_uniqueness_check(attribute, *args, &block)
      value = generate_attribute_value_without_uniqueness_check(attribute, *args, &block)
      if attribute_must_be_unique?(attribute)
        while object.class.first(:conditions => { attribute => value })
          value = generate_attribute_value_without_uniqueness_check(attribute, *args, &block)
        end
      end
      value
    end
    alias_method_chain :generate_attribute_value, :uniqueness_check
    
    def attribute_must_be_unique?(attribute)
      object.class.reflect_on_validations_for(attribute).detect { |v| v.macro == :validates_uniqueness_of }
    end
  end
end

Now all my examples run like they’re supposed to, regardless of fixtures or previous failures or the position of Ares in the fourth quadrant. YESSSSSS.

I Could Design for Apple

I’m updating my résumé right now and decided to look through some Pages templates for ideas. This is how it looks in “San Francisco”:

My résumé in the San Francisco template

Helvetica Neue? Magenta accents? Black on white? This looks so familiar…