Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.os.linux.advocacy > #489471 > unrolled thread

Programming Challenge - Winner Gets Prize

Started by"F. Russell" <frussell@random.info>
First post2019-03-22 17:38 +0000
Last post2019-03-23 20:25 -0400
Articles 20 on this page of 63 — 12 participants

Back to article view | Back to comp.os.linux.advocacy


Contents

  Programming Challenge - Winner Gets Prize "F. Russell" <frussell@random.info> - 2019-03-22 17:38 +0000
    Re: Programming Challenge - Winner Gets Prize Steve Carroll <fretwizzer@gmail.com> - 2019-03-22 10:47 -0700
      Re: Programming Challenge - Winner Gets Prize "F. Russell" <frussell@random.info> - 2019-03-22 17:56 +0000
        Re: Programming Challenge - Winner Gets Prize "F. Russell" <frussell@random.info> - 2019-03-22 18:07 +0000
        Re: Programming Challenge - Winner Gets Prize Steve Carroll <fretwizzer@gmail.com> - 2019-03-22 12:11 -0600
      Re: Programming Challenge - Winner Gets Prize Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-22 19:29 +0000
    Re: Programming Challenge - Winner Gets Prize owl <owl@rooftop.invalid> - 2019-03-22 19:48 +0000
      Re: Programming Challenge - Winner Gets Prize Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-22 19:51 +0000
        Re: Programming Challenge - Winner Gets Prize owl <owl@rooftop.invalid> - 2019-03-22 19:54 +0000
          Re: Programming Challenge - Winner Gets Prize Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-22 19:56 +0000
            Re: Programming Challenge - Winner Gets Prize owl <owl@rooftop.invalid> - 2019-03-22 19:59 +0000
      Re: Programming Challenge - Winner Gets Prize "F. Russell" <frussell@random.info> - 2019-03-22 20:04 +0000
        Re: Programming Challenge - Winner Gets Prize owl <owl@rooftop.invalid> - 2019-03-22 20:46 +0000
          Re: Programming Challenge - Winner Gets Prize owl <owl@rooftop.invalid> - 2019-03-23 00:51 +0000
            Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-23 21:00 +0000
              Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-23 22:58 +0000
                Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-23 23:20 +0000
                  Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-23 16:33 -0700
                  Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-23 23:34 +0000
                    Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-23 23:44 +0000
                      Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 00:59 +0000
                        Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 03:49 +0000
                          Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-23 21:16 -0700
                        Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 12:41 +0000
                          Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 13:55 +0000
                            Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 14:30 +0000
                              Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 14:49 +0000
                                Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 08:15 -0700
                                Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 15:31 +0000
                                  Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <fretwizzer@gmail.com> - 2019-03-24 08:48 -0700
                                    Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 16:00 +0000
                                      Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <fretwizzer@gmail.com> - 2019-04-01 07:09 -0700
                                        Re: Programming Challenge - Winner Gets Prize [SOLVED] Steven Petruzzellis <frelwizzen@gmail.com> - 2019-04-01 08:40 -0700
                                    Re: Programming Challenge - Winner Gets Prize [SOLVED] Snit <usenet@gallopinginsanity.com> - 2019-03-24 17:23 +0000
                                  Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 17:25 +0000
                                  Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 18:48 +0000
                                    Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 19:27 +0000
                                      Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-24 23:03 +0000
                                        Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 16:33 -0700
                                        Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-24 23:35 +0000
                                          Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-25 00:18 +0000
                                            In my hands, vim is a worthless piece of shit. Jeff-Relf.Me  @. - 2019-03-24 18:01 -0700
                                              Re: In my hands, vim is a worthless piece of shit. Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 18:21 -0700
                                            Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 19:24 -0700
                                            Re: Programming Challenge - Winner Gets Prize [SOLVED] Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-25 02:40 +0000
                                              Re: Programming Challenge - Winner Gets Prize [SOLVED] owl <owl@rooftop.invalid> - 2019-03-25 03:02 +0000
                                              Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-25 10:15 +0000
                                              Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <"Steve Carroll"@noSPAM.none> - 2019-03-25 14:56 +0000
                                            Re: Programming Challenge - Winner Gets Prize [SOLVED] "F. Russell" <fr@random.info> - 2019-03-25 09:30 +0000
                                              Re: Programming Challenge - Winner Gets Prize [SOLVED] Mel <mel@zzzzz.com> - 2019-03-25 10:42 +0100
                                        Re: Programming Challenge - Winner Gets Prize [SOLVED] Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-25 02:39 +0000
                                    Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 13:11 -0700
                                    Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 14:29 -0700
                              Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 08:00 -0700
                          Re: Programming Challenge - Winner Gets Prize [SOLVED] Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 07:11 -0700
            Re: Programming Challenge - Winner Gets Prize Melzzzzz <Melzzzzz@zzzzz.com> - 2019-03-23 22:29 +0000
              Re: Programming Challenge - Winner Gets Prize Steve Carroll <frelwizzen@gmail.com> - 2019-03-23 16:48 -0700
                Re: Programming Challenge - Winner Gets Prize Steve Carroll <frelwizzen@gmail.com> - 2019-03-23 18:53 -0700
                  Re: Programming Challenge - Winner Gets Prize Steve Carroll <frelwizzen@gmail.com> - 2019-03-24 05:07 -0700
          Re: Programming Challenge - Winner Gets Prize "F. Russell" <fr@random.info> - 2019-03-23 15:31 +0000
            Re: Programming Challenge - Winner Gets Prize Steve Carroll <fretwizzer@gmail.com> - 2019-03-23 09:30 -0700
            Re: Programming Challenge - Winner Gets Prize "F. Russell" <fr@random.info> - 2019-03-23 18:49 +0000
    Re: Programming Challenge - Winner Gets Prize Nobody you know <nobody@nowhere.com> - 2019-03-23 20:25 -0400

Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →


