30 Days of Tech: Day 1 - SystemTimer
Since this is the first 30 Days of Tech post, I’ll give you just a bit of background. If you read my earlier posts, it should be obvious that this commitment to 30 Days of Tech is an extension of the “30 Days of Gratitude” than Annie...
Hello from RailsConf 2008 + 30 days of tech
I’m a little behind the ball on this, but hopefully not too late to make a difference. If you ended up here because you heard my name at a RailsConf presentation, fear not! You’re at the right place. Don’t let the sparse technical...
30 Days of Tech: Day 2 - DeepTest
Zak Tamsen and Dan Manges gave a wonderful talk about the testing practices developed on projects we’ve been on. One of the themes throughout the presentation was the speed with which your tests should provide you with feedback. They mentioned...
30 Days of Tech: Day 3 - WaitForAjax
Here’s a quick one that came out of writing Selenium tests for an application with a fair amount of Ajax calls. Selenium provides a waitForPageToLoad command that does exactly what it says. It’s typically used after an action (such as...
30 Days of Tech: Day 4 - monkey_patch.js
Yesterday I posted a fix for prototype.js that ensures that the Ajax active request count remains correct even if an application provided hook causes an exception. In the fix I showed a snippet of code from respondToReadyStateChange function of prototype.js...
30 Days of Tech: Day 5 - The UnModule
There are many ways to change the behavior of an existing class in Ruby. Every so often you run into a new set of constraints that lead to to a way of doing it that you might normally reject, but is surprisingly sound in context. Here is an example...
30 Days of Tech: Day 6 - Overloading
One thing new Ruby users are sometimes surprised by is Ruby’s lack of overloaded methods. Once you get used to duck typing you quickly realize why this is a strength for Ruby rather than a weakness. Nonetheless I have often wondered what it...
30 Days of Tech: Day 7 - Mephisto Hacking
f you were paying close attention, you may have thought I missed a day on Thursday with the 30 days of tech. It turns out that you would be both right and wrong. I wrote the post on Wednesday night and asked Mephisto to publish in on Thursday since...
30 Days of Tech: Day 8 - Cron Woes
Yesterday I wrote about a Ruby script I set up to be run by cron that would make sure pages cached by Mephisto were cleared for future-dated articles that I publish. After I wrote the script and added the cron entries for it…
Yesterday I wrote...
30 Days of Tech: Day 9 - MacBrick
Some colleagues on my current project got together tonight to do some Rubinius hacking. Pat organized the event as a way to jump start us with the goal of getting Rubinius working on everybody’s laptop and start digging into the code, possibly...
30 Days of Tech: Day 10 - Super Stub!
If you’re a Rubyist, doing TDD, and using mocks and stubs of any sort you may have encountered difficulties with mocking or stubbing super calls in subclasses. The reason is simple: super isn’t a method, so you can’t mock it with...
30 Days of Tech: Day 11 - Method Sorta Missing
Method missing magic can often be a code smell leading you to question your design. Sometimes, however, it can be a boon. For those of us who have trouble spelling or remembering the exact names of methods, we can make method missing help with method...
30 Days of Tech: Day 12 - Class Vars
Ruby has class variables, which are somewhat similar to static members of classes in Java. They can be used to conveniently share references between class methods and instance methods on classes. Ruby’s class variables have some very surprising...
30 Days of Tech: Day 13 - Self Eval
Ruby provides a method, eval that accepts a string and evaluates it as Ruby code, returning the result. Since all Ruby code is evaluated in the context of an object, what is self for eval? ...
Ruby provides a method, eval that accepts a string and...
30 Days of Tech: Day 14 - Minlength Enum
Here’s a hack I cooked up some time ago for situations where you want an enumerable with a minimum length. It decorates an existing enum instance (an object supporting the each method) to contain a minimum number of objects, returning a “filler”...
30 Days of Tech: Day 15 - Git Uncommit
One nice feature of git’s distributed nature is that if you haven’t pushed a commit to another repository, you can actually undo the commit, erasing it from git’s history. This is nice if you screwed up a commit and want to redo...
30 Days of Tech: Day 16 - Line Animation
Here’s a little something pulled out of one of my personal projects. It’s a class to help with single line animations on the command line. You construct it with an output device (something supporting <<, like STDOUT) and a list of...
30 Days of Tech: Day 17 - Nesting
ruby-doc.org describes Module.nesting as “the list of Modules nested at the point of call.” What does this really mean? ...
ruby-doc.org describes Module.nesting as “the list of Modules nested at the point of call.” What does...
30 Days of Tech: Day 18 - Ajax Defined JS
If you’re using prototype.js for Ajax and updating your page with HTML that defines new javascript functions, you’re likely to encounter issues. One solution is to pull the function definitions out of the HTML to a javascript file that...
30 Days of Tech: Day 19 - instance_eval & Method#to_proc
Ruby has instance_eval that accepts a block and executes it with self set to the receiver of instance_eval. Ruby also has a method called method that returns a Method object representing a callable method on an object. Method objects, in turn, have...
30 Days of Tech: Day 20 - Unmixed Methods
mixology is a Ruby extension implemented by some of the Something Nimble collaborators. In short, it allows you to add modules to Objects (much like Ruby’s extend), but in such a way that they can also be removed. Mixology refers to these operations...
30 Days of Tech: Day 21 - Object Literals
You can do object oriented programming in both Ruby and Javascript. I think most people would agree that Ruby is “more” object oriented than Javascript, whatever subjective judgement they’re using. One thing that’s interesting...
30 Days of Tech: Day 22 - Class#to_proc
Here’s a little hack for Ruby classes that comes from a project.
class Class def to_proc method(:new).to_proc end end If you’ve ever used map (a.k.a. collect) to create a bunch of objects you might be familiar with code that looks something...
30 Days of Tech: Day 23 - DearSoul
class DearSoul def self.new(first, last) ObjectSpace.define_finalizer(allocate, proc {|id| puts "Goodbye, #{first}. We'll miss you." }) end end DearSoul.new("George", "Carlin")
30 Days of Tech: Day 24 - drubyall
When we first started trying to use distributed DeepTest, we quickly ran into an issue with DRb servers not binding to the correct addresses. DRb does provide a way to bind to 0.0.0.0 to listen to all addresses, but there’s a downside to the...
30 Days of Tech: Day 25 - Gem dependency version
RubyGems and I had a fight. It was about what version of net-ssh we wanted to have installed on my machine. RubyGems wanted the latest (2.0.2) and I wanted a 1.x version (1.1.4). Apparently net-ssh 2 has an issue with sshing into Fedora Core 4, which...
30 Days of Tech: Day 26 - Fixnum#object_id
In Ruby every object has an object_id that uniquely identifies that object in that particular instance of the Ruby process. Ruby also treats integers as objects—they are instances of Fixnum. For efficiency reasons, though, Ruby implements integers...
30 Days of Tech: Day 27 - Short Circuited Timeout
Ruby’s timeout method operates by raising a exception, Timeout::Error. Timeout::Error inherits from Interrupt, SignalException, and finally Exception. In particular, it doesn’t inherit from StandardError, which means it isn’t caught...
30 Days of Tech: Day 28 - lambda args
The Ruby documentation for the lambda method (a.k.a. proc) says “Equivalent to Proc.new, except the resulting Proc objects check the number of parameters passed when called.” This is almost exactly right. There are, however, at least two...
30 Days of Tech: Day 29 - C, Ruby, & Threads, Oh My!
When Philippe and I worked on SystemTimer together we went back and forth about how much to write in Ruby and how much to write in C. Writing purely at the C level gave us more control over what was happening in the Ruby process as we installed and...
30 Days of Tech: Day 30 - Haskell Decompose
Some time ago Tom, a friend, presented a math programming challenge to a me and a few others. The challenge was to create a function that when given a positive number would return a set of all the sets of positive numbers whose sum was the original...
DeepTest 2.0 in the works
I’ve started on a significant overhaul of DeepTest which will be released as version 2.0 when it’s finished. I thought I’d share some of my plans for what 2.0 will include and some thoughts about what might come versions after. I...
DynamicTeardown
I ran into a situation while working on DeepTest recently where I wanted an object to start a temporary drb server in the middle of the test and have it be stopped automatically at the end of the test. Ideally, I wanted to encapsulate inside the class...
Now Hosted on EC2
I’ve moved the hosting for this blog from my old VPS into Amazon EC2. My calculations indicate this should save me around $9-$10 a month when using a single reserved m1.small instance. This is a pretty good deal since an m1.small instance has...
Come to the first AFPUG Meeting!
I’m pleased to announce that ThoughtWorks is sponsoring the first Atlanta Function Programming Users Group meeting. All the info is here at our google group page. I’ll be giving a short introduction to the Haskell programming language...
The Dark Side of Elastic IPs
Did I inherit thothle.ca?
Google “David Vollbracht”. What domain name comes up? Right now the domain is thothle.ca. In fact, you may even be viewing this page on thothle.ca. This is quite awkward, as I do NOT own thothle.ca. I’m...
First AFPUG Meeting!
Last night we held the first Atlanta Functional Programming Users Group meeting at the ThoughtWorks office in Atlanta. I gave a short introduction Haskell, which generated a lot of good questions. You can check out the presentation at the group’s...
DeepTest 2.0 Prerelease + New Maintainer!
I’m very pleased to announce that Scott Sims is now an official maintainer for DeepTest! For the time being the github location remains the same, but Scott will be taking on the active work in putting together the final 2.0 release.
In case...
The Expression Problem - Haskell
I've been having fun with Haskell again lately, so when I came across this post (via @rickasaurus) about the expression problem, it got me thinking about how I'd approach the code in Haskell. The functional language example that Robert gives doesn't...
Headache.new(Unicorn + Capistrano + Bundler + USR2)
If you're running Unicorn with Bundler and deploying with Capistrano like we are at Flipstone, you may run into trouble if you implement USR2 based restarts with Unicorn. It may appear as if Unicorn is ignoring your USR2 signal and never launching...