Re: scopes

2009-03-25 Thread Seb Duggan

If I ever need to do this, I just use:

cfset FORM = URL /

You don't need to duplicate the Struct, as you're not going to have  
any problems with the original URL data changing throughout the  
lifetime of the page.


Seb

On 25 Mar 2009, at 16:17, Adrian Lynch wrote:


 I'm not sure if you're saying it works or doesn't work. If it  
 doesn't, try
 FORM.putAll(URL) or StructAppend(FORM, URL) to get the URL vars into  
 the
 FORM scope.

 Adrian

 -Original Message-
 From: Brian Dumbledore [mailto:psteja2...@yahoo.com]
 Sent: 25 March 2009 16:31
 To: cf-talk
 Subject: scopes


 ok I was trying something and did this:

 cfif isdefined(url.username)
 cfset form = duplicate(url)
 /cfif

 And then I go about the rest as if the request came from a form  
 post (I
 use form dot notation everywhere afterwards).

 When I did a cfdump var=#form# it doesn't recognize the form scope,
 but this works

 cfdump var=#variables.form#

 But every where else in the code it works fine (recorgnizes all form
 dot names that were originally sent as url parameters)
 So is cf not supposed to handle the dump 'logically'? Can someone
 please reason this behavior?



~|
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:320943
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: What the heck is happening during CFQUERY?

2009-03-09 Thread Seb Duggan

Yeah, but what are you going to do with 300,000 actual records in a  
single recordset?

In his original post, Claude never specified what the requirements of  
his CFQUERY were - if we knew what he was trying to achieve, we could  
provide better advice on how to do it...


On 9 Mar 2009, at 13:44, Billy Cox wrote:


 That doesn't work because getArmes contains only a count of the  
 records in
 armesArmoriaux, not the actual records.

 -Original Message-
 From: Al Musella, DPM [mailto:muse...@virtualtrials.com]
 Sent: Sunday, March 08, 2009 7:37 PM
 To: cf-talk
 Subject: Re: What the heck is happening during CFQUERY?




~|
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:320260
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: What the heck is happening during CFQUERY?

2009-03-09 Thread Seb Duggan

What we are really talking about here is having the right tool for the  
job.

dBase, Clipper and FoxPro are all database management systems, and so  
are designed to work efficiently in examples like the one you are  
citing.

ColdFusion is a Web Application server, designed to interact with a  
database to deliver web content. By the very nature of Web  
applications, you wouldn't want to be leaving open database  
connections all over the place - the surest way to crash a server  
under heavy load...

Really, all the heavy lifting should be done within the database  
itself; but out of preference I don't think I'd be using Acces for this!

However, you can do what you want using ColdFusion; I've done similar  
stuff in the past when the updating has required extra ColdFusion  
logic. I would just recommend doing it in chunks of data - maybe 5000  
records at a time? Grab the first 5000 records; process them; then do  
the next 5000...


 I don't think this is unexpected behaviour

 It is not only unexpected, it is completely retarded.
 All ODBC/JDBC functions are designed so the database can be connected,
 then the SQL statement be compiled, then data retrieved row by row, as
 needed. Even dBase, Clipper, Foxpro worked this way.


~|
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:320282
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


phpBB to Galleon migration?

2009-03-08 Thread Seb Duggan

Has anyone ever carried out a successful migration from phpBB to  
Galleon (or even any other CF-based forum)?

After wasting nearly a whole Sunday trying to get PHP installed and  
running on a new web server (just to transfer across an existing phpBB  
forum), I've really had enough of PHP (although it's working now.)

I'd really like to move to a CFML-based forum, but my client has a  
fairly sizeable archive of posts (recently passed 300,000), so  
retaining all these is essential.

[Who knew there was that much to say about making cards and parchment  
craft...]


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com



~|
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:320231
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: What the heck is happening during CFQUERY?

2009-03-08 Thread Seb Duggan

The CFQUERY connects to the database, returns the whole of the  
resulting query result into the specified variable, then closes the  
connection; the variable is held in memory for the lifetime of the  
request.

So, if you run a query that, as in this case, returns more than  
300,000 records, there is going to be a significant overhead as the  
data is read out of the database and into ColdFusion. Especially if  
one of those fields is a memo field.

