RSpec recently dropped their StoryRunner in favor of Cucumber.
Dispite that, Joseph Wilk's post on "what makes a good story" is still a great place to get started, if you're looking for some pointers.
Works for me :)
Nigel Thorne's software development blog, focusing on finding simple solutions to real work problems.
Tuesday, December 09, 2008
Friday, December 05, 2008
Great Hackers
I heard a good talk by Paul Graham on what makes a Great Hacker.
The bit that stuck with me was the idea of getting your great hackers to write the tools or building blocks that let the others write the apps.
I love that idea.. I think I keep gravitating that way.
The bit that stuck with me was the idea of getting your great hackers to write the tools or building blocks that let the others write the apps.
I love that idea.. I think I keep gravitating that way.
Monday, November 17, 2008
Getting Cyclometric Complexity in PHP
I have some legacy code I am analyzing at the moment. I needed a tool to report Cyclomatic complexity for PHP code.
I found Lint PHP which is a web form in which you can post your code to be evaluated. Now I'm not going to post all my code to some 3rd parties page. Luckily you can download the code.
After installing PHP ...
I used [ XAMPP. Just unzip it made that painless] I put the code in the htdocs directory and visit http://localhost/lint_php.php and there you go .. a local copy is running.
Next problem... I have around 200 pages all spread through a directory structure I want to submit to this form..
This is where Ruby and Mechanize come in.
I found a bug with Mechanize at this point that slowed me down.. :(
You are supposed to be able pass blocks to forms, like so...
... but that didn't work for me.
I finally got the following working..
So.. now I can call
and get out some figures.
All this reports is the worst methods complexity and a total for the code submitted.
How useful this is I won't get into, but you can change it to report whatever you like from the list generated in the code.
Hope this helps :)
I found Lint PHP which is a web form in which you can post your code to be evaluated. Now I'm not going to post all my code to some 3rd parties page. Luckily you can download the code.
After installing PHP ...
I used [ XAMPP. Just unzip it made that painless] I put the code in the htdocs directory and visit http://localhost/lint_php.php and there you go .. a local copy is running.
Next problem... I have around 200 pages all spread through a directory structure I want to submit to this form..
This is where Ruby and Mechanize come in.
I found a bug with Mechanize at this point that slowed me down.. :(
You are supposed to be able pass blocks to forms, like so...
... but that didn't work for me.
I finally got the following working..
So.. now I can call
phpcc C:\Projects\PHPStuff\srcand get out some figures.
All this reports is the worst methods complexity and a total for the code submitted.
How useful this is I won't get into, but you can change it to report whatever you like from the list generated in the code.
Hope this helps :)
Tuesday, November 11, 2008
Matching Ruby Regular Expressions Across Lines
Just a quick note:
To match all lines
Nice!
I found it here.
x.matches(/something.*/) will match all of one line. To match all lines
x.matches(/something.*/m) you need to put the 'm'.Nice!
I found it here.
Wednesday, October 29, 2008
Transform a Twiki Table
I needed to change a TWiki table to make the rows become columns and columns become rows.
Ruby + 5 mins =
Ahhhh.. That could have been painful.
I love being a programmer. How do people that don't code handle this sort of problem?
Ruby + 5 mins =
table = <<-TABLE
...paste table here...
TABLE
rows = (table.split "\n").collect { |line| line.split("|") }
puts (0.. rows[1].length).each { |col| puts "|#{rows.collect{ |row| row[col] }.join("|")}|" }
Ahhhh.. That could have been painful.
I love being a programmer. How do people that don't code handle this sort of problem?
Subscribe to:
Posts (Atom)