RE: odd error calling function in cfc

2009-08-16 Thread Adrian Lynch

Yeah, reserved word seems unlikely.

Chances are you're overwriting add_option somewhere or the scoping is out
somehow.

I notice there's no var scope on your getOptions query, var scope everything
and see it that sorts things.

It's hard to say more without seeing the full CFC mind.

Adrian

 -Original Message-
 From: Charlie Griefer [mailto:charlie.grie...@gmail.com]
 Sent: 16 August 2009 04:24
 To: cf-talk
 Subject: Re: odd error calling function in cfc
 
 
 I'd be really surprised if that was the actual issue.  if add_option
 was a
 reserved word, your initial iteration of the loop would have thrown the
 error (you said it would successfully complete the first iteration and
 then
 break).
 
 I'm not sure what the issues is, I'm just saying I'd be surprised if it
 turned out to be the variable name, in this case :)
 
 On Sat, Aug 15, 2009 at 7:57 PM, Mike Little m...@nzsolutions.co.nz
 wrote:
 
 
  you kow what is was... it was the name of the function add_option -
 i
  have renamed to add_new_option and it works.
 
  if someon could explain that one?? is it a reserved word?
 
 
   You don't really need the CFIF test, since CFOUTPUT will only
 render
   if
   there are records.  Simplify like the example below and see if it
   still
   gives you trouble.  If it does, then check that the add_option()
   method
   isn't erroring ...
  
   cfoutput query=getOptions
   cfset add_option(product_id=arguments.product_id,
   product_option_title=product_option_title)
   /cfoutput


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325481
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: ADA Captcha

2009-08-16 Thread Sebastiaan GMC van Dijk

Hahahahahahhahahahaaa, that gave me the first good laugh of the day, 
CFFormProtect very hard to configure (in any Fusebox app) ;-)
Thanx for cheering up my day with an intense felt laughter ;-)

Sorry about that, but I think you understand that I have to disagree with you 
about difficulties of setting up CFFormProtect. I've set it up in simple 
CFM-pages, in Fusebox 2, 3 and 5.5 (noXML) apps in less than one minute. If you 
need pointers or any help, feel free to e-mail me (off-list if you wish: sebgmc 
- at - hotmail - . - com).
Sebastiaan
=
So long and thanx 4 all the fish

== Onlinebase.nl
 Date: Tue, 4 Aug 2009 15:30:53 -0700
 Subject: Re: ADA Captcha
 From: vec...@mostdeadlygame.com
 To: cf-talk@houseoffusion.com
 
 
 I found CFFormProtect to be very hard to configure and set up (in
 fusebox). reCapatcha, I set up in about 4 mins. (just did it) and it
 works perfectly.
 
 On Tue, Aug 4, 2009 at 3:28 PM, Sebastiaan GMC van
 Dijkseb...@hotmail.com wrote:
 
  Captcha's are SOOO passe!
  Toss out the Captcha and make use of CFFormProtect, available from 
  RIAForge.com ;-)
  No extra user input, coupled to Akismet and Project Honeypot, and all CFC 
  ;-)
 
  Sebastiaan
  =
  So long and thanx 4 all the fish
 
  == Onlinebase.nl
  Date: Tue, 4 Aug 2009 14:51:58 -0700
  Subject: Re: ADA Captcha
  From: h...@ilsweb.com
  To: cf-talk@houseoffusion.com
 
 
  Dave Watts wrote:
   While I do think you're right about reCAPTCHA being ADA-compliant, I
   would still recommend avoiding the use of CAPTCHAs at all. ADA
   compliant doesn't necessarily equate with easy to use.
 
  While I don't disagree that there are costs and cons to weigh when using
  a captcha.  I find the Carnegie-Mellon one to be less annoying then
  most.  They don't do *really* funky things with the words like toss the
  letters like salad or use horrid backgrounds.  They actually use the
  creative idea of taking a fairly human readable word that has already
  failed computer recognition when it was scanned and OCR'ed from a
  digitalization project, currently the NY Times.  And combines this with
  a word that has already been solved by humans.
 
  Thus you get a pair of fairly straight forward words that have always
  been simple for me to understand at least.  That has not always been
  true with other, more homegrown captcha systems.  Plus you get the
  community benefit of helping digitalize pre-computer printed works.  I
  feel that offsets quite a bit of the cons of captcha's in general.  As
  well as that Carnegie-Mellon has also included the ADA compliance portion.
 
  But, as always, your (general) millage may vary and only you (general)
  can make the decision on what is best for your (general) given project
  of the day.
 
 
 
  
 
 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325482
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: ColdBox and ColdSpring Login