I don't think this is unexpected behaviour - you just need to examine  
what you actually require from the query, and tailor your SQL to that.  
It is highly unlikely that you actually need to work with 300,000  
records at one time...


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 8 Mar 2009, at 22:42, Claude Schneegans wrote:


 Hi,

 I've always thought that all what CFQUERY was doing was to create some
 connection to the database, and then the actual content of all records
 would be read as needed during some loop on the result set.

 I have this statement on some Access database :
 CFQUERY NAME=getArmes DATASOURCE=Armoriaux
  SELECT armeId, armTexte
  FROM armesArmoriaux
 /CFQUERY
 CFOUTPUTgetArmes.recordCount = #getArmes.recordCount#BR
 cfquery.ExecutionTime = #cfquery.ExecutionTime#BR/ 
 CFOUTPUTCFABORT

 The query semms to take for ever. Actually, the output says:
 getArmes.recordCount = 303203
 cfquery.ExecutionTime = 614469

 More than 10 min. just to settle a result set? That does not make  
 sense.
 Ok, armTexte is a memo field, but is CFQUERY supposed to read all of  
 them?

 If I run the same query directly from Access, it runs so fast, I  
 cannot
 even measure the time it takes.

 So, what the heck CF is doing within CFQUERY? Read all content? That
 does not make sense.
 Is the problem with CF, or the ODBC driver?

 

~|
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:320241
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: FireFox getElementById issue?

2009-02-16 Thread Seb Duggan

First up, script = Javascript1.2 is meaningless... Should be  
script language=Javascript1.2 or, better: script type=text/ 
javascript.


Your main problem, however, is that

   var list = document.getElementById(MemberName).value;

