Roger's woze

December 31, 2009

ruby how to escape command line args into a string via bat file

Filed under: Uncategorized — rogerdpack @ 11:27 pm

You may have tried to pass args to ruby via  bat file before, like

ruby -e “puts %*” # print out all the arguments

turns out this doesn’t work if you pass in an argument with backslashes, though [like \a\b\a -- it interpolates them as escaped strings]

To overcome this, create go.bat

ruby some_file.rb %*

then use ARGV within that file–it will no longer be escaped.

Enjoy.

random woes

Filed under: Uncategorized — rogerdpack @ 1:11 am
E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:67: [BUG] The handle is invalid.
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32]
– control frame ———-
c:0004 p:—- s:0010 b:0010 l:000009 d:000009 CFUNC  :sleep
c:0003 p:0012 s:0006 b:0006 l:000260 d:000005 BLOCK  E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49
c:0002 p:—- s:0004 b:0004 l:000003 d:000003 FINISH
c:0001 p:—- s:0002 b:0002 l:000001 d:000001 TOP
—————————
– Ruby level backtrace information—————————————–
E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49:in `sleep’
E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49:in `block in timeout’

E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:67: [BUG] The handle is invalid.
ruby 1.9.1p376 (2009-12-07 revision 26041) [i386-mingw32]
– control frame ———-c:0004 p:—- s:0010 b:0010 l:000009 d:000009 CFUNC  :sleepc:0003 p:0012 s:0006 b:0006 l:000260 d:000005 BLOCK  E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49c:0002 p:—- s:0004 b:0004 l:000003 d:000003 FINISHc:0001 p:—- s:0002 b:0002 l:000001 d:000001 TOP—————————– Ruby level backtrace information—————————————–E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49:in `sleep’E:/installs/ruby191p376/lib/ruby/1.9.1/timeout.rb:49:in `block in timeout’

may have been related to

http://www.ruby-forum.com/topic/200692#new

ruby how to trace anytime an exception is raised (tracing exception creation)

Filed under: Uncategorized — rogerdpack @ 12:19 am

you could do this by using set_trace_func (or it’s C wrappers)


require 'faster_rubygems'
require 'event_hook'

class Demo < EventHook   def self.process(*args)      # args => [64, #, :initialize, Exception]
   begin
     if args[1].is_a? Exception
       puts args.inspect
     end
   rescue
     # fantastically, this check fails within rails at times
   end
  end
end

Demo.start_hook

or you can just run ruby -d [$DEBUG = true] and it will do it for you automatically.

December 28, 2009

ruby-prof woes

Filed under: Uncategorized — rogerdpack @ 11:42 pm
see comments

jruby woe

Filed under: Uncategorized — rogerdpack @ 9:03 pm
“c:/Program Files/jruby-1.4.0/bin/jruby.exe” -rubygems c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake RUBYARCHDIR=”c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/faster_rubygems-0.1.0/lib” RUBYLIBDIR=”c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/faster_rubygems-0.1.0/lib”
Error opening script file: c:/Program (The system cannot find the file specified)

“c:/Program Files/jruby-1.4.0/bin/jruby.exe” -rubygems c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake RUBYARCHDIR=”c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/faster_rubygems-0.1.0/lib” RUBYLIBDIR=”c:/Program Files/jruby-1.4.0/lib/ruby/gems/1.8/gems/faster_rubygems-0.1.0/lib”Error opening script file: c:/Program (The system cannot find the file specified)

meant “use jruby > 1.4, k? to avoid this bug in doze”

December 27, 2009

ruby 1.9 breakage

Filed under: Uncategorized — rogerdpack @ 12:12 am
dense_ruby_to_ruby.cpp: In member function `size_t hashrb::operator()(VALUE) const’:
dense_ruby_to_ruby.cpp:70: error: `RBIGNUM_DIGITS’ was not declared in this scope
make: *** [dense_ruby_to_ruby.o] Error 1

dense_ruby_to_ruby.cpp: In member function `size_t hashrb::operator()(VALUE) const’:dense_ruby_to_ruby.cpp:70: error: `RBIGNUM_DIGITS’ was not declared in this scopemake: *** [dense_ruby_to_ruby.o] Error 1

meant “for 1.8, do”

#ifndef RBIGNUM_DIGITS

# define RBIGNUM_DIGITS(a) RBIGNUM(a)->digits

#endif

December 26, 2009

ruby-prof woe

Filed under: Uncategorized — rogerdpack @ 11:00 pm
gcc -I. -I. -IC:/ruby/lib/ruby/1.8/i386-mingw32 -I.  -g -O2   -c ruby_prof.c
ruby_prof.c: In function `get_method’:
ruby_prof.c:877: error: `node’ undeclared (first use in this function)
ruby_prof.c:877: error: (Each undeclared identifier is reported only once
ruby_prof.c:877: error: for each function it appears in.)
make: *** [ruby_prof.o] Error 1

gcc -I. -I. -IC:/ruby/lib/ruby/1.8/i386-mingw32 -I.  -g -O2   -c ruby_prof.cruby_prof.c: In function `get_method’:ruby_prof.c:877: error: `node’ undeclared (first use in this function)ruby_prof.c:877: error: (Each undeclared identifier is reported only onceruby_prof.c:877: error: for each function it appears in.)make: *** [ruby_prof.o] Error 1

meant “update your ruby prof version”

http://github.com/rdp/ruby-prof

December 25, 2009

ubuntu woe

Filed under: Uncategorized — rogerdpack @ 9:49 pm

sudo apt-get update yielded

Hit http://security.ubuntu.com karmic-security/multiverse Packages
Hit http://security.ubuntu.com karmic-security/multiverse Sources
56% [Waiting for headers]^C

which meant “go into syntaptic -> repositories and change your repository to be the main one not the country one”

ref:

http://www.ubuntugeek.com/how-to-select-fastest-mirror-in-ubuntu.html

http://forums.debian.net/viewtopic.php?f=10&t=46863

December 23, 2009

ruby ARGV # can’t modify frozen string

Filed under: Uncategorized — rogerdpack @ 5:26 pm

appears that by default the command line parameters [ARGV] are frozen strings. go figure.

You can still do funky things with ARGV, though.

ARGV.map!{|name| name.dup} # now they’re not frozen

ARGV.shift

etc

etc.

December 22, 2009

pcre woe

Filed under: Uncategorized — rogerdpack @ 7:34 pm

ruby: symbol lookup error: ./pcre.so: undefined symbol: pcre_compile

meant “you’re missing -lpcre”

http://121.78.227.9/pcre/ruby-pcre.diff

Older Posts »

Powered by WordPress