#489695 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 00:59 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<szxb803ga.ghuo3@rooftop.invalid>
In reply to#489684
F. Russell <fr@random.info> wrote:
> On Sat, 23 Mar 2019 23:34:39 +0000, owl wrote:
> 
>> 
>> I don't see that option.
>>
> 
> Actually the option is called "Insert stdout on completion."
> 

Yeah.  I saw that, and when I ran your script on the selection,
it inserted after the selected text.  It did not replace it.


> The cooledit documentation does not have much info on scripting
> but it says to examine the other built-in scripts for guidance.
> 
> So look at the other scripts and you will see what is happening.
> 
> 
>> 
>> Select some text anywhere and run xsel -o in a terminal.  That output
>> can be fed to a script.
>> 
> 
> OK.  But that does not have any relevance here.
> 

It does, because it means there is no need for any internal mechanism
to deal with the selection.  It can be passed to a script just by selecting
the text and calling the script with $(xsel -o) as an argument or by
having the script itself run $(xsel -o) to grab the selection.

>> 
>> Your script is defining the cutoff.  Of course "vim can do that", because
>> vim can work with any script or pipeline of scripts.  And there is no need
>> to enter them into some internal dialog.  With vim you just call the script
>> with its path using :!
>>
> 
> But my script does not have to define the cutoff value.  I may decide
> that I want a different cutoff for different places.  Thus I could dynamically
> assign the cutoff value, with a dialog prompt, before each and every replacement.
> 
> Can vim assign script values dynamically by prompting the user?  I thought
> not.
> 

Sure.  Because, for one thing, the script itself could prompt with zenity
if you wanted a nice gui dialog, or you could use Vim's builtin scripting
language to write a function that prompts the user and then passes the
response to a script.

:nnoremap <F7> :call Cut()<CR>
function! Cut()
 call inputsave()
 let cutoff=input('How many? ')
 call inputrestore()
 execute ".!./tah " . cutoff
endfunction

That could be in your .vimrc, or in a file that you would read in with
the :source command.  It will prompt you at the bottom of the window
for a number, then run the script "./tah" with that number as ${1}
and paste the output on the current line.

 

[toc] | [prev] | [next] | [standalone]


#489712 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 03:49 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<sz8b983tg3.aghu4@rooftop.invalid>
In reply to#489695
owl <owl@rooftop.invalid> wrote:
> F. Russell <fr@random.info> wrote:
>> On Sat, 23 Mar 2019 23:34:39 +0000, owl wrote:
>> 
>>> 
>>> I don't see that option.
>>>
>> 
>> Actually the option is called "Insert stdout on completion."
>> 
> 
> Yeah.  I saw that, and when I ran your script on the selection,
> it inserted after the selected text.  It did not replace it.
> 
> 
>> The cooledit documentation does not have much info on scripting
>> but it says to examine the other built-in scripts for guidance.
>> 
>> So look at the other scripts and you will see what is happening.
>> 
>> 
>>> 
>>> Select some text anywhere and run xsel -o in a terminal.  That output
>>> can be fed to a script.
>>> 
>> 
>> OK.  But that does not have any relevance here.
>> 
> 
> It does, because it means there is no need for any internal mechanism
> to deal with the selection.  It can be passed to a script just by selecting
> the text and calling the script with $(xsel -o) as an argument or by
> having the script itself run $(xsel -o) to grab the selection.
> 
>>> 
>>> Your script is defining the cutoff.  Of course "vim can do that", because
>>> vim can work with any script or pipeline of scripts.  And there is no need
>>> to enter them into some internal dialog.  With vim you just call the script
>>> with its path using :!
>>>
>> 
>> But my script does not have to define the cutoff value.  I may decide
>> that I want a different cutoff for different places.  Thus I could dynamically
>> assign the cutoff value, with a dialog prompt, before each and every replacement.
>> 
>> Can vim assign script values dynamically by prompting the user?  I thought
>> not.
>> 
> 
> Sure.  Because, for one thing, the script itself could prompt with zenity
> if you wanted a nice gui dialog, or you could use Vim's builtin scripting
> language to write a function that prompts the user and then passes the
> response to a script.
> 
> :nnoremap <F7> :call Cut()<CR>
> function! Cut()
>  call inputsave()
>  let cutoff=input('How many? ')
>  call inputrestore()
>  execute ".!./tah " . cutoff
> endfunction
> 
> That could be in your .vimrc, or in a file that you would read in with
> the :source command.  It will prompt you at the bottom of the window
> for a number, then run the script "./tah" with that number as ${1}
> and paste the output on the current line.
> 

