Re: [WebDNA] unique words
This WebDNA talk-list message is from 2009
It keeps the original formatting.
numero = 103449
interpreted = N
texte = [shell]ruby -e "print %w[[text_var]].uniq.sort_by{|w|w.downcase}.join(' ')"[/shell]I could duplicate your result. Please try with the inner single quoteremoved. This worked for me either way. I also added a sort methodtoo.BillOn Tue, Aug 25, 2009 at 4:05 PM, SystemAdministrator
wrote:> i tried this> =A0=A0[shell]ruby -e "print %w['apple computer apple'].uniq.join(' ')"[/s=hell]> =A0=A0 and it displayed below on the html page...?> =A0=A0=A0'apple computer apple'>>>> On Aug 25, 2009, at 3:40 PM, William DeVaul wrote:>> Here is another solution that uses the WebDNA shell command on *nix> systems to use ruby:>> [shell]ruby -e "print %w['[text_var]'].uniq.join(' ')"[/shell]>> This worked for me and is only one line.>> It calls the ruby interpreter, passing the -e switch to execute the> ruby command in doublequotes, converts the words of the string to> members of an array ([text_var] is expressed before calling the> command line), finds the unique array members and joins them with a> space.>> It's not WebDNA doing the heavy lifting and adds a dependency you may> not want, but it's only one line.>> Bill>> On Tue, Aug 25, 2009 at 1:27 PM, System> Administrator wrote:>> thanks Frank... you're =A0awesome.>> =A0here's it at work (before
is text before conversion)>> =A0http://www.etrader.tv/uniquewords.tpl>>>>> On Aug 25, 2009, at 1:20 PM, Frank Nordberg wrote:>> Woops, I noticed a bug right away. This is better, although I still won't>> promise it'll work without some tweaking:>> [ListWords Words=3Dtext with some repeated words with repeated words][!]>> [/!][ShowIf [index]=3D1][!]>> [/!][Text]usedwords=3D_[word]_[/Text][!]>> [/!][word] [!]>> [/!][/ShowIf][!]>> [/!][HideIf [usedwords]^_[word]_][!]>> [/!] [word][!]>> [/!][/HideIf][!]>> [/!][Text]usedwords=3D[usedwords]_[word]_[/Text][!]>> [/!][/ListWords]>> and:>> [ListWords Words=3Dtext with some repeated words with repeated words][!]>> [/!][ShowIf [index]=3D1][!]>> [/!][Text]usedwords=3D_[word_][/Text][!]>> [/!][/ShowIf][!]>> [/!][ShowIf [usedwords]^_[word]_][!]>> [/!][word] [!]>> [/!][/ShowIf][!]>> [/!][Text]usedwords=3D[usedwords]_[word]_[/Text][!]>> [/!][/ListWords]>> For a more compact script you can remove the [!] and [/!] but then you'd>> also have to remove all the line shifts in the script making it a it tric=ky>> to read and debug.>> Frank Nordberg>> http://www.musicaviva.com>> http://stores.ebay.com/Nordbergs-Music-Store?refid=3Dstore>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> old archives: http://dev.webdna.us/TalkListArchive/> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>>>
Associated Messages, from the most recent to the oldest:
[shell]ruby -e "print %w[[text_var]].uniq.sort_by{|w|w.downcase}.join(' ')"[/shell]I could duplicate your result. Please try with the inner single quoteremoved. This worked for me either way. I also added a sort methodtoo.BillOn Tue, Aug 25, 2009 at 4:05 PM, SystemAdministrator wrote:> i tried this> =A0=A0[shell]ruby -e "print %w['apple computer apple'].uniq.join(' ')"[/s=hell]> =A0=A0 and it displayed below on the html page...?> =A0=A0=A0'apple computer apple'>>>> On Aug 25, 2009, at 3:40 PM, William DeVaul wrote:>> Here is another solution that uses the WebDNA shell command on *nix> systems to use ruby:>> [shell]ruby -e "print %w['[text_var]'].uniq.join(' ')"[/shell]>> This worked for me and is only one line.>> It calls the ruby interpreter, passing the -e switch to execute the> ruby command in doublequotes, converts the words of the string to> members of an array ([text_var] is expressed before calling the> command line), finds the unique array members and joins them with a> space.>> It's not WebDNA doing the heavy lifting and adds a dependency you may> not want, but it's only one line.>> Bill>> On Tue, Aug 25, 2009 at 1:27 PM, System> Administrator wrote:>> thanks Frank... you're =A0awesome.>> =A0here's it at work (before
is text before conversion)>> =A0http://www.etrader.tv/uniquewords.tpl>>>>> On Aug 25, 2009, at 1:20 PM, Frank Nordberg wrote:>> Woops, I noticed a bug right away. This is better, although I still won't>> promise it'll work without some tweaking:>> [ListWords Words=3Dtext with some repeated words with repeated words][!]>> [/!][ShowIf [index]=3D1][!]>> [/!][text]usedwords=3D_[word]_[/Text][!]>> [/!][word] [!]>> [/!][/ShowIf][!]>> [/!][HideIf [usedwords]^_[word]_][!]>> [/!] [word][!]>> [/!][/HideIf][!]>> [/!][text]usedwords=3D[usedwords]_[word]_[/Text][!]>> [/!][/ListWords]>> and:>> [ListWords Words=3Dtext with some repeated words with repeated words][!]>> [/!][ShowIf [index]=3D1][!]>> [/!][text]usedwords=3D_[word_][/Text][!]>> [/!][/ShowIf][!]>> [/!][ShowIf [usedwords]^_[word]_][!]>> [/!][word] [!]>> [/!][/ShowIf][!]>> [/!][text]usedwords=3D[usedwords]_[word]_[/Text][!]>> [/!][/ListWords]>> For a more compact script you can remove the [!] and [/!] but then you'd>> also have to remove all the line shifts in the script making it a it tric=ky>> to read and debug.>> Frank Nordberg>> http://www.musicaviva.com>> http://stores.ebay.com/Nordbergs-Music-Store?refid=3Dstore>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>>> --------------------------------------------------------->> This message is sent to you because you are subscribed to>> the mailing list .>> To unsubscribe, E-mail to: >> archives: http://mail.webdna.us/list/talk@webdna.us>> old archives: http://dev.webdna.us/TalkListArchive/>> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>> ---------------------------------------------------------> This message is sent to you because you are subscribed to> the mailing list .> To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us> old archives: http://dev.webdna.us/TalkListArchive/> Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category==3D288>>>
William DeVaul
DOWNLOAD WEBDNA NOW!
Top Articles:
Talk List
The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...
Related Readings:
Formatting of email on NT (1998)
View Source from cache (1997)
Email address checker (2002)
Hello??? (1997)
Pithy questions on webcommerce & siteedit (1997)
Speed Admin? (Was FlushDatabases) (1997)
URGENT! ACGI Stopped!!!! (1997)
tcpconnect/tcpsend problem ... (2004)
How true is this? (1999)
NT error logs (1997)
apostrophe in search item (1997)
Dummy Credit Card Number for debug? (1997)
[OT] (waaaay OT) further off topic than before (2004)
Showing unopened cart (1997)
Webmerchant confirmation hooks? (1997)
Arbitrary limits on length of data in cart header fields? (2000)
More DateMath problems (1997)
Pithy questions on webcommerce & siteedit (1997)
SM: MySQL and Numbers (BUG) (2005)
RE: [WebDNA] Mixed Content (2009)