Mustafa M. | 1 Jan 01:15 2011
Picon

update_rubygems problem

I am using ubuntu 10.04. Downloaded ruby-1.9.2-p136 and installed it
successfully. Then I tried to update rubygems, but whatever I try it
does not work.

> sudo update_rubygems
or
> sudo gem update --system
or
>cd /usr/local/ruby/gems/1.9.1/gems/rubygems-update-1.4.0
> sudo ruby setup.rb

error occours like this:

>sudo gem update --system
Updating RubyGems
Updating rubygems-update
Successfully installed rubygems-update-1.4.0
Updating RubyGems to 1.4.0
Installing RubyGems 1.4.0
/usr/local/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/source_index.rb:62:in
`installed_spec_directories': undefined method `path' for Gem:Module
(NoMethodError)
  from
/usr/local/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/source_index.rb:52:in
`from_installed_gems'
  from
/usr/local/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems.rb:914:in
`source_index'
  from
/usr/local/ruby/gems/1.9.1/gems/rubygems-update-1.4.0/lib/rubygems/gem_path_searcher.rb:98:in
(Continue reading)

Phillip Gawlowski | 1 Jan 01:17 2011

Re: update_rubygems problem

On Sat, Jan 1, 2011 at 1:15 AM, Mustafa M. <mustafakyr <at> gmail.com> wrote:
> I am using ubuntu 10.04. Downloaded ruby-1.9.2-p136 and installed it
> successfully. Then I tried to update rubygems, but whatever I try it
> does not work.

You should read the RubyGems 1.4 announcement in full.

--

-- 
Phillip Gawlowski

Though the folk I have met,
(Ah, how soon!) they forget
When I've moved on to some other place,
There may be one or two,
When I've played and passed through,
Who'll remember my song or my face.

Jakub Arnold | 1 Jan 01:35 2011
Picon

Re: update_rubygems problem

RubyGems 1.4.0 doesn't work on Ruby 1.9.x, yet.

http://rubygems.rubyforge.org/rubygems-update/UPGRADING_rdoc.html

--

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

Tom Wardrop | 1 Jan 02:09 2011

Re: Where To Put Validation Logic?

I appreciate the reply David.

A little while after my initial post, I actually started coming to a 
similar conclusion as what you've described. The model should define the 
valid state of the system. This obviously does present a problem for a 
write-on-set database interface, because if you only set one field, even 
if you soon follow up by setting multiple other fields, the new or 
updated record will become invalid because it'll be missing field x, y 
and z.

I did manage to come up with a solution however, which is something I 
had already planned to implement, but for a different purpose. I've 
decided to use a queuing construct. So if you've created a new object, 
or you need to update multiple fields, you can wrap such operations in a 
"set" block. For example...

john.set do |doc|
   doc[:age] = 23
   doc[:hair] = 'long'
   doc[:skin] = 'fair'
end

Or you could simply pass in a hash depending on the situation...

john.set age: 23, hair: 'long', skin: 'fair'

Single field write-on-set operation can still be performed using: 
john[:hair] = 'long', but if you wish to perform an operation that will 
invalidate the object for any period of time, you'll have to wrap the 
operations in a 'set' block.
(Continue reading)

Pen Ttt | 1 Jan 02:42 2011
Picon

Re: change integer into date

in my irb,
pt <at> pt:~$ ruby -v
ruby 1.8.7 (2010-06-23 patchlevel 299) [i686-linux]
pt <at> pt:~$ irb
irb(main):001:0> time = Time.new(2010, 12, 31)
ArgumentError: wrong number of arguments (3 for 0)
  from (irb):1:in `initialize'
  from (irb):1:in `new'
  from (irb):1
  from :0

it's wrong for  the expression:  Time.new(2010, 12, 31)

--

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

Ryan Davis | 1 Jan 03:34 2011

[ruby-core:34024] Re: [ANN] rubygems 1.4.0 Released

aaaaaaand another release...

(technically, 1.4.0 was released yesterday, but I didn't get around to announcing it until today.)

rubygems version 1.4.1 has been released, hot on the tails of 1.4.0!

* <http://rubygems.org>
* <http://docs.rubygems.org>
* <http://help.rubygems.org>
* <http://github.com/rubygems>

RubyGems is a package management framework for Ruby.

This gem is an update for the RubyGems software. You must have an
installation of RubyGems before this update can be applied.

See Gem for information on RubyGems (or `ri Gem`)

To upgrade to the latest RubyGems, run:

  $ gem update --system  # you might need to be an administrator or root

-----

NOTE:  RubyGems 1.1 and 1.2 have problems upgrading when there is no
rubygems-update installed.  You will need to use the following instructions
if you see "Nothing to update".

If you have an older version of RubyGems installed, then you can still
do it in two steps:
(Continue reading)

Kedar Mhaswade | 1 Jan 03:37 2011
Picon

Re: ri does not know require_relative?

Eric Hodel wrote in post #970589:
> On Dec 24, 2010, at 05:53, Kedar Mhaswade wrote:
>> With Ruby/ri 1.9.2, if I do: ri require_relative it says it does not
>> know anything about it.
>>
>> Any idea?
>
> It is not documented in 1.9.2.  I committed some documentation for
> 1.9.3.

Thank you!

--

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

Kedar Mhaswade | 1 Jan 03:43 2011
Picon

Getting two's complement representation of an Integer?

Is there a Ruby standard library method to get an Integer's two's
complement representation (on the given machine) of an Integer?

to_s(2) does not give the two's complement representation of a negative
integer.

Thanks in advance!

-Kedar

--

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

Jörg W Mittag | 1 Jan 03:45 2011

Re: update_rubygems problem

Jakub Arnold wrote:
> RubyGems 1.4.0 doesn't work on Ruby 1.9.x, yet.

Shouldn't it have

    required_ruby_version = '< 1.9'

set in rubygems-update.gemspec, then?

Or have I fundamentally misunderstood what that's for? (Quite likely.)

jwm

Pen Ttt | 1 Jan 04:17 2011
Picon

write right method to be concise

there is a section of my program,it can run,
    require 'mysql'
    dbh = Mysql.real_connect("localhost", "root", "222222")
    days.times do  #days=10000
    case  code
    when  "hk"  then
        str="use  dzh_hk"
        dbh.query(str)
        str_insert="insert into quote (code,date,price)values (?,?,?)
        st=dbh.prepare(str_insert)
        st.execute(data[0],data[1],data[2])
     when  "sh"  then
        str="use  dzh_sk"
        dbh.query(str)
        str_insert="insert into quote (code,date,price)values (?,?,?)
        st=dbh.prepare(str_insert)
        st.execute(data[0],data[1],data[2])
     when  "sz"  then
        str="use  dzh_sz"
        dbh.query(str)
        str_insert="insert into quote (code,date,price)values (?,?,?)
        st=dbh.prepare(str_insert)
        st.execute(data[0],data[1],data[2])
     end
    end
#others ommitted
   i feel it's  burdensome,want to make it be concise, i writ a method
in my program

p1:
(Continue reading)


Gmane