Re: REGEX hell

2010-11-22 Thread Michael Dinowitz

I agree that the * (0 or more) should be avoided unless needed but in this
case I felt it was. There may or may not be a space. There may be more than
one space. There may be a space character being seen as a space (like a
tab).
Because we don't know if a space will actually exist, the * is needed. The
+? (1 or more but as few as needed) assumes that at least one space exists.

As a rule I don't over-worry about using * when it's used with a \s (space)
unless I really have to.

On Tue, Nov 23, 2010 at 12:20 AM, andy matthews wrote:

>
> For future reference you should avoid using * where possible as it can
> easily lead to overmatching. Even using + would be better although both +
> and * alone are greedy matches. An even better solution would be to use a
> lazy match like so:
>
> \)\s+?\)
>
> The ? following the + tells the regex engine to match as little as
> possible.
>
>
>
> andy
>
> -Original Message-
> From: Rick Colman [mailto:rcol...@cox.net]
> Sent: Monday, November 22, 2010 9:59 PM
> To: cf-talk
> Subject: Re: REGEX hell
>
>
> This worked!! TNX.
>
> On 11/22/2010 6:04 PM, Michael Dinowitz wrote:
> > Are you sure it's a space and not 2 spaces? Or a tab? Try using \s* to
> > indicate that there may be one or more space characters.
> >
> > \)\s*\)
> >
> > 
> >
> > On Mon, Nov 22, 2010 at 8:48 PM, Rick Colman  wrote:
> >
> >> I am trying to replace two trailing parens )) with a single paren.
> >>
> >> here is a sample string:
> >>
> >> (K AAA) (N AAC) (E GAA) )
> >>
> >> looks like there is a space in between the two )), so I tried:
> >>
> >> 
> >>
> >> but this is not working.
> >>
> >> Any ideas as two what is wrong greatly appreciated.
> >>
> >>
> >>
> >
>
>
>
> 

~|
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:339446
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-22 Thread andy matthews

For future reference you should avoid using * where possible as it can
easily lead to overmatching. Even using + would be better although both +
and * alone are greedy matches. An even better solution would be to use a
lazy match like so:

\)\s+?\)

The ? following the + tells the regex engine to match as little as possible.



andy

-Original Message-
From: Rick Colman [mailto:rcol...@cox.net] 
Sent: Monday, November 22, 2010 9:59 PM
To: cf-talk
Subject: Re: REGEX hell


This worked!! TNX.

On 11/22/2010 6:04 PM, Michael Dinowitz wrote:
> Are you sure it's a space and not 2 spaces? Or a tab? Try using \s* to
> indicate that there may be one or more space characters.
>
> \)\s*\)
>
> 
>
> On Mon, Nov 22, 2010 at 8:48 PM, Rick Colman  wrote:
>
>> I am trying to replace two trailing parens )) with a single paren.
>>
>> here is a sample string:
>>
>> (K AAA) (N AAC) (E GAA) )
>>
>> looks like there is a space in between the two )), so I tried:
>>
>> 
>>
>> but this is not working.
>>
>> Any ideas as two what is wrong greatly appreciated.
>>
>>
>>
> 



~|
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:339445
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-22 Thread Rick Colman

This worked!! TNX.

On 11/22/2010 6:04 PM, Michael Dinowitz wrote:
> Are you sure it's a space and not 2 spaces? Or a tab? Try using \s* to
> indicate that there may be one or more space characters.
>
> \)\s*\)
>
> 
>
> On Mon, Nov 22, 2010 at 8:48 PM, Rick Colman  wrote:
>
>> I am trying to replace two trailing parens )) with a single paren.
>>
>> here is a sample string:
>>
>> (K AAA) (N AAC) (E GAA) )
>>
>> looks like there is a space in between the two )), so I tried:
>>
>> 
>>
>> but this is not working.
>>
>> Any ideas as two what is wrong greatly appreciated.
>>
>>
>>
> 

~|
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:339444
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-22 Thread Michael Dinowitz