These two lines in either .vimrc or in a sourced file will either work
on a vim visual selection (not the X selection) or make the selection
for you, given the cursor is on the starting point, and will then do
the replacement inline, overwriting the selection.

:vnoremap <F7> d<Esc>i<CR><CR><Esc>kp:.!./fab<CR>k:.,+2j<CR>:.s/ //g<CR>
:nnoremap <F7> vf^ld<Esc>i<CR><CR><Esc>kp:.!./fab<CR>k:.,+2j<CR>:.s/ //g<CR>

In normal mode, just go to the starting point and hit F7.
In visual mode, you hit F7, and it will work on the selection you made.

There is a bug that I haven't worked out yet:  if the exponentiated
item is the last thing on the line, it erroneously puts the preceding
[+-/*] operator after the replacement.  Temporarily adding a '.' or 'x'
or something at the end makes it work. (Or just take it to a new line
and rejoin afterward). Every other case seems to work fine.  I haven't
tied it to a prompting function for the max exponent.  This is using
the following code for 'fab':

#!/bin/bash
while read x;do
  stuff=$(echo ${x} |sed -e 's/\(.*\)\^.*/\1/g')
  count=$(echo ${x} |sed -e 's/.*\^\(.*\)/\1/g')
  if [ "${count}" -lt 7 ];then
    for (( i = 1; i <= ${count} ; i++)); do
      echo -n "${stuff}"
       if [ "${i}" -lt "${count}" ]; then
         echo -n "*"
       fi
    done
  else
    echo -n "pow(${stuff},${count})"
  fi
done

[toc] | [prev] | [next] | [standalone]


#489714 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteve Carroll <frelwizzen@gmail.com>
Date2019-03-23 21:16 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<505847f9-c3b9-4d98-9ac0-3bb2f5a4cd2e@googlegroups.com>
In reply to#489712
On Saturday, March 23, 2019 at 8:49:30 PM UTC-7, owl wrote:
> owl <owl@rooftop.invalid> wrote:
> > F. Russell <fr@random.info> wrote:
> >> On Sat, 23 Mar 2019 23:34:39 +0000, owl wrote:
> >> 
> >>> 
> >>> I don't see that option.
> >>>
> >> 
> >> Actually the option is called "Insert stdout on completion."
> >> 
> > 
> > Yeah.  I saw that, and when I ran your script on the selection,
> > it inserted after the selected text.  It did not replace it.
> > 
> > 
> >> The cooledit documentation does not have much info on scripting
> >> but it says to examine the other built-in scripts for guidance.
> >> 
> >> So look at the other scripts and you will see what is happening.
> >> 
> >> 
> >>> 
> >>> Select some text anywhere and run xsel -o in a terminal.  That output
> >>> can be fed to a script.
> >>> 
> >> 
> >> OK.  But that does not have any relevance here.
> >> 
> > 
> > It does, because it means there is no need for any internal mechanism
> > to deal with the selection.  It can be passed to a script just by selecting
> > the text and calling the script with $(xsel -o) as an argument or by
> > having the script itself run $(xsel -o) to grab the selection.
> > 
> >>> 
> >>> Your script is defining the cutoff.  Of course "vim can do that", because
> >>> vim can work with any script or pipeline of scripts.  And there is no need
> >>> to enter them into some internal dialog.  With vim you just call the script
> >>> with its path using :!
> >>>
> >> 
> >> But my script does not have to define the cutoff value.  I may decide
> >> that I want a different cutoff for different places.  Thus I could dynamically
> >> assign the cutoff value, with a dialog prompt, before each and every replacement.
> >> 
> >> Can vim assign script values dynamically by prompting the user?  I thought
> >> not.
> >> 
> > 
> > Sure.  Because, for one thing, the script itself could prompt with zenity
> > if you wanted a nice gui dialog, or you could use Vim's builtin scripting
> > language to write a function that prompts the user and then passes the
> > response to a script.
> > 
> > :nnoremap <F7> :call Cut()<CR>
> > function! Cut()
> >  call inputsave()
> >  let cutoff=input('How many? ')
> >  call inputrestore()
> >  execute ".!./tah " . cutoff
> > endfunction
> > 
> > That could be in your .vimrc, or in a file that you would read in with
> > the :source command.  It will prompt you at the bottom of the window
> > for a number, then run the script "./tah" with that number as ${1}
> > and paste the output on the current line.
> > 
> 
> These two lines in either .vimrc or in a sourced file will either work
> on a vim visual selection (not the X selection) or make the selection
> for you, given the cursor is on the starting point, and will then do
> the replacement inline, overwriting the selection.
> 
> :vnoremap <F7> d<Esc>i<CR><CR><Esc>kp:.!./fab<CR>k:.,+2j<CR>:.s/ //g<CR>
> :nnoremap <F7> vf^ld<Esc>i<CR><CR><Esc>kp:.!./fab<CR>k:.,+2j<CR>:.s/ //g<CR>
> 
> In normal mode, just go to the starting point and hit F7.
> In visual mode, you hit F7, and it will work on the selection you made.
> 
> There is a bug that I haven't worked out yet:  if the exponentiated
> item is the last thing on the line, it erroneously puts the preceding
> [+-/*] operator after the replacement.  Temporarily adding a '.' or 'x'
> or something at the end makes it work. (Or just take it to a new line
> and rejoin afterward). Every other case seems to work fine.  I haven't
> tied it to a prompting function for the max exponent.  This is using
> the following code for 'fab':
> 
> #!/bin/bash
> while read x;do
>   stuff=$(echo ${x} |sed -e 's/\(.*\)\^.*/\1/g')
>   count=$(echo ${x} |sed -e 's/.*\^\(.*\)/\1/g')
>   if [ "${count}" -lt 7 ];then
>     for (( i = 1; i <= ${count} ; i++)); do
>       echo -n "${stuff}"
>        if [ "${i}" -lt "${count}" ]; then
>          echo -n "*"
>        fi
>     done
>   else
>     echo -n "pow(${stuff},${count})"
>   fi
> done



For most I would say it is suspicious. However, given that it's Klaus 'Super Troll' Schadenfreude I would drop that step and go straight to 'drug-induced delusion' because that's most of what Klaus 'Super Troll' Schadenfreude does. It is faster to assume it is a lie until proved otherwise. 

The Mack has more choice. Klaus 'Super Troll' Schadenfreude failed to give a case study of a profitable corporation that has made its wealth by not giving a shit about its customers or products. 



--
Eight things to never feed your cat!!
http://www.5z8.info/stalin-will-rise-again_j3h5uj_nakedgrandmas.jpg
https://groups.google.com/forum/#!topic/comp.lang.c/KDQrv8appR8
Jonas Eklundh Communication AB

[toc] | [prev] | [next] | [standalone]


#489747 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 12:41 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q77ttv01f4f@news1.newsguy.com>
In reply to#489695
On Sun, 24 Mar 2019 00:59:05 +0000, owl wrote:

> 
> Yeah.  I saw that, and when I ran your script on the selection,
> it inserted after the selected text.  It did not replace it.
> 

That's because you did not check the "Delete block on commence"
option and also the "Save block on commence."

My script works beautifully and can even be "undone" with
the Ctrl+U undo function.  That's cooledit power.


> 
> Sure.  Because, for one thing, the script itself could prompt with zenity
> if you wanted a nice gui dialog, or you could use Vim's builtin scripting
> language to write a function that prompts the user and then passes the
> response to a script.
> 

Whew!  That's a lot of fuss for something that cooledit does
automatically and without the need to go beyond the standard scripting
languages.

[toc] | [prev] | [next] | [standalone]


#489761 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 13:55 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<szb803tag.u4@rooftop.invalid>
In reply to#489747
F. Russell <fr@random.info> wrote:
> On Sun, 24 Mar 2019 00:59:05 +0000, owl wrote:
> 
>> 
>> Yeah.  I saw that, and when I ran your script on the selection,
>> it inserted after the selected text.  It did not replace it.
>> 
> 
> That's because you did not check the "Delete block on commence"
> option and also the "Save block on commence."
> 
> My script works beautifully and can even be "undone" with
> the Ctrl+U undo function.  That's cooledit power.
> 

Easier with vim.  Just type u to undo.

> 
>> 
>> Sure.  Because, for one thing, the script itself could prompt with zenity
>> if you wanted a nice gui dialog, or you could use Vim's builtin scripting
>> language to write a function that prompts the user and then passes the
>> response to a script.
>> 
> 
> Whew!  That's a lot of fuss for something that cooledit does
> automatically and without the need to go beyond the standard scripting
> languages.
> 

No fuss at all.  And zenity is pretty standard these days.
And a vim function is no more non-standard than a cooledit dialog.
But what you want to do is compare the speed that vim allows
to that almost-MS-like sluggishness of working with cooledit.

https://streamable.com/cb6r

Here's the data:

foo^2+bar^8+q^2-ppp^7/gys^4+p+3

It takes about 10 seconds in vim to convert that to:

foo*foo+pow(bar,8)+q*q-pow(ppp,7)/gys*gys*gys*gys+p+3

anon@lowtide:~/code/vim/work$ cat wah; date; vim wah; date; cat wah
foo^2+bar^8+q^2-ppp^7/gys^4+p+3
Sun Mar 24 09:54:22 EDT 2019
Sun Mar 24 09:54:32 EDT 2019
foo*foo+pow(bar,8)+q*q-pow(ppp,7)/gys*gys*gys*gys+p+3
anon@lowtide:~/code/vim/work$ 

How long does it take in cooledit?

[toc] | [prev] | [next] | [standalone]


#489765 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 14:30 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q784ab0836@news3.newsguy.com>
In reply to#489761
On Sun, 24 Mar 2019 13:55:36 +0000, owl wrote:

> 
> Easier with vim.  Just type u to undo.
> 

But you first have to switch to command mode.  Ha, ha, ha, ha!


> 
> Here's the data:
> 
> foo^2+bar^8+q^2-ppp^7/gys^4+p+3
> 
> It takes about 10 seconds in vim to convert that to:
>
> foo*foo+pow(bar,8)+q*q-pow(ppp,7)/gys*gys*gys*gys+p+3
>

Whew!  10 seconds for a completely INCORRECT result.  That's
impressive.

There needs to be parentheses around the "gys*gys*gys*gys"
otherwise the standard operator precedence will cause the
result to be evaluated as:

pow(ppp,7)
---------- * gys * gys * gys = pow(ppp,7) * gys * gys
   gys


To avoid unintentional mishaps like this, without resorting
to a full-blown parsing routine, it is better to concentrate
only on a single exponential expression at a time.

[toc] | [prev] | [next] | [standalone]


#489767 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 14:49 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<hgyz3a.tgh93@rooftop.invalid>
In reply to#489765
F. Russell <fr@random.info> wrote:
> On Sun, 24 Mar 2019 13:55:36 +0000, owl wrote:
> 
>> 
>> Easier with vim.  Just type u to undo.
>> 
> 
> But you first have to switch to command mode.  Ha, ha, ha, ha!
> 

It's called normal mode, and there's no need to switch, since
you're already there.


> 
>> 
>> Here's the data:
>> 
>> foo^2+bar^8+q^2-ppp^7/gys^4+p+3
>> 
>> It takes about 10 seconds in vim to convert that to:
>>
>> foo*foo+pow(bar,8)+q*q-pow(ppp,7)/gys*gys*gys*gys+p+3
>>
> 
> Whew!  10 seconds for a completely INCORRECT result.  That's
> impressive.
> 
> There needs to be parentheses around the "gys*gys*gys*gys"
> otherwise the standard operator precedence will cause the
> result to be evaluated as:
> 
> pow(ppp,7)
> ---------- * gys * gys * gys = pow(ppp,7) * gys * gys
>    gys
> 
> 
> To avoid unintentional mishaps like this, without resorting
> to a full-blown parsing routine, it is better to concentrate
> only on a single exponential expression at a time.
> 

Just change the script to add parentheses.  With an additional
.vimrc change to have it run 5 times, it now takes only one
second in vim:

anon@lowtide:~/code/vim/work$ cat wah; date; vim wah; date; cat wah
foo^2+bar^8+q^2-ppp^7/gys^4+p+3
Sun Mar 24 10:47:55 EDT 2019
Sun Mar 24 10:47:56 EDT 2019
(foo*foo)+pow(bar,8)+(q*q)-pow(ppp,7)/(gys*gys*gys*gys)+p+3
anon@lowtide:~/code/vim/work$ 

Poor cooledit.  Pwned again.

[toc] | [prev] | [next] | [standalone]


#489771 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteve Carroll <frelwizzen@gmail.com>
Date2019-03-24 08:15 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<1e1834bd-13a4-4d19-b64d-8772b67abf4b@googlegroups.com>
In reply to#489767
On Sunday, March 24, 2019 at 7:49:55 AM UTC-7, owl wrote:
> F. Russell <fr@random.info> wrote:
> > On Sun, 24 Mar 2019 13:55:36 +0000, owl wrote:
> > 
> >> 
> >> Easier with vim.  Just type u to undo.
> >> 
> > 
> > But you first have to switch to command mode.  Ha, ha, ha, ha!
> > 
> 
> It's called normal mode, and there's no need to switch, since
> you're already there.
> 
> 
> > 
> >> 
> >> Here's the data:
> >> 
> >> foo^2+bar^8+q^2-ppp^7/gys^4+p+3
> >> 
> >> It takes about 10 seconds in vim to convert that to:
> >>
> >> foo*foo+pow(bar,8)+q*q-pow(ppp,7)/gys*gys*gys*gys+p+3
> >>
> > 
> > Whew!  10 seconds for a completely INCORRECT result.  That's
> > impressive.
> > 
> > There needs to be parentheses around the "gys*gys*gys*gys"
> > otherwise the standard operator precedence will cause the
> > result to be evaluated as:
> > 
> > pow(ppp,7)
> > ---------- * gys * gys * gys = pow(ppp,7) * gys * gys
> >    gys
> > 
> > 
> > To avoid unintentional mishaps like this, without resorting
> > to a full-blown parsing routine, it is better to concentrate
> > only on a single exponential expression at a time.
> > 
> 
> Just change the script to add parentheses.  With an additional
> .vimrc change to have it run 5 times, it now takes only one
> second in vim:
> 
> anon@lowtide:~/code/vim/work$ cat wah; date; vim wah; date; cat wah
> foo^2+bar^8+q^2-ppp^7/gys^4+p+3
> Sun Mar 24 10:47:55 EDT 2019
> Sun Mar 24 10:47:56 EDT 2019
> (foo*foo)+pow(bar,8)+(q*q)-pow(ppp,7)/(gys*gys*gys*gys)+p+3
> anon@lowtide:~/code/vim/work$ 
> 
> Poor cooledit.  Pwned again.



What did Jesus Christ assume from the lying imbecile? That mattb moron has nothing to waste but time. He has nothing else, especially not a girlfriend. Jesus Christ conned mattb a bit, big fscking deal. mattb is being a howling bitch about it? From what I've seen (which is none of it lately), it looks like the trolling nonsense needs more and more resources. 

mattb doesn't have any concept of what he is sobbing about. 

mattb gets excited that Jesus Christ is on the other end. Imagine if mattb walked up to a chimpanzee and delivered the punch line. It wouldn't be amusing in any way. Nearly all people in this group do application development either as a pastime or as a vocation, so I think it unlikely anybody here consider automation to be "sorcery". 



--
This Trick Gets Women Hot For You
https://www.youtube.com/watch?v=AglvCo3dJ38&feature=youtu.be
Jonas Eklundh Communication AB

[toc] | [prev] | [next] | [standalone]


#489774 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 15:31 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q787ss0v7e@news2.newsguy.com>
In reply to#489767
On Sun, 24 Mar 2019 14:49:53 +0000, owl wrote:

> 
> Poor cooledit.  Pwned again.
>

You are skating on very thin ice.

Your procedure is valid only for positive integral exponents
which are far from common.  It will easily choke on this:

(something)^(3/7)

This has to be converted to "pow(something*something*something, 1/7)"

With cooledit I can quickly rewrite the expression and invoke the
script, with an option, twice and the job will be done.

But you'll have to frantically scramble to accommodate every new case.

[toc] | [prev] | [next] | [standalone]


#489778 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteve Carroll <fretwizzer@gmail.com>
Date2019-03-24 08:48 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<08739765-664f-44c8-b395-bee34343759f@googlegroups.com>
In reply to#489774
On Sunday, March 24, 2019 at 9:32:36 AM UTC-6, F. Russell wrote:
> On Sun, 24 Mar 2019 14:49:53 +0000, owl wrote:
> 
> > 
> > Poor cooledit.  Pwned again.
> >
> 
> You are skating on very thin ice.
> 
> Your procedure is valid only for positive integral exponents
> which are far from common.  It will easily choke on this:
> 
> (something)^(3/7)
> 
> This has to be converted to "pow(something*something*something, 1/7)"
> 
> With cooledit I can quickly rewrite the expression and invoke the
> script, with an option, twice and the job will be done.
> 
> But you'll have to frantically scramble to accommodate every new case.

I can understand someone not like vi(m) 'cuz it's (cue whiny voice)
'Too hard'. But Cooledit? Isn't it laying in the app graveyard next to
Dreamweaver? ;)

[toc] | [prev] | [next] | [standalone]


#489780 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 16:00 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q789i101003@news2.newsguy.com>
In reply to#489778
On Sun, 24 Mar 2019 08:48:29 -0700, Steve Carroll wrote:

> 
> I can understand
>

You can't understand shit.  You are only full of dreamy conjectures.

>
> But Cooledit? Isn't it laying in the app graveyard
>

It's been brought back to life thanks to my patches
which are now part of Gentoo.

But it seems like I'll have to do more work to keep
it going far into the future.  This won't be easy for
cooledit uses only X libraries (no GUI toolkits) and I
therefore need to learn all about the underpinnings of X.
That's not a fun prospect.

So why don't you get off your lazy ass and develop cooledit?
Make yourself useful to the FOSS community instead of spewing
meaningless conjectures.

[toc] | [prev] | [next] | [standalone]


#490956 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteve Carroll <fretwizzer@gmail.com>
Date2019-04-01 07:09 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<0c1ee68f-e6d8-4883-a6d6-990f40a05490@googlegroups.com>
In reply to#489780
On Sunday, March 24, 2019 at 10:00:31 AM UTC-6, F. Russell wrote:
> On Sun, 24 Mar 2019 08:48:29 -0700, Steve Carroll wrote:
> 
> > 
> > I can understand
> >
> 
> You can't understand shit. 

Not true, I understand you perfectly.

[toc] | [prev] | [next] | [standalone]


#490975 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteven Petruzzellis <frelwizzen@gmail.com>
Date2019-04-01 08:40 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<8ce7d4c0-4e57-4eb1-8093-74f62a79f632@googlegroups.com>
In reply to#490956
On Monday, April 1, 2019 at 7:09:24 AM UTC-7, Steve Carroll wrote:
> On Sunday, March 24, 2019 at 10:00:31 AM UTC-6, F. Russell wrote:
> > On Sun, 24 Mar 2019 08:48:29 -0700, Steve Carroll wrote:
> > 
> > > 
> > > I can understand
> > >
> > 
> > You can't understand shit. 
> 
> Not true, I understand you perfectly.



Only what flatfish+++ wants matters to flatfish+++. There is nothing you or I can do to change that. It's a chance to cause harm and it is what it is. 

flatfish+++ suffers from waking drug trips so, to him, everything, even simple comments about tech, are "abuses". Who DOESN'T know this? What is flatfish+++'s system for the flooding crap? JavaScript? That is the only tool he knows, or admits to. He must be programming it to write these annoying "flooding" idiotic threads. Lemme theory, flatfish+++ took Snit (a real advocate)'s code that he hacked and declared it his... he is feeding it Snit (a real advocate)'s posts, grabbing hand-picked paragraphs, then re-writing those using the Borůvka's algorithm and then he hand posts them because his insanity enables him to do that almost nonstop. 

Why would you want to limit all scripts on Fedora to what can be done on PCs and Macs? 

flatfish+++ can only rationalize from the viewpoint of a programmer. 

flatfish+++ can't get anything else to work, either. 

It's a long, drawn out war, and flatfish+++ is simultaneously a master at off-the-cuff trolling remarks, while posting with socks with a myriad of tells. 

--
Do not click this link!!!
http://www.5z8.info/hack-outlook_c6c9in_michaelangelo-virus
https://www.youtube.com/watch?v=AglvCo3dJ38&feature=youtu.be
Jonas Eklundh

[toc] | [prev] | [next] | [standalone]


#489788 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSnit <usenet@gallopinginsanity.com>
Date2019-03-24 17:23 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<gfpsonFgtv6U2@mid.individual.net>
In reply to#489778
Steve Carroll <fretwizzer@gmail.com> wrote:
> On Sunday, March 24, 2019 at 9:32:36 AM UTC-6, F. Russell wrote:
>> On Sun, 24 Mar 2019 14:49:53 +0000, owl wrote:
>> 
>>> 
>>> Poor cooledit.  Pwned again.
>>> 
>> 
>> You are skating on very thin ice.
>> 
>> Your procedure is valid only for positive integral exponents
>> which are far from common.  It will easily choke on this:
>> 
>> (something)^(3/7)
>> 
>> This has to be converted to "pow(something*something*something, 1/7)"
>> 
>> With cooledit I can quickly rewrite the expression and invoke the
>> script, with an option, twice and the job will be done.
>> 
>> But you'll have to frantically scramble to accommodate every new case.
> 
> I can understand someone not like vi(m) 'cuz it's (cue whiny voice)
> 'Too hard'. But Cooledit? Isn't it laying in the app graveyard next to
> Dreamweaver? ;)
> 

