Re: More Complicated RegEx Replace

2012-07-02 Thread Peter Boughton

 This is the replace statement a regex guru gave me 
 to wrap a variable found in a string in a span tag. 

Not sure you can call them a guru when the only piece of regex used is a pair 
of parentheses which are entirely unnecessary. *shrug*

Here's a simpler version that does exactly the same thing:

REReplaceNoCase
( answer
, search_string
, 'span class=keyword\0/span'
, 'all'
)

However, what that isn't doing is escaping potential regex metacharacters 
inside search_string (which could then result in unexpected behaviour).

If you can't guarantee there will not be any metacharacters present, you need 
to do this:

REReplaceNoCase
( answer
, search_string.replaceAll('[$^*()+\[\]{}.?\\|]','\\$0')
, 'span class=keyword\0/span'
, 'all'
)

(Which prefixes the relevant characters with a backslash to escape them.)


Anyhow, as for your actual problem, regex is not a good tool for parsing HTML 
(which is what you're asking to be done by excluding tag attributes from 
matching).

What you need to do is use a HTML parsing library, such as jSoup, to isolate 
the text segments within HTML tags, and loop through performing your replace 
operation on each of those in turn (recursing down through any child tags as 
required).

Using jSoup, this can be achieved with the textNodes() method, to access the 
individual segments of text and child nodes:
http://jsoup.org/apidocs/org/jsoup/nodes/Element.html#textNodes()

If you're unfamiliar with using JARs in CF, Ben Nadel has a post on using jSoup 
with CF10:
http://www.bennadel.com/blog/2358-Parsing-Traversing-And-Mutating-HTML-With-ColdFusion-And-jSoup.htm
 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351784
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Replace Question

2012-07-02 Thread Peter Boughton

This is a case for Regular Expressions (RegEx):

REReplaceNoCase(answer, '(#search_string#)', 'span
class=keyword\1/span', 'all')#


Heh, just seen this after the other thread, so guess I'll repeat what I said 
there:

Using parentheses is completely unnecessary. Use \0 in the replacement string 
instead.

If search_string is (for example) $10 or :) or a+b^c or whatever then 
simply using it as a regex_pattern will cause problems.
To solve this means escaping the meta-characters, for example, 
search_string.replaceAll('[$^*()+\[\]{}.?\\|]','\\$0')

Putting both those together results in:

REReplaceNoCase
( answer
, search_string.replaceAll('[$^*()+\[\]{}.?\\|]','\\$0')
, 'span class=keyword\0/span'
, 'all'
)

(Though of course, as noted in the other thread, this doesn't deal with HTML.) 


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:351787
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Check for list of words in string

2011-10-11 Thread Peter Boughton

Wouldn't this also catch words like 'myselection'?

Yes. \b is your friend. :)

Or possibly even stuff like (?=^|;)\s*(?:SELECT|DECLARE|EXEC|etc)\b to 
ensure this is stuff at a beginning of a string/statement.


But I don't really agree with the general approach here.

With cfqueryparam + thorough code reviews + security testing both before and 
after code goes live, you don't need to worry about this.

