Technoclasm | A few thoughts about Coldfusion, Development and Life

CAT | Development

Watch out for the gotcha with 2 things.

1 – don’t use request scoped variables in the init of controllers. Wont work when you change the mode to testing. At All.

2 – if your using PascalNotation for your controllers, don’t forget to put hyphens in your views

Joel  -  Smarticles

Version 1.0 of coldfusion on wheels was released in late November.

I’ve been watching, and recommending this framework for a while. I recommend everyone taking a really good look at it.

There has been lots of speculation about it not gaining traction. In large organisations, or in large projects, people forget that frameworks can only be replaced when the existing application is redeveloped. In traditional risk-averse environments it can be many years between re-developments. Couple that with some really good frameworks like Coldbox, and Mach II and traction for Wheels could be pretty slow.That isn’t the frameworks fault, its just the way things happen. Sometimes a tipping point has to be reached before community projects explode into life.

All of this can only be aided by the release of the 1.0 release. Beta releases (except by Google) put people off, and hopefully this will mark a step change in peoples attitudes to wheels.

Joel – Smarticles

No tags

A few notes on implicit vs explicit getters and setters.

1) Coldfusion support in CF9 is enabled on the property tag as an attribute – not on by default
http://www.danvega.org/blog/index.cfm/2009/10/6/ColdFusion-9-Implicit-getters–setters-change

2) Coldfusion onMissingMethod
http://www.bennadel.com/index.cfm?dax=blog:868.view
Although Ben Nadel seems to dislike the thing ( it was a while back so maybe he changed his mind?) – and he’s being convinced in the comments. The performance affect was exceedingly marginal (<20ms).

An implementation of what I was talking about is here:
http://www.coldfusionjedi.com/index.cfm/2007/8/5/Warning-about-onMissingMethod – the warning relates to using the right arguments. Comments suggested changing find to comparing the first 3 characters to improve performance.

<cfcomponent name="entity_auto" extends="ColdFX.entity" output="false">

<cffunction name=”onMissingMethod” access=”public” returnType=”any” output=”false”>
<cfargument name=”missingMethodName” type=”string” required=”true”>
<cfargument name=”missingMethodArguments” type=”struct” required=”true”>
<cfset var key = “”>

<!— this includes arguments with set —>
<cfif left(arguments.missingMethodName,3) eq “set”>
<cfset key = replaceNoCase(arguments.missingMethodName,”get”,”")>
<cfif structKeyExists(variables, key)>
<cfreturn variables[key]>
</cfif>
</cfif>

<!— this includes arguments with get —>
<cfif left(arguments.missingMethodName,3) eq “get”>
<cfset key = replaceNoCase(arguments.missingMethodName,”set”,”")>
<cfif structKeyExists(arguments.missingMethodArguments, key)>
<cfset variables[key] = arguments.missingMethodArguments[key]>
</cfif>
</cfif>

<!— everything else still throws an error —>

</cffunction>

</cfcomponent>

If you want to turn on auto magic dynamic proxying all you do in your component is

<cfcomponent name="car" extends="ColdFX.entity_auto" output="false">
<cfproperty name="wheels">
<cfproperty name="engine">

<cffunction name=”init”>
<cfargument name=”wheels”>
<cfargument name=”engine”>
<cfset this.setWheels(arguments.wheels)/>
<cfset this.setEngine(arguments.engine)/>
</cffunction>

</cfcomponent>

, , ,

This is a follow up on my previous post. It intends to go into greater detail about form fields in HTML 5.

Using HTML 5 Forms

Firstly webforms2 seems to have a javascript implementation so that you can use these in all modern web browsers. The library seems to be adapting itself, but should be pretty bombproof for html5 soon.

With this you can start using

<input type="email"/>
<input type="date"/>
<input type="url"/>

all immediately.

Required Fields

There are however some bonus options. I mentioned input required in my previous post – as my commenter points out – it should be:

<input required="required"/>

Bespoke Validation

There is also the neat pattern attributes which allows you to bespoke regular expression validation for a field

<input type="text" pattern="^([A-PR-UWYZ][A-HK-Y0-9][A-HJKS-UW0-9]?
[ABEHMNPRVWXY0-9]?{1,2} [0-9][ABD-HJLNP-UW-Z]{2})$" />
<!-- uk postal code -->

Placeholder

Placeholder is some text that provides a hint to the user about what to type. It isn’t the default value.  I have seen this hacked in with Javascript several times before. Its a really good nice to have feature that can be implemented really cheaply.

Javascript and Handlers

For the form level. You can now call checkValidity() on the form to check the validity of the form.

When you submit a form using submit() with a scripted-submit tag present.

Finally if you want to do bespoke validations to a form and use the built in form validation. You can set a custom validity for the field using setCustomValidity(). An empty string indicates validity, anything else indicates an error.

Joel

No tags

Just a really quick one. I saw Andy Scott’s email about scopes and was reminded what was cool about Railo

In Railo administrator at Settings/Scope you can set the Local Scope Mode from update to always, this change how Railo use the local scope, after this change Railo write every un-scoped variable to the local scope, you no longer need the var or local. to write a variable to local scope, this makes code like this a much easier. Michael Offner-Streit

No tags

I have been keen to take a look at html 5 and I thought I would have a go.  Google have recently released an os based on it, and Microsoft are promising that Internet Explorer will (mostly) support it.

From my initial view it looks really sensible.  I hope that the browsers can get together and thrash out a solution to the video tag – it would save everyone from having to install flash, or worse still silverlight.

1) Embed other XML

