The Ruby Feel

Posted by curt on February 5th, 2006

I've been using PHP about 8 years now for web development. I remember when I first discovered PHP. I had been writing CGI applications in C/C++ at the time, and PHP was a breath of fresh air. It was so powerful, yet so simple. I can't describe it exactly, but there was a good feeling about PHP.

Fast forward to present day where I've been learning and using Ruby, and the feeling is very similar. For me, Ruby is the next breath of fresh air in programming languages. It just feels right.

Obviously, other programmers have different opinions, and that's okay with me. I'm not here to win your heart for Ruby. Other languages may create the right feel for you. If python makes you happy, then I say "Congratulations, on finding a language that you love!"

vim tips

Posted by curt on January 30th, 2006

I'm using Vim more and more these days for coding. Below are some useful Vim links:

 

Ruby on Rails session store

Posted by curt on January 29th, 2006

I've been building a Ruby on Rails application that is potentially going to be very large, and I need to choose an appropriate session store. Based on Scott Barron's article, I'm wavering between a Distributed Ruby (DRb) server and the ActiveRecord solution.

It looks like DRb can squeeze out a few more requests per second, but using it requires the extra maintenance of making sure one more daemon is always up. This isn't a huge problem, just one extra component to maintain. I also think DRb might get memory hungry with thousands of sessions. And, will it be faster than the DB when I need to sweep out older sessions?

For now I've decided on the ActiveRecord store as it seems a wee bit simpler, but I'll probably end up testing both. If DRb's performance is too good to pass up, I'll use it instead.

Ruby Code & Style

Posted by curt on October 10th, 2005

Well, it's been almost a month now since the baby came. We're doing well, but very tired. Adding to my things-to-read-when-I'm-not-so-tired list:

Ruby Code & Style - a new online magazine from Artima about the Ruby language.

PL/Ruby and PL/PHP in PostgreSQL

Posted by curt on August 23rd, 2005

The ability to write procedural language (PL) in Ruby and PHP for PostgreSQL is awesome. I wish Oracle had something similar (and no, I'm not talking about Java).

passing ORACLE_HOME to Apache environment for PHP oci8 module

Posted by curt on August 9th, 2005

A couple of weeks ago I was installing a development environment at work on CentOS with Apache 2, PHP, and the oci8 module. All configured, make'd, and installed, I was up and running with Apache, PHP, and the Oracle Client tools (sqlplus, etc.) in short order. Everything worked except the oci8 php library functions–they couldn't find my Oracle instances to connect.

I had covered all of the bases:

  • I could connect with sqlplus to my instance, so the Oracle client worked
  • I had set the ORACLE_HOME with SetEnv in Apache's configuration file and in bash's system profile
  • phpinfo() showed the oci8 module as installed and the ORACLE_HOME environment variable as set

This problem had me stumped a good part of an afternoon until I attempted to start Apache directly with apachectl instead of through the 'service' command used in CentOS. Suddenly, it worked!

A quick shuffle through the service script and I found that it was restricting the environment before calling the service like so:

env -i LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"

Hmm. So, only LANG, PATH, and TERM are passed into any service environment: ORACLE_HOME is left out in the cold. And, even though I set it in the httpd.conf file, this is apparently too late for it to make a difference in the php oci8 module. A quick fix in the service script adds the requisite ORACLE_HOME:

env -i ORACLE_HOME=$ORACLE_HOME LANG=$LANG PATH=$PATH TERM=$TERM "${SERVICEDIR}/${SERVICE}"

The line above occurs a few times, so add to each occurance. Voila! It works.

I'm content with this solution for now, but I don't particularly like having to change the service script, so is there any other way to do this?

Update:This is apparently a common issue: Debian mailing list comment, Gentoo bug, which is fixed with a white list of environment variables in a separate file. I couldn't find a similar RedHat/CentOS bug. And, the SetEnv in the httpd.conf file is only effective for CGI PHP, which does not work for me because I'm using mod_php


Copyright © 2007 csummers.org. All rights reserved.