Archive for the ‘ruby’ Category

installing Quickfix with Ruby 1.9 on OS X 1.5.4

Tuesday, October 14th, 2008

installing Quickfix with Ruby 1.9on OS X 1.5.4download ruby 1.9

 sudo su (or add a sudo where appropriate)
svn co http://svn.ruby-lang.org/repos/ruby/trunk /usr/local/src/ruby19
./configure --program-suffix=-trunk --prefix=/usr/local/ make make install

#temporary move ruby bin, you can reverse it after building quickfix

mv /usr/bin/ruby /usr/bin/ruby-osx
ln -s /usr/local/bin/ruby-trunk /usr/bin/ruby

#go to /usr/local/src or wherever you want the quickfix sources to stay#HEAD is currenty broken. i used the newest version where something in the ruby dir was changed

svn co -r 1939 https://quickfix.svn.sourceforge.net/svnroot/quickfix/trunk/quickfix qf1939
cd qf1939
./bootstrap
./configure --with-ruby
./make
./make install

#if you get errors the following bugs havent been fixed yet:#patch your /usr/local/include/ruby-1.9.0/ruby/ruby.h

#patch QuickfixRuby.cpp
2145c2145
< #include "ruby/io.h"
---
> #include "rubyio.h"
2643c2643
<       printf( "%s\n", RSTRING_PTR(message) );
---
>       printf( "%s\n", RSTRING(message)->ptr );
2676c2676
<       printf( "%s\n", RSTRING_PTR(message) );
---
>       printf( "%s\n", RSTRING(message)->ptr );
2709c2709
<       printf( "%s\n", RSTRING_PTR(message) );
---
>       printf( "%s\n", RSTRING(message)->ptr );
2742c2742
<       printf( "%s\n", RSTRING_PTR(message) );
---
>       printf( "%s\n", RSTRING(message)->ptr );
2782c2782
<         printf( "%s\n", RSTRING_PTR(message) );
---
>         printf( "%s\n", RSTRING(message)->ptr );
2849c2849
<         printf( "%s\n", RSTRING_PTR(message) );
---
>         printf( "%s\n", RSTRING(message)->ptr );
2922c2922
<         printf( "%s\n", RSTRING_PTR(message) );
---
>         printf( "%s\n", RSTRING(message)->ptr ); 

#place a symlink

sudo ln -s /usr/local/include/ruby-1.9.0/i386-darwin9.1.0/ruby/config.h /usr/local/include/ruby-1.9.0/i386-darwin9.1.0/config.h

#try to ./make and ./make install again

irb-trunk

and

require 'quickfix_ruby'

YAY!  1.9 porting notes:http://boga.wordpress.com/2008/04/15/ruby-19-porting-notes/ 

Writing a compiler in Ruby bottom up

Thursday, June 5th, 2008

Vidar Hokstad has a nice series on writing a compiler in ruby: http://www.hokstad.com/tag/compiler%20in%20Ruby%20bottom%20upa more general view on computer science is given in this lecture:Building a Modern Computer from First Principleshttp://www1.idc.ac.il/tecs/http://video.google.com/videoplay?docid=7654043762021156507

links about merb, datamapper and AOP

Tuesday, April 22nd, 2008

some nice merb urls

a comparison with rails

an open source book about merb

AOP for ruby

interesting post about deferred requests with merb ebb and thin by ezra

Quantlib and Quantlib Ruby on Mac Os X 10.5

Sunday, January 6th, 2008

today i installed Quantlib and Quantlib Ruby via the SWIG bindings on my macbook.

its quite simple.

  • install macports
  • install boost libs ( sudo port install boost )
  • download the latest Quantlib and Quantlib-SWIG
    for me it was like:
    cd /tmp
    wget http://garr.dl.sourceforge.net/sourceforge/quantlib/QuantLib-0.9.0.tar.gz
    wget http://garr.dl.sourceforge.net/sourceforge/quantlib/QuantLib-SWIG-0.9.0.tar.gz
  • extract them
    tar -xzvf QuantLib*
  • configure QuantLib
    cd QuantLib-0*
    ./configure –enable-static –with-boost-include=/opt/local/include/ –with-boost-lib=/opt/local/lib/ –prefix=/opt/local

    which was the actual tricky part. you need to specify where boost lives and you need to compile it static according to the QL FAQ )
  • build and install
    make && sudo make install
  • build and install Quantlib Ruby
    cd ../QuantLib-SWIG-0*
    cd Ruby && ruby setup.rb wrap
    ruby setup.rb build
    ruby setup.rb test
    sudo ruby setup.rb install
  • off you go! try a sample ( ruby examples/american-option.rb )

now i only have to learn what nifty stuff i can do with that 138mb lib ;)