Your obsession with Dreamweaver is STILL going on? 



-- 
Personal attacks from those who troll show their own insecurity. They
cannot use reason to show the message to be wrong so they try to feel
somehow superior by attacking the messenger. They cling to their attacks
and ignore the message time and time again.

<https://youtu.be/H4NW-Cqh308> 

[toc] | [prev] | [next] | [standalone]


#489790 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 17:25 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<cvb89ag3.ay@rooftop.invalid>
In reply to#489774
F. Russell <fr@random.info> wrote:
> On Sun, 24 Mar 2019 14:49:53 +0000, owl wrote:
> 
>> 
>> Poor cooledit.  Pwned again.
>>
> 
> You are skating on very thin ice.
> 
> Your procedure is valid only for positive integral exponents
> which are far from common.  It will easily choke on this:
> 
> (something)^(3/7)
> 
> This has to be converted to "pow(something*something*something, 1/7)"
> 
> With cooledit I can quickly rewrite the expression and invoke the
> script, with an option, twice and the job will be done.
> 
> But you'll have to frantically scramble to accommodate every new case.
> 

No, you just have to consider what you might encounter, and adjust
your script to cover those cases.  Add some code to handle fractional
exponents, like below, then add some logic to your script and branch
on the denominator != 1.

anon@lowtide:~/code/vim/work$ echo '(3/7)' |./pexp
exp: 3/7
expn: 3
expd: 7
anon@lowtide:~/code/vim/work$ echo '3/7' |./pexp
exp: 3/7
expn: 3
expd: 7
anon@lowtide:~/code/vim/work$ echo '5' |./pexp
exp: 5
expn: 5
expd: 1
anon@lowtide:~/code/vim/work$ echo '(5)' |./pexp
exp: 5
expn: 5
expd: 1
anon@lowtide:~/code/vim/work$ cat pexp
#!/bin/bash
read exp 
exp=$(echo ${exp}|sed -e 's/(?\(.*\/.*\)?/\1/g')
exp=$(echo ${exp}|sed -e 's/(\|)//g')
expn=$(echo ${exp}|sed -e 's/\(.*\)\/\(.*\)/\1/g')
expd=$(echo ${exp}|sed -e 's/\(.*\)\/\(.*\)/\2/g')
if [ "${expn}" == "${exp}" ];then
expd=1
fi
echo "exp: ${exp}"
echo "expn: ${expn}"
echo "expd: ${expd}"
anon@lowtide:~/code/vim/work$ 

