301517-310692

301283-355534 subjects 301731-303506

rubygems-update and Mac OS X 10.4.11
301517 [unbewusst.se] $ sudo gem install --local rubygems-update
301522 [ryand-ruby@z] % sudo update_rubygems
301539 [unbewusst.se] ~%> sudo update_rubygems
301729 [ryand-ruby@z] % sudo gem update --system

Convert integer to array?
301525 [kaepora@ma .] x=1234
+ 301526 [raasdnil@gm ] irb(main):001:0> x=1234
| + 301535 [dblack@ru yp] That's an array of strings rather than integers, though. See my other
| + 301791 [globyy3000@h] x=1234
+ 301527 [botp@de mo t] # Let's say I have: x=1234
| 301529 [lokesh_agraw] Integer to Array
+ 301531 [shortcutter@] x.scan /\d/
| 301621 [shortcutter@] x.to_s.scan(/\d/).map {|i| i.to_i}
+ 301534 [dblack@ru yp] require 'scanf'
| 301536 [dblack@ru yp] "%1d" * x.size would be better (no need to hard-code the 4).
+ 301537 [sepp2k@go gl] result_array = []
  301618 [shortcutter@] Well, that's easily fixed: just work with another variable.  You can
  301622 [Rob@Ag le on] def int_split(x)
  + 301626 [shortcutter@] The reasoning is wrong but comes to the right conclusion: if you want
  | 301647 [dblack@ru yp] I still like scanf :-)
  | 301715 [botp@de mo t] # I still like scanf :-)
  | 301833 [botp@de mo t] # scan+map since i don't need the formatting=20
  + 301631 [phasis@gm il] def int_split(x)

Handling of arrays
301528 [clement.ow@a] $selections = ["*","*"]
301542 [jgabrielygal] src1 = $file_exception.inject(Dir.glob(src)) {|result, ex| result -
301602 [clement.ow@a] nice slick code there using regexp ;) just wondering if there would be a
301611 [jgabrielygal] If what you want is to associate different information to each source path,
301719 [clement.ow@a] thanks Jesus, that was really helpful! However I altered the code alil
+ 301732 [clement.ow@a] Also, I have problems making some file exceptions. For example, i ahve
| 301755 [jgabrielygal] I'm not sure if I'm understanding you correctly, but you can tweak the
| 301844 [clement.ow@a] Nah, it's fine, we all know it can get a lil tiring sometimes. As it is
| 301851 [clement.ow@a] After much playing around with this statement,result here is the whole
| 301863 [clement.ow@a] I found what is actually goin on in this statement. because x is the
| 301957 [jgabrielygal] Enumerable#inject is a very powerful iterator (in my opinion at
| 301958 [jgabrielygal] I have realized that this sentence can be confusing: the accumulator doesn'=
| 301959 [shortcutter@] n't
| 301961 [jgabrielygal] nd
+ 301754 [jgabrielygal] Sorry, that's what I get for not testing the code. I think (I'm a bit

rotation of photos
301538 [sunny_bogawa] album photos, i want to developed a functionality where i can rotate
301543 [gary@Lo de .] Look at http://rmagick.rubyforge.org/

Other languages Was: Re: Looking for a Sudoku Algorithm to implement in Ruby
301544 [jan.svitok@g] Welcome!

Constants, Bindings and instance_eval
301547 [die_gabel@we] Dear rubyists,
+ 301580 [globyy3000@h] class A
+ 301582 [albertschlef] That's an interesting question!

Net:HTTP post question
301548 [raasdnil@gm ] Heya all,
301560 [boesemar@gm ] I just read that WWW::Mechanize has an interface for fileuploads, see
301604 [raasdnil@gm ] Looks perfect, thanks :)

Cover a directory and put all the stuff in a TreeView
301556 [eloi.plans@c] Given a directory, for example /home, I would like to take ALL the
+ 301557 [ymendel@po o] What makes /home/a1 and /home/a2 the children of /home/a? They're not /
+ 301558 [boesemar@gm ] Call a function recursively when you hit a directory. This will output
+ 310692 [mailtokamat@] Below code can be used to convert directory structure in xml.

regexp+hash problem
301561 [jean-christo] I becoming totally mad about this simple script, whose goal is to
+ 301566 [sandro.pagan] Why don't use Date.strptime to match the date info ?
| 301585 [s.korteling@] require 'date'
+ 301568 [bbxx789_05ss] fileName = "data.txt"
+ 301570 [AEtzold@gm .] I think this is due to the fact that you have sometimes one, sometimes
+ 301573 [caduceass@gm] Just FYI, this is effectively the same as...

