Post from November, 2007

Coldfusion Query with index

Wednesday, 28. November 2007 0:07

I would love to be proved wrong by one of the ColdFusion gurus, but I had a real problem with this earlier today. Basically I needed to loop through a query, but I wanted to stop just before the last iteration. I wanted to write a dynamic SQL statement that stopped adding ‘AND’ before the last step. Here’s what I came up with

<cffunction name="blah"><cfset index = 0>

<cfquery name="query1" datasource="datasource">

select id

from table

</cfquery>

<cfquery name="query2" datasource="datasource">

select id2

from table2

where <cfloop query="query1">

id != #query1.ID#

 <cfset index = index +1>

<cfif index neq query1.recordCount>

AND

</cfif>

</cfloop>

</cfquery>

</cffunction>

This little bit of code adds ‘AND’ after ever iteration of the loop except the last. I’m sure there’s either a better way to do this, or that this is obvious, but hey – it worked!

Category:Coldfusion Codesnips | Comment (0) | Author: admin

Flex Gotcha 1 – where have my code hints and colouring gone?

Tuesday, 27. November 2007 23:46

Ok not really basic web development but this is a gotcha that has really wound me up with Flex Builder 3 beta.  I’m not sure if this happens with other versions of Flex Builder.

Here’s the scenario (or at least the one I had).

You’re working on two machines, one at the office the other a laptop, or somewhere else.  You copy a file from one to the other and go to Flex Builder to work on it.  You’ve lost your code hints and colouring.  Hmm.  Not the end of the world, but if you’re like me the code hinting is one of the most important things about using Flex Builder (or Eclipse), you may as well be working in Wordpad.  OK.  Maybe it doesn’t like the file.  I know I’ll save the file as another name, delete the file I’ve got problems with and then rename the new file back to the original anme.  That should sort out the problem.  Nope.  When the file has it’s new name all the code hints work, change it to the filename you want, boom all the code hints are lost again.

If I was really clever I’d be able to tell you why.  I’m not, so I don’t know.  But I do know a work around, and the scenario why this happens (at least for me).

Basically this happens to files that are open int the Flex Builder workspace, EVEN IF FLEX BUILDER IS NOT RUNNING.  So for example you have a file called foo.mxml open in Flex Builder.  Close Flex Builder without closing the file.  Overwrite foo.mxml with another mxml file.  Open Flex Builder, no code hints or colouring on the new foo.mxml file.

Workaround – close all open files in Flex Builder.  Close Flex Builder.  Overwrite file again.  Open Flex Builder.  Open foo.mxml.  Code hinting and colouring back.  Yay! And there was great rejoicing.

Not earth shattering, just stopped me throwing my toys out the pram.

tim

Category:Flex Builder | Comments (1) | Author: admin

New Blog

Tuesday, 27. November 2007 23:29

Haha!  I’m here in the blogosphere now!

My aim with this blog is to put stuff up – NO MATTER HOW BASIC – the big problem I had when I first started was the simple stuff, and getting info about that.  So that’s what this blog is all about the simple, stupid, down to earth stuff about web development.   And as I’ve got a few things to put in I guess the first few days will bit a bit choka with things.  Anyway have fun, if one thing I put up here helps someone, that’s a result. (Actually if someone reads it who I don’t know that’s a result – aim low, be happy, that’s my motto)

Tim

Disclaimer : Blog may contain stuff that isn’t stupid or down to earth.

Category:Uncategorized | Comment (0) | Author: admin