[toc] | [prev] | [next] | [standalone]


#489805 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 18:48 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<sz8b93g0qg.3@rooftop.invalid>
In reply to#489774
F. Russell <fr@random.info> wrote:
> On Sun, 24 Mar 2019 14:49:53 +0000, owl wrote:
> 
>> 
>> Poor cooledit.  Pwned again.
>>
> 
> You are skating on very thin ice.
> 
> Your procedure is valid only for positive integral exponents
> which are far from common.  It will easily choke on this:
> 
> (something)^(3/7)
> 
> This has to be converted to "pow(something*something*something, 1/7)"
> 

I've already addressed parsing the exponent, but why would you convert

(something)^(3/7)

into 

pow(something*something*something,1/7)

instead of just 

pow(something,3/7)

[toc] | [prev] | [next] | [standalone]


#489812 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 19:27 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q78lm9029sr@news4.newsguy.com>
In reply to#489805
On Sun, 24 Mar 2019 18:48:41 +0000, owl wrote:

> 
> pow(something*something*something,1/7)
> 
> instead of just 
> 
> pow(something,3/7)
>

That's an option, but the pow() in libm is supposedly
all messed up and should be avoided.  The UCBTEST shows
6 errors out of 1543 test values for pow().  The only
thing worse is hypot() which has 10 errors out of 126

