Re: SQL query sorting problem

2009-01-26 Thread Chris Blackwell
DBMS is MySQL 5.  I have a report that is generated for cities within 
several states.  The states are designated by their two letter postal 
abbreviations and are in a certain order.  For example:

1. NY
2. CA
3. FL

I would like the records of the report sorted by the original state order, 
then by city name.  I can pull the data for the report in single query, 
but can't figure out how to maintain the state order.

Turning the state list above into a comma delimmited list (NY,CA,FL), my 
query looks something like:

SELECT *
FROM cities
WHERE state IN (cfqueryparam value=#states# list=yes)
ORDER BY state, city

Except that I lose the original order of the state list.

There are a number of workarounds, such as looping through the states and 
doing one query for each.  Or run the single query shown above and then in 
a similar manner loop through the states and do a QoQ for each.

Is there a way to do this in a single query?

You can do this in a very easy and elegant manner with MySQL. No need for join 
or nasty case statements

SELECT *
FROM cities
WHERE state IN (cfqueryparam value=#states# list=yes)
ORDER BY FIND_IN_SET(state, cfqueryparam value=#states#), city

NB. the second cfqueryparam is not a list, its just a comma seperated string 
like NY,CA,FL




~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;207172674;29440083;f

Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:318543
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfthread running condition?

2008-08-29 Thread Chris Blackwell
This should be pretty simple to achieve.  One of the restrictions with threads 
is that a cfthread can not spawn another cfthread.  So your going to need one 
scheduled task that runs at a suitable interval.  It will need to see if theres 
a thread running and if not, kick off the first thread.  The threads will need 
to report there current status somewhere the scheduled task can check - to a db 
or application scope.  When the scheduled task next runs it checks if the 
previous task completed and then starts the next thread.

Chris

Is there a way to make the start of one thread
conditional upon the ending of a previous thread?

I want to keep only one thread at a time running
and would like to set up a series of threads to run,
but only one at a time.

I've been doing this with scheduled tasks and emailing
completion to myself for verification of success each morning,
but running 54 schedule task templates currently, with having to add
another 30 or so soon has just become quite cumbersome.

Didn't know if there were any options.

Too bad we can't number the threads to run sequentially
and set them to run only individually.

Rick 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311780
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Here's an interesting little problem...

2008-08-26 Thread Chris Blackwell
i know i'm a little late to this party but...

SELECT `class`,
concat(left(`class`, 1),100-length(`class`)) AS `sort`
FROM myTable
ORDER BY `sort` ASC

will give you

AAA
AA
A
B
CC
C
D
etc 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311629
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Centering text written on an image

2008-08-22 Thread Chris Blackwell
 Hi,
 
 I want to add some text to an image but have it centered rather than 
 left justified. Does anyone know how to do that?
 
 Kevin Roche

http://imageutils.riaforge.org/ - getCenteredTextPosition()



~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311431
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Details on CF9's free for academic licensing?

2008-08-19 Thread Chris Blackwell
If you're after a free CF engine, why not use Open Blue Dragon.  It has 
everything you need to teach your students web programming.  They have a 
Ready2Run download which is preconfigured and only 20Mb.

http://www.openbluedragon.org/download.cfm

Advantage of this is your students can also use it at home or on their laptops 
with no licensing problems.  

Get them using the free CFeclipse IDE hopefully you'll get them hooked on CFML 
:) 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311238
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Developing cross-RDBMS CF apps, second in an irregular series of Eureka! moments

2008-08-19 Thread Chris Blackwell
There's also Reactor http://reactorframework.com/  Which would certainly clean 
up those functions.  All those case statement will make for some really big 
unweildy functions.

If you didn't want to use an ORM, you could break your queries out into 
seperate includes for each dbms.  This makes maintanence and adding support for 
other dbms's simple, it also cleans up your function so you can see whats going 
on

cffunction namegetFoo
  cfset var dbms = getDbmsTypeFromSomewhere() /
  cfquery name=qGetFoo datasource=whatever
cfinclude template=queries/#dbms#/qGetFoo.cfm /
  /cfquery
/cffunction 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:311239
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Free BlueDragon?

2008-08-14 Thread Chris Blackwell
 Thank you, Gerald, allow me to be lazy for a minute, cf8 
 comes with its own web server albeit it is for development 
 only, and it can be installed siliently (without user 
 interaction would probably be more accurate), and this 
 capability (of silent installation + a default web server) is 
 important to me.

This could be done fairly easy with almost any J2EE app server, and a bit of
shell scripting.

fwiw, i just wanted to point out that unless the software hes writing is 
distributed under a license that is compatible with the GPL then he can't 
bundle OpenBD with his software.  He would have to distribute the software 
seperately and then install it on OpenBD.  

The same is not true of Railo 3.1 which is LGPL and can be bundled with a 
commercial app as long as you don't modify the railo source code.


~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:310982
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: cfexecute batch file not working

2008-08-12 Thread Chris Blackwell
have you tried setting a timeout for the cfexecute 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;203748912;27390454;j

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:310900
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: expandPath() and mod_rewrite

2008-01-23 Thread Chris Blackwell
Add NS (No Sub requests) to the last rewrite rule should solve it

RewriteRule ^(.*)$ index.cfm?course=%{REQUEST_URI} [NS,QSA,L]

I've found an issue with mod_rewrite and expandPath() recently and  
I'm wondering if anyone has a solution.   It seems that Coldfusion  
uses Apache to pull the directory information with expandPath().   
This is the case on Linux (CentOS and SUSE 10), at least, since I  
can't duplicate the problem on my Mac.

For example, I have the following rewrite rules:

RewriteEngine on
#General Rewrites
RewriteRule ^$ index.cfm [QSA]
RewriteRule ^([^.]+)$ $1.htm [QSA]
#Escape if file or directory exists
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
#Redirect all other requests through index.cfm
RewriteRule ^(.*)$ index.cfm?course=%{REQUEST_URI} [QSA,L]

The the two RewriteCond rules escape the redirect when a file  or  
directory exists however when using cffile action write= where an  
expandPath is used to create the file path, Coldfusion returns the  
path redirect:index.cfm as the expanded path instead - since the  
file doesn't exist yet .

The workaround is to modify every path variable to two separate  
variables - one for the directory and one for the file name and then  
combine the two in the cffile tag:  Not a big deal, except that one  
of the apps is a decent sized app with a bunch of file operations  
being done  in legacy code (in different directories) where I keep  
running into this issue.

Any idea of a rewrite rule or workaround that will allow CF (and  
expandPath()) to do it's thing in peace while allowing all other  
rewrite rules to be processed?I've been digging into the  
mod_rewrite book and trying to tweak the existing rules with no success.

Thanks,
Jon 

~|
Adobe® ColdFusion® 8 software 8 is the most important and dramatic release to 
date
Get the Free Trial
http://ad.doubleclick.net/clk;160198600;22374440;w

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:297248
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


cfimport bug?

2006-11-11 Thread Chris Blackwell
I've been messing around with cfimport today and i've come accross a strange 
behaviour.

I created a custom tag

/mytagdir/test.cfm -
cfoutput#getbasetaglist()#/cfoutput

And then called it in two slightly different ways

cfimport taglib=/mytagdir/ prefix=mytag
mytag:test
br /
cfimport taglib=/mytagdir/
test

which results in two different strings
CFOUTPUT,CF_TEST,CFINCLUDE 
CFOUTPUT,CFTEST,CFINCLUDE 

Any thoughts..? should they not both return CF_TEST?

I'm running MX7.01  RH7.3

Cheers

~|
Introducing the Fusion Authority Quarterly Update. 80 pages of hard-hitting,
up-to-date ColdFusion information by your peers, delivered to your door four 
times a year.
http://www.fusionauthority.com/quarterly

Archive: 
http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:260016
Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4