Ruby, HPUX and rubygems
301562 [stephen.odon] So I have the less than enjoyable of installing Ruby on a PA-RISC HPUX
301565 [kyleaschmitt] stephen,
301659 [stephen.odon] I have battled with it a long way, and it gets really far into

[ANN] rb++ / rbgccxml 0.1.1 bugfix release
301569 [jameskilton@] == CHANGELOG
301572 [AEtzold@gm .] Dear Jason,
301574 [jameskilton@] ese)

array diff
301575 [jdechiaro@co] I am new to ruby and trying to do a diff on two csv files.
+ 301577 [AEtzold@gm .] James,
+ 301579 [globyy3000@h] Same thing basically but none-the-less this would also work..
  301588 [jdechiaro@co] Thanks for your responses
  301592 [adam.shelly@] records.collect do |row| row[1].eql?(SumArray)
  301630 [jdechiaro@co] if SumArray.include?(row[1])did the trick...thanks adam!
  301740 [shortcutter@] You might also want to consider using Set or Hash for more efficient
  301742 [jdechiaro@co] Thanks for the tip Robert I will give it a go...as the script has been
  301814 [shortcutter@] Yet another approach would be to use a relational database for this.  If
  301822 [caduceass@gm] I agree that a large dataset like this probably doesn't belong in the