2009-08-16 Thread Glyn Jackson

Thanks Kevan
quote: user object would be stored in the session rather than just the username.

Interesting idea, thanks makes way more sense.  

PS, thank you for the link, just what I was looking for.

Glyn.

 if I should be do this all in my service, or should I come out again with
the username
 and run the bean.setUserSession() in the handler?
I'd keep everything behind the service (or even other objects beyond that)
and not put session related code in your handler.

I'd also keep session code out of the user object (if that is what
the setUserSession() function is doing). I would probably do something more
like:

if credentials are valid, then
session.user = userBean
endif

So your user object would be stored in the session rather than just the
username (if that's what you were planning).

Also have a look at
http://learn.objectorientedcoldfusion.org/wiki/Accessing_a_Users_Session_Data 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325483
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Illudium PU36, queryRowToStruct?

2009-08-16 Thread Glyn Jackson

Hi,

Thank you to everyone on house of fusion who has been very helpful so far with 
my stupid questions. I have another ;)
 
I was looking at some code I generated for a gateway by Illudium PU36. The read 
and update functions do not make any sense in that it does not have any return 
for me to get! However I noticed a function called queryRowToStruct I am 
assuming this has something to do with how I can return the query or access the 
query from my service layer, however this is a private function so my service 
layer cannot access it if this was true. I am just confused because without a 
way to return the query whats the point in these functions?

Are they wrong, or should I give them a return? or I am missing the purpose?

Thanks Glyn

-

!---Read---
cffunction name=readAdminUsers access=public output=false 
returntype=void
  cfargument name=adminusers type=salesMaxx.model.objects.adminusers 
required=true /
  cfset var qRead =  /
  cfset var strReturn = structNew() /
  cftry
cfquery name=qRead datasource=#variables.dsnBean.getname()# 
username=#variables.dsnBean.getusername()# 
password=#variables.dsnBean.getpassword()#

SELECT

adminId,

firstname,

surname,

email,

username,

password,

role,

lastLogin,

flag,

IP,

userLog,

createddatetime

FROMadminusers

WHERE   adminId = cfqueryparam 
value=#arguments.adminusers.getadminId()# CFSQLType=cf_sql_integer /

/cfquery
cfcatch type=database
  !--- leave the bean as is and set an empty query for the conditional 
logic below ---
  cfset qRead = queryNew(id) /
/cfcatch
  /cftry
  cfif qRead.recordCount
cfset strReturn = queryRowToStruct(qRead)
cfset arguments.adminusers.init(argumentCollection=strReturn)
  /cfif
/cffunction




cffunction name=queryRowToStruct access=private output=false 
returntype=struct

cfargument name=qry type=query required=true



cfscript

/**

 * Makes a row of a query into a structure.

 * 

 * @param query  The query to work with. 

 * @param rowRow number to check. Defaults to row 
1. 

 * @return Returns a structure. 

 * @author Nathan Dintenfass (nat...@changemedia.com) 

 * @version 1, December 11, 2001 

 */

//by default, do this to the first row of the query

var row = 1;

//a var for looping

var ii = 1;

//the cols to loop over

var cols = listToArray(qry.columnList);

//the struct to return

var stReturn = structnew();

//if there is a second argument, use that for the row 
number

if(arrayLen(arguments) GT 1)

row = arguments[2];

//loop over the cols and build the struct from the 
query row

for(ii = 1; ii lte arraylen(cols); ii = ii + 1){

stReturn[cols[ii]] = qry[cols[ii]][row];

}   

//return the struct

return stReturn;

/cfscript

/cffunction


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325484
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: 
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4


Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Francois Levesque

That looks more like a DAO than a gateway.
Notice that the read method takes in an adminUsers object. At the end of the
method it initializes it with what the query returned, so you can access
it's properties from the calling page.

Also, typically an update method will only need to return true on success
or false on error. The object's properties are still available in the bean
through the get*X* methods.

hth,

Francois Levesque
http://blog.critical-web.com/


