381619-407328 subjects 382050-397936

anonymous closures with Proc,new, lambda and ->
381822 [stu@ru yp og] I am new to the study of functional paradigm. If this question is academic
+ 381826 [shortcutter@] med
+ 381829 [b.candler@po] def make_counter(init)
| 381830 [b.candler@po] c = lambda { init = 200; lambda { init += 1 } }.call
| + 381834 [stu@ru yp og] What does the semicolon tell the interpreter here? init now exists outside
| | 381841 [b.candler@po] It's a block-local variable. You can think of it as a block argument
| | 381871 [adam@ap es o] Usually the section I go to when I need a reminder.
| + 381875 [stu@ru yp og] how would i break it down to two functions?
|   + 381879 [bbxx789_05ss] inc = lambda {|n| n+=1}
|   + 381884 [bbxx789_05ss] inc = lambda do
|     381890 [stu@ru yp og] Lots of helpful information in this thread. Thank you all for helping me.
|     + 381896 [shortcutter@] You're welcome!
|     | 381913 [steve@st ve ] I would highly reccommend Haskell, and http://learnyouahaskell.com/ .
|     + 381942 [bbxx789_05ss] It's my understanding that unless you have a Phd in abstract
|       381946 [steve@st ve ] Naw, monads are actually really, really easy. They're just poorly
|       381952 [b.candler@po] Posted via http://www.ruby-forum.com/.
|       381966 [bbxx789_05ss] I've looked at that before.  I dropped out at the second diagram.
|       381977 [stu@ru yp og] My interest in learning functional programming( or at least the
|       + 381987 [b.candler@po] If you are coming to functional programming from an imperative
|       + 381993 [shortcutter@] Well, the typical program which prints "Hello World!" is difficult for
|       + 382001 [shortcutter@] Cheers
|       + 382006 [bbxx789_05ss] I would agree with that.  Functional programming is much different than
|         382007 [steve@st ve ] +1 for learn you a haskell.
|         382247 [shortcutter@] Professor Robert Harper thinks "Haskell is not suitable for teaching
|         + 382259 [stu@ru yp og] I'm gonna give scheme a go. I did run through a bit of
|         + 382276 [steve@st ve ] Well, non-professor Steve disagrees. :p
+ 381865 [bbxx789_05ss] Where does this syntax come from?
  381867 [b.candler@po] from (irb):2:in `initialize'
  381868 [steve@st ve ] ...
  381870 [adgar@ca bo ] Interesting. The default allocation behavior method is removed, and =
  381927 [b.candler@po] So I think the question becomes: why does Object#initialize accept any
  381944 [jeremy@bo p.] It seems that it was a bit of an oversight when the change that

How to use Enumerator::Generator in Ruby 1.9.2
381824 [yimutang@gm ] There's a class called Enumerator::Generator in Ruby 1.9.2, and it seems
+ 381828 [shortcutter@] Cheers
| 381837 [johannes.hel] But this can be achieved easier, as e.g. (0..9).cycle already returns an
| 381838 [shortcutter@] Yes, but please note that #cycle was not used in the example posted by
+ 381843 [yimutang@gm ] e = Enumerator.new do |y|
| 381864 [bbxx789_05ss] It's that y thing, and it knows how to provide values to the enumerator
+ 381883 [yimutang@gm ] May I think like this, Enumerator.new is a short way, including two

How can I do the dictionary?
381833 [ploy.sukacha] I am a newbie but I'm familial with C#.
+ 381835 [zhiqiang.lei] ...
+ 381866 [bbxx789_05ss] my_hash = {

irb problem
381845 [sidney.reill] Hey ...
381844 [sidney.reill] #$%**&&^K

Calling a custom Ruby C extension method from other C extension
381872 [ibc@al ax ne] ext/my-exten/
381918 [hanmac@gm .d] in your my-exten use "extern String_headerize( args );"
381919 [ibc@al ax ne] Thanks a lot. I prefer method 1 (as I expect is faster than method 2).

assert_name doesn't exist as a function?
381880 [xandrani@gm ] == START ==
+ 381881 [xandrani@gm ] require 'test/unit/assertions'
| 381904 [b.candler@po] "require" means "go and load this ruby source file, if you've not loaded
+ 381940 [bbxx789_05ss] In ruby 'hello' and 'hello' are not *the same*.  Quotes serve as a
  381951 [b.candler@po] That would explain it if assert_same raised an AssertionFailedError. But

Can I check contain value in hash?
381886 [ploy.sukacha] I have hash which is contain list of string value.
381900 [jgabrielygal] You can try the code. A similar approach to the c# above could use
381903 [b.candler@po] For some applications,
381905 [shortcutter@] My first choice would be to use Set and not Hash as values.
381929 [b.candler@po] OK, although Set is really just a thin wrapper around Hash(*), and I
381979 [shortcutter@] In this case the difference is probably rather small but generally I

using hash keys as object name
381891 [neubyr@gm il] fruits = {"apple" => ["green", "red"], "melons" => ["water", "musk"] }
+ 381898 [shortcutter@] sk"] }
| 381953 [neubyr@gm il] Thanks for the help Robert. Following is a scenario I am trying to implemen=
| 381982 [shortcutter@] There is no need to create local variables for these File objects - in
| 382081 [neubyr@gm il] Thanks a lot for explaining the basics.. Changed the implementation.
+ 381948 [bbxx789_05ss] fruits = {"apple" => ["green", "red"], "melons" => ["water", "musk"] }

[ANN] test-loop 12.0.0
381892 [sunaku@gm il] test-loop - Continuous testing for Ruby with fork/eval

Extended deadline;	IFIP sponsorship: IFIP Working Conference on Domain-Specific Languages
381893 [emilie.balla] IFIP Working Conference on Domain-Specific Languages (DSL)

Nokogiri parsing question
381897 [haebooty@ya ] Nokogiri, and from my reading online I cannot find the proper way to
+ 381899 [shortcutter@] n",
+ 381932 [haebooty@ya ] Thank you for the reply Robert; however, I cannot get it to work still.
  + 381950 [jgabrielygal] The problem is that the attribute pos has a different namespace (exp), I
  + 381981 [shortcutter@] le

Preparing the basic GUI
381901 [passionate_p] I want to write a small text-editor in Ruby for learning the basics. I
+ 381907 [jakekaiden@y] every toolkit is quite different, and so the help you're looking for
| 381908 [passionate_p] I am tweaking with Shoes, but it has very little documentation.
| + 381910 [josh.cheek@g] I have found that the book it has is very nice and pretty thorough (
| + 381912 [steve@st ve ] Hey Rubist-
+ 381909 [jakekaiden@y] i'm not too familiar with shoes, but these posts might be useful for

splitting binary data
381902 [hroyd@ma li ] First post (i am new to ruby :-)). Can you help?
+ 381945 [bbxx789_05ss] I'm not seeing that.  Your message starts with the delimiter, so the
| 381992 [ibc@al ax ne] p str.split(pattern)
| 382009 [bbxx789_05ss] puts RUBY_VERSION
| 382013 [ibc@al ax ne] Interesting, I also use 1.9.2, but have realized that it fails under
| 382016 [bbxx789_05ss] I never use irb like interfaces in any language anymore--they are unreliable.
| 382192 [nobuoka@r- e] On ruby 1.9, a String object knows the encoding of itself.
+ 381991 [hroyd@ma li ] Thanks for the reply, that works
  382010 [bbxx789_05ss] pattern = "\xFF" * 16

How to access and send data to .net webservice using ruby
381911 [mohansc1001@] I'm developing application in ruby which access webservice
381914 [jgabrielygal] What kind of web service is it? SOAP? I've seen people asking

Control characters in ruby
381915 [arun.einstei] I wanted to know how to accept control characters such as ESC, F1,
381916 [shyouhei@ru ] (hint: Ruby is written in C)
381943 [arun.einstei] Thank you so much. The solution for my case lies in ncurses or related
381957 [shyouhei@ru ] FYI ruby has standard library support for curses.  I don't know if Suse ships

[ANN] test-loop 12.0.1
381933 [sunaku@gm il] test-loop - Continuous testing for Ruby with fork/eval

String problem
381934 [cyril_jose@y] I am trying to read characters in a string but I want to ignore the
+ 381935 [hanmac@gm .d] str = ">Hello World\n"
| + 381936 [cyril_jose@y] Forgot to mention that I have a bunch of these types of strings of all
| | + 381938 [code@ap th o] That shouldn't be affected by the length of the string.
| | + 382080 [shortcutter@] Hans's suggestion does work with different length strings
| + 381939 [code@ap th o] Okay, yeah . . . that's probably better than either of the two options
+ 381937 [code@ap th o] There are probably a dozen ways to do that, but how you do it probably
+ 382036 [cyril_jose@y] Thanks guys. Found what I was looking for.
+ 382077 [w_a_x_man@ya] ">Hello World\n"[ /.(.*)/, 1]

Ruby app core dump on shutdown
381941 [gschoep@di i] So my work computers are down for part of the day I thought I would post
+ 381947 [sophrinix@gm] I can has coredump in form of gist (github gist.. or pastie) please?
+ 381949 [rogerpack200] does gdb help at all in this case?
  382024 [matobinder@g] This is where I don't think gdb is helping me out, the first point where

Binary file: SAT
381955 [bomastudio@g] confused..... I need to  "read" in a text file (a *.dxf file) a block of
+ 381962 [bbxx789_05ss] Both numbers and characters are stored as integers in file(or anywhere
| 381965 [bbxx789_05ss] str = "\x00\x00\x00\x61"  #97 in hex, taking up 4 bytes
| 381969 [roger@ro er ] It's the correct result. L uses your systems endianness, which seems
| 381984 [bomastudio@g] Thanx you all. I'm beginning to understand a bit....
| 382011 [bbxx789_05ss] Binary files aren't human readable, i.e. they look like nonsense.
| 382062 [bomastudio@g] That's OK. but the file I need to parse is a special txt file (DXF
| 382075 [bbxx789_05ss] Binary files do not have lines.  Until you can understand that, you
| 382099 [wruyahoo05@c] Its not to helpful to someone trying to deal with DXF files to make such
+ 382014 [bbxx789_05ss] The four bytes could represent the number of widgets sold (=1).

On the Capitalization of Project Files
381958 [transfire@gm] I have noticed a trend with regards to the case of project files. In
+ 381959 [spoon@ki le ] COPYING is used for GNU things, though I don't know why.
| 381968 [code@ap th o] While none of them are GNUish, I've taken to using a COPYING file in some
| + 381980 [now@bi wi se] Agreed.  LICENSE was not invented here, though, so that may be a factor°ń*sigh*
| | 382000 [code@ap th o] Are you referring to the NIH principle of bad engineering in general, or
| + 382002 [transfire@gm] me
|   + 382003 [code@ap th o] Whether just referencing the license location online, et cetera, would be
|   + 382004 [cmdjackryan@] The web is ephemeral, and so are links. Hosting disappears (or moves
+ 381961 [spoon@ki le ] Sorry I just realized that wasn't what you were asking, forgive me.
+ 381967 [jakekaiden@y] purely out of curiosity, and you'll have to forgive me because i have

creating a simple executable jar containing ruby code
381960 [zen_t@ho ma ] I'm a relative noobie ruby dev and I was poking around with rawr. I
+ 381963 [zen_t@ho ma ] Sorry, just to add that I did try to run the jar file with
+ 382018 [zen_t@ho ma ] Alright I was able to solve the mystery and got it to work. It was a

Stanfordparser (or rjb) error on Snow Leopard
381964 [borislavd@gm] I'm having trouble getting stanfordparser to work under Snow Leopard. It
382446 [nogara@gm il] I also followed the instructions of the blog post you mentioned, and

How to set default value to the key in YAML?
381971 [ploy.sukacha] In case I have a key which comes with dictionary values but I also need

Using the spaceship operator
381973 [RichardDummy] Here an abstract version of my app, in which I have an array of two-
+ 381974 [johnf@bi sb ] Instead of doing it that way, consider using sort_by instead to sort
+ 381988 [b.candler@po] Your way *can* be made to work, but it's ugly.
| 382008 [bbxx789_05ss] In other words, your spaceship operator only gets applied to objects of
+ 381998 [RichardDummy] On Apr 21, 12:13=A0am, RichardOnRails
| + 382012 [b.candler@po] No. I only redefined <=> within the class MyElement, so it only affects
| + 382035 [josephjones3] ...
+ 382034 [RichardDummy] 7stud: Thanks for your (comforting :BG) explanation
  382195 [b.candler@po] And a slightly tidier way is to use 'map' (aliased as 'collect') which

[ANN] clogger 1.0.0 - configurable request logging for Rack
381975 [normalperson] Clogger is Rack middleware for logging HTTP requests.  The log format

Hello Sweet Friends
381976 [eaglebalti@g] Friends . What are you looking for? Just visit the folowing link and

[ANN] unicorn 3.6.0 - HTTP server for fast clients and Unix
381978 [normalperson] Unicorn is an HTTP server for Rack applications designed to only serve
382225 [normalperson] That was broken and made the problem worse, do this instead (or upgrade

error: undefined method
381983 [ploy.sukacha] I create a method named splitDot which is spliting a dot "."
+ 381985 [b.candler@po] Yes - make a standalone minimal program which demonstrates the problem.
+ 381986 [ploy.sukacha] Yeah, I'm sorry. Actually, I mean the code is
  381996 [g.diemant@gm] It seems that you call splitDot as class method and not inside another

[ANN] R2CORBA 1.1.0 released.
382017 [mcorino@re e] Remedy IT is pleased to announce the release of version 1.1.0 of

class_eval doesn't find const_missing
382019 [andrew.berke] I am trying to write a DSL which uses method_missing and const_missing
+ 382025 [b.candler@po] class Object
+ 382026 [stephenp@ag ] Const lookup varies between 1.8, 1.9.1, and 1.9.2.
| 382031 [bbxx789_05ss] DummyClass.class_eval do
+ 382028 [bbxx789_05ss] DummyClass.class_eval {const_missing :ANOTHER_CONSTANT}
| 382033 [bbxx789_05ss] As one person replied, constants are looked up by the parser, so their
+ 382079 [andrew.berke] Thanks People - very helpful and seems pretty clear what's going on

AIX5.3: SEVER ERROR: Sybol C_BSTAT from make
382021 [artlee@sb gl] The symbol refers to a csect with symbol number 0, which was not

Re: AIX5.3: SEVER ERROR: Symbol C_BSTAT from make
382022 [artlee@sb gl] The symbol refers to a csect with symbol number 0, which was not
382023 [artlee@sb gl] The symbol refers to a csect with symbol number 0, which was not

[ANN] test-loop 12.0.2
382027 [sunaku@gm il] test-loop - Continuous testing for Ruby with fork/eval

Re: chomp behaviour
382029 [josephjones3] ...
382030 [sduncan@we a] You are obviously not a *nix user ;]

possibly safe usage of Thread#raise?
382032 [normalperson] I've rewritten and heavily commented the ThreadTimeout middleware of

Is there any good Ruby GTK tutorial
382037 [mindaslab@gm] I know Ruby very well and I use Ubuntu. The obvious choice for me is to
+ 382072 [matobinder@g] Go to
+ 382074 [shevegen@li ] There is not a really up-to-date tutorial.
+ 383038 [edmond.kacha] 2011/4/22 Karthikeyan A k <mindaslab@gmail.com>
+ 383049 [jakekaiden@y] the documentation can be slow to load, but as Grant mentioned - simply
+ 383133 [jakekaiden@y] check out Vincent Carmona's ZiK player too for a great sample of gtk2

Parsing text
382038 [cyril_jose@y] Hey all,
+ 382039 [wishdev@gm i] Good Afternoon,
+ 382041 [bbxx789_05ss] A pipe is one of the special regex characters--it does not stand for a
+ 382042 [cyril_jose@y] Thanks John and 7stud - I have a better understanding now.

[ANN] Inochi 6.0.0
382040 [sunaku@gm il] Inochi

Reversing a string without using array, classes and reverse function
382043 [passionate_p] mystring = gets
+ 382044 [spiralofhope] Here's something I stumbled through which seems to work.
| 382047 [passionate_p] I attempted below given code, but it is neither displaying result nor
| 382053 [josecalderon] #!/usr/bin/env ruby
| + 382057 [stu@ru yp og] very nice I like the use of your math. By multiplying the array index
| | 382058 [stu@ru yp og] One more with ruby blocks (This would be the ruby way =3D) )
| | 382060 [larrylv1990@] #!/usr/bin/env ruby
| + 382067 [passionate_p] Thanks all for brilliant examples.
+ 382056 [stu@ru yp og] Simple =)
+ 382061 [robert.dober] What about
| 382070 [josecalderon] @Robert: Thanks, Cheers
| 382082 [b.candler@po] I'm surprised nobody has yet shown using 'inject', as for once it makes
| 382087 [robert.dober] that was mean ;)
+ 382063 [hanmac@gm .d] why without reverse functions?
+ 382066 [list.push@gm] s = "I am a string."
| + 382068 [spiralofhope] Oh, of course!  This makes a lot of sense to me..
| + 382069 [passionate_p] @Harry,
+ 382100 [josh.cheek@g] Thought I'd join the fun :)
  + 382101 [dukeofperl@m] [snip the good stuff]
  + 382103 [adam@ap es o] I feel a benchmark coming, of all the suggestions so far. :)

[ANN] Rumai 4.1.2
382045 [sunaku@gm il] Rumai

[ANN] Inochi 6.0.1
382046 [sunaku@gm il] Inochi

dump in yaml & unexpected result
382048 [ploy.sukacha] I have a Hash which value is Array of Hashes. And I expected to generate
382071 [aaron@te de ] Can you provide the code you're using to produce this YAML?

Can I append hash to hashes?
382049 [ploy.sukacha] Member => {email => Email, name => Name, lastname => Lastname}
+ 382051 [cidza@ti .i ] maybe I cannot understand your problem (?)
+ 382054 [sutniuq@gm .] Have a look at the Hash#merge and Hash#merge! methods.
| 382055 [ploy.sukacha] Actually, I need to do like in array which I can use << to assign more
| 382059 [robert.dober] Sure there are two ways, the destructive one, in which the receiver is
+ 382064 [ploy.sukacha] thanks Robert, it works.