Skip to search.

Breaking News Visit Yahoo! News for the latest.

×Close this window

ntb-clips · The NoteTab Clips List

The Yahoo! Groups Product Blog

Check it out!

Group Information

? Already a member? Sign in to Yahoo!

Yahoo! Groups Tips

Did you know...
Message search is now enhanced, find messages faster. Take it for a spin.

Messages

Advanced
Messages Help
Messages 18613 - 18642 of 23816   Oldest  |  < Older  |  Newer >  |  Newest
Messages: Show Message Summaries Sort by Date ^  
#18613 From: John Fitzsimons <johnf@...>
Date: Sun Nov 2, 2008 11:30 pm
Subject: Line frequency analysis.
johnf@...
Send Email Send Email
 
Hi,

I start with a newsgroup list like......

0.verizon.windows2000
0.verizon.windowsxp
0.verizon.windowsxp
0.verizon.windowsxp
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
24hoursupport.helpdesk
alt.computer
alt.computer
alt.computer
alt.computer
alt.computer
alt.computer
alt.computer
alt.computer


I want to end up with a list like......

000001,0.verizon.windows2000
000003,0.verizon.windowsxp
000012,24hoursupport.helpdesk
000008,alt.computer

Is there an existing way/clip to do this ? If not then can someone
provide the needed code to produce this result please ?

It doesn't matter if the numbers follow the newsgroup name but I
would need a delimiter of some sort first eg. a comma.


Regards, John.

#18614 From: "Sheri" <silvermoonwoman@...>
Date: Mon Nov 3, 2008 4:48 am
Subject: Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@...> wrote:

>
> I want to end up with a list like......
>
> 000001,0.verizon.windows2000
> 000003,0.verizon.windowsxp
> 000012,24hoursupport.helpdesk
> 000008,alt.computer
>
> Is there an existing way/clip to do this ? If not then can someone
> provide the needed code to produce this result please ?
>

This will do it exactly as above, but version 5+ is required:

^!SetScreenUpdate Off
^!Jump Doc_End
^!If ^$GetCol$>1 Next Else Skip
^!InsertText ^P
^!Jump Doc_Start
:Loop
^!Find "^(.+\r\n)\1*" RS
^!IfError Quit
^!Set %count%=^$StrCount("^%NL%";"^$GetSelection$";Yes;Yes)$
^!Set %fill%=^$Calc(6-^$StrSize(^%count%)$)$
^!Replace "(.+\r\n)\1*" >> "^$StrFill("0";^%fill%)$^%count%,$1" RHS
^!Goto Loop
:Quit
^!ClearVariable %count%
^!ClearVariable %fill%
;end of clip

#18615 From: "Don - HtmlFixIt.com" <don@...>
Date: Mon Nov 3, 2008 12:01 pm
Subject: Re: [Clip] Re: Line frequency analysis.
dpasseng
Send Email Send Email
 
Sheri wrote:
> --- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@...> wrote:
>
>> I want to end up with a list like......
>>
>> 000001,0.verizon.windows2000
>> 000003,0.verizon.windowsxp
>> 000012,24hoursupport.helpdesk
>> 000008,alt.computer
>>
>> Is there an existing way/clip to do this ? If not then can someone
>> provide the needed code to produce this result please ?
>>
>
> This will do it exactly as above, but version 5+ is required:
>
> ^!SetScreenUpdate Off
> ^!Jump Doc_End
> ^!If ^$GetCol$>1 Next Else Skip
> ^!InsertText ^P
> ^!Jump Doc_Start
> :Loop
> ^!Find "^(.+\r\n)\1*" RS
> ^!IfError Quit
> ^!Set %count%=^$StrCount("^%NL%";"^$GetSelection$";Yes;Yes)$
> ^!Set %fill%=^$Calc(6-^$StrSize(^%count%)$)$
> ^!Replace "(.+\r\n)\1*" >> "^$StrFill("0";^%fill%)$^%count%,$1" RHS
> ^!Goto Loop
> :Quit
> ^!ClearVariable %count%
> ^!ClearVariable %fill%
> ;end of clip


I have done that much less efficiently in the past.

I'll try to break it down ...
set screen update off just speeds life up
jump doc end takes us to the end
I think you are adding a blank line at the end next ... interesting way
-- although you could have multiple blank lines at the end and you
aren't removing them
Loop ... finds basically anything of one character or more followed by a
new line
if there is an error it quits ... so if there were a blank line in the
middle of the list, it would quit because it is less than one in length?

PLEASE EXPLAIN THIS PART:
It apparently counts the number of times the string occurs in the
document? -- this part confused me a little.  I assume that the \1* is
the key part because it finds all incidents of that term, highlights
them and deletes them to replace them with your final product.
THANKS

I get the $1 being the () part of the find.
  From there it essentially just cycles.


Sheri, even though his data was sorted, should we not do a sort to begin?

What about word wrap.  Could it affect your outcome at all?


Here is how I did something similar without regex -- I bet yours is faster.
In my case I am taking one element out of a delimited list vs his
example that has just one element, ie, the entire line.  Here is mine:

:NewTeam
;first time set team
^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
;^!Info ^%GrabField2%
^!Set %Team%=^$GetSelection$
^!Set %TeamCount%=0
;^!Info ^%TeamCount%
:Loop
;get team for this line
^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
;be sure that this line is for current team
;if not, go to ProcessTeam
;otherwise continue here
^!If "^%Team%" <> "^$GetSelection$" ProcessTeam
^!Set %TeamCount%=^$Calc(^%TeamCount%+1;0)$
;^!Info ^%TeamCount%
^!Jump +1
^!GoTo Loop

:ProcessTeam
;There is more here that does something with the info
^!GoTo NewTeam

#18616 From: "Sheri" <silvermoonwoman@...>
Date: Mon Nov 3, 2008 1:15 pm
Subject: [Clip] Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "Don - HtmlFixIt.com" <don@...> wrote:
>
> Sheri wrote:
> > --- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@> wrote:
> >
> >> I want to end up with a list like......
> >>
> >> 000001,0.verizon.windows2000
> >> 000003,0.verizon.windowsxp
> >> 000012,24hoursupport.helpdesk
> >> 000008,alt.computer
> >>
> >> Is there an existing way/clip to do this ? If not then can
> >> someone provide the needed code to produce this result please ?
> >>
> >
> > This will do it exactly as above, but version 5+ is required:
> >
> > ^!SetScreenUpdate Off
> > ^!Jump Doc_End
> > ^!If ^$GetCol$>1 Next Else Skip
> > ^!InsertText ^P
> > ^!Jump Doc_Start
> > :Loop
> > ^!Find "^(.+\r\n)\1*" RS
> > ^!IfError Quit
> > ^!Set %count%=^$StrCount("^%NL%";"^$GetSelection$";Yes;Yes)$
> > ^!Set %fill%=^$Calc(6-^$StrSize(^%count%)$)$
> > ^!Replace "(.+\r\n)\1*" >> "^$StrFill("0";^%fill%)$^%count%,$1" RHS
> > ^!Goto Loop
> > :Quit
> > ^!ClearVariable %count%
> > ^!ClearVariable %fill%
> > ;end of clip
>
>
> I have done that much less efficiently in the past.
>
> I'll try to break it down ...
> set screen update off just speeds life up
> jump doc end takes us to the end

> I think you are adding a blank line at the end next ...
> interesting way -- although you could have multiple blank lines
> at the end and you aren't removing them

Doesn't matter to the clip if there are multiple blank lines at the
end -- only thing that matters is, the last line with content needs to
have a CRLF aka ^%NL% at the end of it.

> Loop ... finds basically anything of one character or more
> followed by a new line

> if there is an error it quits ... so if there were a blank line
> in the middle of the list, it would quit because it is less than
> one in length?

Find finds next, it skips what doesn't match. So a blank line in the
middle is skipped over. Only problem with a blank line in the middle
would be if it occurs in the middle of repeated content. Each set of
repeated content needs to be consecutive, so a blank line would cause
multiple count outputs for that content/line.

>
> PLEASE EXPLAIN THIS PART:
> It apparently counts the number of times the string occurs in the
> document? -- this part confused me a little. I assume that the
> \1* is the key part because it finds all incidents of that term,
> highlights them and deletes them to replace them with your final
> product.

\1 Matches the same thing that matched for substring 1, i.e., the part
in parentheses (.+\r\n)

IOW, a repetition of the whole line.

The asterisk after \1 says it can match zero or more times.

After the find, the repeated lines are selected. So to find the number
of repetitions, I just count the number of ^%NL%'s in the selection
(aka highlight).

>
> I get the $1 being the () part of the find.
>  From there it essentially just cycles.
>
>
> Sheri, even though his data was sorted, should we not do a sort
> to begin?

To do its job, the repetitions need to be consecutive, so unless
already sorted, yes.

> What about word wrap.  Could it affect your outcome at all?

No, word wrap does not add ^%NL%'s

>
>
> Here is how I did something similar without regex -- I bet yours
> is faster. In my case I am taking one element out of a delimited
> list vs his example that has just one element, ie, the entire
> line.

> Here is mine:

> :NewTeam
> ;first time set team
> ^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
> ;^!Info ^%GrabField2%
> ^!Set %Team%=^$GetSelection$
> ^!Set %TeamCount%=0
> ;^!Info ^%TeamCount%
> :Loop
> ;get team for this line
> ^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
> ;be sure that this line is for current team
> ;if not, go to ProcessTeam
> ;otherwise continue here
> ^!If "^%Team%" <> "^$GetSelection$" ProcessTeam
> ^!Set %TeamCount%=^$Calc(^%TeamCount%+1;0)$
> ;^!Info ^%TeamCount%
> ^!Jump +1
> ^!GoTo Loop
>
> :ProcessTeam
> ;There is more here that does something with the info
> ^!GoTo NewTeam
>

That looks fine, John may prefer it since he was still using 4.95 in a
previous posting this year. Setting screenupdate off might make it faster.

John, there a free Light version of 5.7b (latest version) that
includes clipcode and regex capability.