HTML 5 allows for MathML and SVG elements to be used inside a document

2) New Tags

  • section represents a generic document or application section. It can be used together with the h1, h2, h3, h4, h5, and h6 elements to indicate the document structure.
    this confuses me a bit – but it seems to be to define an area of the page as a section.
  • article represents an independent piece of content of a document, such as a blog entry or newspaper article.
    On the blog home page (like this one) each blog entry would be wrapped in a <article></article> tag.  It’s likely to be well implemented by blog engines, and cms systems. Particularly if Google news will syndicate your content because its in an article tag
  • aside represents a piece of content that is only slightly related to the rest of the page.
    This is for off-topic content. Great for search engines – but I can’t see many people using this too much unless they’re really geeky
  • hgroup represents the header of a section
    Strangely named but I guess quite useful if you are keen to structure your pages perfectly.  Really useful for SEO and search engines.
  • header represents a group of introductory or navigational aids.
    Similar sounding to head, heading is for what always seems to get put in “<div class=’head’>”.  Really useful for SEO and search engines.
  • footer represents a footer for a section and can contain information about the author, copyright information, et cetera.
    The same as header, but with the footer.  Really useful for SEO and search engines.
  • nav represents a section of the document intended for navigation.
    The same as header and footer but for the navigation.
  • dialog can be used to mark up a conversation like this:
    <dialog>
     <dt> Sir if you were my husband I'd poison your tea
     <dd> Lady, if you were my wife I would drink it
    </dialog>
  • figure can be used to associate a caption together with some embedded content, such as a graphic or video:
    <figure>
     <video src="paris_hilton_vid"></video>
     <legend>un-named hotel heiress in video shame</legend>
    </figure>
    This wont hurt SEO, or Talking Browsers, and it seems to offer some nice possibilities
  • video and audio for multimedia content.
    Implementation of this is likely to be very hit and miss. Every browser seems really keen to do it absolutely differently
  • embed is used for plugin content.
  • mark represents a run of marked text.
    This is really for search results snippets where the word found is highlighted. Now the mark tag can be used
  • progress represents a completion of a task, such as downloading or when performing a series of expensive operations.
    Self explanatory, but useful.  Should not be confused with things that require the meter tag.
  • meter represents a measurement, such as disk usage.
    Nice – this will help (support:  http://html5doctor.com/measure-up-with-the-meter-tag/)
  • time represents a date and/or time.
    Another nice addition, works on the locale of the browser
  • ruby, rt and rp allow for marking up ruby annotations.
    Meh
  • canvas is used for rendering dynamic bitmap graphics on the fly, such as graphs or games.
  • command represents a command the user can invoke.
    The <command> tag defines a command button, like a radiobutton, a checkbox, or a button. The command element must be inside a menu element. If not, it will not be displayed.
  • details represents additional information or controls which the user can obtain on demand.
  • datalist together with the a new list attribute for input can be used to make comboboxes:
    <input list="browsers">
    <datalist id="browsers">
     <option value="Safari">
     <option value="Firefox">
    </datalist>
  • keygen represents control for key pair generation.
    Seems to allow for massively complicated key pair generation. I can’t think of a example use – but I’m sure there is a fabulous one.
  • output represents some type of output, such as from a calculation done through scripting.

3) New Input Types