Pow() is also very slow.

For fractional exponents it cannot be avoided, but for
N/2 exponents the sqrt() should always be used.

Even exp(3/7*log(something)) could be better.

[toc] | [prev] | [next] | [standalone]


#489834 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

Fromowl <owl@rooftop.invalid>
Date2019-03-24 23:03 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<sibu3gaiga34hu4.4@rooftop.invalid>
In reply to#489812
F. Russell <fr@random.info> wrote:
> On Sun, 24 Mar 2019 18:48:41 +0000, owl wrote:
> 
>> 
>> pow(something*something*something,1/7)
>> 
>> instead of just 
>> 
>> pow(something,3/7)
>>
> 
> That's an option, but the pow() in libm is supposedly
> all messed up and should be avoided.  The UCBTEST shows
> 6 errors out of 1543 test values for pow().  The only
> thing worse is hypot() which has 10 errors out of 126
> 
> Pow() is also very slow.
> 
> For fractional exponents it cannot be avoided, but for
> N/2 exponents the sqrt() should always be used.
> 
> Even exp(3/7*log(something)) could be better.
> 

Goalpost shift to the reliability of pow(), which has
nothing to do with the original problem of parsing and
replacing text...

[toc] | [prev] | [next] | [standalone]


#489836 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

FromSteve Carroll <frelwizzen@gmail.com>
Date2019-03-24 16:33 -0700
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<ae182414-ef6d-46d4-bfec-d7d2e1628a47@googlegroups.com>
In reply to#489834
On Sunday, March 24, 2019 at 4:03:34 PM UTC-7, owl wrote:
> F. Russell <fr@random.info> wrote:
> > On Sun, 24 Mar 2019 18:48:41 +0000, owl wrote:
> > 
> >> 
> >> pow(something*something*something,1/7)
> >> 
> >> instead of just 
> >> 
> >> pow(something,3/7)
> >>
> > 
> > That's an option, but the pow() in libm is supposedly
> > all messed up and should be avoided.  The UCBTEST shows
> > 6 errors out of 1543 test values for pow().  The only
> > thing worse is hypot() which has 10 errors out of 126
> > 
> > Pow() is also very slow.
> > 
> > For fractional exponents it cannot be avoided, but for
> > N/2 exponents the sqrt() should always be used.
> > 
> > Even exp(3/7*log(something)) could be better.
> > 
> 
> Goalpost shift to the reliability of pow(), which has
> nothing to do with the original problem of parsing and
> replacing text...