Are you sure it's a space and not 2 spaces? Or a tab? Try using \s* to
indicate that there may be one or more space characters.

\)\s*\)



On Mon, Nov 22, 2010 at 8:48 PM, Rick Colman  wrote:

>
> I am trying to replace two trailing parens )) with a single paren.
>
> here is a sample string:
>
> (K AAA) (N AAC) (E GAA) )
>
> looks like there is a space in between the two )), so I tried:
>
> 
>
> but this is not working.
>
> Any ideas as two what is wrong greatly appreciated.
>
>
> 

~|
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:339443
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-22 Thread Jerry Johnson

no need to escape the space char with a slash.

are you sure it is only 1 space, and are you sure it is a space char
(chr(32))?

If so, remove the slash in front of the space, and it should work.

also, pet peeve, no need for the ## around the function. Works either way,
though, so ignore if you prefer.

Jerry Milo Johnson

On Mon, Nov 22, 2010 at 8:48 PM, Rick Colman  wrote:

>
> I am trying to replace two trailing parens )) with a single paren.
>
> here is a sample string:
>
> (K AAA) (N AAC) (E GAA) )
>
> looks like there is a space in between the two )), so I tried:
>
> 
>
> but this is not working.
>
> Any ideas as two what is wrong greatly appreciated.
>
>
> 

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


REGEX hell

2010-11-22 Thread Rick Colman

I am trying to replace two trailing parens )) with a single paren.

here is a sample string:

(K AAA) (N AAC) (E GAA) )

looks like there is a space in between the two )), so I tried:



but this is not working.

Any ideas as two what is wrong greatly appreciated.


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


Re: Detect users based on country???

2010-11-22 Thread Tony Bentley

Use a public geo-location service:

http://ipinfodb.com/ip_query.php?ip=#cgi.REMOTE_ADDR#";
result="response" />

Then use the response XML tree to extract the country or zip:





#price#


I wouldn't actually do it in this order because of the lag in http
posts. I've had good luck with this method but it isn't perfect
because web services can go down and then your checking system breaks.
If the location service isn't working, then don't allow anyone to use
the module you've built with the integrated geo-location service. Use
cookies as you stated to keep from having to do this every time.

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


Detect users based on country???

2010-11-22 Thread Jeff F

I need to hide pricing data on a few web pages for one country, Canada.  I've 
got a range of IP address blocks as in:

  41.206.160.0/19
  24.36.0.0/16
  24.37.0.0/16
 24.38.144.0/20
 24.57.0.0/16
  24.64.0.0/13
  24.72.0.0/17
 24.72.128.0/20

(the list is much longer).

At first I was looking at using .htaccess to detect IP then redirect to a page 
that plants a cookie for future detection on other pages. 

Is there a better idea? I'm open to anything. 



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


ColdFusion & LCDS Session Management

2010-11-22 Thread Josh Dura

Has anyone on the list had any experience implementing session 
management for LiveCycle Data Services into ColdFusion 9? I am building 
an app using CF, Flex & LCDS and am trying to find a way to call a few 
clean up methods on the CF side when a user disconnects. Unfortunately, 
I haven't found much online other than a few unanswered questions on the 
same topic.

