Diasparsoft Logo Let's write software that people understand.

Home | Contact

Training

JUnit support

Outsourcing

The work that Diasparsoft did for us was outstanding. We are now using the software on a daily basis and their work could well have a dramatic impact on the Reds' organization in the near future.Cincinnati Reds Baseball Club.


Publications

Tips & Tricks

Diasparsoft Toolkit

What is Diaspar?

Interesting Bits RSS

Tuesday, September 28th

PHP: pass by value/pass by reference


After years of programming in languages where passing object references around is the norm, I just spent about 30 minutes re-learning the distinction between pass by value and pass by reference. The good news is that I did so within the context of writing tests, so it wasn't so bad.

It boils down to this: PHP passes function parameters by value, so unless you say otherwise, the function will operate on a copy of its parameters, and changes to an object's state are not visible by the invoker. If you want to pass a parameter by reference, you must say so. I came across this while rolling my own test runner in PHP.

jbrains on 09.28.04 @ 12:52 PM ET [more..]

Monday, September 27th

File permissions and HTTPD

Hey, folks. Here's a good tip.

Let's say you want to test your web site on your own box, and let's say you always want to use Eclipse while you're building your site. In this case, there's a good chance your Eclipse workspace is in your home directory. For me, that's /home/jbrains. Now in there you'll have a folder containing your project, within which you might have a folder called www containing the web pages. You now want Apache to serve up those pages.

Easy, right? Open httpd.conf, change the DocumentRoot to /home/jbrains/workspace/..., then restart Apache and you're done, right?

Not so, for me. I get Permission denied /. Why is Apache going to the root of my file system?!

Well, the short version is this: it isn't. Remember that Apache will operate under the user name apache by default, and so you must be careful with both file and directory permissions. In my case, /home/jbrains was owned by user jbrains and only accessible by the owner. Poor old user apache didn't stand a chance. Once I fixed that problem, I could see my web page!

So here's the tip: know what user an application is running with, and check directory permissions everywhere for that user.

jbrains on 09.27.04 @ 03:25 PM ET [link]

Revenge of popfile: Dude, where's my buckets?!


I was a little hasty in announcing my triumphant installation of popfile on my laptop.

Symptom. Every so often, popfile stops running. It seems to happen when I reclassify e-mail to my spam bucket. When I restart popfile, all my configuration is gone!

Solution. Switch from SQLite 3 to SQLite 2. As this article clearly indicates, popfile 0.22 does not work with SQLite 3. For step-by-step instructions, read on.

jbrains on 09.27.04 @ 01:32 PM ET [more..]

Names are important

I often preach that names are important when I talk about programming. I am quite adamant about taking extra time to search for a better name, so that the code might communicate better to its prospective readers. At the same time, I decided to honor a tradition (of sorts) in the TDD community, with the example I used in both my tutorial JUnit: A Starter Guide and in my book JUnit Recipes: a class representing an amount of money. A reader recently pointed out to me what a horrible name Money is for such a class, being an abstract noun. The class, he reminds me, represents a quantity of money, not "a money." He's absolutely correct.

So I have performed the Rename Method refactoring on my sample code, from Money to MonetaryAmount. It's just unfortunate that I can't push that change out to the book. That's one drawback to publishing on paper: it gets so old so quickly!

jbrains on 09.27.04 @ 11:47 AM ET [link]

Linux for a dummy (Guess who?)


I am typing this entry from my laptop, from which Windows is temporarily banished. Yes, I am running RedHat Linux 9 on my laptop, and although it's only been a couple of days, so far, so good. I will be learning a great deal about administering a Linux machine in the coming months, and I will share a little of that with you. This is the first instalment, regarding startup scripts. I'd never quite got this right before, but now that it really matters, it's important enough to me to get right.

I wanted to add popfile, the nice e-mail filter, to my machine as a startup service. Here is how I did it.

jbrains on 09.27.04 @ 11:26 AM ET [more..]

Wednesday, September 22nd

19 horseshoes so far at JavaRanch


Ernest Friedman-Hill posted his own review of JUnit Recipes and gave it 9 horseshoes, to go with the 10 from Dirk Schreckmann. I know of Ernest as a veteran of JUnit, so I was especially pleased to see him write, "I've been using JUnit for years, but I picked up quite a few useful tips from this enjoyable book. Highly recommended." This reminds me of a tense moment towards the end of the book-producing project.

jbrains on 09.22.04 @ 01:13 PM ET [more..]

Tuesday, September 21st

SPEAKING: XP/Agile Toronto User Group, 9/21/2004

I'll be speaking at the XP/Agile Toronto User Group tonight at 7 PM. Following in the grand back-to-school tradition, my talk is entitled What I Did For My Summer Vacation, which includes finishing JUnit Recipes, attending XP/Agile Universe, spending a week at Object Mentor and a special surprise!

jbrains on 09.21.04 @ 12:30 PM ET [link]

JUnit Recipes review at JavaRanch Saloon

Dirk Schreckmann gives JUnit Recipes 10 horseshoes, something that apparently happens rarely. Dirk begins, "'Wow!' on two accounts: 1. I'm actually giving a 10 horseshoe rating to a book, and..."

I would like to thank JavaRanch and Manning for collaborating on making my four-day promotion a success. There were a number of good questions, and appearances by familiar names that made me feel at ease. Thanks, everyone!

jbrains on 09.21.04 @ 12:28 PM ET [link]

ARTICLE: Driving on CruiseControl

Lasse Koskela has written Part 1 of a good-looking series on CruiseControl. One thing I especially like about the article that is he uses Subversion, rather than CVS, in his example. Very good!

jbrains on 09.21.04 @ 12:23 PM ET [link]

Friday, September 17th

A week at ObjectMentor

Today is the last day of my one week "geek vacation" at ObjectMentor. I have had the chance to pair with Uncle Bob in his home and to pair with Micah Martin on FitNesse stories all week. It has been a blast, especially for someone like me who has been working solo so much in the past two years. I would like to thank everyone at ObjectMentor for welcoming me to the office, feeding me, giving me shelter and providing me with enough coffee and episodes of Law & Order to keep me happy. We really must do this again sometime. (How's November?)

jbrains on 09.17.04 @ 11:03 AM ET [link]