A Little Noise

November 11, 2005

Truncation

Filed under: MySQL Gotchas — snoyes @ 4:47 pm

Assume the following has completed correctly:

CREATE TABLE test (
charField varchar(5)
);

What is the end difference between the following two statements?

INSERT INTO test (charField) VALUES ("123456");
INSERT INTO test (charField) VALUES ("12345 ");

Show Answer ▼

Concatenate

Filed under: PHP Gotchas — snoyes @ 4:00 am

What, if anything, is the minimum change (fewest inserted/deleted/modified characters) required to make the output The result is bar:


<?php
class A {
  private $foo = "bar";
  public function __toString() {
    return $this->foo;
  }
}

$myObject = new A();
echo "The result is " . $myObject;
?>

Show Answer ▼

November 9, 2005

User Experience

Filed under: MySQL — snoyes @ 4:43 pm

I had a positive user experience at the MySQL website the other day while registering for a webinar. The site knew I was logged in, and filled out as much of the form for me as it could. When I added the missing pieces of information, that next page noticed and provided a single-click where I could add the data to my profile. Added functionality, but completely unobtrusive – that’s the user experience I like.

What are ‘gotchas’?

Filed under: Technical — snoyes @ 4:42 pm

At work, we play a little game called “Tech Team Quiz”.

Whenever we stumble across a bit of code that behaves oddly, or gives unexpected results that turn out to be documented clearly in the manual, or just contain some devious little error that took a long time to hunt down, we post it as a challenge for the others. For the purpose of this blog, I’ve dubbed them “gotchas”.

Read carefully – sometimes it’s bad syntax, sometimes it’s behavior that changed between recent versions (for PHP, you can assume version 5.0; for MySQL, it could be anything from 4.0 to 5.1).

« Newer Posts

Powered by WordPress