RE: [ cf-dev ] number of items in a list

2004-09-24 Thread Aidan Whitehall
 [snip]
 It's up to you whether you choose to use these functions or not, which
I
 guess in most cases will come down to if (when) CF7 comes out, it may
 break things, but are you likely to upgrade the machines you're
hosting
 your already-written apps on?

Thanks for all the info, Tim -- very interesting.

As tempting as it might be to use undocumented features (CF not
enumerating empty list elements is a pet-peeve of mine, so I loved your
split() suggestion), I don't think it's entirely beyond the realms of
possibility that either (i) a machine would be upgraded or (ii) a new
box might be built using CFMX7 and pre-existing apps moved onto it.

And to be honest, if I put myself in our employers shoes, I'd take a dim
view of a developer who, without consent, used something like that. I
feel it's the IT equivalent of leaving an electrical lead trailing
across a walkway -- something that might be convenient to you in the
short-term, but that introduces an avoidable risk.

If it's your own application or business, of course, that's different.


-- 
Aidan Whitehall   [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental   +44 (0)1695 51775


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk


--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Robertson-Ravo, Neil (RX)
This is a known issue sin CF, you will need to add padders in a list with
empty values.

See here..

http://www.cflib.org/udf.cfm?ID=507





-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] 
Sent: 23 September 2004 12:49
To: [EMAIL PROTECTED]
Subject: [ cf-dev ] number of items in a list

cfset list=a,b,c,i

cfoutput
 #ListLen(list)#
/cfoutput

= 4.  i.e. it's not counting the empty elements in the list.  how'd you get
round that, parse through the list looking for commas?




-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]
This e-mail is from Reed Exhibitions (Oriel House, 26 The Quadrant,
Richmond, Surrey, TW9 1DL, United Kingdom), a division of Reed Business,
Registered in England, Number 678540.  It contains information which is
confidential and may also be privileged.  It is for the exclusive use of the
intended recipient(s).  If you are not the intended recipient(s) please note
that any form of distribution, copying or use of this communication or the
information in it is strictly prohibited and may be unlawful.  If you have
received this communication in error please return it to the sender or call
our switchboard on +44 (0) 20 89107910.  The opinions expressed within this
communication are not necessarily those expressed by Reed Exhibitions.
Visit our website at http://www.reedexpo.com

-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Re: [ cf-dev ] number of items in a list

2004-09-23 Thread Paul Johnston
If you want an array... use an array.

Lists are useless when you should be using an array.  To get round it,
count the number of commas and + 1.

