July 2010
2 posts
Topological sort of a DOT Graph
Today I needed to get a sequential execution order for a system that I already had a DOT dependency graph of, which I knew contained no cycles.
Currently I don’t officially have access to.. well, anything resembling a development environment at all really, so I was faced with the prospect of doing this in vba. As my masochism is underdeveloped I haven’t actually tried this yet, but...
The idea that I can be presented with a problem, set out to logically solve it...
– John Carmack
June 2010
2 posts
Oracle enhanced adapter for Rails 3 →
It makes me very happy that someone continues to work on this.
Martin Fowler on team room layouts →
My favourite bit:
First make sure it is the right size for the team. While a team room should be open within itself, it should be closed to everyone else
Yes, a million times yes.
May 2010
2 posts
Interview with Jim Coplien →
I really enjoyed this interview (but I’m weird that way) with Jim Coplien.
Goes over many many things, the rise of functional programming techniques, the prevalence of class-oriented programming over object-oriented programming, the DCI architecture and some general thoughts about Scrum and Agile and just plain old professionalism.
It’s also the first mention I’ve seen of DCI,...
Flay for cucumber →
Quick very hacky job to get flay to give some duplication metrics on cucumber files, gives ideas on where your features are repeating themselves and should be refactored into higher level steps or at least moved into Background’s and Outline’s.
Only tested on a regular cucumber install run from the root directory of a rails app, likely won’t work anywhere else.
April 2010
12 posts
There are two novels that can change a bookish fourteen-year old’s life:...
– @jeremydmiller who doesn’t know the original source
DRX - ruby object inspection
This is so freaking cool source
Steps to get running on ubuntu:
sudo apt-get install libtcltk-ruby tk-tile
sudo gem install drx
irb
irb(main):001:0> require 'rubygems'
=> true
irb(main):002:0> require 'drx'
=> true
irb(main):003:0> 123.see
=> nil
irb(main):004:0>
Anyone who ever saw me use ‘ddd’ will understand why I love this.
Weird history
Ada Lovelace - Commonly known as the first programmer
chiefly known for her work on Charles Babbage’s early mechanical general-purpose computer, the analytical engine. Her notes on the engine include what is recognized as the first algorithm intended to be processed by a machine;
fathered by
Lord Byron - Famous poet, “mad, bad and dangerous to know” who used his place in...
Behaviour of next in collect
Basically, anyone got a better way to do this? :
irb(main):003:0> [1,2,3,4,5,6].collect { |v| next if v == 3; v * 7 }.compact
=> [7, 14, 28, 35, 42]
Let me know on twitter if you have a better way.
I oversimplified my example, it’s actually more like:
objects.collect do |obj|
begin
QueryPredicate.new(obj.parser.parse_internal)
rescue ParsingException => e
...
Podcast by DHH on planning, VC, and MBA's →
David Heinemeier Hansson is the founder of ruby on rails, partner at 37signals, and co-author of Rework.
Pretty standard stuff for DHH really, planning is guessing etc etc, still it’s an interesting talk, particularly if you haven’t read/heard him before.
Always like hearing the “go small” spiel, applies in so many different places, two quotes from Warren Buffet:
...
TDD/Refactoring/Least possible Videos →
If you have a spare couple of hours (and let’s be honest, now cricket season is over who doesn’t?) handy these videos area really worth watching.
They’re sort’ve billed as an intro to TDD, which they are, but they also pretty well demonstrate all of the code side of development, test, code, refactor etc.
It’s a bit like getting a feel for what “Clean...
Rails content_for stacks content
Worth remembering, the content_for helper appends subsequent calls rather than replacing.
So would render “Hello world!”.
Seems kind’ve insane to me, if I wanted that behaviour I could always add it to content_for rather than doing it by default.
Update to bash back button
My new .bash_aliases
alias cd="pushd >/dev/null
alias bd="pushd +1 >dev/null"
alias fd="pushd -0 >/dev/null"
My bash prompt now has a “back directory” command, *and* a “forward directory” command!
mongrel_rails, logrotate, and copytruncate
If using logrotate with rails remember to use the copytruncate option. This means that instead of renaming the old file and creating a new one, logrotate will copy the old file to the archive name, and truncate the current file. This means that mongrel_rails doesn’t lose its file handle and your logging doesn’t silently turn off :)
On The Value Of Fundamentals In Software... →
How I learned to let my workers lead →
Really interesting story on what is essentially the implementation of Agile/Lean at a manufacturing company.
March 2010
6 posts
Spend a lot of time cd-ing around a complex... →
The tool linked to looks very nice, but some of the comments are awesome too.
I especially like:
i alias “cd” as pushd, and alias “bd” as popd. so i have a back-button for cd.
Genius!
10 Most Influential Software Development Books of... →
Nice list. Added about half to my list of “books to read” and ordering one
Leaving Everything Behind: Why 20% time is awesome... →
One of the things I was most excited about when joining reevoo was the fact that thursday afternoons were “work on what you like time”. I spent the first 6 months using this time to bring my Ruby/Rails skills up to scratch, reading books or running code samples and gradually transitioned…
Latest cucumber, rails, exception rescue_from
Cucumber these days appears to disable the base controller from doing exception rescues, which makes plenty of sense as it means you get proper error traces instead of boilerplate uselessness.
But, when you’re testing that your error pages are rendered incorrectly, it’s a bit of a pain. In that case you want the line:
ActionController::Base.allow_rescue = true
Mechanical computers, old instructional videos
If you haven’t seen this yet and you have a spare 40 minutes I really really recommend it.
Old instructional videos from the US Navy on the inner workings of the mechanical computers that used to be used to work out the correct firing positions for moving ships. The amount of variables taken account of is stunning, but mostly I just like the way the videos are all about explaining...
the { buckblogs :here }: Unobtrusive, yet explicit →
Interesting. I personally believe in the “purity for purity’s sake” when it comes to “aim for one language per file”, but something like this looks to be the best solution for making it obvious *where* your JS is used.
February 2010
5 posts
Conditional Validation using with_options to... →
Hmm. Pretty sure we could use this
Why I love everything you hate about Java →
The railing against convention over configuration for performance reasons is a bit strange, and yes you can do everything done in Java here in Ruby.
But damn if this isn’t a good response to that stupid “higher level languages abstract you away from the need for design patterns” mentality.
Views, SQLServer, and Active Record
By default, public users don’t have access to view definitions in sqlserver 2005.
The activerecord-sqlserver-adapter requires view definitions to execute select_all on them.
This will give you a headache.
If you see an error that looks like “There is no text for object ‘view’”, then you should do this:
USE database GO GRANT VIEW Definition TO PUBLIC
January 2010
4 posts
Company twitter and the Pareto principle
From wikipedia: “The Pareto principle (also known as the 80-20 rule,[1] the law of the vital few, and the principle of factor sparsity) states that, for many events, roughly 80% of the effects come from 20% of the causes.”
I’ve always liked the 80-20 rule, because it seems to be such a consistent rule of thumb when dealing with people, who you would assume would be more...
I love the rails console
>> DatasetAttribute.find_all_by_is_ignore_on_insert(true).length
=> 77
>> DatasetAttribute.find_all_by_is_ignore_on_insert(true).each do |dsa|
?> dsa.attribute_domain_id = 109
>> dsa.save!
>> end
That is all.
Annoying fact of the day. Stubbing delegates
A possibly dangerous habit I’ve taken up lately is using Delegate in ruby as a way of changing the behaviour of a nasty dependency that’s just too prevalent in the system to break.
(The possibly dangerous part is that I’m still leaving dependencies hanging around that I know should be broken now, but oh well.)
Noticed something today that took me a long time to track down:...
Think about this. What is a better outcome for a project at the end of its...
– Jeremy Miller - http://msdn.microsoft.com/en-us/magazine/ee294453.aspx
Patterns in practice: a retrospective →
Jeremy Miller provides links to what he considers the most important articles he wrote for the ‘patterns in practice’ column for MSDN over the past two years.
I’m about half way through these and they’ve all so far been excellent general software engineering/OOP articles.
TLDR →
Data visualization tool for large Internet discussion forums.
I use reddit a fair bit and I love the idea behind this. The “too many voices” problem is still very much an open one.
December 2009
5 posts
Oracle LD_LIBRARY_PATH for ruby-oci8/rails
Just putting this somewhere on the internet to hopefully save some other poor bastard the trouble of figuring it out.
To get the oracle instant client libraries to always be found even by background services etc (say monit restarting a mongrel) add a file in /etc/ld.so.conf.d called oracle-client.conf with a single unquoted line that is the path to your oracle instant client install eg...
Google offers to clean up your contacts →
Came in to work this morning and found my “Clean Code” book had arrived a month early and that Google contacts has added the exact feature I wanted.
Good start to the day :-)
The Waterfall model is originally invented by Winston W. Royce in 1970. He wrote...
– tarmo.fi » Blog Archive » Don’t draw diagrams of wrong practices – or: Why people still believe in the Waterfall model
A Programmer Pilgrim’s Progress - Ward Bell →
Usability bitch: Contacts
For my central contact store I use Google Contacts.
It’s used by gmail (my main email client), Wave, and my phone (G1). This means I have a single view of phone numbers and email addresses for people, it’s constantly backed up and is available with me always. I really like this.
But it doesn’t let me order information! I can’t change the ordering of email addresses for a...
November 2009
4 posts
Links worth reading for the day
What’s all this nonsense about Katas
via rss
Dynamic Languages and SOLID Principles
via @unclebobmartin
Amusing conversation of the day
(15: 30:58) friend: in vim
(15: 31:06) friend: i have to swap every other line
(15: 32:35) me: what on earth do you mean by that?
(15: 33:54) friend: ok
(15: 33:55) friend: so
(15: 34:08) friend: assume the entire file is made up of pairs of lines
(15: 34:29) friend: line 1/2 is one pair, 3/4 the next, etc.
(15: 34:33) me: oh
(15: 34:36) friend: i need to reorder all the pairs
(15: 34:49) friend: so swap line 2 with 1, 3 with 4, etc.
(15: 34:49) me: ggqqddpj@qq@q
(15: 34:56) friend: fuck off
(15: 35:03) me: take a backup and try it
(15: 35:06) friend: if that actually works, i will kill you
(15: 36:46) friend: fuck you
(15: 36:53) me: you're welcome
(15: 37:04) friend: in the most gratitude expressingly possible way, fuck you
(15: 37:32) friend: now i have to spend the next 10 minutes figuring out how the hell that did something useful
Mocks and Stubs
Mock when you need to test that the code *does* something to another object
Stub when the code needs to call a complicated query on another object
Try to avoid either wherever possible :-)
Trying to make sure I remember some lessons by writing them down. I’ve grokked the absolute necessity of unit tests for quite a while now, but after a hell of a lot of practice I finally seem to be...
Hitting “fc” from a Bash shell invokes your default editor...
– Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs: Last Command
October 2009
2 posts
From: Linus Torvalds
Subject: Re: Coding style - a non-issue
Date: Fri, 30...
– http://kerneltrap.org/node/11
JComments joomla extension + specific port
Workmate ran into an issue this week where the JComments joomla extension wasn’t working for a host running on a port other than 80 or 443.
Too lazy to write much up in detail so I’m just going to basically post code and let it speak for itself.
First up, check the page source to see how JComments is set up:
jcomments =...
September 2009
3 posts
Extract till you drop →
“Uncle Bob” is one of the creators of the Agile software development method and is the author of some of the best known books on object oriented design.
The fairly simple idea he describes here is a very easy way to improve the code you write drastically. Code that is broken up into many small collaborating methods is better for lots of reasons:
Easier to read and understand. Bit of...
Keep Models out of Your Views' Business! →
Part 2 may be even nicer
More and more often I’m seeing things that make me annoyed that our app isn’t using I18n, this is a very well written and very familiar one.
Database column defaults: don't use them
I would say that most people consider it good form to keep business rules out of the data layer, that’s a given. But default column values are pretty damn low level and simple right? Almost like column nullability.
Well, after today I’m going to say if your app is ever going to interface with more than one type of database I’d say no.
Little demonstration, the code required to...
July 2009
7 posts
pygowave-server →
Implementation of the google wave server written in python before google even released the reference implementation. Very impressive.
Allows for multiple users in a single wave, has the fancy real-time typing, and allows for upload of custom gadgets which everyone can use. Only allows one gadget to be used at a time and has no “default” functionality, purely the server being used...
And the game programmers are always two iterations behind. In the heyday of C,...
– Slashdot Developers Story | Google Wave Reviewed
I salute you random /. AC, because you made my day with that.
How to change listen port for Windows 2008 RDP
To hopefully save someone some time:
Change value of “HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations\RDP-Tcp” to be the port number you want. (Type Decimal)
In computer management, add a firewall rule to Incoming to allow connections from your new port. Disable the old RDP firewall rule.
In services management, restart the Terminal Services service.
...