Click to search Andy Jarrett.co.uk RSS feed

Loading Twitter

OO Nearly Destroyed A Business?

There is an excellent, albeit long, post by Marc Funaro entitled "How OO Almost Destroyed My Business"

In short, the article describes how going to the effort of applying Java OO rules to CF's dynamic behavior on every project can take you away from your main goal.

I do agree with some of the points made but I think there is something everyone has got to remember. OO is a must for some languages, but when it comes to ColdFusion you're allowed to make a choice on your coding style for the application you are building. If you come from an OO background and you want your recordset as an object do it, use Transfer or another ORM and apply it. If you just want to organise your logic away from your views you can use CFC's to simply handle that. If you are building a 3 page leaflet site then you can throw one together using procedural code with <cfmodule> to wrap a layout around 3 .cfm pages. Thats the beauty of CF and it always will be.

From my point of view when building an application my goal is plain, make sure the client get a solid app and to do this it's simple: organise your code, stick to a particular methodology or framework, and remain consistent. If you do this you will always be able to revisit your application and make changes quickly and efficiently regardless of your coding style.

With all that said, always find out what the next guy is learning/teaching and give it a try. But after that don't be afraid to say it doesn't fit what I am working on currently so I'm moving on.

Comments Comments (2) | Print Print | Send Send | 238 Views

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

Comments Comments (0) | Print Print | Send Send | 1263 Views

Another Linux Railo MySQL install guide (no Apache)

This was meant to be a guide about setting up your server with Linux, Railo, Apache, and MySQL but I've dropped Apache. Why? Well its an overhead I don't need. Resin functions perfectly well as a HTTP server and it does all I need. Why add another bit of software to fail? .... simplify :) In the long run I might change but for now I'd rather save the resources.

So ... where did this guide come from considering there are quite a few guides for this setup? Well for one reason or another I just didn't get on with them and by the end something went wrong which was mainly because I am Mac boy more than a Linux guy and sometimes I just missed the points here and there. The aim of my guide is to be clear and simple. So with a fresh Ubuntu install i'm planning on gettingt Railo running via Resin so I can call http://www.mysite.com/index.cfm

I won't lie, to make this post I have "borrowed" from other sources out there which I will try and link to at the end.

Im running Ubuntu 8.10 (Intrepid) without a graphical interface.

Note: If you are doing this on a clean, new server then before you even read on check out Slicehost.com documentation about setting up a Ubuntu server. These guides are the best and clearest I've seen online to date and cover everything you need!!!!

  1. http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-1
  2. http://articles.slicehost.com/2008/11/28/ubuntu-intrepid-setup-page-2

On to Railo

[More]

Comments Comments (3) | Print Print | Send Send | 2778 Views

Setting up Apache and Subversion on JeOS (Ubuntu)

I'll be honest, I don't have much linux experience. I've always liked the idea of Linux and a command line driven OS but as soon as I see the GUI I tend point and click, which means I don't learn anything new. Then comes along JeOS (Just enough OS, pronounced as "juice") from Ubuntu which doesn't give you a GUI, it just gives you the bare minimum to run a server. It's designed for VM's and perfect for running a Subversion server on your local machine in the background. The specs are:

  • Less than 100Mb ISO image
  • Less than 300Mb installed footprint
  • Specialised -virtual Kernel 2.6.24
  • Optimised for VMWare ESX, VMWare Server and KVM
  • Intel or AMD x86 architecture
  • Minimum memory 128M
  • No graphical environment preloaded as it is aimed at server virtual appliance

So with JeOS and VMWare Fusion armed I was ready to setup a light-weight Subversion and Apache server. Below documents what I did to get a single SVN repository up and running. Im not installing Trac or SSL with this just so you know. I might try and cover them later, along with multiple repositories.

Setting up JeOS with VMWare fusion is no different than setting up any other VM so I won't go over that here. I'll assume that you can do that, and have done that and now at the command prompt.

Obviously because there is no GUI supplied all commands have to be run from the Command Line/Terminal. This also means editing txt files from the terminal too. If you've never used VIMM you might want to have the following URL handy www.gnulamp.com/vi.html

First things first, lets make sure your install is up-to-date.

view plain print about
1$ sudo apt-get update

[More]

Comments Comments (4) | Print Print | Send Send | 4841 Views

Passing Application scoped variables to ColdSpring within Model Glue

Passing defaultProperties in ColdSpring with Model Glue

Or Using defaultProperties with CS and MG. I couldn't figure out which title would be better.

Basically this is a guide on how to pass variables into ColdSpring. In my case from the Application scope. Recently I've been working on a Model Glue, Transfer, and ColdSpring app and came across a problem which I couldn't find a direct answer to online. The application I'm working is only a small part of the site and has some settings in the Application scope which needs to remain there. Usually I put all my variables in a ColdSpring/Model Glue simpleConfig Bean (using the class ModelGlue.Bean.CommonBeans.SimpleConfig) but this time I needed CS to get the variables from the application scope. This actually isn't too hard as you can pass properties(dynamic variables) into the config.xml e.g.

