jen Marsh | 18 May 2013 05:50

Ruby 'gets' truncates input to 256 characters (Windows)

Is this a 'feature' of Ruby on windows?
I am trying to enter a long string (> 256 characters but generally <
512) in Ruby with:

    puts "Enter long string"
    ilogo = gets.chomp
    puts ilogo

For some reason, it always truncates the input to keep only 256
characters (before chomp).
I verified that Ruby accepts longer strings, and that Windows 7 command
line console also accepts strings > 256 chars. I have seen that people
don't have the issue with MacOS, but others do have it with Windows XP.
I am running Win7.  I can't find any mention of the gets method having
that type of limitation, but I am surely missing something.  Could that
be just a 'gets' limitation for Ruby running on Windows?

--

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

Love U Ruby | 17 May 2013 21:42

how to create a method object of from an singleton method?

class Foo
  def suprim;end
end

p foo = Foo.new #=> #<Foo:0x90bd908>
p foo.method(:suprim) #=> #<Method: Foo#suprim>
p Bar=foo.singleton_class #=> #<Class:#<Foo:0x90bd908>>
p foo.define_singleton_method(:hello) { "#{self}: Hello there!" } #=>
#<Proc:0x90bd2a0 <at> /home/kirti/ruby/test.rb:8 (lambda)>
p Bar.method(:hello) #=> `method': undefined method `hello' for class
`Class' (NameError)

My question is how to create a method object of an singleton method,like
I did `foo.method(:suprim)`?

--

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

Grant Schoep | 17 May 2013 21:28

configure option for doxygen

So I'm building some Ruby releases I don't want it to build any docs
for.

When running configure, I already add --disable-install-doc.

However, since I have doxygen, configure notices that and adds it to be
built. I normally just quick edit the resulting Makefile and remove
doxygen.

However, is there a way to tell configure to --disable-doxygen or
something similar?

--

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

Amarnath Krishnan | 17 May 2013 08:37

Error in Migration

I am a RoR newbie. I am getting this error when trying to migrate my 2.x
project to 3.x project.
actionpack-3.2.13/lib/action_dispatch/routing/mapper.rb:109:in
`normalize_path': undefined method `to_sym' for nil:NilClass
(NoMethodError)

In that line i can see the following code
options[$1.to_sym]||=/.+/?

why $1.to_sym ends with NilClass error

--

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

Luis Lavena | 17 May 2013 07:27
Picon
Gravatar

[ANN] RubyInstaller 2.0.0-p195 released

In combination with the rest of the RubyInstaller team, I'm very
pleased to announce the release of RubyInstaller packages for Ruby
2.0.0-p195

This new version of Ruby also brings new changes to RubyInstaller.

Starting with 2.0.0, the packages will be provided in two versions:
32bits (x86) and 64bits (x64).

This is possible thanks to newer compiler provided by mingw-w64 project.

Over the past months our Continous Integration worker has been compiling and
running tests against GCC 4.7.2, ensuring this version satisfy the compilation
requirements of Ruby.

This also means newer DevKit package is required to use with this version.

As usual, installer and 7z packages are available at RubyInstaller
website and RubyForge for download:


For verification, MD5 signatures of each file released are provided:

c243bb334fd4f19047ed145d9b5db042 *ruby-2.0.0-p195-doc-chm.7z
6df8ea7ff64abf86c9f880381ddbd09d *ruby-2.0.0-p195-i386-mingw32.7z
31c7f19e02566bf4f40dfd68f0797348 *ruby-2.0.0-p195-x64-mingw32.7z
b3ecf760be8682e8a33d1f423ee16f77 *rubyinstaller-2.0.0-p195.exe
3723f8eeacd58b1ee05202b51e7bdaf7 *rubyinstaller-2.0.0-p195-x64.exe

Installer is also digitally signed to avoid alterations and UAC warnings.

You can read Ruby's own announcement here:


= What's new in Ruby, for Windows users?

Ruby's announcement was generic in relation to all the new features added to
the language.

However, it missed enhancements specific to our platform of choice.