Regards,
Sheri

#18617 From: Alec Burgess <buralex@...>
Date: Mon Nov 3, 2008 9:14 pm
Subject: Re: [Clip] Re: Line frequency analysis.
alecb3ca
Send Email Send Email
 
Sheri (silvermoonwoman@...) wrote (in part)  (on 2008-11-03 at
08:15):
>  That looks fine, John may prefer it since he was still using 4.95 in a
>  previous posting this year. Setting screenupdate off might make it
>  faster.

Sheri -

Version 5.7 of Notetab Standard $29.95 US
Version 5.7 of Notetab Pro ......... $19.95 US
Version 5.7 of Notetab Light ...... free
Keeping track of which version every past poster to yahoo-groups is
using ... Priceless!

>  John, there a free Light version of 5.7b (latest version) that
>  includes clipcode and regex capability.



[Non-text portions of this message have been removed]

#18618 From: Robin & Blaine <lighthouse101@...>
Date: Tue Nov 4, 2008 2:14 am
Subject: Linux advise
roblainethree
Send Email Send Email
 
I'm going to dump Microsoft and switch to Linux. I'd like to keep
NoteTab and tidy. Would anyone have an idea which build of Linux works
best ... please tell me I can keep NoteTab and all of it's wonderful
features.

#18619 From: John Fitzsimons <johnf@...>
Date: Tue Nov 4, 2008 2:38 am
Subject: Re: [Clip] Re: Line frequency analysis.
johnf@...
Send Email Send Email
 
On Mon, 03 Nov 2008 04:48:45 -0000, Sheri wrote:

>--- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@...> wrote:

Hi Cheri,

>> I want to end up with a list like......

>> 000001,0.verizon.windows2000
>> 000003,0.verizon.windowsxp
>> 000012,24hoursupport.helpdesk
>> 000008,alt.computer

>> Is there an existing way/clip to do this ? If not then can someone
>> provide the needed code to produce this result please ?

>This will do it exactly as above, but version 5+ is required:

Thanks for the mention. I downloaded 5+ to try it out.

>^!SetScreenUpdate Off
>^!Jump Doc_End
>^!If ^$GetCol$>1 Next Else Skip
>^!InsertText ^P
>^!Jump Doc_Start
>:Loop
>^!Find "^(.+\r\n)\1*" RS
>^!IfError Quit
>^!Set %count%=^$StrCount("^%NL%";"^$GetSelection$";Yes;Yes)$
>^!Set %fill%=^$Calc(6-^$StrSize(^%count%)$)$
>^!Replace "(.+\r\n)\1*" >> "^$StrFill("0";^%fill%)$^%count%,$1" RHS
>^!Goto Loop
>:Quit
>^!ClearVariable %count%
>^!ClearVariable %fill%
>;end of clip

Excellent ! I started with a file with more than 200K lines and it did
the job very very quickly. Many thanks.

I did a quick check of some of the totals and although they didn't all
match the "Occurrences" I did with S/R they were very close.
Certainly fine for what I wanted.

You are very clever for having done that. I wish I were as smart.
I have done programming BUT reg exps still intimidate me greatly.


Regards, John.

#18620 From: John Fitzsimons <johnf@...>
Date: Tue Nov 4, 2008 3:13 am
Subject: Re: [Clip] Linux advise
johnf@...
Send Email Send Email
 
On Mon, 03 Nov 2008 21:14:57 -0500, Robin & Blaine wrote:

>I'm going to dump Microsoft and switch to Linux. I'd like to keep
>NoteTab and tidy. Would anyone have an idea which build of Linux works
>best ...

Best for doing what ? That is like asking which is the best car, best
flower, best food etc.

This link should help you....

http://distrowatch.com/

and/or

http://www.tldp.org/HOWTO/DOS-Win-to-Linux-HOWTO.html

>please tell me I can keep NoteTab and all of it's wonderful
>features.

Is there a Linux version ? I doubt it. If there isn't however you
should be able to run it under Wine.


Regards, John.

#18621 From: "Alan C" <acummingsus@...>
Date: Tue Nov 4, 2008 4:02 am
Subject: OT was Re: [Clip] Linux advise
acummingsus
Send Email Send Email
 
CC'd this also to ntb-OffTopic@yahoogroups.com (ntb-offtopic yahoogroups
list) Please, if anyone reply to this post, verify that your reply only goes
to ntb-offtopic and *not* to here/clips.

On Mon, Nov 3, 2008 at 6:14 PM, Robin & Blaine <lighthouse101@...>wrote:

[ Linux curious . . . ]

http://tech.groups.yahoo.com/group/ntb-linux/

Notetab runs in wine on Linux

