Re: trying to shorten long string

2015-03-09 Thread Dean Lawrence

Well, the reason for the alternative approach is that he didn't specify why
he wanted to truncate the description. Typically, this is due to layout and
not necessarily content. Also, counting words breaks down as soon as you
introduce html into the mix, because it is very easy to lop off closing
tags, screwing up the display. However, if you can guarantee that there is
no html used, here is a link to an old article that Ray did that uses regex
to dump all words into an array.
http://www.raymondcamden.com/2007/08/02/Counting-Word-Instances-in-a-String.
You could then loop over this array, adding the length of each word to a
total length  variable, and outputting the word as long as the total length
variable does not exceed the maximum length limit that you set.

On Mon, Mar 9, 2015 at 1:47 PM, Michael Grant  wrote:

>
> I think the point is that he's trying to truncate the text in a meaningful
> way, such as at the end of a sentence.
> One way around "4.5 houses" is to only use a period as a delimiter if it is
> followed by at least one space and an uppercase letter. It's not perfect of
> course, but it would eliminate more edge cases of your truncation not
> working as intended.
>
> Mike
>
> On Mon, Mar 9, 2015 at 1:04 PM, Dean Lawrence  wrote:
>
> >
> > Another option would be to place the entire description in a div and then
> > truncate it via css.
> >
> > http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
> >
>



-- 

  [image: profile picture]  *Dean Lawrence*
*President*
Internet Data Technology
*Phone:* 888-438-4381 x701
*Web:* www.idatatech.com
*Email:* d...@idatatech.com
  Programming | Database | Consulting | Training


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


Re: trying to shorten long string

2015-03-09 Thread Michael Grant

I think the point is that he's trying to truncate the text in a meaningful
way, such as at the end of a sentence.
One way around "4.5 houses" is to only use a period as a delimiter if it is
followed by at least one space and an uppercase letter. It's not perfect of
course, but it would eliminate more edge cases of your truncation not
working as intended.

Mike

On Mon, Mar 9, 2015 at 1:04 PM, Dean Lawrence  wrote:

>
> Another option would be to place the entire description in a div and then
> truncate it via css.
>
> http://www.w3schools.com/cssref/css3_pr_text-overflow.asp
>
> On Sat, Mar 7, 2015 at 1:31 AM, Mark Spence 
> wrote:
>
> >
> > I have a long product description I am trying to truncate.  I could just
> > truncate it, but I don't want to break off sentences.  Here is the
> solution
> > I came up with but it does not seem to have any effect.
> >
> > Any ideas?
> >
> > 
> > 
> > 
> >  > listDeleteAt(variables.description,listLen(variables.description, "."),
> > ".")>
> > 
> > 
> > 
> > 
> > 
> >
> >
> >
>
> 

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


Re: trying to shorten long string

2015-03-09 Thread Dean Lawrence

Another option would be to place the entire description in a div and then
truncate it via css.

http://www.w3schools.com/cssref/css3_pr_text-overflow.asp

On Sat, Mar 7, 2015 at 1:31 AM, Mark Spence  wrote:

>
> I have a long product description I am trying to truncate.  I could just
> truncate it, but I don't want to break off sentences.  Here is the solution
> I came up with but it does not seem to have any effect.
>
> Any ideas?
>
> 
> 
> 
>  listDeleteAt(variables.description,listLen(variables.description, "."),
> ".")>
> 
> 
> 
> 
> 
>
>
> 

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


Re: trying to shorten long string

2015-03-09 Thread Bryan Stevenson

just keep in mind that periods exist in text for other reasons than 
ending sentences - this code will NOT always work as intended

This will kill your desired end result "There are 4.5 houses finished." ;-)

SorryI don't have a solution handy - just spotted a potential issue

Take care

-Bryan

*Bryan Stevenson*B.Comm.
President & CEO
Electric Edge Systems Group Inc. - makers of FACTS™
phone: 250.480.0642
cell: 250.920.8830
e-mail: br...@fisheryfacts.com 
web: www.fisheryfacts.com 



Please consider the environment before printing this e-mail

-CONFIDENTIALITY--
This message, including any attachments, is confidential and may contain 
information that is privileged or exempt from disclosure. It is intended 
only for the person to whom it is addressed unless expressly authorized 
otherwise by the sender. If you are not an authorized recipient, please 
notify the sender immediately and permanently destroy all copies of this 
message and attachments.
On 2015-03-07 8:22 AM, Captain Obvious wrote:
> Variable I is undefined.
>
> This works,
>
> 
>  
>  
>   listDeleteAt(variables.description,listLen(variables.description,
> "."),".")>
>  
>  
>  
>  
> 
> #variables.description#
>
> On Sat, Mar 7, 2015 at 1:31 AM, Mark Spence  wrote:
>> I have a long product description I am trying to truncate.  I could just
>> truncate it, but I don't want to break off sentences.  Here is the solution
>> I came up with but it does not seem to have any effect.
>>
>> Any ideas?
>>
>> 
>> 
>>  
>>  > listDeleteAt(variables.description,listLen(variables.description, "."),
>> ".")>
>>  
>>  
>>  
>>  
>> 
>>
>>
>>
> 

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


CF11 cannot validate default PDF Service Manager

2015-03-09 Thread m

Not sure where to look with this one, would appreciate any thoughts: Am using a 
freshly installed CF11 Enterprise box and cannot generate PDFs. Simple tests 
with cfdocument led to my finding that in the CF admin I cannot validate the 
default PDF Service Manager. Settings look the same as a different machine that 
validates as expected. On the bad box the validate request just runs on and on, 
never seems to time out, though all other CF features seems to be working fine. 
Logs show nothing of interest.

Would appreciate any thoughts, tia. 

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