Either that, or loop over the string and create a real array
(listtoarray won't help here either)...

Paul

On Thu, 2004-09-23 at 12:48, [EMAIL PROTECTED]
wrote:
 cfset list=a,b,c,i
 
 cfoutput
  #ListLen(list)#
 /cfoutput
 
 = 4.  i.e. it's not counting the empty elements in the list.  how'd you get
 round that, parse through the list looking for commas?
 
 
 


-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 Either that, or loop over the string and create a real array 

Or be more convuluted:

cfset list=a,b,c,i
cfset itemCount = arraylen(list.split(,))
cfoutput#itemCount#/cfoutput

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Re: [ cf-dev ] number of items in a list

2004-09-23 Thread duncan . cumming

who said anything about arrays?




   
  
Paul Johnston  
  
[EMAIL PROTECTED]To: [EMAIL PROTECTED]
   
tions.com cc: 
  
   Subject: Re: [ cf-dev ] number of items 
in a list 
23/09/2004 
  
12:44  
  
Please respond 
  
to dev 
  
   
  
   
  



If you want an array... use an array.

Lists are useless when you should be using an array.  To get round it,
count the number of commas and + 1.

Either that, or loop over the string and create a real array
(listtoarray won't help here either)...

Paul

On Thu, 2004-09-23 at 12:48, [EMAIL PROTECTED]
wrote:
 cfset list=a,b,c,i

 cfoutput
  #ListLen(list)#
 /cfoutput

 = 4.  i.e. it's not counting the empty elements in the list.  how'd you
get
 round that, parse through the list looking for commas?





--
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]






-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Re: [ cf-dev ] number of items in a list

2004-09-23 Thread Paul Johnston
The point being that if you want an array, use an array.

The whole point of an array is that you want to know that a certain
value is at a certain position.  Therefore, knowing the length of an
array is important.

With a list, the length is unimportant.  It's just a variable to hold a
bunch of values.  It's not supposed to be used like an array.  It's
not supposed to have a useful length value.  The fact that it does
is neither here nor there.  Also, as has been said, if the list value is
empty (ie s,,,f) then CF will ignore it. That list only has 2 values
in it... because it actually only has 2 values in it.  If it was an
array, it would have 5 positions to store values and would have a lenght
of 5.

Am I making any sense?

It's programming constructs!  I do think it would have been appropriate
to make CF lists similar to arrays, but then all a list would have been
was a string based array.

Think about it for a moment though, if CF had originally had a NULL in
it, then a list with empty values would have made sense.  However,
because there is no such thing as an empty value in CF (it's always an
empty string) then if you parsed in a list with empty strings in it,
and you were expecting (say) a bunch of numbers, what *should* CF do
with it?  It has no NULL and an empty string is incorrect... should it
be 0 or what?

Anyway, I've rabbitted enough now!  I think I'm quite tired...

Paul

On Thu, 2004-09-23 at 14:00, [EMAIL PROTECTED]
wrote:
 who said anything about arrays?
 
 
 
 
  
 
 Paul Johnston
 
 [EMAIL PROTECTED]To: [EMAIL PROTECTED]  
  
 tions.com cc:   
 
Subject: Re: [ cf-dev ] number of 
 items in a list 
 23/09/2004   
 
 12:44
 
 Please respond   
 
 to dev   
 
  
 
  
 
 
 
 
 If you want an array... use an array.
 
 Lists are useless when you should be using an array.  To get round it,
 count the number of commas and + 1.
 
 Either that, or loop over the string and create a real array
 (listtoarray won't help here either)...
 
 Paul
 
 On Thu, 2004-09-23 at 12:48, [EMAIL PROTECTED]
 wrote:
  cfset list=a,b,c,i
 
  cfoutput
   #ListLen(list)#
  /cfoutput
 
  = 4.  i.e. it's not counting the empty elements in the list.  how'd you
 get
  round that, parse through the list looking for commas?
 
 
 
 
 
 --
 These lists are syncronised with the CFDeveloper forum at
 http://forum.cfdeveloper.co.uk/
 Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
 CFDeveloper Sponsors and contributors:-
 *Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
 by activepdf.com*
   *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
 proworkflow.com*
*Tutorials provided by helmguru.com* :: *Lists hosted by
 gradwell.com*
 
 To unsubscribe, e-mail: [EMAIL PROTECTED]
 
 
 
 
 


-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 list.split(,)  am I missing something, where did this
 come from?

That's a since MX thing -- because all basic types in CF are treated
(at least initially) as Java strings, you can use functions from the
java.lang.String class [1], which includes a function to tokenise a
string into an array given a certain token (in this case a comma).

In this case, the split() method [2] can actually perform the split on
more than a single character -- it takes a regular expression as the
delimiter.  It also acts differently as the CF list functions in that is
*doesn't* ignore empty items.

You can use other methods the String class to good effect too: I've used
functions like charAt(), compareTo(), startsWith(), endsWith() and
matches().

Ah the joys of CF sitting on top of Java...  ;)

Tim.

[1] http://short.badpen.com/?8SMBASDZ
[2] http://short.badpen.com/?N117J1BF

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



Re: [ cf-dev ] number of items in a list

2004-09-23 Thread Salvatore Fusto
hello, why not ListToArray(list,,)?
sa
- Original Message - 
From: Tim Blair [EMAIL PROTECTED]
To: [EMAIL PROTECTED]
Sent: Thursday, September 23, 2004 4:54 PM
Subject: RE: [ cf-dev ] number of items in a list



 list.split(,)  am I missing something, where did this
 come from?

That's a since MX thing -- because all basic types in CF are treated
(at least initially) as Java strings, you can use functions from the
java.lang.String class [1], which includes a function to tokenise a
string into an array given a certain token (in this case a comma).

In this case, the split() method [2] can actually perform the split on
more than a single character -- it takes a regular expression as the
delimiter.  It also acts differently as the CF list functions in that is
*doesn't* ignore empty items.

You can use other methods the String class to good effect too: I've used
functions like charAt(), compareTo(), startsWith(), endsWith() and
matches().

Ah the joys of CF sitting on top of Java...  ;)

Tim.