Big Dog (AKA Little Pup) must recognize that Peter Köhlmann can go get Access, right, gluey? On top of that, anyone can go get a real newsreader with proper filtering, which renders his usenet group attack useless, just like Big Dog (AKA Little Pup). 

Just look at your junk and look at mine, there is nothing for anyone to learn from a fool like Big Dog (AKA Little Pup). But knock yourself out, let him keep making a blockhead of himself. It is not like anyone believes him. 

So Big Dog (AKA Little Pup) changed his story to "mentioning" him. 

Real posters will not be seen once the druggies overindulge. That, and there will perpetually be a mental midget or more in an open ng. The current tantrum aside, we've all seen who uncontrollably gets angry when he doesn't get nonstop attention. 

The person you are thinking of is in my shit list. 

Big Dog (AKA Little Pup) is trying "really hard" to project their trolling crap onto Peter Köhlmann. For some time Big Dog (AKA Little Pup) has pushed the claim that Peter Köhlmann needs 'backing' to point out all his forgeries. The fact is that no one needs any evidence to do that. So Big Dog (AKA Little Pup) pulls this goofy ad hominem poppycock in a feeble attempt to 'push' the idea that Peter Köhlmann is like him. I bet he thinks his life was hard. 

- 
Curious how these posts are made? Email: fretwizzer@gmail.com

[toc] | [prev] | [next] | [standalone]


#489837 — Re: Programming Challenge - Winner Gets Prize [SOLVED]

From"F. Russell" <fr@random.info>
Date2019-03-24 23:35 +0000
SubjectRe: Programming Challenge - Winner Gets Prize [SOLVED]
Message-ID<q7947t02j6v@news4.newsguy.com>
In reply to#489834
On Sun, 24 Mar 2019 23:03:32 +0000, owl wrote:

> 
> Goalpost shift to the reliability of pow()
>

Wrong again.

In fact, as plainly stated in my original posts, the reliability
of pow() was the sole motivation to find a method of substituting
the repeated multiplication.

Now let us see how YOU shift the posts to try and weasel out
of this highly embarrassing predicament.

[toc] | [prev] | [next] | [standalone]


Page 2 of 4 — ← Prev page 1 [2] 3 4  Next page →

Back to top | Article view | comp.os.linux.advocacy


csiph-web