December 2008
28 posts
Christmas Tree in the Shell - good coders code,... →
Summary: On a system with perl do ~$ sudo perl -MCPAN -e 'install Acme::POE::Tree' ~$ perl -Macme::POE::Tree -e 'Acme::POE::Tree->new()->run()' Merry Christmas!
Dec 25th
Vi and Vim Autocommand: 3 Steps to Add Custom... →
Tutorial on how to create templates for filetypes with vim. Also a good general intro to autocmd’s
Dec 25th
struggling with restfulness - Ruby on Rails: Talk... →
Short but descriptive post on the meaning of “RESTfull”
Dec 25th
News
Sitting at the kitchen table drinking coffee and reading off of my laptop this morning I had a thought: Give me a device that works as an interface to google reader, with an e-paper screen about the size of a paperback, that can collapse small enough to fit in a pocket and uses a negligible amount of power; and I will never buy a newspaper again. This is coming from someone who’s always...
Dec 25th
Presenters in Ruby on Rails Applications →
Good demonstration of the presenter pattern in rails. I get the feeling that a model UploadAttempt in our app needs one of these, but I’m not entirely sure of the responsibilities it would take on. Requires thought.
Dec 23rd
Merb gets merged into Rails 3! →
Choice quote: “Framework agnosticism: Rails will always have a default answer to every question within the stack. If you don’t care about testing frameworks, you’ll get test/unit. If you don’t care about which ORM, you’ll get Active Record. But some people do care and want something else. Some people want RSpec for testing, others want to use Sequel or Data Mapper for ORM, others again...
Dec 23rd
“The verdure had thickened, and its bright green stood out sharply against the...”
– Leo Tolstoy - War and Peace
Dec 21st
Freakish optical illusion →
Dec 17th
Dec 16th
surround.vim →
Vim plugin of the day, works on all standard vim text objects. If you install it make sure you also get repeat.vim which just makes sure the . operator works with surroundings.
Dec 16th
Martin Fowler: BusinessReadableDSL →
If you’re not subscribed to Martin Fowler’s feed you probably should be.
Dec 15th
Slashdot | Wiretap Whistleblower, a Life in Limbo? →
Posted purely for “Agent Lawless”. What are the chances…
Dec 15th
Why not to ask design questions in #rubyonrails...
beau: Hi all. Would anyone have a good resource for implementing a strategy pattern in rails? ie just where to start and the features that should be used? What I have is an "attribute" object that needs to be able to validate input using an associated "constraint" object. It's the "constraint" object that is giving me hassles, as there are different types of constraint objects (lookup, length) that are defined by the user (as they accept parameters).
It seems to me that the attribute object needs a polymorphic association to one of the constraints, but what's tripping me up is how the concrete constraint objects are to be created, would each concrete type have its own controller? should those controllers be nested? etc etc#
pythonic: tl, dr
pythonic: pattern, wtf?
Zarathu: beau: wat
pythonic: beau is the sarah palin of #rubyonrails
pythonic: it's all under the umbrella of job creation
pythonic: beau: do you even know what the fuck you're on about?
melfar: I need a good resource to implement the little red box pattern
beau: pythonic: no need to be rude fella, what confuses you about what I'm asking?
Radar: !google little red box pattern
logga: http://www.google.com/search?q=little+red+box+pattern
pythonic: beau: why don't you describe exactly what you're doing instead of serving up word salad
beau: I have model named "attribute" that needs to delegate behaviour to another object defined and associated at runtime by the user
melfar: Strategy is some sort of a callback function you pass around. Some ancient crap from GOF and the Java realm
beau: melfar: no, it's really not.
pythonic: a solution looking for a problem
pythonic: beau: k. now what's the problem you're really trying to solve?
melfar: beau, are you fond of Rava language?
beau: melfar: so what is simpler. me saying "strategy" and those who work in the same field knowing what I'm talking about? or me saying "I need a way of delegating behaviour to a runtime created and associated object" every time?
pythonic: beau: k. now what's the problem you're really trying to solve?
pythonic: patterns are for human compilers
beau: I have a model named "attribute" that validates text. It needs to validate this text based on rules defined in another object that is created and associated by the user
beau: look, you can whinge about the word "pattern" all you like. but that is a well known pattern and "strategy" is the most succinct way to describe it
pythonic: beau: patterns are for human compilers
codeape: beau: are you wearing a tie right now?
beau: patterns are a dsl for programmers
pythonic: bullshit
melfar: Patterns is stuff you are asked on interviews. Expected question: what patterns do you know (used, heard of). Expected answer usually includes Singleton
beau: melfar: that's truly great, and I feel for your hate of specific "words". But the problem is the same as it was 5 minutes ago. Has anyone got any pointers?
pythonic: beau: more powerful languages can abstract away the pattern bullshit you need to write time after time in java
beau: pythonic: ok, abstract away my user defined strategy pattern "bullshit" then
pythonic: beau: do you even have a pastie for anyone to look at?
beau: pythonic: it's a design question!
pythonic: wtf?
anathematic: you are a design question
pythonic: you haven't written any code at all?
elspeth: ...
anathematic: write love, not code
elspeth: beau: wtf.
beau: pythonic: I have reams of code in the existing application, this is a new feature
ryantown_: I think I get you beau.
melfar: Todo list: Implement new feature "strategy"
pythonic: melfar: haha
add "skill: strategy pattern, level: expert" to cv.#
After this "ryantown" did make an effort to understand what I was asking and help me, though the conclusion reached was that a user modifying system behaviour at runtime is a very unusual case and so I should just hack around it. Hopefully as I get to know rails better the implementation will become obvious to me.
Dec 14th
Dec 14th
Why, oh WHY, do those #?@! nutheads use vi? →
Really good quick tour on some reasons why vim is worth knowing. Pick of the article: ci”
Dec 13th
United States Patent: 6368227 →
Have I been duped or is this actually real??
Dec 11th
"You're doing it wrong"
Nothing like reading the well-reasoned equivalent of that statement when you’re half way through an implementation. But that’s programming I guess. RoR Quality Code Checklist This seems to be a very good general sanity check on design decisions made for a Rails App. Unfortunately I read it when I was half way through implementing a design using STI. Nevermind, here’s someone...
Dec 11th
Nested Resources in Rails 2 →
Short tutorial on nested resources for Rails 2.0. Gives some good background on the whole thing. I’m really getting tempted to move some weird parent/child controllers I have over to nested-resources with multiple controllers and then tie the views back together with AJAX. Only problem is that really could make integration testing a bit more of a pain… While significantly cleaning up...
Dec 11th
Nosy controller specs - rspec →
Good discussion on a point that’s been annoying me lately - Fat Logic-full Controlers.
Dec 11th
AutoClose - Auto close pair of characters →
Another vim plugin of happiness. Anyone who’s spent a lot of time with eclipse will likely enjoy this one.
Dec 10th
dbext.vim - Vim sql plugin →
That such a thing exists almost makes me wish I was still doing data analysis.
Dec 10th
“while Austen is about as readable as Danielle Steele, but gets credit for being...”
– Captain Splendid (slashdot)
Dec 10th
Listening to Your Specs →
Good article summarising some common rspec “smells”. Likely worth referring to when your tests just don’t look right.
Dec 9th
Seven Principles of Lean Software Development -... →
Good article on the importance of considering software quality from the start, and ways to help ensure it using an agile process. I think I need to look at bringing some static code analyis tools into my process… annoyingly that’s the second time this year I’ve had the same realisation.
Dec 3rd
Clicking specific links by id with webrat
Quick followup to last post, you can get the same behaviour out of webrat for links as buttons with the code Given /^I follow Edit link for AccessGroup with name "(.*?)"/ do |name| assoc = AccessGroupDataset.find_by_name(name) within "#access_group_#{assoc.id}_edit" do |scope| scope.click_link("Edit") end end
Dec 3rd
specifying which button webrat should press →
Short but rather good discussion on using webrat to push specific buttons. We’ve actually ended up with a very similar convention on our project by sheer coincidence, in that I try to fill in either the “value” or “id” attribute of a button with “CLASS_NAME_#{@class_name.id}_ACTION” and then set up a webrat step definition for each class and action...
Dec 2nd
Vim documentation: Folding →
Working with my ruby and haml syntax files now. Yes, it is good.
Dec 1st
Example Rspec/Cucumber rails app →
This came up on the rspec mailing list this morning. Pau Cor has created a very simple rails app with full rspec/cucumber tests. I think this would be a pretty good jumping off point for anyone who wants to see how rspec/cucumber can be used on a rails based project. Without having to wade through the cruft of a full application.
Dec 1st