I am pretty new to CF & LCDS, but it seems it would need to use the 
FlexSession Java class (something like this... 
http://sujitreddyg.wordpress.com/2008/05/16/session-data-management-in-flex-remoting/),
 
but I have no idea how to use java event listeners within CF. Thanks for 
any help ahead of time.

Josh Dura


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


Re: CFDocument and Images

2010-11-22 Thread Jochem van Dieten

On Mon, Nov 22, 2010 at 5:18 PM, JediHomer wrote:
> I've tried toggleing the localURL with the img src set to
> "./image1.png" and using ExpandPath to get the full path to the file
> so that the img src is set to the full physical path to the file.  I'm
> on linux, so the path then becomes "/home/jedi/blah..." but the
> problem is still the same...

Try a "file:///home/jedi/..." path.

Jochem

-- 
Jochem van Dieten
http://jochem.vandieten.net/

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


CF8 cfcookie vs cfheader set-cookie

2010-11-22 Thread Jawad Shaik Mohammed

I was updating our application to support httponly cookies and came across what 
seems like a ColdFusion quirk. I had to update a bunch of pages where we used 
to set cookies using cfcookie tag, so I went ahead and created a custom tag 
that all templates can use to set a cookie. Since CF8's cfcookie does not 
support httponly flag (CF9 does), I used cfheader to set the cookie in the 
custom tag and here is what I found.

When you use the cfcookie tag to set the cookie, coldfusion populates the 
cookie struct right away. But if you use cfheader instead to set the cookie, I 
believe coldfusion does not populate the cookie struct until the next request. 
I spent a couple of days chasing this issue and trying workarounds for it 
without success. So, the only thing left to do was to do a relocate to the same 
template the first time the cookie is set using cfheader so that coldfusion 
populates the cookie struct. (Manipulating the cookie struct is out of the 
question since that messes up the cookies.)

Here is a test case to prove this:












On the first page load, the cfdump will only have the cfcookietest cookie in 
the cookie struct. Only on the second request will the cfheadertest cookie be 
present in the cookie struct. Hope this helps others who are facing the same 
issue. Please reply/comment if there is a better way to handle this. Thanks.

-Jawad 

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


Re: Using isDefined/StructKeyExists against a ,Net com object

2010-11-22 Thread Dave Watts

> I've found that the conversion process brings everything back as 
> rootObject.Get_ObjectName().Get_Value() which blows up if the
> object is empty throwing an undefined error - However if I try and use 
> isDefined("rootObject.Get_ObjectName") or
> StructKeyExists(rootObject,"Get_ObjectName) - it just doesn't work - If I add 
> in the () at the end - it blows up Coldfusion

Use cftry/cfcatch around your calls to
rootObject.Get_ObjectName().Get_Value() instead of trying to treat the
values within your object as if they were structures, etc.

Dave Watts, CTO, Fig Leaf Software
http://www.figleaf.com/
http://training.figleaf.com/

Fig Leaf Software is a Veteran-Owned Small Business (VOSB) on
GSA Schedule, and provides the highest caliber vendor-authorized
instruction at our training centers, online, or onsite.

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


Using isDefined/StructKeyExists against a ,Net com object

2010-11-22 Thread Joanne Corless

I'm doing some .Net integration and the values of the .Net object returned need 
to be inspected and then displayed if they are defined

 

I've found that the conversion process brings everything back as 
rootObject.Get_ObjectName().Get_Value() which blows up if the object is empty 
throwing an undefined error - However if I try and use 
isDefined("rootObject.Get_ObjectName") or 
StructKeyExists(rootObject,"Get_ObjectName) - it just doesn't work - If I add 
in the () at the end - it blows up Coldfusion

 

I can't just display everything because there may be elements that are empty - 
Has anyone else had this problem & have a solution? 

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


RE: CFDocument and Images

2010-11-22 Thread Russ Michaels

I believe CF actually uses iTtext (http://itextpdf.com/), you could try
manipulating this directly and see if you have the same issue, if so then
perhaps updating iText may solve the problem.

Russ

-Original Message-
From: JediHomer [mailto:jediho...@gmail.com] 
Sent: 22 November 2010 16:18
To: cf-talk
Subject: Re: CFDocument and Images


Hi,

Yep, no difference.

I've tried toggleing the localURL with the img src set to
"./image1.png" and using ExpandPath to get the full path to the file
so that the img src is set to the full physical path to the file.  I'm
on linux, so the path then becomes "/home/jedi/blah..." but the
problem is still the same...


Kind regards

Jedi



On 22 November 2010 16:08, Russ Michaels  wrote:
>
> That depends how you have told it to get the images.
>
> See the localUrl attribute
> Specifies whether to retrieve image files directly from the local drive:
>
>    * yes: ColdFusion retrieves image files directly from the local drive
> rather than by using HTTP, HTTPS, or proxy.
>    * no: ColdFusion uses HTTP, HTTPS, or proxy to retrieve image files
even
> if the files are stored locally.
>
> Have you tried setting it to "yes" and loading them from the local drive?
>
>
> --
> Russ Michaels
>
> http://www.bluethunderinternet.com : B2B hosting, VPS's, Exchange, CF,
Railo
> www.cfmldeveloper.com              : CFML community, FREE ColdFusion/Railo
> hosting
> http://www.michaels.me.uk      :   My Blog
> skype me                       :  russmichaels
>
>
>
>
> 



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


Re: CFDocument and Images

2010-11-22 Thread JediHomer

Hi,

Yep, no difference.

I've tried toggleing the localURL with the img src set to
"./image1.png" and using ExpandPath to get the full path to the file
so that the img src is set to the full physical path to the file.  I'm
on linux, so the path then becomes "/home/jedi/blah..." but the
problem is still the same...


Kind regards

Jedi



On 22 November 2010 16:08, Russ Michaels  wrote:
>
> That depends how you have told it to get the images.
>
> See the localUrl attribute
> Specifies whether to retrieve image files directly from the local drive:
>
>    * yes: ColdFusion retrieves image files directly from the local drive
> rather than by using HTTP, HTTPS, or proxy.
>    * no: ColdFusion uses HTTP, HTTPS, or proxy to retrieve image files even
> if the files are stored locally.
>
> Have you tried setting it to "yes" and loading them from the local drive?
>
>
> --
> Russ Michaels
>
> http://www.bluethunderinternet.com : B2B hosting, VPS's, Exchange, CF, Railo
> www.cfmldeveloper.com              : CFML community, FREE ColdFusion/Railo
> hosting
> http://www.michaels.me.uk      :   My Blog
> skype me                       :  russmichaels
>
>
>
>
> 

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


RE: CFDocument and Images

2010-11-22 Thread Russ Michaels

That depends how you have told it to get the images.

See the localUrl attribute
Specifies whether to retrieve image files directly from the local drive:

* yes: ColdFusion retrieves image files directly from the local drive
rather than by using HTTP, HTTPS, or proxy.
* no: ColdFusion uses HTTP, HTTPS, or proxy to retrieve image files even
if the files are stored locally.

Have you tried setting it to "yes" and loading them from the local drive?


--
Russ Michaels

http://www.bluethunderinternet.com : B2B hosting, VPS's, Exchange, CF, Railo
www.cfmldeveloper.com  : CFML community, FREE ColdFusion/Railo
hosting
http://www.michaels.me.uk  :   My Blog  
skype me   :  russmichaels




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


CFDocument and Images

2010-11-22 Thread JediHomer

Hi,

How does CFDocument, serving a PDF, go about actually getting images?

We have a fairly complex report that returns a PDF with a fair amount
of CFCharts within it.  We were initially seeing a lot of timeouts
creating the image, then moving the site to a multi-instance CF caused
more mahem.  So we changed the code to first save the image to a
temporary location and generate the PDF from that.  All was going
well, we thought.

There are two questions in a report (not all) where the image
displayed for the answer is wrong.  Running the same report outside of
the CFDocument producs the correct output.  In both cases, the correct
images are written to disk.  The image shown in these two cases are
another image also included in the report.  First we thought it was a
CF9 v CF901 problem as the Dev server is 901 but the live server is 9.

However I've managed to reproduce the problem on CF901 with two images
and a very simple table.  The image files themselves are different,
I've tried getting MD5s of the images and these differ.  When run,
there are two images embedded in the document, but both are of the
first image encountered.  Changing the order of the images changes the
output.

In attempting to debug this, we have tried using UUIDs to ensure the
filenames are unique, adding an ?rnd=#CreateUUID()# to attempt to stop
caching, all have failed.

The only way I've managed to get the images to work properly (as I
thought it was an HTML issue to start with) is to watermark the images
like:








This makes the image ugly, but the correct one.  Strangley, if I
change the SetDrawingColor to white, as the text appears over a white
background, then the same problem persists...

Has anyone got any ideas, as I'm now stumped...


Kind regards

Jedi

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