Wise Advice from a Signature

Wise Advice from a Signature

I was searching for a quick and easy way of renaming an array key without altering the order of the array elements, when I stumbled upon this thread. While it didn’t help me accomplish my goal, I did enjoy Mark Baker’s signature:

Turn on error reporting!

I’d say his estimate is low, and that it is more like 95% of PHP problems can be resolved by turning on error reporting.

I think part of the issue is that everyone recommends “for security” to turn off error reporting on production websites. That’s fine I suppose, but only if your site has some way of telling you it is broken (e.g., an emailer that sends you error logs, an error message on the screen that you can see or someone will email to you, etc..). Just having a log isn’t enough. It is unreasonable to expect someone to waste time looking at an error log that should be empty. Spend 5 minutes and write yourself a little script to email the error log to you (or search Google and find one that is already pre-built), set up a cron, and then fix your bugs when they come rolling in.

I think what drives me even crazier is when people turn error reporting off to hide “safe” errors/warnings (i.e., non-fatal), like undefined index, undefined variable, or deprecated errors. The company I work for recently hired a contractor to help get us up to speed on an open source application. We turned on error reporting, and suddenly the app was spewing warnings left and right. Our contractor’s advice? Turn off error reporting.

But the error messages are there for a reason. If PHP is telling you that you are trying to use a variable or index that isn’t there, then it doesn’t matter if it isn’t a fatal error: your code is broken. It is trying to do something that doesn’t make any sense, and the code needs fixed. 99% of the time this is as easy as setting defaults on your variables or adding a few isset()’s into your code.

So please, for the sake of the children, turn on error reporting.

Read More

Review: Three Weeks to Say Goodbye

Just finished Three Weeks to Say Goodbye by C.J. Box.

The book is narrated by a man that recently adopted a baby girl with his wife. Life is great until the adoption agency calls to tell him that the birth father wants the baby back. To make things worse, the birth father’s father is a federal judge.

While things seem rather ominous at first, the first part of the book reads almost like a TV special. The judge and his son appear “evil”, but no more so than you’d expect from people willing to tear a child from her family.

But things get worse and worse. People die, people kill, lives are changed. Despite my continual attempts to guess at the ending, I failed pretty miserably until it was pretty much spelled out for me.

Overall, a very good read. I’d definitely recommend it.

Get it here at Amazon.com.

Read More

Conduit Toolbars

Back in April of 2007, I signed up with Conduit. They offer website publishers to quickly and easily create a completely custom browser toolbar that works with both Internet Explorer and Firefox. To make it even better, they pay the publisher when people use the toolbar!

To get me started, they gave me a $100 bonus, but the minimum payout was $250 (I could cash out earlier, but wouldn’t get the $100 bonus). I put the toolbar up on the Fake Name Generator and started to get users. I expected to quickly pull in enough to meet the $250.

I didn’t. I earned mere cents per day. It would take years to hit the $250 payout. So I gave up, took it off my website, and moved on to other projects.

Fast forward 2 years. I got an email asking me how they can reinstall my toolbar because they had to format their computer. I thought to myself, “what is this guy talking about? I don’t offer a toolbar…” But then I remembered Conduit! I pulled open my control panel and see $244.09 sitting in my account, only $5.91 from the payout!

I add the toolbar back to the Fake Name Generator, quickly get over 100 users, and about a month later have a pinch over $250 sitting in my PayPal account.

So what next? Well, the next day I get an email from a Conduit employee. They congratulate me on getting a payout, and show me a new toolbar for the Fake Name Generator that they put together and ask if I want to use it. I say “sure!” They then show me some updated code I can use to advertise my toolbar on the Fake Name Generator.

Did it work? Yes! Earnings from the day before the toolbar: $0.14. Earnings the day after: $0.72.

Am I going to get rich? No. Am I going to get paid every month? No. Does it matter? No!

With absolutely no effort, I’m going to get $50 every couple months. My users get a toolbar that they apparently enjoy. I get extra traffic to the Fake Name Generator that I might not otherwise get, perhaps increasing my AdSense or CJ revenue.

Want your own toolbar? Visit Conduit.

Read More

I Am Reading: Lots of stuff!

So you may have noticed that on the right of the site I list what I’m reading. Previously, I displayed this info using the I Am Reading plugin for WordPress. It lets you put in a single ISBN, and it will magically display the cover and link it to Amazon.

But who reads only one book at a time?

Okay, maybe lots of people do, but I don’t. I “read” a book in the car (i.e., I listen to books on CD), I read a book at work, and I read a book at home. Sometimes I’ll have a couple books going at either work or home.

So I spent a few minutes digging into the I Am Reading source code to try to make it let me specify more than one ISBN. I spent about 15 minutes doing this before I realized I’m probably not the first person to want this functionality.

So I found a better plugin: Amazon Showcase. With this plugin I can list as many books as I want, and it will display a nice big thumbnail of the cover and link it to Amazon for me, and it didn’t require any source code changes. Yay!

Read More

Review: Variable Star

Just finished Variable Star by Robert A. Heinlein and Spider Robinson. It is a sci-fi book that was outlined by Robert A. Heinlein before he died, and then fleshed out by Spider Robinson many years later.

SPOILER WARNING!

The premise is pretty good. A poor college student finds out that his supposedly equally-poor college student girlfriend is a member of one of the richest families in the solar system. To escape the life they have planned out for him, he hops on a colony ship heading dozens of light years away.

Things are going relatively well until Sol (our sun) explodes, killing everyone and everything except for a few colonies and the colony ship that the protagonist is on. To make matters worse, an engineer that keeps the ship running commits suicide, leaving the ship stranded in space.

This is where things break down. Like the last book I read, it feels a lot like the author wrote a good story, but then got himself in a hole and couldn’t figure out how to get out of it. The ending doesn’t make any sense, because it is based entirely on several highly intelligent main characters being completely ignorant of what should have been completely obvious to them.

Overall, a good read though.

Read More