Archive of posts from 2010

Rails 3 Table with Fields Using Calculated Data

I have a table in my app, called entries. Entries belongs_to :users and has a field (decimal) called hours. There is another decimal field called cost. Cost is not entered by the user, but is calculated by multiplying the value in hours with the value in users named rate. To get this to work properly, I had to do the following.

Downloading Spreadsheet from Rails

I have a rails app that needs to provide a spreadsheet of all the data in one of the tables. Specifically, we have a simple signup form for an event. I need to be able to let a subset of users download a spreadsheet of the current people signed up with the information given on the signup form. Here’s what I did.

Rails3, ldap and authlogic

I have an openldap server running and wanted to use it for authentication on a rails 3 application.

Mac OS X Server and WordPress

I have to say that I’m not at all happy with Mac OS X as a web server. My immediate complaint is that it’s not serving up WordPress themes correctly. I know I have them working properly, but when I go to other computers, I see that they’re not correct. I guess it’s time for me to move back to linux where I know things work properly.

Rails3 and Gemfile

I’ve had some problems with the new bundle install in rails 3. Specifically, on my laptop, in the development environment, I use sqlite. But in production, I use mysql. I was getting all sorts of errors on my laptop about the mysql gem not working and on the production server the errors were about a problem with the sqlite gem. Ideally, I wanted the development server to ignore mysql and the production server to ignore sqlite. Here’s how it was done.

Fullfilling a Promise (from Google Cache)

Originally posted on July 27, 2008

My House Style (from Google Cache)

Originally posted August 3, 2008

Best.Corn.Ever (from Google Cache)

Originally posted August 20, 2008

Rails and params hash (from Google Cache)

Originally posted January 7, 2010

Perhaps This is Stupid (from Google Cache)

Originally posted August 21, 2008

iPhone Update (from Google Cache)

Originally posted June 28, 2009

The Little House All Alone (from Google Cache)

Originally posted June 6, 2009

Happy New Year and New Year Spamassassin Issues (from Google Cache)

Originally posted January 1, 2010

Blown Power Supply (from Google Cache)

Originally posted October 14, 2009

RubyGems Notes (from Google Cache)

Originally posted October 15, 2009

I’ve been trying to do some stuff with ruby on rails and getting my program up and running here on coldandheartless. I had all kinds of trouble when I finally got to the deployment stage. The first errors I got were:

yo:site maryh$ cap deploy:setup
/Library/Ruby/Site/1.8/rubygems.rb:280:in `activate’: can’t activate net-sftp (= 1.1.0, runtime)
for [], already activated net-sftp-2.0.2 for ["capistrano-2.0.0"] (Gem::LoadError)
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:35:in `require’
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/
gems/capistrano-2.0.0/lib/capistrano/upload.rb:2
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/
capistrano-2.0.0/lib/capistrano/configuration/actions/file_transfer.rb:1
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require’
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/
capistrano-2.0.0/lib/capistrano/configuration.rb:12
… 7 levels…
from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require’
from /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8/gems/
capistrano-2.0.0/bin/cap:3
from /usr/bin/cap:19:in `load’
from /usr/bin/cap:19

After screwing around for a very long time, I found that I seem to have some old versions of gems that were messing me up. And I when I tried to uninstall them, I got this error:

yo:gems root# gem uninstall capistrano -i /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
Remove executables:
cap, capify

in addition to the gem? [Yn] Y
ERROR: While executing gem … (Gem::FilePermissionError)
You don’t have write permissions into the /System/Library/Frameworks/Ruby.framework/
Versions/1.8/usr/lib/ruby/gems/1.8/bin directory.

So I went to go and look at the above directory and it’s true that I don’t have write permissions because there was no bin directory there at all. After I created the bin directory, I was able to uninstall the gems. So now I should be able to uninstall the old stuff and put the newest files on.

Working with httpd.conf (from Google Cache)

Originally posted October 16, 2009

Comcast, SurfBoard SB6120 and Airport Extreme (from Google Cache)

Originally posted Nov. 28, 2009.

My First Solar Image (from Google Cache)

Originally posted March 3, 2010.

Business is Open!

I got my first consulting work check today. It wasn’t much, but it was something. I’ll have to build on this to get the business going.

A New Coldandheartless

It might be a bit obvious now, but my coldandheartless server died a painful death last week. I finally got around to seeing if I could fix anything and found that the system drive had completely failed. I tried rescuing files from the drive and it didn’t work. The good news is that I had the webpages on a separate disk which was still fine. So I could copy all of those files to my new server. Unfortunately, my wordpress database was not backed up (my bad) and I was unable to restore any of the files. The good news is that I did find one old backup (from sometime in 2008) that I could use to get back some of my posts. So there is now about a two-year gap in the blog. Oh well. Lesson learned. Now, I have to devise a new backup scheme. I haven’t yet decided how to do it, but I’m sure I’ll come up with something.