390973-403144

390752-414085 subjects 391159-407305

HTML to XML
390973 [wbrisett@at ] I'm getting ready to try converting one of my behemoth AppleScripts to =
390974 [dave.baldwin] Not familiar with DITA, but have a look at builder.
390975 [wbrisett@at ] Thanks Dave, looks like a perfect solution for me.

Confusing results from string multiplication
390976 [robmarshall@] I actually registered here to ask a different question, but after
+ 390977 [shortcutter@] Congratulations, you really hit a strange corner case in the syntax!
+ 390978 [peter.c.r.la] The difference is down to the optional argument for Fixnum#to_s, the
+ 390980 [matthias@wa ] but it works correctly for other numbers. try
| 391009 [josh.cheek@g] 2011/12/8 Matthias W=E4chter <matthias@waechter.wiz.at>
| 391038 [matma.rex@gm] Just a note that this might happen not only with multiplication vs
+ 390981 [robmarshall@] Well, for someone who is new to Ruby, how would I, or anyone for that
| + 390983 [adam@ap es o] 11.to_s(2) gives you "1011". This is a string, and it doesn't actually know
| | 390984 [adam@ap es o] Typo! That should be 1011, of course. It doesn't affect the point I was
| + 390986 [pete@pe er i] FWIW, ruby will warn you about ambiguous syntax if you run it with warnings
| + 390987 [ymendel@po o] Possibly, but I'd hope not. At some point you should think about
| + 390997 [echristopher] Wherever you heard whitespace doesn't matter, forget it; it's not true.
|   397307 [lists@ru y- ] Absolutely right - whitespace is *very* significant in ruby. Here's
+ 390982 [robmarshall@] Oh, and just for clarification, I guess it's the "splat" operator, not
+ 390985 [robmarshall@] Well, I do, at least to some degree, understand what's happening. I
+ 390989 [robmarshall@] Well at least I started a lively discussion :-)
+ 390991 [robmarshall@] Oh, and by the way, I do know why '11.to_s*2' works "correctly", in the

Greed Dice Game Scoring from Ruby Koans
390993 [nathan@li ds] ...
391000 [sduncan@we a] This is quite a fun exercise, and interesting to see what people come up

rubyscript2exe
390995 [aggouni2002@] I am trying rubyscript2exe for the first time and I am getting an error
+ 391002 [luislavena@g] Luis Lavena
+ 391037 [dickyhide@gm] ocra is very easy to use.

how to view the structure of a hash
391003 [sodani@gm il] I keep finding myself trying to decipher the structure of hash objects
+ 391004 [Carey.Nation] Syntax from memory, so please forgive errors...
| 391013 [sodani@gm il] This doesn't really change much in my opinion because the values are
| + 391015 [frosty@un uc] What exactly do you want to discover about the hash?  What it's values
| + 391048 [Carey.Nation] Notice the "you'll want to do a bit more to make it readable" part.
+ 391005 [klauer@gm il] Would awesome_print( https://github.com/michaeldv/awesome_print ) work?
+ 391018 [whitequark@w] require 'pp' # Pretty printer
+ 391051 [shevegen@li ] Peter Zotov already suggested the way to go.
  391100 [sodani@gm il] Thank you all for the responses. I'll try these all out.

What is a good ruby tutorial / book for a beginner?
391006 [sasogeek@ya ] I have been reading Chris Pine's book for a while now and I'm stuck at
+ 391008 [wbrisett@at ] programs
+ 391010 [sasogeek@ya ] I haven't learnt classes or hashes yet... It is in the next 2 chapters
| 391011 [rbakerjax@gm] I would recommend The Well Grounded Rubyist by David Black. His book is excellent!
+ 391012 [sasogeek@ya ] Thanks a ton Russel :) I downloaded the book, going to give it a good
+ 391014 [josh.cheek@g] This is a good exercise! When I first tried to sort an array, it hurt my
+ 391017 [nss118@gm il] I really liked Beginning Ruby by Peter Cooper.
  391034 [wbrisett@at ] Peter also teaches an online course that uses his book at =

ERROR Encoding::CompatibilityError
391016 [chonkw@na e.] Windows7 32bit
391039 [matma.rex@gm] Have you tried adding the magic encoding comment (see below) to the