On Sun, Aug 16, 2009 at 1:56 PM, Glyn Jackson glyn.jack...@newebia.co.ukwrote:


 Hi,

 Thank you to everyone on house of fusion who has been very helpful so far
 with my stupid questions. I have another ;)

 I was looking at some code I generated for a gateway by Illudium PU36. The
 read and update functions do not make any sense in that it does not have any
 return for me to get! However I noticed a function called queryRowToStruct
 I am assuming this has something to do with how I can return the query or
 access the query from my service layer, however this is a private function
 so my service layer cannot access it if this was true. I am just confused
 because without a way to return the query whats the point in these
 functions?

 Are they wrong, or should I give them a return? or I am missing the
 purpose?

 Thanks Glyn

 -

 !---Read---
 cffunction name=readAdminUsers access=public output=false
 returntype=void
  cfargument name=adminusers type=salesMaxx.model.objects.adminusers
 required=true /
  cfset var qRead =  /
  cfset var strReturn = structNew() /
  cftry
cfquery name=qRead datasource=#variables.dsnBean.getname()#
 username=#variables.dsnBean.getusername()#
 password=#variables.dsnBean.getpassword()#

SELECT

adminId,

firstname,

surname,

email,

username,

password,

role,

lastLogin,

flag,

IP,

userLog,

createddatetime

FROMadminusers

WHERE   adminId = cfqueryparam
 value=#arguments.adminusers.getadminId()# CFSQLType=cf_sql_integer /

/cfquery
cfcatch type=database
  !--- leave the bean as is and set an empty query for the conditional
 logic below ---
  cfset qRead = queryNew(id) /
/cfcatch
  /cftry
  cfif qRead.recordCount
cfset strReturn = queryRowToStruct(qRead)
cfset arguments.adminusers.init(argumentCollection=strReturn)
  /cfif
 /cffunction




 cffunction name=queryRowToStruct access=private output=false
 returntype=struct

cfargument name=qry type=query required=true



cfscript

/**

 * Makes a row of a query into a structure.

 *

 * @param query  The query to work with.

 * @param rowRow number to check. Defaults to
 row 1.

 * @return Returns a structure.

 * @author Nathan Dintenfass (
 nat...@changemedia.com)

 * @version 1, December 11, 2001

 */

//by default, do this to the first row of the query

var row = 1;

//a var for looping

var ii = 1;

//the cols to loop over

var cols = listToArray(qry.columnList);

//the struct to return

var stReturn = structnew();

//if there is a second argument, use that for the
 row number

if(arrayLen(arguments) GT 1)

row = arguments[2];

//loop over the cols and build the struct from the
 query row

for(ii = 1; ii lte arraylen(cols); ii = ii + 1){

stReturn[cols[ii]] = qry[cols[ii]][row];

}

//return the struct

return stReturn;

/cfscript

/cffunction


 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325485
Subscription: 

Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Matt Quackenbush

It appears as though that code is expecting the object to be provided in the
'adminusers' argument, and then is converting the query to a struct, and is
then re-initializing the 'adminusers' object with that struct.  Assuming the
init() method on the adminusers object is built to accept these properties
and will re-populate itself, then that's all you need to do.  Because CF
passes CFCs by reference, your adminusers object will magically have all
of the updated info in it wherever you called readAdminUsers() from.

HTH


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325486
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Glyn Jackson

 quote: Because CF passes CFCs by reference, your adminusers object will 
 magically have all of the updated info in it wherever you called 
 readAdminUsers() from. 

really, no way? so my admin object will have the data populated using the 
getters and setters! thats cool!

so let me see if I understand this. say I wanted to get data from my database 
where ID = 1

in my service layer I would do something like this...

var userDetails = variables.adminUsersGateway.readAdminUsers(arguments.bean);

then in my handler I could setadminusers.getname() to get the name.

do I have to use the object first to set the userID then pass in my object?.



~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325487
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Glyn Jackson

This really works! Look at me I am starting to get this (is it really sad 
this is making me smile with joy lol)


I love this object stuff! So here is what I am doing,

I have just checked my user exist, got their details and set there session in 4 
lines of code in my handler! Now that's cool, right?

if (resultCount.recordcount eq 1){
variables.adminUsersService.getUserByID(userBean);//Get User Deatils, Object 
Will Have The User ID Already
variables.adminUsersService.setCurrentUser(userBean);// Setup User Session
}

I can see now how to make this better no need for the resultCount line I have 
do this via the object also! 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325488
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Matt Quackenbush

Heh.  I so totally LOVE those A HA!!! moments!  And no, it's not sad that
those things make you smile.  Hell, I'm smiling just because it's cool to
see someone else get it.  :-)

Oh, and yes, you are absolutely correct.  You do not need the resultCount
line, because you can just get the object from your service (which utilizes
the gateway/dao to populate it).


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325489
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Illudium PU36, queryRowToStruct?

2009-08-16 Thread Glyn Jackson

