[#321488] new here on ruby-talk — Richard <rich.japh@...>
hi, I am very interested in learning Ruby and wanted to say hi to the
[#321489] Form Controls for User interface in a Database Application — Warren Dulnuan <rr3800@...>
Is there an IDE for Ruby where i can drag n drop Grid Controls, COmbo
[#321506] really beginner question — rocksonchan <rocksonchan@...>
hi all, as shows on the subject, it is a really really beginner
Hi!
[#321519] Control Structures — Trent Jones <1337indi@...>
G'day all, I'm new to Ruby, been studying Software Engineering at
> G'day all, I'm new to Ruby, been studying Software Engineering at
Hi Jakub,
> Hi Jakub,
Like many languages, there are lots of ways to do things. Using a block
[#321530] How do you find an item that satisfies multiple conditions? — Bob Sanders <small.business.strategy@...>
I know that to find an item that satisfies one condition, it's this:
[#321538] Explanation on some code — Michael Albers <registraties@...>
Hi,
[#321546] Another Ruby Book (and interview) — "pat eyler" <pat.eyler@...>
Most ruby-talk readers probably know that a Ruby edition
On Mon, Dec 01, 2008 at 11:33:22PM +0900, pat eyler wrote:
On Thu, Dec 4, 2008 at 10:13 AM, Chad Perrin <perrin@apotheon.com> wrote:
[#321557] Multi-Index Containers — "Avdi Grimm" <avdi@...>
Does anyone know of a multi-index container library for Ruby? I just
[#321562] crate 0.1.1 Released — Jeremy Hinegardner <jeremy@...>
I'm pleased to announce that Crate, the project I spoke on at RubyConf
[#321574] Regular Expressions — Mmcolli00 Mom <mmc_collins@...>
Hi everyone.
On Mon, Dec 1, 2008 at 1:08 PM, Mmcolli00 Mom <mmc_collins@yahoo.com> wrote:
On Mon, Dec 1, 2008 at 1:51 PM, Kyle Schmitt <kyleaschmitt@gmail.com> wrote:
[#321601] Adventures in Optimization... or why CONST frozen is Good — John Carter <john.carter@...>
...or when a language design level optimization is a pessimization.
[#321607] while loop in a here documents — equinox <aditya15417@...>
I have a here documents of something like this:
[#321610] Different between symbol and string ? — Chris Li <libo5426@...>
What is exactly different between symbol and string ? Symbol has never
[#321630] Array deletion — jazzez ravi <jazzezravi@...>
Hi All,
jazzez ravi wrote:
[#321638] How to install sqlite3 in linux? — Zhao Yi <youhaodeyi@...>
I used this command to install sqlite3:
[#321641] Memory usage with blocks — "John Ky" <newhoggy@...>
Hi all,
[#321652] Ruby Database Application — Warren Dulnuan <rr3800@...>
Can someone upload a database application on Ruby? preferably an
[#321655] Ruby cgi script — ZippySwish <fischer.jan@...>
I put "script.rb" into the cgi-bin folder of my webhost, but nothing's
Well, telnet can't get a connection for some reason, but what I mean
[#321670] opening/reading a text file - how do u use .find method? — Mmcolli00 Mom <mmc_collins@...>
Here I am creating a text file, writing to the text file and then
[#321679] dynamic programming — Frank Tao <dalfrank@...>
# I have a class Adam
[#321681] Substring with "..." — Jose Antonio Parra <josparbar@...>
Hi!
On Tue, Dec 2, 2008 at 12:00 PM, Jose Antonio Parra <josparbar@gmail.com> wrote:
[#321693] Why is Ruby 1.9 not called Ruby 2.0? — The Higgs bozo <higgs.bozo@...>
[#321711] How do you read text file by creating a Hash in a script? — Mmcolli00 Mom <mmc_collins@...>
This is some example contents of my text file: logzT09.txt
Mmcolli00 Mom wrote:
yes I meant to read it into an Hash. Can you give me a snippet? I just
[#321731] RubyForge not being updated? — "Avdi Grimm" <avdi@...>
Anyone know what's up with RubyForge? I submitted a new project three
[#321733] FFI 0.2.0 — "Wayne Meissner" <wmeissner@...>
Greetings Rubyists.
* Wayne Meissner <wmeissner@gmail.com> [2008-12-03 10:09:03 +0900]:
[#321743] Stack level too deep — "John Ky" <newhoggy@...>
Hi,
[#321750] rubyscript2exe problem — Jim Mahony <mewshew@...>
Hi all,
The Higgs bozo wrote:
* Jim Mahony <mewshew@hotmail.com> [2008-12-03 17:35:40 +0900]:
[#321761] Question about op. overloading — Maarten Mortier <maarten.mortier@...>
I have:
[#321780] ipaddr and invalid ipv4 addresses — "Martin DeMello" <martindemello@...>
What's going on here?
[#321794] string with \ — Vrone Ve <vrone@...>
[#321814] HookR version 1.0.0 released — "Avdi Grimm" <avdi@...>
HookR version 1.0.0
[#321818] Ruby and legacy Java Applications — Joe Wfel <joe@...>
What are some good ways to integrate Ruby into legacy Java
[#321827] 1.8.7 segfault — Izit Izit <portie@...>
Hi,
[#321836] Ruby Serial Port for windows — Riad Riad <riad.gaffar@...>
Hi,
[#321857] rescuing a failed %x[] call? — "Kyle Schmitt" <kyleaschmitt@...>
I know it should be streightforward, but I'm not finding the docs anywhere...
On Wed, Dec 3, 2008 at 6:02 PM, Kyle Schmitt <kyleaschmitt@gmail.com> wrote:
On Wed, Dec 3, 2008 at 9:28 PM, Avdi Grimm <avdi@avdi.org> wrote:
[#321865] reg exp — Hai anh Le <lhanh@...>
I have a problem with regexp. I have some document like :
[#321881] 'and' keyword? — "list. rb" <list.rb@...>
Because puts("hi") yields nil, the second item never gets called:
[#321887] A question about ruby-doc — Zhao Yi <youhaodeyi@...>
I installed ruby-doc-stdlib-0.10.1 in my computer and open the index
I often find myself not connected to the Internet and want to read
[#321893] Nigh Stikipad — Trans <transfire@...>
Does anyone know anything about what happened to Stikipad? This was a
[#321904] JRuby 1.1.6RC1 Released — Thomas Enebo <Thomas.Enebo@...>
The JRuby community is pleased to announce the release of JRuby 1.1.6RC1!
[#321920] Force a program to stop if runtime exceeds given duration — Aldric Giacomoni <"aldric[remove]"@...>
Any idea how to do that?
require 'timeout'
On Thu, Dec 4, 2008 at 10:04 AM, Aldric Giacomoni <"aldric[remove]"@
On Thu, Dec 4, 2008 at 10:32 AM, Glen Holcomb <damnbigman@gmail.com> wrote:
Glen Holcomb wrote:
See http://www.ruby-doc.org/core-1.9/classes/Process.html#M003012
Everybody automatically assumes that rubyists are using Linux - sadly,
On Fri, Dec 5, 2008 at 6:59 AM, Aldric Giacomoni <"aldric[remove]"@
On Fri, Dec 5, 2008 at 7:08 AM, Glen Holcomb <damnbigman@gmail.com> wrote:
[#321967] Are the docs correct for spaceship <=> in String? — thomas.c.mitchell@...
Hello all,
[#321969] Are there any Ruby Technical Writers here? — Vito Fontaine <vito.matro@...>
I am a beginner with Ruby who was interested in writing some programs.
On 04.12.2008 22:43, Vito Fontaine wrote:
Robert Klemme wrote:
Vito Fontaine wrote:
On Fri, 5 Dec 2008, Vito Fontaine wrote:
David A. Black wrote:
Plus, I have just started a not-for-profit organization. It's goals are
P.S. - I plan on implementing J-Ruby into the program as well but
[#321995] Data extraction using Scrubyt — Vipin Vm <vipin@...>
Hi All,
[#322000] database design — Adam Akhtar <adamtemporary@...>
im new to databases and im currently using a flatfile db called
[#322014] Proximity searches in Ruby — Stuart Clarke <stuart.clarke1986@...>
Does Ruby have the ability to perform proximity searches on data. For
No proximity searches with 1.8.. you would need a full fledged text
On 06.12.2008 00:29, Ilan Berci wrote:
On Sat, Dec 6, 2008 at 1:18 PM, Robert Klemme
> File::read("test.data").scan %r{Hello.{0,10}World}im
On Sat, Dec 6, 2008 at 2:06 PM, Michael Fellinger <m.fellinger@gmail.com> wrote:
[#322036] Ruby 1.8.7 Lambas: syntax and scoping issue (are these bugs? — Charlton Wang <charlton.wang@...>
I'm seeing two odd behaviours with using lambdas:
[#322043] AnsiString (#185) — Matthew Moss <matt@...>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
[#322054] Ruby vs SELF — Marc Heiler <shevegen@...>
What are the main differences between Ruby and SELF in day-to-day work
On Fri, Dec 5, 2008 at 11:57 PM, Marc Heiler <shevegen@linuxmail.org> wrote=
On Sat, Dec 6, 2008 at 9:21 PM, Robert Dober <robert.dober@gmail.com> wrote:
[#322073] shoes 2 (raisins) is go. — _why <why@...>
Salutations and hi.
On Sat, Dec 6, 2008 at 2:05 PM, _why <why@ruby-lang.org> wrote:
[#322090] Gruff labels — Rick Jones <ukbell@...>
I have been working on this code for a few days and can't seem to figure
[#322095] Remove me from the mailing list — "Chas O'Riley" <ceoriley@...>
CEO'Riley
[#322100] Proposing an arbitrary precision class building on BigDecimal and being derived from Numeric — ulrichmutze@...
Dear Ruby commuity,
> this note deals with arbitrary precision arithmetics and Ruby
[#322117] Very Basic Question — Gilman Gunn <gilmangunn@...>
Hi all,
[#322124] class vrs. method — Tom Cloyd <tomcloyd@...>
I've been thinking about this question for days, and have yet to come up
[#322139] newbie's question: getting parameters given to hello.rb file — "L. Maiwald" <neorus@...>
hello,
[#322144] creating a DSL: adding random methods — dc <dc.pikkle@...>
hi -
[#322181] A quetion about ruby string — Zhao Yi <youhaodeyi@...>
How can I change a string to regular expression? Take this method for an
[#322187] UTF char issue — Abirami Selvam <abirami.janu@...>
While reading the data from the text file,the special characters has not
[#322205] string to hash — Jens -- <jens@...>
Hi All,
[#322212] libxml-ruby is too crazy — "Sebastian W." <swittenk@...>
Okay, if any libxml-ruby developers read this list, I sincerely hope you
[#322217] Beginner question about attributes — Scott Peterson <swp@...>
I don't understand why my model (attached) isn't working.
On Dec 8, 3:31=A0pm, Scott Peterson <s...@mho.com> wrote:
Yossef Mendelssohn wrote:
Scott Peterson wrote:
[#322219] Kernel.exec won't find a file that File.expand_path can — Fritz Anderson <fritza@...>
I'm doing a fork/exec on a .rb file in the same directory as the parent
On Mon, Dec 8, 2008 at 11:23 PM, Fritz Anderson <fritza@uchicago.edu> wrote=
[#322235] Ruby QT Hiding the mouse — Michael Pope <map7@...>
I'm currently trying to build an application using Ruby with QT which
[#322242] pop3 body email — Erika <geagneske83@...>
Hi,
[#322245] getting by without a server — Adam Akhtar <adamtemporary@...>
ive made a simple budgeting script that takes receipts (with the
[#322246] undefined method `parse' for Time:Class Error — Srikanth Jeeva <sri.jjhero@...>
hi,,.
Srikanth Jeeva <sri.jjhero@gmail.com> writes:
Just to add my tuppence.... the same applies to Date.parse (amongst
[#322256] problem with array ... object inside disappear — MR Damien <mr.damien@...>
Hi dudes,
[#322260] Help on algorythm — Helder Oliveira <hrpoliveira@...>
Guys i have been trying to make this algorythm but with no sucess, can
On Tue, Dec 9, 2008 at 7:44 AM, Helder Oliveira <hrpoliveira@gmail.com>wrote:
On Tue, Dec 9, 2008 at 9:56 AM, Glen Holcomb <damnbigman@gmail.com> wrote:
Gregory Brown wrote:
On Tue, Dec 9, 2008 at 4:24 PM, Chris Lowis <chris.lowis@gmail.com> wrote:
[#322272] Ruby Test Frameworks — Michael Furmaniuk <mfurmaniuk@...>
I'm looking for a Ruby Framework that I can use to aid in testing a
[#322283] Completely new programmer lacks direction — Cameron Carroll <ubernoobs@...>
Hi. I recently picked up a beginning ruby book, having only lightly
Cameron Carroll wrote:
[#322285] compare 2 text files - check for difference - Please help — Mmcolli00 Mom <mmc_collins@...>
Hi. I want to take two files that are supposed to be identical, then ook
Mmcolli00 Mom wrote:
require 'diff/lcs/Array'
Are you wanting to get the actual differences, or just know if they are
Mmcolli00 Mom wrote:
> I want to be able to say that 2.txt contained '3' therefore the file was
I just used this on my txt files however, I can't get the script to
Mmcolli00 Mom wrote:
[#322288] Way to many calls to Dir#[] — Tj Holowaychuk <tj@...>
I cannot seem to debug this issue... my entire library does not call
Tj Holowaychuk wrote:
Thanks! that is helping, its all from rubygems
[#322302] Problem parseing a XML - PullParser — "Sebastian (syepes)" <sebastian@...>
Hi all,
On 9 d=E9c. 08, at 21:17, Sebastian (syepes) wrote:
Luc Heinrich wrote:
Hi,
Bob Hutchison wrote:
[#322329] want to search value in nested arrays and return other value — Joao Silva <rubyforum@...>
Hi.
[#322345] chars method — George George <george.githinji@...>
Any ideas why this code returns :
George George wrote:
[#322360] Standardizing FFI based wrappers — Luc Heinrich <luc@...>
Greetings,
Luc Heinrich wrote:
[#322371] want only the working hours(9am-5pm) between two dates — Srikanth Jeeva <sri.jjhero@...>
want only the working hours(9am-5pm) between two dates, weekends should
[#322379] Displaying long floats without scientific notation — sa 125 <s_ayalon@...>
Hello -
[#322395] A bug in c:\InstantRails\ruby\lib\ruby\1.8\net\http.rb? — Zhoran Tvalve <ztuaev@...>
I can not make working a line of code:
[#322400] P shows object values, so can u put P and value in txt? — Mmcolli00 Mom <mmc_collins@...>
This is something that I have been working on using diff/lcs. I am
On 10.12.2008 18:05, Mmcolli00 Mom wrote:
I tried putting this but it did not work.
By 'ri p', it was meant that you do that on the command-line.
[#322417] why Hash corrupts 'key' object ? — Dmitry Perfilyev <dmitry1976@...>
Hi, I have next script:
[#322418] Folder actions — Einar Magn俍 Boson <einarmagnus@...>
Hi all,
[#322424] copy txt file - only copies 1/3 of the file - what happened? — Mmcolli00 Mom <mmc_collins@...>
File.open('oldFile.txt', 'r') do |f1| #file contains XML type data
[#322431] to get help from inside irb console — Sijo Kg <sijo@...>
Hi
[#322455] Out of range on Dates beyond 2038/01/19 — Fernando Guillen <fguillen.mail@...>
Hi people,
On Thu, Dec 11, 2008 at 6:58 AM, Fernando Guillen
Err, I should have mentioned, many UNIX and UNIX like systems have
Thank you people for the information.
RnJvbTogRmVybmFuZG8gR3VpbGxlbiBbbWFpbHRvOmZndWlsbGVuLm1haWxAZ21haWwuY29tXSAN
[#322457] All possible letter combinations? — Teme Rosi <the_beaf@...>
Hi, im new to ruby. It is smiliar to perl. Can anyone convert this
[#322464] Q: FFI and C++? — Jeremy Henty <onepoint@...>
If I want to wrap a C++ library using FFI, can it cope with the name
Because of the complexity that C++ adds, I doubt that any feasible FFI
[#322479] User Prompt as a pop up - not IRB/command line? — Mmcolli00 Mom <mmc_collins@...>
Has anyone heard of Ruby containing a popup window prompt for users? I
On Thu, Dec 11, 2008 at 10:33 PM, Mmcolli00 Mom <mmc_collins@yahoo.com> wrote:
[#322502] Rhodes - a microframework for building native mobile device applications — Adam <adam@...>
The Rhodes framework is an open source Ruby-based platform for
[#322504] How to open url in firefox — Raju Alluri <avr_1@...>
Hi,
[#322516] Invoking Ruby code from a low-level language? — Alex Fulton <a.fulton@...>
Hi, my sincerest apologies if this question has already been answered
On Fri, Dec 12, 2008 at 07:59:39AM +0900, Alex Fulton wrote:
Wow, thanks for the replies everyone. This has given me a lot of
On Wed, Dec 17, 2008 at 05:22:10AM +0900, Alex Fulton wrote:
[#322529] parallel method return value — Louis-Philippe <default@...>
Hi all,
> and with a method:
Louis-Philippe wrote:
Hi guys,
Thanks Matthew,
[#322535] How to Count pages in a word document — Talib Hussain <talibhn@...>
Hi,
[#322543] How to get contents of word file page by page — Talib Hussain <talibhn@...>
Hi,
2008/12/12 Talib Hussain <talibhn@gmail.com>:
Heesob Park wrote:
You must be trying to solve a problem (word document convertation to
[#322549] how do I extract the ID name of a Div and its content? — Hans Wurst <mahatma.gates@...>
Hi folks,
[#322566] How to run background processes (more than 1 worker) parallely. — "Deepak Gole" <deepak.gole8@...>
Hi
[#322571] Multiple Ruby versions for testing — "James Coglan" <jcoglan@...>
Hi list,
[#322578] FFI Gem on Win32 — Simon Smith <simonjsmithuk@...>
Hi,
2008/12/13 Simon Smith <simonjsmithuk@yahoo.co.uk>:
[#322580] Function def at end of scripts — No Where <nowhere@...>
Hi,
[#322620] need quick check on my rubygems install procedure — Tom Cloyd <tomcloyd@...>
I'm running Kubuntu Linux 8.10 - a fresh install. I'm setting up Ruby now.
Tom Cloyd wrote:
[#322622] Creating directory structures — Ch Ba <navouri@...>
I'm having a bit of a difficult time coming up with a solid way handle
[#322624] singleton methods vs. meta instance methods — Daniel DeLorme <dan-ml@...42.com>
If I understand the ruby object model correctly, then an object's
On Sat, Dec 13, 2008 at 6:25 AM, Daniel DeLorme <dan-ml@dan42.com> wrote:
Robert Dober wrote:
On Sat, Dec 13, 2008 at 10:50 PM, Brian Candler <b.candler@pobox.com> wrote=
Robert Dober wrote:
On Sun, Dec 14, 2008 at 12:16 PM, Brian Candler <b.candler@pobox.com> wrote=
Robert Dober wrote:
[#322643] Beggining the compiler journey — Rafael Rosa <rafaelrosafu@...>
Hi,
[#322666] marshal_load, marshal_dump — Tim Hunter <TimHunter@...>
Currently RMagick uses the old _dump and _load methods to
On Dec 13, 2008, at 14:36 PM, Tim Hunter wrote:
[#322675] Command line utilities in rubygems? — Ch Ba <navouri@...>
I have a small project that I'm working on and I would like the
[#322681] email structure — Adam Akhtar <adamtemporary@...>
I have accessed my gmail account and using imap downloaded an email and
[#322702] Speed up require on win32 — Alex 2k8 <abc3def@...>
Hello,
Hello, Robert
[#322705] ruby 1.9.1: Encoding trouble: broken US-ASCII String — Tom Link <micathom@...>
Hi,
> text = File.read("text.txt", :encoding=>"ISO-8859-1")
Tom Link wrote:
Brian Candler wrote:
Ah, there is a preview here:
On Dec 15, 2008, at 7:55 AM, Brian Candler wrote:
In article <AC6610E0-BA7A-498A-96E3-853617CAE2CF@grayproductions.net>,
[#322709] rubygems install confusion - beginner problems — Tom Cloyd <tomcloyd@...>
Yesterday I compiled ruby 1.8.7, and have verified that it's now
[#322710] Help with an "easy" regular expression substitution — Iñaki Baz Castillo <ibc@...>
Hi, I'm getting crazy to get a theorically easy substitution:
Hi --
El Domingo, 14 de Diciembre de 2008, David A. Black escribi=C3=B3:
[#322725] __PRETTY__FUNCTION__ for Ruby? — John Carter <john.carter@...>
We have __FILE__ and __LINE__....
[#322726] Quality of Ruby — Kless <jonas.esp@...>
I was reading this interesting post [1] about Ruby, and well..., you
[#322756] How to create a music player using ruby — Tejaswini Pedapati <tejaswinipvk@...>
I want to create a music player like itunes or media player using ruby.
[#322757] Accentuated function names — Jean-baptiste Hétier <djib.nospam@...>
Hello,
[#322802] Re: [QUIZ] Mix and Match (#186) — peter@...
Is it possible to post a solution already? (I guess the question is
On Mon, Dec 15, 2008 at 3:31 PM, Matthew Moss <matt@moss.name> wrote:
[#322815] Walk through directory structure, look at first file, rename dir in consequence. — Aldric Giacomoni <"aldric[remove]"@...>
This is pretty ugly and doesn't work.. Can't figure out why, but it
Einar Magn俍 Boson wrote:
[#322819] Pure Ruby Zlib::GzipWriter — Daniel Berger <djberg96@...>
Hi,
> I've put in a feature request [2] but I'd like to see it expedited. In
Daniel Berger wrote:
Daniel Berger wrote:
Charles L. wrote:
Hi,
Heesob Park wrote:
On Jan 9, 9:26=A0pm, "Charles L." <aquas...@gmail.com> wrote:
On Jan 12, 12:38=A0pm, Daniel Berger <djber...@gmail.com> wrote:
[#322861] Google translate ruby client 1.0 — "Dingding Ye" <yedingding@...>
Hi.
[#322863] Is there any IDE for WATIR development? — Narendra Gollapilli <narendra.gollapilli@...>
Hi,
[#322873] Unique values in hash? — "Vapor .." <vaqas.ashraf@...>
Hi,
[#322886] Validation — Cyrus Dev <cyrus_dev@...>
Hi ,
[#322910] Ruby 1.8.6 - normal behavior ? — Aldric Giacomoni <"aldric[remove]"@...>
I don't know enough to really test this but I came across a funny
> #Apparently, the simple fact of checking this keeps Ruby from raising
[#322913] How to cycle through an instance — Tom Ha <tom999@...>
Hi there,
[#322930] about Float — Kyung won Cheon <kdream95@...>
a = 1333.3339999999964
On Tue, Dec 16, 2008 at 8:32 PM, Kyung won Cheon <kdream95@gmerce.co.kr> wrote:
[#322941] ruby way of dumping file — "Joshua Ball" <chezball@...>
Hi,
[#322942] function discovery — "Joshua Ball" <chezball@...>
I am curious if there is a programatic way to list all methods of a class.
[#322954] About qt4-ruby — Magicloud <magicloud.magiclouds@...>
Hi,
[#322979] Ruby based Discussion forum — rubydevl <email2sanjay@...>
Hello All-
[#322986] Hopefully simple regex — "stephen O'D" <stephen.odonnell@...>
Hi,
[#322987] Using ruby hash on array — Stuart Clarke <stuart.clarke1986@...>
I would like to process some data from an array and using hash to
2008/12/17 Stuart Clarke <stuart.clarke1986@gmail.com>:
2008/12/18 Stuart Clarke <stuart.clarke1986@gmail.com>:
[#322997] Net::SSH - kick off background job — "Sebastian W." <swittenk@...>
Does anyone know of a way to tell Net::SSH to start running a script but
Sebastian W. wrote:
On Thu, Dec 18, 2008 at 2:27 AM, Brian Candler <b.candler@pobox.com> wrote:
[#323016] Array problem — John Zoldiark <tavarezjonathan@...>
I have an array like this:
[#323034] Define objects from classes in different files — Jason Lillywhite <jason.lillywhite@...>
Could someone help me with this little problem?
[#323075] Get Status Code of URL — Desingurajan Aswanthaaman <desingurajan@...>
url = URI.parse("http://www.google.com/")
[#323079] Regular exressions and arguments — Rick Jones <ukbell@...>
This should be (and probably will be) a simple answer, but if I have the
[#323085] Ruby and Rails supported on 10gen — "Jim Menard" <jim.menard@...>
http://www.10gen.com/blog/2008/12/ruby-support-on-10gen
Jim Menard wrote:
On Thu, Dec 18, 2008 at 8:32 PM, Charles Oliver Nutter
Jim Menard wrote:
[#323086] Show newest file in directory? — Mmcolli00 Mom <mmc_collins@...>
If you have a directory full of files, how can you get the newest file
On Dec 18, 12:36=A0pm, Mmcolli00 Mom <mmc_coll...@yahoo.com> wrote:
[#323091] .profile in UNIX — Bob Smyph <eric.ramsey@...>
Does anyone know how to access and use the .profile in UNIX while using
Bob Smyph wrote:
[#323106] RbFind 1.1 — Bertram Scharpf <lists@...>
Hi,
[#323108] RAWR can't find jruby_fetch — "Leslie Viljoen" <leslieviljoen@...>
Hi people!
[#323121] block comment problem — Mrmaster Mrmaster <mrsolarlife@...>
Hello,
[#323125] How to check endianess using ruby? — Xie Hanjian <jan.h.xie@...>
Hi,
[#323129] could this one line Date extension to return the end of financial year date be any more compact? — "Greg Hauptmann" <greg.hauptmann.ruby@...>
could this be any more compact or ruby like that it is?
[#323134] How to implement drag and drop — Arati Sawant <arati.sawant@...>
Hi,
[#323150] Runtime error after moving to 1.8.7 — "Gerardo Santana Gez Garrido" <gerardo.santana@...>
Ruby/Informix works fine on Ruby 1.8.6, but after installing Ruby
[#323166] Dreaming of a Ruby Christmas (#187) — Matthew Moss <matt@...>
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
On Fri, Dec 19, 2008 at 3:08 PM, Matthew Moss <matt@moss.name> wrote:
[#323169] Last chance for JRubyOne...er...JavaOne proposals — Charles Oliver Nutter <charles.nutter@...>
Today is the last day for JavaOne proposals, and we're really hoping to
[#323181] FTP — Philip Pratt <pratstercs@...>
Hi,
[#323182] YAML troubles — Tim Mcd <tmcdowell@...>
I am working on a ruby MUD server, and I wanted to save a list of
[#323193] ruby midi problem — rick_2047 <rick.chatterbox@...>
Ok i was going through the book "Ruby practical Projects" and right at
[#323204] get first and last line from txt file - how? — Mmcolli00 Mom <mmc_collins@...>
I have txt file with date/time stamps only. I want to grab the first
Mmcolli00 Mom wrote:
I'm just wondering..
2008/12/20 Yaser Sulaiman <yaserbuntu@gmail.com>:
On 20.12.2008 17:46, Thomas Preymesser wrote:
2008/12/21 Robert Klemme <shortcutter@googlemail.com>:
From: Thomas Preymesser [mailto:thopre@gmail.com]=20
[#323213] add text at beginning of a string — Fernando Perez <pedrolito@...>
Hi,
On Sat, Dec 20, 2008 at 6:13 PM, Fernando Perez <pedrolito@lavache.com> wrote:
[#323222] Trying to make modifications to a gem... — Aldric Giacomoni <"aldric[removeme]"@...>
I'm toying around with a gem. How can I easily make changes and test
[#323245] Why Ruby stops working under cygwin — Li Chen <chen_li3@...>
Hi all,
[#323267] login form — Johny ben <joh13ny@...>
I just want to create a login form on my RoR project.anyone have a good
[#323273] how to make installing Ruby easier for amateurs — Tom Cloyd <tomcloyd@...>
Greetings!
Tom Cloyd wrote:
Marc Heiler wrote:
[#323312] Name that data structure! — Simon Chiang <simon.a.chiang@...>
I'm using a data structure that I'm sure has been implemented and
On Mon, Dec 22, 2008 at 5:38 PM, Simon Chiang <simon.a.chiang@gmail.com> wrote:
Gregory Brown wrote:
Sounds like a marked graph to me, and not directed at all, or did I
Robert Dober wrote:
Tom Cloyd wrote:
Addendum:
[#323326] Error after install — Callen Mascarenhas <callenmas@...>
I installed Ruby on my RHEL 3 system. I did the following:
> Now when I try to run irb in
unknown wrote:
Callen Mascarenhas wrote:
Brian Candler wrote:
[#323333] Problem running simple rail application — Vikas Gholap <vikasg@...>
Hello to all , please Give me solution..............
[#323342] Are all Ruby built-in objects thread safe? — "Just Another Victim of the Ambient Morality" <ihatespam@...>
Are all built-in objects thread safe? For example, if I have an array
Hi,
Yukihiro Matsumoto wrote:
I would very much welcome a set of guaranteed-thread-safe wrapper
[#323351] Loading up a hash with variables if they are defined — "Patrick Doyle" <wpdster@...>
Is there a cleaner, more Rubyesque way to do this?
[#323365] Integer.step is inclusive?! — "Just Another Victim of the Ambient Morality" <ihatespam@...>
I don't know how to post the output of irb so I'll just have to describe
[#323397] Go LABEL — Xx Xx <limhuisian@...>
Can we do a " go label " in ruby just like in asm? i cant find any
goto
Cant download from the link http://raa.ruby-lang.org/project/ruby-goto/
[#323403] Calling Ruby from Delphi — Rob Ram <numeric@...>
I want to call an embedded ruby function from Delphi 2009. A C or C++
[#323409] Ruby Installation Mac Leopard — Michael Rigart <damick@...>
Hi everybody
[#323420] Newbie - open file permission denied — Bob Smith <rasmith2310@...>
I am attempting to open a directory, open each file and send each line
[#323434] Testing Data Scrapes — Michael Boutros <me@...>
Hello all,
[#323450] StressTest — Ilias bankai <citrix_linux@...>
[#323468] Buiding anamgrams — andrea <kerny404@...>
I'm studying ruby (and I really love it even more than python) and I
[#323482] Regular Expression Trouble — Chris Hoeppner <chris.webstar@...>
Hey!
[#323488] Win32API- GetForegroundWindows() — Diego Guti <diegosanjulian@...>
Hi!
Diego Guti wrote:
[#323494] ruby -> python — Roger Pack <rogerpack2005@...>
I was thinking the other day...wouldn't it be nice to be able to take
On Dec 26, 11:11=A0pm, Roger Pack <rogerpack2...@gmail.com> wrote:
[#323511] Interpreter to work well with other programming languages — Rafael El Frederico <rubyisking@...>
What would be some good interpreters for the Ruby programming language?
On 27.12.2008 11:51, Rafael El Frederico wrote:
[#323519] What does 'Monkey Patching' exactly Mean in Ruby? — "Yaser Sulaiman" <yaserbuntu@...>
According to Wikipedia, a monkey patch[1] is:
Hi --
Phlip wrote:
Hi --
On Fri, Jan 2, 2009 at 1:42 PM, David A. Black <dblack@rubypal.com> wrote:
Hi --
On Fri, Jan 2, 2009 at 5:30 PM, David A. Black <dblack@rubypal.com> wrote:
Robert Dober wrote:
> =A0 =A0module MyGsubBang
[#323536] SUPRISE...! — symbolsofpower@...
http://freemobiletechs.blogspot.com/
[#323541] Syntax error I don't understand — Albert Schlef <albertschlef@...>
(I'm using Ruby 1.8.6.)
Albert Schlef wrote:
Dave Bass wrote:
[#323542] New to Ruby: copying arrays? — John Park <jcpark@...>
Hi. First-time poster here. I've done some programming in Delphi
Alle Sunday 28 December 2008, John Park ha scritto:
[#323573] Few Questions on Ruby — Anil Bhat <anilbhat21@...>
Given this module definition:
[#323574] use not equal(!=) operator as a Symbol. — Jun Young Kim <jykim@...>
Hi, all
[#323581] unable to open Excel file — Riya Rai <riya1236@...>
[#323603] Bug In Ruby 1.8.6-26 — Opt Opt <jp0661@...>
I'm currently coding a ruby/rails application on Windows Vista using
[#323612] Creating a class for returing DB results — Darin Ginther <darin.ginther@...>
I'm a ruby noob. I've managed to accomplish what I want to do in one
You're close. Wrap the actual code which does the action in another
[#323631] What you do when dealing with a huge number of conditions ? — Nicholas Wieland <nicholas.wieland@...>
[#323639] racc 1.4.6 release — Aaron Patterson <aaron@...>
racc 1.4.6 has been released!
On Tue, Dec 30, 2008 at 05:44:23PM +0900, Ryan Davis wrote:
[#323644] Why Ruby? — Mike Stephens <rubfor@...>
I have never seen or heard of Ruby in a corporate context. The single
Mike Stephens wrote:
Mike Stephens wrote:
Thanks Phlip.
On Thu, Jan 8, 2009 at 4:29 PM, Mike Stephens <rubfor@recitel.net> wrote:
Of course ten years ago Mike could easily have been asking:
[#323650] babelfish 0.0.1 — Suraj Kurapati <snk@...>
babelfish : Ruby interface to Yahoo! BabelFish translation service
wow.. this is great!!!
[#323668] Ruby 1.9.1 RC1 is released — "Yugui (Yuki Sonoda)" <yugui@...>
Hi, folks
On Tue, Dec 30, 2008 at 9:36 AM, Yugui (Yuki Sonoda) <yugui@yugui.jp> wrote:
Can it be published as a torrent?
[#323700] Ruby Noobie needs some help — r <rt8396@...>
Hello,
[#323740] about searching constant — Kyung won Cheon <kdream95@...>
class A
[#323746] Happy New Year Ruby Community! — "Pablo Q." <paqs140482@...>
Happy New Year Ruby Community!
Pablo Q. wrote:
Ruby Rabbit wrote:
[#323748] Ruby arguments into C function are warped — Daniel Waite <rabbitblue@...>
I want to code a few methods in C for speed reasons. The Pick Axe book
[SUMMARY] AnsiString (#185)
It would seem that writing Transfire's desired `ANSIString` class is =20
more difficult that it appears. (Or, perhaps, y'all are busy preparing =20=
for the holidays.) The sole submission for this quiz comes from =20
_Robert Dober_; it's not completely to specification nor handles the =20
bonus, but it is a good start. (More appropriately, it might be better =20=
to say that the specification isn't entirely clear, and that Robert's =20=
implementation didn't match *my* interpretation of the spec; a proper =20=
`ANSIString` module would need to provide more details on a number of =20=
things.)
Robert relies on other libraries to provide the actual ANSI codes; =20
seeing as there are at least three libraries that do, Robert provides =20=
a mechanism to choose between them based on user request and/or =20
availability. Let's take a quick look at this mechanism. (Since this =20
quiz doesn't use the Module mechanism in Robert's `register_lib` =20
routine, I've removed the related references for clarity. I suspect =20
those are for a larger set of library management routines.)
@use_lib =3D
( ARGV.first =3D=3D '-f' || ARGV.first =3D=3D '--force' ) &&
ARGV[1]
=09
def register_lib lib_path, &blk
return if @use_lib && lib_path !=3D @use_lib
require lib_path
Libraries[ lib_path ] =3D blk
end
register_lib "facets/ansicode" do | color |
ANSICode.send color
end
# similar register_lib calls for "highline" and "term/ansicolor"
class ANSIString
used_lib_name =3D Libraries.keys[ rand( Libraries.keys.size ) =
]
lib =3D Libraries[ used_lib_name ]
case lib
when Proc
define_method :__color__, &lib
else
raise RuntimeError, "Nooooo I have explained exactly how to =20=
register libraries, has I not?"
end
# ... rest of ANSIString ...
end
=09
First, we check if the user has requested (via `--force`) a particular =20=
library. This is used in the first line of `register_lib`, which exits =20=
early if we try to register a library other than the one specified. =20
Then `register_lib` loads the matching library (or all if the user did =20=
not specify) via `require` as is typical. Finally, a reference to the =20=
provided code block is kept, indexed by the library name.
This seems, perhaps, part of a larger set of library management =20
routines; its use in this quiz is rather simple, as can be seen in the =20=
calls to `register_lib` immediately following. While registering =20
"facets/ansicode", a block is provided to call `ANSICode.send color`. =20=
This is then used below in `ANSIString`, when we choose one of the =20
libraries to use, recall the corresponding code block, and define a =20
new method `__color__` that calls that code block.
Altogether, this is a reasonable technique for putting a fa=E7ade around =
=20
similar functionality in different libraries and choosing between =20
available libraries, perhaps if one or another is not available. It =20
seems to me that such library management =96 at least the general =20
mechanisms =96 might be worthy of its own gem.
Given that we now have a way to access ANSI codes via =20
`ANSIString#__color__`, let's now move onto the code related to the =20
task, starting with initialization and conversion to `String`:
class ANSIString
ANSIEnd =3D "\e[0m"
def initialize *strings
@strings =3D strings.dup
end
def to_s
@strings.map do |s|
case s
when String
s
when :end
ANSIEnd
else
__color__ s
end
end.join
end
end
=09
Internally, `ANSIString` keeps an array of strings, its initial value =20=
set to a copy of the initialization parameters. So we can create ANSI =20=
string objects in a couple of ways:
s1 =3D ANSIString.new "Hello, world!"
s2 =3D ANSIString.new :green, "Merry ", :red, "Christmas!", :end
=09
When converting with `to_s`, each member of that array is =20
appropriately converted to a `String`. It is assumed that members of =20
the array are either already `String` objects (so are mapped to =20
themselves), the `:end` symbol (so mapped to constant string =20
`ANSIEnd`), or appropriate color symbols available in the previously =20
loaded library (mapped to the corresponding ANSI string available =20
through method `__color__`). Once all items in the array are converted =20=
to strings, a simple call to `join` binds them together into one, =20
final string.
Let's look at string concatenation:
class ANSIString
def + other
other.add_reverse self
rescue NoMethodError
self.class::new( *( __end__ << other ) )
end
def add_reverse an_ansi_str
self.class::new( *(
an_ansi_str.send( :__end__ ) + __end__
) )
end
private
def __end__
@strings.reverse.find{ |x| Symbol =3D=3D=3D x} =3D=3D :end ?
@strings.dup : @strings.dup << :end
end
end
Before we get to the concatenation itself, take a quick look at helper =20=
method `__end__`. It looks for the last symbol and compares it against =20=
`:end`. Whether true or false, the `@string` array is duplicated (and =20=
so protects the instance variable from change). Only, `__end__` does =20
not append another `:end` symbol if unnecessary.
I was a little confused, at first, about the implementation of =20
`ANSIString` concatenation. Perhaps Robert had other plans in mind, =20
but it seemed to me this work could be simplified. Since `add_reverse` =20=
is called nowhere else (and I couldn't imagine it being called by the =20=
user, despite the public interface), I tried inserting `add_reverse` =20
inline to `+` (fixing names along the way):
def + other
other.class::new( *(self.send(:__end__) + other.__end__) )
rescue NoMethodError
self.class::new( *( __end__ << other ) )
end
And, with further simplification:
def + other
other.class::new( *( __end__ + other.send(:__end__) ) )
rescue NoMethodError
self.class::new( *( __end__ << other ) )
end
I believed Robert had a bug, neglecting to call `__end__` in the =20
second case, until I realized my mistake: `other` is not necessarily =20
of the `ANSIString` class, and so would not have the `__end__` method. =20=
My attempt to fix my mistake was to rewrite again as this:
def + other
ANSIString::new( *( __end__ + other.to_s ) )
end
=09
But that has its own problems if `other` *is* an `ANSIString`; it =20
neglects to end the string and converts it to a simple `String` rather =20=
than maintaining its components. Clearly undesirable. Obviously, =20
Robert's implementation is the right way... or is it? Going back to =20
this version:
def + other
other.class::new( *( __end__ + other.send(:__end__) ) )
rescue NoMethodError
self.class::new( *( __end__ << other ) )
end
Ignoring the redundancy, this actually works. My simplification will =20
throw the `NoMethodError` exception, because `String` does not define =20=
`__end__`, just as Robert's version throws that exception if either =20
`add_reverse` or `__end__` is not defined. So, removing redundancy, I =20=
believe concatenation can be simplified correctly as:
def + other
self.class::new( *(
__end__ + (other.send(:__end__) rescue [other] )
) )
end
For me, this reduces concatenation to something more quickly =20
understandable.
One last point on concatenation; Robert's version will create an =20
object of class `other.class` if that class has both methods =20
`add_reverse` and `__end__`, whereas my simplification does not. =20
However, it seems unlikely to me that any class other than =20
`ANSIString` will have those methods. I recognize that my assumption =20
here may be flawed; Robert will have to provide further details on his =20=
reasoning or other uses of the code.
Finally, we deal with adding ANSI codes to the ANSI strings (aside =20
from at initialization):
class ANSIString
def end
self.class::new( * __end__ )
end
def method_missing name, *args, &blk
super( name, *args, &blk ) unless args.empty? && blk.nil?
class << self; self end.module_eval do
define_method name do
self.class::new( *([name.to_sym] + =
@strings).flatten )
end
end
send name
end
end
=09
Method `end` simply appends the symbol `:end` to the `@strings` array =20=
by making use of the existing `__end__` method. Reusing `__end__` (as =20=
opposed to just doing `@strings << :end`) ensures that we don't have =20
unnecessary `:end` symbols in the string.
Finally, `method_missing` catches all other calls, such as `bold` or =20
`red`. Any calls with arguments or a code block are passed up first to =20=
the superclass, though considering the parent class is `Object`, any =20
such call is likely to generate a `NoMethodError` exception (since, if =20=
the method was in `Object`, `method_missing` would not have been =20
called). Also note that whether "handled" by the superclass or not, =20
all missing methods are *also* handled by the rest of the code in =20
`method_missing`. I don't know if that is intentional or accidental. =20
In general, this seems prone to error, and it would seem a better =20
tactic either to discern the ANSI code methods from the loaded module =20=
or to be explicit about such codes.
In any case, calling `red` on `ANSIString` the first time actually =20
generates a new method, by way of the `define_method` call located in =20=
`method_missing`. Further calls to `red` (and the first call, via the =20=
last line `send name`) will actually use that new method, which =20
prepends `red.to_sym` (that is, `:red`) to the string in question.
At this point, `ANSIString` handles basic initialization, =20
concatenation, ANSI codes and output; it does not handle the rest of =20
the capabilities of `String` (such as substrings, `gsub`, and others), =20=
so it is not a drop-in replacement for strings. I believe it could be, =20=
with time and effort, but that is certainly a greater challenge than =20
is usually attempted on Ruby Quiz.