(And if you want to block frequent blatant attacks from wasting server 
resources, do it at the firewall level, not the application server level.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:348057
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Anyone care to review this image handling process?

2011-08-21 Thread Peter Boughton

I'd raise four must-fix issues with that code.

1:
You haven't var/local scoped any of these variables, despite being inside a 
function which is probably going to end up in a shared scope, so this code 
isn't thread-safe and thus can cause incorrect behaviour if two people upload 
images at the same time.
(Or, possibly, you've not copied that part of code, since there's no 
cffunction/cfargument lines either, but still safer to highlight the problem.)

2:
The variable loopCounter never changes, which is probably not what you want.

The whole imageList looping is broken, because the list attribute accepts a 
string (which is actually what you're giving it, so no errors), but the 
imageList variable is a query. Either do list=#ValueList(imageList.name)# or 
use query=imageList instead.

(Also, don't forget the filter attribute. You can use it to do file* as well 
as *.ext to reduce the number of files to check against)

3:
You've also got incorrect hash usage, e.g:
cfset newImageFileName  = reReplace(#originalImageFileName#, 
'[^a-zA-Z0-9_\-.]', '', 'all') /
cfif image is '#newFileNameComplete#'
cfset  renamedNewFileNameComplete = #newFileNameComplete#  

(Yes, over-use of hashes is a must-fix issue, because it indicates a lack of 
understanding of what's going on, so it's a bug in the programmers brain that 
needs fixing.)

4:
As Justin points out, tempImages is going to keep growing.
Depending on where the images are uploaded from, you may simply be able to 
FileDelete the uploaded version after the cfimage/resize has been done, and 
that's that.
Or you could schedule a task that runs outside working hours to clear the 
folder, or to remove anything over X days old (if there's a reason to keep 
recent ones).


I wouldn't pass any code without those things being corrected, but a few others 
which aren't specific bugs but still worth being mentioned/fixed are:

5:
You haven't use a variable for e:\tempImages, which means you'd need to 
search/replace if/when the drive or path changes.
Better to have it defined in one place, so you can simply change a single line 
if it does, and using a variable means any typo will be caught (whereas a typo 
in a directory name might be silently accepted).

6:
I'd also point out that you've got an awful lot of single-use variables there. 
Variables are variable. You can change what they contain and don't need to keep 
creating new ones - you only need one or two ImageFileName variables there, 
which you mutate as you go through the code.

7:
Based on all this being inside if/len/trim, I'm thinking this is just a small 
part of a larger function, dealing with profile changing (or something like 
that).
If so, I definitely suggest breaking down the function into smaller 
self-contained sub-functions.
i.e. This logic should in be a processStaffPhoto function, with relevant 
arguments being passed in and the final filename being returned at the end, 
called by whatever the larger function is. Makes things significantly easier to 
follow and maintain.


There we go... happy to expand on anything here if you want more details. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346894
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Run a class file generated with CF outside of CF

2011-08-07 Thread Peter Boughton

It's Railo, that's r-a-I-L-o, not Ralio.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346568
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cffunction - initialize query as empty string or QueryNew

2011-08-04 Thread Peter Boughton

Sorry, yeah, that was worded badly.

I should have prefixed that with If you *always* use the local scope, you 
don't need var...


Annoyingly I can't go back and revise the message, and for some reason it got 
posted twice too. :/

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346517
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: left, right, mid? (no political content)

2011-08-04 Thread Peter Boughton

If the format is as simple as this, regex would be overkill.

Also, don't forget that list functions ignore empty delimiters (by default), so 
can just do:

cfset FirstNumber = ListFirst( CurrentLine , 'x_' ) /
cfset LastNumber = ListLast( CurrentLine , '_' ) /


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346551
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: left, right, mid? (no political content)

2011-08-04 Thread Peter Boughton

Uh, the original post states all have xx at the beginning.

I can only read that as two literal x characters, not some random value, and 
similarly the description of the format as xx-digits-underscore-digits seems to 
be pretty explicit.

Given the information provided, the results are entirely predictable. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346553
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cffunction - initialize query as empty string or QueryNew

2011-08-03 Thread Peter Boughton

It doesn't matter - CFML is not like Java (where you must pre-define variables 
with strict types). In CFML, variables can change types at any time.

If you're just var scoping a cfquery variable, it doesn't matter what you use. 
(I would guess using QueryNew might be ever so slightly slower - but I doubt 
it's significant, and wouldn't be surprised if the JVM optimized it away 
anyhow.)


You can avoid the pointless debate by using:

cfquery name=local.myQuery etc

If you're not on CF9/equivalent then you need a cfset var local = StructNew() 
/ immediately after any arguments.


~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346488
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cffunction - initialize query as empty string or QueryNew

2011-08-03 Thread Peter Boughton

With CF9 you don't need the var keyword anymore, and if you don't need 
backwards compatible code it's (arguably) clearer to not use it at all.

That means, do NOT use either of your examples, unless you _need_ a value in 
myvar1/myvar2 at the start.

Perhaps a good way to explain it is to use some sample functions... this is 
just a bit of nonsense code, but hopefully demonstrates the different ways to 
do it...


cffunction name=test_cf8_var
--- [imagine arguments here] ---
cfset var myVar1 =  /
cfset var myVar2 =  /

cfif Arguments.Something EQ whatever
cfset myVar1 = wibble /
/cfif

cfloop index=myVar2 from=0 to=10 
cfset myVar1 = Variables.Data[myVar2] /
/cfloop

cfif len(myVar1)
cfreturn myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction


cffunction name=test_cf8_local
--- [imagine arguments here] ---
cfset var local = StructNew() /

cfif Arguments.Something EQ whatever
cfset local.myVar1 = wibble /
cfelse
cfset local.myVar1 =  /
/cfif

cfloop index=local.myVar2 from=0 to=10 
cfset local.myVar1 = Variables.Data[local.myVar2] /
/cfloop

cfif len(local.myVar1)
cfreturn local.myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction


cffunction name=test_cf9
--- [imagine arguments here] ---

cfif Arguments.Something EQ whatever
cfset local.myVar1 = wibble /
cfelse
cfset local.myVar1 =  /
/cfif

cfloop index=local.myVar2 from=0 to=10 
cfset local.myVar1 = Variables.Data[local.myVar2] /
/cfloop

cfif len(local.myVar1)
cfreturn local.myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction



...does that make sense?

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346491
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: cffunction - initialize query as empty string or QueryNew

2011-08-03 Thread Peter Boughton

With CF9 you don't need the var keyword anymore, and if you don't need 
backwards compatible code it's (arguably) clearer to not use it at all.

That means, do NOT use either of your examples, unless you _need_ a value in 
myvar1/myvar2 at the start.

Perhaps a good way to explain it is to use some sample functions... this is 
just a bit of nonsense code, but hopefully demonstrates the different ways to 
do it...


cffunction name=test_cf8_var
--- [imagine arguments here] ---
cfset var myVar1 =  /
cfset var myVar2 =  /

cfif Arguments.Something EQ whatever
cfset myVar1 = wibble /
/cfif

cfloop index=myVar2 from=0 to=10 
cfset myVar1 = Variables.Data[myVar2] /
/cfloop

cfif len(myVar1)
cfreturn myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction


cffunction name=test_cf8_local
--- [imagine arguments here] ---
cfset var local = StructNew() /

cfif Arguments.Something EQ whatever
cfset local.myVar1 = wibble /
cfelse
cfset local.myVar1 =  /
/cfif

cfloop index=local.myVar2 from=0 to=10 
cfset local.myVar1 = Variables.Data[local.myVar2] /
/cfloop

cfif len(local.myVar1)
cfreturn local.myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction


cffunction name=test_cf9
--- [imagine arguments here] ---

cfif Arguments.Something EQ whatever
cfset local.myVar1 = wibble /
cfelse
cfset local.myVar1 =  /
/cfif

cfloop index=local.myVar2 from=0 to=10 
cfset local.myVar1 = Variables.Data[local.myVar2] /
/cfloop

cfif len(local.myVar1)
cfreturn local.myVar1 /
cfelse
cfreturn burp /
/cfif
/cffunction



...does that make sense?

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346492
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Committing Line by Line Changes?

2011-07-27 Thread Peter Boughton

As has been said, Git was built knowing that branching is an important task - 
and so creating and using branches is easy, fast, and flexible.

(I used to work on a large project that used SVN, and I had half a dozen 
checked-out copies because I often worked on multiple things and switching 
branches with SVN was so slow.)

I very much recommend the branching strategy Jonah linked to ( 
http://nvie.com/posts/a-successful-git-branching-model/ ), it might seem like 
overkill, but it really does make sense.


I'm also going to repeat a couple of things that have already been said, 
because I think it's beneficial to say them in a different way. :)


Git allows you to move all uncommitted changes to a temporary branch, and to 
retrieve again later, using git stash command.
Also, if you want to, you can convert stashes into real branches (with a single 
command).

See http://www.kernel.org/pub/software/scm/git/docs/git-stash.html for info.


Git allows changes to be staged in parts with git add --patch filename - 
this will step you through a list of changes in that file, and allows you to 
indicate if each change should be staged or not, as well as splitting each one 
into smaller changes.

I do this all the time, when I've got multiple unrelated changed that each 
deserve independent commit messages.
Once you understand what's happening, it's not hard to handle. (Unless the 
changes are not unrelated, but that's a different problem.)

Details at http://kernel.org/pub/software/scm/git/docs/git-add.html


Also worth pointing out, aside from those man pages, there's a number of good 
documentation sources for git:

http://www.kernel.org/pub/software/scm/git/docs/user-manual.html
http://progit.org/book (also available as a physical book)
http://book.git-scm.com 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346378
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: remove high ASCII chars from text

2011-07-11 Thread Peter Boughton

Jason wrote:
Text = reReplace(Text, [^\x20-\x7E], , all);

That'll also strip tabs, newlines and carriage returns, which probably isn't 
desired.

Use [^\t\n\r\x20-\x7E] to keep them.


However, this shouldn't be necessary - doesn't TinyMCE already have the ability 
to clean-up MS Word pastes? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:346185
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-29 Thread Peter Boughton

Hi Jenny, could you provide the address where I can send all future message 
drafts for you to verify if you will allow them to be on this list? Thanks! 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345896
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-29 Thread Peter Boughton

My reply to Rick was not condescending, since to be so requires intent, and 
there was none.

My aim with all my responses to this list is to be helpful and try to make the 
web a better place. I try to write replies keeping in mind that the post may 
well be used as a reference by others - erring on the side of lack of knowledge 
is usually the better option since you never know who might later be reading 
it, in addition to the person being responded to.


At time of writing, the post was four times the average post length, and 
followed on from a focused reply of I want continuous updates; that's what 
you've got to wandering across the whole spectrum of the topic being covered 
here. That constitutes long and rambling for me, and - in case you missed it - 
that line was terminated with a big fat tongue, to specifically suggest the 
tone to interpret with.

I'm not sticking my head in the sand, I'm doing the complete opposite: I'm 
saying take some time to read about HTML5 from authoritative sources, and 
you'll see it really is becoming all the things you want - a continuous 
standard that the browser vendors are actually working towards implementing; we 
really are in a better place than ten years ago.

I never said we should not be pressing for better browsers - I very much 
dislike *all* browsers; they all suck in different ways, (and I'd love to have 
the resources to do something about that).

And yes, these days, even Microsoft have actually been making efforts, with IE9 
- it's still far from perfect, but compared to previous versions it's a great 
improvement.

If there's any particular or general view which you (or anyone) feels I have 
missed, please feel free to re-iterate it and I'll address it directly.

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345897
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: complex string split

2011-06-29 Thread Peter Boughton

This is slightly more efficient:

REMatch( '[^]+|\S+' , value )


The difference is probably insignificant here, but as a general rule a negated 
greedy match is a better choice than a wildcard lazy match.

(The second half is no different, just makes it more readable.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345899
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-29 Thread Peter Boughton

 when one programmer decides to do a mass search and replace and totally 
 destroys a code base, then management directs you to do it by hand.

That's because management doesn't know that the correct response to that was:

1) why didn't they check it on their local machine before committing?
1) why were the errors not picked up during code review?
2) how did any of this get past testing? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345902
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-29 Thread Peter Boughton

( Although the management can probably at least count to three correctly. :$ ) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345903
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-29 Thread Peter Boughton

Heh, whilst I guess I can see :P being exhaustion, it's always been a 
teasing/playful emote for me (which is also how Wikipedia defines it: tongue 
sticking out, cheeky/playful).

And yeah, I wasn't offended by anything from you - but I did dislike being told 
that I effectively wasn't allowed to post because someone else mis-interpreted 
the tone of one of my replies to you.

Anyway, hopefully that's enough of that nonsense and we can get back to the 
technical stuff.


...wait a second, did you just call me big boy!? I am *highly* offended by 
your implication that I am fat! Grrr!

:) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345923
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Double Quote issue

