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

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.

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

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]

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 plainprintabout
 $ sudo apt-get update

[More]

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 plainprintabout
 <!-- First we create our global vars in the Application scope -->
 <cfset application.settings = structNew() />
 <!-- Add our DSN name to the Settings struct -->
 <cfset application.settings.dsn = "myDSN" />
 <!-- If our bean factory doesn't exist then we create it. You could also check for a url.reinit var as well here -->
 <cfif NOT isDefined("application.beanFactory")>
     <!-- Our struct to hold the variables we are going to pass to ColdSpring -->
     <cfset properties = structNew() />
     <!-- 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]

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 plainprintabout
 <package name="post">
     <object name="Post" table="post_table">
         <id name="postid" column="postid" type="numeric"/>
         <property name="postText" type="string" column="postText" />
         <property name="postDate" type="date" column="postDate" />
     </object>
 </package>

[More]

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]

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]

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]

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