[#89088] More questions about =~ — GGarramuno@... (GGarramuno)
irb(main):006:1* class String
[#89093] Good article on Open Source, GPL, copyright, etc. — Tim Hunter <cyclists@...>
There is periodically some discussion on c.l.r. about Open Source
[#89115] Drb and observer pattern — Stephan K舂per <Stephan.Kaemper@...>
Hi all and have a happy new year everybody!
[#89118] Confused abour 'ri' in 1.8.1? — Frank Mitchell <fmitchell@...>
Sorry if this has been asked before, but ...
[#89119] Loop/Iterator questions — GGarramuno@... (GGarramuno)
1) Is there anything like Perl's continue block available? This is
ts <decoux@moulon.inra.fr> wrote in message news:<200401041500.i04F0jg04445@moulon.inra.fr>...
[#89141] mod_ruby and win2k — David Tillman <dtillman@...>
Hello all, I first sent this to the mod_ruby list - after
[#89159] Ruby general question — "Greg Brondo" <greg@...>
Ok. I'm sold on Ruby (it really is great). I have a question though: Why
[#89162] Dir.chdir '~' — Joel VanderWerf <vjoel@...>
[#89171] Execute code on descendant class init — Chris Morris <chrismo@...>
I've got the following code:
[#89174] DRb question — Jos Backus <jos@...>
I am trying to write a simple remote execution framework, and am running into a
[#89180] nuby question: f.rename(x,y) does not work — "Boris \"BXS\" Schulz" <bxs@...>
Hi,
[#89185] Ruby explained to Python programmers — "Gilles Lenfant" <glenfant-nospam@...>
Hi,
Gilles Lenfant wrote:
[#89189] Best way to send mail in ruby — Bauduin Raphael <rb@...>
Hi,
Bauduin Raphael (rb@raphinou.com) wrote:
Thanks :-)
A lot of these things are snippets on the RubyGarden Wiki, and there is also
[#89193] Simple Ruby DB apps/programs ... — Useko Netsumi <usenets@...>
I was wondering if there are some example of small Ruby(1.8.1) Database
Useko Netsumi wrote:
Carl Youngblood wrote:
[#89194] Rublog questions — Hal Fulton <hal9000@...>
I probably "just don't get it" yet. So feel free to say,
[#89206] How to disconnect a drb client? — Nathaniel Talbott <nathaniel@...>
I have a drb client/server application, and I'd like the server to be
[#89222] webhosting with ruby? — "Chris Pine" <cpine@...>
Does anyone know of any webhosters offering Ruby (or mod_ruby)?
[#89255] libldap-ruby and \000 — Bedo Sandor <bsanyi@...>
[#89261] class Time doesn't pass year 2038? — Jean-Baptiste <temuphaey0@...>
Hi!
On Wed, Jan 07, 2004 at 10:06:24AM +0900, Josef 'Jupp' SCHUGT wrote:
On Wed, Jan 07, 2004 at 10:36:42AM +0900, Mark J. Reed wrote:
[#89271] name of current ruby iterpreter — Joel VanderWerf <vjoel@...>
[#89285] proc question and instance_methods — GGarramuno@... (GGarramuno)
Continuing with the sets of newbie questions...
[#89290] Calling shadowed methods in an inherited object — Charles Comstock <cc1@...>
If I have code like:
[#89294] problems compiling ruby 1.8.1 on AIX 4.3.3 — biblia99@... (paul)
Hi,
[#89301] Re: Ruby.exe crashing with WIN32OLE WMI example? — "Pe, Botp" <botp@...>
Yonatan of yonatan_avraham at hotmail.com humbly asked:
[#89312] rub 1.8.1 and $= — Patrick Gundlach <clr1.10.randomuser@...>
Hello out there,
[#89322] Ruby and QT/KDE — "Greg Brondo" <greg@...>
Is there any mature bindings (like Python has) for KDE/QT and Ruby?
Greg Brondo wrote:
[#89339] Compression (besides Huffman) and Ruby — "Josef 'Jupp' SCHUGT" <jupp@...>
Hi!
Josef 'Jupp' SCHUGT wrote:
[#89353] ruby-1.8.1/ext/tk/sample/demos-en/ : none works! — Paul.Sue@... (Paul)
Hi,
[#89359] RDoc & other questions... — GGarramuno@... (GGarramuno)
1) Is there any document describing the syntax and rules that rdoc
[#89367] Database applications and OOness — Tim Bates <tim@...>
People,
I've been watching this thread with a great deal of interest. I'm
On Fri, 9 Jan 2004 04:33:15 +0900, Pete y wrote:
On Thursday 08 January 2004 03:46 pm, Austin Ziegler wrote:
In article <3FFE2A2E.5040604@po.cwru.edu>, Dan Doel wrote:
Quoting Joe Mason <joe@notcharles.ca>:
jason r tibbetts wrote:
On Sat, Jan 10, 2004 at 12:29:24AM +0900, Jamis Buck wrote:
il Wed, 7 Jan 2004 19:06:32 +0900, Tim Bates <tim@bates.id.au> ha
On Wed, Jan 07, 2004 at 08:16:40PM +0900, gabriele renzi wrote:
Tim Bates wrote:
Tim Bates <tim@bates.id.au> wrote in message news:<20040108230256.GB12826@bates.id.au>...
On Fri, 9 Jan 2004 13:41:44 +0900
A bit of background before I respond to the question of using Critera for
[#89407] Re: rexml and external entities — "Volkmann, Mark" <Mark.Volkmann@...>
> -----Original Message-----
"Volkmann, Mark" <Mark.Volkmann@AGEDWARDS.com> wrote in
[#89418] ruby 1.8.1 crosscompiling for armv4l (iPAQ) — Kero <kero@...>
Hi all!
[#89434] convert a C/C++ array to a Ruby array — elathan@...
Hello!
Hi,
[#89446] testunit and infinite loop — Bil Kleb <Bil.Kleb@...>
My searching abilities are failing me today...
[#89453] ruby 1.8.1 windows installer — KONTRA Gergely <kgergely@...>
Hi!
On Thu, 2004-01-08 at 12:37, KONTRA Gergely wrote:
>
> Since the first edition of the Pickaxe book didn't exactly fly off the
On Wed, Jan 14, 2004 at 09:41:38PM +0900, Alan Davies wrote:
On Thu, 15 Jan 2004, Mauricio Fern疣dez wrote:
[#89460] Re: block delimiting — "Mike Wilson" <wmwilson01@...>
On Thursday 08 January 2004 03:24 pm, Mike Wilson wrote:
Pete Yadlowsky wrote:
Kent R. Spillner wrote:
In article <Law12-F38fDGCl9FopY000082ac@hotmail.com>, Mike Wilson wrote:
[#89494] ANN: First release of Perl's Getopt::Declare for ruby — GGarramuno@... (GGarramuno)
Okay, as a way of returning the favor for all my recent silly
GGarramuno wrote:
[#89519] Call method from a TK object — amnesiacx <louis@...>
Please can someone tell my why the code that follows works when the
[#89545] Should a newbie learn 1.6 or 1.8? — stevec890@... (Steve Cooper)
I'm just starting to learn Ruby, and I've purchased Ruby in a Nutshell
[#89565] Ruby 1.8.0 bugs on Dir — ggarramuno@... (GGarramuno)
Okay, two separate bugs. One probably on all platforms and one more serious
Hi,
>
[#89589] Anonymous CVS access — Bil Kleb <Bil.Kleb@...>
Hello.
[#89590] regex to NOT match? — Ruby Baby <ruby@...>
Sorry it seems like the smallest thing, but I'm stuck on this.
[#89605] How to reproduce the tk dialect? — shasckaw <shasckaw@...>
Hello,
[#89611] Converting a string to an array of tokens — "John W. Long" <ws@...>
Is there a fast way to convert a string into a list of tokens?
[#89630] RDoc/Ruby1.9 problems — Jim Menard <jimm@...>
I had previously installed RDoc. I checked out the latest Ruby via CVS,
[#89652] Game Programming with Python, Lua and Ruby — Carsten Eckelmann <careck@...42.com>
Just read this over at the Daily Python-URL!:
[#89664] efficient way to get the first found (or a random) key/value of a large hash — David Garamond <lists@...6.isreserved.com>
# a large hash
[#89672] faster integer arithmetics & arbitrary precision floating number — David Garamond <lists@...6.isreserved.com>
1. Is there a way in Ruby to speed up 32bit integer arithmetics (only
David Garamond wrote:
David Garamond wrote:
Emmanuel Touzery wrote:
On Monday 12 of January 2004 16:59, David Garamond wrote:
On Monday 12 of January 2004 20:36, Emmanuel Touzery wrote:
On Tue, 13 Jan 2004, David Garamond wrote:
What abouts Rubys design would make integer arithmetic slower than integer
On Tue, 13 Jan 2004, Dave Thomas wrote:
[#89699] Problem using https:// — Dave Thomas <dave@...>
For the first time I'm trying to connect to an https server. However,
[#89718] Getting the tail of a list? — Carsten Eckelmann <careck@...42.com>
Hi everybody,
Carsten Eckelmann wrote:
[#89737] Ruby binding for OpenDX? — Bil Kleb <Bil.Kleb@...>
I've googled and bladed, but to no avail...
In article <40036FDA.6080509@NASA.Gov>, Bil Kleb <Bil.Kleb@NASA.Gov> wrote:
[#89756] : how can I write a goto in ruby — "smayemba" <aidez.moi@...>
Hi all,
[#89796] Ruby OS mentioned on /. — intc_ctor@... (Phil Tomson)
http://developers.slashdot.org/developers/04/01/13/0123250.shtml?tid=185&tid=190
./ normally does not have vaporware... are a bunch of ruby (a very high
Somehow i have this strange feeling that not all ruby peeps are strictly
On Wed, 14 Jan 2004, Zach Dennis wrote:
[#89797] HP-UX+mkmf.rb -- compilation problems with 1.8.1 — Kero <kero@...>
Hi,
[#89816] configuring openssl and ruby — Joel VanderWerf <vjoel@...>
[#89831] What object-configuration approach to use? — Mike Williams <mwilliams@...>
Consider a class that supports a number of configurable properties.
> Consider a class that supports a number of configurable properties.
On Wed, Jan 14, 2004 at 02:07:43PM +0900, Gavin Sinclair wrote:
On Wednesday, January 14, 2004, 7:15:58 PM, Mauricio wrote:
[#89864] Updated documentation — "Imobach =?iso-8859-15?q?Gonz=E1lez_Sosa?=" <imobachgs@...>
Hi all,
[#89865] Array.delete — "E.-R. Bruecklmeier" <news01@...>
Hello
[#89869] Concatenating variable number of Arrays ? — Johan Holmberg <holmberg@...>
[#89872] collect! and Enumerable — Jim Freeze <jim@...>
Hi
[#89897] ruby-dev summary 22435-22573 — Minero Aoki <aamine@...>
Hi all,
[#89900] Stack level too deep (SystemStackError) — "Jesper Olsen" <Jesper@...>
I have a program where I'm getting a Stack level too deep (SystemStackError)
[#89902] Nested scopes and the Singleton pattern — Hal Fulton <hal9000@...>
Hello all,
Hi,
nobu.nokada@softhome.net wrote:
[#89951] NULL pointer given, Win32API — "Berger, Daniel" <djberge@...>
Hi all,
[#89966] Quick Input -- Sockets vs. HTTP — "dhtapp" <dhtapp@...>
Hi,
[#89975] drb, firewall, ssh tunneling, and yield — Joel VanderWerf <vjoel@...>
On Jan 15, 2004, at 19:10, Joel VanderWerf wrote:
Nathaniel Talbott wrote:
On Jan 15, 2004, at 19:49, Joel VanderWerf wrote:
On Friday, 16 January 2004 at 9:29:59 +0900, Nathaniel Talbott wrote:
On Jan 15, 2004, at 20:16, Jim Freeze wrote:
On Friday, 16 January 2004 at 11:21:40 +0900, Nathaniel Talbott wrote:
[#89990] HTML templating that works in more than one language? — Ruby Baby <ruby@...>
Has anyone seen an HTML templating system that would be
Hello Ruby,
On Fri, Jan 16, 2004 at 11:46:14PM +0900, Lothar Scholz wrote:
[#90013] Fighting Ruby's bad fame — gabriele renzi <surrender_it@...1.vip.ukl.yahoo.com>
Hi gurus and nubys,
Hello gabriele,
In article <af53b0ba.0401171921.7cf9b9b7@posting.google.com>,
>can you elaborate? Ruby has namespaces defined by modules.
[#90023] Installing a program Unix-like — Malte Milatz <malteDELETETHIS@...>
Users of Linux, FreeBSD etc. are used to downloading an archive,
On Sat, Jan 17, 2004 at 05:00:05AM +0900, Malte Milatz wrote:
I wrote:
On Tue, Jan 20, 2004 at 09:05:00PM +0900, Malte Milatz wrote:
[#90058] SOAP4R and WSDL — Ian Macdonald <ian@...>
Hello,
[#90071] In which order are files looked for when loaded/requierd - and what's the order of suffixes? — Stephan K舂per <Stephan.Kaemper@...>
Hi all,
[#90077] long expression syntax — rick.hu@... (Rick Hu)
why do I get a syntax error for
On Sun, Jan 18, 2004 at 08:10:01AM +0900, Rick Hu wrote:
messju mohr wrote:
On Sun, Jan 18, 2004 at 08:37:49AM +0900, Jamis Buck wrote:
[#90086] is Ruby the right language for these projects? — Ruby Baby <ruby@...>
Please forgive my self-centered question. I've been learning all about Ruby
[#90102] mod_ruby(.rbx) newbie — Ruby Tuesday <rubytuzdayz@...>
Hi, I was wondering why my .rbx script just print the out out of my ruby
> Hi, I was wondering why my .rbx script just print the out out of my
[#90103] C++ from Ruby ARRRGGHH!! — Asfand Yar Qazi <im_not_giving_it_here@..._hate_spam.com>
Yes, I know there's a wrapper available already that can wrap C++
[#90113] running external process? — Ferenc Engard <ferenc@...>
Hi all,
[#90126] setting instance variable "dynamically" — Bauduin Raphael <rb@...>
I saw in the pickaxe there's a way to call methods dynamically, with
[#90139] segfaults on mandrake... — Ferenc Engard <ferenc@...>
Hello,
nobu.nokada@softhome.net wrote:
[#90140] mysql-ruby troubles — Armin Preis <preisa@...>
Hi!
[#90157] Ruby1.8.1 on FreeBSD — Carsten Eckelmann <careck@...42.com>
Hi,
[#90161] List of defined classes/modules — "Mark J. Reed" <markjreed@...>
How can I programmatically determine what classes and modules
[#90183] Re: setting instance variable "dynamically" — "Weirich, James" <James.Weirich@...>
> > The following will work with arbitrary objects ...
[#90200] regex help — Chris Morris <chrismo@...>
I need a re such that:
On Tue, 20 Jan 2004 04:38:12 +0900, Chris Morris wrote:
Simon Strandgaard wrote:
[#90213] Help! cannot recursive call — "Greg Brondo" <greg@...>
Having a problem with following code. It will drop to the first directory
[#90214] detecting Win95/Win98/WinME — Joel VanderWerf <vjoel@...>
[#90227] Metadata — Ralph Mason <ralph.mason@...>
I am playing with dynamicaly creating proxy ruby objects, but need more
[#90228] Re: New to Python: my impression v. Perl/Ruby — ptkwt@... (Phil Tomson)
In article <mailman.493.1074484056.12720.python-list@python.org>,
>>>>> "Phil" == Phil Tomson <ptkwt@aracnet.com> writes:
Ville>Though "sending messages" to int literals is a syntax error.
"Zach Dennis" <zdennis@mktec.com> wrote in message news:<AKEKIKLMCFIHPEAHKAAICEOHHFAA.zdennis@mktec.com>...
Received: Wed, 21 Jan 2004 16:59:59 +0900
[#90233] eRuby on Mac OS X — kevin_mcconnell@... (Kevin M)
I'm trying to get eRuby and mod_ruby running on OS X (Panther).
[#90255] Re: recvfrom(2) error on OS X 10.3.2 — fukumoto@...
On Jan 20, 2004, at 09:06, fukumoto@nospam.imasy.or.jp wrote:
[#90291] question about blocks — Ferenc Engard <ferenc@...>
Hello,
[#90309] Proposal for programming language of the year — Christian Szegedy <szegedy@...>
Pragmatic Programmers wrote, that every year a new language should be
[#90317] Re: Proposal for programming language of the year — "Volkmann, Mark" <Mark.Volkmann@...>
I think one of the main points of learning a new language each year is that
In article <89539780CB9BD51182270002A5897DF605ED006B@hqempn04.agedwards.com>, Volkmann, Mark wrote:
[#90319] Parsing periods of time: Code and questions — "Josef 'Jupp' SCHUGT" <jupp@...>
Hi!
[#90353] no timeslicing? — Rasputin <rasputnik@...>
[#90354] Modules as namespace — gm@... (George Moschovitis)
Hello everyone,
George Moschovitis wrote:
[#90375] gsub oddity? — Ralph Mason <ralph.mason@...>
What am I missing here. I am trying to replace a single quote with the
[#90378] Boost Protein Expression by Codon Optimization — Sally Wang <service@...>
Dear Colleague,
[#90379] Trouble installing eRuby on MacOS X 10.3 — Gavin Kistner <gavin@...>
All day I have been trying to get mod_ruby and eRuby installed on MacOS
[#90405] Very basic Ruby docs/books/tutorial? — Robert Feldt <feldt@...>
Hello,
[#90420] BibTeX parser — Daniel Carrera <dcarrera@...>
Hi all,
[#90422] Parse Date bug? — Guillaume Marcais <guslist@...>
Parse Date returns illegal values in a date. Ex:
[#90437] how to broadcast UDP packets — Joel VanderWerf <vjoel@...>
On Thu, 2004-01-22 at 22:38, Joel VanderWerf wrote:
[#90472] Ruby/Extensions v0.3 released — Gavin Sinclair <gsinclair@...>
A new version of Ruby/Extensions, a suite of useful methods added to
On Friday 23 January 2004 02:06 pm, Gavin Sinclair wrote:
On Saturday, January 24, 2004, 5:07:40 AM, T. wrote:
[#90473] Usage of 'super' — Michael Weller <michael@...>
Hi!
[#90491] FXRuby: adding child widgets after #run has started — Yuri Leikind <y.leikind@...>
Hello all,
[#90495] Regular Expressions — Rove Monteux <rove.monteux@...>
Hi there,
On Sat, 24 Jan 2004, Rove Monteux wrote:
[#90505] Why is to_a going to be obsolete? — Patrick Bennett <patrick.bennett@...>
I find it immensely useful when dealing with arrays to be able to
Patrick Bennett wrote:
Hmmm, thanks, but it's a bit 'non-obvious' to casual Ruby programmers
On Friday 23 January 2004 06:43 pm, Gennady wrote:
Hi,
Ah, thanks! I see that it returns the object as-is if it's already an
[#90513] detecting default parameters — Ian Macdonald <ian@...>
Hello,
[#90559] RubyGems news? — ptkwt@... (Phil Tomson)
After RubyConf2002 some people decided that a package
[#90574] cgi.rb params initialize_query() — Dan Janowski <danj@3skel.com>
I assert that initialize_query is broken. CGI::parse should _always_ be
[#90589] Re: determine method passed and determine the receiver that received the method — "Robert Klemme" <bob.news@...>
[#90595] OT: Haskell software? — Jamis Buck <jgb3@...>
This isn't really Ruby-oriented, but with the many times I've heard
[#90598] perl bug File::Basename and Perl's nature — xah@... (Xah Lee)
Just bumped into another irresponsibility in perl.
[#90602] Keyword arguments in Ruby — grom_3@... (grom)
Is it possbile for Ruby to have keyword arguments added in like in
[#90612] Constant inheritance — David Heinemeier Hansson <david@...>
Is there anyway to let a subclass overwrite a constant in the
[#90613] Running a specific test in a suite from the command-line — David Heinemeier Hansson <david@...>
I remember being able to write "ruby my_test_suite.rb
[#90640] Regurgitating the contents of a file — Philip Mak <pmak@...>
What's the shortest way to regurgitate the contents of a file? I mean
Philip Mak wrote:
[#90655] Re: nuby: determine method passed and determine the receiver that rec eived the method — "Pe, Botp" <botp@...>
On Mon, Jan 26, 2004 at 12:02:11PM +0900, "Pe, Botp" wrote:
[#90667] ruby-math and "why is ** not abelian?" — vanjac12@... (Van Jacques)
I was reading the 1st thread in the ruby-math discussion at
[#90693] rdoc and hyperlinks — Joel VanderWerf <vjoel@...>
For some reason, my rdoc installation isn't generating hyperlinks for
I thought "hyperlinks, rdoc can do that now? cool!" and updated to the latest
Ack, forget this.
Sam Roberts wrote:
[#90699] def foo[](x) — Gavin Kistner <gavin@...>
#Works
> ....without having to create a new class for bar and define the []
David Heinemeier Hansson wrote:
[#90706] programming languages — KONTRA Gergely <kgergely@...>
Hi!
[#90750] choosing ruby? — Piergiuliano Bossi <p_bossi_AGAINST_SPAM@...>
We are on the way to start a new project, a web application with a bunch
On Tue, Jan 27, 2004 at 10:29:56PM +0900, Robert Klemme wrote:
Mauricio Fern疣dez wrote:
On Wed, Jan 28, 2004 at 01:21:37PM +0900, Joel VanderWerf wrote:
On Thu, 2004-01-29 at 11:34, Mauricio Fern叩ndez wrote:
[#90756] Editor — Safran von Twesla <me@...>
Hi,
The windows installer comes with SciTE. I'm happy with it.
On Wed, 28 Jan 2004 00:14:35 +0900, "Zach Dennis" <zdennis@mktec.com>
[#90763] fltk build and doc access problems — Jim Freeze <jim@...>
Hi
[#90768] checksum with ruby, how? — shasckaw <shasckaw@...>
Hello there, I need help.
[#90770] newbee question about "missing" hash methods +, += and << — benny <linux@...>
Hi,
>>>>> "b" == benny <linux@marcrenearns.de> writes:
[#90774] ./configure problem — William Sundberg <william@...4trade.com>
uname -a
[#90793] Re: nuby: can't get an image via http — Emmanuel Touzery <emmanuel.touzery@...>
Hello,
In article <200401271823.35269.emmanuel.touzery@wanadoo.fr>,
[#90803] MiniRubyWiki in action? — phlip_cpp@... (Phlip)
Rubies:
[#90845] float types — elathan@...
Hello!
[#90875] Ruby & gd — Safran von Twesla <me@...>
Hi,
[#90876] Why does DBI insist on using it's own date/time classes? — David Heinemeier Hansson <david@...>
I can't seem to figure out why DBI uses its own set of date/time
[#90879] hostname -> www.codeforpeople.com — "Ara.T.Howard" <Ara.T.Howard@...>
[#90913] vimrc for Ruby or rubytidy — Theodore Knab <tjk@...>
Does someone have a '.vimrc' file they will share
> Does someone have a '.vimrc' file they will share
Hi,
[#90934] Bignums and return — Andre Nathan <andre@...>
Hello
On Thu, 29 Jan 2004 22:41:42 +0900, Andre Nathan <andre@digirati.com.br>
On Fri, 2004-01-30 at 05:20, Jason Hutchens wrote:
>>>>> "A" == Andre Nathan <andre@digirati.com.br> writes:
On Fri, Jan 30, 2004 at 08:05:03PM +0900, ts wrote:
[#90948] why won't ruby chomp for me? — Emmanuel Touzery <emmanuel.touzery@...>
Hello,
[#90971] time comparison — tony summerfelt <snowzone5@...>
i want to parse and trim a log file. the date format log file looks like:
t3 = t2 - 24 * 2600 * x # - for Time work on the seconds
On Thu, 29 Jan 2004 at 18:51 GMT, Guillaume Marcais <guslist@free.fr> wrote:
[#90976] Why is def foo? legal but @foo? illegal? — Gavin Kistner <gavin@...>
Can someone tell me why you can define a method with a question mark in
[#90981] Checking the parameters "type" — "Imobach =?iso-8859-15?q?Gonz=E1lez_Sosa?=" <imodev@...>
Hi all,
[#90988] fallbacks using contiuations — Joel VanderWerf <vjoel@...>
"Jim Weirich" <jim@weirichhouse.org> wrote in message news:<33737.216.23.36.251.1075442652.squirrel@jimweirich.umlcoop.net>...
[#90992] rescue *[] — Joel VanderWerf <vjoel@...>
Hi,
[#91005] Ruby and Perl Integration — "John W. Long" <ws@...>
All this talk about RJNI has gotten me thinking. Has anyone attempted to
--- "John W. Long" <ws@johnwlong.com> wrote:
[#91041] Windows 1.8.1 installer ready — Andrew Hunt <andy@...>
rubyinstaller.sourceforge.net now has the latest installer, built for
[#91053] Changes to "Programming Ruby" book for 1.8.x — intc_ctor@... (Phil Tomson)
Since the text to Dave & Andy's "Programming Ruby" book is freely
[#91056] principle of most suprise — tony summerfelt <snowzone5@...>
gah, ruby is doing it to me again:
[#91071] Accesing to private attributes — "Imobach =?iso-8859-15?q?Gonz=E1lez_Sosa?=" <imodev@...>
Hi all,
[#91088] flip flop operator and assignment — ptkwt@... (Phil Tomson)
I'm working on the pattern matching section for
In article <200401311343.i0VDh2Z00793@moulon.inra.fr>,
Jamis Buck <jgb3@email.byu.edu> wrote in message news:<401F1E82.1080008@email.byu.edu>...
Phil Tomson wrote:
[#91089] No difference between .. and ... flip/flop operators? — ptkwt@... (Phil Tomson)
When constructing ranges of values (such as Fixnums), ... excludes the
Dan Doel wrote:
On Jan 31, 2004, at 09:38, Michael campbell wrote:
Nathaniel Talbott wrote:
On Jan 31, 2004, at 10:58, Michael campbell wrote:
In article <401B6792.10204@po.cwru.edu>, Dan Doel <djd15@po.cwru.edu> wrote:
In article <E15487A8-540F-11D8-83F8-000A95CD7A8E@talbott.ws>,
Phil Tomson wrote:
Hal Fulton wrote:
In article <401C50D5.601@yahoo.com>,
[#91099] Ruby 1.8.1 REXML performance — Steven Jenkins <steven.jenkins@...>
I have a script that uses REXML to stream parse an XML file and load a
Steven Jenkins <steven.jenkins@ieee.org> wrote in message news:<401C268F.80805@ieee.org>...
Daniel Berger wrote:
I've repeated all the tests with Ruby 1.8.0 and it sure looks like
Open source == Learn it yourself by trying and get it right if you can,
[#91101] credit card processing — Armin Roehrl <armin@...>
Hi,
[#91104] graphics lib? — Alwin Blok <alwinblok@...>
Hello,
On Sun, 01 Feb 2004 16:18:50 -0600, Charles Comstock wrote:
[#91109] cascading message sends — paulmg@... (Paul MG)
In Smalltalk, which Ruby is much like in some ways, you can 'cascade'
Re: Nested scopes and the Singleton pattern
Hi,
At Fri, 16 Jan 2004 07:46:39 +0900,
Christoph wrote:
> > > > Just using Thread.critical. And seems close to your idea
> > > > excepting for it uses "instance" method rather than "new".
> >
> > Not accurate, it uses 3-state; before, during and after
> > creation, but I feel it should use mutex or something.
>
> You probably always need a 3-state if you want a self
> modifying first instance call (at least in some implicit way).
>
> Here is a mutexy version of singleton.rb I wrote some time
> ago - it is probably more robust then the current code but equally
> obscure - sorry ...
Due to the line ending codes, your patch contains whole files.
Following is a bit modified version.
Index: lib/singleton.rb
===================================================================
RCS file: /cvs/ruby/src/ruby/lib/singleton.rb,v
retrieving revision 1.21
diff -u -2 -p -d -r1.21 singleton.rb
--- lib/singleton.rb 22 Aug 2003 08:09:58 -0000 1.21
+++ lib/singleton.rb 16 Jan 2004 01:26:06 -0000
@@ -12,5 +12,5 @@
# a,b = Klass.instance, Klass.instance
# a == b # => true
-# a.new # NoMethodError - new is private ...
+# Klass.new # NoMethodError - new is private ...
#
# * ``The instance'' is created at instanciation time, in other
@@ -31,7 +31,5 @@
#
# Providing (or modifying) the class methods
-# * Klass.inherited(sub_klass) and Klass.clone() -
-# to ensure that the Singleton pattern is properly
-# inherited and cloned.
+# * Klass.inherited(sub_klass) and Klass.initialize_copy()
#
# * Klass.instance() - returning ``the instance''. After a
@@ -45,20 +43,12 @@
# * Klass._load(str) - calling Klass.instance()
#
-# * Klass._instanciate?() - returning ``the instance'' or
-# nil. This hook method puts a second (or nth) thread calling
-# Klass.instance() on a waiting loop. The return value
-# signifies the successful completion or premature termination
-# of the first, or more generally, current "instanciation thread".
-#
#
# The instance method of Singleton are
-# * clone and dup - raising TypeErrors to prevent cloning or duping
+# * clone and dup - raising TypeErrors to prevent cloning
#
-# * _dump(depth) - returning the empty string. Marshalling strips
-# by default all state information, e.g. instance variables and
-# taint state, from ``the instance''. Providing custom _load(str)
-# and _dump(depth) hooks allows the (partially) resurrections of
-# a previous state of ``the instance''.
-
+# * _dump(depth) - returning the empty string, in other words
+# marshalling strips all state information. Providing custom
+# _load(str) and _dump(depth) hooks allows the (partially)
+# resurrections of a previous state of ``the instance''.
@@ -82,60 +72,61 @@ end
class << Singleton
# Method body of first instance call.
- FirstInstanceCall = proc do
- # @__instance__ takes on one of the following values
- # * nil - before and after a failed creation
- # * false - during creation
- # * sub_class instance - after a successful creation
- # the form makes up for the lack of returns in progs
- Thread.critical = true
- if @__instance__.nil?
- @__instance__ = false
- Thread.critical = false
- begin
+ FirstInstanceCall = proc do ||
+ critical, Thread.critical = Thread.critical, true
+ begin
+ if instanciating = @__instance__.nil?
+ @__instance__ = false
+ Thread.critical = critical
@__instance__ = new
- ensure
- if @__instance__
- class <<self
- remove_method :instance
- def instance; @__instance__ end
- end
- else
- @__instance__ = nil # failed instance creation
- end
+ elsif !@__instance__
+ @__instanciating_queue__ << Thread.current
+ Thread.stop
+ Thread.critical = true
+ retry
end
- elsif _instanciate?()
- Thread.critical = false
- else
- @__instance__ = false
- Thread.critical = false
- begin
- @__instance__ = new
- ensure
+ @__instance__
+ ensure
+ if instanciating
+ Thread.critical= true
if @__instance__
- class <<self
+ class << self
remove_method :instance
def instance; @__instance__ end
end
+ remove_instance_variable(@__instanciating_queue__).each do |thr|
+ thr.wakeup
+ end
else
@__instance__ = nil
+ if thr = @__instanciating_queue__.shift
+ thr.wakeup
+ end
end
end
+ Thread.critical = critical
end
- @__instance__
end
- module SingletonClassMethods
- # properly clone the Singleton pattern - did you know
- # that duping doesn't copy class methods?
- def clone
- Singleton.__init__(super)
+ module SingletonClassMethods
+ def self.extended(klass)
+ klass.instance_eval {
+ @__instance__ = nil
+ @__instanciating_queue__ = []
+ }
+ class << klass
+ define_method(:instance, FirstInstanceCall)
+ end
end
private
- # ensure that the Singleton pattern is properly inherited
+ def initialize_copy(orig)
+ super
+ SingletonClassMethods.extended(self)
+ end
+
def inherited(sub_klass)
super
- Singleton.__init__(sub_klass)
+ SingletonClassMethods.extended(sub_klass)
end
@@ -143,23 +134,6 @@ class << Singleton
instance
end
-
- # waiting-loop hook
- def _instanciate?()
- while false.equal?(@__instance__)
- Thread.critical = false
- sleep(0.08) # timeout
- Thread.critical = true
- end
- @__instance__
- end
end
- def __init__(klass)
- klass.instance_eval { @__instance__ = nil }
- class << klass
- define_method(:instance,FirstInstanceCall)
- end
- klass
- end
private
@@ -177,7 +151,7 @@ class << Singleton
def included(klass)
super
- klass.private_class_method :new, :allocate
+ klass.private_class_method :new,:allocate
klass.extend SingletonClassMethods
- Singleton.__init__(klass)
+ SingletonClassMethods.extended(klass)
end
end
@@ -186,9 +160,4 @@ end
if __FILE__ == $0
-
-def num_of_instances(klass)
- "#{ObjectSpace.each_object(klass){}} #{klass} instance(s)"
-end
-
# The basic and most important example.
@@ -196,5 +165,7 @@ class SomeSingletonClass
include Singleton
end
-puts "There are #{num_of_instances(SomeSingletonClass)}"
+
+num = ObjectSpace.each_object(SomeSingletonClass) {}
+puts "There are #{num} of SomeSingletonClass instances"
a = SomeSingletonClass.instance
@@ -209,90 +180,81 @@ end
+puts "\nThreaded example with exception"
+$stdout.sync= true
-puts "\nThreaded example with exception and customized #_instanciate?() hook"; p
-Thread.abort_on_exception = false
+class Foo < SomeSingletonClass
+ @attempts = 0
-class Ups < SomeSingletonClass
def initialize
- self.class.__sleep
- puts "initialize called by thread ##{Thread.current[:i]}"
- end
-end
-
-class << Ups
- def _instanciate?
- @enter.push Thread.current[:i]
- while false.equal?(@__instance__)
- Thread.critical = false
- sleep 0.08
- Thread.critical = true
+ @valid = false
+ sleep(rand(0.1))
+ if self.class.attempts < 3
+ raise "boom - initialize failed for thread ##{Thread.current[:i]}"
+ else
+ @valid = true
+ puts "yes! - initialize succceeded for thread ##{Thread.current[:i]}"
end
- @leave.push Thread.current[:i]
- @__instance__
+ ensure
+ self.class.attempts+= 1
end
- def __sleep
- sleep(rand(0.08))
- end
+ def valid?
+ @valid
+ end
+end
- def new
- begin
- __sleep
- raise "boom - thread ##{Thread.current[:i]} failed to create instance"
- ensure
- # simple flip-flop
- class << self
- remove_method :new
- end
- end
- end
+class << Foo
+ attr_accessor :attempts
def instanciate_all
- @enter = []
- @leave = []
- 1.upto(9) {|i|
- Thread.new {
+ Thread.current.priority = 101
+ thrs= Array.new(101) {|i|
+ curr= Thread.new {
begin
+ sleep(rand(0.1))
Thread.current[:i] = i
- __sleep
instance
- rescue RuntimeError => mes
+ rescue => mes
puts mes
end
}
+ curr.priority = rand(101)
+ curr
}
- puts "Before there were #{num_of_instances(self)}"
+ puts "Before there existed #{num} valid #{self} instance(s)"
sleep 3
- puts "Now there is #{num_of_instances(self)}"
- puts "#{@enter.join '; '} was the order of threads entering the waiting loop"
- puts "#{@leave.join '; '} was the order of threads leaving the waiting loop"
+ thrs.each {|t| t.join }
+ puts "Now there exist(s) #{num} valid #{self} instance(s)"
end
-end
+
+ def num
+ cnt = 0
+ ObjectSpace.each_object(self) {|o| cnt+=1 if o.valid? }
+ cnt
+ end
+
+ private
+
+ def initialize_copy(orig)
+ super
+ @attempts = 0
+ end
+end
-Ups.instanciate_all
-# results in message like
-# Before there were 0 Ups instance(s)
-# boom - thread #6 failed to create instance
-# initialize called by thread #3
-# Now there is 1 Ups instance(s)
-# 3; 2; 1; 8; 4; 7; 5 was the order of threads entering the waiting loop
-# 3; 2; 1; 7; 4; 8; 5 was the order of threads leaving the waiting loop
+Foo.instanciate_all
+# results in something like:
+# Before there were 0 valid Foo instance(s)
+# boom - initialize failed for thread #78
+# boom - initialize failed for thread #93
+# boom - initialize failed for thread #8
+# yes - initialize succceeded for thread #27
+# Now there are 1 valid Foo instance(s)
+# Now there are 1 valid Foo instance(s)
puts "\nLets see if class level cloning really works"
-Yup = Ups.clone
-def Yup.new
- begin
- __sleep
- raise "boom - thread ##{Thread.current[:i]} failed to create instance"
- ensure
- # simple flip-flop
- class << self
- remove_method :new
- end
- end
-end
-Yup.instanciate_all
+Baz = Foo.clone
+Baz.instanciate_all
--
Nobu Nakada