Friday, October 31, 2008

installing Nokogiri

Looking into using tenderlove's new library, nokogiri. Looks faster than Hpricot, according to the benchmarks he provides, the syntax also looks really nice.

hmmm.... I installed racc, and frex... getting an error when creating the Make file. I really want to try this out. If I figure it out, or talk to someone who knows, I'll post a reply. For now, here is the error I'm getting.


-bash3.2.17:holtonma:Fri Oct 31 12:09:37>> sudo gem install nokogiri
Building native extensions. This could take a while...
ERROR: Error installing nokogiri:
ERROR: Failed to build gem native extension.

rake RUBYARCHDIR=/opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.1/lib RUBYLIBDIR=/opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.1/lib
(in /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.1)
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... yes
checking for #include
... yes
checking for #include
... yes
checking for racc... yes
checking for frex... yes
creating Makefile
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c html_document.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c html_sax_parser.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c native.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_cdata.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_document.c
xml_document.c: In function ‘substitute_entities_set’:
xml_document.c:117: warning: unused parameter ‘klass’
xml_document.c: In function ‘load_external_subsets_set’:
xml_document.c:129: warning: unused parameter ‘klass’
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_dtd.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_node.c
xml_node.c: In function ‘new’:
xml_node.c:475: warning: unused parameter ‘klass’
xml_node.c: In function ‘new_from_str’:
xml_node.c:494: warning: unused parameter ‘klass’
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_node_set.c
xml_node_set.c: In function ‘allocate’:
xml_node_set.c:106: warning: unused parameter ‘klass’
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_reader.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_sax_parser.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_syntax_error.c
xml_syntax_error.c: In function ‘Nokogiri_error_handler’:
xml_syntax_error.c:162: warning: unused parameter ‘ctx’
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_text.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_xpath.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xml_xpath_context.c
gcc -I. -I. -I/opt/local/lib/ruby/1.8/i686-darwin8.10.1 -I. -I/opt/local/include/libxml2 -I/opt/local/include -fno-common -O2 -fno-common -pipe -fno-common -g -DXP_UNIX -O3 -Wall -Wextra -Wcast-qual -Wwrite-strings -Wconversion -Wmissing-noreturn -Winline -c xslt_stylesheet.c
cc -dynamic -bundle -undefined suppress -flat_namespace -L/opt/local/lib -L"/opt/local/lib" -o native.bundle html_document.o html_sax_parser.o native.o xml_cdata.o xml_document.o xml_dtd.o xml_node.o xml_node_set.o xml_reader.o xml_sax_parser.o xml_syntax_error.o xml_text.o xml_xpath.o xml_xpath_context.o xslt_stylesheet.o -lruby -lxslt -lxml2 -lpthread -ldl -lobjc
ld: warning, duplicate dylib /opt/local/lib/libxml2.2.dylib
/opt/local/lib/ruby/gems/1.8/gems/hpricot-0.6.161/lib/hpricot/builder.rb:26: warning: `&' interpreted as argument prefix
Loaded suite -e
Started
..............................................................................................................................................................................................................................................
Finished in 2.551585 seconds.

238 tests, 701 assertions, 0 failures, 0 errors
/opt/local/lib/ruby/1.8/test/unit.rb:278: [BUG] Bus Error
ruby 1.8.6 (2007-03-13) [i686-darwin8.10.1]

rake aborted!
Command failed with status (): [/opt/local/bin/ruby -w -Ilib:ext:bin:test ...]

(See full trace by running task with --trace)


Gem files will remain installed in /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.1 for inspection.
Results logged to /opt/local/lib/ruby/gems/1.8/gems/nokogiri-1.0.1/gem_make.out

Thursday, October 30, 2008

embedding a Gist in your blog

- Login to your Github account (free) https://github.com/
- go here: http://gist.github.com/ embedding a gist in your blog...
- add your code to the gist and click "paste"
- click embed, and embed the code in your blog (hopefully it is more useful than this code below!):

Wednesday, October 29, 2008

Open Source OGWR Scraper

Going to write some Ruby code to scrape the Official Golf World Ranking... going to release it as open source.

Tuesday, October 28, 2008

updated Rails to 2.1.2 along with various rubygems update

Info on Rails 2.1.2: http://weblog.rubyonrails.org/2008/10/23/rails-2-1-2-security-other-fixes

-bash3.2.17:holts:Tue Oct 28 09:23:10 ~ >> sudo gem update
Password: ********************

Updating installed gems
Updating ZenTest
Successfully installed ZenTest-3.11.0
Updating actionmailer
Successfully installed activesupport-2.1.2
Successfully installed actionpack-2.1.2
Successfully installed actionmailer-2.1.2
Updating activerecord
Successfully installed activerecord-2.1.2
Updating activeresource
Successfully installed activeresource-2.1.2
Updating hoe
Successfully installed rubyforge-1.0.1
Successfully installed hoe-1.8.2
Updating rails
Successfully installed rails-2.1.2
Updating rspec
Successfully installed rspec-1.1.11
Updating rubygems-update
Successfully installed rubygems-update-1.3.1

Ezra Zygmuntowicz Tech Talk : Ruby, Merb, Rubinius

This talk is great. Tons of information if you're interested in Ruby, Merb, Rubinius, etc.

"Engine Yard co-founder Ezra Zygmuntowicz gave a Tech Talk on Monday at Google. He covered some of the open-source projects we’re working on at Engine Yard, including Merb and Rubinius."

http://blog.engineyard.com/2008/10/24/ezra-gives-google-tech-talk-on-merb-and-rubinius

Wednesday, October 22, 2008

Sizzle

Browsers are getting faster (see: Google Chrome, see next release of Firefox) with JIT compliation, improved Javascript VM's, etc... but not only that, developers are getting better at writing codez and finding things in browsers... all of it makes the interwebs better: It's good to keep an eye on what is coming down the pike, as they say:

John Resig (jQuery author)... is working on Sizzle... which will become part of jQuery... check out the performance here:
http://jamesdonaghue.com/static/peppy/profile/slickspeed/#

Here's a link to Sizzle on GitHub: http://github.com/jeresig/sizzle/tree/master

Also, it was bounced around today on the Prototype mailing list that Prototype (traditionally slower than other mainstream libraries when traversing the DOM with CSS Selectors), is mulling over including Sizzle as well. Very nice developments -- check them out.

Friday, October 17, 2008

update Rails and gems on Joyent Accelerator

Was back on my Joyent Accelerator (been too long), and hadn't done an update in awhile. Needed to update Rails, among many other gems and was coming across this error whenever I tried updating any gems:

ERROR: While executing gem ... (Gem::GemNotFoundException)
could not find capistrano locally or in a repository

Realized I needed to install rubygems-update-1.2.0 from source:

$ sudo curl -O http://rubyforge.rubyuser.de/rubygems/rubygems-update-1.1.1.gem
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 418k 100 418k 0 0 146k 0 0:00:02 0:00:02 --:--:-- 165k

$ sudo curl -O http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-update-1.2.0.gem
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 246k 100 246k 0 0 147k 0 0:00:01 0:00:01 --:--:-- 183k

$ sudo gem install rubygems-update-1.1.1.gem
Successfully installed rubygems-update-1.1.1
1 gem installed
[admin@golfapp /home]$ sudo gem install rubygems-update-1.2.0.gem
Successfully installed rubygems-update-1.2.0
1 gem installed

$ sudo update_rubygems

$ sudo gem update rails
Updating installed gems
Updating rails
Successfully installed activesupport-2.1.1
Successfully installed activerecord-2.1.1
Successfully installed actionpack-2.1.1
Successfully installed actionmailer-2.1.1
Successfully installed activeresource-2.1.1
Successfully installed rails-2.1.1
Gems updated: activesupport, activerecord, actionpack, actionmailer, activeresource, rails

Rubygems 1.3.0 was out about 20 days ago (it's been awhile since I updated this Accelerator)...
http://blog.segment7.net/articles/2008/09/26/rubygems-1-3-0

$ sudo curl -O http://files.rubyforge.vm.bytemark.co.uk/rubygems/rubygems-update-1.3.0.gem
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 257k 100 257k 0 0 151k 0 0:00:01 0:00:01 --:--:-- 188k
[admin@golfapp /home]$ sudo gem install rubygems-update-1.3.0.gem
Successfully installed rubygems-update-1.3.0
1 gem installed
[admin@golfapp /home]$ sudo update_rubygems
Installing RubyGems 1.3.0...

After reading Eric's blog post, I should have just done a:
$ sudo gem update --system
$ sudo gem update

Live and learn. But RubyGems is updated now, and so are all my installed gems. Yayy. Need to deploy my app to this by Dec 1 hopefully.