<?xml version="1.0" encoding="UTF-8"?>

<rdf:RDF
 xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
 xmlns="http://purl.org/rss/1.0/"
 xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/"
 xmlns:dc="http://purl.org/dc/elements/1.1/"
 xmlns:syn="http://purl.org/rss/1.0/modules/syndication/"
 xmlns:admin="http://webns.net/mvcb/"
>

<channel rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/ruby-talk">
<title>ruby-talk archive @ ASPN</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/ruby-talk</link>
<description>Discussion about the ruby programming language</description>
<dc:language>en-us</dc:language>
<dc:rights>Copyright 2005, ActiveState</dc:rights>
<dc:publisher>aspn-feedback@activestate.com</dc:publisher>
<dc:creator>aspn-feedback@activestate.com</dc:creator>
<dc:subject>ASPN Mail Archive</dc:subject>
<syn:updatePeriod>hourly</syn:updatePeriod>
<syn:updateFrequency>1</syn:updateFrequency>
<syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
<items>
 <rdf:Seq>
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173807" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173806" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173797" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173796" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173786" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173785" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173766" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173765" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173753" />
  <rdf:li rdf:resource="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173752" />
 </rdf:Seq>
</items>
<image rdf:resource="http://ASPN.ActiveState.com/ASPN/img/logo_78x25.gif" />
</channel>

<image rdf:about="http://ASPN.ActiveState.com/ASPN/img/logo_78x25.gif">
<title>ruby-talk @ ASPN Mail Archive</title>
<url>http://ASPN.ActiveState.com/ASPN/img/logo_78x25.gif</url>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Browse/Threaded/ruby-talk</link>
<dc:creator>G. Raphics (graphics @ ActiveState)</dc:creator>
</image>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173807">
<title>Re: RailsForge</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173807</link>
<description>&lt;PRE>On Jun 22, 2006, at 12:32 PM, James Britt
wrote:
> transfire@... wrote:
>> pat eyler wrote:
>>> I already worry about the growing separation between the RoR and
>>> Ruby communities.  I'm afraid that a distinct RailsForge would only
>>> exacerbate the problem.
>> Growing separation? Huh. That's interesting. I worry about similar
>> idea, I think, but from a different perpective. I worry that Rails is
>> consuming Ruby and that in time Ruby may loose most of it's	
>> identity as
>> a language akin to Perl, say. And instead become thought of more like
>> PHP.
>
> Not an unreasonable concern.	  But the sense I get in my part of  
> the world is that there really is a separation, with people who  
> only know Ruby as Rails, and other people who use Ruby, but have  
> only a passing interest in Rails.

 From my part of the world, I see a slurry. I trust it continues to  
melt. I've heard many a Railsista wax eloquent on the allure of their  
ruddy new gem - some of these folks are just brimming.

Ruby fossils are right to be wary: maybe the invaders aren't so nice?  
or are too leechy or inane to tolerate? (e.g. ruby-forum slouching  
toward content-freedom.)

But, that joyfulness! It's in them too and those who love it are  
exploring why.

