I did get a satisfactory explanation of the strategy, tactics, and raison d'etre of rugby when I was in New Zealand: 'There's a position for everybody in town, and we all work up a thirst.' But this doesn't seem to stretch far enough to cover either cricket or Nisus macros, which I still find impenetrable. 'Lagaan' helped with cricket; Kino helps with macros--but I don't think I'm going to master either one at this stage. Keep up the good work, Kino! -- Ferren ------------------------------------------------------------ (Dr) Ferren MacIntyre 1 Chemin des Echarts Campagne sur Aude 11260 France 42.91500N, 2.20900E +33 (0)468 748870 ------------------------------------------------------------- OSX 10.6.5 MacBook Pro 5,1 2.4 GHz Intel Core-2 Duo, 4 GB On Tue, Dec 28, 2010 at 06:00, NISUS automatic digest system < [log in to unmask]> wrote: > There are 7 messages totalling 502 lines in this issue. > > Topics of the day: > > 1. OT: Christmas Greetings (3) > 2. OT: cricket (was: Christmas Greetings) > 3. a macro essay: calculate non-contiguious selected digits (2) > 4. Two or Three things I Know about NWP Macro Language > > ---------------------------------------------------------------------- > > Date: Mon, 27 Dec 2010 07:53:41 +0000 > From: Chris <[log in to unmask]> > Subject: Re: OT: Christmas Greetings > > Listening to the news here in the UK this morning I suspect the pressure > is getting to Ponting. Haranguing both umpires is not the done thing. > > That said I wouldn't want him to be suspended since he should be another > cheap wicket for us to bag.... :-) > > >On the other hand, when there is a changing of the guard ... ;-) > > I agree. I'm old enough to know you never, ever, write off the Aussies.... > > Chris > > On 27/12/10 Geoffrey Heard wrote: > > >>Bit late to this, but Christmas greetings to all and best wishes for a > >>prosperous and healthy New Year. > >> > >>And, commiserations to Geoff on the Aussie's performance in the current > >>test match :) > > > >I have to admit, Chris, that I *LOVE* what's happening! Ponting et al > >told us all, when they were winning, that they didn't have to pay > >attention to what we all thought -- they would play how they liked, > >select who they liked, say what they liked, and be as nasty and > >arrogant as they liked. The fawning media supported them. > > > >I suspect lots of Australians are as happy as I am to see them > >getting their comeuppance. > > > >On the other hand, when there is a changing of the guard ... ;-) > > > >Cheers, geoff > > ------------------------------ > > Date: Mon, 27 Dec 2010 19:02:25 +1100 > From: Geoffrey Heard <[log in to unmask]> > Subject: Re: OT: cricket (was: Christmas Greetings) > > Hiya Chris > > >Listening to the news here in the UK this morning I suspect the pressure > >is getting to Ponting. Haranguing both umpires is not the done thing. > > And in the cirumstances, amazing. The Prior goes on to bat through to > stumps! Great stuff. > > >That said I wouldn't want him to be suspended since he should be another > >cheap wicket for us to bag.... :-) > > True, true. But it is such a bizarre game, you never know what is > going to happen. > > Still, with 4.5 times the Australia score, 5 wickets still in hand, > Trott batting like a beauty, to say nothing of Prior, abd 3 days to > play, England should feel a certsin smount of confidence. :D > > Cheers, geoff > > ------------------------------ > > Date: Mon, 27 Dec 2010 17:47:01 +0900 > From: Nobumi Iyanaga <[log in to unmask]> > Subject: Re: a macro essay: calculate non-contiguious selected digits > > Hello Kino, > > Thank you very much for your reply. > > On Dec 27, 2010, at 2:28 AM, Kino wrote: > > > > >> foreach $num in $selectedTexts > >> $theNum = Cast to Int $num > >> if $theNum == 0 > >> if $num != '0' > >> exit "$num is not a digit" > >> end > >> end > >> $theExpression &= $num & $theOperator > >> end > > > > Yeah, NWP macro does not have a proper command for that kind of > > verification. That is a bit annoying, but, in a certain sense, it > > is those shortcomings which make us more familiar with the macro > > language. Doing trials and errors to write a viable alternative, > > surely we learn something. > > Yes, I completely agree with you. On the other hand, I think that one > thing which still lacks in Nisus macro language is the possibility of > using sub-routine. When this will be possible, I think/hope that > writing macros will be much simpler (but before that, we -- I -- > should master the current macro language, which is not easy at all...!). > > >> $theLength = $theExpression.length > >> $theLength = $theLength - 1 > >> $theRange = Range.new (0, $theLength) > > > > You can condense these three lines into: > > > > $theRange = Range.new (0, $theExpression.length - 1) > > Ah, I would have not been able to find this by myself. Very > intelligent and helpful! > > > > >> $theExpression = $theExpression.substringInRange ($theRange) > > > > For such a purpose, I think you can use join command > > advantageously, like in the macro below. > > This is also very useful. It seems there are many interesting and > useful commands in the macro language, but it is difficult to > understand and use them when one is not familiar with it. Exercise > and experience...! > > > ### another version #### > ... > > This version is much simpler and cleverer. Thank you very much. I > will keep it in my macro file. > > I will reply to your other posting, and please wait some time... > > Best regard, > > Nobumi Iyanaga > Tokyo, > Japan > > ------------------------------ > > Date: Mon, 27 Dec 2010 07:18:49 -0400 > From: THDW <[log in to unmask]> > Subject: Re: OT: Christmas Greetings > > --Apple-Mail-568--538566938 > Content-Transfer-Encoding: quoted-printable > Content-Type: text/plain; > charset=windows-1252 > > > On 25 Dec 2010, at 19:04, Geoffrey Heard wrote: > > > It was the last Feudal family dispute -- the sovereigns of all the = > principal nations when the war started were cousins. Of course, = > underlying that was the treasure generated by power over less developed = > lands that could be sucked dry. > > This should clinch you the Us and Them Chair of modern history at Mel = > Gibson University.=20 > > You are overlooking the role of jingoism among the masses. Italy went to = > war in 1915 largely as the result of popular demand, not least from (the = > until then socialist) Benito Mussolini. > > T > > > seen in the Economist: > > > > In the spring of 1854, as the Crimean fighting began in earnest, an = > Anglican cleric declared that Russian Orthodoxy was as =93impure, = > demoralising, and intolerant as popery itself=94. What could be more = > natural, then, than to team up with Islam and popery to cleanse that = > terrible impurity? A French newspaper, meanwhile, gave warning that the = > Russians represented a special menace to all Catholics because =93they = > hope to convert us to their heresy=94. > > > > > > THDW > [log in to unmask] > > > > > --Apple-Mail-568--538566938 > Content-Transfer-Encoding: quoted-printable > Content-Type: text/html; > charset=windows-1252 > > <html><head></head><body style=3D"word-wrap: break-word; = > -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; = > "><br><div><div>On 25 Dec 2010, at 19:04, Geoffrey Heard wrote:</div><br = > class=3D"Apple-interchange-newline"><blockquote type=3D"cite"><span = > class=3D"Apple-style-span" style=3D"border-collapse: separate; = > font-family: 'Lucida Grande'; font-style: normal; font-variant: normal; = > font-weight: normal; letter-spacing: normal; line-height: normal; = > orphans: 2; text-indent: 0px; text-transform: none; white-space: normal; = > widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; = > -webkit-border-vertical-spacing: 0px; = > -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: = > auto; -webkit-text-stroke-width: 0px; font-size: medium; ">It was the = > last Feudal family dispute -- the sovereigns of all the principal = > nations when the war started were cousins. Of course, underlying that = > was the treasure generated by power over less developed lands that could = > be sucked dry.</span></blockquote><br></div><div>This should clinch you = > the Us and Them Chair of modern history at Mel Gibson = > University. </div><div><br></div><div>You are overlooking the role = > of jingoism among the masses. Italy went to war in 1915 largely as the = > result of popular demand, not least from (the until then socialist) = > Benito = > Mussolini.</div><div><br></div><div>T</div><div><br></div><div><br></div><= > div>seen in the = > Economist:</div><div><br></div><div><br></div><div><blockquote = > type=3D"cite"><span class=3D"Apple-style-span" style=3D"font-family: = > Verdana, Arial, sans-serif; font-size: 13px; color: rgb(51, 51, 51); = > line-height: 20px; ">In the spring of 1854, as the Crimean fighting = > began in earnest, an Anglican cleric declared that Russian Orthodoxy was = > as =93impure, demoralising, and intolerant as popery itself=94. What = > could be more natural, then, than to team up with Islam and popery to = > cleanse that terrible impurity? A French newspaper, meanwhile, gave = > warning that the Russians represented a special menace to all Catholics = > because =93they hope to convert us to their = > heresy=94.</span></blockquote></div><div><br></div><div><br></div><div><br= > ></div><br><div> > <span class=3D"Apple-style-span" style=3D"border-collapse: separate; = > color: rgb(0, 0, 0); font-family: 'Lucida Grande'; font-size: 16px; = > font-style: normal; font-variant: normal; font-weight: normal; = > letter-spacing: normal; line-height: normal; orphans: 2; text-align: = > auto; text-indent: 0px; text-transform: none; white-space: normal; = > widows: 2; word-spacing: 0px; -webkit-border-horizontal-spacing: 0px; = > -webkit-border-vertical-spacing: 0px; = > -webkit-text-decorations-in-effect: none; -webkit-text-size-adjust: = > auto; -webkit-text-stroke-width: 0; "><div>THDW</div><div><a = > href=3D"mailto:[log in to unmask]">[log in to unmask] > = > m</a></div><div><br class=3D"webkit-block-placeholder"></div></span><br = > class=3D"Apple-interchange-newline"> > </div> > <br></body></html>= > > --Apple-Mail-568--538566938-- > > ------------------------------ > > Date: Tue, 28 Dec 2010 03:18:19 +0900 > From: Kino <[log in to unmask]> > Subject: Re: a macro essay: calculate non-contiguious selected digits > > Hello Nobumi, > > On Dec 27, 2010, at 5:47 PM, Nobumi Iyanaga wrote: > > > On the other hand, I think that one thing which still lacks in Nisus = > macro language is the possibility of using sub-routine. When this will = > be possible, I think/hope that writing macros will be much simpler > > I agree with you. Due to the lack of sub-routine, sometimes I have to = > write a verrrrrry long loop repeating several code blocks again and = > again in it. That is annoying. > > > (but before that, we -- I -- should master the current macro language, = > which is not easy at all...!). > > > I remember the impression of something very stern I felt when I looked = > at NWP 1.1's Macro Reference for the first time. But believe me, it is = > far easier to master than it looks. For example, the naming scheme of = > commands is so consistent that you can know the syntax of a command from = > its name in most of the cases. Of course, I was in an uncommon = > situation. To test all new commands, I wrote a large number of small = > macros in a short period. So, if you do something similar (not for the = > current enlarged command set but for the basic one flagged as v1.1), I = > bet you will feel very comfortable with the NWP macro. It would take = > several days but worth trying, I think. Now I find the current NWP macro = > the easiest and the smartest of all the macro/scripting languages I have = > ever tried. NW Classic macro was simpler in some aspects but, with it, = > you were often forced to invent something acrobatic and tricky. > > The same applies to the regular expression. If there is something I know = > and you don't, that is just because I tested all special characters and = > syntactic elements, including Unicode properties, e.g. \p{Hebrew}, when = > they adopted the new regex library in NWP 1.0.1. > > BTW, according to my testings of years ago, the atomic group -- = > (?>subexp) -- is not especially efficient in NWP although it is = > supported properly. That does not mean that its implementation in NWP or = > in oniguruma (regex library) is bad. On the contrary, the regex library = > -- the one implemented in NWP at leaset -- seems to be very well = > optimized that you don't need using it in order to improve the = > performance. I'm not 100 % sure but that is my impression. > > >> You can condense these three lines into: > >>=20 > >> $theRange =3D Range.new (0, $theExpression.length - 1) > >=20 > > Ah, I would have not been able to find this by myself. > > Neither did I. Until I saw something similar in a macro written by = > Martin, I did not imagine such a construction to be possible. > > > Kino > > ------------------------------ > > Date: Tue, 28 Dec 2010 03:34:56 +0900 > From: Kino <[log in to unmask]> > Subject: Two or Three things I Know about NWP Macro Language > > Below are the essentials of what I came to know by exchanging messages = > with Martin at Nisus Soft and of some undocumented things I verified by = > myself. > > > - You can repeat the same commands several times without fearing a = > performance hit. I was told that NWP caches them. For example, recently = > I wrote such a routine in a macro. > = > <http://www2.odn.ne.jp/alt-quinon/files/NWPro/link/MakeLinkIndex_nwm.zip> > > foreach $sel in $sels > $attr =3D $sel.text.attributesAtIndex $sel.location > if $pages{$attr.link} =3D=3D undefined > $pages{$attr.link} =3D Array.new > end > $page =3D $sel.text.pageNumberAtIndex $sel.location > if $pages{$attr.link}.indexOfValue($page) =3D=3D -1 > $pages{$attr.link}.appendValue $page > end > $page =3D $sel.text.pageNumberAtIndex($sel.bound - 1) > if $pages{$attr.link}.indexOfValue($page) =3D=3D -1 > $pages{$attr.link}.appendValue $page > end > end > > Looking odd? In such a case, usually you would use a variable storing = > $attr.link ($linkText in the code below). But there is no significant = > difference in performance (I did benchmark tests) between the code above = > and a common way of coding like this: > > foreach $sel in $sels > $attr =3D $sel.text.attributesAtIndex $sel.location > $linkText =3D $attr.link > if $pages{$linkText} =3D=3D undefined > $pages{$linkText} =3D Array.new > end > $page =3D $sel.text.pageNumberAtIndex $sel.location > if $pages{$linkText}.indexOfValue($page) =3D=3D -1 > $pages{$linkText}.appendValue $page > end > $page =3D $sel.text.pageNumberAtIndex($sel.bound - 1) > if $pages{$linkText}.indexOfValue($page) =3D=3D -1 > $pages{$linkText}.appendValue $page > end > end > > > - "$textObject.find" is much faster than "Find" command because the = > former does not create selections actually. There is a huge difference = > when processing a very large number of occurrences. > > > > - Something similar applies to "Push Target Selection ... Pop Target = > Selection" command. For example, > > $doc =3D Document.active > $sels =3D $doc.text.findAll '(?<=3D\t)\S+(?=3D\t)', 'E' > Push Target Selection $sels > Set Font Name 'Times' > Pop Target Selection > > is much and much faster than > > Find All '(?<=3D\t)\S+(?=3D\t)', 'E' > Set Font Name 'Times' > > when there will be a large number of selections. > > > - When inserting a large number of footnotes, it is not recommendable to = > process from the document end to the document start. Then, NWP would be = > forced to update note numbers of all the already inserted footnotes each = > time you insert a new one. > > Then, one inconvenience in processing from the document start is the = > necessity to update TextSelection objects when a new footnote has been = > inserted. For that, you can use a routine in a macro > = > < > http://www2.odn.ne.jp/alt-quinon/files/NWPro/footendnotes/ConvertHTMLNote= > s_nwm.zip> > written for converting notes in e-texts such as > <http://socserv.mcmaster.ca/~econ/ugcm/3ll3/hume/treatise1.html> > > In that macro, you will find... > > $offset =3D 0 > > # $ref is a TextSelection object corresponding, for example, with "(47)" = > in the html file > foreach $ref in $noteRef > # Extract the subtext of the first value of $noteText (array) > $note =3D $noteText.dequeue.subtext > # replace "47. " of "47. Sect. 4." with $defNoteText > $note.findAndReplace $noteNum, $defNoteText, 'E-i' > # Store the current $text.length in $previousTextLength > $previousTextLength =3D $text.length > # Modify the location of $ref so that it fits the current state = > of $text > $ref.location -=3D $offset > # Delete "(47)". > $text.deleteInRange $ref.range > # Insert a footnote with note text ($note) > Note.insertFootnoteInTextAtIndex $text, $ref.location, $note > # Increase $offset by (PreviousTextLength - CurrentTextLength) > $offset +=3D $previousTextLength - $text.length > end > > The code above is based on the one given by Martin when I complaint = > about the performance of an oldest version of my macro, namely = > < > http://www2.odn.ne.jp/alt-quinon/files/NWPro/footendnotes/Body2Note_nwm.z= > ip>. > > > - And... probably you would already know but there is a long-standing = > bug in the interpretation of back slash enclosed by single quotes. The = > find expression in > > Find '\\footnote{[^}]+}', 'E' > > will be interpreted as '\f' (page break) followed by 'ootnote{[^}]+}'. = > To work it around, you have to put three (or four?) back slashes. That's = > ugly. So I always use a hexadecimal notation \x{5C}. > > > Kino > > ------------------------------ > > Date: Tue, 28 Dec 2010 12:53:52 +1100 > From: Geoffrey Heard <[log in to unmask]> > Subject: Re: OT: Christmas Greetings > > >On 25 Dec 2010, at 19:04, Geoffrey Heard wrote: > > > >>It was the last Feudal family dispute -- the sovereigns of all the > >>principal nations when the war started were cousins. Of course, > >>underlying that was the treasure generated by power over less > >>developed lands that could be sucked dry. > >> > > > >This should clinch you the Us and Them Chair of modern history at > >Mel Gibson University. > > > >You are overlooking the role of jingoism among the masses. Italy > >went to war in 1915 largely as the result of popular demand, not > >least from (the until then socialist) Benito Mussolini. > > > >T > > > >seen in the Economist: > > > > > >>In the spring of 1854, as the Crimean fighting began in earnest, an > >>Anglican cleric declared that Russian Orthodoxy was as "impure, > >>demoralising, and intolerant as popery itself". What could be more > >>natural, then, than to team up with Islam and popery to cleanse > >>that terrible impurity? A French newspaper, meanwhile, gave warning > >>that the Russians represented a special menace to all Catholics > >>because "they hope to convert us to their heresy". > > Lovely stuff, T, but my explanation was shorter! :D > > Not forgetting that the C of E clergy were catspaws (and often > younger brothers of) the aristocracy. > > And let's not forget that other Crimean war in 1919 -- Australian > troops, sick of the bloodshed, climbed on to ships expecting to go > home ... but found themselves in the Crimea fighting for the White > Russians. Gawd. > > Cheers, geoff > > ------------------------------ > > End of NISUS Digest - 26 Dec 2010 to 27 Dec 2010 (#2010-3) > ********************************************************** >