[#187137] DO NOT USE JAVA BECAUSE IT IS NOT OPEN SOURCE — atbusbook@...

Programing Languiges Are Ment to be free. That is why i am starting The

15 messages 2006/04/01

[#187149] ruby-dev summary 28274-28600 — APURI Furuhashi <afuru@...>

Hi all,

16 messages 2006/04/01

[#187194] Ruby Goes to the Sun — James Britt <james_b@...>

I've not seen this translated anyplace, but the Japanese Ruby site has

13 messages 2006/04/01

[#187228] Dynamic code generation — "Thiago Arrais" <thiago.arrais@...>

I have been trying to do some simple dynamic code generation in Ruby.

12 messages 2006/04/01

[#187230] %w{tomato cheese ham pineapple}.join(', ', ' and ') — Benjohn Barnes <benjohn@...>

=> 'tomato, cheese, ham and pineapple'

15 messages 2006/04/01

[#187263] Typed Parameters — "Robert Dober" <robert.dober@...>

Dear group

34 messages 2006/04/01
[#187279] Re: Typed Parameters — "Austin Ziegler" <halostatue@...> 2006/04/01

On 4/1/06, Robert Dober <robert.dober@gmail.com> wrote:> Dear group>> there was a recent thread about "Boolean" and it braught me to my> favorit thing I would love to have in Ruby2.>> *typed parameters*

[#187298] Re: Typed Parameters — "Trans" <transfire@...> 2006/04/02

<blockquote>

[#187313] Re: Typed Parameters — "Daniel Nugent" <nugend@...> 2006/04/02

Well, I think you should allowed to put a selective effect on the

[#187345] Re: Typed Parameters — "Robert Dober" <robert.dober@...> 2006/04/02

On 4/2/06, Daniel Nugent <nugend@gmail.com> wrote:

[#187371] Re: Typed Parameters — "Austin Ziegler" <halostatue@...> 2006/04/02

On 4/2/06, Robert Dober <robert.dober@gmail.com> wrote:> On 4/2/06, Daniel Nugent <nugend@gmail.com> wrote:>> Well, I think you should allowed to put a selective effect on the>> remaining arguments, but it should at least allow you to be a little>> smarter than simply checking one single Type. I'd like to see you>> able to check against multiple types as well as methods and>> combinations thereof, like>>>> def foo(arg1 : (Array and :custom_array_method) or Hash or>> :special_method)>>>> Then at least it's simply a syntactic convenience for writing>> respond_to? and kind_of? calls. And, logically, you should be able>> to assign these parameter checks to a variabe so you can reduce the>> duplication of them, although I don't have a clue as to what a good>> syntax for that would be... Maybe something like:>>>> type_check = TypeCheck.new do |var|>> case var>> when Array>> return true if var.respond_to? :custom_array_method>> when Hash>> return Hash>> else>> return true if var.respond_to? :special_method>> end>> return false>> end>>>> And, of course, you can do any checking you want in the block. You>> could then do this:>>>> def foo(arg1 : type_check)>> def bar(arg1, arg2 : type_check)

[#187567] Possible RubyQuiz idea — Hal Fulton <hal9000@...>

This might be too easy, it's JEG2's call.

17 messages 2006/04/04

[#187659] un_include and un_extend — "itsme213" <itsme213@...>

How do I un_include a module from a class/module, or un_extend a module from

13 messages 2006/04/04
[#187727] Re: un_include and un_extend — "itsme213" <itsme213@...> 2006/04/05

Thanks. Will 2.0 allow this?

[#187908] Re: un_include and un_extend — Yukihiro Matsumoto <matz@...> 2006/04/06

Hi,

[#187923] Re: un_include and un_extend — "Austin Ziegler" <halostatue@...> 2006/04/06

On 4/6/06, Yukihiro Matsumoto <matz@ruby-lang.org> wrote:> In message "Re: un_include and un_extend"> on Wed, 5 Apr 2006 09:03:47 +0900, "itsme213" <itsme213@hotmail.com> writes:>| Thanks. Will 2.0 allow this?> No plan. Currently I have no reason to allow it.

[#187698] is GUI a weak point? — "greg.rb" <ghalsey@...>

Ruby seems pretty eash to code and understand. However, as a

43 messages 2006/04/04
[#187764] Re: is GUI a weak point? — "Michal Suchanek" <hramrach@...> 2006/04/05

On 4/4/06, greg.rb <ghalsey@yahoo.com> wrote:> Ruby seems pretty eash to code and understand. However, as a> non-professional programmer, I find GUI the hardest part so far.

[#187786] Re: is GUI a weak point? — "Mark Volkmann" <r.mark.volkmann@...> 2006/04/05

On 4/5/06, Michal Suchanek <hramrach@centrum.cz> wrote:

[#187770] Re: is GUI a weak point? — Hidetoshi NAGAI <nagai@...> 2006/04/05

From: "greg.rb" <ghalsey@yahoo.com>

[#187776] Re: is GUI a weak point? — "Carl Woodward" <cjwoodward@...> 2006/04/05

I am thinking about this problem at the moment. There are a lot of

[#187777] Re: is GUI a weak point? — azrael@... 2006/04/05

> There are plenty of others but one thing that I would like to see/like

[#187781] Re: is GUI a weak point? — Caleb Tennis <caleb@...> 2006/04/05

[#187792] Re: is GUI a weak point? — zdennis <zdennis@...> 2006/04/05

Caleb Tennis wrote:

[#187793] Re: is GUI a weak point? — azrael@... 2006/04/05

> > Using Rails and a web interface is a nice way to present data to an end

[#187798] Re: is GUI a weak point? — Randy Kramer <rhkramer@...> 2006/04/05

On Wednesday 05 April 2006 09:40 am, azrael@cream.org wrote:

[#187802] Re: is GUI a weak point? — "Chris Alfeld" <chris.alfeld@...> 2006/04/05

Cross platform GUIs is a very serious problem today and one without

[#187723] GPL v3 and Ruby License. — "Gregory Brown" <gregory.t.brown@...>

I went to MIT for the Free Software Foundation Associate members

34 messages 2006/04/04
[#187801] Re: GPL v3 and Ruby License. — "Austin Ziegler" <halostatue@...> 2006/04/05

On 4/4/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:> I went to MIT for the Free Software Foundation Associate members> meeting last weekend. I asked Stallman the question of whether the> FSF planned to contact various individuals who were using dual> licenses and encourage them to participate in commenting on GPLv3.

[#187804] Re: GPL v3 and Ruby License. — "Gregory Brown" <gregory.t.brown@...> 2006/04/05

On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:

[#187809] Re: GPL v3 and Ruby License. — "Austin Ziegler" <halostatue@...> 2006/04/05

On 4/5/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:> On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:>> On 4/4/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:>> [...]

[#187820] Re: GPL v3 and Ruby License. — "Gregory Brown" <gregory.t.brown@...> 2006/04/05

I really didn't want to start a license flame war. I've responded

[#187829] Re: GPL v3 and Ruby License. — "Austin Ziegler" <halostatue@...> 2006/04/05

On 4/5/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:> I really didn't want to start a license flame war. I've responded> below, but please keep in mind that my personal beliefs and my> pragmatic beliefs are somewhat disjointed, and that for the> community's sake, I'd always side with my pragmatic feelings.>> Meaning... when GPLv3 comes out, do we.>> a) Resist it by removing any "any later version" clauses from our> license agreements which use the license of ruby>> b) Embrace it and re-release code using GPLv3 and Matz's terms, but> make sure the FSF hears the voice of our community beforehand.>> c) Can it entirely and favor an established license such as the BSD> license.>> d) Draft up our own license, possibly with cartoon foxes.

[#187835] Re: GPL v3 and Ruby License. — "Gregory Brown" <gregory.t.brown@...> 2006/04/05

On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:

[#187849] Re: GPL v3 and Ruby License. — "Austin Ziegler" <halostatue@...> 2006/04/05

On 4/5/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:> On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:[...]>>> Stronger is not necessarily better, of course. Stronger also can be>>> seen as 'more restrictive' by some. However, I do believe that>>> copyleft is not coercion because you cannot coerce someone through>>> licensing terms.>> That's a common misconception. One *can* coerce through licensing>> terms. If the choice is "my way or the highway", where the highway is>> extremely difficult, it's coercion. A lot of Libertarians I know>> would disagree me on this point, but they're also of the opinion that>> coercion can only come from physical force. The verb "coerce",>> however, is defined as: "To cause to do through pressure or>> necessity, by physical, moral or intellectual means". A licence can>> be coercion.> I'm an anarcho-capitalist. I guess that puts me in the dissenting> group on things like that. I believe that strong contracts that are> freely entered into can be upheld and can be used to support various> political and ethical goals.

[#187870] Re: GPL v3 and Ruby License. — "Michal Suchanek" <hramrach@...> 2006/04/05

On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:> On 4/5/06, Gregory Brown <gregory.t.brown@gmail.com> wrote:> > On 4/5/06, Austin Ziegler <halostatue@gmail.com> wrote:> [...]> >>> I am mostly in favor of weak copyleft, in most pragmatic> >>> applications of licenses. Protect your source, ensure it will> >>> remain free software, ensure the license can't be buried under a> >>> proprietary license, etc. As far as linking and integrating with> >>> non-free software... i'd like to be an idealist and say it's evil...> >>> but of course, I wouldn't have a job if that were the case ;)> >> Something like the MPL. The problem is, with the way that the GPL is> >> written, the MPL is incompatible with it. This will not be changing> >> under GPLv3.> > I imagine I must be the FSF's "most loving critic". I do love these> > guys and their ideas, but I don't love the vagueness and rhetoric they> > are prone to:>> Yeah. That's Stallman through and through. I was one of the ~300 or so> folks heavily involved in the discussion list about the MPL back in the> day, and I got into some arguments with Eben Moglen about the whole> thing when the FSF was trying to get Netscape to *solely* use the GNU> GPL. (I consider the day that the Mozilla Foundation relicensed> everything as MPL and GNU GPL as a net loss for quality open source.)>> The problem is entirely in the GNU GPL's wording preventing further> restrictions on the code. Here's a gedankenexperiment:>> * Create a copyleft licence patterned after the GNU GPL (make it the> GNU GPL without the propaganda). Call it the ASCL (Austin's Strong> Copyleft Licence). Add one additional term that enforces your right> to be known as the author of a work (this is *not* the advertising> clause from the original BSD, mind you). The ASCL is incompatible> with the GNU GPL.>> The GNU GPL requires that your licence have a *subset* of restrictions> that the GNU GPL provides. It is not even clear if the GNU GPL would be> compatible the ASCL even if the additional term were removed. However,> even *one* additional restriction, no matter how reasonable, renders> your licence wholly incompatible with the GNU GPL.>> It's nonsense, and it could be fixed pretty easily.>

[#187822] what are sympbols?!? — Alain <mantat@...>

Hi, simple question here but I cant figure it out after reading the Ruby

11 messages 2006/04/05

[#187851] Rake: Making "cleanup" task — Pistos Christou <jesusrubsyou.5.pistos@...>

I'm just getting my feet wet with Rake, at least as far as running unit

18 messages 2006/04/05
[#187861] Re: Rake: Making "cleanup" task — Jim Weirich <jim@...> 2006/04/05

Pistos Christou wrote:

[#187954] Re: Rake: Making "cleanup" task — Pistos Christou <jesusrubsyou.5.pistos@...> 2006/04/06

Jim Weirich wrote:

[#188027] Re: Rake: Making "cleanup" task — Eric Armstrong <Eric.Armstrong@...> 2006/04/07

> Jim Weirich wrote:

[#188130] Re: Rake: Making "cleanup" task — Pistos Christou <jesusrubsyou.5.pistos@...> 2006/04/07

Eric Armstrong wrote:

[#188143] Re: Rake: Making "cleanup" task — "Austin Ziegler" <halostatue@...> 2006/04/07

On 4/7/06, Pistos Christou <jesusrubsyou.5.pistos@geoshell.com> wrote:> Eric Armstrong wrote:> >> Jim Weirich wrote:> > >>> Is this possible? If so, how? :)> > >>>> > Rake is just executing a ruby script, right?> >> > So what's wrong with coding an END block> > at the end of the script?> > (he asked, not yet having tried it, but> > wondering why it wouldn't work)>> Could you show some example code? I've never heard of this "END block"> thing. I thought __END__ in Perl made the interpreter stop and ignore> everything below that line.

[#187853] best practices — Jean-Charles Carelli <jnchrls@...>

I'm working my way through the Pickaxe book and I have a question

15 messages 2006/04/05

[#187920] String generalization — Peter Szinek <peter@...>

Hello all,

15 messages 2006/04/06

[#188004] Re: Archive::Tar uncompress question — "Berger, Daniel" <Daniel.Berger@...>

> -----Original Message-----

2 messages 2006/04/06

[#188057] win32ole with COM method taking two out refs — Adam Gardiner <adam.gardiner@...>

Hi,

20 messages 2006/04/07

[#188061] Markov Chains (#74) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

40 messages 2006/04/07
[#188068] Re: [QUIZ] Markov Chains (#74) — Charlie Bowman <charlie@...> 2006/04/07

I'm pumped! I've been reading this mailing list for the last 3 months

[#188074] Re: [QUIZ] Markov Chains (#74) — James Edward Gray II <james@...> 2006/04/07

On Apr 7, 2006, at 8:53 AM, Charlie Bowman wrote:

[#188098] Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...>

I have a case where I'd like to delete an instance of a class I made

28 messages 2006/04/07
[#188099] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

-----BEGIN PGP SIGNED MESSAGE-----

[#188103] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

> Some code would help. Saying: ...

[#188105] Re: Simple Question About Deleting Instances — "Mark Van Holstyn" <mvette13@...> 2006/04/07

I think you problems is in the report class. Each time you do report =3D

[#188108] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

Mark Van Holstyn wrote:

[#188110] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

-----BEGIN PGP SIGNED MESSAGE-----

[#188115] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188120] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

Nathan Olberding wrote:

[#188123] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188126] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

Nathan Olberding wrote:

[#188131] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188137] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

Nathan Olberding wrote:

[#188141] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188145] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

Nathan Olberding wrote:

[#188149] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188151] Re: Simple Question About Deleting Instances — zdennis <zdennis@...> 2006/04/07

-----BEGIN PGP SIGNED MESSAGE-----

[#188169] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

zdennis wrote:

[#188176] Re: Simple Question About Deleting Instances — "Austin Ziegler" <halostatue@...> 2006/04/07

On 4/7/06, Nathan Olberding <nathan.olberding@gmail.com> wrote:> zdennis wrote:[...]> It's not so much that I feel strongly as much as that it perplexes me.> I guess I just wanted to make sure my meds haven't been replaced with> crazy pills.>> I thought of this, too: isn't it odd that you can define class> variables in a definition of how instances of a class should work, but> you can't define their accessors? It seems inconsistent. If it's> agreed that this is inconsistent, I'll post something to the site you> mentioned, but if it's that way for a reason, I'll just take your much> appreciated advice, learn that much more, and be that much less of a> newbie.

[#188179] Re: Simple Question About Deleting Instances — Nathan Olberding <nathan.olberding@...> 2006/04/07

Austin Ziegler wrote:

[#188190] Re: Simple Question About Deleting Instances — "Austin Ziegler" <halostatue@...> 2006/04/08

On 4/7/06, Nathan Olberding <nathan.olberding@gmail.com> wrote:> Austin Ziegler wrote:>> So using attr_accessor doesn't declare a variable; it declares a pair>> of methods that access and may instantiate a variable, but doesn't>> have to. And *that* is why doing "attr_accessor :@var" really>> wouldn't be appropriate.> I guess to put my question simply, why is there a single context in> which I can define class variables but not class methods (accessors> for these variables)? Shouldn't the two be handled in the same context> / scope / block / area-of-code?

[#188228] windows gurus i beseech you — ara.t.howard@...

12 messages 2006/04/08

[#188297] Dumb reflection problem - create object from String — Brian Parkinson <parkI@...>

Hello - I'm bashing my head against the wall - I'm sure this is a simple

9 messages 2006/04/09

[#188327] Ruby Grammar - "do" — Bihal <wmioch@...>

Hey everyone

14 messages 2006/04/10
[#188329] Re: Ruby Grammar - "do" — Eric Hodel <drbrain@...7.net> 2006/04/10

[#188330] Re: Ruby Grammar - "do" — Bihal <wmioch@...> 2006/04/10

Okay. My next question is then

[#188334] Re: Ruby Grammar - "do" — Jeff Coleman <progressions@...> 2006/04/10

Bihal wrote:

[#188335] Re: Ruby Grammar - "do" — Bihal <wmioch@...> 2006/04/10

Thanks Hal, that explains it.

[#188336] Re: Ruby Grammar - "do" — Bihal <wmioch@...> 2006/04/10

And Eric, sorry if I mislead you, by example code I meant any code I

[#188349] Adding in class attribute with a Module — kris <krisleech@...>

Is it possible to add class attributes (cattr_accessor) using a module?

26 messages 2006/04/10
[#188350] Re: Adding in class attribute with a Module — "Farrel Lifson" <farrel.lifson@...> 2006/04/10

Worked pretty much how I expected it to:

[#188355] Re: Adding in class attribute with a Module — dblack@... 2006/04/10

Hi --

[#188367] Re: Adding in class attribute with a Module — kris <krisleech@...> 2006/04/10

Thanks very much for all the examples. I think I need to clarify,

[#188386] Quick syntax question — Gregory Seidman <gsslist+ruby@...>

Consider the following three class definitions:

17 messages 2006/04/10
[#188395] Re: Quick syntax question — "Austin Ziegler" <halostatue@...> 2006/04/10

On 4/10/06, Gregory Seidman <gsslist+ruby@anthropohedron.net> wrote:> Consider the following three class definitions:>> class Foo> def self.bar> @@bar> end> def self.bar=(val)> @@bar = val> end> end>> class Foo> class << self> def bar> @@bar> end> def bar=(val)> @@bar = val> end> end> end>> class Foo> class << self> attr_accessor :bar> end> end>> Am I correct in believing that they are equivalent? If not, how do they> differ?

[#188476] Class Definition inside a method definition? — Bihal <wmioch@...>

I was under the impression that a class definition could not be inside a

24 messages 2006/04/11
[#188478] Re: Class Definition inside a method definition? — Bihal <wmioch@...> 2006/04/11

Thanks David. I'm not sure you caught sight of the line of code I was

[#188483] Re: Class Definition inside a method definition? — David Vallner <david@...> 2006/04/11

D=C5=88a Utorok 11. Apr=C3=ADl 2006 02:39 Bihal nap=C3=ADsal:

[#188486] Re: Class Definition inside a method definition? — Bihal <wmioch@...> 2006/04/11

Thanks for the explanation David, I'm sure it's close enough :P

[#188496] Re: Class Definition inside a method definition? — Bihal <wmioch@...> 2006/04/11

Hey guys,

[#188501] Re: Class Definition inside a method definition? — John Wilger <johnwilger@...> 2006/04/11

On Apr 10, 2006, at 9:46 PM, Bihal wrote:

[#188504] Re: Class Definition inside a method definition? — Bihal <wmioch@...> 2006/04/11

Sorry John, I didn't realise this was a mailing list as opposed to a

[#188615] Q about tk buttons — "Jeppe Jakobsen" <jeppe88@...>

Hi guys, I have a little problem with the buttons in tk. I want to add 1 to

12 messages 2006/04/11

[#188631] vim 7 ruby omni-complete v0.2 — Mark Guzman <segfault@...>

Thanks to some outside suggestions and contributions we now have another

17 messages 2006/04/12

[#188678] First script seems slow - What's a better way to write this? — Charlotte <c.f.curtis@...>

I've inherited a tcl script from previous co-op students, and it's a

19 messages 2006/04/12
[#188688] Re: First script seems slow - What's a better way to write this? — Peter Hickman <peter@...> 2006/04/12

As a side issue there is a tool to generate cross references in tcl

[#188696] Re: First script seems slow - What's a better way to write t — Charlotte <c.f.curtis@...> 2006/04/12

Thanks for the link. However, I forgot to mention that the reason I'm

[#188705] Re: First script seems slow - What's a better way to write t — ara.t.howard@... 2006/04/12

On Thu, 13 Apr 2006, Charlotte wrote:

[#188707] Re: First script seems slow - What's a better way to write t — Daniel Berger <Daniel.Berger@...> 2006/04/12

ara.t.howard@noaa.gov wrote:

[#188714] Re: First script seems slow - What's a better way to write t — "Mark Volkmann" <r.mark.volkmann@...> 2006/04/12

On 4/12/06, Daniel Berger <Daniel.Berger@qwest.com> wrote:

[#188791] Ruby Idioms (TextMate Bundle) — James Edward Gray II <james@...>

Just a short note here, for TextMate users. I've made my bundle of

14 messages 2006/04/13
[#188868] Re: [ANN] Ruby Idioms (TextMate Bundle) — Ezra Zygmuntowicz <ezmobius@...> 2006/04/13

[#188900] Refactoring (#75) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

9 messages 2006/04/14
[#189159] Re: [QUIZ] Refactoring (#75) — "Ilmari Heikkinen" <ilmari.heikkinen@...> 2006/04/17

On 4/14/06, Ruby Quiz <james@grayproductions.net> wrote:> The three rules of Ruby Quiz:>> 1. Please do not post any solutions or spoiler discussion for this quiz until> 48 hours have passed from the time on this message.>> 2. Support Ruby Quiz by submitting ideas as often as you can:>> http://www.rubyquiz.com/>> 3. Enjoy!>> Suggestion: A [QUIZ] in the subject of emails about the problem helps everyone> on Ruby Talk follow the discussion.>> -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=>> by Pat Eyler>> This week's quiz is a bit of a departure from the normal. Instead of submitting> different implementations of the same code, we'd like you to submit different> implementations of the same process -- Refactoring.>> Refactoring is the art of improving the design of existing code, without> changing it's functional behaviour. It is well documented in the book> 'Refactoring' by Martin Fowler, and on his website:>> http://www.refactoring.com>> The quiz this week is to submit refactorings of code you use -- whether your own> code, a library or application for RubyForge, or even something from the> Standard Library. Any submission should implement a refactoring from:>> http://www.refactoring.com/catalog/index.html>> or other citable sources, e.g.:>> http://kallokain.blogspot.com/2006/01/refactoring-extract-mixin.html>> Each Submission should follow this outline:>> Refactoring name (and citation if needed)> Original code> Explanation of the purpose and mechanics of the refactoring> New code> (optionally, unit tests created/used to verify the code)>> Submissions will be combined into an online catalog of Ruby Refactorings,> probably on the RubyGarden wiki.>>

[#188932] Google Summer of Code -- It's back — "Patrick Hurley" <phurley@...>

http://code.google.com/soc/

50 messages 2006/04/14
[#188934] Re: Google Summer of Code -- It's back — "pat eyler" <pat.eyler@...> 2006/04/14

On 4/14/06, Patrick Hurley <phurley@gmail.com> wrote:

[#188936] Re: Google Summer of Code -- It's back — dblack@... 2006/04/14

Hi --

[#188937] Re: Google Summer of Code -- It's back — Peter Szinek <peter@...> 2006/04/14

dblack@wobblini.net wrote:

[#189103] Re: Google Summer of Code -- It's back — Nicolas Kassis <nic.kassis@...> 2006/04/17

Peter Szinek wrote:

[#189176] Re: Google Summer of Code -- It's back — Gregory Seidman <gsslist+ruby@...> 2006/04/17

On Tue, Apr 18, 2006 at 12:34:49AM +0900, Nicolas Kassis wrote:

[#189183] Re: Google Summer of Code -- It's back — Jake McArthur <jake.mcarthur@...> 2006/04/17

I'm also eligible, and this is right up my ally. Would love to get

[#189194] Re: Google Summer of Code -- It's back — "Tanner Burson" <tanner.burson@...> 2006/04/18

On 4/17/06, Jake McArthur <jake.mcarthur@gmail.com> wrote:

[#189231] Re: Google Summer of Code -- It's back — "Patrick Hurley" <phurley@...> 2006/04/18

On 4/17/06, Tanner Burson <tanner.burson@gmail.com> wrote:

[#189232] Re: Google Summer of Code -- It's back — James Edward Gray II <james@...> 2006/04/18

On Apr 18, 2006, at 7:28 AM, Patrick Hurley wrote:

[#188935] Super-unstable Webrick on Windows 2000 — Bryan Duxbury <bryan.duxbury@...>

I'm using Ruby 1.8.4 on a Windows 2000 machine. When running anything

13 messages 2006/04/14
[#188939] Re: Super-unstable Webrick on Windows 2000 — Stephen Caudill <vox@...> 2006/04/14

Why not just use Mongrel[1]?

[#188941] Re: Super-unstable Webrick on Windows 2000 — James Britt <james_b@...> 2006/04/14

Stephen Caudill wrote:

[#188943] Re: Super-unstable Webrick on Windows 2000 — Bryan Duxbury <bryan.duxbury@...> 2006/04/15

Actually, I ran on 1.8.2 for a long time, too. The errors had exactly

[#188951] HighLine - examples for using "list" — "Sy Ali" <sy1234@...>

http://highline.rubyforge.org/doc/classes/HighLine.html

25 messages 2006/04/15
[#188959] Re: HighLine - examples for using "list" — Mike Stok <mike@...> 2006/04/15

[#188965] Re: HighLine - examples for using "list" — "Sy Ali" <sy1234@...> 2006/04/15

On 4/15/06, Mike Stok <mike@stok.ca> wrote:

[#188967] Re: HighLine - examples for using "list" — "Sy Ali" <sy1234@...> 2006/04/15

Ok, I played with it some more and it appears it won't do what I want.

[#188969] Re: HighLine - examples for using "list" — James Edward Gray II <james@...> 2006/04/15

On Apr 15, 2006, at 10:19 AM, Sy Ali wrote:

[#188971] Re: HighLine - examples for using "list" — "Sy Ali" <sy1234@...> 2006/04/15

On 4/15/06, James Edward Gray II <james@grayproductions.net> wrote:

[#188974] Re: HighLine - examples for using "list" — "Sy Ali" <sy1234@...> 2006/04/15

On 4/15/06, Sy Ali <sy1234@gmail.com> wrote:

[#188978] Re: HighLine - examples for using "list" — James Edward Gray II <james@...> 2006/04/15

On Apr 15, 2006, at 1:36 PM, Sy Ali wrote:

[#188984] Re: HighLine - examples for using "list" — "Sy Ali" <sy1234@...> 2006/04/15

On 4/15/06, James Edward Gray II <james@grayproductions.net> wrote:

[#188985] Re: HighLine - examples for using "list" — Mike Stok <mike@...> 2006/04/15

[#188987] Re: HighLine - examples for using "list" — James Edward Gray II <james@...> 2006/04/15

On Apr 15, 2006, at 5:00 PM, Mike Stok wrote:

[#189018] Re: HighLine - examples for using "list" — "Gregory Brown" <gregory.t.brown@...> 2006/04/16

On 4/15/06, James Edward Gray II <james@grayproductions.net> wrote:

[#189025] Re: HighLine - examples for using "list" — James Edward Gray II <james@...> 2006/04/16

On Apr 16, 2006, at 9:55 AM, Gregory Brown wrote:

[#188957] Bug: Requiring "breakpoint" causes the entire Rails framework to load. — "Alder Green" <alder.green@...>

Hi

11 messages 2006/04/15
[#188976] Re: Bug: Requiring "breakpoint" causes the entire Rails framework to load. — Florian Gro<florgro@...> 2006/04/15

Alder Green wrote:

[#188973] "Ruby for Rails" now available in PDF! — dblack@...

Hi everyone --

12 messages 2006/04/15

[#189058] Tattoo — "ruby talk" <rubytalk@...>

I want to get a tattoo of ruby code, but i just cant seem to find code

15 messages 2006/04/17

[#189118] Need to carry over application variable into RUBY script — Peter Bailey <pbailey@...>

I have an application that converts PDFs to individual EPS files. When

7 messages 2006/04/17
[#189120] Re: Need to carry over application variable into RUBY script — "Austin Ziegler" <halostatue@...> 2006/04/17

On 4/17/06, Peter Bailey <pbailey@bna.com> wrote:> I have an application that converts PDFs to individual EPS files. When> it does so, it creates a subdirectory with the same name as the original> filename and puts all of the resulting EPS files it creates into that> directory. Well, I have to do a lot of scripting and stuff on those EPS> files. To automate this, I need to know what the directory name is that> it put the files. The application provides a variable, "%2," just for> this purpose. I've gotten this %2 variable to work for me in cmd.exe.> But, I'd like it to work in RUBY. I'm sure it can be done. But, came> someone tell me how I can transfer this %2 variable from my application> to a Dir.chdir target?

[#189130] Re: Need to carry over application variable into RUBY script — Peter Bailey <pbailey@...> 2006/04/17

Austin Ziegler wrote:

[#189136] Re: Need to carry over application variable into RUBY script — "Austin Ziegler" <halostatue@...> 2006/04/17

On 4/17/06, Peter Bailey <pbailey@bna.com> wrote:> Austin Ziegler wrote:> > On 4/17/06, Peter Bailey <pbailey@bna.com> wrote:> >> I have an application that converts PDFs to individual EPS files. When> >> it does so, it creates a subdirectory with the same name as the original> >> filename and puts all of the resulting EPS files it creates into that> >> directory. Well, I have to do a lot of scripting and stuff on those EPS> >> files. To automate this, I need to know what the directory name is that> >> it put the files. The application provides a variable, "%2," just for> >> this purpose. I've gotten this %2 variable to work for me in cmd.exe.> >> But, I'd like it to work in RUBY. I'm sure it can be done. But, came> >> someone tell me how I can transfer this %2 variable from my application> >> to a Dir.chdir target?> >> > %2 is the 2nd argument on the command-line, so you just have to look> > for ARGV[2].> >> > It'd be interesting to find out what %1 is ;)> Thanks, Austin. So, do I do this?>> Dir.chdir(ARGV[2])> or this> Dir.chdir("ARGV[2]")?

[#189203] Google Summer of Code update — dblack@...

Hi --

13 messages 2006/04/18

[#189258] Is anyone doing serious dev using the one-click Ruby? — David Reynolds <dr-groups@...>

I'm getting started with Rails on Windows and really like the

8 messages 2006/04/18
[#189261] Re: Is anyone doing serious dev using the one-click Ruby? — "Austin Ziegler" <halostatue@...> 2006/04/18

On 4/18/06, David Reynolds <dr-groups@fantast.com> wrote:> I'm getting started with Rails on Windows and really like the> convenience of the one-click Ruby installer but the stable releases are> too few and far between -- only about once a year it seems -- which> means you get stuck with an old version of Ruby.> Is there an easy way to patch it while waiting between stable releases?> Or is the one-click version of Ruby just a convenient tool for newbies> on Windows and not recommended for serious Ruby development? (A few> things I've found that don't work have also given me this impression.)> If not the one-click installer, what? One of the other binaries for> Windows? Or is the problem endemic to all win32 binaries, and the best> course is to work on linux?

[#189263] ruby-ldap on Windows (built) — Chris Scharf <scharfie@...>

I have finally managed to build the ruby-ldap library for the Windows

34 messages 2006/04/18
[#189279] Re: ruby-ldap on Windows (built) — "Wilson Bilkovich" <wilsonb@...> 2006/04/18

On 4/18/06, Chris Scharf <scharfie@gmail.com> wrote:

[#189280] Re: ruby-ldap on Windows (built) — Chris Scharf <scharfie@...> 2006/04/18

Wilson Bilkovich wrote:

[#189285] Re: ruby-ldap on Windows (built) — Ian Macdonald <ian@...> 2006/04/18

Chris Scharf wrote:

[#189328] Re: ruby-ldap on Windows (built) — Ian Macdonald <ian@...> 2006/04/19

Ian Macdonald wrote:

[#189633] Re: ruby-ldap on Windows (built) — Ian Macdonald <ian@...> 2006/04/20

Ian Macdonald wrote:

[#189286] Publishing to rubyforge - is there a command line tool that accompanies the rubyforge publisher rake contrib task — "Jeff Barczewski" <jeff.barczewski@...>

I was trying to use the rake contrib task for publishing to Rubyforge, but

5 messages 2006/04/18
[#189289] Re: Publishing to rubyforge - is there a command line tool that accompanies the rubyforge publisher rake contrib task — "Austin Ziegler" <halostatue@...> 2006/04/18

On 4/18/06, Jeff Barczewski <jeff.barczewski@gmail.com> wrote:> I was trying to use the rake contrib task for publishing to Rubyforge, but> it seems to use a command line component to do the work (which I don't seem> to have :-) I believe this was contributed by Florian Gross. Does anyone> know where I get this extra piece to make this all work?>> What do people use to automate their uploads to Rubyforge? Is this publish> task the best way? I have many files to post each time.

[#189354] interested in metaprogramming? — "chiaro scuro" <kiaroskuro@...>

Hi, I have started writing a guide to metaprogramming called 'the way

19 messages 2006/04/19
[#189359] Re: interested in metaprogramming? — Mark Somerville <mark@...> 2006/04/19

On Wednesday 19 April 2006 09:37, chiaro scuro wrote:

[#189361] Re: interested in metaprogramming? — "chiaro scuro" <kiaroskuro@...> 2006/04/19

two people is already a crowd to me :-)

[#189366] Re: interested in metaprogramming? — Gregory Seidman <gsslist+ruby@...> 2006/04/19

On Wed, Apr 19, 2006 at 06:31:47PM +0900, chiaro scuro wrote:

[#189407] Is there an "in" operator in ruby ? — Dinesh Umanath <u_dinesh@...>

Hi all,

13 messages 2006/04/19

[#189423] Symbol#to_proc is just so beautiful — Daniel Schierbeck <daniel.schierbeck@...>

When is this ever getting into Ruby Core?

21 messages 2006/04/19
[#189449] Re: Symbol#to_proc is just so beautiful — Florian Gro<florgro@...> 2006/04/19

Daniel Schierbeck schrieb:

[#189500] Re: Symbol#to_proc is just so beautiful — John Johnson <johnatl@...> 2006/04/19

[#189448] Symbol#to_proc is just so beautiful — TRANS <transfire@...>

What would you think of:

20 messages 2006/04/19
[#189466] Gateway (was Re: Symbol#to_proc is just so beautiful) — Ross Bamford <rossrt@...> 2006/04/19

On Thu, 2006-04-20 at 04:02 +0900, TRANS wrote:

[#189477] Re: Gateway (was Re: Symbol#to_proc is just so beautiful) — Eric Hodel <drbrain@...7.net> 2006/04/19

On Apr 19, 2006, at 12:56 PM, Ross Bamford wrote:

[#189486] Array#each Looping Gotcha — Nathan Olberding <nathan.olberding@...>

I think I've found a gotcha. Really, it should be expected behavior, but

8 messages 2006/04/19

[#189505] Zero is true, but it isn't — John Johnson <johnatl@...>

I was wondering today, so I tried this:

12 messages 2006/04/19

[#189516] Re: Gateway (was Re: Symbol#to_proc is just so beautiful) — TRANS <transfire@...>

You guys have no sympathy for goodness sake! You want to dis the

12 messages 2006/04/20
[#189522] Re: Gateway (was Re: Symbol#to_proc is just so beautiful) — "Gregory Brown" <gregory.t.brown@...> 2006/04/20

On 4/19/06, TRANS <transfire@gmail.com> wrote:

[#189592] Converting IP range to array of IP's — Kris <krisleech@...>

I'm looking to convert an IP string (ranges, subnet masks or wild-carded

14 messages 2006/04/20

[#189703] Text Munger (#76) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

74 messages 2006/04/21
[#189708] Re: [QUIZ] Text Munger (#76) — =?ISO-8859-15?Q?Florian_Gro=DF?= <florgro@...> 2006/04/21

Ruby Quiz wrote:

[#189709] Re: [QUIZ] Text Munger (#76) — James Edward Gray II <james@...> 2006/04/21

On Apr 21, 2006, at 8:10 AM, Florian Growrote:

[#189712] Re: [QUIZ] Text Munger (#76) — "Dirk Meijer" <hawkman.gelooft@...> 2006/04/21

this quiz is probably easier than usually, as, for the first time

[#189714] Re: [QUIZ] Text Munger (#76) — Gregory Seidman <gsslist+ruby@...> 2006/04/21

On Fri, Apr 21, 2006 at 11:16:38PM +0900, Dirk Meijer wrote:

[#189753] Re: [QUIZ] Text Munger (#76) — Jake McArthur <jake.mcarthur@...> 2006/04/21

My first participation in Ruby Quiz, and it has to be easy. That

[#189756] Re: [QUIZ] Text Munger (#76) — "Ryan Leavengood" <leavengood@...> 2006/04/21

Strictly speaking, any Ruby code can be made into one line with

[#189767] Re: Text Munger (#76) — "Bill Kelly" <billk@...> 2006/04/21

From: "Andrew Johnson" <ajohnson@cpan.org>

[#189758] Newbie questoin of the day:A for loop that counts backwards? — MenDAKE <mendake_ddude@...>

How do I get a for loop to count backwards?

11 messages 2006/04/21

[#189900] How do threads and join work? — "Pat Maddox" <pergesu@...>

I'm reading the pickaxe and it says on p137 "When a Ruby program

20 messages 2006/04/23

[#189906] How to make an array from a date range? — "Marston A." <marston@...>

What is the easiest way in Ruby to make an array our of a date range?

13 messages 2006/04/23

[#189993] Ruby programs to learn from. — Jonathan uUttle <j.tuttle@4077.mash.org>

Hello,

13 messages 2006/04/23

[#190036] Squeak-like Ruby env — "Robert Feldt" <robert.feldt@...>

Hi,

23 messages 2006/04/24
[#190054] Re: Squeak-like Ruby env — "Ryan Leavengood" <leavengood@...> 2006/04/24

On 4/24/06, Robert Feldt <robert.feldt@gmail.com> wrote:

[#190080] Re: Squeak-like Ruby env — "Ilmari Heikkinen" <ilmari.heikkinen@...> 2006/04/24

Hi,

[#190144] Rake task dependeny vs. method call — TRANS <transfire@...>

In Rake, what's the signifficant difference between

19 messages 2006/04/25

[#190186] Ruby IDE — SleepJunk13 <SleepJunk13@...>

Is there a standard IDE out there that most people use? I'm looking at

40 messages 2006/04/25
[#190197] Re: Ruby IDE — "Ryan Leavengood" <leavengood@...> 2006/04/25

On 4/25/06, SleepJunk13 <SleepJunk13@gmail.com> wrote:

[#190207] Re: Ruby IDE — "John Gabriele" <jmg3000@...> 2006/04/26

On 4/25/06, Ryan Leavengood <leavengood@gmail.com> wrote:

[#190729] Re: Ruby IDE — Paul Legato <plegato@...> 2006/04/29

SleepJunk13 wrote:

[#190751] Re: Ruby & Emacs — Eric Armstrong <Eric.Armstrong@...> 2006/04/30

Hmm. The only thing that turned me off to Emacs was the

[#190311] Ruby for command line applications — Alan M <nospam@...>

Hi,

32 messages 2006/04/26
[#190312] Re: Ruby for command line applications — Jake McArthur <jake.mcarthur@...> 2006/04/26

Of course, you can expect a bias on this mailing list, but I will

[#190317] Re: Ruby for command line applications — James Edward Gray II <james@...> 2006/04/26

On Apr 26, 2006, at 4:31 PM, Jake McArthur wrote:

[#190368] from block to code (also: how to get the bindings of a block) — "chiaro scuro" <kiaroskuro@...>

Does anyone know how to convert a block to a string representation of

34 messages 2006/04/27
[#190793] Re: from block to code (also: how to get the bindings of a block) — Eric Hodel <drbrain@...7.net> 2006/04/30

On Apr 27, 2006, at 12:35 AM, chiaro scuro wrote:

[#190798] Re: from block to code (also: how to get the bindings of a block) — "chiaro scuro" <kiaroskuro@...> 2006/04/30

On 4/30/06, Eric Hodel <drbrain@segment7.net> wrote:

[#190902] Re: from block to code (also: how to get the bindings of a block) — Eric Hodel <drbrain@...7.net> 2006/05/01

On Apr 30, 2006, at 1:30 PM, chiaro scuro wrote:

[#190909] Re: from block to code (also: how to get the bindings of a block) — "chiaro scuro" <kiaroskuro@...> 2006/05/01

On 5/1/06, Eric Hodel <drbrain@segment7.net> wrote:

[#190910] Re: from block to code (also: how to get the bindings of a block) — "Jacob Fugal" <lukfugl@...> 2006/05/01

On 5/1/06, chiaro scuro <kiaroskuro@gmail.com> wrote:

[#190913] Re: from block to code (also: how to get the bindings of a block) — "chiaro scuro" <kiaroskuro@...> 2006/05/01

On 5/1/06, Jacob Fugal <lukfugl@gmail.com> wrote:

[#190948] Re: from block to code (also: how to get the bindings of a block) — Ross Bamford <rossrt@...> 2006/05/01

On Tue, 2006-05-02 at 05:11 +0900, chiaro scuro wrote:

[#190950] Re: from block to code (also: how to get the bindings of a block) — "chiaro scuro" <kiaroskuro@...> 2006/05/02

Not sure about the ATs. even if I don't mind them that much... if I unfocus

[#190955] Re: from block to code (also: how to get the bindings of a block) — Ross Bamford <rossrt@...> 2006/05/02

On Tue, 2006-05-02 at 09:27 +0900, chiaro scuro wrote:

[#190435] Integration/Antidifferentiation Program — SleepJunkie <SleepJunk13@...>

I'd like to write a program to integrate derivatives to save time on

28 messages 2006/04/27
[#192005] Re: Integration/Antidifferentiation Program — Justin Bangerter <bodanger@...> 2006/05/09

I've been thinking about doing something like this myself, just for

[#190438] OT: Vim->Ruby and back ? — Meino Christian Cramer <Meino.Cramer@...>

Hi,

12 messages 2006/04/27

[#190453] Re: Fishing in Ruby — "Brown, Warren" <warrenbrown@...>

>> But does it scale?

43 messages 2006/04/27
[#190455] Re: Fishing in Ruby — dblack@... 2006/04/27

Hi --

[#190467] Re: Fishing in Ruby — Pistos Christou <jesusrubsyou.5.pistos@...> 2006/04/27

unknown wrote:

[#190469] Re: Fishing in Ruby — Jake McArthur <jake.mcarthur@...> 2006/04/27

>>>>> But does it scale?

[#190536] Re: Fishing in Ruby — Steve Callaway <sjc2000_uk@...> 2006/04/28

For sure, there's no plaice here for them....

[#190537] Re: Fishing in Ruby — "Daniel Baird" <danielbaird@...> 2006/04/28

Surely there has been enough carping on.. we should stop baiting each

[#190551] Re: Fishing in Ruby — "Alan Fritz" <Alan.Fritz@...> 2006/04/28

Yes, I agree. This is all becoming one big flaming fugu...

[#190554] Re: Fishing in Ruby — "stuart yarus" <syarus@...> 2006/04/28

I'm floundering around, hoping there will be a reel end to this

[#190620] Re: Fishing in Ruby — "Giles Bowkett" <gilesb@...> 2006/04/28

I think it may be a while before this thread hits its fin ish.

[#190623] Re: Fishing in Ruby — "John Gabriele" <jmg3000@...> 2006/04/28

Nah. This is just a fluke. The bad puns will abait any minute now.

[#190632] Re: Fishing in Ruby — "Giles Bowkett" <gilesb@...> 2006/04/28

You're right. We've definitely passed the point where anyone else will dive in.

[#190633] Re: Fishing in Ruby — "Bill Guindon" <agorilla@...> 2006/04/28

On 4/28/06, Giles Bowkett <gilesb@gmail.com> wrote:

[#190634] Re: Fishing in Ruby — "Vlad GALU" <vladgalu@...> 2006/04/28

On 4/28/06, Bill Guindon <agorilla@gmail.com> wrote:

[#190638] Re: Fishing in Ruby — "Mike Brum" <ruby@...> 2006/04/28

Welcome, it's good to see more people getting their feet wet with Ruby!

[#190639] Re: Fishing in Ruby — "Alan Fritz" <Alan.Fritz@...> 2006/04/28

Yes we usually don't see this much carp over one thread but Welcome!

[#190640] Re: Fishing in Ruby — Charlie Bowman <charlie@...> 2006/04/28

I just followed a link earlier in this post to the ruby forum. Google

[#190457] Ruby Drops — Jake McArthur <jake.mcarthur@...>

This is the idea I am thinking of proposing for my Google Summer of

27 messages 2006/04/27
[#190529] Re: Ruby Drops — Jake McArthur <jake.mcarthur@...> 2006/04/28

Come on, it can't be that bad of an idea! Is this really going to go

[#190564] time.parse fails for year values > 2037 (time out of range) in ruby 1.8.4 — "Peter Krantz" <peter.krantz@...>

Hi!

12 messages 2006/04/28
[#190680] Re: time.parse fails for year values > 2037 (time out of range) in ruby 1.8.4 — Jim Morris <morris@...> 2006/04/29

If you don't need the time and just the date, then Date seems to have a much wider range

[#190607] how to create Class object with name determined at runtime — Bill Roberts <bill.roberts@...>

I hope someone can help with this - I am a Ruby newbie.

10 messages 2006/04/28

[#190622] how to use curly brackets vs. 'end' in Ruby — carlo <cdicelico@...>

i dislike the use of 'end' (just about the only think i *don't* like in

20 messages 2006/04/28
[#190625] Re: how to use curly brackets vs. 'end' in Ruby — "Austin Ziegler" <halostatue@...> 2006/04/28

On 4/28/06, carlo <cdicelico@earthlink.net> wrote:> i dislike the use of 'end' (just about the only think i *don't* like in> ruby). so, since everybody is saying that this is just a matter of> taste, why won't this work:

[#190689] Multiplexed I/O — "Vlad GALU" <vladgalu@...>

I'd like to use Ruby for a quite high performance networking tool.

20 messages 2006/04/29

[#190712] can a ruby script perform a chdir on win xp? — "Bill Guindon" <agorilla@...>

I want to run a ruby script, and end up in a different directory. Possible?

23 messages 2006/04/29

[#190758] Constant in Ruby. — Charlie <peckcharlie@...>

I'm new to Ruby programming and I saw this article which concerns me:

20 messages 2006/04/30
[#190761] Re: Constant in Ruby. — Mike Fletcher <lemurific+rforum@...> 2006/04/30

Charlie wrote:

[#190765] Re: Constant in Ruby. — Charlie <peckcharlie@...> 2006/04/30

Mike Fletcher wrote:

[#190770] Re: Constant in Ruby. — Daniel Schierbeck <daniel.schierbeck@...> 2006/04/30

Charlie wrote:

[#191539] Re: Constant in Ruby. — Charlie <peckcharlie@...> 2006/05/05

Thank you everyone for your input. I got this simple example to share:

[#190776] Ruby based editor — Phil Jackson <phil@...>

Hi all,

20 messages 2006/04/30
[#190806] Re: Ruby based editor — Randy Kramer <rhkramer@...> 2006/04/30

On Sunday 30 April 2006 11:00 am, Phil Jackson wrote:

[#190810] Re: Ruby based editor — Phil Jackson <phil@...> 2006/04/30

On Mon, May 01, 2006 at 07:38:40AM +0900, Randy Kramer wrote:

[#190817] Re: Ruby based editor — "John Gabriele" <jmg3000@...> 2006/05/01

On 4/30/06, Phil Jackson <phil@shellarchive.co.uk> wrote:

[#190855] Re: Ruby based editor — "Simon Strandgaard" <neoneye@...> 2006/05/01

On 5/1/06, John Gabriele <jmg3000@gmail.com> wrote:

Re: [QUIZ][SOLUTION] Markov Chains (#74)

From: Joern Dinkla <joern@...>
Date: 2006-04-10 22:47:26 UTC
List: ruby-talk #188471
Hi again,

I wrote:
> Hi all,
> 
> Here's my solution for the quiz No 74. It generates text with a first 
> order Markov Chain. Because the matrix of a Markov chain for native 
> language tests is sparse, the chain is stored in a hash of hashes for 
> better memory usage.

Now i implemented higher order Markov Chains as well. I could not resist 
:-)

A first order chain, for example the following one

     @mc3 = MarkovChain.new()
     @mc3.add(1,2)
     @mc3.add(3,4)

is stored as the following hash of hashes

	{1=>{2=>1}, 3=>{4=>1}}

A higher order chain, for example the following

     @mc7 = MarkovChain.new(order = 2)
     @mc7.add_elems([20,21,20,22,21,22,20,23])

is also stored as a hash of hashes, but the keys are arrays

{[22, 21]=>{22=>1}, [22, 20]=>{23=>1}, [20, 21]=>{20=>1}, [21, 
22]=>{20=>1}, [20,22]=>{21=>1}, [21,20]=>{22=>1}}

Because i am new to Ruby, i had to learn a few things about Arrays, 
Objects and dup(). I still do not understand this fully (perhaps it is 
to late here 00:46 CET), but in the method MarkovChain.add() i need to 
dup the arrays, otherwise some keys will get overwritten.

In class MarkovChain
   # Add an edge from node a to node b.
   #
   def add(a, b)
     # this dup is needed, otherwise elements will be overwritten
     a = a.dup() if a.instance_of?(Array)
     @absolute[a] ||= {}
     @absolute[a][b] ||= 0
     @absolute[a][b] += 1
     @sum_edges[a] ||= 0
     @sum_edges[a] += 1
     @dirty[a] = true
   end

I will try to find it out tommorow. By the way, below is an example text 
i generated for order 3 after i fed 4 books of Chesterton into the 
chain. Beginning with order 3 i think the text looks like a patchwork or 
collage of some phrases and sentences of the original texts.

Best regards,

Joern

. Up to a certain point it was a wordless clamour startlingly close, and 
loud enough to be distinct if each word had not killed the other. No, 
replied Fisher. The Renaissance nobles of the Tudor time were like that. 
It is awful, I think it goes far enough! said Flambeau; but my 
information is fragmentary, and only twelve members of the Central 
Anarchist Council. The gentleman who has for some time past played, with 
propriety and general applause, the difficult part of Thursday, has died 
quite suddenly. Consequently, he was willing to go into Parliament as a 
yeoman or a gentleman or a Jacobite or an Ancient Briton, I should say 
that, Crane went on. This also tempted him, that in a more partial and 
also a more premature fashion, for his voice was colourless and sad. 
What I did next does matter: I gave him a rather wild stare, March had 
yet another unexpected emotion, for his guide hailed the man as Hoggs 
and introduced him as Sir Howard Horne, then introducing his so-called 
Socialist budget, and prepared to expound it in an interview with so
promising a penman. Harold March was to have the gold of Glengyle. So 
far the crime seemed clear enough; and while Boyle was looking into it 
he heard a thud behind him, and then a sudden stillness, as of a stone 
statue walking. He might have been firebrands. The mutinies simmered 
down; the men who must have known that particular house to be so 
accurately inaccurate. But what makes you think it a specimen. Put the 
same feather with a ribbon and an artificial flower and everyone will 
think it a wildcat, though it may have been a clever fellow, answered 
the priest. As they raced along to the gate out of which poured and 
rolled, not Roman, but very late, and that this, my successful
masquerade, might be of considerable value to the public, placed it here 
with his own pale blue ones, and said, Do you want me to tell you all 
you want to guess what he doing, keep behind him. About his life and 
fortune on the table, and went below the surface in a way that at once 
puzzled and reassured him. On the oranges was the equally clear and 
exact description, Finest Brazil nuts, 4d. a lb. M. Brun had a dark, 
handsome lady, of no little majesty, and rather like a mosaic palace, 
rent with earthquakes; or like a Dutch tulip garden blown to the stars. 
The other did not answer; he was free in free London, and drinking

-- 
Joern Dinkla, http://www.dinkla.net


Attachments (7)

markov-chain.rb (2.64 KB, text/x-ruby)
require 'pretty-print'

# 
# A Markov Chain contains a graph which edges are labeled with probabilities.
# The graph is stored as two hashes, one for the absolute probabilites, one for
# the relative probabilities. The nodes of the graph correspond to the keys of the hashes.
#
# The rand() method is worst case O(n), for small lists this is ok, but for
# large lists binary search will be better O(lg n)
#

class MarkovChain 

  attr_reader :order
  
  # Initializes the hashes.
  #
  def initialize(order = 1)
    @order = order
    @absolute = {}
    @relative = {}
    @sum_edges = {}
    @dirty = {}
  end
  
  # The nodes of the graph correspond to the keys of the hashes.
  #
  def nodes
    @absolute.keys()
  end
  
  # Add an edge from node a to node b.
  #
  def add(a, b)
    # this dup is needed, otherwise elements will be overwritten
    a = a.dup() if a.instance_of?(Array)
    @absolute[a] ||= {} 
    @absolute[a][b] ||= 0
    @absolute[a][b] += 1
    @sum_edges[a] ||= 0
    @sum_edges[a] += 1
    @dirty[a] = true
  end

  # Adds a list of elements pairwise.
  #
  def add_elems(elems)
    if ( 1 == @order )
      a = nil
      elems.each() do |b|
        add(a, b) if ( a )
        a = b
      end
    else
      a = []
      elems.each() do |b|
        if ( a.length() == @order )
          add(a, b)
          a.shift()
        end
        a.push(b)
      end
    end
  end

  # Calculates all the relative cumulative probabilities.
  #
  def recalc_all()
    @relative = @absolute.dup()
    @relative.each_pair do | a, hash |
      recalc(a) if @dirty[a]
    end
  end
  
  # Calculates the relative cumulative probabilities.
  #
  def recalc(a)
    cum = 0.0
    @relative[a] = @absolute[a].dup()
    sum = @sum_edges[a] * 1.0
    @relative[a].each_pair do | b, value|
      cum = cum + ( value / sum )
      @relative[a][b] = cum
    end
    @dirty.delete(a)
    @relative[a]
  end
  
  # Generates a random successor of node a according to the probabilities learned 
  # from the example texts.
  #
  def rand(a)
    recalc(a) if @dirty[a]
    if a.nil? || @relative[a].nil? || @relative[a].length() == 0
      return nil
    elsif @relative[a].length() == 1
      return @relative[a].keys[0]
    else
      # this is a linear search now with worst case O(n), TODO log(n) binary search
      value = Kernel.rand()
      candidates = @relative[a].select { |b, prob| prob > value }
      return candidates[0][0]
    end
  end

  def to_s()
    result = []
    result << "MarkovChain"
    @absolute.each_pair do | key, hash |
      result << "#{key.pretty_to_s()}: ABS: #{@absolute[key].pretty_to_s()} - REL: #{@relative[key].pretty_to_s()}"
    end
    result.join("\n")
  end

end
story-generator.rb (1.87 KB, text/x-ruby)
# 

require 'markov-chain'

# A generator for stories. Fill the Markov chain with the methods add()
# or add_file() and generate a story with the method story().
#
class StoryGenerator

  attr_reader :mc, :order
  
  # Initializes.
  #
  def initialize(order = 1) 
    @mc ||= MarkovChain.new(order = order)
    @order = order
  end

  # Adds the words to the MarkovChain
  #
  def add(words) 
    @mc.add_elems(words)
  end

  # Adds a file to the MarkovChain.
  #
  def add_file(file) 
    puts "Reading file #{file}" if ( $VERBOSE )
    words = Words.parse_file(file)
    if ( $VERBOSE )
      puts "Read in #{words.length} words."
      puts "Inserting words from file #{file}"
      STDOUT.flush()
    end
    @mc.add_elems(words)
  end
  
  # Genereates a story with n words (".", "," etc. counting as a word) 
  #
  def story(n, initial_words = nil)
    elems = generate(n, initial_words)
    format(elems)
  end
  
  # Generates a story from the Markov Chain mc of length n and which starts with a
  # successor of word.
  #
  def generate(n, words)
    lexicon = @mc.nodes()
    words = random_word(lexicon) if words.nil?
    elems = []
    1.upto(n) do |i|
      next_word = @mc.rand(words)
      # if no word is word, take a random one from the lexicon
      if next_word.nil?
        words = random_word(lexicon)
      else
        if 1 == @order 
          words = next_word
          elems << words
        else
          elems << words.shift()
          words.push(next_word)
        end
      end
      if ( i % LOG_WORDS_NUM == 0 && $VERBOSE )
        puts "Generated #{i} words." 
        STDOUT.flush()
      end
    end
    elems
  end
  
  # Formats the elements.
  #
  def format(elems)
    text = elems.join(" ")
    text.gsub!(/\ ([.,!?;:'"-])\ /, '\1 ')
    text
  end

  # Returns a random (list of) word(s)
  #
  def random_word(lexicon)
    lexicon[rand(lexicon.length)]  
  end
  
end
words.rb (1.06 KB, text/x-ruby)
# A parser for texts in native languages, for example english or german.
# 
# Example:
#   "To be    or not to    be."
#
# will be parsed into the array
#
# ["To", "be", "or", "not", "to", "be", "."]
#
class Words

  attr_reader :words
  
  # Returns the words of a file.
  #
  def Words.parse_file(filename)
    i = 1
    all_words = []
    File.foreach(filename) do |line|
      ws = Words.parse(line)
      next if ws.nil?
      all_words += ws
      i += 1 
      if ( i % LOG_FILE_READ_NUM == 0 && $VERBOSE ) 
        puts "  Read #{i} lines." 
        STDOUT.flush()
      end
    end
    all_words
  end

  # Returns the words of a line.
  #
  def Words.parse(line)
    # replace newline
    line.gsub!(/\r\n/, '')
    return nil if line.length == 0
    # seperate all special characters by blanks
    line.gsub!(/([,;!?:.])/, ' \1 ')
    # remove unused special characters
    line.gsub!(/[+=\t\r\n()"]/, " ")
    line.gsub!(/\-+/, " - ")
    line.gsub!(/'[^t]/, "")
    # split the line into words
    words = line.split(/[ ]+/).select { |w| w.length > 0 }
    words
  end

end
pretty-print.rb (678 Bytes, text/x-ruby)
#


class NilClass
  def pretty_to_s()
    "nil"
  end
end

class Fixnum
  def pretty_to_s()
    to_s()
  end
end

class Float
  def pretty_to_s()
    to_s()
  end
end

class String
  def pretty_to_s()
    to_s()
  end
end



class Array

  def pretty_to_s()
    results = ["["]
    self.each() do |e|
      results += [ e.pretty_to_s(), "," ] 
    end
    results.pop() if results.length() > 1
    results += [ "]" ]
    results.join("")
  end
  
end

class Hash

  def pretty_to_s()
    results = ["{"]
    self.each() do |e|
      results += [ e.pretty_to_s(), "," ] 
    end
    results.pop() if results.length() > 1
    results += [ "}" ]
    results.join("")
  end
  
end
main-markov-chains.rb (1.92 KB, application/x-sh)
joern.vcf (209 Bytes, text/x-vcard)
begin:vcard
fn;quoted-printable:J=C3=B6rn Dinkla
n;quoted-printable:Dinkla;J=C3=B6rn
adr;dom:;;;Hamburg
email;internet:joern@dinkla.net
tel;cell:+49(0)179 70 10 60 5
x-mozilla-html:TRUE
version:2.1
end:vcard

In This Thread

Prev Next