How can I do h["foo"] += "bar" if h["foo"] does not exist?
391019 [andrewinfose] I have a hash with various keys and values that are strings.
+ 391020 [whitequark@w] $ irb
| 391022 [ryand-ruby@z] This is bad. Very bad.
| 391023 [josh.cheek@g] in
+ 391021 [ryand-ruby@z] That only works if the value at key "foo" responds to +. In this case, I =
+ 391024 [code@ap th o] I guess you could get really ugly with it.
+ 391025 [mayank.kohal] You can have something like this to check whether the key is present or
| 391026 [ryand-ruby@z] Values can be false/nil.
| 391032 [shortcutter@] Also, this is inelegant.  Either do this to prevent accidental
| 391035 [mayank.kohal] Thanks for the enlightenment!!! Learned something about hashes today. :)
| 391044 [shortcutter@] irb(main):012:0> h = Hash.new {|ha,k| h[k] = ""}
+ 391052 [gf.bozzetti@] =begin
+ 391057 [andrewinfose] Many thanks to all who replied!

reading from file without end-of-lines
391027 [umrzykus@ga ] if File.exists?(file)
+ 391028 [gsinclair@gm] I tend to strip out all such characters at once, before operating on any li=
| 391031 [shortcutter@] e?
| + 391033 [umrzykus@ga ] [cut]
| + 391042 [gsinclair@gm] Very elegant.  Except for that ghastly &  :)
|   + 391045 [josh.cheek@g] What isn't elegant about the `&'?
|   | + 391056 [umrzykus@ga ] looks like reference operator in C ? :)
|   | + 391076 [gsinclair@gm] It twists my head trying to think about how it works.  Nothing else in
|   |   391099 [josh.cheek@g] I disagree. `&` is known to invoke `to_proc` and place the result in the
|   |   391115 [shortcutter@] Josh, thanks for catching this in my example!
|   + 391046 [shortcutter@] Absolutely agree!  We could remedy this by allowing a single argument
+ 391083 [shevegen@li ] It is not elegant because the rest of the line uses . ! ? and ()
| + 391089 [mike@st k. a] Solely may be an exaggeration. & is used in other places, for example =
| + 391094 [shortcutter@] Please note that this is not "&:" notation - it is just "&" because
|   391096 [rubytalk2dav] Not that that's a prescription for a good programming language.
|   391114 [shortcutter@] Which I did not claim.  The point was that there *are* people who like
+ 391084 [shevegen@li ] That too. Reminds me of pointers.

Learn To Program (Chris Pine) - Building and Sorting Array
391029 [emekapatrick] Super new to programming (1 week or so) and working through 'Learn to
391030 [shortcutter@] Welcome to the world of Ruby!
391064 [emekapatrick] Thanks so much for getting back to me on this much appreciated. Some
391071 [wishdev@gm i] Good Day Emeka,
391073 [emekapatrick] Thanks so much for getting back to me and for your kind words. Really
+ 391095 [shortcutter@] It's among the most friendly online communities I have come across -
+ 391109 [alexandermcm] ...

net-ftp 530 error message
391036 [dickyhide@gm] I want to write a ftp script to download some folder from

CONCEPT OF INSTANCE VARIABLE IN RUBY
391040 [manavkbgupta] @x = 'Hello world'
+ 391041 [peter.c.r.la] 1.9.3p0 :001 > self
+ 391070 [lw2011@so ic] To expand on the nice diagnostic suggestion in the foregoing post, x and
| 391145 [b.candler@po] No, that's not quite right. x here is a method call, not a local
+ 391144 [eule@sp ce c] Why does it (again) sound like a school assignment?
+ 391170 [transfire@gm] ...

[ANN] cast_off-0.4.0 released
391043 [shiba@rv .j ] cast_off-0.4.0 has been released.

Close? ... or have I been messing up from the get go?
391047 [wbrisett@at ] f = File.open("blossom.xml")
+ 391049 [richard.conr] When you read in the info in a block, the file closes automatically.
+ 391050 [whitequark@w] No, files aren't automatically closed upon encountering EOF. You may

Trouble. parse error
391053 [zzcrash@gm i] I have some problem when i want start program. What should I do to fix
391054 [peter.c.r.la] def l(h, r1, r2)

gem build options -- how to make them persist?
391058 [joelvanderwe] On one of my systems, the pg gem won't build unless you tell it the
391059 [ryand-ruby@z] There is no way. I have a ticket filed for this feature. Patches welcome.
391068 [steve@st ve ] If you're using bundler, bundle config can do this for you.

