Re: best coding for limiting a value

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 10:13 PM, Regis d'Aubarede wrote: > A) result=value max ? max : value) > > B) > result=value > if value < min then result= min end > if value > max then result= max end > > C) > [min,max,value].sort[1] "best" according to what metric? Cheers robert -- remember.guy do

Re: faster CSV process only one row!

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 3:25 PM, ajay paswan wrote: > Suppose I have a string s, which is basically a CSV, how can I get it as > array using fastercsv? Or any simple way? How about looking at the documentation? http://rdoc.info/stdlib/csv/CSV robert -- remember.guy do |as, often| as.you_can -

Re: Socket Decorator

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 2:34 PM, Bernhard Brodowsky wrote: > Hi, I am implementing a special kind of socket that takes an io object > (usually a socket) as its argument and then behaves like a socket, but > does some transformations before/after it sends/receives, so in pseudo > code, it could look

Re: Apriori algorithm implementation

2012-09-04 Thread Иван Бишевац
2012/9/1 Bob Hutchison > > On 2012-09-01, at 9:30 AM, Иван Бишевац wrote: > > I am learning Apriori algorithm but have trouble implementing it in Ruby. > I wonder if there is some implementation of Apriori algorithm in Ruby. > > > From a quick google... > > https://github.com/jashmenn/apriori >

Re: What makes Ruby a dynamic language?

2012-09-04 Thread Иван Бишевац
2012/9/1 Uwe Kubosch > On 2012-09-01, at 14:07, Rubyist Rohit wrote: > > > What makes Ruby dynamic and what are those features? > > > The most important feature making Ruby a dynamic language is that you can > alter classes at runtime. In C#, Java, and C++, you compile your classes > and they c

Re: how to sum element of array

2012-09-04 Thread Иван Бишевац
2012/9/4 Edward QU > dear all > > a_array=[2,4,6,8,10] > I want to sum the elements of the array: > 2+4+6+8+10 > how to write the script? > > many thanks! > best regards > Edward > > -- > Posted via http://www.ruby-forum.com/. > > One suggestion. I'm beginner in Ruby too, and I find http://ruby-d

Re: How to get unicode support in ruby

2012-09-04 Thread Иван Бишевац
I don't know what's your concrete problem. Maybe you could try to write: # encoding: utf-8 at the beginning of the ruby file. Source: http://stackoverflow.com/a/2105210/507018 2012/9/4 nandan k. > Hi All, > > > Please let detail description how to achieve unicode support in > ruby. > > Thank

Apriori algorithm implementation

2012-09-04 Thread Иван Бишевац
I am learning Apriori algorithm but have trouble implementing it in Ruby. I wonder if there is some implementation of Apriori algorithm in Ruby. -- You received this message because you are subscribed to the Google Groups ruby-talk-google group. To post to this group, send email to ruby-talk-goo

Re: how to sum element of array

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 10:37 AM, Henry Maddocks wrote: > > On 4/09/2012, at 8:33 PM, Robert Klemme wrote: > >> On Tue, Sep 4, 2012 at 10:19 AM, Edward QU wrote: >>> dear all >>> >>> a_array=[2,4,6,8,10] >>> I want to sum the elements of the array: >>> 2+4+6+8+10 >>> how to write the script? >> >>

Re: how to sum element of array

2012-09-04 Thread Robert Klemme
On Tue, Sep 4, 2012 at 10:19 AM, Edward QU wrote: > dear all > > a_array=[2,4,6,8,10] > I want to sum the elements of the array: > 2+4+6+8+10 > how to write the script? Open the text editor, start typing... Seriously: how would you do it on paper if you would not know beforehand how many items t