RichardOnRails | 1 Mar 2011 01:05

Re: erb example from comp.lang.ruby fails

On Feb 28, 2:38 pm, Sean O'Halpin <sean.ohal... <at> gmail.com> wrote:
> On Mon, Feb 28, 2011 at 7:00 PM, RichardOnRails
>
>
>
> <RichardDummyMailbox58... <at> uscomputergurus.com> wrote:
> > I copied code fromhttp://www.ruby-doc.org/stdlib-1.8.6/(erb package
> > in Table of Contents, ERB in Classes column.
>
> > I edited it only slightly in SciTE and pasted it inhttp://www.pastie.org/1617782
>
> > Running the code from within SciTE 1.74 gave me the error message:
> > (erb):16: undefined local variable or method `priority' for
> > main:Object (NameError)
> >        from K:/_Utilities/ruby186-26_rc2/ruby/lib/ruby/1.8/erb.rb:741:in
> > `value'
> >        from K:/_Utilities/ruby186-26_rc2/ruby/lib/ruby/1.8/erb.rb:741:in
> > `result'
> >        from erb1.rb:43
>
> > I'm running ruby 1.8.6 under WinXP-Pro/SP3
>
> > If there's a easily recognized fix,  I'd like to apply it to this
> > example.  Meanwhile,  I'll try other examples that might both work and
> > suggest a hint at why this example fails.
>
> > Thanks in Advance,
> > Richard
>
> That ".gsub(/^  /, '')" at the end of the template is the clue. It
(Continue reading)

Brian Ledsworth | 1 Mar 2011 01:15
Gravatar

Re: Trying to install pg on 32bit Snow Leopard 10.6

I'm assuming you downloaded and and installed the PostgreSQL client?

I just installed the Gem a few weeks ago and had to add the bin dir to
my path (e.g. /Library/PostgreSQL/9.0/bin) right after I installed the 
client.  Try that if you haven't.

I hope this helps!

Brian

--

-- 
Posted via http://www.ruby-forum.com/.

Ignatz Hafflegab | 1 Mar 2011 04:06
Picon
Favicon

Re: tk canvas drag items

Thank you very much for your reply.  I hope that you didn't feel
obligated because I dropped your name.  It was mentioned because I was
grateful for the samples included in the 1.8.6 Ruby installer.

The plot.rb sample prompted my ambiguous questions. I wanted to
constrain the points to the actual size of the canvas.  When
plot.rb's window is not maximized, a point can be dragged completely off
the canvas.  If it is dragged off the east edge of the canvas, it will
reappear when the window is maximized.  I assume that's because the
canvas is set to FILL X.  However, if a point is dragged far enough off
of the west, north, or south edge when the canvas is not maximized,  it
is consigned to oblivion, and it will not be see again.

What I'm looking for is an example that will confine a selected item
within the boundaries fixed-size canvas while the item is dragged.

--

-- 
Posted via http://www.ruby-forum.com/.

7stud -- | 1 Mar 2011 04:44
Picon
Favicon

Re: why is $1 in a grep() equal to nil?

Eric Christopherson wrote in post #984033:
> On Fri, Feb 25, 2011 at 2:53 PM, 7stud -- <bbxx789_05ss <at> yahoo.com>
> wrote:
>>> worry
>>> about that too, and found out later it was not necessary.
> [...]
>> Uh oh. Someone is going to have to explain that to me. $1 does not act
>> like a regular global variable:
>
> This is getting more confusing for me.

I think your source of confusion is how closures work.  I believe the
following brief example demonstrates what you are seeing in my larger
script:

def do_stuff
  x = 'hello'

  p = Proc.new {puts x}

  x = 'goodbye'

  return p
end

my_callable = do_stuff
my_callable.call

--output:--
goodbye
(Continue reading)

RichardOnRails | 1 Mar 2011 04:45

Re: Comining Arrays

On Feb 28, 4:46 pm, "David J.Hamilton" <gro... <at> hjdivad.com> wrote:
> Excerpts from Paul Sholtz's message of Mon Feb 28 12:31:12 -0800 2011:
>
> > That is, I'm stepping through one array, and then I'm "counting" to keep
> > track of where I am in the other array, so as to "add" the two arrays.
>
> > I know (before calling the routine) that both arrays are of the same
> > size, and that elements of the corresponding arrays will be added
> > together.
>
> Sounds like you want zip.
>
>   %w( a b c ).zip( 1..3 ).each {|l, d| puts "# l:#{l}, d:#{d}" }
>   # l:a, d:1
>   # l:b, d:2
>   # l:c, d:3
>   # => [["a", 1], ["b", 2], ["c", 3]]
>
> --
> med vänlig hälsning
> David J. Hamilton

Hey David,

Neat code,  but I don't get it.

%w( a b c ) yields an instance of class String.

%w( a b c ).zip( 1..3 ) invokes the ostensible zip method of the
String class with a Range instance as an argument.  But String has no
(Continue reading)

Sam Duncan | 1 Mar 2011 05:01
Picon

Re: Comining Arrays

On 01/03/11 16:45, RichardOnRails wrote:
>
> Hey David,
>
> Neat code,  but I don't get it.
>
> %w( a b c ) yields an instance of class String.
>    

ruby-1.9.2-p0 > %w( a b c )
  => ["a", "b", "c"]
ruby-1.9.2-p0 > %w( a b c ).kind_of?(String)
  => false
ruby-1.9.2-p0 > %w( a b c ).kind_of?(Array)
  => true

Sam Duncan | 1 Mar 2011 05:05
Picon

Re: Comining Arrays

And just to be sure, with 1.8.7 ...

irb(main):001:0> RUBY_VERSION
=> "1.8.7"
irb(main):002:0> %w( a b c )
=> ["a", "b", "c"]
irb(main):003:0> %w( a b c ).kind_of?(String)
=> false
irb(main):004:0> %w( a b c ).kind_of?(Array)
=> true

On 01/03/11 17:01, Sam Duncan wrote:
> On 01/03/11 16:45, RichardOnRails wrote:
>>
>> Hey David,
>>
>> Neat code,  but I don't get it.
>>
>> %w( a b c ) yields an instance of class String.
>
> ruby-1.9.2-p0 > %w( a b c )
>  => ["a", "b", "c"]
> ruby-1.9.2-p0 > %w( a b c ).kind_of?(String)
>  => false
> ruby-1.9.2-p0 > %w( a b c ).kind_of?(Array)
>  => true
>

tarun l. | 1 Mar 2011 05:53
Picon

How to retrieve the html read only properties of radio button

Hi All,

This Statement would give me the properties which are in read-write mode
$ie.radios.to_s

Now I want to retrieve the read only properties of this radio button.
Does anyone know how to achieve this????

--

-- 
Posted via http://www.ruby-forum.com/.

RichardOnRails | 1 Mar 2011 06:25

Re: Comining Arrays

On Feb 28, 11:05 pm, Sam Duncan <sdun... <at> wetafx.co.nz> wrote:
> And just to be sure, with 1.8.7 ...
>
> irb(main):001:0> RUBY_VERSION
> => "1.8.7"
> irb(main):002:0> %w( a b c )
> => ["a", "b", "c"]
> irb(main):003:0> %w( a b c ).kind_of?(String)
> => false
> irb(main):004:0> %w( a b c ).kind_of?(Array)
> => true
>
> On 01/03/11 17:01, Sam Duncan wrote:
>
> > On 01/03/11 16:45, RichardOnRails wrote:
>
> >> Hey David,
>
> >> Neat code,  but I don't get it.
>
> >> %w( a b c ) yields an instance of class String.
>
> > ruby-1.9.2-p0 > %w( a b c )
> >  => ["a", "b", "c"]
> > ruby-1.9.2-p0 > %w( a b c ).kind_of?(String)
> >  => false
> > ruby-1.9.2-p0 > %w( a b c ).kind_of?(Array)
> >  => true
>
>
(Continue reading)

Robert Klemme | 1 Mar 2011 09:11
Gravatar

Re: why is $1 in a grep() equal to nil?

On Fri, Feb 25, 2011 at 9:53 PM, 7stud -- <bbxx789_05ss <at> yahoo.com> wrote:
> Josh Cheek wrote in post #983791:
>> On Thu, Feb 24, 2011 at 8:04 PM, 7stud -- <bbxx789_05ss <at> yahoo.com>
>> wrote:
>>
>>>
>>> $1 is a *global* variable, so saying it doesn't persist outside of a
>>> block doesn't make any sense.
>>>
>>>
>> It isn't actually global. I don't know the specifics, but I used to
>> worry
>> about that too, and found out later it was not necessary.
>>
>> def meth_a
>>   "a" =~ /(.)/
>>   puts "in a, $1 = #{$1.inspect}"
>> end
>>
>> def meth_b
>>   "b" =~ /(.)/
>>   puts "in b, $1 = #{$1.inspect}"
>>   meth_a
>>   puts "in b, $1 = #{$1.inspect}"
>> end
>>
>> meth_b
>>
>>
>> # >> in b, $1 = "b"
(Continue reading)


Gmane