Home | Blog | Twitter @AndyJ | Contact Me | Snippets/Downloads | RSS

FW/1 and redirect in the application.cfc

Chatting with AJ Mercer this morning (his evening) on getting redirect() to work in the Application.cfc for Framework One (FW/1). The code being he was using looked perfectly fine:

   view plainprintabout
 rc.variableToPass = "me";
 redirect(variables.framework.home, 'all', 'variableToPass');

As I said this looked fine and works in the controllers but in the Application.cfc we just saw "&fw1pk=[some number]" appended to the URL. The fix was quite simple. The variable/structure RC is set as a shortcut to the Request.Context for the controllers but in the Application.cfc you need to reference Request.Context directly. The meant the above code changed to:

   view plainprintabout
 request.context.variableToPass = "me";
 redirect(variables.framework.home, 'all', 'variableToPass');

and all worked fine.

As a side note the fix for this came from it being such a simple framework to hack in to and see whats happening over others with multiple core files and components. Recently my work ethics has changed a lot and in its place 2 components now stand, convention over configuration and simplicity both of which FW/1 fits the bill. So if you haven't spent 30 minutes looking at it do so and also check out the Google group at http://groups.google.com/group/framework-one

CFEclipe 1.3.6 bug fix release

CFEclipse has released version 1.3.6 earlier. All bug fixes no new features on the 1.3.5 release. You can read more at http://www.cfeclipse.org/update/web/doc/intro/doc/new.html

Using RegEx to cut down on code

I sometimes forget how useful/powerful RegEx can be. Take the following bit of CFIF logic

[sourcecode language="plain"] <cfset username = trim(form.uname) /> <cfif len(username) LT 4> <cfset errorMsg = "Your username is too short" /> <cfelseif NOT reFindNoCase("[\w]", username, 1, "false")> <cfset errorMsg = "Your username is too short" /> </cfif> [/sourcecode]

A quick regex guide: the "\w" reference stands for "word character", which translates to [A-Za-z0-9_] n.b.the underscore as well

You can actually add on to the regex and at the same time cut down a lot of the logic by doing the following:

[sourcecode language="plain" gutter="true" toolbar="true" wraplines="true"] <cfif NOT refindnocase("[\w]{4,}", username, 1, "false")> <cfset errorMsg = "Usernames must be 4 characters in length and contain [A-Za-z 0-9 _" /> </cfif> [/sourcecode]

The key is "{4,}". Using the curly braces to specify a specific amount of repetition of "word characters" and is equivilant to "len(username) LT 4"

CFEclipse 1.3.4 released

With the annual release of Eclipse Galileo the CFEclipse team have pushed out its latest release of CFEclipse 1.3.4!.

This update brings compatibility with Eclipse 3.4 and Eclipse 3.5 along with:

  • An updated CF8 Dictionary
  • Some mild updates to the parser
  • Mark occurrences of selected words (tag/variable/method/etc)
  • Integration with Eclipse's DocShare (optional)
  • Preference for modifying the browse url on unit tests to run unit tests
Thats just the tip of the iceberg though, check out the full list here

Available from the update site get it now http://www.cfeclipse.org/update

My blog has moved

Please update your bookmarks and feeds for my site.

I now have a Mango Blog at:

http://www.andyjarrett.com/blog

Feed URL: http://feeds.feedburner.com/andyjarrett

CFEclipse and Adobe CF Extensions in one download

In the first part of this 2 parter I mentioned the differences between the 2 ColdFusion plugins for Eclipse that are out there. Here I have put them into one zip file for you to download and install, it really couldn't be easier to check out the CF environment "everyone is using"*

Update: After a quick read of the EULA from Adobe, it appears that I was being a little naughty by bundling them together. Hence the quick removal/update of the original post (anyone who got here first was lucky). That doesn't mean that you still can't have a cracking CF dev environment. The zip I produced was files taken from 2 sources: Eclipse 3.3 and the ColdFusion Extensions for Eclipse and the CFEclipse download section of the site.

[More]

Difference between CFEclipse and CF Extensions

This post is in two parts as I realised it's probably not good to bombard you with one longgggg post. The second part (which is the reason this post even exists) is about a new zip file that I have put together so you can download CFEclipse and Adobe CF Extensions in one go. This post first off covers the difference between them so you know what you are getting and why you want it;

Incase you don't know the CF Extensions are very different to the CFEclipse plugin for Eclipse but both are essential for your CF development environment.

[More]

Eclipse local help system

Update: This appears to be on a different port for others. As Jax pointed out you can go: Eclipse, select Help -> Help contents to get there as well :o)

I was just going into some help files of Aptana when I came across the local address for the Eclipse Help system at: http://127.0.0.1:58041/help/index.jsp

In there was a wealth of information I just didn't know was on my hard drive ... though I suppose it depends on what plug-in's you've got installed but for me I had:

[More]

Update CFEclipse mailing lists

Mark Drew has posted a list of the updated and current CFEclipse mailing lists.

He does mention that anyone who is still on the Tigris lists needs to unsubscribe as they will soon be deleted.

Ant: Copying files and directories

I know that I've done a post on copying files with Ant, but I really want to take this further and into more detail. To save my fingers a lot of the text below is taken from my first post as moving and copying directories/files is a similar command in principle.

I also want to mention that I am running all my Ant tasks via Eclipse and not the command line. If there is a demand to know how to install Ant and run it from the command line I'll do that post separately. At this point I'm assuming you've got Eclipse and you know you way around it enough? Before we do begin you will need to ensure that you can see the Console 'View', you can get to this by going to:

[More]

More Entries

BlogCFC / created by Raymond Camden / running version 5.9.5.003 / Contact AndyJarrett.com / Pet Rescue SOS www.redgiraffes.co.uk