fleshyorgans

Journal of a software engineer with a romantic heart

Coding: Rails Issues with :include

This is a sort of code analysis and something I discovered with :include usage in Rails. (This is in rails 1.1.6, so YMMV. I believe the latest Rails opts to use inner SELECTs rather than JOIN statements. Also, this is kind of long.)

Operator Precedence (ruby et al.)

Thought this was a little silly, but it generated a lot of discussion about precedence, short-circuiting of conditionals, and the value of syntactic sugar. http://pastie.caboo.se/146194

Quick and dirty hack for acts_as_attachment file movement

Say you’re working on something that uses acts_as_attachment. Also say that the person who wrote it decided that all the different models’ attachments would save in the same place. Also suppose that you want to change the file location of all those uploads. Well, here’s a quick and dirty migration that’ll save you from moving [...]

PHP and Payflow Pro FOR THE LOSE

Posting this cause I wan’t aware and the only other post I found was dated January. Since Paypal purchased Verisign they are discontinuing the pfpro extension to PHP. And in fact, what I’m reading is that Sept 2009 is the end of life for that functionality, meaning requests will not work beyond that point. For [...]

My tools for development under Ubuntu

My work machine recently developed the click of death, so I had to get a new hard drive and reinstall everything. Just in case this happens again, and in case anyone else is interested, below is the list of things I install in addition to the standard Ubuntu installation:

How I got ruby 1.8.5 on a Red Hat 7.3 box

For anyone else who needs to do this: Compiling Ruby 1.8.5 on an ancient redhat box is difficult. It’s not as simple as just make/make install… it doesn’t work right out of the box. My solution was to statically link ruby during compilation. Grab the source Extract Do “./configure” Edit ext/Setup (a text file), and [...]

Ruby Braces vs. Do/End blocks

When parentheses are important: So, braces have higher precedence over do/end blocks. According to Pickaxe, when calling a method with no parentheses, the braces will be applied to the last method parameter, do will be applied to the invocation. A Very Contrived Example: def string_to_integer   if block_given?     yield.to_i   else     0   end end a = [1,2,3] [...]

keep looking »
  • Follow me

  • Twitter

    Powered by Twitter Tools

  • RSS Tumblr Posts