168719-173263

168549-170827 subjects 168905-195288

PrettyPrint Array  ?
168719 [janchrister.] I'm trying to make my own simple assert, but have problem displaying
+ 168723 [m.fellinger@] charset="utf-8"
+ 168749 [rosco@ro co ] I'm not sure if this is what you're after, but if it's just about the
  168808 [janchrister.] No, I do not want to hide the difference.

Strange crash (interpreter bug?)
168720 [sylvain.joye] I was trying to fix the busy_handler of the sqlite3. (version 1.1.0 makes
168747 [pan@er kv en] If you call the first busy_handler without a block, cb isn't
168766 [sylvain.joye] Does not seem so ... The code does run. The problem is a *crash* (i.e.
+ 168768 [pan@er kv en] You asked about the difference between the two functions, not
+ 168852 [decoux@mo lo] I don't know what is a crash. Can you give a *small* example to reproduce

How to use Net::SSH for piping?
168721 [ilmari.heikk] 1. Started an SSH session to a remote host using Net::SSH
168739 [ilmari.heikk] I went with using IO.popen("ssh #{host} #{create_proxy_script_for(filename)}")

Fwd: [SOLUTION]
168729 [james@gr yp ] ...

"disallow sticky world writable directory in PATH": Why?
168731 [pan@er kv en] file.c (path_check_0): disallow sticky world writable directory in PATH (and $LOAD_PATH). [ruby-dev:27226]
+ 168735 [ara.t.howard] $VERBOSE = nil
| 168738 [pan@er kv en] I noticed that the check on ENV["PATH"] is done only once (see
+ 168755 [zedshaw@ze s] I didn't write it or have anything to do with it, but it's done because
| 168774 [pan@er kv en] If /tmp is a sticky directory (it is) and /tmp/$APP.$$.tmp is
+ 168893 [matz@ru y- a] Warning condition may be too loose.  Let me re-consider, although it's

Re: Weird Numbers (#57) Solution
168734 [hcatlin@gm i] James,
168748 [hcatlin@gm i] Mine's *really* fast up to 3,963,968.... then it slows down just a
168751 [leavengood@g] Except your solution is missing tons and tons of valid weird numbers.
168781 [hcatlin@gm i] Which ones are missing?
+ 168783 [hcatlin@gm i] I did mine with a good dose of humor.
| + 168786 [hcatlin@gm i] Ryan-
| + 168787 [james@gr yp ] It is a valid technique.  It can probably be used to make the fastest
| + 168791 [leavengood@g] Hehehe, I could see that a bit.
|   168795 [hcatlin@gm i] I'm from Jacksonville originally, but now live in the cold tundra of
|   168806 [janchrister.] Weird Numbers (#57) Solution
|   + 168811 [leavengood@g] Thank you for the compliment and for catching the error. It seems
|   + 168818 [levin@gr nd ] def sum_in_subset?(div = self.divisors)    return false if self < 0    return false if div.empty?    return true if div.include?(self)
|     168821 [leavengood@g] that. But the above is still pretty nice, and certainly more succinct.
|     168834 [pine29@my as] Wow, I got a lot from looking at the other solutions. Thanks especially
|     168840 [adam.shelly@] Here's mine.
+ 168788 [leavengood@g] Just up to 100,000 you are missing 191 weird numbers. Run my, Rob or
  168790 [hcatlin@gm i] I realized it was a list of primitive weird numbers instead of weird

Weird Numbers (#57) Solution
168752 [horndude77@g] Here's my solution. It looks pretty close to others. Not too fast, but
168773 [pine29@my as] #!/usr/bin/env ruby

When to use : before variables?
168754 [daniel@vo lk] after looking at rails and the pickaxe book (not totally red yet, just
+ 168756 [leavengood@g] Look up Symbols. The colon (:) is used to create them.
+ 168757 [mark.ericson] ...
  168762 [daniel@vo lk] Thanks a lot. That are these kind of programming constructs I've to

Fuzzy Searching a Database
168760 [tomrossi7@gm] How would you recommend implementing something like a fuzzy search with
+ 168761 [rdm@cf l. om] Soundex is a phonetic algorithm for indexing names by their sound when
| 168796 [steve@wa ts ] Also worth mentioning is that many database systems have Soundex
+ 168792 [hcatlin@gm i] Just make Kit screen all of the queries. Get her a blackberry and email
+ 168794 [vanek@ac .n ] this was discussed on both this ML and the Rails ML about a week ago. The
| 168797 [w3gat@nw ag ] I needed to do something similar with my office database.  I used the
+ 168812 [Paul.McArdle] see fulltext searching at mysql.com.
  168829 [ben@fa ts li] /How would you recommend implementing something like a fuzzy search with
  168835 [hsanson@mo g] check http://ferret.davebalmain.com/api/files/TUTORIAL.html

Getting Over Symbols
168763 [gwtmp01@ma .] When I was first learning Ruby, symbols were a bit of a mystery.
+ 168765 [james@gr yp ] It's my opinion that Rails complicates this issue quite a bit, with
| + 168775 [rosco@ro co ] It took your describing it so before I saw that symbols aren't nearly as
| + 168819 [levin@gr nd ] Interesting.  I always think of them as a Number with an arbitrary value.
+ 168769 [dblack@wo bl] 1. Confusion between Symbol objects and symbols in the sense of
| 168779 [gwtmp01@ma .] When you define an instance method you are adding an entry to the
| 168782 [dblack@wo bl] I understand -- but what I meant was, there's no situation where you
| + 168785 [gwtmp01@ma .] Agreed, but in a static language (yes, I know that is a fuzzy
| + 168849 [sean.ohalpin] No, but you could do Symbols.all_symbols.each do {}  ;)
| + 168940 [ruby.brian@g] Ah, have they finally released the new version? Where can I find the changelog?
+ 168800 [iamkris@gm i] Very interesting post to a newbie like me. Coming from a "C" family of
+ 168814 [transfire@gm] The : (colon) notation doesn't help eithrr. Given the other prefixes
+ 168844 [gwtmp01@ma .] Speak of the devil...
+ 169043 [ruby-forum-r] The most common confusion I have seen is the mistaken understanding

WWW::Mechanize speed
168767 [narf968@gm i] I found the Ruby version of the following script is half as fast as the
168770 [leavengood@g] It is most likely the HTML parsing that is slowing things down. Does

Automatic trace utility.
168776 [  kyku@os pl] ...
+ 168789 [transfire@gm] There's #set_trace_func built-in to Ruby. Or for a more complete
| 168854 [  kyku@os pl] Quite nice, but how about auto-magical tracing of passed arguments.
+ 168853 [snail@ob me ] Ruby Bug Validator does all of the above and can apply filters and also

Deleting object inn array, if...
168801 [henrik.ormas] I have an array witch contains the id of living objects. I want to
+ 168802 [neoneye@gm i] how about ?
| 168803 [neoneye@gm i] Argh.. realized that you wanted x.var_of_x to be deleted.
+ 168804 [gwtmp01@ma .] Do you mean that you are actually storing the object_id of a Ruby
  168807 [henrik.ormas] Thanks for the fast replay's, I'm impressed :-).
  + 168828 [toddkennethb] <irb(main):001:0> class Item
  + 168845 [bob.news@gm ] irb(main):020:0* a=Item.new "a"

[ARTICLE] XML Transformations using REXML
168813 [james_b@ne r] Toot toot!
+ 168815 [jcribbs@tw i] Congratulations!
+ 168816 [steve@wa ts ] Nice job James!
+ 168823 [lyndon.samso] ...

What a response!
168822 [dabhar1959@h] Thanks everyone for your overwhelming input!
168860 [rasputnik@gm] Course. You can just run a webserver on your laptop.
168909 [julesjacobs@] You can wrap your application in one .exe (you don't even need a

Filling PDF Forms
168837 [kevin.olbric] Are there any Ruby utilities out there for filling out PDF forms?
168895 [pfharlock@ya] ...
168910 [kevin.olbric] While this is helpful, it does not solve my problem.
168915 [halostatue@g] You are correct. I am not sure when or if this will be possible with
171184 [mjfreshyfres] I'm looking for this same functionality myself. Please post if/when you
173263 [mjfreshyfres] Just to follow up on this...

Ruby :symbols and C *pointers are related?
168838 [petermichaux] I'm still trying to grasp exactly what symbols are. I am getting a
+ 168839 [halostatue@g] No. Symbols are just names--they can be considered immutable immediate
+ 168841 [dido.sevilla] Not at all. The truth can hardly be further from your understanding.
| 168843 [billk@ct .c ] Except that, when testing for equality, comparing two symbols
+ 168842 [dave@bu t. d] I think the closest link between C pointers and symbols is that C strings
+ 169804 [petermichaux] Thanks for all the responses.
  + 169811 [nightphotos@] Symbols are immediate values, so they are stored in a 32 bit integer.
  + 169814 [dooby@d1 .k ] An int is the key into a table which holds the name.
  + 169815 [mental@ry ia] Integers.

ruby ferret question -> how to get list of values for a given term ?
168846 [didier.proph] So I have a ferret question. Suppose I have a bunch of documents I
168850 [dbalmain.ml@] Something like this. I don't have time to test it but it should be pretty close.
168914 [didier.proph] Exactly what I needed.

WANTED: Ruby Developer
168847 [stevej@no me] Are you interested in using your Ruby/Rails knowledge to create a

Ruby Tk and DRb
168848 [alexmaster85] can't invoke "wm" command:  application has been destroyed

Ruby debuger on Windows
168855 [theHaPK@ya d] Can somebody point out, why on Windows
+ 168857 [phasis68@ho ] That is due to RUBYOPT environment variable.
+ 168866 [theHaPK@ya d] Oh... figured out myself.. The problem was in RUBY_OPT environment

Oppinions on map vs collect
168858 [pfharlock@ya] I've been using collect in all my programs up till now, and I recently
+ 168862 [rasputnik@gm] I prefer map, since to me that's what it does.
+ 168864 [daniel.schie] I usually use #map if I want to collect the return values generated from
  + 168868 [daniel.schie] Heh, I could've written that a lot clearer, but I'm way too wasted to do so.
  + 168870 [matt.mower@g] I like that convention.  Assuming that it's too late for Matz to
    168875 [daniel.schie] Muahahaha, my evil plan to take over the world has begun! Soon, all will
    168879 [jason.sweat@] Regards,
    168899 [daniel.schie] God damn it! There's always someone who's thought of doing everything

lib for optional static typing
168861 [robert_kuzel] if you, after reading this post, feel the almost unbearable urge
+ 168863 [bob.news@gm ] There is a DbC sample implementation that might be able to do what you
+ 168867 [djberg96@gm ] Regards,
| 168903 [robert_kuzel] ok,
| 169222 [halostatue@g] You will, however, find that such a module and approach gets in your
| 169225 [james@gr yp ] Amen!  I so agree.
| 169639 [robert_kuzel] <sigh>
| 169837 [chneukirchen] The *real* question is where to get a type-system that is flexible
| + 169884 [james_b@ne r] BTW, there is a discussion on the Pragmatic Programmer mailing list
| | 170049 [chneukirchen] Except the archives are only accessible by members, which probably
| + 170057 [robert_kuzel] that is certainly a point of view that many "typed" guys
|   + 170064 [batkins57@gm] Common Lisp supports something like that.  All values are dynamically
|   | 170101 [kyosuke@se n] Well, personally, I really like Common Lisp and its approach. But
|   | 170102 [chneukirchen] Oh, but the time it actually needs to compile and the megabytes of C
|   | 170104 [kyosuke@se n] Well, that's the "static language implementation" part. :-D You cold
|   | 170111 [ruby-ml@ma i] Eivind Eklund had some good ideas regarding type inference loosely
|   + 170065 [djberg96@gm ] Evan Webb mentioned that it would be possible to add a pseudo type
|   | 170068 [dblack@wo bl] s/typing/ancestry-checking/
|   | 170130 [surrender_it] I probably said it many times, but what if we provided real type checking?
|   | + 170135 [halostatue@g] Hm. No. That would end up requiring a significant change to Ruby,
|   | | 170154 [surrender_it] yeah, I'm not really suggesting changing Math.sqrt, just an example.
|   | | 170172 [halostatue@g] Yeah, but it's a perfect example of what's wrong with trying to put
|   | | 170356 [surrender_it] I fail to see how redefining a method is better than defining a
|   | + 170136 [james_b@ne r] What does the words "real", "type", and "checking" means?
|   |   170153 [surrender_it] being not a native english speaker I won't try to explain each single
|   + 170067 [doug00@gm il] See also boo http://boo.codehaus.org/ which has both static
|     170078 [james_b@ne r] I believe JScript.net also gives the choice of dynamic/static typing.
+ 168869 [dblack@wo bl] It sounds like you're more interested in class/module ancestry than type.
+ 170260 [eeklund@gm i] I've got an implementation that works more or less like that available

increasing counter whithin loop?
168871 [clr9.10.rand] a very basic question...
+ 168872 [simon.kroege] a.inject(false) do |skip, elt|
| 169036 [dbatml@gm .d] Here is another (not really nice) way to do it, using the flip-flop
+ 168873 [pavel.s.soko] a=%w( a b c d e )
+ 168874 [bob.news@gm ] => ["a", "b", "c", "d", "e"]
+ 168876 [malte__@gm -] I do not know whether I understood correctly what you want, but you could
| 168877 [decoux@mo lo] try it, with
| 168890 [malte__@gm -] Huh. Right. So it becomes
| 168894 [james@gr yp ] next if i > 0 and array[i - 1] == :b
+ 168881 [neil@ha ub .] array = [1, :skip, :hidden, 2, :skip, :hidden, 3, :skip]
+ 168892 [pfharlock@ya] a = ["a", "b", "c", "d", "e"]
+ 168897 [rjseagraves@] Maybe I'm just being thick, but wouldn't it just be easier (and much
+ 168911 [clr8.10.rand] thanks for the answers. I have been very unclear what I wanted, but
  169271 [martindemell] I'd use Gary Watson's method, and cache the last seen element, rather
  169294 [transfire@gm] Maybe I missed something.
  169322 [clr9.10.rand] You missed to read my mind; my explanation was very unclear. I wanted
  169350 [mental@ry ia] It's probably helpful to realize that Ruby has no for-loop in the
  + 169369 [blargity@gm ] If you're really tied to the traditional for loop, you can use a while loop
  | 169412 [clr9.10.rand] That is exactly what I am trying to find. I have a list (Array) of
  | + 169418 [blargity@gm ] No, you can manipulate the counter just fine, just that it won't persist for
  | | 169444 [clr9.10.rand] [for i in ..... end ]
  | | 169450 [mental@ry ia] Well, let's assume we've got persistence.  What would you expect
  | | + 169541 [clr10.10.ran] infinite loop.
  | | + 169560 [clr10.10.ran] ok, rethinking and withdrawing my answer....
  | + 169432 [mental@ry ia] for counter in 0...element_size
  |   169445 [clr9.10.rand] OK, then it makes sense that one cannot manipulate counter. But IMO it
  |   + 169459 [mental@ry ia] Maybe think of it like foreach in TCL [ foreach i $things { ... } ],
  |   | + 169473 [leavengood@g] Beautifully said, and most true. I think your each_with_prev is the
  |   | | 169508 [phurley@gm i] +1
  |   | + 169549 [clr9.10.rand] Hmm, I don't know tcl nor JS well enough.
  |   |   + 169553 [simon.kroege] Hmm, I still don't know exactly what you realy want/need. If you just
  |   |   | 169555 [simon.kroege] require 'enumerator'
  |   |   | + 169559 [clr10.10.ran] That's interesting, thanks.
  |   |   | + 169566 [slitt@ea th ] I just ran your code, and got the exact output you got, but I don't understand
  |   |   |   169607 [james@gr yp ] One interesting technique when you are struggling, is to ask Ruby
  |   |   + 169562 [mental@ry ia] I think you could implement something like that via a customized each
  |   |     170228 [clr10.10.ran] Your two solutions are very nice, thank you. I think I'll go for the
  |   |     170236 [mental@ry ia] Cool.  Note that (per the recent thread with Matz) I was wrong about
  |   |     170454 [clr10.10.ran] 'this can't happen'
  |   + 169532 [blargity@gm ] Don't base your sense of "intuitive" on other languages.  It is more intuitive
  |     169542 [clr9.10.rand] ? How else should I expect a behaviour, if not from other languages?
  |     169610 [blargity@gm ] Perhaps how Ruby defines the construct, since it's not another language?
  |     169616 [simon.kroege] actually these aren't variables but values, symbols to be
  + 169397 [clr9.10.rand] Yes, but when writing 'for i in x ... end' I'd expect a for-loop :-)

RCRchive back up
168880 [dblack@wo bl] I'm slowly piecing things together post-crash -- luckily very little

Can I set a module context for a block?
168882 [drjflam@gm i] ...
+ 168883 [neil@ha ub .] def self.create(name)
| 168885 [neil@ha ub .] [something wrong]
+ 168884 [bob.news@gm ] module Bob
  168886 [drjflam@gm i] ...

[ANN] Rote 0.2.4 (Textual templating, Doco)
168896 [rosco@ro co ] Well, I've been learning *a lot* from this group, and of course I've kept
168912 [lthiryidontw] Only one 'r' to 'thiry', please! ;)
168916 [rosco@ro co ] Lionel, what can I say... My sincere apologies, my hands don't seem to be
169073 [lthiryidontw] Don't worry that much! :) There is no offense! :)
169081 [rosco@ro co ] Phew! Thanks for being so cool about it - many wouldn't be so forgiving :)

Gem install error
168902 [transfire@gm] trans@ubixie:/usr/local/lib/site_ruby/1.8$ sudo gem install
168904 [tom@in oe he] Hm, I was able to install it just now... perhaps the mirror was down for
+ 168913 [rosco@ro co ] (not complaining!)
| + 168917 [rosco@ro co ] I'm not actually drunk, I just sound it.
| + 168928 [tom@in oe he] It's odd... because the files are just rsync'd from one machine to
|   169014 [jpb@Ap sS ek] Oddly, I just got a 300 Error
+ 168921 [transfire@gm] Okay, I tried it three more time (after the three before) and it
  168925 [tom@in oe he] Super!
threads.html
top