Here's the code for creating the bean factory. You would find this in onApplicationStart or at the top of your Application.cfm.

Code for Application.cfm/cfc

view plain print about
1<!-- First we create our global vars in the Application scope -->
2<cfset application.settings = structNew() />
3<!-- Add our DSN name to the Settings struct -->
4<cfset application.settings.dsn = "myDSN" />
5<!-- If our bean factory doesn't exist then we create it. You could also check for a url.reinit var as well here -->
6<cfif NOT isDefined("application.beanFactory")>
7    <!-- Our struct to hold the variables we are going to pass to ColdSpring -->
8    <cfset properties = structNew() />
9    <!-- Our struct to hold the variables we are going to pass to ColdSpring -->
10    <cfset properties.dsn = "dsn_reference">
11    <!-- Create our bean object -->    
12    <cfset application.beanFactory = createObject("component","coldspring.beans.DefaultXmlBeanFactory").init(structNew(), properties)/>
13    <!-- Pass a fully qualified path to a bean definition xml file -->
14    <cfset application.beanFactory.loadBeansFromXmlFile(expandPath('/config/beans.xml'), true)/>
15</cfif>

In our Beans.xml we need to reference the properties structure by the key.

[More]

Comments Comments (0) | Print Print | Send Send | 3587 Views

Transfer and TQL

I love working with Transfer and Mark Mandel has done an amazing feat of giving it some really good documentation. But I remember when I was getting started I was looking for a rough guide to the TQL language for Transfer and how to implement it. So based on all the information at www.transfer-orm.com/transfer/documentation/ here's a quick start to TQL.

Please note: I am presuming you already know how to set up Transfer and have basic knowledge of how it works.

For this example here is our Transfer.xml configuration file:

view plain print about
1<package name="post">
2    <object name="Post" table="post_table">
3        <id name="postid" column="postid" type="numeric"/>
4        <property name="postText" type="string" column="postText" />
5        <property name="postDate" type="date" column="postDate" />
6    </object>
7</package>

[More]

Comments Comments (2) | Print Print | Send Send | 2911 Views

Adding a property to BlogCFC

The other title was, How I added the FeedBurer URL to BlogCFC - imagine whatever your prefer :o)
If you haven't heard Feedburner has recently been acquired by Google. Which as it seems with all Google acquisitions means us users end up getting something free out of it and to with keep up traditions Feedburner now offer their "Pro" services for free.

[More]

Comments Comments (2) | Print Print | Send Send | 3624 Views

Ant: Passing attributes to Build.xml

Critter on a previous post asked "if you can pass in attributes to the build.xml file?" From the Terminal this is as easy as adding another argument "-D".

[More]

Comments Comments (3) | Print Print | Send Send | 5633 Views

Installing ANT on Windows and or Mac OS X

I'm gonna try and cover the two OS's here so be kind.

First things first, goto http://ant.apache.org/bindownload.cgi and download the appropriate archive (zip) file: apache-ant-[VERSION NUMBER HERE]-bin.zip

[More]

Comments Comments (15) | Print Print | Send Send | 9286 Views

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]

Comments Comments (4) | Print Print | Send Send | 21444 Views

Ant: Moving files and directories

First off I wanna say that I'm running all my Ant task 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.

So, what is Ant? Well to steal a quote from Mark Drew, think of Ant as .bat files on steroids. You use XML to describe a set of commands to run a whole range of tasks to do anything from SVN/CVS checkouts, unit tests, FTP, emails, sql, moving/copying folders/files generally just name it!

In this guide I want to cover creating a build.xml file and moving files/folders. 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.

[More]

Comments Comments (1) | Print Print | Send Send | 9265 Views

Building and installing Apache 2 on a Mac

Ok Below is a rough guide to get anyone up and going when it comes to building and installing Apache 2 from source. We're gonna do this all from the Terminal found in /Applications/Utilities/Termain.app.

Please note that '$' means new line, don't type this character If you want to know about any of the commands we make from the terminal you can always type "man + command" e.g.

view plain print about
1$ man curl
If you run the above code it should tell you that
curl is a tool to transfer data from or to a server, using one of the supported protocols (HTTP, HTTPS, FTP, FTPS, GOPHER, DICT, TELNET, LDAP or FILE). The command is designed to work without user interaction.

This will also detail the options I use.

[More]

Comments Comments (7) | Print Print | Send Send | 4842 Views

CFUnit and CFEclipse

I did mention back in January that the CFUNIT disappeared from the then current CFEclipse build. Well its back with 1.3. This also means the guide I wrote a while back is now valid again: Running CFUnit in CFEclipse quick guide. I also know it is still works as I've found myself going over my own post :o) Time to start back on those test cases.

Also included in the 1.3 update is the CF Frameworks Explorer and don't forget to check out the intro to this feature on CFE T.V.

Comments Comments (1) | Print Print | Send Send | 2904 Views

Maintaining your laptop battery Life

