Posts in the ‘Programming’ Category

PHP Slicehost API

A couple of days ago I added a bunch of features to my Slicehost API interface class (for PHP).  Most of you are about to say “Uh, what’s Slicehost?”  Click here.  (They’re the server hosting company I use.  If you sign up, please use this referral link or put “heron@xnapid.com” as the referrer so I get a referral bonus :) )

Slicehost provides an application programming interface to let you control your hosted servers (“slices”).  This API can do everything from creating a new slice, to restoring a slice from a backup, to deleting a slice, to managing the domain name resolution settings on your account.  (So when I bought orderingdisorder.com, I used the API to automatically add the DNS entries to my slicehost account so “the internet” would know where to find this site, rather than adding the entries manually.)

Anyway, my PHP interface class is just a PHP class that lets you conveniently access your Slicehost account from the convenience of a PHP script.  My last update added the ability to create, reimage, reboot, or rename slices.

If you find yourself needing the class, you can download it here:

http://sourceforge.net/projects/php-sliceapi/

Or, you can grab it from the Subversion repository, if you’re into that sort of thing:

https://php-sliceapi.svn.sourceforge.net/svnroot/php-sliceapi/trunk

Share on Facebook

Project Euler

I like Project Euler.  If you’ve never heard of it, it’s a website with a few hundred math/programming puzzles to solve, and it keeps track of which ones you’ve solved, who else has solved them, etc etc.

Yesterday, I was working on solving one of the problems.  The way you know you’ve solved it is by entering the answer into the website, and they tell you if it’s right.

I wrote some code, ran it, and got an answer.  They said it was wrong.  So I double-checked my code, ran it again, and got the same answer.  Wrong.  I re-wrote the code from scratch, and got the same answer.  Wrong.

Finally, I got fed up and googled the answer.  Someone’s blog listed what they claimed was the answer – but it was wrong.

So I copied the algorithm used by that blogger, and ran it.  It produced my original answer.  Not the answer they posted on their blog – the same answer I had all along.

I submitted it again, trying not to scream in frustration.  This time, it was accepted.

I don’t know why the site didn’t accept my answer the first couple times.  I don’t know why that blogger posted the wrong answer but the correct algorithm.  I guess Project Euler just wanted to waste some of my time?

(If anyone’s interested, you can see my Project Euler profile here.)

Share on Facebook

Amazon Web Services

http://aws.amazon.com

Coolest thing ever.  I’ll be building up some services around it soon.

Share on Facebook