On Estimating – What Kind of Risk Do You Prefer?

July 7th, 2008 § 0

Estimating development time of software is one of my least favorite things to do. Usually, I’m pretty good at it, but that doesn’t change the fact that it’s

  • Time consuming
  • Often grossly inaccurate
  • Usually done while flying by the seat of your pants, with a marginal (at best) understanding of the functionality that you need to estimate.

I’ve always been a pessimistic estimator, and it’s something that people I’ve worked with for a long time understand and appreciate (even if they make fun of me for it, at times).

Some people might think it’s crazy to be a pessimistic estimator, because any estimate that you give to a client that’s padded by 50 or 100% is potentially going to be high. It might be a lot higher than some other shop who might totally low-ball an estimate just to land a contract.

In my opinion, in my way of doing business, the risk of a dissatisfied customer from a blown budget due to a low-ball estimate is significantly greater than the risk of losing a few contracts because of pessimistic estimates.

I would rather estimate high and exceed expectations by coming in well under budget; even if it means that I lose some work along the way because someone felt my estimates were too high.

JavaScript Menu Appearing Behind Flash Object

June 26th, 2008 § 0

Yes. It’s 1:26 am, and I’m working on stuff. Really, I’d like to be in bed. Asleep. And I’d like to stay there for three days.

But alas, instead, if you are having problems with dropdown JavaScript menus appearing BEHIND a Flash object, try adding this to the parameters you’re passing to the Flash object:

wmode="transparent" 

Or if you’re using SWFObject, you can do something like this instead:

var so = new SWFObject("crappy.swf", "crappy_swf", "100%", "100%", "9", "#ffffff");
so.addParam("wmode", "transparent");
so.write("flash");

Maybe that will save you some headaches. It saved me some.

UPDATE

Apparently it might be better to use

wmode="opaque" 

Apparently it’s less CPU intensive, and it seems to do the same job (that’s how it worked for me, anyway). I believe the differences are as follows:

Opaque makes Flash behave like any other page element, allowing you to easily float content over it using JavaScript and DHTML.

Transparent makes the page background underneath the Flash video appear through any transparent areas of the Flash video.

Email From Bill Gates

June 24th, 2008 § 0

There is an awesome article over at seattlepi.com containing the text of an email written by Mr. Gates regarding his experience trying to download and install MovieMaker on his computer. The email really cracked me up, and I think it’s worth a read.

It’s probably also worth noting, that instead of all that rig-a-ma-roll, one could just buy a Mac (which happens to include iLife, which includes iMovie). The Surgeon General agrees that my strategy would keep your blood pressure a lot lower, and increase your life expectancy by about 10 years.

Ultra Premium… Indeed.

June 16th, 2008 § 0

I got a good laugh yesterday at the Amazon reviews page for the Denon Ultra Premium Link Cable (aka – 1.5 meter CAT5) – selling for the MSRP of $499. That’s right, $499.

If you need something to laugh at on this rather grey-looking Tuesday, I highly recommend the amazingly insightful reviews over at Amazon, including what this gentleman had to say:

After I took delivery of my $500 Denon AKDL1 Cat-5 uber-cable, Al Gore was mysteriously drawn to my home, where he pronounced that Global Warming had been suspended in my vicinity.

Yes, I had perfect weather: no flooding, no tornadoes, the exact amount of rain necessary, and he pronounced sea levels exactly right and that they were not going to rise within five miles of my house.

Additionally, my cars began achieving 200 mpg and I didn’t even need gasoline. I was able to put three grams of cat litter into the tank and drive forever.

What’s more, the atmosphere inside my home became 93% oxygen and virtually no carbon dioxide. In fact, I now exhale oxygen.

One heck of a cable.

Didn’t notice any improvement in audio quality though.

The $800 Apple iCable is clearly superior.

Why Kiva is Cool

May 14th, 2008 § 0

If any of you read Inc.com you might have already seen this, but for those of you who don’t – read on.

One of the reasons I’m publishing this is to encourage people to lend money to entrepreneurs around the world using Kiva. A second reason is that this is an awesome story out of a country that was probably my favorite place in the entire world to visit.

Cambodia is a war-torn country, and the people still seem to live in daily fear that at any moment the Khmer Rouge could return to destroy and oppress once again. So seeing this glimmer of hope from an entrepreneur in Cambodia really seemed to make my day. And if the fact that this family is able to make $400 per month in their business seems like peanuts to you, remember that most of the population lives off of about $350 per year.

CodeIgniter .htaccess file not working on Mac OS X

May 6th, 2008 § 0

If you’re using CodeIgniter on Mac OS X, and you have a .htaccess file that looks something like this:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php?/$1 [L]

If you’re finding that it doesn’t seem to be working, and you’re getting 404’s when trying to access any controller other than the front controller, you might want to check on your main httpd.conf file to make sure that you don’t have an AllowOverride None that is preventing your .htaccess directives from being executed.

The main apache configuration file on Leopard is here:

/private/etc/apache2/httpd.conf

Hopefully this saves someone a couple of hours and a couple of Tylenol.

Your License To Code PHP Has Been Revoked

April 9th, 2008 § 0

It’s a typical story. Dan on a rescue mission, fixing a mess that some clown(s) left behind. PHP. No framework to speak of, riddled with SQL injection holes, a TABLE-based layout – and it doesn’t get any better from there.

For the love of all things holy, why do people have to do stuff like this:

$sql = "SELECT user_id,user_status FROM users WHERE user_name='$username' AND user_password='$p'";
$r = mysql_fetch_assoc(mysql_query($sql));

For the record, $username and $p were just grabbed right out of $_POST.

If you spent 30 seconds to write even a crappy inefficient function to actually do something intelligent, not only would you not have code that’s riddled with SQL injection vulnerabilities (did I mention that this snippet of joy came out of a 3112 line file without a SINGLE comment?), but it might actually make your life easier because your code won’t suck so much – and you can stop repeating yourself.

I’m no 1337 PHP h4×0r, but how about – oh, I don’t know – something like this:

function fetch_associative_array_safely( $array ){
$sql = $array[0];
foreach ($array as $index => $value) {
$sql = str_replace( "?".$index, addslashes($value), $sql );
}
return mysql_fetch_assoc( mysql_query( $sql ) );
}

And just execute that bad boy like so:

$r = fetch_associative_array_safely( 
array( "SELECT user_id, user_status FROM users WHERE user_name='?1' AND user_password='?2'",
$username, $p) );

It’s not overly elegant, beautiful or efficient. But I don’t think that really matters. It helps me to not repeat myself, and by golly – at least someone can’t drop tables from my database anymore. It’s a bit Rails-esque, at least as far the the conditions portion of ActiveRecord::Base.find(...).

What do you think? I haven’t done any significant PHP coding in years.

Firefly

April 3rd, 2008 § 0

I wanted to make a totally off-of-normal-topics entry regarding what I consider to be the greatest television show of all time.

It just so happens there is a very aptly timed xkcd sort of on the same topic (at least the “I can kill you with my brain” part).

Carly and I have been watching the first (only) season on DVD again, and each and every episode has me bursting forth with some form of “MAN! This is the best TV show EVER!” or another.

It continues to amaze me that Fox pulled this off the air, I’m pretty sure that THAT was a crime against humanity.

Sigh.

Sustainable Software Development

March 29th, 2008 § 0

Avdi Grim has begun a thought-provoking series surrounding the idea of sustainable software development – specifically targeting Ruby as an example.

With some of the recent discussion surrounding “monkey patching” in Ruby, I think that the timing seems about right, for some serious thought to be given about the long-term effects of maintaining Ruby-based code-bases, should prolific “monkey patching” continue to be used haphazardly by many of the libraries, plugins, gems and other code that makes (sometimes critical?) modifications to the underlying core language classes.

Nick Sieger has crafted a thoughtful response to Avdi, which includes the quote:

[Monkey patching is] still a basic part of the Ruby programming culture, like it or not.

While Nick is totally correct, and Ruby does give you the power to shoot, maim and otherwise pillage and murder yourself in a bazillion different ways – that doesn’t take away the fact that it is still an incredibly powerful, elegant and syntactically beautiful programming language.

At the risk of sounding like a trite broken record (for the 485,000 time), I think that once again it boils down to using and choosing the right tools for the job. If the consequences of Ruby’s dynamism (among whatever other consequences) outweigh the positive benefits that a Ruby solution provides – then choose a different tool.

You can complain about the verbosity of a language like Java all you want (heck, I know I do at times), but I come back to Java sometimes after working with Ruby for a few months, and I’m all of a sudden thankful for strict, static typing, always knowing what I’m gonna get.

What continues to irk me are the folks who seem completely hell-bent that their way is the only One True Wayâ„¢.

I was in a job interview the other day (company name shall be kept confidential) at a place that does extensive software development in many languages including Java, C, C++, Perl and PHP (at the very least). Near the end of the interview, we were discussing different languages, and I mentioned how sometimes I really enjoy the dynamic typing facet of Ruby, as opposed to the statically typed facet of Java. At this statement, one of the interviewers piped up to tell me that the fact that I enjoyed dynamic typing at times was “the most brain-dead thing” he’d ever heard anyone say.

It seems so strange to me, to be on the receiving end of an insult like that, coming from a company that performs extensive development in PHP (which is not only dynamically typed, but also weakly typed, as opposed to Ruby which is strictly typed).

At any rate, all of that comes to some sort of summary that everyone should already know by now:

  1. there is no silver bullet
  2. think before you choose your tool/language/whatever
  3. don’t hate the unknown simply because it’s unknown
  4. don’t call someone brain-dead if they sometimes enjoy a programming language that is dynamically typed, it hurts their feelings
  5. read Avdi’s series on sustainable development in Ruby.

Static Imports in Java

March 17th, 2008 § 0

I’ve just been doing some reading up on some various Java documentation – and came across the list of new language features in Java 5 (yeah – I know, we’re at 6 now).

At any rate, I came across this gem about static imports, copied verbatim from Sun’s online documentation:

So when should you use static import? Very sparingly! Only use it when you’d otherwise be tempted to declare local copies of constants, or to abuse inheritance (the Constant Interface Antipattern). In other words, use it when you require frequent access to static members from one or two classes.

So that begs the question, why bother adding static imports as a core language feature at all, if the documentation basically says (in PR Speak to English, with apologies to John Gruber):

We have wicked awesome new language features including static imports! But FOR THE LOVE OF ALL THINGS GOOD, DON’T USE STATIC IMPORTS, IT WILL TURN YOUR CODE TO SLOPPY CRAP!

Thanks, Sun. Next time, add some language features that we have your blessing to actually utilize.

Note to Sun: I like closures, and if you build them into the language, try doing it using syntax that doesn’t suck (I’m looking at you, generics).