[#253828] Getting the last N bytes of a string: — Brian Candler <B.Candler@...>

What's the simplest way to get only the last 10 bytes of a string?

21 messages 2007/06/01

[#253837] FizzBuzz (#126) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

177 messages 2007/06/01
[#253853] Re: [QUIZ] FizzBuzz (#126) — Hans Fugal <fugalh@...> 2007/06/01

Ruby Quiz wrote:

[#253854] Re: FizzBuzz (#126) — Paul Novak <novakps@...> 2007/06/01

On Jun 1, 9:51 am, Hans Fugal <fug...@zianet.com> wrote:

[#253885] Re: [QUIZ] FizzBuzz (#126) — Daniel Martin <martin@...> 2007/06/01

Hans Fugal <fugalh@zianet.com> writes:

[#253945] Re: [QUIZ] FizzBuzz (#126) — Morton Goldberg <m_goldberg@...> 2007/06/02

On Jun 1, 2007, at 8:28 AM, Ruby Quiz wrote:

[#254215] Re: [QUIZ] FizzBuzz (#126) — James Edward Gray II <james@...> 2007/06/04

On Jun 1, 2007, at 10:37 PM, Morton Goldberg wrote:

[#253969] Re: [QUIZ] FizzBuzz (#126) — Daniel Martin <martin@...> 2007/06/02

Ruby Quiz <james@grayproductions.net> writes:

[#254095] Re: [QUIZ] FizzBuzz (#126) — Michael Glaesemann <grzm@...> 2007/06/03

My first Ruby Quiz submission.

[#254096] Re: FizzBuzz (#126) — Joshua Ballanco <jballanc@...> 2007/06/03

So, I've got to lay claim to the 56 byte solution:

[#254097] Re: FizzBuzz (#126) — "Robert Dober" <robert.dober@...> 2007/06/03

On 6/3/07, Joshua Ballanco <jballanc@gmail.com> wrote:

[#254104] Re: FizzBuzz (#126) — Joshua Ballanco <jballanc@...> 2007/06/03

Robert Dober wrote:

[#253838] nested methods don't really exist?! — Artur Merke <am@...>

Hi,

28 messages 2007/06/01
[#253906] Re: nested methods don't really exist?! — Robert Klemme <shortcutter@...> 2007/06/01

On 01.06.2007 14:36, Artur Merke wrote:

[#253919] Re: nested methods don't really exist?! — Trans <transfire@...> 2007/06/01

[#253961] Re: nested methods don't really exist?! — Robert Klemme <shortcutter@...> 2007/06/02

On 01.06.2007 23:14, Trans wrote:

[#253967] Re: nested methods don't really exist?! — "Robert Dober" <robert.dober@...> 2007/06/02

On 6/2/07, Robert Klemme <shortcutter@googlemail.com> wrote:

[#253893] Help with emailing attachments with Ruby... — grooveska <ryangs@...>

I am working on a script that will send an email with a .csv file

11 messages 2007/06/01

[#254054] No way of looking for a regrexp match starting from a particular point in a string? — Kenneth McDonald <kenneth.m.mcdonald@...>

I'm probably just missing something obvious, but I haven't found a way

26 messages 2007/06/03
[#254056] Re: No way of looking for a regrexp match starting from a particular point in a string? — Nobuyoshi Nakada <nobu@...> 2007/06/03

Hi,

[#254059] Re: No way of looking for a regrexp match starting from a particular point in a string? — "Patrick Hurley" <phurley@...> 2007/06/03

On 6/3/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

[#254063] Re: No way of looking for a regrexp match starting from a particular point in a string? — Nobuyoshi Nakada <nobu@...> 2007/06/03

Hi,

[#254235] Re: No way of looking for a regrexp match starting from a particular point in a string? — "Robert Dober" <robert.dober@...> 2007/06/04

On 6/3/07, Kenneth McDonald <kenneth.m.mcdonald@sbcglobal.net> wrote:

[#254132] FizzBuzz (#126) — "Christian Roese" <croese@...>

Great quiz, really got me thinking about other ways to solve this

16 messages 2007/06/03
[#254277] Re: [QUIZ] FizzBuzz (#126) — "Mike Moore" <blowmage@...> 2007/06/04

I didn't spend any time golfing this quiz, so I don't have anything crazy to

[#254217] code problems — "david karapetyan" <dkarapetyan@...>

why is the following code not valid

18 messages 2007/06/04
[#254218] Re: code problems — Nobuyoshi Nakada <nobu@...> 2007/06/04

Hi,

[#254219] Re: code problems — "david karapetyan" <dkarapetyan@...> 2007/06/04

thanks. i didn't realize i had to provide the block as well when i was

[#254223] Re: code problems — Nobuyoshi Nakada <nobu@...> 2007/06/04

Hi,

[#254291] Re: code problems — fREW <frioux@...> 2007/06/04

On 6/3/07, Nobuyoshi Nakada <nobu@ruby-lang.org> wrote:

[#254250] Deleting a file - is there a less clumsy way to do this? — "Ronald Fischer" <ronald.fischer@...>

In my application, I often have blocks of code, where during preparation

13 messages 2007/06/04

[#254332] Reverse-range alternatives? — Kenneth McDonald <kenneth.m.mcdonald@...>

Since a reverse range (eg. 4...1) is functionally almost the same as an

11 messages 2007/06/04

[#254452] David Black's book _Ruby for Rails — finetan@...

Hi all

16 messages 2007/06/05

[#254459] [QUIZ] FizzBuzz (#126) [solution #1] — MenTaLguY <mental@...>

I've got two solutions this go-round. First, the solution I would present were I asked to do this in an actual job interview:

13 messages 2007/06/05

[#254467] Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...>

Hello, I'm working on Gecode/R, a Ruby interface to Gecode[0], allowing

24 messages 2007/06/05
[#254477] Re: Gecode/R - Request for syntax feedback — James Edward Gray II <james@...> 2007/06/05

On Jun 5, 2007, at 2:43 PM, Andreas Launila wrote:

[#254526] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

James Edward Gray II wrote:

[#254544] Re: Gecode/R - Request for syntax feedback — James Edward Gray II <james@...> 2007/06/06

On Jun 6, 2007, at 5:21 AM, Andreas Launila wrote:

[#254561] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

James Edward Gray II wrote:

[#254583] Re: Gecode/R - Request for syntax feedback — Andreas Launila <ruby-talk@...> 2007/06/06

Andreas Launila wrote:

[#254639] Globals not incrementing inside block — "Todd A. Jacobs" <tjacobs-sndr-019fdb@...>

I have the following snippet:

13 messages 2007/06/07
[#254642] Re: Globals not incrementing inside block — "Harry Kakueki" <list.push@...> 2007/06/07

On 6/7/07, Todd A. Jacobs <tjacobs-sndr-019fdb@codegnome.org> wrote:

[#254661] Mutually-Recursive Functions — Revence Kalibwani <revence27@...>

Ruby doesn't seem to do mutually-recursive functions. Or is it some

15 messages 2007/06/07
[#254664] Re: Mutually-Recursive Functions — Dan Zwell <dzwell@...> 2007/06/07

Revence Kalibwani wrote:

[#254665] Re: Mutually-Recursive Functions — Revence Kalibwani <revence27@...> 2007/06/07

Dan Zwell wrote:

[#254673] What about a 'series' type? — Peter Marsh <evil_grunger@...>

I'm sure everyone is fimilar with ranges:

17 messages 2007/06/07
[#254685] Re: What about a 'series' type? — seebs@... (Peter Seebach) 2007/06/07

In message <cd08f63ca2ad51e567d4288410f593da@ruby-forum.com>, Peter Marsh writes:

[#254686] Re: What about a 'series' type? — SonOfLilit <sonoflilit@...> 2007/06/07

Actually, the syntax:

[#254717] Problem with getting info from several websites — "Tom Bombadil" <bombadil.tom@...>

Hi there,

14 messages 2007/06/07
[#254741] Re: Problem with getting info from several websites — George Malamidis <george@...> 2007/06/07

Hi,

[#254799] Re: Problem with getting info from several websites — "Tom Bombadil" <bombadil.tom@...> 2007/06/08

George,

[#254743] Installing Curb Was: Re: ruby libcurl maintainer? — "Jano Svitok" <jan.svitok@...>

On 6/7/07, Md.elme focruzzaman Shuvo <shuvo.razi@gmail.com> wrote:

11 messages 2007/06/07
[#254816] Installing Curb Was: Re: ruby libcurl maintainer? — "Md.elme focruzzaman Shuvo" <shuvo.razi@...> 2007/06/08

Jano Svitok wrote:

[#254808] newbie question about Ri — Grehom <grehom@...>

I just installed the latest Windows version from Activestate (having

13 messages 2007/06/08

[#254812] practical ruby console on windows? — =?iso-8859-2?q?Kiripolszky_K=E1roly?= <karoly.kiripolszky@...>

Ehlo,

5 messages 2007/06/08

[#254831] Mexican Blanket (#127) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

16 messages 2007/06/08

[#254863] Synchronized attr_accessor — Nasir Khan <rubylearner@...>

I have a fairly repetitive use case of having to define attributes and

23 messages 2007/06/08
[#254865] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 04:34:42 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254867] Re: Synchronized attr_accessor — Nasir Khan <rubylearner@...> 2007/06/08

This is about having a instance variable always accessed under a lock,

[#254879] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 04:55:24 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254886] Re: Synchronized attr_accessor — Nasir Khan <rubylearner@...> 2007/06/08

There is no big picture.

[#254890] Re: Synchronized attr_accessor — MenTaLguY <mental@...> 2007/06/08

On Sat, 9 Jun 2007 06:54:04 +0900, Nasir Khan <rubylearner@gmail.com> wrote:

[#254900] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Yeah I see what you guys mean...I was a little delusional. Now I

[#254915] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Actually facets/more/synchash.rb does what I was looking for hash.

[#254943] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/09

Prodding it further I could come up with a method synchronizer.

[#255049] Re: Synchronized attr_accessor — "Caleb Clausen" <vikkous@...> 2007/06/10

Nasir Khan wrote:

[#255073] Re: Synchronized attr_accessor — "Nasir Khan" <rubylearner@...> 2007/06/11

Thanks for the feedback. Here is a refinement -

[#255093] Re: Synchronized attr_accessor — "Caleb Clausen" <vikkous@...> 2007/06/11

On 6/10/07, Nasir Khan <rubylearner@gmail.com> wrote:

[#254864] trouble running ruby programs — Hydro_Flame XZ18 <hydroflame@...>

I'm a newbie programmer and I just downloaded ruby today. I must say I'm

14 messages 2007/06/08
[#254866] Re: trouble running ruby programs — Peter Szinek <peter@...> 2007/06/08

> Can anyone help? I'm running Windows XP if that helps at all.

[#254870] Re: trouble running ruby programs — Jacob Gillie <hydroflame@...> 2007/06/08

I tried going to the command prompt, making sure the file was in the

[#254871] Re: trouble running ruby programs — "Michael W. Ryder" <_mwryder@...> 2007/06/08

Jacob Gillie wrote:

[#254917] Ruby wildcard command line argument auto expansion — Michael Jia <z_jia@...>

I want to pass in wildcard file names, and use it to match file names

14 messages 2007/06/09

[#254974] Passing block to Proc#call — "Erwin Abbott" <erwin.abbott@...>

I'd like to do something like:

13 messages 2007/06/10

[#254975] Overloading Array Subtraction operator — Nicko <anko.com@...>

Hi,

15 messages 2007/06/10
[#254978] Re: Overloading Array Subtraction operator — "Erwin Abbott" <erwin.abbott@...> 2007/06/10

The - operator compares objects by their ID, so they aren't removed

[#254986] JRuby 1.0 Released — Thomas Enebo <Thomas.Enebo@...>

The JRuby community is pleased to announce the release of JRuby 1.0!

14 messages 2007/06/10

[#254989] fun with "case" — Robert Klemme <shortcutter@...>

16 messages 2007/06/10

[#255013] Serious danger of being impressed — Mark Carter <me@...>

I'm mostly into Python, and decided to have a go at writing a little

34 messages 2007/06/10
[#255038] Re: Serious danger of being impressed — Chad Perrin <perrin@...> 2007/06/10

On Mon, Jun 11, 2007 at 12:20:12AM +0900, Mark Carter wrote:

[#255096] Re: Serious danger of being impressed — John Joyce <dangerwillrobinsondanger@...> 2007/06/11

[#255103] Re: Serious danger of being impressed — Chad Perrin <perrin@...> 2007/06/11

On Mon, Jun 11, 2007 at 03:42:03PM +0900, John Joyce wrote:

[#255044] Requiring more than one file? — Marc Heiler <shevegen@...>

require does accept ony word, which should be the name that has

13 messages 2007/06/10

[#255142] Custom Mutex methods undefined by fastthread — Alex Young <alex@...>

At the risk of asking an FAQ, I've run into the following problem:

12 messages 2007/06/11

[#255181] a matter of style — Bas van Gils <bas@...>

22 messages 2007/06/11
[#255188] Re: a matter of style — Anthony Martinez <pi@...> 2007/06/11

On Tue, Jun 12, 2007 at 03:10:49AM +0900, Bas van Gils wrote:

[#255299] Re: a matter of style — dblack@... 2007/06/12

Hi --

[#255202] Ruby way to update a file in place — Li Chen <chen_li3@...>

Hi all,

12 messages 2007/06/11

[#255258] how to make a[2][2][3]=4 work? — gz zz <gpygood@126.com>

a=Hash.new{|h,k|

16 messages 2007/06/12

[#255289] Generate a grid of cells, and give characteristics — Joop Van den tillaart <tillaart36@...>

Hi you all I am new to this forum and also quite new to ruby...I have

12 messages 2007/06/12
[#255303] Re: Generate a grid of cells, and give characteristics — "Harry Kakueki" <list.push@...> 2007/06/12

On 6/12/07, Joop Van den tillaart <tillaart36@hotmail.com> wrote:

[#255306] Re: Generate a grid of cells, and give characteristics — Joop Van den tillaart <tillaart36@...> 2007/06/12

Harry Kakueki wrote:

[#255315] Re: Generate a grid of cells, and give characteristics — "Harry Kakueki" <list.push@...> 2007/06/12

On 6/12/07, Joop Van den tillaart <tillaart36@hotmail.com> wrote:

[#255373] Quick sed replacemnt — yitzhakbg <yitzhakbg@...>

I need a quicky which I can't do in sed and I did it very clumsily.

14 messages 2007/06/12

[#255651] Changing registry values with Win32::Registry — Collin Miller <collintmiller@...>

I'm trying to change a registry value for an IPTV SDK

12 messages 2007/06/14
[#255699] Re: Changing registry values with Win32::Registry — "Jano Svitok" <jan.svitok@...> 2007/06/15

On 6/14/07, Collin Miller <collintmiller@gmail.com> wrote:> I'm trying to change a registry value for an IPTV SDK>> This code:>> Win32::Registry::HKEY_LOCAL_MACHINE.open("SOFTWARE\\PATH_TO_KEY\> \").write("IgnoreTinyIFrames",Win32::Registry::REG_DWORD,0)>> Returns this error:>> Win32::Registry::Error: Access is denied.> from c:/ruby/lib/ruby/1.8/win32/registry.rb:743:in `write'> from (irb):150> from ⊂:0>> Anybody know how I can ensure access to this key?

[#255664] Reasonable practice? — Trans <transfire@...>

It the following reasonable? How thread safe is it?

14 messages 2007/06/14

[#255672] Re: class destruction (evil genius metaprogramming) — "Rick DeNatale" <rick.denatale@...>

On 6/14/07, Giles Bowkett <gilesb@gmail.com> wrote:

12 messages 2007/06/15

[#255737] Verbal Arithmetic (#128) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

29 messages 2007/06/15

[#255760] Using extend for initialization settings? — Trans <transfire@...>

It's not uncommon to see initialize method take a hash or a setting

16 messages 2007/06/15
[#255784] Re: Using extend for initialization settings? — Robert Klemme <shortcutter@...> 2007/06/15

On 15.06.2007 16:44, Trans wrote:

[#255797] Re: Using extend for initialization settings? — Trans <transfire@...> 2007/06/15

[#255864] Adding new value (in array) to existing key in a hash — Gilbert Lau <gilbertlsk@...>

Hi all,

12 messages 2007/06/16
[#255866] Re: Adding new value (in array) to existing key in a hash — "Harry Kakueki" <list.push@...> 2007/06/16

On 6/16/07, Gilbert Lau <gilbertlsk@gmail.com> wrote:

[#255873] Re: Adding new value (in array) to existing key in a hash — Gilbert Lau <gilbertlsk@...> 2007/06/16

Harry Kakueki wrote:

[#255871] Error in ancestor? — "Robert Dober" <robert.dober@...>

Hi list

39 messages 2007/06/16
[#256036] Re: Error in ancestor? — Sylvain Joyeux <sylvain.joyeux@...> 2007/06/18

I launched a discussion about this on Ruby-core. I think there were no

[#256193] Re: Error in ancestor? — "Robert Dober" <robert.dober@...> 2007/06/19

On 6/18/07, Sylvain Joyeux <sylvain.joyeux@polytechnique.org> wrote:

[#256204] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/19

On 6/19/07, Robert Dober <robert.dober@gmail.com> wrote:

[#256236] Re: Error in ancestor? — dblack@... 2007/06/19

Hi --

[#256486] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/21

On 6/19/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256492] Re: Error in ancestor? — dblack@... 2007/06/21

Hi --

[#256594] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/22

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256595] Re: Error in ancestor? — dblack@... 2007/06/22

Hi --

[#256598] Re: Error in ancestor? — "Gregory Brown" <gregory.t.brown@...> 2007/06/22

On 6/22/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256700] Re: Error in ancestor? — "Rick DeNatale" <rick.denatale@...> 2007/06/23

On 6/22/07, Gregory Brown <gregory.t.brown@gmail.com> wrote:

[#255911] Chris Pine Program Challenges — danielj@...

puts 'Type in as many words as you want'

13 messages 2007/06/16

[#255980] Parsing strings — NB88 <germans88@...>

Quick question, is there a method for deleting substrings from within a

15 messages 2007/06/18

[#256062] Another Easy Beginner Question — danielj <danielj@...>

17 messages 2007/06/18

[#256131] local vars clobbered by un-run code — Trans <transfire@...>

Err...

13 messages 2007/06/19

[#256243] Ruby MVC — poopdeville@...

Hi Everybody,

14 messages 2007/06/20

[#256299] Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...>

Hello everybody,

55 messages 2007/06/20
[#256311] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Trans <transfire@...> 2007/06/20

[#256357] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

>> Hello everybody,

[#256361] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Robert Klemme <shortcutter@...> 2007/06/21

On 21.06.2007 11:06, Alexander Presber wrote:

[#256364] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

Am 21.06.2007 um 11:20 schrieb Robert Klemme:

[#256365] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256367] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256370] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256498] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Rick DeNatale" <rick.denatale@...> 2007/06/21

On 6/21/07, dblack@wobblini.net <dblack@wobblini.net> wrote:

[#256369] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

[#256374] Re: Behaviour of Enumerables reject vs. select mixed into Hash — dblack@... 2007/06/21

Hi --

[#256377] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

[#256385] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, Alexander Presber <aljoscha@weisshuhn.de> wrote:

[#256401] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Trans <transfire@...> 2007/06/21

[#256414] Re: Behaviour of Enumerables reject vs. select mixed into Hash — "Robert Dober" <robert.dober@...> 2007/06/21

On 6/21/07, Trans <transfire@gmail.com> wrote:

[#256423] Re: Behaviour of Enumerables reject vs. select mixed into Hash — Alexander Presber <aljoscha@...> 2007/06/21

>> module Enumerable

[#256310] Do You Understand Regular Expressions? — growlatoe@...

Hi all.

20 messages 2007/06/20
[#256317] Re: Do You Understand Regular Expressions? — "Axel Etzold" <AEtzold@...> 2007/06/20

> irb(main):001:0> "hello".scan(/.*/)

[#256324] Re: Do You Understand Regular Expressions? — Daniel DeLorme <dan-ml@...42.com> 2007/06/20

Axel Etzold wrote:

[#256386] Re: Do You Understand Regular Expressions? — "Stephen Ball" <sdball@...> 2007/06/21

On 6/20/07, Daniel DeLorme <dan-ml@dan42.com> wrote:

[#256426] Ruby extensions question.. — Aaron Smith <beingthexemplary@...>

So I'm getting slightly confused with writing ruby extensions and what

17 messages 2007/06/21
[#256430] Re: Ruby extensions question.. — james.d.masters@... 2007/06/21

On Jun 21, 10:22 am, Aaron Smith <beingthexempl...@gmail.com> wrote:

[#256442] Re: Ruby extensions question.. — Aaron Smith <beingthexemplary@...> 2007/06/21

unknown wrote:

[#256450] Re: Ruby extensions question.. — MenTaLguY <mental@...> 2007/06/21

On Fri, 22 Jun 2007 03:55:11 +0900, Aaron Smith <beingthexemplary@gmail.com> wrote:

[#256469] Re: Ruby extensions question.. — Aaron Smith <beingthexemplary@...> 2007/06/21

MenTaLguY wrote:

[#256473] Re: Ruby extensions question.. — MenTaLguY <mental@...> 2007/06/21

On Fri, 22 Jun 2007 05:28:17 +0900, Aaron Smith <beingthexemplary@gmail.com> wrote:

[#256447] Ruby doesn't know how to multiply — "rjprado@..." <rjprado@...>

Hello,

45 messages 2007/06/21
[#256462] Re: Ruby doesn't know how to multiply — "rjprado@..." <rjprado@...> 2007/06/21

On Jun 21, 3:21 pm, "rjpr...@gmail.com" <rjpr...@gmail.com> wrote:

[#256484] Re: Ruby doesn't know how to multiply — Lloyd Linklater <lloyd@2live4.com> 2007/06/21

> Yes, you are all right. It's a common problem. I have confirmed this

[#256509] Re: Ruby doesn't know how to multiply — Yukihiro Matsumoto <matz@...> 2007/06/22

Hi,

[#256512] Re: Ruby doesn't know how to multiply — "Michael W. Ryder" <_mwryder@...> 2007/06/22

Yukihiro Matsumoto wrote:

[#256514] Re: Ruby doesn't know how to multiply — "Gregory Brown" <gregory.t.brown@...> 2007/06/22

On 6/21/07, Michael W. Ryder <_mwryder@worldnet.att.net> wrote:

[#256517] Re: Ruby doesn't know how to multiply — Rob Biedenharn <Rob@...> 2007/06/22

On Jun 21, 2007, at 8:48 PM, Gregory Brown wrote:

[#256519] Re: Ruby doesn't know how to multiply — "Michael W. Ryder" <_mwryder@...> 2007/06/22

Rob Biedenharn wrote:

[#256556] avoiding nil.methodcalls short and cheap — Thorsten Rossner <rossnet@...>

Hi,

17 messages 2007/06/22

[#256675] Regexp to split name? — Alex MacCaw <maccman@...>

Does anyone have an example of splitting a name into first and last

15 messages 2007/06/23
[#256676] Re: Regexp to split name? — darren kirby <bulliver@...> 2007/06/23

quoth the Alex MacCaw:

[#256713] Named/positional method args — darren kirby <bulliver@...>

I have a method here that takes two arguments. Both are optional, with

19 messages 2007/06/23

[#256748] LSRC Name Picker (#129) — Ruby Quiz <james@...>

The three rules of Ruby Quiz:

44 messages 2007/06/24
[#256749] Re: [QUIZ] LSRC Name Picker (#129) — James Edward Gray II <james@...> 2007/06/24

Sorry the quiz was late this week.

[#256811] Helper to create multi-dimensional arrays — Anthony Martinez <pi@...>

I came up with this method really quick to create x*y arrays in Ruby. It

21 messages 2007/06/24
[#256816] Ruby Debugger — Dick Summerfield <ds@...> 2007/06/24

Hello everybody,

[#257017] Probably an FAQ, but... — David Rush <kumoyuki@...>

Hi all,

13 messages 2007/06/26
[#257023] Re: Probably an FAQ, but... — Morton Goldberg <m_goldberg@...> 2007/06/26

On Jun 26, 2007, at 5:00 AM, David Rush wrote:

[#257033] how much to charge for a freelance project in ruby in the states — urielka <uriel.katz@...>

i work in Israel and i wanted to know how much should i charge per

9 messages 2007/06/26

[#257207] ActiveRecord (not necessarily rails) — "shawn bright" <nephish@...>

Hello all,

11 messages 2007/06/27

[#257228] Ajax with Ruby problem — Gale CC <galecho@...>

I'm a newbie to both Ruby and Ajax. I'm trying to use Ruby to handle the

13 messages 2007/06/27

[#257246] Array Problem, sort Array — Cool Wong <coolwong85@...>

[code]

23 messages 2007/06/28
[#257248] Re: Array Problem, sort Array — "list. rb" <list.rb@...> 2007/06/28

["a", "a", "a", "b", "b", "c", "c", "c","d", "d", "e"].uniq.sort

[#257342] Help with regular expression — "toulax@..." <toulax@...>

How can I make a regular expression that will match everything, unless

17 messages 2007/06/28
[#257343] Re: Help with regular expression — Philip Hallstrom <ruby@...> 2007/06/28

> How can I make a regular expression that will match everything, unless

[#257346] Re: Help with regular expression — "toulax@..." <toulax@...> 2007/06/28

On Jun 28, 4:00 pm, Philip Hallstrom <r...@philip.pjkh.com> wrote:

[#257353] Re: Help with regular expression — "Axel Etzold" <AEtzold@...> 2007/06/28

I think what you want is what's called negative lookahead.

[#257383] newby non/programmer trying to understand classes — "weathercoach@..." <weathercoach@...>

Hello.

15 messages 2007/06/28

[#257428] Where to start in parsing? — "Hakusa@..." <Hakusa@...>

I haven't programmed in a while, but I want to get back with doing

10 messages 2007/06/29

[#257454] Feature Request: Special file '-' denoting stdin/stdout — "Ronald Fischer" <ronald.fischer@...>

I would like to propose a feature for Ruby which can be

12 messages 2007/06/29
[#257471] Re: Feature Request: Special file '-' denoting stdin/stdout — Erik Veenstra <erikveen@...> 2007/06/29

It should be mentioned that both File.new and File.open are

[#257746] Re: Feature Request: Special file '-' denoting stdin/stdout — "Ronald Fischer" <ronald.fischer@...> 2007/07/02

[#257573] is it bug? for — Chung Chung <bkeh12@...>

[root@home1 ~]# ruby -v

16 messages 2007/06/30

[#257601] de-camelcase a filename — Aaron Smith <beingthexemplary@...>

how can a take a string file name like MyTestCase.rb and change it to

15 messages 2007/06/30

[#257609] apt-get installs 1.8.5 on ubuntu 7.0.4 — "D. Krmpotic" <david.krmpotic@...>

hi!

11 messages 2007/06/30

Re: KVO in Ruby

From: Joel VanderWerf <vjoel@...>
Date: 2007-06-07 18:02:46 UTC
List: ruby-talk #254751
Joshua Ballanco wrote:
> Zachary Holt wrote:
>> On Jun 6, 2007, at 10:47 PM, Joshua Ballanco wrote:
>>
>>> Hey all!
>> Hey
>>
>>> Is there a good method for implementing Key-Value Observing in Ruby?
>> Check out the Observable module.
>>
>> http://ruby-doc.org/core/classes/Observable.html
> 
> Hmm...how did I miss that? This should do very well for the project I'm 
> currently working on.
> 
> However, looking through the Observable module, I see one major 
> downside: it's not automatic. That is, the Observable module should work 
> well enough for custom classes, but what about Built-in and Standard 
> Library classes? If, say, you wanted to be notified when the length of a 
> string was changed, you would have to extend the String class, but then 
> also implement a method to constantly observe the length...or am I 
> missing something here? The way I understand how this works in Cocoa is 
> that isa-swizzling is used to replace the class of the property being 
> observed with a thin pseudo-class that notifies any registered observers 
> when a change is made, then passes the change to the original class.
> 
> Is there a good reason not to do things this way? to do things this way? 
> The only KVO implementation that I've ever used is Cocoa's, so I'm just 
> curious about how/why it's done in Ruby. If I'm making a big fuss over 
> nothing please feel free to say so.
> 

It will be difficult to get automatic notification of a change in the 
length of a string, since there are so many ways that can happen, and it 
happens in core code. (For example, the C function rb_str_append() gets 
called from other C functions, so there is no way to hook in a pure ruby 
observer.)

However, there are some cases where a library class has an attr_writer 
(or other method) and all you want is notification of changes that go 
through that method. And, of course if you are developing the library 
yourself you can force all changes to go through a method.

In these cases, you might want to take a look at my observable library 
(really, it should be called observable-attr or something):

http://raa.ruby-lang.org/project/observable/
http://redshift.sourceforge.net/observable/

Unlike the standard Observer library, which operates at the level of 
entire objects, this library operates on individual methods. Also, 
notification is automatic in the sense that the observed object doesn't 
have to call notify_observers. Further, each observer can register more 
than one "when" clause that is called just when the new value matches 
(in the sense of #===) some pattern, class, or other matching object.

I've found this useful primarily in fxruby (the foxtails library uses it 
to make data targets more friendly and responsive).

Here's an example:

   require 'observable'

   # A prexisting class with a method that doesn't expect to be observed.
   class Base
     attr_writer :foo
   end

   class Speaker < Base
     extend Observable

     # make the inherited method :foo be observable and define an
     # additional observable attribute, :bar.
     observable :foo, :bar

     def run
       self.foo = "1"
       self.bar = [4,5,6]
       self.foo = "2"
       self.bar << 7 # Caution: no notification here!
       self.bar += [8] # notification
       self.foo = "3"
       @foo = "4" # No notification here, since writer wasn't called
     end
   end

   class Listener
     def initialize(speaker)
       speaker.when_foo /2/ do |v|
         puts "#{self} saw foo change to have a 2 in #{v.inspect}"
       end

       speaker.when_foo /\d/ do |v|
         puts "#{self} saw foo change to have a digit in #{v.inspect}"
       end

       # This would override the first when_foo clause
       #speaker.when_foo /2/ do |v|
       #  puts "#{self} saw foo change to have a 2 in #{v.inspect} 
[overridden]"
       #end

       # listen for _any_ changes (note that #=== is used to match value,
       # so Object matches everything, including the initial nil)
       speaker.when_bar Object do |v, old_v|
         puts "#{self} saw bar change from #{old_v.inspect} to #{v.inspect}"
       end
     end
   end

   sp = Speaker.new
   Listener.new(sp)
   sp.run

__END__

Output:

#<Listener:0xb7a56628> saw bar change from nil to nil
#<Listener:0xb7a56628> saw foo change to have a digit in "1"
#<Listener:0xb7a56628> saw bar change from nil to [4, 5, 6]
#<Listener:0xb7a56628> saw foo change to have a 2 in "2"
#<Listener:0xb7a56628> saw foo change to have a digit in "2"
#<Listener:0xb7a56628> saw bar change from [4, 5, 6, 7] to [4, 5, 6, 7, 8]
#<Listener:0xb7a56628> saw foo change to have a digit in "3"

-- 
       vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407

In This Thread