[1] http://short.badpen.com/?8SMBASDZ
[2] http://short.badpen.com/?N117J1BF

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

-- 
These lists are syncronised with the CFDeveloper forum at
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided
by activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by
proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by
gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]




-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Adrian Lynch
It's not often CF suprises me, but this is one of them!

-Original Message-
From: Tim Blair [mailto:[EMAIL PROTECTED]
Sent: 23 September 2004 15:55
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] number of items in a list



 list.split(,)  am I missing something, where did this
 come from?

That's a since MX thing -- because all basic types in CF are treated
(at least initially) as Java strings, you can use functions from the
java.lang.String class [1], which includes a function to tokenise a
string into an array given a certain token (in this case a comma).

In this case, the split() method [2] can actually perform the split on
more than a single character -- it takes a regular expression as the
delimiter.  It also acts differently as the CF list functions in that is
*doesn't* ignore empty items.

You can use other methods the String class to good effect too: I've used
functions like charAt(), compareTo(), startsWith(), endsWith() and
matches().

Ah the joys of CF sitting on top of Java...  ;)

Tim.

-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Aidan Whitehall
  list.split(,)  am I missing something, where did this
  come from?
 
 That's a since MX thing -- because all basic types in CF are treated
 (at least initially) as Java strings, you can use functions from the
 java.lang.String class [1], which includes a function to tokenise a
 string into an array given a certain token (in this case a comma).

Do you know to what extent this new functionality is supported?

I'd hate to start using Java methods directly on CF variables (I assume
that's what you're doing) only to find that in some future version the
code fails to run because of some modification MM make.


-- 
Aidan Whitehall   [EMAIL PROTECTED]
Macromedia ColdFusion Developer
Fairbanks Environmental   +44 (0)1695 51775


This e-mail has been scanned for all viruses by Star. The
service is powered by MessageLabs. For more information on a proactive
anti-virus service working around the clock, around the globe, visit:
http://www.star.net.uk


--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 hello, why not ListToArray(list,,)?

Because, as already mentioned, Duncan wanted to include empty elements
in the count.  Using listToArray() excludes the empty elements, whereas
split() includes them and gives the correct result.

Tim.

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 Do you know to what extent this new functionality is supported?
 
 I'd hate to start using Java methods directly on CF variables 
 (I assume that's what you're doing) only to find that in some 
 future version the code fails to run because of some 
 modification MM make.

Well, of course this behaviour is under the hood and unsupported stuff
which you probably won't find in any offical CF docs, much in the same
wasy as using the service factory methods.

While we're on the subject, another good one I've found is the handy
isLast() function that you can call on queries.  Take, for example, you
want to print a comma-delimited list of items in a particular query
column (and before anyone says it, yes you can use valueList() -- this
is just an exmaple!).  You need to output a value, followed by a comma
each time apart from the last value.

In regular CF, you'd can either do your query, set up a counter, then
loop through all the results, incrementing the counter and comparing it
to myQuery.recordcount to see if you've got to the end.  The slightly
better way is to remove the counter and use myQuery.currentrow instead.

Alternatively, you can ignore any comparison of values as in the
previous two example, and simply do a boolean check on myQuery.isLast()
which will return TRUE if the current row is the last.  Hidden methods
are great.  :)

It's up to you whether you choose to use these functions or not, which I
guess in most cases will come down to if (when) CF7 comes out, it may
break things, but are you likely to upgrade the machines you're hosting
your already-written apps on?

Tim.

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Adrian Lynch
You've gone and done it now, worm, can, open...

... does a CF query map to a built in Java dataype or is there a Query
class?

Got any more exmaples? Got any code to help explore this new gold mine? The
service factory was fun but this looks like it might be even better! (If
anyone's reading this, I didn't just say that :OP)

Ade

-Original Message-
From: Tim Blair [mailto:[EMAIL PROTECTED]
Sent: 23 September 2004 16:27
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] number of items in a list



 Do you know to what extent this new functionality is supported?

 I'd hate to start using Java methods directly on CF variables
 (I assume that's what you're doing) only to find that in some
 future version the code fails to run because of some
 modification MM make.

Well, of course this behaviour is under the hood and unsupported stuff
which you probably won't find in any offical CF docs, much in the same
wasy as using the service factory methods.

