MustModify Blog: All Posts for

Get a List of Bad Links from Rails Log

October 22, 2009
If you have a Ruby on Rails app and you want to generate a list of the URLs that have generated 404s from your logs, here's one way: --- perl -n -e '/No route matches "(.*)" with .*/&&print "$1\n"' log/production.log | sort | uniq>public/bad_paths.txt --- then view: http://production_site/bad_paths.txt We're using...


sometimes it's the little things

October 20, 2009
I was looking through the ways you can tweak gMail and found this. I can't say how often it would have prevented me from looking like an idiot. "Forgotten Attachment Detector":http://gmailblog.blogspot.com/2008/09/new-in-labs-handy-intern-tweaks.html - Prevents you from accidentally sending messages without the relevant attachments. Prompts...


Remote Pair Programming by any other name ....

October 01, 2009
I've tried pair programming remotely a few time recently. I think it's been beneficial, but the lag time is always an issue when you're using screen sharing and Skype. I finally found out that I was using the wrong keywords to look for what I wanted, which was a text-editor that enabled remote pair-programming. The search term that brought me...


Why do we use factories for testing?

September 23, 2009
A client recently asked me why we used factories in our tests. Here's my answer: Originally, people would create a new instance of every model in every test. So, if you were testing that we properly parse dates and know which ones are valid and which aren't, and you know that Person requires a name, you might write: --- Person.new(:name...


search and replace in files

September 17, 2009
For all files under app/views, replace all tabls with two spaces. --- find app/views -type f -print0 | xargs -0 sed -i 's/\t/ /g' --- broken down: --- find app/views -type f --- 'find' lists all the files (with relative path) at or below the specified path. 'type -f' gives you 'files' ie not directories. It also exclude symlinks,...


Getting data into production shouldn't be a blocker. But it is. Again.

September 10, 2009
I can think of at least three Rails projects recently where one of the blockers to being really ready to get a project into production was a lack of production data. I'm on a project right now that is code-complete and has been for more than week. We have a production machine configured and ready to rock. The only thing that prevents us from...


Explore MySQL from the shell

September 08, 2009
I just discovered mysqlshow -- every developer who uses a database should know about this utility. (though I've createded an alias describe, which seems much more intuitive.) I constantly find myself going into script/console to get a list of the fields for a model, or other db-specific info. This solution is much faster. given no inputs,...


reCAPTCHA - a confluence of solutions

September 03, 2009
One of the things I appreciate about good design is the way two complex problems can be solved more elegantly together than separately. A great example of this is "reCAPTCHA":http://www.recaptcha.net . It prevents bots from submitting forms _and_ helps "digitize books, newspapers, and old time radio shows" ... they've used crowd-sourcing to...