..is also wrong. You're trying to access the select item, not its  
value (which doesn't actually exist), at this point. So:

   var list = document.getElementById(MemberName);

Your list then has an array of options, and the rest of the code  
should work fine.


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 16 Feb 2009, at 16:44, Austin Band wrote:


 Hello, I need a little help. I have javascript that works with IE  
 but not FireFox.

 The code:

 script = Javascript1.2
 function addItemsToParent(){
 var MemberList= ;
 var list = document.getElementById(MemberName).value;
 for(var i=0; ilist.options.length; ++i)
   if(list.options[i].selected){
   MemberList = MemberList + ,+list.options[i].value;
   }
   opener.document.MemberName.value = MemberList;
   self.close();
   }
 /script

 The error returned in Error Console is that the list is null. This  
 works correctly in IE. The goal is to select a name and it displays  
 in the textbox



 

~|
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:319380
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Need ISAPI rewrite help...

2009-02-09 Thread Seb Duggan

On 9 Feb 2009, at 01:44, Will Tomlinson wrote:

 Thanks Seb!

 So I could say:

 RewriteRule ^calendarDetails\.html/[A-Za-z]+/([0-9]+)$ / 
 calendarDetails.cfm? EID=$1 [NC]


Make sure there's no space before the ?

Yes, or even:

RewriteRule ^calendarDetails\.html/([A-Za-z]+)/([0-9]+)$ / 
calendarDetails.cfm?$1=$2 [NC]

This means that /XXX/123 would provide ?XXX=123.

Also, if you add /? before the $, then /XXX/123/ would work as well  
as /XXX/123 (personally, I always have one of my first rules that  
forces the trailing slash to be either present or not present - better  
for SEO, and making sure you don't have 2 URLs for the same page).


I would also recommend starting your .htaccess file with the following:

RewriteEngine On
RepeatLimit 200
RewriteBase /

The RewriteBase directive means that every matched expression (the  
first half of the RewriteRule) is started after the root / of the  
website (^ means the beginning of the string to match, $ means the end).

Having the ^ at the beginning also means that the regex would match 
http://www.my.com/calendarDetails.html/EID/123 
  but not http://www.my.com/directory/calendarDetails.html/EID/123. If  
you removed it, you could have any number of characters appearing  
before the calendarDetails.html...

~|
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:319073
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Need ISAPI rewrite help...

2009-02-08 Thread Seb Duggan

What version of ISAPI Rewrite are you using?

The tutorial looks as though it's written for v2; whereas in v3 it is  
much more like the syntax of Apache's mod_rewrite. Which means that  
the querystring is not actually seen as part of the URL in  
RewriteRule, but can be accessed via a RewriteCond.

There are a number of other differences too. If you post exactly what  
you want converted to what, I can give you some more precise pointers...


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 7 Feb 2009, at 17:21, Will Tomlinson wrote:


 I'm attempting my first SES URL rewriting with the IIS ISAPI filter,  
 and having a few problems.

 I wanted to process .html files as .cfm's. That part seems to work,  
 but I have another rule that converts /EID/993 to ?EID=993

 My URL var doesn't seem to be seen on the action page.

 http://staging.ac100.org/calendarDetails.html?/EID/935

 I dump the value of URL.EID, and it's 0, which I had cfparam'd.

 Here are my rewrite rules in httpd.ini. Thanks for any help someone  
 could offer.

 RewriteRule (.*)/(.*)\.html(.*) /$2.cfm [I]

 #Convert SES URLs to standard URLs before passing them to ColdFusion
 RewriteRule (.*?\.cfm)(\?[^/]*)?/([^/]*)/([^/]*)(.+?)? $1(?2$2:\?) 
 $3=$4?5$5: [N,I]
 RewriteRule (.*?\.cfc)(\?[^/]*)?/([^/]*)/([^/]*)(.+?)? $1(?2$2:\?) 
 $3=$4?5$5: [N,I]

 I was using Brandon's tutorial here:
 http://www.bpurcell.org/blog/index.cfm?mode=entryentry=1070



 

~|
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:319050
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Need ISAPI rewrite help...

2009-02-08 Thread Seb Duggan

This should do the trick:

RewriteRule ^calendarDetails\.html/EID/([0-9]+)$ /calendarDetails.cfm? 
EID=$1 [NC]

[NC] is the equivalent of [I] in v2 (case insensitive match).

And this assumes that the files are at your site's root, and that it's  
always an EID value you're matching. (If the key value in the  
querystring varies, you could use a regex for that too).


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 8 Feb 2009, at 23:16, Will Tomlinson wrote:


 What version of ISAPI Rewrite are you using?

 The tutorial looks as though it's written for v2; whereas in v3 it is
 much more like the syntax of Apache's mod_rewrite. Which means that
 the querystring is not actually seen as part of the URL in
 RewriteRule, but can be accessed via a RewriteCond.


 I'm using V3 I believe. I just want to convert:

 calendarDetails.html/EID/935 -  calendarDetails.cfm?EID=935

 Thanks much!

 Will

 

~|
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:319052
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


How are CFCONTENT requests handled?

2009-02-06 Thread Seb Duggan

I'm putting together a page on one of my sites for downloading of hi- 
res press images.

These are JPEGs; but I want them to be downloaded rather than opened  
in the browser.

The following code works just fine:

cfheader name=Content-Disposition value=attachment; filename=press- 
image.jpg /
cfcontent type=image/jpeg file=#ExpandPath(press-image.jpg)# /

What I want to know is: if I'm serving the file in this method, does  
CF load the image into memory and then serve it? Or does it just point  
the browser to the relevant location?

The reason I ask is that some of the images are up to 10MB in size,  
and I don't want my CF server to be hammered by someone downloading a  
few of these at the same time.

The alternative is to zip them all up - very little size gain for  
JPEGs, but at least the browser will just download the file, and IIS  
will take the strain instead of CF...



Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com



~|
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:318962
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: How are CFCONTENT requests handled?

2009-02-06 Thread Seb Duggan

Thanks Nathan.

I'm currently trying to work out a solution using ISAPI_Rewrite to  
modify the headers, but can't quite get it to work yet...



On 6 Feb 2009, at 20:29, Nathan Strutz wrote:


 Seb,

 It is most likely that CF will open the file you are delivering,  
 however, it
 will probably be more in a streaming fashion, aka, it will probably  
 not all
 be loaded into active memory.

 I just did it with a 200MB file, the memory went up about 6MB and  
 now has
 dropped down 12MB. I would say it's safe.

 It literally streams it from disk to network and to local disk  
 without any
 one application loading 200MB of data. I used CF7 and Firefox 3.

 nathan strutz
 [Blog and Family @ http://www.dopefly.com/]
 [AZCFUG Manager @ http://www.azcfug.org/]




~|
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:319002
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: conditional cfloop

2009-01-05 Thread Seb Duggan
The alternative would be:

cfloop condition=(NOT structKeyExists(posts,'query')) OR  
posts.query.recordcount GT 10

ColdFusion doesn't evaluate the OR condition if the first condition  
has already returned TRUE - i.e. if the query doesn't exist, it will  
not look for the recordcount; if it does, then it will evaluate the  
second half of the condition.

Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 5 Jan 2009, at 13:31, daniel kessler wrote:

 I'm trying to create a conditional cfloop that has two conditions.

 cfloop condition=(NOT structKeyExists(posts,'query')) AND  
 posts.query.recordcount GT 10


 I only want it to loop until the query struct exists and when it has  
 at least 10 entries in it.  Otherwise, I decrement the date by two  
 weeks and have it query again.  This is through rss feed so I can't  
 just query for the top 10.


~|
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:317402
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: MySQL - Trying to query x days back

2008-12-28 Thread Seb Duggan
I would use the DATEDIFF() function:

SELECT  DATE(orderdate) AS thedate, SUM(ordertotal) AS ordersubtotal
FROM tblOrders
WHERE DATEDIFF(current_date(), orderdate) = 30
GROUP BY DATE(orderdate)

(I think this should work; I use MSSQL, so can't test this...)

Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com


On 28 Dec 2008, at 22:32, Will Tomlinson wrote:

 I have an orders table with a datetime field. I'm trying to query  
 orders that are x number of days back from today. Ex. Show me all  
 orders 30 days back from now.

 SELECT  date(orderdate) as thedate, sum(ordertotal) AS ordersubtotal
 FROM tblOrders
 where orderdate = current_date() - 30
 group by date(orderdate)

 The query works, but it's returning orders all the way back to 2006  
 - Not correct!

 What's weird is, if I change the value from 30, to 7, It shows the  
 correct orders. I can change it all the way up to 28, and it's  
 correct. If you change it to 29, which runs into last month, it  
 pulls EVERYthing. Very strange!


~|
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:317190
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Variable within a variable

2008-12-27 Thread Seb Duggan
There's no simple way to do this (as far as I'm aware) in ColdFusion.

BlueDragon has a very useful function - Render() - which will parse  
the contents of a variable, exactly as you describe.

But on ColdFusion, I've always handled cases like this by having my  
templates as flat files to be included; the variables within them get  
processed as normal.


Seb

Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 27 Dec 2008, at 13:14, Maya MacDonald wrote:

 How can you display a variable within a variable?

 I have a client who needs to control the content of all email  
 notices that go out to their clients.

 Email notices have some dynamic content such as grabbing customer  
 name or account details. The value of the email notice content is  
 stored in a variable called #emailContent# and I would like it to  
 have a value of something like this (where it contains varibles  
 within itself):

 Dear #customer#,

 Email content email content...your account expires on #expiryDate#.

 However, when the variable #emailContent# is outputted within a  
 CFMAIL tag the variables #customer# and #expiryDate# just get shown  
 as is with the hash marks. How can I output the variables within the  
 variable?

 Thanks!


~|
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:317148
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Variable within a variable

2008-12-27 Thread Seb Duggan
Either:

1. Have a separate file with just the content of the email, including  
the variables you want replaced, and include it in your cfmail like  
this:

cfmail ...
cfinclude template=myemailtemplate.cfm /
/cfmail

or:

2. If your template text is in a database, you could generate a temp  
file on the fly with the template text in it, then include that file  
as above. I'm not sure what the performance implications of this would  
be, but you'd have to weigh that against how often the process is  
called. Alternatively, generate the appropriate flat file whenever the  
template is updated.

But I've also used Dominic's method of replaceing a [variable] token  
in the template using Replace().


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 27 Dec 2008, at 13:38, Maya MacDonald wrote:

 Seb,

 Thank you for the reply.

 I am not quite sure I am following how I would include this as a  
 flat file?

 Thanks,
 Devin



Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com



~|
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:317154
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


re: product search query - advice needed

2008-12-16 Thread Seb Duggan
First
up, I'm sure you don't need telling you should be using CFQUERYPARAM
for your query variables... (Of course, you may have just omitted that
to simplify your example).

It's not the easiest query to
optimise; have you considered a different approch: make a Verity index
of your products. It's not something I've done much of myself, but it
should also give you other benefits such as better returns for near
matches...

(If Verity isn't a good way to go for this, I'm sure someone will correct me...)

Seb 



Seb Duggan
Web  ColdFusion Developer 


 
e:  s...@sebduggan.com 
t:  07786 333184 
w:  http://sebduggan.com 



From: Mike Little m...@nzsolutions.co.nz
Sent: 16 December 2008 09:06
To: cf-talk cf-talk@houseoffusion.com
Subject: product search query - advice needed 

hi guys,

i have a product table with over 500 records in it. each product is linked to a 
category and brand. when a user inputs a search i need all three elements 
searched (plus other fields as you will see in query below). at the moment, the 
query is not the fastest of queries (database is mysql). i was wondering if 
anyone can see any obvious mistakes i am making with this function...

pid = product id
cid = category id
bid = brand id

SELECT P.pid, P.price, P.price_sale, P.bid, P.display, P.views, PD.ptitle, 
PD.availability

FROM tblProducts P

INNER JOIN tblProductDesc PD ON P.pid = PD.pid
INNER JOIN tblProductCatLink PCL ON P.pid = PCL.pid
INNER JOIN tblCat C ON PCL.cid = C.cid
INNER JOIN tblCatDesc CD ON C.cid = CD.cid
INNER JOIN tblBrand B ON P.bid = B.bid

WHERE ((P.code LIKE '%searchstring%') OR (PD.ptitle LIKE '%searchstring%') OR 
(PD.pdesc LIKE '%searchstring%') OR (PD.fill_type LIKE '%searchstring%') OR 
(PD.summary LIKE '%searchstring%') OR (PD.features LIKE '%searchstring%') OR 
(CD.ctitle LIKE '%searchstring%') OR (B.btitle LIKE '%searchstring%'))
AND P.display = 1

GROUP BY P.pid, P.price, P.price_sale, P.bid, P.display, P.views, PD.ptitle, 
PD.availability
ORDER BY PD.ptitle ASC

thanks heaps.
mike 



~|
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:316807
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Would anyone care to critique my approach/code to this login scheme?

2008-12-15 Thread Seb Duggan
It may seem like an obvious thing to check (I find that's always the  
best place to start when troubleshooting...):

Have you enabled session management in your Application.cfc or  
Application.cfm file? Do you even have an Application file? (You've  
not included it as part of your source listings).


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 12 Dec 2008, at 17:14, Rick Faircloth wrote:

 Hello, all...

 I appreciate everyone's help in getting my first ColdFusion/Ajax/ 
 jQuery
 code working for this login...except for one minor (sarcasm) point.
 The cf line of code in the first page below (PRE_LOGIN.CFM),
 which should prevent the login dialog from appearing after someone
 logs in, is not doing anything.  I've tried checking the variable with
 cfdump var = '#session#', but I get an error saying the variable  
 doesn't exist.
 Upon successful login, it should get set (session.manager_id) in the
 manager_data.cfc below.  Why?




~|
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:316778
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Re: Would anyone care to critique my approach/code to this login scheme?

2008-12-15 Thread Seb Duggan
Out of interest, how are you enabling session variables if you're not  
using Application.cfm or .cfc?

Just enabling them in the Administrator is not enough - you need to  
set sessionManagement=true either in your cfapplication tag in  
Application.cfm, or at the start of your Application.cfc...


Seb


On 15 Dec 2008, at 20:36, Rick Faircloth wrote:

 Thanks for the reply, Seb...

 - session variables enabled...yes
 - not application.cfm or .cfc needed in this small test app

 I feel like this has to do with the way Ajax works to pass data
 back and forth.  It's probably more restrictive that I thought.

 After working with this some more, I've been able to use session  
 variables,
 but in limited ways.

 Still trying...

 Rick




~|
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:316783
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Is there a non-aggregate Max() function in MySQL?

2008-12-14 Thread Seb Duggan
I don't have MySQL installed, but this is how I'd do it in MSSQL (and  
I don't see why it wouldn't work for you...):

SELECT
*,
OrderValue = CASE WHEN MinPrice  MaxPrice THEN MinPrice ELSE  
MaxPrice END
FROM
mytable
ORDER BY
OrderValue DESC


Seb


Seb Duggan
Web  ColdFusion Developer

e:  s...@sebduggan.com
t:  07786 333184
w:  http://sebduggan.com

On 14 Dec 2008, at 03:26, Jim McAtee wrote:

 I have a table with two columns containing min and max values

 minprice INT
 maxprice INT

 The max price may not be present and is set to zero when that's the  
 case,
 so data might look like:

 1 5
 5 0
 3 10
 8 0
 6 0

 I want to order by the larger of the two column values

 ORDER BY Max(minprice, maxprice) DESC

 But SQL's MAX() can't be used like this since it's an aggregate  
 function.
 Is there a MySQL function that would do this?


~|
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:316744
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: CFLoop died help

2008-12-08 Thread Seb Duggan
If the page itself isn't throwing an error, it sounds like an email  
problem.

If you have access to the host, check the Spool and Undeliverable Mail  
directories.

Failing that, try creating an absolutely basic page which just sends  
an email to your own address. If this doesn't get through, you've got  
a problem with your CF mail setup.

Have you changed servers? Does your mail server expect a username and  
password? There are lots of possible mail faults...



Seb Duggan
Web  ColdFusion Developer

e:  [EMAIL PROTECTED]
t:  07786 333184
w:  http://sebduggan.com

On 8 Dec 2008, at 02:34, cfcom wrote:

 Previously it would loop over the list and send an email to each  
 address in
 the cfloop. Now I do not receive emails to each address. I'm looking  
 into
 the host as I think it was on cf7 and now cf8.



~|
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:316410
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Making a Recently Viewed list

2008-11-26 Thread Seb Duggan
Should be possible without doing another query. Simply work with your  
list of recent product ids:

!--- Get a list of all product ids from your cached query ---
!--- If you wanted, you could cache this at the same time as the  
query ---
cfset AllProductIDs = ValueList(AllProducts.ProductID) /

!--- Now loop over your list of recently viewed product ids ---
cfloop list=#COOKIE.RecentlyViewed# item=RecentItem
!--- Find the item in the list of all product ids ---
cfset i = ListFind(AllProductIDs, RecentItem) /

!--- Do whatever output you want for each recent product (if it's in  
the list) ---
cfif i gt 0
Product ID: #AllProducts.ProductID[i]#
Product Name: #AllProducts.ProductName[i]#
ThumbNail: #AllProducts.ThumbNail[i]#
/cfif
/cfloop

(Code not tested, but should work fine).



Seb Duggan
Web  ColdFusion Developer

e:  [EMAIL PROTECTED]
t:  07786 333184
w:  http://sebduggan.com

~|
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:315961
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: single quote issue

2008-11-26 Thread Seb Duggan
On 26 Nov 2008, at 14:33, Brian Dumbledore wrote:

 Ok Preservesinglequotes() didn't work. Got an error saying invalid  
 construct '[' at..
 All I did was to replace '#form[fn  _ ocid]#' with
 '#preservesinglequotes(form[fn  _ ocid])#'.

If that's what you've typed, there's a missing :

'#preservesinglequotes(form[fn  _  ocid])#'


~|
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:315973
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


re: convert decimal to fractions

2008-11-25 Thread Seb Duggan
Here's my quick method, to add to the others (I'd already written it by the 
time I saw all the replies!).

cfset decimal = 0.75 /

cfif ListLen(decimal,.) neq 2
cfthrow message=Not a decimal!/ 
/cfif

cfset places = Len(ListGetAt(decimal,2,.)) /

cfset bottom = 10 ^ places /
cfset top = decimal * bottom /

cfloop from=#top# to=1 step=-1 index=x
cfif top mod x eq 0 and bottom mod x eq 0
cfbreak /
/cfif
/cfloop

cfoutput
p
Your fraction is #top#/#bottom#, which simplifies to #top/x#/#bottom/x#.
/p
/cfoutput



Seb Duggan
Web  ColdFusion Developer 


 
e:  [EMAIL PROTECTED] 
t:  07786 333184 
w:  http://sebduggan.com 


 


~|
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:315874
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: convert decimal to fractions

2008-11-25 Thread Seb Duggan
 Seb 
 
 That worked, but there is one problem, is there a way to simplify to a 
 whole and a fraction.
 
 example 11.5 = 23/2 = 11 1/2 


You could handle this either at the beginning or at the end; for efficiency, 
I'd recommend the beginning, as your loop will be shorter...

cfset input = 11.5 /
cfset whole = Int(input) /!--- Gives a whole number of 11 ---
cfset decimal = input - whole /!--- Gives a decimal of 0.5 ---

and then display the whole numer with the fraction at the end. 

~|
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:315876
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: image function rounded rectangle?

2008-11-23 Thread Seb Duggan
This might be what you're looking for...

http://www.melrosesolutions.com/blog/index.cfm/2008/10/20/Rounding-image-corners-in-CF8

Google is your friend ;-)



Seb Duggan
Web  ColdFusion Developer

e:  [EMAIL PROTECTED]
t:  07786 333184
w:  http://sebduggan.com



On 23 Nov 2008, at 15:59, Tony wrote:

 hey in coldfusion 8 have your programmatically
 figured out how to make a rounded rectangle mask
 and cut an image out of that, so that you basically
 have a rounded rectangle bounded image, all done in cf, p
 resented to the browser like so... even if it started out square?

 thanks!

 -- tony


~|
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:315812
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: sql param error

2008-11-22 Thread Seb Duggan
One thing to bear in mind with errors thrown in the middle of a query  
is that the specified line number is not necessarily the problem one -  
it just means there's an error somewhere in the query.

In this case, somewhere in the query there's an integer parameter that  
you're trying to insert into an ntext column.

My guess is that it's this one:

JeopardyExplain = cfqueryparam value=#Arguments.pJeopardyExplain#  
cfsqltype=cf_sql_integernull=#nJeopardyExplain#

as all the other Explain columns are using  
cfsqltype=cf_sql_longvarchar.


Hope this fixes it.

--
Seb Duggan
Web  ColdFusion Developer

e:  [EMAIL PROTECTED]
t:  07786 333184
w:  http://sebduggan.com



  Error Executing Database Query.

 [Macromedia][SQLServer JDBC Driver][SQLServer]Operand type clash:  
 int is
 incompatible with ntext

 The error occurred in
 *C:\htdocs\irb\functions\_functions_protocol_events.cfc: line 491*
 *Called from* C:\htdocs\irb\proc\validate_irb_event_form3.cfm: line  
 258
 *Called from* C:\htdocs\irb\proc\validate_irb_event_form3.cfm: line 1
 *Called from* C:\htdocs\irb\functions\_functions_protocol_events.cfc:
 line 491
 *Called from* C:\htdocs\irb\proc\validate_irb_event_form3.cfm: line  
 258
 *Called from* C:\htdocs\irb\proc\validate_irb_event_form3.cfm: line 1

 489 : Corrective_Explain = cfqueryparam  
 value=#Arguments.pCorrectiveExplain#  
 cfsqltype=cf_sql_longvarchar null=#nCorrectiveExplain#
 490 :
 *491 : where Info_Id = cfqueryparam  
 value=#Arguments.pInfoId# cfsqltype=cf_sql_integer*
 492 : /cfquery
 493 :



~|
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:315804
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Re: Prevent direct access to XML data file?

2008-11-20 Thread Seb Duggan
How are you accessing your XML file?

If it's being accessed via CFML, you can place it outside your  
webroot, and it will not be browsable...


Seb


 Is it possible to prevent direct access to an XML datafile?

 Similar to verifyClient() for AJAX request, I was hoping that there  
 was one for an XML data file request as well.




~|
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:315663
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: (Probably) Simple SQL Question?

2008-11-18 Thread Seb Duggan
What database are you using? In MS SQL 2005 you can use the RANK and PARTITION 
keywords:

SELECT id, name, date_due, date_modified FROM (
SELECT id, name, date_due, date_modified, RANK() OVER (PARTITION BY id ORDER BY 
date_modified DESC) AS userRank FROM table
) AS t2
WHERE t2.userRank = 2
ORDER BY id, date_modified DESC

(I think the code is correct, but I've not been able to test it...)

 Actually, your suggestion wouldn't work for the first set, either, as 
 it would bring up 2 records for Smith and none for Woo. 


~|
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:315480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: (Probably) Simple SQL Question?

2008-11-18 Thread Seb Duggan
If you're not using SQL 2005, the following (slightly more complex) query 
should simulate the RANK and PARTITION:

SELECT id, name, date_due, date_modified
FROM (
SELECT id, name, date_due, date_modified, (SELECT COUNT(id) FROM table T2 WHERE 
T1.id = T2.id AND T2.date_modified = T1.date_modified) AS userRank
FROM table T1
) AS rankedTable
WHERE rankedTable.userRank = 2
ORDER BY id, date_modified DESC

The only caveat is that if you have two entries with exactly the same date 
stamp, the ranking might be thrown off; but that's fairly unlikely... 

~|
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:315486
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4