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..]