March
18

IE 4.x minimum

Posted In: Software Development by graham

Though Scott Hanselman, in IE6 Warning - Stop Living In The Past - Get off of IE6, and others would like to see users upgrade to a newer version of Internet Explorer, it may take a long time to happen with some users.

This Government agency - to remain nameless - offers no incentive to upgrade according to this pop-up warning in which requires at least Internet Explorer version 4.0:

Internet Explorer 4.x required

How they continue to keep their application compatible with a 12 year old browser I do not know, but they must be geniuses!

Comments Off
March
13

The elegance of code is still important, for those of us who read and write code. If you use WYSIWYG editors or a code generating IDE then your code will never be elegant, but I digress.

The problem I wanted to solve today was to change the case of strings. For example, to change 'HELLO WORLD' to 'Hello World'. My challenge is to see whether I can do it with MySQL and just the built-in string functions. If it's not possible, it's no matter. I can fall back on a simple PHP script to do this one-time conversion very easily. This is because I've already written code in PHP to do this in the application for all new records that are created, and I just want to change the existing data stored in the table.

Googling a possible MySQL solution, I came across an article on Experts Exchange for the exact same problem, and they also agreed PHP is a better option than using just SQL. What surprised me on reading it was how inelegant the suggested solution was. Let me illustrate:

Their solution:

$field = strtolower($field);
$array=explode(" ",$field);
for ($i=0;$i<count($array);$i++)
{
  substr($array[$i],0,1) = strtoupper(substr($array[$i],0,1));
}
$field = implode(" ",$array);

My solution:

$field = ucwords(strtolower($field));

Which would you rather write? And more importantly, which would you rather read if you had to read someone else's code? Now my solution does have one important difference: I reviewed the PHP manual to see if there was a built-in function that capitalizes the first letter of each word. In simple terms it satisfies the DRY principle, code reuse and using as little code as possible. Sometimes all it takes is a little time and thought to create something so much more beautiful, elegant and readable - time well spent.

Comments Off
March
11

I've turned my brain to mush reading about all these social networking and twitter opinion pieces and the readers' comments that accompany them. It's all too easy to reach information overload just reading about them, and not actually reading from them. Regardless, I've learned some things along the way, and strengthened some opinions I already had forming.

My personal opinion is, unless you have extremely topical / insightful / thought-provoking / funny / or you're posting first-hand breaking news in your tweets, they're of little value to me or anyone else.  I'm not going to read them. I'm far too busy and there are better things to do with my time. This also goes for Facebook status updates. I'm not just a hater; Facebook is good for some things, especially if it promotes turning off the computer and doing things in the real world.

Blog posts are a different kind of animal. Most people spend a fair amount of time composing them, polishing them, and have enough room to support an opinion they may be expressing. Some - like this post - are intended to be thought provoking for the reader.

Do you have your own blog? If not, imagine you do. Would it contain up-to-the-minute local news and events, essays, specialist information on one topic? How is it different than a printed magazine, or a printed newspaper? Do you update it every day, week, or month?

I probably have more questions than I have answers. To find these answers I would first look to traditional historical forms of communication. Think about what books, newspapers, magazines, radio, television, telephone, snail mail, the local pub and others have done well, and adapt it to the new digital medium. The biggest changes made possible by technology is the low cost, far reach, and immediacy of self-publishing.

This blog is still in its infancy, and many of the above questions are still to be answered. The more input I get from readers, the better focussed my content can get. So comments and questions are appreciated. And my goal for now is to post again in less than a month to get some momentum happening.

Comments Off