I run Slackware 12.1 (but, though Slack *is* popular amongst a certain
crowd, this distro is not everyone's choice of distro). The appeal: huge
community support; simple and easy; many programmers contributions as
sizeable portion of said community; lends itself well to customization; I
have *full* control (over the what where how of what's on my sys [apps,
etc.] and how it's configured).

con: simple and easy [roll up your sleeves, edit some config files manually
with an editor] and ditto with customization and ditto with my *full*
control.  (sometimes [though likely niot often, if at all] the auto-config
thingy in other distro not always does perfect -- but it does do it their
way.

I have Win 2K SP4 runs in the Qemu virtual machine on top of Slackware
(Slack is the host, Win 2K is the guest OS -- Notetab works superbly in said
Win 2K (Win 2K is Win 2K whether it is on real hardware or on virtualized
[software container that emulates/fakes] hardware.

I've recently now an Intel dual core with Slack 12.1 on it -- next is to try
Win XP in some of the virtual that target this CPU such as Xen, KVM kernel
virtual machine -- oop, perhaps I already goofed as maybe the [for dual core
Intel optimization] virtual layer goes onto the HD first and then/next on
with the operating systems.

It's so much fun to run two operating systems simultaneously on one hardware
box . . .
--
Alan.


[Non-text portions of this message have been removed]

#18622 From: Piotr Bienkowski <syntax@...>
Date: Tue Nov 4, 2008 4:47 am
Subject: Re: [Clip] Linux advise
syntaxpb
Send Email Send Email
 
John Fitzsimons wrote:
> On Mon, 03 Nov 2008 21:14:57 -0500, Robin & Blaine wrote:
>
>
>> I'm going to dump Microsoft and switch to Linux. I'd like to keep
>> NoteTab and tidy. Would anyone have an idea which build of Linux works
>> best ...
>>
>
>
You might try running NTP through WINE or Crossover Office. The first
one is free, the other one is a commercial emulator for running Windows
software on Linux.

HTH

Piotr

> Best for doing what ? That is like asking which is the best car, best
> flower, best food etc.
>
> This link should help you....
>
> http://distrowatch.com/
>
> and/or
>
> http://www.tldp.org/HOWTO/DOS-Win-to-Linux-HOWTO.html
>
>
>> please tell me I can keep NoteTab and all of it's wonderful
>> features.
>>
>
> Is there a Linux version ? I doubt it. If there isn't however you
> should be able to run it under Wine.
>
>
> Regards, John.
>
> ------------------------------------
>
> Fookes Software: http://www.fookes.com/
> NoteTab website: http://www.notetab.com/
> NoteTab Discussion Lists: http://www.notetab.com/groups.php
>
> ***
> Yahoo! Groups Links
>
>
>
>
>
>



[Non-text portions of this message have been removed]

#18623 From: John Fitzsimons <johnf@...>
Date: Tue Nov 4, 2008 6:59 am
Subject: Re: [Clip] Re: Line frequency analysis.
johnf@...
Send Email Send Email
 
On Mon, 03 Nov 2008 07:01:02 -0500, Don - HtmlFixIt.com wrote:

Hi Don,

< snip >

>Here is how I did something similar without regex -- I bet yours is faster.
>In my case I am taking one element out of a delimited list vs his
>example that has just one element, ie, the entire line.  Here is mine:

>:NewTeam
>;first time set team
>^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
>;^!Info ^%GrabField2%
>^!Set %Team%=^$GetSelection$
>^!Set %TeamCount%=0
>;^!Info ^%TeamCount%
>:Loop
>;get team for this line
>^!Set %GrabField2%=^$GetField(^$GetRow$;^%TeamField%)$
>;be sure that this line is for current team
>;if not, go to ProcessTeam
>;otherwise continue here
>^!If "^%Team%" <> "^$GetSelection$" ProcessTeam
>^!Set %TeamCount%=^$Calc(^%TeamCount%+1;0)$
>;^!Info ^%TeamCount%
>^!Jump +1
>^!GoTo Loop

>:ProcessTeam
>;There is more here that does something with the info
>^!GoTo NewTeam

Thanks. I did give it a go in 4.95 but unfortunately it didn't finish.
It took about a half hour to go through my text file and then kept
doing something (without producing any output) for another half
an hour. Before I stopped it.

Regards, John.

#18624 From: "Sheri" <silvermoonwoman@...>
Date: Tue Nov 4, 2008 12:24 pm
Subject: [Clip] Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@...> wrote:

> I did a quick check of some of the totals and although they didn't all
> match the "Occurrences" I did with S/R they were very close.
> Certainly fine for what I wanted.

Can you explain the differences? Might there be spaces at the end of
some lines or something?

Regards,
Sheri

#18625 From: sisterscape <sisterscape@...>
Date: Tue Nov 4, 2008 2:43 pm
Subject: Re: [Clip] Linux advise
sisterscape
Send Email Send Email
 
I am copying this also to the NoteTab Linux list which started over a year ago.

My distro of choice is Ubuntu and NTB works fine in Wine (not so fine in
Crossover when last I tried).

If you want to explore the variety of Linux distros, here's a good summary:

http://www.linux.com/distributions/

Welcome to a REAL operating system!!

Sister


--- On Mon, 11/3/08, Robin & Blaine <lighthouse101@...> wrote:

> From: Robin & Blaine <lighthouse101@...>
> Subject: [Clip] Linux advise
> To: ntb-clips@yahoogroups.com
> Date: Monday, November 3, 2008, 8:14 PM
> I'm going to dump Microsoft and switch to Linux. I'd
> like to keep
> NoteTab and tidy. Would anyone have an idea which build of
> Linux works
> best ... please tell me I can keep NoteTab and all of
> it's wonderful
> features.
>
>
> ------------------------------------
>
> Fookes Software: http://www.fookes.com/
> NoteTab website: http://www.notetab.com/
> NoteTab Discussion Lists: http://www.notetab.com/groups.php
>
> ***
> Yahoo! Groups Links
>
>
>

#18626 From: Robin & Blaine <lighthouse101@...>
Date: Wed Nov 5, 2008 4:21 am
Subject: Re: Linux advise
roblainethree
Send Email Send Email
 
Thanks. That's what I needed. Good advise. I now know were to start
looking and I'll take a look at the Linux group.
Thanks again.

#18627 From: "Flo" <flo.gehrke@...>
Date: Wed Nov 5, 2008 12:39 pm
Subject: Re: Line frequency analysis.
jonas_ramus
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
>
> --- In ntb-clips@yahoogroups.com, John Fitzsimons <johnf@> wrote:
>
> >
> > I want to end up with a list like......
> >
> > 000001,0.verizon.windows2000
> > 000003,0.verizon.windowsxp
> > 000012,24hoursupport.helpdesk
> > 000008,alt.computer
> >
> > Is there an existing way/clip to do this ? If not then can someone
> > provide the needed code to produce this result please ?
> >
>
> This will do it exactly as above, but version 5+ is required:
>
> ^!SetScreenUpdate Off
> ^!Jump Doc_End
> ^!If ^$GetCol$>1 Next Else Skip
> ^!InsertText ^P
> ^!Jump Doc_Start
> :Loop
> ^!Find "^(.+\r\n)\1*" RS
> ^!IfError Quit
> ^!Set %count%=^$StrCount("^%NL%";"^$GetSelection$";Yes;Yes)$
> ^!Set %fill%=^$Calc(6-^$StrSize(^%count%)$)$
> ^!Replace "(.+\r\n)\1*" >> "^$StrFill("0";^%fill%)$^%count%,$1" RHS
> ^!Goto Loop
> :Quit
> ^!ClearVariable %count%
> ^!ClearVariable %fill%
> ;end of clip


Sheri,

Just another idea concerning your solution:

In the past, we have used that pattern...

^(.+\r\n)\1*

quite often for finding duplicate lines. I think we could also use...

^(.+)(\r\n\1)*

The advantage is that, with this pattern, we don't have to care for
CRNL at the end of the list.

In your clip, a final NL is (also) needed for counting the selected
(duplicate) lines. But, instead of calculating the NL, we could
write...

^$Calc(1+^$GetRowEnd$-^$GetRowStart$)$

So I think the clip could be slightly shortened like this...


^!Jump Doc_Start
:Loop
^!Find "^(.+)(\r\n\1)*" RS
^!IfError End
^!Set %Count%=^$Calc(1+^$GetRowEnd$-^$GetRowStart$)$
^!Set %Fill%=^$Calc(6-^$StrSize(^%Count%)$)$
^!Replace "(.+)(\r\n\1)*" >> "^$StrFill("0";^%Fill%)$^%Count%,$1" RS
^!Goto Loop

The only minor disadvantage: Empty lines within the list will provide
wrong results. So if there are any, we have to remove them with an
additional command line.

Do you agree with this solution?

Regards,
Flo
 

#18628 From: "Sheri" <silvermoonwoman@...>
Date: Wed Nov 5, 2008 4:03 pm
Subject: Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "Flo" <flo.gehrke@...> wrote:
>
> Sheri,
>
> Just another idea concerning your solution:
>
> In the past, we have used that pattern...
>
> ^(.+\r\n)\1*
>
> quite often for finding duplicate lines. I think we could also use...
>
> ^(.+)(\r\n\1)*
>
> The advantage is that, with this pattern, we don't have to care
> for CRNL at the end of the list. In your clip, a final NL is
> (also) needed for counting the selected (duplicate) lines. But,
> instead of calculating the NL, we could write...
>
> ^$Calc(1+^$GetRowEnd$-^$GetRowStart$)$
>
> So I think the clip could be slightly shortened like this...
>
>
> ^!Jump Doc_Start
> :Loop
> ^!Find "^(.+)(\r\n\1)*" RS
> ^!IfError End
> ^!Set %Count%=^$Calc(1+^$GetRowEnd$-^$GetRowStart$)$
> ^!Set %Fill%=^$Calc(6-^$StrSize(^%Count%)$)$
> ^!Replace "(.+)(\r\n\1)*" >> "^$StrFill("0";^%Fill%)$^%Count%,$1" RS
> ^!Goto Loop
>
> The only minor disadvantage: Empty lines within the list will
> provide wrong results. So if there are any, we have to remove
> them with an additional command line.
>
> Do you agree with this solution?
>
> Regards,
> Flo
>  
>

That works fine. Here's one that ignores trailing white space and
empty lines in the data (but goes back to counting strings for count):

^!SetScreenUpdate off
^!Jump Doc_Start
:Loop
^!Find "^(.+)(\s*\r\n\1)*" RS
^!IfError Out
^!SetArray %farray%=^$GetReSubstrings$
;begin long line
^!Set
%Count%=^$StrCount("^%NL%";"^$GetDocReplaceAll("\s*(\r\n)+|(?<=.)\z";"\r\n")$";Y\
ES;YES)$
;end long line
^!Set %Fill%=^$Calc(6-^$StrSize(^%Count%)$)$
^!InsertText ^$StrFill("0";^%fill%)$^%Count%,^%farray1%
^!Goto Loop
:Out
^!Set %farray%=""
^!ClearVariable %farray%
^!ClearVariable %Count%
^!ClearVariable %Fill%
;end of clip

#18629 From: "joy8388608" <mycroftj@...>
Date: Wed Nov 5, 2008 3:40 pm
Subject: Problem with simple modification of sample HTML clip
joy8388608
Send Email Send Email
 
The first clip (I added " - Selected is Text" to the name) was a
sample in the HTML.clb file.

I wanted to clone it and create a clip that used the selected text as
the link instead of the text so I created the second clip (HRef Link
- Selected is Link) but it works inconsistantly.

Although the dialog box looks ok, it usually replaces the selected
link with <A>text field contents</A>.  It works SOMETIMES, but I
can't figure out why. I thought the T=T would insert the HREF value
so it would come out like this
    <A HREF="http://virusscan.jotti.org">text</A>

Would executing the original script affect it?
Does the contents of the clipboard (control-c to copy) affect
anything?  I thought the selected text is unrelated to what I did
contol-c on.

H="HRef Link - Selected is Text"  <-- Original. Works fine.
^!InsertHtml <A ^?[(T=T;F="HTML Files|*.*htm*;*.asp;*.css")Link to
web page=]>^?[Link text=^&]</A>

H="HRef Link - Selected is Link"  <--- my clone. Doesn't work well.
^!InsertHtml <A ^?[(T=T)Link to web page=^&]>^?[Link text=" "]</A>

Thanks for any light you can shed on this.

Joy

#18630 From: "Sheri" <silvermoonwoman@...>
Date: Wed Nov 5, 2008 7:31 pm
Subject: Re: Problem with simple modification of sample HTML clip
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "joy8388608" <mycroftj@...> wrote:
>
> The first clip (I added " - Selected is Text" to the name) was a
> sample in the HTML.clb file. I wanted to clone it and create a
> clip that used the selected text as the link instead of the text
> so I created the second clip (HRef Link - Selected is Link) but
> it works inconsistantly.
>
> Although the dialog box looks ok, it usually replaces the selected
> link with <A>text field contents</A>.  It works SOMETIMES, but I
> can't figure out why. I thought the T=T would insert the HREF value
> so it would come out like this
>    <A HREF="http://virusscan.jotti.org">text</A>

works for me. Can't seem to make it fail.

>
> Would executing the original script affect it?

No, but are you executing these clips on their own, as presented, or
combining them into one clip? The token ^& represents the text that
was selected prior to starting a clip. It doesn't change as a result
of clip commands that might alter the selection.

Regards,
Sheri

#18631 From: loro <loro-spam01-@...>
Date: Thu Nov 6, 2008 1:21 am
Subject: Re: [Clip] Problem with simple modification of sample HTML clip
yastupidhoo
Send Email Send Email
 
Joy wrote:
>The first clip (I added " - Selected is Text" to the name) was a
>sample in the HTML.clb file.
>
>I wanted to clone it and create a clip that used the selected text as
>the link instead of the text so I created the second clip (HRef Link
>- Selected is Link) but it works inconsistantly.
>
>Although the dialog box looks ok, it usually replaces the selected
>link with <A>text field contents</A>.  It works SOMETIMES, but I
>can't figure out why. I thought the T=T would insert the HREF value
>so it would come out like this
>    <A HREF="http://virusscan.jotti.org">text</A>

No, T=T is one of the field options you can use. See "Clip Wizard and
Fields" in Clip Help. I've actually never used this one. It seems to
a do a whole lot more than expected. It's what creates the browse button.

If I understand you right you want to select a URL and have the clip
put it as the value of href. Then I guess the wizard should ask you
to type in the link text instead? Something like this.

----------------------
h="Link-the-link"
^!InsertHTML <a href="^&">^?[Link text=]</a>
----------------------

Lotta

#18632 From: "Flo" <flo.gehrke@...>
Date: Thu Nov 6, 2008 4:20 pm
Subject: Re: Line frequency analysis.
jonas_ramus
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, "Sheri" <silvermoonwoman@...> wrote:
>
> That works fine. Here's one that ignores trailing white space and
> empty lines in the data (but goes back to counting strings for
count):
>
> ^!SetScreenUpdate off
> ^!Jump Doc_Start
> :Loop
> ^!Find "^(.+)(\s*\r\n\1)*" RS
> ^!IfError Out
> ^!SetArray %farray%=^$GetReSubstrings$
> ;begin long line
> ^!Set
> %Count%=^$StrCount("^%NL%";"^$GetDocReplaceAll("\s*(\r\n)+|(?<=.)
\z";"\r\n")$";YES;YES)$
> ;end long line
> ^!Set %Fill%=^$Calc(6-^$StrSize(^%Count%)$)$
> ^!InsertText ^$StrFill("0";^%fill%)$^%Count%,^%farray1%
> ^!Goto Loop
> :Out
> ^!Set %farray%=""
> ^!ClearVariable %farray%
> ^!ClearVariable %Count%
> ^!ClearVariable %Fill%
> ;end of clip

Sheri,

I think there's a problem with this solution. It ignores trailing
blanks and empty lines in the counting of duplicate lines but not in
the ^!Find command. So if we have got...

0.verizon.windowsxp  <-- trailing blank
0.verizon.windowsxp
0.verizon.windowsxp

for example, the clip doesn't find three duplicates but interprets
this as a singular line plus two duplicates of another line. That is,
it works fine only on the condition that all three duplicates end
with a trailing blank.

So it may be better to remove trailing blanks prior to ^!Find. Isn't
it?

Regards,
Flo

P.S. By the way: It makes no difference -- but what about...

^$GetDocReplaceAll("\s+$|(?<=.)\z";"\r\n")$

(since NT v.5.0 the \s matches "any white space", including CRNL).
 

#18633 From: Sheri <silvermoonwoman@...>
Date: Thu Nov 6, 2008 4:52 pm
Subject: Re: [Clip] Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
Flo wrote:
> Sheri,
>
> I think there's a problem with this solution. It ignores trailing
> blanks and empty lines in the counting of duplicate lines but not in
> the ^!Find command. So if we have got...
>
> 0.verizon.windowsxp  <-- trailing blank
> 0.verizon.windowsxp
> 0.verizon.windowsxp
>
> for example, the clip doesn't find three duplicates but interprets
> this as a singular line plus two duplicates of another line. That is,
> it works fine only on the condition that all three duplicates end
> with a trailing blank.
>
You're right.
> So it may be better to remove trailing blanks prior to ^!Find. Isn't
> it?
>
Not necessary if we change the ^!Find to this:

^!Find "^(.+\S)(\s*\r\n\1)*" RS

> P.S. By the way: It makes no difference -- but what about...
>
> ^$GetDocReplaceAll("\s+$|(?<=.)\z";"\r\n")$
>
> (since NT v.5.0 the \s matches "any white space", including CRNL).
>
Haven't tested that and it may work fine. However it looks suspicious
because: we are using the PCRE multiline option by default in NoteTab so
$ matches at line ends (and line ends by definition are followed by \r\n
when showing in a NoteTab document) but \s+ matches across line breaks.
So how can it match $ if it picks up all the \r\n's? In order to match $
it would need to backtrack. It might create an issue if it backtracks
between the \r and \n.

I'll try to test it later.

Regards,
Sheri

#18634 From: Sheri <silvermoonwoman@...>
Date: Thu Nov 6, 2008 5:05 pm
Subject: Re: [Clip] Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
Sheri wrote:
>
> Not necessary if we change the ^!Find to this:
>
> ^!Find "^(.+\S)(\s*\r\n\1)*" RS
>
Hmn, maybe it should be

^!Find "^(.*\S)(\s*\r\n\1)*" RS

just in case there is only one visible character on the line.

Regards,
Sheri

#18635 From: loro <loro-spam01-@...>
Date: Fri Nov 7, 2008 4:41 am
Subject: Peculiarity with Modify Block
yastupidhoo
Send Email Send Email
 
Hi,

I faintly recall this has been discussed before, but I don't find it.
Problem: if you want to copy/cut/delete the rightmost column and that
column is only 1 character wide, nothing happens. Why?

Lotta

#18636 From: "Chuck Seward" <Chuck.Seward@...>
Date: Fri Nov 7, 2008 12:57 pm
Subject: Re: [Clip] Peculiarity with Modify Block
remitmon
Send Email Send Email
 
Is it possible the 1 character is a tab?  I've found that the block
capabilities aren't too happy with tabs as opposed to spaces.
Chuck
___________________________
http://urlkiss.com/03w?HomePort
http://www.linkedin.com/in/chuckseward
http://pyr8hd.blogspot.com/


On Thu, Nov 6, 2008 at 23:41, loro <loro-spam01-@...> wrote:

>   Hi,
>
> I faintly recall this has been discussed before, but I don't find it.
> Problem: if you want to copy/cut/delete the rightmost column and that
> column is only 1 character wide, nothing happens. Why?
>
> Lotta
>
>
>


[Non-text portions of this message have been removed]

#18637 From: "Sheri" <silvermoonwoman@...>
Date: Fri Nov 7, 2008 2:14 pm
Subject: [Clip] Re: Line frequency analysis.
silvermoonwo...
Send Email Send Email
 
--- In ntb-clips@yahoogroups.com, Sheri <silvermoonwoman@...> wrote:
>
> Flo wrote:
> > Sheri,
> >
> > I think there's a problem with this solution. It ignores trailing
> > blanks and empty lines in the counting of duplicate lines but not in
> > the ^!Find command. So if we have got...
> >
> > 0.verizon.windowsxp  <-- trailing blank
> > 0.verizon.windowsxp
> > 0.verizon.windowsxp
> >
> > for example, the clip doesn't find three duplicates but
> > interprets this as a singular line plus two duplicates of another
> > line. That is, it works fine only on the condition that all three
> > duplicates end with a trailing blank. You're right. So it may be
> > better to remove trailing blanks prior to ^!Find. Isn't it?

> >
> Not necessary if we change the ^!Find to this:
>
> ^!Find "^(.+\S)(\s*\r\n\1)*" RS
>
> > P.S. By the way: It makes no difference -- but what about...
> >
> > ^$GetDocReplaceAll("\s+$|(?<=.)\z";"\r\n")$
> >
> > (since NT v.5.0 the \s matches "any white space", including
> > CRNL). Haven't tested that and it may work fine. However it looks
> > suspicious because: we are using the PCRE multiline option by
> > default in NoteTab so $ matches at line ends (and line ends by
> > definition are followed by \r\n when showing in a NoteTab
> > document) but \s+ matches across line breaks. So how can it match
> > $ if it picks up all the \r\n's? In order to match $ it would
> > need to backtrack. It might create an issue if it backtracks
> > between the \r and \n.
>
> I'll try to test it later.

Indeed that pattern matches in the middle of \r\n. So after
replacement, we end up with \r\n\n. The reason it makes no difference
to the outcome is because we are counting "\r\n" after applying this
in ^$GetDocReplaceAll$. You would be able to see a problem if that
were getting inserted in the document (however, something else happens
when you insert it, \r\n\n becomes \r\n\r\n because the input control
needs line breaks to be \r\n -- you can test the string size prior to
insertion vs testing the size of a selection after insertion).

I think it is preferable to greedily replace white space that precedes
"\r\n" with "". The white space does include other CRLFs.

Regards,
Sheri

#18638 From: loro <loro-spam01-@...>
Date: Fri Nov 7, 2008 3:31 pm
Subject: Re: [Clip] Peculiarity with Modify Block
yastupidhoo
Send Email Send Email
 
Hi,

Chuck Seward wrote:
>Is it possible the 1 character is a tab?  I've found that the block
>capabilities aren't too happy with tabs as opposed to spaces.


No, it can be anything. Take the below, you can't do anything with
the X column. Or maybe I should say I can't.

000000X
000000X
000000X
000000X

Lotta

#18639 From: Sheri <silvermoonwoman@...>
Date: Fri Nov 7, 2008 3:41 pm
Subject: Re: [Clip] Peculiarity with Modify Block
silvermoonwo...
Send Email Send Email
 
loro wrote:
> Hi,
>
> Chuck Seward wrote:
>
>> Is it possible the 1 character is a tab?  I've found that the block
>> capabilities aren't too happy with tabs as opposed to spaces.
>>
>
>
> No, it can be anything. Take the below, you can't do anything with
> the X column. Or maybe I should say I can't.
>
> 000000X
> 000000X
> 000000X
> 000000X
>
> Lotta
>
Cut and Delete don't, but Copy and Sum work for me.

Regards,
Sheri

#18640 From: loro <loro-spam01-@...>
Date: Fri Nov 7, 2008 4:31 pm
Subject: Re: [Clip] Peculiarity with Modify Block
yastupidhoo
Send Email Send Email
 
Sheri wrote:
>Cut and Delete don't, but Copy and Sum work for me.

Sheri, you are right. I got things confused. Cut and Delete it is. Copy works.

I can't figure out if there is a reason for this behavior.

Lotta

#18641 From: Sheri <silvermoonwoman@...>
Date: Fri Nov 7, 2008 4:38 pm
Subject: Re: [Clip] Peculiarity with Modify Block
silvermoonwo...
Send Email Send Email
 
loro wrote:
> Sheri wrote:
>
>> Cut and Delete don't, but Copy and Sum work for me.
>>
>
> Sheri, you are right. I got things confused. Cut and Delete it is. Copy works.
>
> I can't figure out if there is a reason for this behavior.
>
> Lotta
>
Do you mean a "good" reason?

'cause I sure can't think of any. :D

#18642 From: loro <loro-spam01-@...>
Date: Fri Nov 7, 2008 5:19 pm
Subject: Re: [Clip] Peculiarity with Modify Block
yastupidhoo
Send Email Send Email
 
Sheri wrote:
>Do you mean a "good" reason?
>
>'cause I sure can't think of any. :D

I was trying to avoid the B word! ;-o) But I guess there could be
some obscure technical reason. Maybe.

I guess I've never needed to copy a one character rightmost column
before, because this "problem" is there in 4.95 too.

Lotta

Messages 18613 - 18642 of 23816   Oldest  |  < Older  |  Newer >  |  Newest
Add to My Yahoo!      XML What's This?

Copyright © 2010 Yahoo! Inc. All rights reserved.
Privacy Policy - Terms of Service - Guidelines NEW - Help