Skip to content


Custom error pages on Internet Explorer

Originally written for the G3 Global blog

Being a web developer I am often faced with the challenge of getting a website looking sweet in various types of browsers and versions of those browsers.

Firefox

Each browser interprets code differently, so when one writes code which renders correctly in one browser it doesn’t necessarily render as well in another browser. The thorn in all web developer’s sides is good old Internet Explorer 6 or IE6. One can build a webpage which looks fantastic in the world’s best browser Firefox (yes I am biased :) ) and then look at it in IE6 and it will most probably have layout issues.

There are numerous tricks and hacks to get web-pages looking good in IE6, so one just learns to deal with how bad the browser is.

So, what’s the real issue?

Just to re-enforce how bad the browser actually is, I was recently told about how Internet Explorer (all versions) have a built in default error page which will always be displayed even if you have added a customized error page to your web project.

What it boils down to is that if your custom error page is less than 512 bytes, it will never be rendered in IE. I seriously could not believe it when I saw the article by Jeff Starr, but it’s true. So, some Microsoft employee specifically wrote code to do this…one has to ask why? I mean seriously, what was the logic behind this decision? What a bunch of jokers!!!

To make matters worse, there even settings for this in the Windoze registry which differ according to the type of error….craziness!!

\HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Internet Explorer\Main\ErrorThresholds
Error - threshold (default)
400 - 512 bytes
403 - 256 bytes
404 - 512 bytes
405 - 256 bytes
406 - 512 bytes
408 - 512 bytes
409 - 512 bytes
410 - 256 bytes
500 - 512 bytes
501 - 512 bytes
505 - 512 bytes

Useless tip of the day: Ensure that your custom error pages have enough useless content in them to make them larger than 512 bytes

Tags: , , .

Ensuring the hand cursor is displayed in Flex components

Originally written for the G3 Global blog

I’m not sure if it’s a bug in the Flex code framework, but I have found it difficult to get the handcursor working when hovering over components like Labels/Text which arn’t used as links by default. After bashing my head against my desk for a few hours and doing some research on the web, I finally came across a soution which which works in most cases. To get the hand cursor working you need use the following 3 properties:

buttonMode=”true” mouseChildren=”false” useHandCursor=”true”

Here’s an example of a Label which is used as a link:

< mx:Label text="Log out" buttonMode="true" mouseChildren="false" useHandCursor="true" click="logout()" />

It seems like it’s a pretty common problem and these two articles showed me the light of day, thanks dudes!

Tags: , .

G3 Global launches a new website and blog

I am currently working for G3 Global a company specialising in SAP implementation in the media industry. Apart from building web portal applications for clients, I have also been working on improving the website.

G3 Global is a SAP Channel Partner specialising in the implementation of SAP ERP solutions in the Media industry.

The old site was built using static php pages, had a dated design and was disjointed in a few areas. So, we set out to improve the site by putting more emphasis on our products, the introduction of a fresh design, a flatter hierarchy, a blog, and an events section.

The design was done by “Andy, the chief coffee drinker” at Caffeinehit Ltd . I have to say that he did a great job after lots of Starbucks Grande latte’s and a few design workshops in our offices.

I did the implementation of the site and for those of you that care…yes the geeks ;), I used wordpress as the CMS solution along with a number of plugins which I either downloaded and hacked or wrote myself.

Overall I really enjoyed working on the site and I think it has been well received by the rest of the company. Now all we need to do is get everyone blogging…so I’m going to have to answer questions like - “what’s a blog?”, “how do i put a list into a post?”…blah, blah, blah :)

Besides Andy, thanks also go out to Chris and Drew for their hard work and guidance. Good effort lads!

Tags: , , , .

Don’t let the distance scare you

While browsing some runners blogs and websites I came across these paragraph by Karl King - not sure who he is, but I think it’s classic:

When my longest run was 13 miles, a marathon seemed nearly impossible.
When my longest run was 26 miles, 50 miles seemed nearly impossible.
When my longest run was 50 miles, 100 miles seemed nearly impossible.
When my longest run was 100 miles, 50 miles seemed like a nice, long training run.

Don’t let the distance scare you; run from aid station to aid station and the distance will take care of itself.

Tags: , .

Styling and controlling a Flex Tree control using a custom ItemRenderer

I am still pretty new to Flex and the last two weeks have been a massive learning curve. However, through trial and error, lots of research and plenty of tea (thanks Drew!), I am finally coming to grips with Flex, but more importantly Actionscript.

One of the things I have been working on is a FAQ section for a web portol. To implement this I have used the following components and controls:

  1. A basepage
  2. A standard mxml Tree contol ()
  3. A custom ItemRenderer
  4. A custom DataDescriptor
  5. A function which is executed upon creation (creationComplete=”initTree()”)

The focus of this tutorial is however on Item 3, a custom ItemRenderer. So here goes…

Firstly the data structure that I am using is a standard xml file which has categories, an answer and a question, I have included an exmaple below:

< ? xml version="1.0" encoding="UTF-8"?>
< faq xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
< category>
< nameGuidance
< item>
< question>What is the meaning of life, the universe and everything?
< answer>42
< /item>


Secondly, the Tree control has a number of paramaters which need to be included to get the desired result:

< mx:Tree id="myTree"
styleName="faqList"
wordWrap="true"
itemClick="tree_itemClick(event);"
width="100%" height="100%"
top="20"
dataDescriptor="{new TreeDataDescriptor()}"
itemRenderer="renderers.TreeRenderer"
creationComplete="initTree()"
/>

I will try to cover the dataDescriptor, itemClick and creationComplete in other posts, but for the time being, the ItemRenderer works something like this:

  • It is important to include the if (super.data) logic otherwise the application will through errors because it’s referring to an object with a null value.
  • In the data method, I have set all parents (depth == 1) to have a bold style otherwise the nodes should just have normal font weight.
  • In the updateDisplayList:
    1. I firstly remove the disclosure icons from all nodes
    2. Add some default text styling to nodes, which sets the selected node back to its original styling after it was selected
    3. Then if a 2nd level node is either highlighted (isItemHighligthed) or selected (isItemSelected) I change styling, display the disclosure icon and adjust the position of the disclosure icon
      (super.disclosureIcon.x = super.width - 50;).
  • Note: The moving the position of the icon is relatively simple, but I had difficulty finding information on the web about how to do this, so I’m hoping this will help someone out ther. This particular example moves the disclsure icon 50px inside the right hand border of the Tree control

package com.g3global.ipp.view.components.renderers
{
import mx.collections.*;
import mx.controls.treeClasses.*;
import mx.controls.listClasses.ListBase;

/*
* Custom Item Renderer for TreeControl
*
* @package Renderers
* @author Stephen Blake
*/
public class TreeRenderer extends TreeItemRenderer
{

/*
* Define the constructor.
*/
public function TreeRenderer()
{
super();
}

/* Override method for the data property to set the font color and style of each node.
*
* @param value Object
*/
override public function set data(value:Object):void
{
super.data = value;

if (super.data)
{
if (TreeListData(listData).depth == 1)
{
setStyle("fontWeight", 'bold');
}
else
{
setStyle("fontWeight", 'normal');
}
}
}

/* Override method to set the text for each tree node.
*
* @param unscaledWidth Number
* @param unscaledHeight Number
*/
override protected function updateDisplayList(unscaledWidth:Number,
unscaledHeight:Number):void {

// Call the method in the super class
super.updateDisplayList(unscaledWidth, unscaledHeight);

if(super.data)
{
// Set the disclosure icon to false - overrides styles
super.disclosureIcon.visible = false;

if (TreeListData(listData).depth > 1)
{
setStyle("fontWeight", 'normal');
}

// Specific styling for children nodes that are selected or highlighted
if(ListBase(owner).isItemSelected(data) || ListBase(owner).isItemHighlighted(data) && TreeListData(listData).depth == 2)
{
super.disclosureIcon.visible = true;
super.disclosureIcon.x = super.width - 50;
setStyle('fontWeight', 'bold');
}

}
}
}
}

So that’s about it. Unfortunately I can’t link to a working demo of this feature because it is part of a much bigger application which is being built for a client.

Tags: , , .

London comes to a halt

Last nights snow fall seemed to bring London to a stand still. All the buses have been suspended and here is a snapshot of the tube service at the moment:
Tube closures

Wordpress 2.7 “Coltrane” released

The long awaited new version of Wordpress was released just over a week ago and I have got to say that I am really impressed with the new look and feel, updated user interface and the large amount of new and improved functionality.

Hats off to everybody involved in the new release! It has truly become a fantastic blogging platform and although I have always been a huge advocate for Wordpress, this release makes it much easier for me to convince people how good it actually is.

The usability of the admin interface is so slick and easy to use that I have completely fallen in love with it. So, if you’re using another blogging platform do yourself a favour and get Wordpress installed – I guarantee that you won’t look back.

Below is the screencast of some of the new functionality - it’s awesome!!

Tags: , , .

Working from home is overrated

I have been working from home by myself for the whole week and I’ve got to say that the novelty has definitely worn off. It is something that I don’t think is sustainable for long periods of time, unless you really enjoy what you do, have about as much self control as the Dalai Lama and quite frankly enjoy being a hermit.

Don’t get me wrong here, I do quite enjoy working from home once in awhile as there are less distractions and when I have lots of coding to do the less distractions the better. Also it gives you a break from the office and can be a good way to recharge. However, I think two days a week is pretty much my limit.

I am sure that their are some differences of opinion here, but as far as I’m concerned, it’s not my cup of tea. We are after all social beings and we do need interaction….and no, video skype calls don’t count…I’m talking about face to face human interaction. Even, if it’s just having one of your colleagues next to you listening to music in his earphones, at least you can have chat over a cup of tea every now and then.

As far as I’m concerned, if a company expects their employees to work from home, then they are going to have a few unhappy individuals on the payroll.

Tags: .