Httparty parsed response
391060 [rubythemyste] I am using httparty to get the content of a service.
+ 403043 [lists@ru y- ] I'm still a bit of a nube with ruby but I have been working with this
+ 403144 [lists@ru y- ] The response is in standard JSON format.  Look into the JSON gem (IIRC,

REST CLient Example
391061 [rubythemyste] Can anyone explain me with an example, by using REST Client to do
391062 [hassan.schro] The doc has examples: http://rubydoc.info/gems/rest-client/1.6.7/frames
391067 [rubythemyste] Thanks ..
391072 [hassan.schro] No, I can't, but all you need is right there  :-)

Can't convert String into Integer
391063 [rubythemyste] Using Httparty, I get the following response
391065 [lw2011@so ic] puts @response.inspect

Custom fields Unlimited
391066 [winn67257@gm] In my application I would like to allow users to dynamically add custom

HTTParty PUT/POST/GET/DELETE Example
391069 [rubythemyste] I need to do POST/PUT operation using httparty.

Building a method - Learn to Program Section 9.5
391074 [emekapatrick] In this program
+ 391077 [list.push@gm] if (reply != 'yes' || reply != 'no')
+ 391078 [rubytalk2dav] [from]
  391086 [emekapatrick] Thanks for the feedback and help! Definitely clarifies this. Didn't cover && as of yet in the book so wasn't aware of using it as an option.
  391088 [rubytalk2dav] Oh!  They're usually covered more or less together.

[ANN] pg 0.12.0 Released
391075 [ged@Fa ri MU] pg version 0.12.0 has been released!

Ruby module error
391079 [zzcrash@gm i] How in ruby i can write module ?
+ 391080 [peter@va de ] For the module Math, you can easily see the documented
+ 391081 [jakekaiden@y] a = -4
+ 391082 [shevegen@li ] You should use

RubyXL::Hash.prepare
391085 [micky.tour@g] What is the difference between RubyXL::Hash.prepare and basic Hash.

mp3 slowing down
391092 [code984265@g] everything works alright but after about 20..30 Up and Down keystrokes

How to call a method from a different class
391097 [dhulem1@um c] I am currently stuck trying to call a method from a different class.
+ 391098 [peter@va de ] So that could be done like this.
+ 391116 [jakekaiden@y] hey folks,
  391123 [peter@va de ] Sorry for the confusion ... (hits hammer on head: _always_ test code before
  391126 [lrodriguezsa] 1 module Checkout

HELP: i need to programm a traffic light an it doesn't work
391101 [akviliukasle] i need this Programm for my exam on wednesday and i am getting out of my
391102 [gennady-ruby] my
391103 [akviliukasle] Shoes.app :height=> 500, :width=> 500 do
+ 391106 [ashbbb@gm il] Umm,...
+ 391119 [reid.thompso] use www.pastebin.com

[ANN] arcadia ide 0.11.1 released
391104 [antonio.gale] a new version of arcadia was just released including minor enhancements
391108 [transfire@gm] ...

Scope and Instance Variable Question
391105 [cleverlemmin] Hail Caesars!
391110 [jgabrielygal] Can you show the caller code? From your description and the code,
391181 [cleverlemmin] I think I have it figured out. It looks like there is more than one

How can i make this procedure into a function?
391111 [akviliukasle] def pause (dauer)
391112 [mbj@se ni .n] This is a busy loop and should not be used unless you are doing much
391113 [akviliukasle] Hey,
+ 391120 [b.candler@po] If that's really the case then your professor doesn't know much about
+ 391156 [ashbbb@gm il] I think it's better to use timer() method in this case.

Re: arcadia ide 0.11.1 released
391117 [antonio.gale] I'll examine it trying installation under rbenv. Thanks

Q. reg modules -scope of executed code
391118 [sentinel1879] I am DRYing up some code. Earlier I was creating modules and calling a

enforcing module contract with self.included?
391124 [grary.stimon] Hey,
+ 391125 [sylvester.ke] Try self.extended. For instance, the following code should print 'PASS' =
+ 391127 [grary.stimon] Sylvester,
| 391131 [sylvester.ke] In this case, the proper hook method is Module.included (as you =
+ 391132 [grary.stimon] OK, right.
| 391133 [sylvester.ke] That's an interesting question and I'd be interested to read more =
+ 391134 [grary.stimon] Yes, I understand your proposed approach.
  391136 [sylvester.ke] because=20

Using HTTParty - POST/PUT/GET/DELETE for RestService
391128 [rubythemyste] Any one who is working with HTTParty can provide me an example for

How to access Hash containing Array of Hashes ?
391129 [rubythemyste] Can anyone give me an example of getting each individual elements of
+ 391130 [mbj@se ni .n] hash_in_response['key'][index_of_array]['other_key']
| 391149 [rubythemyste] Markus
+ 391148 [rubythemyste] Markus

I need advice on what to do next.
391135 [system_freak] I am new to programming.  I read the ebook "Learn to Program" by Chris
+ 391140 [code@ap th o] What kind of programming do you think you'll want to do?  Web
+ 391182 [system_freak] I would like to do web programming, integration, and coding mainly.  I
| + 391186 [josh.cheek@g] I put together Ruby Kickstart (http://ruby-kickstart.com/) to help people
| | 391187 [josh.cheek@g] For this, check http://www.meetup.com/
| + 391193 [code@ap th o] In my experience, using a Unix-like OS as one's primary working
+ 391189 [system_freak] Hey Josh,
| + 391192 [josh.cheek@g] Curious. They're hosted on Amazon S3. Anyone else having trouble with S3?
| + 391284 [josh.cheek@g] Got this fixed, I hadn't set the headers, so the content type was coming in
+ 391211 [chris.hulan@] ...
+ 391221 [shevegen@li ] The only way to learn ruby is to write ruby scripts.
+ 391271 [system_freak] So basically what you're saying Marc is write a simple program that
| 391272 [alex.lang.ut] OOP is Object Oriented Programming, Ruby is an Object Oriented Programming
| 391274 [jonanscheffl] If you need a project go to http://projecteuler.net/ and start working
| 391275 [josh.cheek@g] I've done 140 of those, and can say that while they're wonderful for
+ 391293 [system_freak] Hey Josh,
+ 391295 [system_freak] Hey Josh,
| 391312 [code@ap th o] Have you tried right-clicking the link and choosing the option to
+ 391412 [system_freak] That seemed to have worked.  Thank you.
+ 391484 [system_freak] Can I ask for help with coding no matter how simple it is to others?  I
  + 391485 [isaacbfsande] I have had to learn this the hard way, but you need to do your research
  + 391486 [rubytalk2dav] Sure, so long as you make it clear that you have actually put some
    391487 [steve@st ve ] ...

Send rtf files to printer
391137 [glenn_ritz@y] ...
+ 391138 [garthy_lmklt] - Google "batch print rtf".
| 391139 [garthy_lmklt] Oh, I almost forgot: A good starting point is to look into the Ruby
+ 391146 [b.candler@po] libreoffice?
+ 391147 [richard.conr] Rautomation https://github.com/jarmo/RAutomation is a nice little windows

How to get Rio working again
391142 [gsinclair@gm] If you use a recent Ruby (in my case 1.9.2p0) then the very useful, cool,

after downloading showing empty file
391143 [ajitteli@gm ] def export_rawdata

[ANN] jobQueue 1.0.1 - Running stuff with a user defined number of threads
391151 [ralf.mueller] JobQueue is a ruby gem, that allows you to run Ruby methods and system commands in parallel. It comes with an
+ 391157 [shortcutter@] You're welcome!
| 391166 [ralf.mueller] This was my first interface idea, too. But I skipped it to be able to push a whole list of items at once. But
| 391180 [shortcutter@] h a
| 391250 [ralf.mueller] I skipped this for the moment, but the current 1.0.2 release has implemented the strait forward interface you
+ 391188 [tony.arcieri] Just curious, have you seen girl_friday?
  391248 [ralf.mueller] no, I didn't. Seems to have a different interface concept, but looks interesting. It seems to have a

Install Ruby on Win7
391152 [umpierre.fel] but I have a problem...
391162 [luislavena@g] 1) Did you use RubyInstaller or RailsInstaller?

How to create Arrays (and Hashes) correctly?
391153 [umrzykus@ga ] As far as I know, I can create Arrays and Hashes in Ruby at least in two
391155 [shortcutter@] No, if you only consider constructor without arguments.  But

WIN32OLE taking 100% CPU utilisation
391158 [shareef@ja l] just having a quick play with WIN32OLE and it looks like the
+ 391167 [shareef@ja l] The Perl version works with no such issues so I'm using that for now.
+ 391168 [rogerpack200] do all versions of ruby do the same thing?
| 391419 [shareef@ja l] Sorry, missed these replies.  Not tried any more versions I'm affraid -
+ 391195 [cremes.devli] This is how #message_loop is supposed to work. It polls the Win32 event sink and processes all of the events that are in queue. Try putting a short sleep in your "loop do" like "sleep(0.1) # 100 ms".
threads.html
top