Roger's woze

January 30, 2010

ruby undef_const

Filed under: Uncategorized — rogerdpack @ 4:37 am

what you want is remove_const

January 28, 2010

database.yml that accomodates for jruby and MRI

Filed under: Uncategorized — rogerdpack @ 7:16 pm

Here’s how to have an MRI AND JRUBY database.yml file (well, with sqlite, anyway–same principles would apply for mysql)


test:
adapter: <%= RUBY_PLATFORM =~ /java/ ? 'jdbcsqlite3' : 'sqlite3' %>
database: db/test.sqlite3
pool: 5
timeout: 5000
test:  adapter: <%= RUBY_PLATFORM =~ /java/ ? 'jdbcsqlite3' : 'sqlite3' %>  database: db/test.sqlite3  pool: 5  timeout: 5000

This required (in jruby)

C:\> gem install activerecord-jdbcsqlite3-adapter

and (in MRI)

C:\> gem install sqlite3-ruby

to avoid the dreaded “no such file to load — sqlite3″

ref: http://blog.emptyway.com/2008/04/08/120-seconds-guide-to-jruby-on-rails/

rspec re use specs

Filed under: Uncategorized — rogerdpack @ 6:45 pm

You can “re use” rspec specs by using

(class A should behave like B)

it_should_behave_like

http://rspec.info/documentation/

ubuntu rubinius

Filed under: Uncategorized — rogerdpack @ 1:39 am

How to install
$ sudo apt-get install llvm
$ (download rubinius.tar.gz, extract)
$ ./configure && rake

January 27, 2010

how many peers will a bittorrent seed serve to?

Filed under: Uncategorized — rogerdpack @ 4:59 pm

I think default is 7 (see

–max_uploads
the maximum number of uploads to allow at once. (defaults to 7)

)

January 25, 2010

ruby woes

Filed under: Uncategorized — rogerdpack @ 6:06 pm

# uninitialized constant RubyDocTest::Runner::Test

meant “you have a file named test.rb in your local dir–rename it so it will require its own test.rb”

vm.o: In function `ruby_vm_destruct’:
E:/dev/ruby/downloads/ruby_trunk/vm.c:1538: undefined reference to `rb_thread_lock_unlock’
E:/dev/ruby/downloads/ruby_trunk/vm.c:1539: undefined reference to `rb_thread_lock_destroy’

meant “you need to do a make clean first” (and possibly svn revert some stuff)

January 24, 2010

rspec woe

Filed under: Uncategorized — rogerdpack @ 4:19 am

Required: test-unit-1.2.3
Loaded: test-unit-2.0.6

With ruby-1.9, rspec-1.3.0 requires test-unit-1.2.3, and
tries to force it with “gem ‘test-unit’, ‘= 1.2.3′” in:

E:/installs/ruby191p376/lib/ruby/gems/1.9.1/gems/rspec-1.3.0/lib/spec/interop/test.rb

Unfortunately, test-unit-2.0.6 was loaded anyway. While we are
aware of this bug we have not been able to track down its source.
Until we do, you have two alternatives:

* uninstall test-unit-2.0.6

meant “bugin rails I think”

https://rails.lighthouseapp.com/projects/8994-ruby-on-rails/tickets/3778-rails-disables-gems-from-loading-previous-versions-on-19

January 22, 2010

redcar woe

Filed under: Uncategorized — rogerdpack @ 9:25 pm

rdp@rdp-vm:~/dev/downloads/redcar$ ~/dev/downloads/jruby/bin/jruby bin/redcar
Redcar 0.3.2dev (jruby )
SWT jar file required: /free_space/rdp/downloads/redcar/plugins/application_swt/vendor/swt/linux/swt.jar
Error loading plugin: 0] 0 files>
exit
/free_space/rdp/downloads/redcar/plugins/application_swt/lib/application_swt/swt_wrapper.rb:4:in `require’
/free_space/rdp/downloads/redcar/plugins/application_swt/lib/application_swt.rb:4
/free_space/rdp/downloads/redcar/plugins/application_swt/lib/application_swt.rb:28:in `require’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:28:in `load’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:44:in `log_requires’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:27:in `load’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager.rb:49:in `load’
/free_space/rdp/downloads/redcar/lib/redcar/boot.rb:55:in `load’
bin/redcar:12
Error loading plugin: 0, application>0] 0 files>
uninitialized constant Swt::Browser
/home/rdp/dev/downloads/jruby/lib/ruby/site_ruby/shared/builtin/javasupport/core_ext/object.rb:124:in `const_missing’
/free_space/rdp/downloads/redcar/plugins/html_view/lib/html_view.rb:23
/free_space/rdp/downloads/redcar/plugins/html_view/lib/html_view.rb:28:in `require’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:28:in `load’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:44:in `log_requires’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager/plugin_definition.rb:27:in `load’
/free_space/rdp/downloads/redcar/lib/plugin_manager/lib/plugin_manager.rb:49:in `load’
/free_space/rdp/downloads/redcar/lib/redcar/boot.rb:55:in `load’
bin/redcar:12
There was an error loading:
* application_swt
* HTML View
/free_space/rdp/downloads/redcar/lib/redcar/boot.rb:64:in `const_missing’: uninitialized constant Redcar::Top (NameError)
from bin/redcar:13

meant “you need to run redcar –install first”

maven woe

Filed under: Uncategorized — rogerdpack @ 6:50 pm

Project ID: org.apache.maven.plugins:maven-idea-plugin

Reason: POM ‘org.apache.maven.plugins:maven-idea-plugin’ not found in repository: Unable to download the artifact from any repository

org.apache.maven.plugins:maven-idea-plugin:pom:2.3-atlassian-1

from the specified remote repositories:
central (http://repo1.maven.org/maven2),
approved (http://mvn.onemodel.org/nexus/content/repositories/approved),
maven2-repository.dev.java.net (http://download.java.net/maven/2/),
maven-repository.dev.java.net (http://download.java.net/maven/1/),
unapproved (http://mvn.onemodel.org/nexus/content/repositories/unapproved)

meant “you need to add the right repository to your maven settings.xml file”

January 21, 2010

ruby dir glob backslash doesn’t work

Filed under: Uncategorized — rogerdpack @ 9:19 pm

As a warning–
Dir["c:\\abc*"] does NOT work

Dir["c:/abc*"] does, (which is equal to Dir.glob(“c:/abc”) )

ref:http://perldoc.perl.org/File/Glob.html (search for DOSISH)

Older Posts »

Powered by WordPress