The other day I noticed my current battery capacity was around 65%, which for a MBP under a year old I was a little annoyed at. According to iStat Nano, a [excellent] system monitor widget and confirmed with Coconut Battery the maximum battery charge I could currently hold would be around 3500mAh instead of the factory default of 5500mAh.

After a quick search on the Apple site I have managed to bump it back up into the 90% region. How? Easy, I Calibrated the battery, something you should do every 2 months or so!.

[More]

Comments Comments (8) | Print Print | Send Send | 5301 Views

RegEx word boundaries

Recently I was looking for the word "fail" or "pass" in a string so I had the following regEx set up:

view plain print about
1#reFindNoCase("pass|fail", status)#

Which worked fine until testing came along and "failed" got passed through successfully.

To prevent this you need to use regex boundaries, "\b", so my new statement becomes:

view plain print about
1#reFindNoCase("\bpass\b|\bfail\b", status)#

In simple terms "\b" perform a "whole word only" search means that it trapped 'failed', 'failure' you get the point.

Comments Comments (3) | Print Print | Send Send | 3638 Views

The Rough Guides

In case no one has noticed I am kind of starting a Rough Guide Series. These guides are made the way I like guides to be. They don't go in-depth and throw everything at you! They just do enough to get you up and walking and give you an understanding of the topic. For example the ColdSpring series were done with this in mind. I just wanted to help get the idea to finally click and see what it is good for. They seemed to of done well from looking at the views and they even got a mention in the CFWeekly(cheers guys, keep up the good work!). Along with this I will also offer links/resources to carry on where I leave off.

What will I be covering next.

[More]

Comments Comments (1) | Print Print | Send Send | 2391 Views

Going beyond Eclipse's local file compare/replace

Originally I wanted to title this "Last night Eclipse saved my life" but decided that didn't really explain this mini guide all to well.

First off, if you are not on Eclipse than you probably don't know about two great features, "Compare with local history", and "Replace with local history". In brief, Eclipse saves all previous version of your file(s) you are working on. So with a simple click you can "Compare"/"Replace" your current version of a document to the original one you started working on 2 days ago! Think of it as a mini source control without the checking in.out. If you want to know more about these features go to Robert Blackburn write up in Fusion Authority.

What does "Going beyond Eclipse's local file compare/replace" mean then?

[More]

Comments Comments (1) | Print Print | Send Send | 5207 Views

Running CFUnit in CFEclipse quick guide

As you might of heard CFUnit is now integrated into the beta build of CFEclipse. To bring you up-to-speed about CFUnit(incase you didn't know); CFUnit is a unit testing framework for ColdFusion, modelled after the popular JUnit framework. By building test units while creating your app you can ensure that your methods (cffunctions) and components overall behave as expected. If you are totally new to CFUnit you might want to check out the references at the end of this post.

So who is this guide for. Well nearly anyone who wants to get started with CFUnit within CFEclipse. For reference I am working on Eclipse 3.2.1 with CFEclipse 1.3 Beta RC2 1.2.9.7 and im gonna assume you've got both on your sytem. This guide doesn't really go into all the benefits of CFUnit (though by the end of this you should be able to seem them) so if you want more details afterwards check out the points of reference at the end.

[More]

Comments Comments (12) | Print Print | Send Send | 15851 Views

Multi-lingual site with Model-Glue and Coldspring

Now and then through my work I get asked to create a site with multi-lingual support. In the past I have usually just created a custom tag or UDF. This time, now that I am on A href="http://model-glue.com/">Model Glue: Unity I wanted something that was a little more integrated so I decided to use Ray Camden modified ResourceBundle.cfc. This cfc was actually created by Paul Hastings and you can find more information here.

There are two reasons I am posting this mini guide, first to share and the second is that knowing me I am probably doing something inefficient and by letting the community see it hopefully someone will point out any errors or an easier way to do things :o)

[More]

Comments Comments (2) | Print Print | Send Send | 4457 Views

ColdSpring and Dependency Injection for the beginner part 3: Setter Injection.

Onto part 3 of this rough beginners tutorial. By now you should of read part 1 and part 2 and this is the final part of me explaining Dependency Injection. This doesn't mean that come the end of this post you'll now know everything. But you'll know the basics, and be able to walk away and understand a little more of how and where to use ColdSpring.

To go back a little as since my first post there has been for my American readers a national holiday - Deep Fried Turkey day or Thanksgiving as it is better known (sorry I had to mention the deep fried [whole]turkey, I don't know if it because I'm British, but it just seems wrong!). Back to the code.....todays topic is is Setter Injection and to recap from the ColdSpring site;

<property name="propertyName" />
Similar in nature to constructor arg, however in this case ColdSpring will pass some value or object reference into your bean as an argument to a setter method, identified via the name attribute. Thus, your CFC must have a setter method name that matches the property tag's name attribute (for example if your property is named "foo" then your CFC needs a setFoo() method).

[More]

Comments Comments (0) | Print Print | Send Send | 5318 Views

More Entries

BlogCFC by Raymond Camden + Twitter @AndyJ + ColdFusion jobs + Contact Me + Snippets/Downloads + RSS .