Entries for month: October 2010

Using <cfexecute/> with Windows Batch Files

ColdFusion , Windows , Gotchas 3 Comments »

Recently I wrote some batch files to complement some scheduled tasks I was developing to help with automating some processes that were being carried out manually by system administrators on applications deployed in a Microsoft Windows environment.

In doing so I came across a number of minor issues that I had to figure out, so I thought I'd share them here for anyone else who's ever required to do anything similar.

I was calling the batch file using the <cfexecute /> tag and passing some arguments to keep the script cohesive enough that its functionality could be used on other servers.

The code final code I used is below but I have discussed the important parts that I had left out.

<cftry>
    <cfscript>
        args = [1];
        args[1] = "argument1Value";
        args[2] = "argument2Value";
        args[3] = "argument3Value";
    </cfscript>
    <cfexecute variable="batchScriptOutput" 
	              name="#APPLICATION.BATCH_SCRIPT_DIRECTORY#\#APPLICATION.NAME_OF_SCRIPT#" 
				  arguments="#args#" 
				  timeout="99999" 
				  errorVariable="batchScriptError" 
	/>
    <cfoutput>
         SCRIPT OUTPUT:<br />#batchScriptOutput#<br />
         ERRORS:<br />#batchScriptError#<br />
    </cfoutput>
	<cfcatch>                
	    <cfrethrow />        
	</cfcatch>
</cftry>

The issues I had were that:

  • I wanted to pass argument values that had spaces in them
  • I wanted to see the output generated by the batch file

Neither of this seemed possible without formatting the code as I have above.  If a "timeout" value wasn't set, I didn't get the output returned and it just seemed simpler to pass the arguments as an array.

If anyone has had any similar experiences or better methods of implementation, I would like to hear your thoughts.

Bookmark and Share

Installing CouchDB on Windows (Quick Guide)

Apache CouchDB , Javascript 7 Comments »

Apache CouchDB

Seeing as everyone else out there except me (and a few others) uses a Mac, I thought I'd write this short post regarding installing CouchDB on Windows and how to access the Futon Administration console.

Apache CouchDB is a document-oriented database that can be queried and indexed in a MapReduce fashion using JavaScript. CouchDB also offers incremental replication with bi-directional conflict detection and resolution.

As promised, the quick and dirty way to install CouchDB on windows is as follows:

  1. Click here to visit the Wiki and download the installer.  At the time of writing the latest installer was v1.0.1
  2. When downloaded, run the installer as an "Administrator" and follow the on-screen instructions.
  3. To install couchDB as a Windows Service, leave the default selections as it's automatically configured to do so.
  4. Once the installation is complete, for the default installation options, the service "Apache couchDB" should be running under the local system account.
    1. If, after installation you are experiencing permissions issues, see here.
  5. Open a modern web browser, in otherwords Firefox (this is also the recommended browser to use).
  6. Navigate to: http://127.0.0.1:5984
    1. You should see the following text: {"couchdb":"Welcome","version":"1.0.1"}
  7. To access Futon (Administration console) Navigate to: http://127.0.0.1:5984/_utils
  8. That's It !!

Told you it was a quick guide ;-)

I will be exploring couchDB further in the near future and will post my experiences here for anyone else who is interested.

In particular, I'll be looking at:

 

Bookmark and Share

Quick and Dirty UML with yUML

Best Practices , Online Resources , UML No Comments »

"A picture says a thousand words"

I have always been a big fan of modelling / diagramming a business' domain model and processes when desiging an application.  Not always wanting to jump straight onto a computer - I was a big fan of the old school pencil and paper for drawing out \ diagramming these as I found it helped me a) Get a better understanding of what I had to develop, the objects I had to create and their relationships and b) Helped identify any ambiguities or issues that may occur before and during development.

In the earlier days I would have jumped straight into my database management tool and started designing and developing my database tables.  Then Hal Helms taught me that the database should only exist to persist the data in your objects, and I agreed and therefore started taking a different approach to how I started out with an applications design.

I started getting into UML (Unified Modelling Language) and BPMN (Business Process Model Notation) which standardised what I was doing with regards to designing my application and helping convey what we were \ are trying to acomplish to others.

In doing so I came across a couple of useful tools that helped out along the way and one in particular I felt was worth mentioning.

That's where yUML comes in...

Read more...

Flex and the City - for FREE!

Adobe Events , Conferences , Flash , Flash Builder , Flex No Comments »

Flex and the City

 

 

 

 

 

 

Just helping the organisers out with this one...

If you haven't done already and may be interested in Adobe Flex or are already using Flex, there is a FREE One Day Event called "Flex and the City" next Wednesday 20th October.

Website: http://www.flashcamp.co.uk/flexandthecity

Registration: http://flexandthecity.eventbrite.com/

Twitter Hashtag: fatcuk

Event: Flex and the City

Date: Wednesday, October 20, 2010 from 12:00 PM - 10:30 PM (GMT)

Location:
Barbican Centre
Silk Street
EC2Y 8DS London
United Kingdom

For more information click here: Flex and the City

Hopefully see you there!

 

 

Bookmark and Share

<cfdump /> for JavaScript

Javascript No Comments »

Thought I'd clear the cobwebs off the blog and start getting some of these posts I wanted to post online!!

OK, This has been around for a while and if you're not already using Firebug then the following links might come in useful.

In order of _my_ preference check out these utilities for inspecting JS Variables \ Objects.

  • http://www.netgrow.com.au/files/javascript_dump.cfm
  • http://flesler.blogspot.com/2008/05/jsdump-pretty-dump-of-any-javascript.html
  • Alternatively ColdFusion can also provide debug-level messages in the log window, details here:
    • http://livedocs.adobe.com/coldfusion/8/htmldocs/help.html?content=JavaScriptFcns_21.html

If there are any others you know of, feel free to add the to this list.

Bookmark and Share
Powered by Mango Blog. Design and Icons by N.Design Studio
RSS Feeds