Intuition Is Not To Be Ignored when Debugging
When I have spare time, I work on an object layer around the Amazon Web Services API, that I write in PHP. I want to be able to just instantiate an object like:
$books = new AmazItemSearch("search term", "browse node", etc.. )
And then loop through $books->itemArray to display the books (or anything from Amazon)
But when I finally got around to adding support for Amazon Wishlists into my object library, and then started testing it, I noticed that I was seeing only about half of the Wishlists returned, or so.
src=”http://pagead2.googlesyndication.com/pagead/show_ads.js”>
(Note: I have 11 wishlists, of various categories, such as “health”, “programming”, “fiction”, etc.., and not just for testing,.. it just makes sense to keep these lists at Amazon, because that is where I buy a lot of them)
And then I became paranoid, and realized that there must be something that I’m doing that Amazon is not liking, such as making too many REST requests per second, so I made sure that I had sleep(1)’s in the right places, but actually I did already have those in place.
And then I decided that maybe I’m doing something wrong somewhere in the methods within my own custom-written Objects, so I disregarded using my own Object Layer, and tried doing everything manually, such as:
$xml = file_get_contents("http://xml-us.amznxslt.com/onca/xml?Service=AWSECommerceService&Operation=ListLookup& ...);
$finalResultArray = XmlParser($xml);
( …make additional REST calls in order to get the remainder of the wishlists.)
Here’s what the intuition part comes in: throughout this whole time of debugging, I kept on having this voice or nagging feeling tell me to simply upload my code to the paid Hosting service I use (Hostgator in this instance), instead of continuing working on my local installation of Apache/Mysql/Php (on WinXP).
But the whole time I ignored that instinct beacause I figured it can’t be something local.
After all, “if there was a problem, nothing would work, and I wouldn’t be getting any data back from A.W.S.”, I was thinking.
You probably know the rest.
When I uploaded the code to Hostgator, everything worked flawlessly. And I changed the main PHP code in the index.php, to go back to using my Object library to do everything. And everything works fine.
I don’t know what in Apache, locally, would prevent some of the data to return, but I’m not in the mood to pick up an Apache book just yet ( aside from the book on mod_rewrite that I need to read in order to get CakePHP working properly). Must be some kind of Apache setting that is causing my browser to time out when retrieving data through XML or something.
Just when you think it’s some strange problem that will take a lot of “work”, if you just stop messing around and follow your gut, things are easy.