Re: [WebDNA] unique words

This WebDNA talk-list message is from

2009


It keeps the original formatting.
numero = 103448
interpreted = N
texte = --Apple-Mail-1-193114890 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit i tried this [shell]ruby -e "print %w['apple computer apple'].uniq.join(' ')"[/ shell] and it displayed below on the html page...? '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 awesome. >> here's it at work (before
is text before conversion) >> http://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=text with some repeated words with repeated words] >>> [!] >>> [/!][ShowIf [index]=1][!] >>> [/!][Text]usedwords=_[word]_[/Text][!] >>> [/!][word] [!] >>> [/!][/ShowIf][!] >>> [/!][HideIf [usedwords]^_[word]_][!] >>> [/!] [word][!] >>> [/!][/HideIf][!] >>> [/!][Text]usedwords=[usedwords]_[word]_[/Text][!] >>> [/!][/ListWords] >>> >>> and: >>> >>> [ListWords Words=text with some repeated words with repeated words] >>> [!] >>> [/!][ShowIf [index]=1][!] >>> [/!][Text]usedwords=_[word_][/Text][!] >>> [/!][/ShowIf][!] >>> [/!][ShowIf [usedwords]^_[word]_][!] >>> [/!][word] [!] >>> [/!][/ShowIf][!] >>> [/!][Text]usedwords=[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 tricky >>> to read and debug. >>> >>> Frank Nordberg >>> http://www.musicaviva.com >>> http://stores.ebay.com/Nordbergs-Music-Store?refid=store >>> >>> --------------------------------------------------------- >>> 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=topics&category=288 >>> >> >> --------------------------------------------------------- >> 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=topics&category=288 >> > --------------------------------------------------------- > 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=topics&category=288 > --Apple-Mail-1-193114890 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable i tried = this
  [shell]ruby -e "print %w['apple computer = apple'].uniq.join(' ')"[/shell]
   and it displayed = below on the html page...?
   '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<bharrington@1choicerealty.co= m> wrote:
thanks Frank... you're =  awesome.
 here's it = at work (before <hr> is text before = conversion)
 http://www.etrader.tv/uniqu= ewords.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 tricky
to read and = debug.

Frank = Nordberg
http://www.musicaviva.com
http:/= /stores.ebay.com/Nordbergs-Music-Store?refid=3Dstore
<= /blockquote>

---------------------------------------------------------
This message is sent to you because you are subscribed = to
the mailing list <talk@webdna.us>.
To = unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/l= ist/talk@webdna.us
old archives: http://dev.webdna.us/TalkLi= stArchive/
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 <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/l= ist/talk@webdna.us
old = archives: http://dev.webdna.us/TalkLi= stArchive/
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 <talk@webdna.us>.
To unsubscribe, = E-mail to: <talk-leave@webdna.us>
archives= : http://mail.webdna.us/l= ist/talk@webdna.us
old archives: http://dev.webdna.us/TalkLi= stArchive/
Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category=3D288=


= --Apple-Mail-1-193114890-- Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] unique words (William DeVaul 2009)
  2. Re: [WebDNA] unique words (System Administrator 2009)
  3. Re: [WebDNA] unique words (William DeVaul 2009)
  4. Re: [WebDNA] unique words (System Administrator 2009)
  5. Re: [WebDNA] unique words (William DeVaul 2009)
  6. Re: [WebDNA] unique words (System Administrator 2009)
  7. Re: [WebDNA] unique words (Frank Nordberg 2009)
  8. Re: [WebDNA] unique words (Frank Nordberg 2009)
  9. Re: [WebDNA] unique words (Kenneth Grome 2009)
  10. [WebDNA] unique words (System Administrator 2009)