2011-06-25 Thread Peter Boughton

Don't built dynamic queries with user-supplied data, unless you like exposing 
yourself to SQL injection.

cfquery name=myQuery datasource=myDatasource
SELECT value
FROM table1
WHERE id = cfqueryparam value=#url.param1# /
/cfquery

And url.param1 can contain as many single or double quotes as you like without 
causing any SQL issues at all. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345666
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-25 Thread Peter Boughton

I'm doing a lot of detection and loading code and style
sheets based on what browser is being used, but it's a steady pain to
keep up with what works and what doesn't.

That's why you shouldn't do browser detection, you should do feature detection.

For HTML5, here's a guide to doing that:
http://diveintohtml5.org/detect.html


When I get really grumpy,
my urge is to just feed a text based site to anyone using IE with a
note at the top that says if you want to see the pretty stuff, get a
real browser.

Again, with sensible feature detection you will return a site that is as pretty 
as IE can handle, but without the extra frills.

Ultimately, *any* browser with all scripts/styles/images/etc disabled should 
receive a usable text-based site.

Of course, I very much agree with displaying a get out of the dark ages 
message to anyone running IE6 (or earlier). 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345668
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-25 Thread Peter Boughton

We need some sort of continuously updated standard with
more nimble browser updating, as well.

That is *EXACTLY* what HTML5 is now - an evolving standard which you CAN use on 
the desktop right now (if you do things correctly; detect features not 
browsers).

http://html5doctor.com/how-to-use-html5-in-your-client-work-right-now/


Also:
 The WHATWG HTML spec can now be considered a living standard. 
 It's more mature than any version of the HTML specification to 
 date, so it made no sense for us to keep referring to it as 
 merely a draft.
From http://blog.whatwg.org/html-is-the-new-html5

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345673
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Double Quote issue

2011-06-25 Thread Peter Boughton

Richard wrote:
 the issue here is that there are various filters being built up from 
 different functions which is why we are having to do it as a string 
 and not directly inside a cfquery tag.

The issue here is that you are trying to use cfquery in a way it wasn't 
designed to be used, which is why you're having trouble trying the get the 
language to support your craziness. :)

If you want to work with SQL-based databases, you have to work with queries - 
which in CF means using cfquery and cfqueryparam with individual queries, not 
trying to build up the statement from parts of strings scattered all over the 
place.

If you want a more filter-based approach, you want to use something that is 
built around filtering, which (I think) is one of the main benefits of CouchDB 
and similar.

Depending on exactly what you're doing, I'd probably just put the entire query 
in a single function, and use suitable arguments and switch/if statements to 
control what parts of the where clause is used, which is very likely to be more 
maintainable than having filters in different functions. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345689
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Need some perspective...

2011-06-25 Thread Peter Boughton

I don't quite see it that way, Peter.

 ...

It's been a long week...

And a long rambling post, which seems to be missing the points I was making. :P


The W3C will always be doing the major milestone nonsense, because they're a 
big bureaucratic organisation that does stuff like that.
That's *why* the WHATWG was created and ditched all the XHTML nonsense.

Oh, and there's a reason the WHATWG was founded by Mozilla, Opera, and WebKit. 
The browser vendors *don't* have an interest in HTML incompatibilities - 
there's no benefit to it, and it's not how they're marketing themselves.
If they were making money from browsers then they might fix it all sooner, but 
at least we are converging towards it, and it's a good thing people don't need 
to pay money to get better browsers.


Just because SitePoint are crap at doing books/tutorials/titles/whatever 
doesn't mean that HTML5 and CSS3 can't be used.

