Shaun Mccran

My digital playground

14
A
P
R
2010

Free Coffee in starbucks tomorrow - April 15th

On Thursday 15 April only, take a re-usable travel flask into Starbucks and get any sized free hot or iced espresso drink worth about £2.65. Any drink with an espresso shot is included in the offer, for example a latte, cappuccino, americano, macchiato, inc. flavoured versions.

The offer's available nationwide from 7am to 11pm (provided your local store is open) at participating stores. For full details read about Starbuck's eco campaign 'the Big Picture'.

What counts as a reusable travel mug? It needs to be something you can transport your coffee in easily and that you will use again, eg a polystyrene cup won't work. A ceramic mug from home won't be accepted either. A bog-standard packed lunch flask should do the trick!

13
A
P
R
2010

Flash content incompatibilities with lightbox’s and DHTML Div’s

I've seen the issue a few times in my travels where there is flash content on a page, and other content IE DHTML Div's has been triggered and the new content has slipped behind the flash in a really ugly way.

I found myself in this position building an image gallery with YouTube videos in it. Clicking on a lightbox link caused a flash video to show through the new lighbox pop up.

Like this: Test script showing flash messing up my lightbox.

[ More ]

05
A
P
R
2010

Blog redesign and a version update to BlogCFC 5.9.5

I've been running an older version of Blog CFC for a while now, so I thought it was well past due an update to the latest version. It seemed like a good time to give the site a lick of paint, so I have de- web 2.0'd it. At some point I got swept up in the curved corners and shiny gradients of Web 2.0ness, and now I just plain don't like it.

If you didn't know already you can get BlogCFC from RIA forge here: http://blogcfc.riaforge.org/. There seem to have been some nice tweaks in the last few versions, and it's nice to see a software application maturing.

In the process of redesigning the site I came across this recent survey of the installed user base for windows fonts. It is always risky for a developer to use a non standard font, so surveys like this are ideal. http://www.codestyle.org/css/font-family/sampler-WindowsResults.shtml

Also I had a little Photoshop help creating the image header. Here is a pretty painless Photoshop tutorial on "Fade Images in Photoshop Using Layer Masks", http://articles.sitepoint.com/article/photoshop-fade-layer-mask

Lastly I've added some Feedburner integration. Feedburner is a great way of consuming your RSS feeds, it adds a whole load of options, and allows you to push feed content out to other community sources, such as Twitter or FaceBook. It also provides stats, a la Google Analytics style, and its free (requires a Google account)! http://feedburner.google.com.

I think I took two things away from this redesign. Firstly, double check your CSS. The only real issues I had during the entire process were CSS related (thanks IE). Secondly index your database properly. I'm not sure if the previous install was indexed at all, or whether the new version just has better indexing in the installation scripts, but the performance difference is notably quicker!

25
M
A
R
2010

Pre loading object (CFC) references in your Application.cfc

One of the best practices that I've been using more and more is ColdFusion's ability to add CFC object references to scopes. By this I mean that it is possible to create a shorter friendlier scoped variable that you use to reference your CFC's.

In your Application.cfc you can map out all your CFC references, this gives you a much shorter variable name to type each time, and it caches the CFC.

view plain print about
1<cffunction name="onApplicationStart">
2
3<!--- scope out all the objects as application level vars --->
4<cfset application.formObj= createObject('component','dir.objName ')>
5<cfset application.siteObj= createObject('component','dir.objName')>
6<cfset application.mailObj= createObject('component','dir.objName')>
7<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>
8
9</cffunction>

Put any references like this in the 'onApplicationStart' function. You do not need to lock the scope in this function, and if the code within it does not run successfully then it does not continue running the application. It will try again on the next page request.

The caching functionality here is great, not only will Coldfusion create a handy short name for CFC, but it will actually run through the code, and stop on any errors. If you deliberately introduce a code error into one of your objects you will see the Application halt and show you the error. For me this is reason enough to move all my business logic into CFC's. This essentially means that it is not possible for a user to get part of the way through a application and find an object based error.

Using this in conjunction with a framework such as FuseBox allows you to load, parse and cache the CFC object, all before your actual display layer has been invoked.

The example below uses the FuseBox function 'onFuseboxApplicationStart' of starting an Application.

view plain print about
1<cffunction name="onFuseboxApplicationStart">
2    <cfset super.onFuseboxApplicationStart() />
3<!--- scope out all the objects as application level vars --->
4
5<cfset application.formObj= createObject('component','dir.objName ')>
6<cfset application.siteObj= createObject('component','dir.objName')>
7<cfset application.mailObj= createObject('component','dir.objName')>
8<cfset application.config=createObject('component','dir.objName').getConfig(id=N)>
9
10
11</cffunction>

Changing the 'fusebox_parameters.mode' value allows you to set this caching at an environmental level, so no caching for development, or caching for live

view plain print about
1<cfset FUSEBOX_PARAMETERS.mode = "development-full-load">
2Or
3<cfset FUSEBOX_PARAMETERS.mode = "production">

_UNKNOWNTRANSLATION_ /