jeremy
&lt;/PRE></description>
<dc:creator>Jeremy Kemper (jeremy@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173806">
<title>Re: Randomly select an element from an array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173806</link>
<description>&lt;PRE>On Jun 22, 2006, at 21:46, David Solis wrote:

> I have an array:
>
> [1,2,3,4,5]
>
> How do I randomly select an element from the array?

irb(main):001:0> a = %w(foo bar baz)
=> ["foo", "bar", "baz"]
irb(main):002:0> a[rand(a.length)]
=> "bar"

-- fxn
&lt;/PRE></description>
<dc:creator>Xavier Noria (fxn@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173797">
<title>Re: Turning an Array into a Hash based on an attribute value</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173797</link>
<description>&lt;PRE>On Jun 22, 2006, at 8:25 pm, Simen Edvardsen wrote:
> Hash[*self.map{|m|m.send(method).to_s.to_sym}.zip(self).flatten ]

> Disclaimer: inject is probably more appropriate, but my solution at
> least looks cooler ;)

Simen... you don't come from a Perl background do you ;)


On Jun 22, 2006, at 8:09 pm, Simon KrÃ¶ger wrote:
> class Array
>   def hash_on(method)
>     inject({}){|h, i| h.merge({i.send(method).to_s.to_sym, i})}
>   end
> end

I like!


On Jun 22, 2006, at 8:05 pm, Louis J Scoras wrote:
> I'm not sure of the api--i.e.: this is untested--but why not something
> like this:
>
> particular_item = DataItem.find_by_identifer("my_identifier")
> particular_item.do_something
>
> This is the sort of thing that databases are good at.

It avoids hitting the database every time - if there are 500 items in  
the list I'd rather get them all out at once than hit the server 500  
times.


Thanks for the replies people.


Incidentally... what is the convention here on CCing posters in  
replies?  I come from the FreeBSD lists where it's normal to CC the  
poster so they don't have to check the list.  But people on Ruby  
lists are really surprised when I do that.
&lt;/PRE></description>
<dc:creator>Ashley Moran (work@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173796">
<title>Randomly select an element from an array</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173796</link>
<description>&lt;PRE>I have an array:

[1,2,3,4,5]

How do I randomly select an element from the array?

-- 
Posted via http://www.ruby-forum.com/.
&lt;/PRE></description>
<dc:creator>David Solis (dsolis@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173786">
<title>Re: ruby-lang.org redesign?</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173786</link>
<description>&lt;PRE>> &lt;chuckle> subvitamine.com gives me a blank screen with a "must
> download latest version of shockwave flash to see this site".
> 
> In context, the best laugh I've had all week.


I get a low contrast page squeezed to the far left of my browser
window. Part of the loading window is still visible on the right
(yes my laptop has a high resolution). There is no way (i can see)
to copy e.g. the contact info or other data i would like to safe.
Bookmarking anything but the index is impossible. Its a dot.com
site with (obviously) no english text on it (except the captions)
and no way to change that.

Btw: Ever heard of 'Barrier-Free Web' ?

Simon
&lt;/PRE></description>
<dc:creator>Simon Kröger (SimonKroeger@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173785">
<title>Re: Accessing the raw/un-html-ized CGI parameters</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173785</link>
<description>&lt;PRE>>>> sender: "Simen Edvardsen" date: "Fri, Jun
23, 2006 at 02:03:55AM +0900" &lt;&lt;&lt;EOQ
> What is this? Webrick, Mongrel, Rails, etc. Difficult to help if we
> have no idea what libraries you are using.
Thanks for trying :) and sorry for being so vague.
I am using Apache, plain Ruby run as cgi and the standard cgi module,
like this:

require 'cgi'

cgi = CGI.new
cgi['idn-domain-name-here.com'] # == BIG_SURPRISE! :)

I enter this 'qweÅ?lÅ£qwe.com' and get this 'qwe&#351;l&#355;qwe.com'
instead. I solved the problem by using 'htmlentities':
http://htmlentities.rubyforge.org/
which btw, works excellent, but I'd still be interested if there is 
a solution to achieve this just by using the cgi module itself (and 
preventing the encoding in the first place).

Thank you!
Alex
&lt;/PRE></description>
<dc:creator>Alexandru E. Ungur (alexandru@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173766">
<title>Re: Turning an Array into a Hash based on an attribute value</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173766</link>
<description>&lt;PRE>Disclaimer: inject is probably more
appropriate, but my solution at
least looks cooler ;)

On 6/22/06, Simen Edvardsen &lt;toalett@... wrote:
> $ irb
> irb(main):001:0> class Array
> irb(main):002:1>   def hash_on(method)
> irb(main):003:2>
> Hash[*self.map{|m|m.send(method).to_s.to_sym}.zip(self).flatten ]
> irb(main):004:2>   end
> irb(main):005:1> end
> => nil
> irb(main):006:0> [1, "2", :three].hash_on(:class)
> => {:String=>"2", :Symbol=>:three, :Fixnum=>1}
> irb(main):007:0>
>
>
> On 6/22/06, Ashley Moran &lt;work@... wrote:
> > A guy I work with has some some work on an ActiveRecord class that
> > basically reads static lookup data, and contains (among other things)
> > an "identifier" attribute.	Given an array of all these objects he
> > wanted to access them by the contents of the identifier attribute, eg:
> >
> > data_items = DataItem.find(:all)
> > # data_items[3].identifier => "my_identifier"
> > data_items[:my_identifier].do_something # => data_items[3].do_something
> >
> > The best I can come up with is this:
> >
> >    class Array
> >	 def hash_on(method)
> >	   method = method.to_sym
> >	   hash = { }
> >	   self.each do |i|
> >	     hash[i.send(method).to_s.to_sym] = i
> >	   end
> >	   hash
> >	 end
> >    end
> >
> >    > [1, "2", :three].hash_on(:class)
> >    => {:String=>"2", :Symbol=>:three, :Fixnum=>1}
> >
> > Is there a neater (one-line?) way I missed?
> >
> > Ashley
> >
> >
>
>
> --
> - Simen
>
>


-- 
- Simen
&lt;/PRE></description>
<dc:creator>Simen Edvardsen (toalett@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173765">
<title>Re: Convert String to BinaryString</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173765</link>
<description>&lt;PRE>Michael stepanov wrote:
> pack is cool, but Template characters I found here - 
> http://www.rubycentral.com/ref/ref_c_array.html#include_qm

You can also use

ri pack
ri unpack

for a quick reference.

-- 
      vjoel : Joel VanderWerf : path berkeley edu : 510 665 3407
&lt;/PRE></description>
<dc:creator>Joel VanderWerf (vjoel@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173753">
<title>Re: ruby-lang.org redesign?</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173753</link>
<description>&lt;PRE>From: "Kyrre Nygard" &lt;kyrreny@...
>
> At 19:46 20.06.2006, Tom Werner wrote:
> 
>>I think the redesign is just what the ruby-lang.org site, and the 
>>Ruby language needs. Ruby is a powerful, contemporary language, and 
>>needs to present an image that portrays this. Little nitpicks about 
>>absolute paths to CSS files and such, while worthwhile to fix, have 
>>nothing to do with the merit of the site design.
> 
> The proposed "image" does not portray any of this.
> 
> The job of a great designer is to see designs from the perspective of others.
> 
> What you think will simply not suffice.

Please tell us what you've learned by seeing the new design from
the perspective of the many people who like it.

> I see from cube6media.com that you are experienced with web design.
> Your talent, however, seems to be more oriented towards programming
> rather than actual design, which is what we are discussing here.
> 
> All the best,
> Kyrre + subvitamine.com

&lt;chuckle> subvitamine.com gives me a blank screen with a "must
download latest version of shockwave flash to see this site".

In context, the best laugh I've had all week.


Thanks,

Bill
&lt;/PRE></description>
<dc:creator>Bill Kelly (billk@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

<item rdf:about="http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173752">
<title>Re: Turning an Array into a Hash based on an attribute value</title>
<link>http://ASPN.ActiveState.com/ASPN/Mail/Message/ruby-talk/3173752</link>
<description>&lt;PRE>$ irb
irb(main):001:0> class Array
irb(main):002:1>   def hash_on(method)
irb(main):003:2>
Hash[*self.map{|m|m.send(method).to_s.to_sym}.zip(self).flatten ]
irb(main):004:2>   end
irb(main):005:1> end
=> nil
irb(main):006:0> [1, "2", :three].hash_on(:class)
=> {:String=>"2", :Symbol=>:three, :Fixnum=>1}
irb(main):007:0>


On 6/22/06, Ashley Moran &lt;work@... wrote:
> A guy I work with has some some work on an ActiveRecord class that
> basically reads static lookup data, and contains (among other things)
> an "identifier" attribute.  Given an array of all these objects he
> wanted to access them by the contents of the identifier attribute, eg:
>
> data_items = DataItem.find(:all)
> # data_items[3].identifier => "my_identifier"
> data_items[:my_identifier].do_something # => data_items[3].do_something
>
> The best I can come up with is this:
>
>    class Array
>      def hash_on(method)
>	 method = method.to_sym
>	 hash = { }
>	 self.each do |i|
>	   hash[i.send(method).to_s.to_sym] = i
>	 end
>	 hash
>      end
>    end
>
>    > [1, "2", :three].hash_on(:class)
>    => {:String=>"2", :Symbol=>:three, :Fixnum=>1}
>
> Is there a neater (one-line?) way I missed?
>
> Ashley
>
>


-- 
- Simen
&lt;/PRE></description>
<dc:creator>Simen Edvardsen (toalett@...)</dc:creator>
<dc:subject>ruby-talk</dc:subject>
</item>

</rdf:RDF>