Plasticx Blog

Capable of being shaped or formed

compiling ruby 1.8.5 w/ openssl on Debian (Etch/testing) and FreeBSD in $HOME

Posted by Mike 02/03/2007 at 09:44AM

If you want to have control over the version of ruby that is available in your user space here’s how to build and install it in your $HOME directory. The Debian Way of packaging ruby and gem deviates from the Ruby Way on other Nix platforms. So its better to just do it Your Way so that you have control of which ruby and ruby tools (gem, rake, rails, etc.) is available to your user environment.

This is a way to compile and install ruby 1.8.5 with local dependency on openssl, readline, and openssl on Debian (Etch/testing) 686 in your $HOME directory. The method also works for FreeBSD 4.8-STABLE. (BTW if you have root privilege on your machine and you just want to enable openssl to your already installed ruby make sure the libopenssl-ruby Debian package is installed and ignore the rest of the knowledge presented here.)

Posted in , , , |

Save your file after calling YAML::dump

Posted by Mike 01/25/2007 at 10:04PM

Not saving a yaml file after calling YAML::dump cost me about two hours the other day. Here’s an example:

# load
fnm='myyaml.yml'
h = YAML::load_file(fnm) || Hash.new
# add to hash
h[:foo]='bar'
#save# load
fnm=myyaml.yml
h = YAML::load_file(fnm) || Hash.new
# add to hash
h[:foo]=bar
#save

=begin

  1. don’t do it like this …
    f = File.open(fnm, ‘w’)
    YAML::dump(h, f)
    #close writes the file to disk
    f.close
    =end

# file gets closed after block executes
File.open(fnm, w) do |out|
YAML.dump(h, out)
end

Posted in , |

Agile Web Development with Rails (ISBN 0977616630)

Posted by Mike 01/24/2007 at 11:02PM
I’ve started reading the second edition of Agile Web Development with Rails . I’m going to try something different and append my notes from each chapter to his blog entry as I read them. I bought this book from The Pragmatic Programmers site with the PDF copy of the book. I like having the PDF copies of their books (I currently own the PickAxe book , the Agile Rails book, and the Rail Recipes books) so I can reference them without having to search the internet or crack open my real book for a discussion of a question I might have.

Posted in , , , |

Head First Design Patterns (ISBN: 0596007124)

Posted by Mike 01/21/2007 at 06:14PM

A couple of years ago Slashdot reviewed of “Head First Design Patterns” by Elisabeth Freeman, Eric Freeman, Bert Bates, and Kathy Sierra.

I bought the book but at the time wasn’t programming Java and didn’t take any further action. A weird twist of circumstance was at the time Elisabeth Freeman and Eric Freeman lived in the same town as me and I would see them on the ferry that we commute on. I knew that they were Java programmers by the JavaOne backpacks that they had but I didn’t know they were the authors of the book. Anyway, they don’t live here now, which is too bad, because I would let them know that I learned a lot from their work.

The way that I self teach is to read a book and either take notes while reading or take summary notes at the end of the chapter. Then when finished with the book recompile my notes. These are my notes from the book. They will not replace your notes when you read the book but do provide a nice reference in and of themselves (and make for some blog content).

Posted in , |

CSS: The Missing Manual (ISBN 0596526873)

Posted by Mike 01/14/2007 at 10:59AM

After reading Slashdot’s review of “CSS: The Missing Manual” by David Sawyer McFarland, I was interested in learning more about CSS so I picked up a copy.

The book gave me a better understanding about the different structures in CSS but what I really learned was how to properly structure HTML, validate HTML, and how valid HTML will improve search engine results for a page i.e. Seach Engine Optimization.
|

I recommend the book for your collection and here are my notes from reading the book …

Posted in , |

Ruby RMagick Watermark Bug

Posted by Mike 01/12/2007 at 12:19AM

Here’s the quick and dirty on placing a shaded watermark bug on an image.

The result will be like this example with the bug in the lower right corner.

Posted in |

decoding email attachments with ActionMailer::Base receive

Posted by Mike 12/30/2006 at 09:35PM

There are lots of references that say you can decode images and other media attachements in email using the receive method of ActionMailer::Base

Ruby On Rails Wiki is one: HowToReceiveEmailsWithActionMailer.

Rails Recipes Recipe #68 “Testing Incoming Mail” is another.

But those references and many others on the internet don’t show you how to really do it.

Here’s how its done …

Posted in , , |


Web Statistics