Glad its not just me. Thanks again for you help, I am sure I will have more 
questions but I have a bit to be going on with now for a while at least.

Glyn 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325490
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFFM 1.20 Released

2009-08-16 Thread Rick Root

On Sat, Aug 15, 2009 at 3:24 AM, Kevin Peppermanchorno...@gmail.com wrote:

 Great work Rick!
 No setup other than 2 paths, and its up and running on BlueDragon.

 Very nice.

Thanks Kevin.  I'm hoping to find some time to work on a cool 2.0
version that uses a lot of jQuery, and works with CFIMAGE instead of
(or in addition to) ImageCFC)

Rick

 On Sat, Aug 15, 2009 at 12:48 AM, Rick Root rick.r...@webworksllc.comwrote:


 So I finally got around to fixing up CFFM

 www.opensourcecf.com/cffm
-- 
Rick Root
New Brian Vander Ark Album, songs in the music player and cool behind
the scenes video at www.myspace.com/brianvanderark

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325491
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFFM 1.20 Released

2009-08-16 Thread Sonny Savage

Hey Rick,

I was overjoyed to discover the ImageCFC library through your CFFM package.
I'm doing a project that's on a CFMX 6.1 server, and needed an image editing
solution badly.

Thanks!

Edward Sonny Savage


On Sun, Aug 16, 2009 at 4:25 PM, Rick Root rick.r...@webworksllc.comwrote:


 On Sat, Aug 15, 2009 at 3:24 AM, Kevin Peppermanchorno...@gmail.com
 wrote:
 
  Great work Rick!
  No setup other than 2 paths, and its up and running on BlueDragon.
 
  Very nice.

 Thanks Kevin.  I'm hoping to find some time to work on a cool 2.0
 version that uses a lot of jQuery, and works with CFIMAGE instead of
 (or in addition to) ImageCFC)

 Rick

  On Sat, Aug 15, 2009 at 12:48 AM, Rick Root rick.r...@webworksllc.com
 wrote:
 
 
  So I finally got around to fixing up CFFM
 
  www.opensourcecf.com/cffm
 --
 Rick Root
 New Brian Vander Ark Album, songs in the music player and cool behind
 the scenes video at www.myspace.com/brianvanderark

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325492
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFFM 1.20 Released

2009-08-16 Thread Gerald Guido

Rick,
I have been using CFFM for years. Good stuff. I added an ajaxy  mouse over
image preview feature for images to it that you may (or may not) want to
look at.  It is no big deal but I can send you the code if you want... I got
it at work so it will be tomorrow.

Thanx
G!



On Sat, Aug 15, 2009 at 12:48 AM, Rick Root rick.r...@webworksllc.comwrote:


 So I finally got around to fixing up CFFM

 www.opensourcecf.com/cffm

 Here's a basic summary of the (relatively minor) changes since the
 last release about 2 years ago:

 - changed throw() method to imagecfcthrow() in image.cfc, as cf9
 doesn't like me using that function name.
 - changed directoryList() in cffm.cfc to cffmDirectoryList() as OpenBD
 didn't like it, and I doubt CF9 does either.
 - Added coldfusion 9 ramdisk support (cool).  So you can use CFFM to
 manage files in your coldfusion server's virtual file system.  Just
 set the includeDir to ram:// and the includeDirWeb to / - you can even
 view/edit files that are stored in the ram disk.

 Image Manipulation doesn't work in the ram disk in this version
 because imageCFC can't read/write to the ram disk.  That'll have to be
 a future release.

 --
 Rick Root
 New Brian Vander Ark Album, songs in the music player and cool behind
 the scenes video at www.myspace.com/brianvanderark

 

~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325493
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


RE: keeping a session alive

2009-08-16 Thread Justin Scott

 I have an application that, after 20 mins of idle (detected 
 by JS), the user is given a warning saying they are about to 
 be logged out with a link to keep the session going.  My 
 original plan was to sent an AJAX request to a page when the 
 link is clicked, but I have read that an AJAX request will 
 not keep the session alive.  Redirecting off the page is out 
 of the question.

In the past I have had the yes keep my session active option like this
create an image object within JavaScript and then set the source attribute
to a ColdFusion page that served up a blank image (not that it mattered
since it was never displayed anywhere.  This can also be used to ping the
server and have data passed back in a cookie that the JS can read, a sort of
poor-man's AJAX before AJAX was even a term).  There are certain instances
in a content management system where you may want to automatically keep the
session alive longer without prompting the user, and the same method applies
in the background.


-Justin


~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:325494
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4