--Apple-Mail-1-193114890 Content-Type: text/plain; charset=US-ASCII; format=flowed; delsp=yes Content-Transfer-Encoding: 7bit i tried this [shell]ruby -e "print %w['apple computer apple'].uniq.join(' ')"[/ shell] and it displayed below on the html page...? '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 awesome. >> here's it at work (before
is text before conversion) >> http://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=text with some repeated words with repeated words] >>> [!] >>> [/!][ShowIf [index]=1][!] >>> [/!][text]usedwords=_[word]_[/Text][!] >>> [/!][word] [!] >>> [/!][/ShowIf][!] >>> [/!][HideIf [usedwords]^_[word]_][!] >>> [/!] [word][!] >>> [/!][/HideIf][!] >>> [/!][text]usedwords=[usedwords]_[word]_[/Text][!] >>> [/!][/ListWords] >>> >>> and: >>> >>> [ListWords Words=text with some repeated words with repeated words] >>> [!] >>> [/!][ShowIf [index]=1][!] >>> [/!][text]usedwords=_[word_][/Text][!] >>> [/!][/ShowIf][!] >>> [/!][ShowIf [usedwords]^_[word]_][!] >>> [/!][word] [!] >>> [/!][/ShowIf][!] >>> [/!][text]usedwords=[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 tricky >>> to read and debug. >>> >>> Frank Nordberg >>> http://www.musicaviva.com >>> http://stores.ebay.com/Nordbergs-Music-Store?refid=store >>> >>> --------------------------------------------------------- >>> 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=topics&category=288 >>> >> >> --------------------------------------------------------- >> 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=topics&category=288 >> > --------------------------------------------------------- > 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=topics&category=288 > --Apple-Mail-1-193114890 Content-Type: text/html; charset=US-ASCII Content-Transfer-Encoding: quoted-printable i tried = this
  [shell]ruby -e "print %w['apple computer = apple'].uniq.join(' ')"[/shell]
   and it displayed = below on the html page...?
   '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<bharrington@1choicerealty.co= m> wrote:
thanks Frank... you're =  awesome.
 here's it = at work (before <hr> is text before = conversion)
 http://www.etrader.tv/uniqu= ewords.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 tricky
to read and = debug.

Frank = Nordberg
http://www.musicaviva.com
http:/= /stores.ebay.com/Nordbergs-Music-Store?refid=3Dstore
<= /blockquote>

---------------------------------------------------------
This message is sent to you because you are subscribed = to
the mailing list <talk@webdna.us>.
To = unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/l= ist/talk@webdna.us
old archives: http://dev.webdna.us/TalkLi= stArchive/
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 <talk@webdna.us>.
To unsubscribe, E-mail to: <talk-leave@webdna.us>
archives: http://mail.webdna.us/l= ist/talk@webdna.us
old = archives: http://dev.webdna.us/TalkLi= stArchive/
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 <talk@webdna.us>.
To unsubscribe, = E-mail to: <talk-leave@webdna.us>
archives= : http://mail.webdna.us/l= ist/talk@webdna.us
old archives: http://dev.webdna.us/TalkLi= stArchive/
Bug Reporting: http://forum.webdna.us/eucabb.html?page=3Dtopics&category=3D288=


= --Apple-Mail-1-193114890-- System Administrator

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:

Sorting by date (1997) Exclamation point (1997) Plain Language Manual? (1998) [WebDNA] No more SQL in 7.1? (2012) help testing quicktime delivery (1997) problem with [Format Days_To_Date] (2000) [WebDNA] Some Monday night fun (2009) Formulas.db (1997) [WebDNA] "Safe Write for Database" setting.... (2016) Server slowing down. (1997) no [search] with NT (1997) WebCat2 Append problem (B14Macacgi) (1997) List of WebDNA users (2002) setcookie getcookie on the same page (2003) Searching an Email database (1997) Setting up shop (1997) WebCat2 Append problem (B14Macacgi) (1997) HELP (2000) WebCatalog 2.0 & WebDNA docs in HTML ... (1997) WC2b15 - [HTMLx]...[/HTMLx] problems SOLVED! (1997)