* Enhancements:
  * Faster startup due improved Windows-specific API. [Bug #6836]
  * Support ANSI-colors out of the box without the need of external tools
    or gems. [Feature #6418]
  * Fixes for native 64bits builds for Windows under MinGW

= What's new in RubyInstaller?

Beyond what is covered by Ruby itself, we have our own set of improvements:

* Enhancements:
  * Upgraded Ruby 2.0.0 to patchlevel 195
  * Upgraded OpenSSL to version 1.0.0k
  * Upgraded rb-readline to 0.5.0.pre.1 (compatible with Ruby 2.0)

* Bugfixes:
  * Generate documentation for target version of Ruby

= Important Notes

* Ruby 2.0.0-p195 is brand new

While officially 2.0.0 is stable, that doesn't mean all the software will
magically work on it.

Use 2.0.0 for development and verify your application, scripts and tools works
properly before deciding to run this in your production environment.

* Existing pre-compiled gems are not Ruby 2.0 compatible

Ruby 2.0 introduces ABI breakage which means compiled C extensions with previous
1.9.3 will work with Ruby 2.0.

DO NOT install Ruby 2.0 on top of existing Ruby 1.9.3, or try to use compiled
extensions with it.

You will be required to force compilation of those gems:

    gem install <name> --platform=ruby

This will require you have the extra dependencies required for that gem to
compile. Look at the gem documentation for the requirements.

* Do not use other DevKit version than the one recommended

This version of Ruby has been compiled and optimized for mingw-w64 GCC 4.7.2.

Use of older version of DevKit package to compile gems might result in
compilation issues during gem installation or simply segfaults.

Look for the DevKit installers identified with the name 'DevKit-mingw64-32' and
'DevKit-mingw64-64' for 32 and 64 bits respectively.

= Alternate download links

Sometimes RubyForge might have issues when trying to download the above files.

Please try adding "/noredirect" to the file download URLs so skip the entire
RubyForge's mirror functionality.

If that still doesn't work, try using RubyInstaller CDN directly by using
above filenames combined with the archive folder:


Same applies to DevKit URLs:


Regards,
-- 
Luis Lavena
AREA 17
-
Perfection in design is achieved not when there is nothing more to add,
but rather when there is nothing more to take away.
Antoine de Saint-Exupéry
Thomas E Enebo | 16 May 2013 21:50
Picon
Gravatar

[ANN] JRuby 1.7.4 Released

JRuby 1.7.4 Released - Thursday, May 16 2013

The JRuby community is pleased to announce the release of JRuby 1.7.4

    Homepage: http://www.jruby.org/
    Download: http://www.jruby.org/download

JRuby 1.7.4 is our fourth update release since JRuby 1.7.0. The primary goal of 1.7 point releases is to fill out any missing compatibility issues with Ruby 1.9.4. The community participation lately has been great. Keep reporting issues and sending pull requests.

Changes of note:

- Dozens of 1.9-mode compatibility fixes
- Many IO and encoding issues fixed
- Transcoding support for :xml entity encoding
- Proc and block dispatch perf improvements
- Fiber and Enumerator#next improvements and fixes
- Fixed a regression in windows java native launcher
- Experimental Ruby 2.0 support (most features and stdlib included)
- 90%+ complete Ripper support
- OpenSSL fixes and updated to newer Bouncy Castle library
- Updates and fixes to FFI subsystem (compat with C ext, AIX support, etc)
- Long running regexp can be interrupted by Thread#kill and raise
- 137 issues fixed for 1.7.4

Thanks to all contributors for this release:

Alex Tambellini, Andrew Kiellor, Andy Lindeman, Anoop Sankar, Benoit Daloze, Bohuslav Kabrda, Charles Oliver Nutter, Daniel Noll, Dario Bertini, Gino Lucero, Hiro Asari, Iain Barnett, Isaiah Peng, Jake Goulding, James Pickering, Jeff Simpson, John Shahid, Jonathan Adams, Jose Donizetti, Kevin Menard, Mark McCraw, Martin Ott, Matt Wilson, Patrick Mahoney, Prathamesh Sonpatki, Robin Message, Ryan Blue, Sakumatti Luukkonen, Seth Wright, Subramanya Sastry, Sébastien Le Callonnec, Thomas E. Enebo, Uwe Kubosch, Vipul A M, Wayne Meissner, ryenus

Jira Issues resolved for 1.7.4

    JRUBY-7112 - Fiber exception handling regression in JRuby 1.7.3
    JRUBY-7121 - String#encode(:xml => :attr) encoding differs from MRI
    JRUBY-5742 - Fails to use UTF-8 encoded source with BOM.
    JRUBY-7102 - Time.now == "" should return false and not nil
    JRUBY-7117 - Dir.foreach should list entries in JAR root and in JAR directories ending in slash like "file:myjar!/test/"
    JRUBY-7033 - yielding from fiber fails when running jruby with --debug
    JRUBY-7127 - Ripper bug when parsing "::Object"
    JRUBY-4820 - [windows] File.size is completely broken on Windows
    JRUBY-6136 - Changing jnr-posix to use errno() value unconditionally has created lots of failures in windows
    JRUBY-7122 - File.realpath does not handle classpath:/ path on Windows
    JRUBY-7157 - IO.copy_stream broken for non-seekable source streams
    JRUBY-7143 - FileUtils.cp, FileUtils.copy, FileUtils.copy_stream bug on windows when copying from jar files
    JRUBY-7145 - FileUtils.mkdir_p creates extra directory named after drive letter
    JRUBY-7161 - NPE in socket connection
    JRUBY-7113 - Setting ssl_timeout on a Net::HTTP instance throws an exception
    JRUBY-7130 - Missing support for Time.getlocal(utc_offset) method in JRuby
    JRUBY-7134 - Dir.exists? sets $! when directory does not exist

Github Issues resolved for 1.7.4

    #737 - require_relative fails in jars
    #733 - Inconsistency between MRI and JRuby with begin/rescue/else
    #729 - Fixing IO.binwrite specs, parsing options.
    #728 - Refactored directed graph specs
    #726 - IO.binwrite doesn't truncate the file if an offset is given
    #725 - IO.binwrite doesn't truncate the file if an offset is given
    #724 - When offset passed return RandomAccessFile when not return FileOutputStream
    #717 - Add fails tag to failing Kernel.spawn spec
    #716 - Add fails tags for Process.{get,set}rlimit
    #715 - Bignum#/ should not raise ZeroDivisionError if other is zero and is a Float
    #714 - Some rubyspec additions
    #712 - Complex#/ with a Numeric which responds to #real? with false should coerce the passed argument to Complex and divide the resulting elements
    #711 - Exception#== should return true if the two exceptions inherit from Exception but have different classes
    #709 - NullPointerException on calling java_* methods on java interface impl in Ruby
    #708 - Fix failing rubyspecs for Encoding#compatible?
    #707 - Kernel#singleton_methods should return a unique list of methods
    #706 - Kernel#open should correctly handle objects that responds to to_open
    #704 - Kernel.exec should raise an ArgumentError if the command includes a null byte
    #703 - Kernel.abort should set the exception message to the given message
    #701 - Untag passing Math.cbrt and Math.gamma specs
    #700 - Numeric#div should raise ZeroDivisionError for 0
    #699 - Range#each should raise a TypeError if the first element is a Time object
    #698 - Range#first should raise an ArgumentError when count is negative
    #697 - Supporting IO.ungetbyte
    #696 - Regexp#initialize should raise a SecurityError on a Regexp literal
    #695 - Regexp#options should include FIXEDENCODING and NOENCODING when enabled
    #693 - using bytelist instead of a linkedlist for a better performance
    #691 - Implement String#to_sym special cases.
    #689 - Thread#initialize should raise a ThreadError when already initialized
    #688 - Fixing IO.ungetc tagged specs!
    #687 - Time methods should coerce the day, hour, minute, or second with #to_int
    #686 - jcodings release needed for JRuby 1.7.4
    #685 - REFACTORING: supporting a list of bytes
    #684 - Fix some failing rubyspecs for String#encode
    #683 - Fix unseekable stream implementation of IO.copy_stream in RubyIO.java
    #682 - Verifying if character is corrupted, meaning that one more char is needed.
    #681 - Untag passing float rubyspecs
    #680 - StringIO#puts should print newline when passed nil 1 or more times
    #679 - StringIO#set_encoding should set the encoding to default external when passed nil
    #677 - TempFile path consistency vs the rest of the Ruby implementations
    #676 - Fix eclipse problems
    #675 - Fix failing rubyspecs for String#unpack
    #674 - My stab at fixing JRUBY-7122
    #673 - Remove required argument constraint from StringIO#readpartial
    #672 - Fix Etc rubyspecs
    #671 - Untag passing conditional variable rubyspecs
    #669 - Fix BigDecimal#div rubyspecs
    #668 - Fix float rounding issues.
    #667 - Do not display class name for an anonymous struct.
    #666 - LoadError#path not implemented
    #665 - NameError for version when loading gemspec in 2.0 mode
    #664 - GzipReader#rewind should reset the position of the stream pointer
    #663 - Tempfile#size should return the size of self even if self is closed in 1.9
    #662 - Add license header to anno package classes.
    #661 - Bignum failing specs
    #660 - Fixing IO.foreach rubyspec, set env variable $_ to nil
    #659 - Ruby 2.0 Compatibility - NET:HTTP
    #658 - Math.gamma should return -∞ for -0.0
    #656 - Fix #645 by calling Java Math.cbrt directly.
    #655 - Io foreach
    #654 - [FFI] FFI::AutoPointer#free causes FFI::AutoPointer#autorelease? to cast NullPointerException
    #653 - Ant integration causes exception trace on failed build
    #651 - Kernel#__dir__ missing from 2.0 mode
    #650 - File/IO readlines supporting new params limit, and open mode
    #647 - Using Enumerable#cycle causes a background thread to be created but never destroyed.
    #645 - Behavior of Jruby Math.cbrt(number) does not match MRI
    #643 - FIXES #235 Fix for relative require from within a gem on the classpath.
    #639 - Project files fix
    #637 - Updated shared module dependencies.
    #635 - remove double assignment and addition to 0
    #634 - Implemented OpenSSL::PKCS7::write_smime
    #630 - [FFI] Struct Arrays behave differently on JRuby vs FFI gem
    #628 - OpenSSL::TestPKCS12 failure on OpenJDK 6
    #627 - ant integration breaks with ant 1.9.0
    #626 - jruby dies with fatal error on jdk8-ea-b83 on ubuntu
    #622 - Added new option jruby.timeout.thread.pool.max to control the max number...
    #617 - An object's ID is not copied
    #615 - Restore $! when catching exception.
    #613 - Ruby 2.0 caller API
    #612 - [FFI] FFI::Struct.by_ref mapped type accepts arbitrary structs in it’s #to_native
    #611 - Timeout worker pool size
    #609 - Add support for Floats as the first argument in Time.at.
    #608 - [FFI] FFI::Pointer#slice is not defined
    #607 - [FFI] FFI::Pointer.size is not defined
    #602 - RSpec 2.13 doesn't load in 2.0 mode
    #601 - Ant integration DSL issue
    #600 - Fixing RubyBasicObject#compareTo bug.
    #599 - Recursive annotation visiting
    #595 - Fixing build problem introduced by removing encryption jars
    #591 - Time.new: the UTC offset is always negative
    #590 - Consistent hash code values between JVM instances
    #587 - AIX 6.1: stat.st_gid unsupported or native support failed to load
    #583 - Method#parameters returning empty array for some Object methods
    #580 - [windows][jruby-complete] Resolv.getaddress fails
    #579 - Don't include imports from previously processed ruby files in every generated java file.
    #578 - Update psych to edf05c9f40e0c566e391f7e04b4a30327c31a828
    #575 - Require paths with .. in them are not normalized
    #571 - Fix so require_relative can handle an absolute path.
    #569 - Ruby 2.0: locations and caller APIs can take ranges now
    #568 - [Ruby 2.0] Kernel#caller_locations
    #566 - Ruby 2.0: Range#bsearch
    #565 - Time.at broken in 1.7.3 when passed (Time, 0)
    #556 - RbConfig.expand is missing
    #554 - Fixes issue #549 (OpenSSL sockets spin indefinitely on timeout in handshake)
    #553 - show build status from travis [ci skip]
    #552 - Zlib::GzipWriter.wrap in 1.9 mode accepts only one argument
    #551 - Fi JRUBY-5122_nonblocking_io_spec on Fedora 19 by raising chunk size
    #550 - JRuby 1.7.3 breaks Sidekiq (DeadTaskErrors on startup)
    #549 - OpenSSL sockets spin indefinitely on timeout in handshake
    #546 - Remove unused call to `String#replaceAll()`.
    #544 - replacing a hash with itself returns an empty hash in ruby 1.9 compatibility mode
    #539 - Time::new should treat numeric offsets as the GMT offset in seconds.
    #530 - JRuby is quick to show version number, slow to exit
    #523 - Java integration failures in 1.9 mode
    #522 - Generate new empty RubyString's with US-ASCII encoding.
    #515 - Dir.foreach fails in jar files
    #497 - JRuby behaves different from MRI and Rubinius when it comes to setting Module#name
    #471 - File.directory? should handle IO's
    #405 - jruby-1.7.0 Dir::tmpdir returns current directory if it is not world writable.
    #189 - OpenSSL::SSL::SSLError when talking to github


--
blog: http://blog.enebo.com       twitter: tom_enebo
mail: tom.enebo <at> gmail.com
haxuan lac | 16 May 2013 18:42

Could you give me some Website for Learning Ruby

I'm learning Ruby and I search some Website for learning Ruby
 but I want have some Website same as Tutorial with more information
about variable,class,extend... (very detail).
Who can help me this problem? Thanks...

--

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

Panagiotis Atmatzidis | 16 May 2013 10:57
Gravatar

Is it 'safe' to upgrade to ruby 2.0 by now?

Hello,

I'd like to know if do you consider safe upgrading all our programs to ruby 2.0. By now it's considered
'stable' and I'd like to keep up with 'current development' in order to avoid
issues that may arise from lagging too much behind. But do you or know if there are gem issues with ruby 2.0?
Some gems might need to get upgraded, some are active other not...

What's your opinion on this and which version do you use for production/test development?

Best Regards,

Panagiotis (atmosx) Atmatzidis

email:	atma <at> convalesco.org
URL:	http://www.convalesco.org
GnuPG ID: 0x1A7BFEC5
gpg --keyserver pgp.mit.edu --recv-keys 1A7BFEC5
--
The wise man said: "Never argue with an idiot. They bring you down to their level and beat you with experience."

Paramesh DS | 16 May 2013 09:22

Configure/Integration of MYSQL in Tomcat using Ruby script

Hi,

I have installed MySQL with the help of MySQL msi package through
command prompt and now trying to do configuration of MySQL in Tomcat
help of Ruby recipes. I have downloaded Mysql and Tomcat recipes from
Opscode Cookbook. But I am not getting how to do Configuration of MySQL
in Tomcat help of Ruby. Can any one please help me on this how to
proceed.

Thanks.

--

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

Flex Philips | 15 May 2013 23:46

n00b looking to learn from the best

Hey Rubyians!

I am not used to joining online forum's and I am eager to join the Ruby
community. This is the first language I am learning and have a practice
problem that I cannot seem to get. Can you enlighten me? I'm looking
forward to learning from all of you!

Here is the question:

Write a method named lassy_sum(numbers) that takes an array of numbers.
lassy_sum should multiply each number in the array by its position in
the array, and return the sum.

I don't quite understand how to multiply each number in the array by its
position in the array. Any help will be greatly appreciated! Thanks.

Flex

--

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

Geetha S. | 15 May 2013 19:31

converting a dns msg to wireformat -- dnsruby

I'm trying to convert a dnsruby message to wire format. Is there any way
to do that?
Much like toWire() in dnsjava ??

Thanks.

--

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


Gmane