RSS
 

Archive for September, 2009

Bugzilla error

23 Sep

Setting up Bugzilla for a friend on a slicehost account running RHEL5, I ran into issues following the official installation guide.
After running:
./checksetup.pl --check-modules
/usr/bin/perl install-module.pl --all

The error message I received was:

Can’t exec “–decompress”: No such file or directory

Amazingly, I found no exact matches for this in Google (my google-fu is generally weak, however). It turns out that in order for the module installer to be able to install the modules it needs, there’s a certain module it needs!

yum install perl-Compress-Zlib.x86_64
yum install perl-Archive-Tar.noarch

makes everything happy again.

Nothing earth shattering, but maybe now Google will have an answer if anyone else runs into this.

 
 

PHP Order of Operations Gotcha

04 Sep

PHP’s decision to give addition, subtraction and string concatenation equal precedence has caused some difficult to track down bugs on several occasions. It’s so non-intuitive I have difficulty remembering this one, and hence keep writing wrong code.

Example:

$tacos = "Robots: " . 1 + 2 . " for the win!";

I think a normal human would expect $tacos to be equal to “Robots: 3 for the win!”. But the result is actually “2 for the win!”

What gives? Well, the PHP docs say that plus, minus and string concatenation all get equal precedence, with left associativity. So going from left to right, it says:
“Robots: ” . 1 | “Robots: 1” so far, so good.
“Robots: 1″ + 2 => (int)”Robots: 1” + 2; | “Robots: 1″ converts to 0, so 0 + 2
2 . ” for the win!” | “2 for the win!” D’oh!

I think it would make a lot more sense for string concatenation to take a lower precedence than any arithmetic.

The correct way to write the above code is:

$tacos = "Robots: " . (1 + 2) . " for the win!";

 
3 Comments

Posted in Coding

 

Free eBook for VIP users

01 Sep

…sorta.

It looks like there was a mix up and a bunch of our VIP users received the following email:

Andrew Wise
to me

show details 2:10 PM (3 minutes ago)

Hi,

Thanks for purchasing our eBook, please download the eBook from this email.

http://tripletsmommy.com/wp-content/themes/typebased/ebook1.zip

Having not actually purchased an eBook, some of our users thought this was a weird form of spam or phishing, or even that their accounts might have been compromised. It’s nothing as sinister as all that, however, just a flub.

Here’s the official explanation from BWC, sent to one of our users who originally pointed out the issue:

Hey [redacted],

Thanks for letting me know, and sorry for the confusion!

Looks like our business guy (Andrew) who handles all our PayPal and such had a little mixup between Grooveshark and one of his side-projects. I just yelled at him, and everything is sorted out now.

[…]

Let me know if there’s anything else I can do to help out. Oh, and I guess enjoy being a triplets mommy! ;)

Regards,

Ben Westermann-Clark