Thursday, February 25, 2010

"Unknown Error. Please reload the page." when using the File Manager part of Hosting Control Center from godaddy

I've been using the File Manager from godaddy to unzip some tarballs with updates to my web site. I had to rely on this somehow manual approach as any attempt to do the same programatically, through scripts launched by cron jobs would be cut short. That's because there seems to be a limit on how long a user-initiated process could run on godaddy.

In some cases I'd get an "Unknown Error message" after some unzipping finishes and I try to start a new one. That's presumably because the file manager tries to figure out all new files created as a result of unzipping. However beside showing that useless error message, for just a few seconds before hiding it (awful usability), the error condition seems to recover only after logging out and logging back in after at least 5 minutes.

I discovered one way to avoid the error in the first place. Don't start a new unzipping until the first one stops for good. When does that happen ? Not when the system tells you, but when you see that the checkbox for the archived being unzipped becomes unselected. Depending on the complexity of the archive, that may happen a few minutes after the unzipping finishes.

Tuesday, February 23, 2010

The "iron triangle" concept in Project Management

The PM literature refers to the triple constraint of scope, time and cost as the "iron triangle" to help visualize the interlocked dependencies between these constraints. Imagine a triangle made of iron, with each corner of the triangle corresponding to the scope, time and cost, respectively, while the iron core represents the quality of the result produced by a given project. If you try to stretch any corner, you're bound to break the quality at the core.

Im not sure I buy this metaphor. In my view both time and cost are resources, together with other, like people, skill-set, etc. Each of these have a bearing to the outcome of the project. You may be tackling an impossible problem, so whatever resources you throw at it you're still far from meeting the goals of the project, as defined by its scope. That is, until you come across the mix of resources that makes the impossible possible.

So sow about a silk string instead of the iron triangle ? At one end is the scope, at the other are the resources. The string itself is the quality. If you pull too hard at one end it's bound to break.

Saturday, February 20, 2010

Principles of defensive programming

I came about this topic while watching a course presentation. They mentioned that we should always validate the input provided by the user and the results returned by the code we didn't write (library calls).

Based on my experience I'd add using assertions to document and check for invariants within our code. Another use of assertions is when exposing an API to other parties. If there are preconditions that the calls to the API must satisfy, it's pretty effective to enforce them through assertions.

Another area to watch for is to always check the results (success status) of the function calls we make and act accordingly. Sometimes we tend to be too optimistic and assume that everything will work smoothly. This is somehow alleviated by the use of exceptions, which prevents continuing the processing under false assumptions, which usually yield unexpected results, hard to trace back to their root cause. Unless the exception is muted, that is, caught and ignored, (really bad practice) any problem surfaces quickly.

Tuesday, February 16, 2010

302 redirects and iframe

I was quite surprised to discover that the behavior of posting a form while targeting an iframe depends on whether the form handler performs an HTTP 302 redirect.

I have a web page, with an iframe embedded and a form that targets that iframe. If I post the form and the handler returns a normal 200 result, the iframe will end up with the content sent by the handler, while keeping the surrounding content intact. That's the behavior that I was intuitively expecting.

However if the form handler returns an 302 code, instructing the browser to do a redirect, the whole page gets redirected, so the iframe and surrounding content vanish, being replaced by whatever content is served by the redirection.

This is quite surprising to me, as I would have expected only the target iframe to be affected by the posting of the form. After all that's the semantic of the target, isn't it ? This odd behavior happens in both FireFox and Safari on Mac, so it may not be a bug, but by design. I'd be curious about the rationale behind this.

Monday, February 15, 2010

How to debug PHP scripts on your Mac

I use a MacBook as one of my development machines. For LAMP development I've been using the excellent setup provided by MAMP


Coming from a background in other languages that have readily available debuggers I've been longing for a debugger to help stepping through PHP code and inspecting the content of variables. I found out that some commercial IDEs come with such capabilities out-of the box, but I've been looking for a stand-alone solution, similar to GDB. I can highly recommend xdebug for that. 


Installing it on MAMP was a breeze, by following the excellent instructions from technosophos. The only changes from those instructions were that the latest versions of MAMP (I use version 1.8.4) come with an xdebug.so already present (i.e. /Applications/MAMP/bin/php5/lib/php/extensions/no-debug-non-zts-20060613/xdebug.so), so all you need is uncommenting the zend_extension entry in the php.ini. 


Coupled with the MacGDBp client, the xdebug provides exectly what I've been looking for. Just pay attention to the need to press the reset button in order to initiate a new debugging session when your web page loads.

Sunday, February 14, 2010

shoptoit sucks !

I've been using shoptoit.com for some PPC (pay-per-click) advertising campaigns for my online store, on and off, for some time. Although the ROI is pretty low, I've been thinking to start some new campaigns. 


It's quite amazing how poorly implemented that site is. For merchants they don't provide even such simple tools for updating the list of products they wish to be advertised, all at once, in batch mode. So if you have some products that are out-of date, you're out-of-luck. There's no apparent way to replace them, through a new feed. There's not even a way to delete a product listing, not even manually. Mind boggling. Hello, CRUD, anyone ?


Adding to this deplorable state, any requests to their customer service, via email, on 3 separate addresses, seem to fall on deaf ears. They're probably too busy spewing nonsense on social networks, as they appear to be overly active on twitter and facebook, instead of caring for paying customers. 


Given this, I can highly recommend avoiding them. I'll be trying to get my remaining balance that's in my account and move to better providers.