While we're on the subject, another good one I've found is the handy
isLast() function that you can call on queries.  Take, for example, you
want to print a comma-delimited list of items in a particular query
column (and before anyone says it, yes you can use valueList() -- this
is just an exmaple!).  You need to output a value, followed by a comma
each time apart from the last value.

In regular CF, you'd can either do your query, set up a counter, then
loop through all the results, incrementing the counter and comparing it
to myQuery.recordcount to see if you've got to the end.  The slightly
better way is to remove the counter and use myQuery.currentrow instead.

Alternatively, you can ignore any comparison of values as in the
previous two example, and simply do a boolean check on myQuery.isLast()
which will return TRUE if the current row is the last.  Hidden methods
are great.  :)

It's up to you whether you choose to use these functions or not, which I
guess in most cases will come down to if (when) CF7 comes out, it may
break things, but are you likely to upgrade the machines you're hosting
your already-written apps on?

Tim.


-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Adrian Lynch
http://www.cfdev.com/mx/undocumentation/

Not read it yet, but the introduction says it all

-Original Message-
From: Adrian Lynch [mailto:[EMAIL PROTECTED]
Sent: 23 September 2004 16:54
To: [EMAIL PROTECTED]
Subject: RE: [ cf-dev ] number of items in a list


You've gone and done it now, worm, can, open...

... does a CF query map to a built in Java dataype or is there a Query
class?

Got any more exmaples? Got any code to help explore this new gold mine? The
service factory was fun but this looks like it might be even better! (If
anyone's reading this, I didn't just say that :OP)

Ade

-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 You've gone and done it now, worm, can, open...

LOL, I know what you mean...  :)

 ... does a CF query map to a built in Java dataype or is 
 there a Query class?

It's a non-standard (i.e. created for CF) class called
coldfusion.sql.QueryTable.

 Got any more exmaples? Got any code to help explore this new
 gold mine? The service factory was fun but this looks like it
 might be even better! (If anyone's reading this, I didn't
 just say that :OP)

Wee, the way I do it is just by being nosey!  I wrote the
attached script a while ago -- it creates an instance of an object
(whatever you like - there examples in there of java classes, CF
objects, CF basic types, etc) and then outputs loads of info about it,
such as superclasses, constructors, field names and methods.  Method
information also includes argument and return types.

If you're wondering how to find out what CF classes there are available
to you to poke around in, just take a copy of cfusion.jar
(%cfroot%/lib/cfusion.jar), rename it cfusion.zip and run it through
winzip.  And before someone says, it's all perfectly legit!  We're not
decompiling class files or anything like that.

If anyone finds out anything interesting, let us know :)

Tim.

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

-- 
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/
 
CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]

RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 I wrote the attached script a while ago

Doh, no attachments...  Try this instead (it's a .cfm file, just rename
it):
http://tech.badpen.com/dev/objectInspector.txt

Tim.

--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]



RE: [ cf-dev ] number of items in a list

2004-09-23 Thread Tim Blair

 http://www.cfdev.com/mx/undocumentation/
 
 Not read it yet, but the introduction says it all

Heh, my script basically does exactly what their java class does, but
without the extra class required.


--
---
Badpen Tech - CF and web-tech: http://tech.badpen.com/
---
RAWNET LTD - Internet, New Media and ebusiness Gurus.
WE'VE MOVED - for our new address, please visit our
website at http://www.rawnet.com/ or call us any time
on 0800 294 24 24.
---
This message may contain information which is legally
privileged and/or confidential.  If you are not the
intended recipient, you are hereby notified that any
unauthorised disclosure, copying, distribution or use
of this information is strictly prohibited. Such
notification notwithstanding, any comments, opinions,
information or conclusions expressed in this message
are those of the originator, not of rawnet limited,
unless otherwise explicitly and independently indicated
by an authorised representative of rawnet limited.
--- 

--
These lists are syncronised with the CFDeveloper forum at 
http://forum.cfdeveloper.co.uk/
Archive: http://www.mail-archive.com/dev%40lists.cfdeveloper.co.uk/

CFDeveloper Sponsors and contributors:-
*Hosting and support provided by CFMXhosting.co.uk* :: *ActivePDF provided by 
activepdf.com*
  *Forums provided by fusetalk.com* :: *ProWorkFlow provided by proworkflow.com*
   *Tutorials provided by helmguru.com* :: *Lists hosted by gradwell.com*

To unsubscribe, e-mail: [EMAIL PROTECTED]