Source code from complex user interfaces RUBY GTK
301576 [eloi.plans@c] I've just started creating user interfaces with Ruby GTK and I would
+ 301578 [AEtzold@gm .] I've particularly liked Hal Fulton's Ruby Way (there's
| 301586 [cmdjackryan@] Well, yeah. Otherwise, The Ruby-GNOME2 project page has examples, too,
+ 301587 [albertschlef] I'm not sure a book is the best choice. You don't know what's in the
  301591 [cmdjackryan@] Except Ruby-GNOME2 isn't distributed as gem, and thus gems cannot depend
  301615 [albertschlef] On the one hand you say packages don't depend on some non-existing
  + 301620 [shevegen@li ] The best way is to
  + 301642 [cmdjackryan@] Yes.

This Week in Ruby (May 12, 2008)
301581 [acangiano@gm] Cheers,

Problem with files comparing
301589 [happy.go.luc] My problem is to compare two files in the same directory as the program
301590 [dave@pr gp o] You probably need to call your function.
301593 [happy.go.luc] I tried put them in a class, and tested, but it kept throwing me the
301594 [dave@pr gp o] 1. It's relatively unusual to create instances of a class inside the
301663 [happy.go.luc] compare is a std mathod in ftools.rb
301664 [dave@pr gp o] Then you'd need to say File.compare, and not just compare.
301676 [happy.go.luc] Ok. I c. Thanks man

help re manual RubyGems update?
301601 [greg.hauptma] ...
301681 [luislavena@g] On May 13, 12:17 am, Greg Hauptmann <greg.hauptmann.r...@gmail.com>

about writing file???
301606 [hb.pat87@ho ] I use this
+ 301607 [cmdjackryan@] You can't. All it needs is the correct privileges to access the file.
+ 301610 [fox@ns l. su] If you just want to prevent casual/accidental, rather than
  301617 [albertschlef] Does 0440 work on windows too?
  301735 [fox@ns l. su] Yes, but I did get the arguments backwards.
  301736 [hb.pat87@ho ] thx you I will try with it :)
  302394 [hb.pat87@ho ] It's not work! :'(
  302415 [cmdjackryan@] And you will not be able to change that behavior, short of shipping your

[ANN] ofx-parser 1.0.2 Released
301608 [andy@ti ne f] ofx-parser version 1.0.2 has been released!

About Editors
301612 [kittu_mohan2] ruby enthusiast i would like to dig in to it to the extent possible for
301613 [pikEISPAMMMs] The best editor is the one you like and know best. This is a *lovely*
301638 [JAMES.T.MCLA] ...

OOPS Ruby
301614 [lokesh_agraw] ...
301628 [znmeb@ce ma ] I'd start with Russ Olsen's "Design Patterns in Ruby".

problem in migrating
301616 [rizzwanabanu] I have stuck in problem could you please get me out of it. whenever i
301644 [cmdjackryan@] Can Ruby find it? It does not mean the openssl.rb, but either an

How to convert character to hexadecimal?
301623 [ibc@al ax ne] " " (space)  =>  x20
+ 301629 [sepp2k@go gl] => "x20"
| + 301634 [Rob@Ag le on] " ".unpack('H*')[0]
| | 301636 [ibc@al ax ne] Great !
| | 301639 [chris.hulan@] I think ' '[0].to_s.hex will produce the value and be a bit easier to
| | 301667 [bbxx789_05ss] Besides being a candidate to win a code obfuscation competition, your
| | + 301671 [bbxx789_05ss] ..and the hex method having a misleading name.  Why anyone would call a
| | | 301672 [sepp2k@go gl] Agreed on the misleading name, but not on Integers being "decimal numbers".
| | | 301674 [bbxx789_05ss] You can only interpret the meaning of an Integer in reference to some
| | | 301675 [sepp2k@go gl] How does an Integer whose base is 10 differ from an Integer whose base is
| | | 301679 [bbxx789_05ss] How ruby handles Integers has no bearing on whether a number is called a
| | | 301680 [sepp2k@go gl] Then I ask you again what does have a bearing on that?
| | | + 301683 [Gennady.Byst] 0xA.object_id == 10.object_id == 012.object_id == 0b1010.object_id
| | | | 301685 [sepp2k@go gl] Exactly my point.
| | | + 301717 [bbxx789_05ss] x is not a number--x is a variable.  After the assignment, x refers to
| | |   + 301726 [sepp2k@go gl] Sure, but the Integer doesn't have any idea what kind of literal it was
| | |   + 301733 [overlord@gm ] And an integer literal is a string representation of an Integer. And
| | + 301757 [chris.hulan@] Thanks 7, i totally misrad what hex does...thats what I get for
| + 301635 [ibc@al ax ne] Thanks, but I don't want to convert an integer into a String, but a
|   301643 [sepp2k@go gl] There's no such thing as a character or a hexedecimal value in ruby.
+ 301637 [s.korteling@] " "[0].to_s(16)

disable regexp warning
301625 [gaspard@te i] Is there a way to disable regexp warning ?
301632 [flo@an er gr] I don't see your problem.
301730 [gaspard@te i] This is crazy. When I write a simple test case with your example it
301753 [rick.denatal] Well the regexp you're testing IS valid, perhaps it's not the regexp
301823 [gaspard@te i] There is a space after '#'. The test actually makes sure no one can
302187 [gaspard@te i] I still cannot find a solution to disable regex warning in the
302190 [phasis@gm il] def valid_regexp?(str)
302202 [gaspard@te i] Thanks Heesob Park !

Updating all values in a Hash
301640 [p.dugdale@gm] Does anyone know a good way to update all values in a hash.
+ 301646 [sepp2k@go gl] hash.each {|k,v| v.downcase!}
+ 301648 [tim.pease@gm] h = {1 => 'ONE', 2 => 'TWO'}
+ 301649 [sandro.pagan] I found this way
  301652 [dblack@ru yp] That's very resourceful (I'm fully in favor of extending individual
  301655 [p.dugdale@gm] Sorry! I was trying to keep my post simple, but ended up doing a really
  + 301658 [sepp2k@go gl] You always pass by reference, but you pass a reference to the object (a
  | + 301701 [rick.denatal] a = "Fred"
  | + 301713 [dblack@ru yp] I'd put it differently, and I know this sounds convoluted but I think
  + 301660 [shortcutter@] A reference is indeed passed to the block.  There is no copying of

hash merge
301645 [tim.wolak@gm] I'm not sure if I'm using this the right way and I'm hoping you guys can
+ 301650 [ymendel@po o] I'm not finding that to be the case.
| + 301653 [tim.wolak@gm] a = { 54540 => 10345, 55550 => 30555 }
| | 301654 [s.korteling@] Are you sure? I'll assume you meant value
| | 301656 [tim.wolak@gm] You guys were right it is working, I was returning the wrong values.
| + 301662 [shortcutter@] irb(main):009:0> h = {1=>2}
|   301668 [adam.shelly@] irb(main):010:0> h={1,2}
|   301694 [shortcutter@] Amazing.  Thank you for the education!  I should have looked at the
+ 301651 [s.korteling@] Hash.merge will give you a new Hash, a third one. If somewhere outside

detail on a regex?
301657 [kyleaschmitt] Is there a way to pull details out of a regular expression's failure?
301666 [shortcutter@] If it does not match you get no information out of the regexp.  The
301693 [kyleaschmitt] Hum.  Yea, but I want the error messages to be helpful for when I'm
301706 [shortcutter@] Please do not top post.

requiring the same file and capturing the constants
301661 [neeraj.jsr@g] file1.txt
301669 [vjoel@pa h. ] If you have control over *how* the file is loaded, you can do this,

Problem with Active Record and Oracle using oracle_enhanced adapter
301673 [paqs140482@g] ...
301682 [paqs140482@g] ...
302271 [yizhih@gm il] ...

Ubuntu/Apache/Eruby
301677 [xcampanoli@g] I have an eruby application that I need to run on a machine with apache
301678 [xcampanoli@g] Never Mind.  I got it.  I did some searches again, presumably with a

modify output of script
301687 [kbrede@gm il] I've got some LDAP data I'm trying to pipe into a ruby script.
301692 [jan.svitok@g] Try simple state machine - either you are processing first group (then
301700 [shortcutter@] #!/bin/env ruby

Switch Two Lines in a File
301688 [dmerrick@ic ] Hey guys,
301689 [dmerrick@ic ] Oh, sorry, I should have mentioned, I'm providing two regexes, and the=20
+ 301695 [adam.shelly@] f= File.new(fname,File::RDWR)
+ 301705 [ snk@gn .o g] Here's my solution; thanks for the fun exercise.

require load error
301690 [fbogdanovic@] I installed 'hpricot' and 'wx' (wxruby) libraries with gem command and when
+ 301697 [cmdjackryan@] when
| 301704 [fbogdanovic@] require 'rubygems'
| 301708 [cmdjackryan@] 1.8.6
+ 301698 [caduceass@gm] Maybe, you need require 'rubygems' first.

Failure trying 'gem contents'...?
301691 [xcampanoli@g] root@rhaprpt:~# gem contents
301727 [ryand-ruby@z] ??? the error message is pretty clear. if you want to see the contents

gem install of mongrel_cluster fails...
301696 [xcampanoli@g] root@rhaprpt:~# gem install mongrel_cluster --include-dependencies
301699 [cmdjackryan@] Install the ruby-dev package (if you are on Ubuntu, for example). That
301702 [xcampanoli@g] I am on a hardy install now, and apt-cache search 'ruby-dev' returns
301707 [cmdjackryan@] This is the package you seek.
301709 [xcampanoli@g] Thank you for your help Phillip.  I find it this time searching for

rdoc breaks on some types of links
301714 [vjoel@pa h. ] Not sure exactly which link is causing this, but it seems like bug in
301728 [ryand-ruby@z] do you know how to repro that?
301778 [vjoel@pa h. ] Sorry, that was very vague. I was hoping that it was something obvious
305135 [vjoel@pa h. ] Ok found the cause of the bug, if it is a bug (maybe it's just a change
305136 [vjoel@pa h. ] ...and there already a report of this, from April, in

Re: [QUIZ] The Turing Machine (#162)
301718 [jamesbkoppel] ...

Tracking Ruby on Twitter
301720 [makenai@gm i] I was having trouble finding some interesting rubyists to follow on
301923 [ shot@ho .p ] What about polling similar stuff out of Hashtags? I=E2=80=99d guess it has
301925 [makenai@gm i] Hash tags are cool if you set out with the idea of using them to

hpricot and regexp?
301721 [pood.forums@] I'm trying to grab the "cache date" off of the google search.
301722 [pood.forums@] oops, I mean, grep.
301723 [pood.forums@] date = cache_date.search('table table > td').inner_text.grep(/retrieved
301725 [dandiebolt@y] ...
301777 [pood.forums@] Dan Diebolt,

Re: Need help for finding difference between files
301724 [clement.ow@a] What kinda difference do you wanna look at? is is file attributes?
+ 301779 [happy.go.luc] Ok, I need to compare the contents in 2 files. Print out each difference
| + 301784 [globyy3000@h] file1 = File.readlines("f1.txt")
| | 301801 [happy.go.luc] Thanks man. I found that using "-" can find all differences
| + 301785 [caduceass@gm] If you don't mind reading the whole files in to memory, you can try
| | 301788 [caduceass@gm] Sorry that's | and &, _not_ || and && and I had it backwards...
| + 301850 [reid.thompso] ...
+ 301856 [dsisnero@gm ] ...
threads.html
top