There are mostly cool, and there are some nice hooks that you can add in with javascript (setCustomValidity).  I could write a book on these – but for the most part I’m happy to suggest using your heads and reading the documentation.

  • tel
    for entering telephone numbers
  • search
    a synonym for text, useful for the browser to keep search results, but not other fields
  • url
    a validated field for urls
  • email
    a validated entry field for email addresses
  • datetime
    a whole host of date/time pickers (nice)
  • date
  • month
  • week
  • time
  • datetime-local
  • number
    lets you choose a number
  • range
    lets you pick a number (floating point) between the minimum and maximum values
  • color
    a colour picker, nice

4) Additional Attributes

input required=true|false

this is a bonus – a really sensible and useful addition.

Summary

As you can see there are a host of nice new features. Some of the new tags you could start using now (largely they will be ignored by older browsers). Others will require browser tweaking to get them to work successfully. But I think all-round its a nice standard.

Joel

,

You can now host test servers and staging servers for free (1 per standard/enterprise license I think).  You need to have CF9 of course.

Terry Ryan has posted a blog about new licensing support. The problem with licenses, even when you are trying to be nice is that they are intentionally prescriptive.   he wrote in comments:

“In anycase, we don’t have Adobe police. The rules here are meant to enable you to have a proper environment, that is the spirit of those rules. We’re not going to hunt people down”.

I think that Adobe are being really nice about this – so kudos to them for that. Although it does start me thinking about what Adobe police would look like…

If you struggle with that there is always the brilliant Railo which has just jumped another point version in Alpha. The version Smarticles have running in production is lovely, lightning fast and stable. If I need a dev instance or 20 I can have them.  Love it.

, ,

I was going to try http://www.protoshare.com and http://www.axure.com as prototyping tools for Smarticles.

  • Has anyone else had any experience of them?
  • Alternatively, what do you use?

I find Visio a bit difficult to pass around and the output is not very good.

I would really appreciate anyone’s thoughts suggestions?

What I need:

  • Easy distribution to clients/developers/project managers
  • Easy to build prototypes
  • Preferably working (clickable) prototypes (ie.the function doesn’t have to happen)

Joel

,

Nov/09

10

Site Preflight Checklist

I was just putting together a list of things that should be done prior to launching a website. It only takes an hour to add them all, and it makes the world of difference.

Analytics

Make sure the site you launch has got analytics turned on. Worse-case you can change to another analytics provider. Careful if the site contains sensitive information.

Robots.txt

Put a robots.txt, even a blank one. Having a file existing is usually cheaper to webservers, than not having one. Especially if you have re-write rules. I have known sites to suffer from slow downs caused by robots.txt and favicon.ico’s

Favicon.ico

Put a favicon.ico file. It makes your site more professional and its much easier to see for through the forest of tabs. On big projects its nice to have different ones for dev, test and production.

Sitemap.xml

Add a sitemap.xml, use a generator, or automate it. I don’t mind. It just gets your content on google, yahoo, and alltheweb.com a million times faster. If your site doesn’t link to every page on the homepage then make sure you have a human sitemap too.

This inst an exhaustive list. The word of the day is Soporific so it looks like I have lost all my Smarticles this afternoon. What do you do add before go-live?

Joel

No tags

Find it!

Theme Design by devolux.org