Strict Standards: Redefining already defined constructor for class wpdb in /home/bri58020/public_html/mike/wp-includes/wp-db.php on line 52

Deprecated: Assigning the return value of new by reference is deprecated in /home/bri58020/public_html/mike/wp-includes/cache.php on line 36

Strict Standards: Redefining already defined constructor for class WP_Object_Cache in /home/bri58020/public_html/mike/wp-includes/cache.php on line 389

Strict Standards: Declaration of Walker_Page::start_lvl() should be compatible with Walker::start_lvl($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_lvl() should be compatible with Walker::end_lvl($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::start_el() should be compatible with Walker::start_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_Page::end_el() should be compatible with Walker::end_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 537

Strict Standards: Declaration of Walker_PageDropdown::start_el() should be compatible with Walker::start_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 556

Strict Standards: Declaration of Walker_Category::start_lvl() should be compatible with Walker::start_lvl($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_lvl() should be compatible with Walker::end_lvl($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::start_el() should be compatible with Walker::start_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_Category::end_el() should be compatible with Walker::end_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 653

Strict Standards: Declaration of Walker_CategoryDropdown::start_el() should be compatible with Walker::start_el($output) in /home/bri58020/public_html/mike/wp-includes/classes.php on line 678

Deprecated: Assigning the return value of new by reference is deprecated in /home/bri58020/public_html/mike/wp-includes/query.php on line 21

Deprecated: Assigning the return value of new by reference is deprecated in /home/bri58020/public_html/mike/wp-includes/theme.php on line 508
2006 » May MikeFitz with overflow bit set…

Archive for May, 2006

What is really valuable to your clients?

Tuesday, May 16th, 2006

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/bri58020/public_html/mike/wp-includes/formatting.php on line 74

My mate Dugie had a minor whinge the other day about the cost of printer consumables. His story reminded me of a very clever lady I met a few years ago. She was one of the first Australians to exploit the high profit margin in printer cartridges. Her business was thriving because she had really worked out exactly what her clients needed.

Dugie’s first complaint was that he was forced to buy a new printer for no reason other than the manufacturer no longer made replacement cartridges. There was nothing wrong with his printer; it was even still within its “extended warranty”. Whinge-worthy.

His next shock came when he purchased a new printer and, planning ahead, priced a spare set of cartridges. A complete set of cartridges came to just $20 less than the price of his new printer. Dugie’s question was “Why would anybody ever buy a set of cartridges when you could buy a whole new printer and have complete hardware redundancy?“  Even more whinge-worthy.

But it gets worse. 

(more…)

Did you miss the Inaugural WARDY IT Community Dinner?

Tuesday, May 16th, 2006

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/bri58020/public_html/mike/wp-includes/formatting.php on line 74

Well you should have been there!  You missed a great opportunity to meet your peers in a relaxing environment where we could actually hear each other talk. (Monday nights are fairly quiet in the restaurant business and we had an outside table.)

Thanks to Peter Ward for organising last night’s Community Dinner.  We didn’t learn about any up-coming technologies (that’s what user group meetings are for) but a great night was had by all.  We even had an opportunity to chat with well-known Sydney blow-in (and Microsoft Regional Director) Adam Cogan.

Tell you what, come along next time and I guarantee you will meet two kinds of people…

  1. People with the same skill set as yourself.
    These folks are striking or have struck the same problems as you are currently encountering. And we all know that two heads are better than one.
  2. People with different skills to you.
    These are the folks who can fill in the skill gaps and help you out on your next project. And because you have shared a meal with them, they are now your mates. Productive business partnerships are born this way.

Keep an eye on the Queensland Developer Events page for details of the next Community Dinner. Alternatively, feel free to contact me or Peter (peter @ wardyit.com) if you would like an e-mail invitation.

Brisbane Developers, do not miss Adam Cogan and Wardy IT!

Thursday, May 11th, 2006

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/bri58020/public_html/mike/wp-includes/formatting.php on line 74

An overdose of community for Brisbane developers early next week!

First-up, Monday 15 May, is the inaugural WARDY IT Monthly Community Dinner.

Following a serious suggestion on Community Dinners by Darren Neimke, there has been a lot of interest from all over. (eg Mitch Denny in Canberra, Dugie here in Brisbane)

However, it has taken Peter Ward from Wardy IT Solutions to spot the gap in the market and organise the Inaugural WARDY IT Monthly Community Dinner. (And claim naming rights, good on him!)

Then on Tuesday 16 May, the monthly QMSDNUG meeting featuring Adam Cogan on Making VSTS integrate into your current systems.

Adam will take us through everything we need to know to optimise our software development cycle using VSTS, including:

  1. How a bug tracking system works
  2. Customising Team Foundation Server (TFS) to work in your organization
  3. Updating your bug tracking system to work with TFS
  4. How a task list and work items work

For time and location details on these events, see the Queensland Developer Events page.

Display code in fixed-width blogs without line wrapping

Monday, May 1st, 2006

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/bri58020/public_html/mike/wp-includes/formatting.php on line 74

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/bri58020/public_html/mike/wp-includes/formatting.php on line 81

Do you display code samples in your blog? Do long lines of code push your side-bar off the screen? Do your readers get spurious line breaks when they cut and paste your code?  Maybe this tip will help.

Liquid Layout

I have long been a great fan of “liquid layout”. That is, paragraphs of text expanding or contracting horizontally to fill the browser space available.

Posting code under these circumstances was no drama. Long lines would just wrap as necessary and readers could cut and paste without picking up any spurious line breaks.

11 words per line

However, web accessibility and usability expert Andy Fitzsimon tells me that adults prefer to read text displayed in columns with about 10 to 12 words per line. Apparently this is widely known in graphic design circles and is backed up by research from establishments like Software Usability Research Lab at Dept of Psychology, Wichita State University. See

This is why my blog, along with many other WordPress blogs, now uses a stylesheet which displays 10pt Verdana text in a column 450 pixels wide. For people who only blog in text, this works fine and this is all they need to know. But for developers…

The Problem

So now that we have a text column fixed at 450 pixels wide, what happens when we want to include some sample code which includes long lines which won’t fit within 450 pixels?

In my previous post Customise your BlogMap, I needed to display some HTML with quite long URLs; a fairly common occurrence for developers who blog.

What are our options?

  1. Use an extremely small font
    We might display a fragment of VB code like this…
    ‘initialise date time format (d-MMM for Charts, dd/mm/yy for reports)
    dtf = New CultureInfo(CultureInfo.CurrentCulture.LCID).DateTimeFormat
    If blnCharting Then
    dtf.ShortDatePattern = “d-MMM”
    Else

    Note that our indenting has been lost, readability is lowered and there is still a limit to the length of line which can be displayed this way.
  2. Introduce manual line breaks
    'initialise date time format (d-MMM for Charts,
    dd/mm/yy for reports)
    dtf = New CultureInfo(CultureInfo.CurrentCulture.
    LCID).DateTimeFormat
    If blnCharting Then
    dtf.ShortDatePattern = “d-MMM”
    Else

    The spurious line breaks could confuse readers (and compilers).
  3. Do Nothing
    'initialise date time format (d-MMM for Charts, dd/mm/yy for reports)
    dtf = New CultureInfo(CultureInfo.CurrentCulture.LCID).DateTimeFormat
    If blnCharting Then
    dtf.ShortDatePattern = “d-MMM”
    Else

    Poor handling of white space will lower readability. Further, if my styles weren’t defined correctly, the long line of code could push out into the sidebar area, forcing the sidebar to the bottom of the page. You’ll sometimes see this on other blogs.

Mark up code using the <pre> Tag

The best solution I have found to date is to use the <pre> (preformatted) tag and a code CSS class. For example, if I mark up the code like this…

<pre class="code"><code>
'initialise date time format (d-MMM for Charts, dd/mm/yy for reports)
dtf = New CultureInfo(CultureInfo.CurrentCulture.LCID).DateTimeFormat
If blnCharting Then
    dtf.ShortDatePattern = "d-MMM"
Else
</code></pre>

… then the reader sees this:

'initialise date time format (d-MMM for Charts, dd/mm/yy for reports)
dtf = New CultureInfo(CultureInfo.CurrentCulture.LCID).DateTimeFormat
If blnCharting Then
    dtf.ShortDatePattern = "d-MMM"
Else

The horizontal scroll-bar means that any line length can be accommodated.

The CSS

The corresponding CSS styles to achieve the above effect is…

pre.code {
  width: 100%;
  overflow: auto;
  /*overflow:-moz-scrollbars-horizontal;
  overflow-x:scroll;*/
  border: 1px dotted #281;
  border-left: none;
  background-color: #fff;
  padding-bottom: 16px;
  font-size: 1em;
  }

code {
  font: 1.1em 'Courier New', Courier, Fixed;
  }

The padding-bottom: 16px; is to avoid code being hidden behind the horizontal scroll-bar.

HTML Encoding

Note that we are still dealing with HTML within the <pre> tags. Our code must be HTMLEncoded, ie “&” becomes “&amp;”, “<” and “>” become “&lt;” and “&gt;” respectively.

For example, the small HTML snippet in my previous blog entry was marked-up thus:

<pre class="code"><code>
&lt;div&gt;
  &lt;script type="text/javascript"
    src="http://www.feedmap.net/blogmap/blogapi.ashx?method=blogmapbadge&amp;amp;feed=http://mike.brisgeek.com/feed/"&gt;
  &lt;/script&gt;
&lt;/div&gt;
</code></pre>

If anyone has any other techniques for displaying code in a fixed-width column, please let me know or leave a comment.