[#1711] Re: open-uri patch, added progress_proc hook — "T. Onoma" <transami@...>

Tanaka Akira:

22 messages 2003/11/19
[#1737] Re: open-uri patch, added progress_proc hook — Mathieu Bouchard <matju@...> 2003/11/23

[#1739] Re: open-uri patch, added progress_proc hook — Mathieu Bouchard <matju@...> 2003/11/23

[#1740] Re: open-uri patch, added progress_proc hook — "T. Onoma" <transami@...> 2003/11/23

On Sunday 23 November 2003 08:26 pm, Mathieu Bouchard wrote:

[#1741] Re: open-uri patch, added progress_proc hook — Mathieu Bouchard <matju@...> 2003/11/23

[#1718] Re: open-uri patch, added progress_proc hook — Elliott Hughes <ehughes@...>

22 messages 2003/11/21
[#1722] Re: open-uri patch, added progress_proc hook — Tanaka Akira <akr@...17n.org> 2003/11/22

In article <AD4480A509455343AEFACCC231BA850F17C434@ukexchange>,

[#1724] Re: open-uri patch, added progress_proc hook — "T. Onoma" <transami@...> 2003/11/22

On Saturday 22 November 2003 04:34 pm, Tanaka Akira wrote:

[#1726] Re: open-uri patch, added progress_proc hook — Tanaka Akira <akr@...17n.org> 2003/11/23

In article <200311221024.05642.transami@runbox.com>,

[#1731] Re: open-uri patch, added progress_proc hook — "T. Onoma" <transami@...> 2003/11/23

On Sunday 23 November 2003 02:24 am, Tanaka Akira wrote:

[#1732] Re: open-uri patch, added progress_proc hook — Tanaka Akira <akr@...17n.org> 2003/11/23

In article <200311230325.21687.transami@runbox.com>,

[#1733] Re: open-uri patch, added progress_proc hook — "T. Onoma" <transami@...> 2003/11/23

On Sunday 23 November 2003 03:10 pm, Tanaka Akira wrote:

[#1750] Re: open-uri patch, added progress_proc hook — Tanaka Akira <akr@...17n.org> 2003/11/24

In article <200311230648.41003.transami@runbox.com>,

[#1759] Re: open-uri patch, added progress_proc hook — Sean E Russell <ser@...> 2003/11/24

On Monday 24 November 2003 03:19, Tanaka Akira wrote:

[#1762] Re: open-uri patch, added progress_proc hook — "Nathaniel Talbott" <nathaniel@...> 2003/11/24

Sean E Russell [mailto:ser@germane-software.com] wrote:

[#1753] gc_sweep under 1.8 ... not syck.so — Richard Kilmer <rich@...>

We still encountered a gc_sweep in our use of Ruby 1.8 on Linux (v8).

16 messages 2003/11/24
[#1754] Re: gc_sweep under 1.8 ... not syck.so — ts <decoux@...> 2003/11/24

>>>>> "R" == Richard Kilmer <rich@infoether.com> writes:

[#1757] Re: gc_sweep under 1.8 ... not syck.so — Richard Kilmer <rich@...> 2003/11/24

Yes, there are several (Ruby) threads working during this gc_sweep.

[#1758] Re: gc_sweep under 1.8 ... not syck.so — ts <decoux@...> 2003/11/24

>>>>> "R" == Richard Kilmer <rich@infoether.com> writes:

[#1763] Re: gc_sweep under 1.8 ... not syck.so — Richard Kilmer <rich@...> 2003/11/24

of course this effects 300 machines ;-)

[#1755] Re: Controlled block variables — Jamis Buck <jgb3@...>

On Mon, 2003-11-24 at 02:04, T. Onoma wrote:

26 messages 2003/11/24
[#1756] Re: Controlled block variables — "T. Onoma" <transami@...> 2003/11/24

On Monday 24 November 2003 05:22 pm, Jamis Buck wrote:

[#1760] Re: Controlled block variables — Sean E Russell <ser@...> 2003/11/24

On Monday 24 November 2003 11:51, T. Onoma wrote:

[#1761] Re: Controlled block variables — "T. Onoma" <transami@...> 2003/11/24

On Monday 24 November 2003 06:40 pm, Sean E Russell wrote:

Re: open-uri patch, added progress_proc hook

From: "T. Onoma" <transami@...>
Date: 2003-11-15 03:58:04 UTC
List: ruby-core #1681
> No.  I already implemented.  (not committed yet.)
>
> In my version, progress_proc takes two arguments instead of one.
> It takes expected total size by Content-Length as second argument if available.

could you show example? hmm...wouldn't the expected length be in the proc already if it were needed? that's what i did with my progressbar.
 
> > i had it that way before and i can just put it back. the thing about the proc arguements though, each proc in the hash could take different arguments. hmmm....is is possible for the hash key itself to determine which args to pass in to the proc rather then making up names for them? for instance:
> >
> > open( url, { pos: proc { |b| ...} } )  # would pass #pos
> >
> > or something like that. just a thought.
> 
> m(x => y) is same as m({x => y}).

ugh, my typo. what i meant was:

  open(url, {:pos => proc {|b| ...}})

so that if, method_key = :pos and progress_prco = proc {|b| ...}

would end up something like

  ...
      http.get(uri.to_s, header) { |str|
          buf << str
          progress_proc.call(buf.io.method(method_key).call) if progress_proc
        }
      }
  ...


but maybe that's too odd?

> > funny you ask, because i keep reading and reading about them, but for some reason i never quite understand them. most tech writers just assume you know, i guess. i sort of know how to use them on command line to pipe output from one command into another. can you more easily explain?
> 
> pipe can be used to asynchronous process.
> 
> Try:
> 
> pipe = IO.popen("while :; do echo a; sleep 1; done")
> pipe.each_line {|line| p line }
> 
> pipe = IO.popen("wget -q -O- http://raa.ruby-lang.org/all.html")
> pipe.each_line {|line| p line }
> 
> IO.popen doesn't wait finishing a command.
> 
> So, if URI::HTTP#open works like that, you can use it for progress
> bar.  But it has subtle differences.

i see, thank you! that makes more sense. i think i was just confusing myself by making it more complicated.

-t0


In This Thread

Prev Next