Even if it all doesn't work in IE9, it doesn't matter - you don't care what 
works in which browsers!
You do feature detection so users with most advanced browsers have the best 
experience, and everyone else has a good enough experience.
Of course, if a particular feature will take time to implement, it's worth 
checking who currently/soon supports it, to make sure the work isn't a waste of 
time because nobody can use it ( see http://caniuse.com ), but on the whole 
stop worrying about supporting particular browser versions.

Mobiles add small screens, zooming, and rotating screens to the mix, but beyond 
that they're not really bringing anything new.
And there's no reason why you can't have a distinct mobile site, if your main 
site has features which don't translate well.


Anyway, if it has been a long week you should stop worrying about all this and 
relax a bit - that's exactly what weekends were designed for. ;) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345693
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-24 Thread Peter Boughton

well any variable has to be #text# with no spaces

No it doesn't. If you felt like it, you could do...

#
   text
#

That is perfectly valid and works on all the CFML engines.

However, even if a valid assumption for the codebase in question, trying to 
match a hash followed by spaces would results in matching...

#text# this #text#

Which is obviously not desired. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345617
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-24 Thread Peter Boughton

I would start by finding/escaping identifiable single hashes - i.e. the font 
colours and HTML entities.

Using a regex search that supports lookbehind (so not CF itself, but ok with 
CFEclipse/CFBuilder) you can do:

(?!#)#(?=[A-F0-9]{3,6}\s*+[';])

Which assumes colours must end with  or ' or ; which I think covers both HTML 
attributes and CSS use.

For HTML entities:

(?=)#(?=\d+;|x[A-F0-9]+;)


Oh and # parts in links... something like:

(?=\.(ht|cf)ml?)#(?=[^#']++['])



Those three are all written to just match the # itself, so you can replace with 
## and it should work. (Obviously make sure you have a backup of the code 
before changing anything though.)

Once all the known single hashes are escaped, I'd just attempt to compile all 
the templates using cfcompile, and see what errors crop up from that. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345618
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-24 Thread Peter Boughton

Steven wrote:
 From what I've been reading so far I think this regex should work:
 [^#]#[a-fA-F0-9]{3,6}
 If I'm correct it would pick up #FF3366 but not ##FF3366.

That will not just pick up #FF3366 it will *also* pick-up the character before 
that (either space, colon, quote, etc).

If you are simply identifying matches, that doesn't make a huge difference - 
however, it also means you need to manually fix matches, which is boring.

I explicitly used a negative lookbehind to exclude any preceeding hash without 
also matching any characters, so that they can be escaped automatically with a 
simple search/replace.


(You only need the a-f part if you are doing a case-sensitive match/replace - 
given that this is as simple as ticking/unticking a checkbox in an IDE, I 
didn't bother with that in any of my expressions.)


If you really want to use your CF application for this, you can easily access 
java regex (which supports lookbehinds) by doing:

NewString = OldString.replaceAll('regex','replacement')

Which probably means you spend much less time manually escaping colours 
everywhere. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345644
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-24 Thread Peter Boughton

Ray wrote:
 Here is a crazy idea - wouldn't what you are looking for be a runtime
 error? If so - can't you use the Code Analyzer in the CF Admin to scan
 the folder and find them all at once?

Guessing you meant to write compile-time there (since that's where the error 
is; when compiling the template it'll find incorrect syntax, without needing to 
run it).

This is what I meant when I said use cfcompile - forgot there was an admin 
interface that did it.

Of course, I guess this will stop at the first error in each file, so it will 
need to be executed multiple times until no errors are reported. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345645
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Problem with pound signs

2011-06-24 Thread Peter Boughton

Of course, however you do this, you'll want to make sure you don't 
inadvertently escape colours/etc that are *not* inside cfoutput (or any tags 
that emulate cfoutput; cfmail, cfquery, etc). 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345646
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFCONTENT in the background?

2011-06-16 Thread Peter Boughton

Use cfdocument not cfcontent.

Documentation at:
http://cfquickdocs.com/cf9/#cfdocument 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345366
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFCONTENT in the background?

2011-06-16 Thread Peter Boughton

Ah wait, sorry, didn't read the message properly.

The answer is to use filename attribute of cfdocument - this saves the file on 
disk, and doesn't send it to the browser. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345367
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Regular Expression Help

2011-06-14 Thread Peter Boughton

Give this a go:

cfset Result = InputText.replaceAll
( '~\{(?:(?!/a).)+(?!\}~)(?=/a/li)'
, '$0}~'
) /


It uses the java replaceAll regex function so that it can do the negative 
lookbehind to ensure existing correct items are not changed, meaning it can be 
run multiple times.

Accepts any character (except newline) until it finds a closing A tag.

If newlines are required, that's just a one character change:

'~\{(?s:(?!/a).)+(?!\}~)(?=/a/li)'

(Which adds the 's' flag into what was a non-capturing group, meaning '.' also 
matches newlines.)


If there's the possibly of a '~{' appearing outside this context, it may need 
extra limits applied to work correctly.

Assuming there should not be any tags inside the ~{...}~ part, I would change 
the '.' for a '[^]' which makes it a bit 'safer':

'~\{(?:(?!/a)[^])+(?!\}~)(?=/a/li)' 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345282
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Fuseguard processing time

2011-06-13 Thread Peter Boughton

 200ms is still a good page load time.
Not when the original was 20ms!

A page that takes 0.2s to load is no longer instant, there's a detectable 
delay, which isn't good.



Does it really take 145ms to check for SQL Injection? :/

What's it doing that takes that long!? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345228
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Homesite 5.5

2011-06-13 Thread Peter Boughton

 After punching all that data in I was walking to the 
 card reader with them in one huge stack and I tripped... 

I've heard a similar story a few times, and I don't get it.

If I had a large stack of cards, especially one that had to stay ordered, I'd 
get a piece of string and make a quick bundle, and then you remove the risk of 
them separating in transit.
Alternatively, a simple box would probably work - I assume cardboard boxes had 
been invented back then? :P

Of course, the less high-tech solution is to just look where you're going and 
not be clumsy. ;) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345230
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Fuseguard processing time

2011-06-13 Thread Peter Boughton

Well ideally you have a non-development staging server, which closely mimics 
your live production server, against which you can run load testing to help 
determine this.

The other question is, how secure is your code? If it's riddled with 
vulnerabilities then it might be safer to take this hit, at least until you can 
solve the various issues, rather than take the risk of someone exploiting your 
site. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:345243
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: RegEx Question

2011-05-20 Thread Peter Boughton

Not only can you do it with jQuery, you /should/ do it with jQuery (or equiv).

Regex is not built for HTML parsing, and there are many reasons why it wont 
work correctly when you try. Rather than worry about numerous edge cases, use a 
tool designed for the job from the start.



~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:344746
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: What does this URL mean?

2011-04-10 Thread Peter Boughton

Here's a page which explains how URLs are made up: 
http://hybridchill.com/anatomy-of-a-url.html

And here's how your URL divides:

Protocol = http
Server = //localhost
Script Name = /students/index.cfm
Path Info = /register
Query String = action=studentreg

It's possible (but unlikely) that students is a context not part of the 
script name.
It's also possible (but even more unlikely) that index.cfm is a directory name 
and register is the script.

If you're running the code yourself, you can open up index.cfm and do...

cfdump var=#cgi# /cfabort/

...and you'll see the various variables including those mentioned in the page 
above.


Especially in the past, a lot of things used the Query String (which starts 
after the first ?) for things which *should* have used Path Info - mostly 
because Path Info was neither properly understood nor implemented in many 
servers, and server-side languages didn't make it as easy to work with as with 
query string.

Path Info was designed for identifying which file to display (different to 
which script to process with), whilst Query String was intended for querying 
(searching) in some way. Because it was easier, nearly everyone lumped 
everything into the query string.

There is no default format or imposed use to Path Info, so it is entirely a 
case of how the developer implemented it.

It's possible it could be used for an application name, but I've never seen 
that done.
It's likely to be the name of a page or section, which may or not be stored in 
a database. I've not encountered any CMS that constructs URLs in the way of 
your URL.

Due to the intended purpose of the Query String, early search engines initially 
ignored everything after a ? when spidering URLs, but when Google arrived on 
the scene, it wasn't long before they had started working out which variables 
in a query string identified pages.
At some point, a fad started of moving ALL variables (including ones which 
*should* stay in the query string) into the Path Info section, and claiming 
this was search engine friendly or search engine safe. (I'll try to avoid 
ranting on how stupid both these terms and practise is.)
Mostly outside the CF community, people were already achieving the same thing 
using URL rewriting (using Apache mod_rewrite, IIS ISAPI rewrite, or similar), 
which treats everything after the Server before the Query String as a single 
virtual path, converted into a script name and (potentially) query string 
variables - which meant there was no need for index.ext to be used.
This is generally called things like pretty URLs, vanity URLs, or similar 
terms - which more accurately reflect that they are (should be) done for HUMAN 
benefit (not search engines).


That's starting to drify off the original topic though, so I'll stop now... I 
think I've covered everything, and hopefully this all makes sense? Let me know 
if anything I've written is unclear? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:343639
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: REGEX hell

2010-11-25 Thread Peter Boughton

In this situation, there is no real difference between lazy or greedy - because 
the quantified item is mutually exclusive with the next characters - i.e. \s+ 
cannot match \) - so it will always consume to the end of the whitespace.

It is better to not assume lazy or greedy as a 'default' and always decide 
which one makes sense for the current scenario. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339535
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: REGEX hell

2010-11-25 Thread Peter Boughton

To be clear, CF uses the Apache ORO library, which is different to both Perl 
and Java Regex. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:339536
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Highlighting non-standard ASCII characters?

2010-10-05 Thread Peter Boughton

Hmmm, although it works that code is not quite correct - there's a few issues 
with it.


 If you don?t mind characters like ñ, then just use \w instead of A-Za-z0-9_

This is *incorrect* - in ColdFusion regex, \w does NOT include accented 
characters. There are other regex engines where it does, but the Apache ORO 
used by CF doesn't. (Unless that's changed with CF9 anyhow, but I suspect not..)


There are several unnecessary escapes since .?() do not need escaping inside 
classes.
(However, if '-' wants to be included (it's not currently) then it should be 
escaped as '\-' so it's not treated as a range.)


By including \s you're not just saying space, you're *also* including \r and \n 
and \t and \v. So either just use a literal space (to avoid tabs) or to allow 
tabs don't specify the \r and \n since they're just adding noise.

[^\w\r \n!.?''(),;:] or [^\w\s!.?''(),;:]


Outside of the character class, the outer group is redundant - regex already 
captures the match to \0 so just do:

rereplace( str , '[^\w\r \n!.?''(),;:]' , 'span class=highlight\0/span' 
, 'all' )


And finally, one more optimisation - to avoid a long series of HTML spans, just 
add a + to collect multiple characters together:

rereplace( str , '[^\w\r \n!.?''(),;:]+' , 'span 
class=highlight\0/span' , 'all' )


Hope this helps. :)

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337854
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Beta Testers Wanted - TrafficMunkey - A New CF Framework

2010-10-05 Thread Peter Boughton

I went to go take a look at it, and got to the download page...

Apparently I have to sign an SLA and NDA to download it?

Screw that. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:337855
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Can I tell CF to dump me all run query names?

2010-09-07 Thread Peter Boughton

Depends how you've scoped them. Here's a quick example if they're unscoped:

cfloop item=CurVar collection=#Variables#

cfif isQuery(Variables[CurVar])
cfdump var=#Variables[CurVar]# label=#CurVar# /
/cfif

/cfloop

If you've got multiple scopes used, and/or function local ones, then use a 
debugging template instead. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336849
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Checking arrays for any values

2010-09-06 Thread Peter Boughton

It's not clear what you're trying to do.

Can you post examples of each type of value it might contain, and whether that 
is considered true/false?

(It's probably still simplest to step through the array and check each value 
though.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336832
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Checking arrays for any values

2010-09-06 Thread Peter Boughton

In CF9, Adobe have (finally) added the ArrayFind function, which simplifies 
that code.

(Also available in OpenBD v1.3 and above, and in Railo since early days.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336835
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFParam vs. IsDefined

2010-09-02 Thread Peter Boughton

 That coupled with StructKeyExists is a pain to type!

Why on earth would you *type* it!?

This is exactly why your IDE has Word Completion, Snippets and Templates!

Str then Alt-/ completes word to StructKeyExists
(press Alt-/ again to cycle through other commonly used words)

ske then Ctrl-J snippet for StructKeyExists([cursor])

skel then Ctrl-Space,Enter to select a template:
StructKeyExists([Struct],'[Value]') AND Len([Struct].[Value])


(All this stuff is one of the things I keep meaning to write a full blog 
article on... if anyone is interested let me know and I'll try getting to it 
sooner, and post details here once done.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336748
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFParam vs. IsDefined

2010-09-02 Thread Peter Boughton

Oh, just to point out, ske and skel are custom ones I've created. They're not 
default commands.

Shortcut keys may vary too. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336749
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFParam vs. IsDefined

2010-09-02 Thread Peter Boughton

This must be a CFEclipse thing as CFBuilder is CTRL-SPACE

That's code completion. Word completion is faster (when you know what you want).

These are all Eclipse things (and will exist in any other IDE worth using), so 
available for both CFEclipse and CFBuilder. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336751
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFParam vs. IsDefined

2010-09-02 Thread Peter Boughton

Hmmm, maybe they've changed the default.

Goto WindowsPreferences and type keys in the filter box.

That should bring the key binding panel, type word in that.

Look for Word Completion option(s) and it'll list what the binding is.

If it still doesn't work, check the When value - I've got one Editing Text 
and one In Windows. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336754
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Using ## vs not using ##

2010-09-02 Thread Peter Boughton

just a quick test, please ignore

(sorry for the noise) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336767
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: CFParam vs. IsDefined

2010-09-01 Thread Peter Boughton

I prefer to CFParam my vars with a default value of a zero len string or a 0
for numeric values. Then I skip the isdefined and just test against the
value. Well recently someone I know said that it's better to test if it's
defined. Is there a pro or con to doing it my way vs. IsDefined ?

There is a difference between a value being undefined, and a value being zero.


Consider the following (contrived) example:

cffunction name=convertToKelvin returntype=Numeric output=false
cfargument name=Celsius   type=Numeric default=0 /
cfargument name=Farenheit type=Numeric default=0 /

cfif Arguments.Celsius NEQ 0
...
cfelseif Arguments.Farenheight NEQ 0
... 
cfelse
cfthrow message=Invalid arguments/
/cfif

/cffunction


vs


cffunction name=convertToKelvin returntype=Numeric output=false
cfargument name=Celsius   type=Numeric required=false /
cfargument name=Farenheit type=Numeric required=false /

cfif isDefined('Arguments.Celsius')
...
cfelseif isDefined('Arguments.Farenheight')
... 
cfelse
cfthrow message=Invalid arguments/
/cfif

/cffunction

(Using cfargument/default is equiv to using cfparam/default.)

Unless you can say with certainty that blank/zero is identically equivalent to 
undefined, you should always check for existance (using either isDefined or 
structKeyExists as preferred) instead of setting a default. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336728
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Using #### vs not using ####

2010-09-01 Thread Peter Boughton

It'll have a (very very minor) impact on the first load.
I'd be surprised (and dissappointed) if it wasn't optimised away after that.


However, don't forget Human performance impact - if it takes an extra 0.5 
seconds to decipher whether it just says varName versus #varName#i (or 
similar), then it's better to correct it. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336731
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Using ######## vs not using ########

2010-09-01 Thread Peter Boughton

Hmmm, I'm guessing the web interface to cf-talk is doing double escaping or 
something bad. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336732
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: optimizing CFIDE for cfform

2010-08-31 Thread Peter Boughton

However don;t forget that these files are only loaded once and then are
cached by the browser.

Not guaranteed in all cases, and also the first impression can be the most 
important one, so definitely worth looking at a custom solutionm based on 
jQuery (or other established framework)

Also, making use of a good CDN (like Google's) for hosting the JS files might 
mean the files are cached before even the first visit to a site. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336682
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: sending a form through CF and catching the results

2010-08-27 Thread Peter Boughton

Josh, you're missing the point entirely.

Converting from CSV-Query makes sense and wasn't being questioned.

Using the cfhttp tag to do the conversion is what's crazy.

There is no sensible reason for requiring CSV conversion to go via HTTP - since 
the vast majority of the time this isn't necessary/desired - having a dedicated 
cfcsv tag and/or CsvParse function would have made sense.


As I said, we'd need to ask the relevant developers why the decision to tangle 
the CSV functionality with cfhttp was made.


(Rick, I used Adobe as shorthand; not to exclude Macromedia or Allaire.) 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336610
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Number of site using ColdFusion

2010-08-26 Thread Peter Boughton

 To use an analogy, just because trillions of flies eat manure, does 
 that mean we ought to?

Directors don't care if developers eat shit, once they get the job done quicker 
and cheaper.

There's also the quote Nobody ever got fired for using #IndustryLeader#.

Which isn't particularly helpful, but is easy justification for someone wanting 
to go a particular way.


My point being, Robert needs *useful* counter points, not just soundbites. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336564
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: sending a form through CF and catching the results

2010-08-25 Thread Peter Boughton

Don't specify the columns attribute, it is not needed, and obviously doesn't 
work.

(The columns attribute is part of cfhttp's csv parsing ability. Why cfhttp does 
CSV parsing instead of having dedicated CSV functions is something only Adobe 
can tell us.)


Use the cfhttpparam tags to send through formfields.

If you don't know what form fields there are, load the first page with cfhttp 
(where the form is), run the results through a HTML parser (you can use 
XmlParse if it's valid XHTML) and extract a list of fields to send with the 
second cfhttp request. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336514
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Number of site using ColdFusion

2010-08-25 Thread Peter Boughton

Anyone have a reliable reference to how many sites may are using ColdFusion?

Why do you want one? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336523
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: sending a form through CF and catching the results

2010-08-25 Thread Peter Boughton

Oh and name is incorrect attribute too.

Should be result to change the default 'cfhttp' variable name.


There's a lot of hidden fields you probably need to pass in - here's some code 
that will get you a step closer.

(Note how the cfhttp tag only has URL and METHOD attributes - nothing else is 
needed for standard behaviour like this.)

cfhttp method=POST url=https://jobs.umd.edu/applicants/Central;
cfhttpparam type=FORMFIELD name=searchDelegate  
value=searchDelegate /
cfhttpparam type=FORMFIELD name=actionParameter value= /
cfhttpparam type=FORMFIELD name=windowTimestamp 
value=PA_1282756650239 /
cfhttpparam type=FORMFIELD name=collegeDivision value=20 / 
!--- 20 is value for SPHL - School of Public Health ---
cfhttpparam type=FORMFIELD name=searchType  value=8192 /
cfhttpparam type=FORMFIELD name=formAction  value=goSearch /
cfhttpparam type=FORMFIELD name=button_goSearch value=Search /
/cfhttp

cfdump var=#cfhttp# /

The URL I'm using there is taken from the form's action attribute.

It returns a 302 instead of search results - probably because there's still 
some missing fields or it doesn't like the windowTimestamp or whatever.


But all of this seems to be a waste of effort - is there a reason you can't 
just ask the guys who created this to do one specifically for your department? 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336524
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Number of site using ColdFusion

2010-08-25 Thread Peter Boughton

To respond to an IT director who thinks ColdFusion is dated and not in much
use anymore... 

Well if he's determined, he'll just return with how many sites run on PHP or 
.NET or whatever.

Numbers don't help for CF - what you need to demonstrate is how active and 
passionate the community is.

A recent post by Terry Ryan might help there:
http://www.terrenceryan.com/blog/post.cfm/dear-coldfusion-denier

One specific point Terry makes:
 check out the list of ColdFusion conferences.
 A third of them are new conferences and have 
 popped up over the past 3 years.


He's got another posting linked from that one, which has this Cost of 
Ownership image:
http://www.terrenceryan.com/blog/assets/content/toc.png

Basically showing that CF requires less training, less dev time and less 
maintenance.


I think that sort of thing should be more useful than numbers. 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336528
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: RegEx: Grabbing Keywords from Referers

2010-08-24 Thread Peter Boughton

cfset keywords = reMatchNoCase([?|][p|q]=[^]+, referer)

This is incorrect - the | is a literal in character classes.

You want [?][pq]=[^]+ 

~|
Order the Adobe Coldfusion Anthology now!
http://www.amazon.com/Adobe-Coldfusion-Anthology-Michael-Dinowitz/dp/1430272155/?tag=houseoffusion
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:336489
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Coldfusion SQL Hack

2010-03-22 Thread Peter Boughton

That's not SQL injection, it's HTML injection. (Or XSS as the fashionable term 
is).

You need to use HtmlEditFormat (or similar function) to ensure all content 
output to HTML pages gets appropriately escaped.

(If you need to allow certain HTML, escape it all, and then unescape only the 
safe whitelist.) 

~|
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:331933
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: Make HomeSite+ Open Source? (WAS: RE: Development Apps - Does anyone use homesite still?)

2010-03-09 Thread Peter Boughton

There's little point in making it Open Source.

It might be a nice gesture from Adobe, but it's hard enough finding CF 
developers willing to do Java; finding a Delphi developer willing to support 
HomeSite would be even worse!

For the people that like Homesite, there's nothing wrong with continuing to use 
it, once you don't mind a lack of updates.
(This is assuming the updates are some form of proprietary/binary format; if 
they are text-based then the CF9 stuff yourself!)



 I tried CFECLIPSE and I tried the beta version of
 Adobes CF developer thing.  Both are nice, both are 
 a drain on system resources, slow, and bloated.

Yep, CFEclipse and CFBuilder *are* slow and bloated - because they use the 
Eclipse platform, which is slow and bloated.

It *might* be possible to produce a minimalised/streamlined Eclipse base with 
just the required stuff in - but there are so many other things that CFEclipse 
needs first, and only a limited number of people able to spare a limited amount 
of time to work on improving it.

The great thing is that if people want CFEclipse to be better, they can help to 
make it better!

You do NOT need to know Java to help with CFEclipse - there's plenty of other 
tasks that can be done, and doing those will mean that the Java developers can 
concentrate on the Java tasks, and thus everything improves.

So, if there's things you don't like about CFEclipse (either bugs or feature 
requests), raise them on the issue tracker - problems can't be fixed if they're 
not known!

And, if you want to speed their resolution, pop on to the mailing list ( 
cfeclipse-us...@googlegroups.com ) and see if you can help out - either 
directly working on them, or indirectly (by improving other areas), and 
hopefully it wont be long before we've all got a great IDE! 

~|
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:331480
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: calling a template but not waiting for it to finish running

2010-03-09 Thread Peter Boughton

Read up on threading, which CF implements with the cfthread tag. 

~|
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:331481
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/groups/cf-talk/unsubscribe.cfm


Re: coldfusion for medical research

2010-02-15 Thread Peter Boughton

You'd be best talking to your local Adobe rep about this.

Something on this page will probably give details for that: 
http://www.adobe.com/support/contact/


If Adobe can't provide you with a price you're happy with, you might want to 
consider Railo (http://www.gerailo.com) and OpenBD 
(http://www.openbluedragon.org) as possible alternatives.


~|
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:330733
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 List Multiple Charecter Delimiters

2010-02-12 Thread Peter Boughton

Do this:

cfloop index=i array=#variables.exampleList.split('oat')#
...
/cfloop 

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


Re: SOT: Preventing Link-Builders

2010-02-12 Thread Peter Boughton

 If they are clicking on the email links as well, that's pretty
 advanced..

No its not. It's simple.

A small challenge for a general purpose one, but trivial if you're targeting a 
specific site/application.

If you know how to use cfpop, rematch and cfhttp, you can throw an email 
validation link clicker together in mere minutes.


For beating captchas, it depends on how complex they are: a lot of them can be 
beaten by OCR, and the rest can be beaten by cheap labour in eastern 
europe/russian/etc.




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


Re: REReplaceNoCase and dynamic query columns

2010-02-02 Thread Peter Boughton

Is it possible to dynamically evaluate the temp variable from the
regular expression and use it as a ColdFusion variable?

It's not a temp variable from the regular expression, it is a variable which 
exists *within the scope* of that regular expression.

That's important to understand - given this expression:

REReplaceNoCase(REQUEST.theURL, '%%(\w+)%%',
#REQUEST.myQ[/\1][1]#, 'ALL')

The CF expression is evaluated *before* the regex does its stuff, and thus the 
\1 never enters the regex 'scope', and doesn't gets treated as a regex 
back-reference.

(hope that explanation makes sense?)

Depending on if/how you want to handle invalid columns, one solution which wont 
cause errors is to simply loop through the query column names, like so:

cfset Request.Final = REQUEST.theURL /
cfloop index=CurCol list=#REQUEST.myQ.ColumnList#
cfset Request.Final = 
replace(Request.Final,'%%#CurCol#%%',REQUEST.myQ[CurCol][1],'all') /
/cfloop

That will mean that any mis-named columns are still in the string - so you may 
want/need to look for remaining %% in the string and behave appropriately.


But, going back to the regex solution for this - which can be more flexible, 
and is definitely worth knowing - the way to do this is to use a regex replace 
function which allows you to pass a function as the third argument.

Afaik none of the three main CFML engines allow this (yet), but I do have a CFC 
that enables assorted regex features, including passing a function:
http://hybridchill.com/projects/jre-utils.html

Once you've created the object (named jre below), you can then do:

cfset REQUEST.final = jre.replace( REQUEST.theURL , '%%(\w+)%%' , MyFunction , 
'all' ) /

Then, you can create a function (see the callback function example at the 
above link) named MyFunction and return this:
cfreturn REQUEST.myQ[ Arguments.Groups[1] ][1] /

And that should all ultimately work as you were going for initially.


Hopefully all this makes sense - let me know if any questions/etc. :) 

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


Re: (ot) Mailing lists and/or support forums for PHP

2010-01-27 Thread Peter Boughton

Beehive Forum is the best forum software, and it happens to be PHP. :) 

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


Re: (ot) Mailing lists and/or support forums for PHP

2010-01-27 Thread Peter Boughton

I really love how people do not read the post in question.

Huh?

I did read the question.

Looking back it seems both Sebastiaan and I misread the (badly structured) 
second paragraph in the post and assumed he was asking for a software package.

The subject and question are both ambiguously worded, so it's an easy mistake.

Anyway, I'll go answer for what he was really asking for... 

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


Re: (ot) Mailing lists and/or support forums for PHP

2010-01-27 Thread Peter Boughton

Don't limit yourself to looking specifically for a PHP community.

Go for a general programming community, to learn concepts in a general fashion, 
and (if necessary) then use the PHP manual to learn specific syntax/etc. 
(Although most general communities will have PHP users anyway.)

And for that, Stack Overflow (http://www.stackoverflow.com) can be a good 
source of knowledge - you do need to be wary of quick-but-inaccurate answers 
from people hunting for points - but (once you're not asking something obscure) 
you'll likely have a good answer within 24 hours. 

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


Re: (ot) Mailing lists and/or support forums for PHP

2010-01-27 Thread Peter Boughton

Well I can't comment on how good the PHP devs are, but in general SO users tend 
to figure out the intent fairly well - and it has the benefit of allowing edits 
and comments to clarify things further.

One way to test how well (any) community works: ask a question you've already 
figured out, maybe even being deliberately vague, and see how good the 
responses are. :)


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


Re: regex

2010-01-26 Thread Peter Boughton

That'll probably be matching against the full hostname, so try this:

RewriteRule /[\w-]+/$ index.cfm\?name=$1 [NC,L]


Also might be necessary to escape the slashes, so if that doesn't work give 
this a try:

RewriteRule \/[\w-]+\/$ index.cfm\?name=$1 [NC,L]

(Another thing you could try is using \z instead of the $, i.e. /[\w-]+/\z but 
I doubt that's the problem.)

Oh, and I'm not sure if you need to escape the question mark in the second 
part? Try just index.cfm?name=$1 for that. 

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


Re: regex

2010-01-25 Thread Peter Boughton

The only punctuation that \w matches is underscore.

To match hyphen also, use [\w-], which then gives the expression /[\w-]+/

(To match hyphen but not underscore [a-zA-Z0-9-] is what you want)

NOTE: The hyphen must be first/last in the class, or be escaped with a 
backslash.

To specifically ignore /images/filename.jpg you need to ensure the second 
slash is at the end of the string, (and the opening slash at the start), so use:

^/[\w-]+/$ 

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


Re: Not Able to Get Trim Function to Work

2010-01-25 Thread Peter Boughton

What Justin should have put was this:

WHERE somefield = cfqueryparam value=#trim(form.field)# 
cfsqltype=cf_sql_varchar/

Always use cfqueryparam for user-supplied query values!


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


cfpdf / merge (CF8.0.1)

2010-01-21 Thread Peter Boughton

We have some pretty simple CF8 code, to merge individual PDFs into a single 
document:

cfdirectory action=list
directory=#Application.PdfDir#
filter=#Attributes.RunId#*.pdf
sort=asc
name=pdfList
/

cfif pdfList.RecordCount 
cfpdf action=merge 
destination=#Application.PdfDir#\merged_#Attributes.RunId#.pdf 
overwrite=yes
cfloop query=pdfList
cfpdfparam source=#Application.PdfDir#\#name# 
/cfloop
/cfpdf
/cfif

This code has been working fine for months, until last night, when it has 
started giving the message: could not find %%EOF


Anyone have any idea what might be causing this, and how to fix it?


Thanks,

Peter 

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


Re: cfpdf / merge (CF8.0.1)

2010-01-21 Thread Peter Boughton

Turned out the source PDFs were corrupt/truncated, due to that damned 64000 
byte default on the datasources. (I'm almost certain I'd changed that, but oh 
well.)

Anyone have suggestions on a nice way to throw an error when the data is 
truncated? (rather than silently failing at that point and erroring later on.) 

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


Re: cfpdf / merge (CF8.0.1)

2010-01-21 Thread Peter Boughton

Nah, I was hoping for a check at the insert stage.

I guess something like:

cfif SizeOfData(PdfData) GT CFAdmin.Datasources['PdfStorage'].MaxBlobSize
[throw error]
cfelse
[insert data]
/cfif

A long-winded alternative would be, after the insert, to do a select, write 
file, then IsPDF on that, but that seems a bit of an ugly way of doing it.

But that's a fair bit more effort compared to checking numbers.

Maybe a better solution would be a check onApplicationStart that looked at all 
the datasources and made sure they had suitable settings - again, that would 
need to use cfadmin api stuff - can't remember if that is in CF8 or only CF9? 

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


Re: Recent SQL Injection attacks

2010-01-14 Thread Peter Boughton

The qpscanner is ok in general but I want something that will only get
me numeric variables that are not in a cfqueryparam.

That is not enough to protect you!

It is not hard to create injection attacks that bypass CF's auto-doubling of 
quotes.

qpscanner deliberately errs on the side of paranoia, because it only takes one 
small hole for an attacker to get in and cause havoc. 

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


Re: Recent SQL Injection attacks

2010-01-14 Thread Peter Boughton

I think there's at least one or two more too.  I should really make a
note of them somewhere...

Charlie Arehart's list.

Pretty sure he's got all this listed in a security/similar category.


Yep, here we go:
http://www.carehart.org/cf411/#testing 

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


Re: Looking for Select Full Tag Functionality in Aptana / CFECLIPSE

2009-12-21 Thread Peter Boughton

1) Does this functionality exist in the newer versions of the Aptana /
CFECLIPSE IDE?

Not afaik.


2) If not, then is there some similar type of functionality that will allow
me to select an entire tag and perform an indent / outdent?

You can use jump to matching tag to identify the appropriate one.
In the latest nightly it will underline matching tags too, making selection 
easier.


3) If the answer is no to questions 1 and 2, then is there a way to have
the Aptana / CFECLIPSE extended to provide this functionality?  (I'm willing
to pay a developer to create this functionality for me.)

Ask on the CFE mailing list:
( http://groups.google.com/group/cfeclipse-users )





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


Re: where NOT IN question

2009-12-02 Thread Peter Boughton

 but  what is the query syntax for the reverse scenario when the 
 multiple values passed by a form are NOT IN that particular data set?

You should have tried what you wrote, because that's what it is: NOT IN

So:
SELECT stuff FROM somewhere WHERE id IN (1,2,3);

Can be inverted to:
SELECT stuff FROM somewhere WHERE id NOT IN (1,2,3); 

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


Re: where NOT IN question

2009-12-02 Thread Peter Boughton

Oh and in both cases, since this is user-supplied form data you must use 
cfqueryparam to protect the database.

Like this:

SELECT stuff FROM somewhere
WHERE id IN (cfqueryparam list=true value=#Form.ListOfIds# 
cfsqltype=cf_sql_integer/)

And again the same for doing NOT. 

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


Re: Internet Explorer and @ signs in link text

2009-11-20 Thread Peter Boughton

Use UrlEncodedFormat for encoding URLs (i.e. contents of href and src 
attributes)

Use HtmlEditFormat for encoding text that displays on the page (i.e. contents 
of tabs).


I'm guessing you want something like this:

a href=#UrlEncodedFormat(MyLink)##HtmlEditFormat(MyLink)#/a 

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


Re: Internet Explorer and @ signs in link text

2009-11-20 Thread Peter Boughton

Ah, I didn't read the original post fully. :$

So is this IE8 or IE7, and if the former, is in compatibility mode or not?

Have you been able to duplicate it on other machines?

Do you have any toolbars or plugins installed that might be causing 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:328575
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: Regex help with invalid HTML

2009-11-17 Thread Peter Boughton

 I have no control over this code 

The only time parsing HTML with RegEx might be remotely viable is when you know 
what that code will be - if the HTML is uncontrolled then using RegEx is a 
futile effort.

RegEx is for dealing with Regular text, and HTML is not a Regular language - 
even modern regex engines that implement non-Regular features *cannot* deal 
with the potential complexity of HTML.

The correct solution is to **use a tool designed for parsing HTML**.

There isn't one native to CF, but there are a number of Java ones available - 
take a look at:
http://java-source.net/open-source/html-parsers

I haven't used any of those, I'd probably start with TagSoup or NekoHTML since 
they look promising, but any HTML parser that produces a DOM structure which 
you can run XPath expressions against will allow you to extract the specific 
information you want.

So yeah, it might involve a bit of effort getting one of those to work, but 
it's far more stable and reliable than attempting to use regex for something it 
simply isn't designed for. 

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


Re: cfimage: jpg that is really a gif

2009-11-17 Thread Peter Boughton

 Not the best option

What's a better option then? 

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


Re: 'Tis a sad, sad day...jQuery kills FireFox but works great in IE!

2009-11-13 Thread Peter Boughton

 I have a (large) table that has a list of 
 users with IDs of newUsers and oldUsers.

This is wrong!

Every ID on the page *must* be unique.

Use CLASS for common attributes. 

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


Adalon

2009-11-10 Thread Peter Boughton

I can't get to adalon.net (home of an old Fusebox-related tool).

Does anyone have v3.6 of Adalon which they can either put online, or email me 
offlist with?

Thanks. 

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


Re: REReplace Statment Help

2009-10-22 Thread Peter Boughton

This will replace everything that is not alphanumeric with a dash:

ProductPageName = rereplace( Form.PageName , '\W' , '-' , 'All' )

However, the above will change this  that to this---that, if you would 
prefer a single dash in situations like this, you can simply do this:

ProductPageName = rereplace( Form.PageName , '\W+' , '-' , 'All' )


\W in that regex stands for non-word-character, equivalent in CF to 
[^a-zA-Z0-9_] 

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


Re: Checking line 26 or 27

2009-10-20 Thread Peter Boughton

This doesn't sound like a very robust method.

Are you able to provide sample invoice(s)? 

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


Re: Checking line 26 or 27

2009-10-20 Thread Peter Boughton

As I said, relying on line numbers doesn't seem like a robust method - what 
happens if the top of the invoice is changed, and it suddenly becomes line 
15/16 or 32/33 or something else?

Ideally you refer specifically to the location of the invoice number, hence 
asking for a sample of the invoice to see what structure it uses.


If you r*eally* want to deal with line numbers, then you can split the content 
into an array and do something like this:

cfif Len(line[26]) 
cfset InvoiceNo = line[26] /
cfelseif Len(line[27]) 
cfset InvoiceNo = line[27] /
cfelse
cfthrow message=Can't locate invoice number. /
/cfif

(Or, if this is the only time you're looking at lines, use ListGetAt with 
newlines as delimiters) 

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


Re: Checking line 26 or 27

2009-10-20 Thread Peter Boughton

 The Invoice will not change, its only ever going to be on line 26 or line 27

I'd say the odds of that being the case are low... things like this frequently 
come back to bite you.


 I tried your code but all i get is an error messag saying:
 
 You have attempted to dereference a scalar variable of type class java.
 lang.String as a structure with members. 

Something like this *might* work:
cfset Lines = ListToArray( Lines , Chr(10)Chr(13) ) /

But don't just copy and paste that - make sure you know what it's actually 
doing, and that you know the difference between strings, arrays, structs, and 
so on. 

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


Re: Checking line 26 or 27

2009-10-20 Thread Peter Boughton

Just noticed you're using rematch there - which is good since ListToArray will 
remove blank lines (not what we want).

However, you can simplify it - instead of the crlf variable you can do:

cfset lineArray = reMatch( '\r\n' , myFile ) /

And, once you're there, it's one extra character to do:

cfset lineArray = reMatch( '\r?\n' , myFile ) /

Which will work with files that don't have carriage returns. 

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


Re: special/reserved characters

2009-10-19 Thread Peter Boughton

A very quick summary...

Use cfqueryparam tags to insert user-provided data into the database.

Use the appropriate function (HtmlEditFormat, XmlFormat, UrlEncodedFormat, 
JsStringFormat) to output user-provided data.

These will (should) deal with escaping all reserved characters.

If in doubt, use security scanning software to run some thorough tests against 
your site and verify it is ok before you put it Live. 

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


Re: CFPDF Thumbnail quality

2009-10-15 Thread Peter Boughton

I'm converting PDFs to image  
format, and would expect some kind of control over the output quality  
- I'm writing a JPG after all.

Yep, and you *should* have the option to set a compression percentage for that, 
so I would raise that bit as a bug.

I'm guessing the resolution setting is probably a developer copying through 
possible arguments from whatever underlying API they are using for this. 

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


Re: Splitting a list...

2009-10-14 Thread Peter Boughton

lets say we have 650 elements in our list.
split them into seperate lists with a maximun of 100 elements.

remember, each list must be in a variable

Here we go - InputList will be your 650 elements.

SegmentedLists is an array of the results.



cfset SegmentedLists = segmentList( InputList , 100 ) /

cfdump var=#SegmentedLists#/

cffunction name=segmentList returntype=Array output=false
cfargument name=List type=String /
cfargument name=ItemsPerList type=Numeric /
cfset var MyLists = ArrayNew(1) /
cfset var CurList = 1 /
cfset var CurItem = 0 /
cfset MyLists[1] = ArrayNew(1)/

cfloop index=CurItem array=#ListToArray(Arguments.List)#

cfif ArrayLen(MyLists[CurList]) GTE Arguments.ItemsPerList 
cfset MyLists[++CurList] = ArrayNew(1) /
/cfif

cfset ArrayAppend(MyLists[CurList],CurItem) /

/cfloop

cfloop index=CurList from=1 to=#ArrayLen(MyLists)#
cfset MyLists[CurList] = ArrayToList(MyLists[CurList]) /
/cfloop

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


Re: CFPDF Thumbnail quality

2009-10-14 Thread Peter Boughton

The resolution of an image defines the default physical size it gets sent to 
the printer as (and it can generally be overridden at print stage anyway).

So you can probably ignore 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:327195
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4


Re: CFPDF Thumbnail quality

2009-10-14 Thread Peter Boughton

 resulting images are identical in size. I checked the actual  
resolution in Fireworks and it's 72 for both images.

It may well be that Fireworks is ignoring the value provided - you'll need to 
use a metadata viewer to find out what value the actual file has, rather than a 
graphics editor.

Even then, if it's always set to the same value then it is a bug - but an 
incredibly trivial one since it can be easily changed at print time anyway. 

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


Re: Listserves vs. Message Boards

2009-10-13 Thread Peter Boughton

 The client doesn't know...they want the pros/cons.

From what you've said, I'm inferring that they will mostly have 'normal' 
people using their systems.


The main pro of mailing lists is that they're convenient for busy techies.

Some cons of mailing lists is that they're limited and inflexible, you're at 
the mercy of email servers, and on a high-volume list you need to setup filters 
to avoid your inbox being inundated.

Web-based interfaces to mailing lists can help a little, but in general, 
they're just a bandage.


Which isn't to say forums are perfect - even the best ones have big flaws - but 
(for an audience of non-techies) I would certainly default to a choice forum 
over list.


So, the question then becomes *which* forum to go with, which raises a few 
questions:

* Define in-site - does it have to integrate with a site layout, or is it 
enough to be styled similarly?

* What languages run on the server? (Just CF, or is PHP possible? PHP has far 
more choice).


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


Re: Listserves vs. Message Boards

2009-10-13 Thread Peter Boughton

I don't see why anyone would have a problem using listserves...

And that's part of the reason why there's such a significant divide.

Technical people are fine with mailing lists; they understand them and can 
generally setup their email client in a suitable way, and they don't get what's 
wrong with it.

Non-technical people are fine with forums, and don't see why people use mailing 
lists.

What you refer to as 'hybrid' are generally mailing lists with web interfaces 
tacked on, and those web interfaces simply don't compare to what a full forum 
system gives you.

The downside is that forums are all made by people that don't see the benefits 
that mailing lists have, so you don't get proper email-based interfaces (best 
case is notification emails with replies inline without having to click a link).

There is no reason that they cannot both be properly united, (other than a lack 
of understanding on what attracts people to one or the other).

This is something that has bugged me for *years* - one of my first projects 
after learning CF was to try building a great multi-interfacing discussion 
package, but I didn't know enough back then and it went nowhere.

At the moment, I'm cautiously optimistic that Wave might help with solving the 
problem, but since Google have stopped doing password resets, I've been unable 
to login and start experimenting with that. :(


But anyway, until we have that unified discussion system, the original question 
comes down to what the majority of the users are.

My suspicion of Randy's Client's intended audience is that - if he picked a 
mailing list - they'd 99.9% be using the web interface, so he's better off with 
a proper forum package.

If that turns out to be not the case, then a mailing list might indeed be a 
better choice.


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


  1   2   3   4   5   >