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.

Gemfile:

source 'http://rubygems.org'

gem 'rails', '3.0.0'

gem 'authlogic', :git => 'git://github.com/odorcicd/authlogic.git', :branch => 'rails3'
gem 'declarative_authorization'
gem 'rmagick', :require => 'RMagick'

group :development do
	gem 'sqlite3-ruby', :require => 'sqlite3'
end

group :production do
	gem 'mysql', '2.8.1'
end

On laptop,

$ sudo bundle install --without production test
Fetching source index for http://rubygems.org/
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.4) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.5) 
Using actionmailer (3.0.0) 
Using arel (1.0.1) 
Using activerecord (3.0.0) 
Using activeresource (3.0.0) 
Using authlogic (2.1.3) from git://github.com/odorcicd/authlogic.git (at rails3) 
Using bundler (1.0.0) 
Using thor (0.14.0) 
Using railties (3.0.0) 
Using rails (3.0.0) 
Using declarative_authorization (0.5) 
Using rmagick (2.13.1) 
Using sqlite3-ruby (1.3.1) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

And on my production server.

# sudo bundle install --without development test
Using rake (0.8.7) 
Using abstract (1.0.0) 
Using activesupport (3.0.0) 
Using builder (2.1.2) 
Using i18n (0.4.1) 
Using activemodel (3.0.0) 
Using erubis (2.6.6) 
Using rack (1.2.1) 
Using rack-mount (0.6.13) 
Using rack-test (0.5.4) 
Using tzinfo (0.3.23) 
Using actionpack (3.0.0) 
Using mime-types (1.16) 
Using polyglot (0.3.1) 
Using treetop (1.4.8) 
Using mail (2.2.5) 
Using actionmailer (3.0.0) 
Using arel (1.0.1) 
Using activerecord (3.0.0) 
Using activeresource (3.0.0) 
Using authlogic (2.1.3) from git://github.com/odorcicd/authlogic.git (at rails3) 
Using bundler (1.0.0) 
Using thor (0.14.0) 
Using railties (3.0.0) 
Using rails (3.0.0) 
Using declarative_authorization (0.5) 
Using mysql (2.8.1) 
Using rmagick (2.13.1) 
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.

Working as it should.

Fullfilling a Promise (from Google Cache)

Originally posted on July 27, 2008

While I was working on my bathroom, I would often make promises to myself that I would do or buy things when I was done to keep myself motivated. At some point, I had promised to buy myself a Tivoli iPAL radio to put in the bathroom after it was finished. Now that it’s done, I looked into ordering one. I just could not justify spending over $200 on a radio that would sit in my bathroom. So I just figured that I wouldn’t buy one. Then, I figured that there had to be a nice radio I could get that was nicer than a little flavor-radio (the first radio I ever bought myself when I was a kid, cost $3-$5) from Radio Shack and less expensive than a $219 Tivoli radio. I searched for a while and found the Sangean company. I ended up buying a PR-D5 and couldn’t be happier. It is just really cool looking and sounds fantastic. It looks great in the bathroom, but I’ve already taken it out a number of times to listen to it while lying in bed. I may have to get another one for my bedroom.

Notice the antenna isn’t even up. It sounds great even with it down.

My House Style (from Google Cache)

Originally posted August 3, 2008

Here is a photo of the front of my house. (The bushes are being removed next week. Yay, the big one on the right of the stairs basically smells like cat pee and is the home of about 100 flies.)

As can probably be seen from the photo, the front stairs are falling apart. There’s a big chunk on the left side of the fourth stair up from the bottom that’s just sitting there. It “fell” off last winter when I shoveled the stairs. Also note lots of stuff missing from the second to top stair. My next project will be rebuilding the stairs because they’re a hazard. (The railings are also loose.)

Now, I need to decided how to replace them. My original thought was to just replace what was there. But after talking to Mickey, he thinks wood stairs would be nicer. (Not real wood, but some engineered “wood” that won’t require too much maintenance.) I wasn’t sure that wood stairs would go with the brick house, but now I’m thinking they will. So, now I just need to come up with a design.

I’ve done some research and finally figured out that my house is “Italianate” style. You can tell from the tall, skinny windows with the rounded top parts (I can’t remember what those header parts are called.) and because of the eaves (the part of the roof sticking out over the front of the house). This style of house should have a small porch. So, if I were to add a porch, it shouldn’t be very wide, but it can be rather deep.

I also found a porch design webpage and got these hints. Make the pitch of the awning the same as the pitch of the roof. End the railings at the same height as the window sill.

Now, I looked for some photos of Italianate-style houses and I think it would be best if I just got rid of the awning on the porch. I like this idea for two reasons, it’ll let more light in the house, especially after I put in a new window over the door. And the rounded header over the door will be visible.

I also think that I’ll make the porch maybe a foot or two deeper than it is now. Both of my neighbors’ porches go closer to the street than mine, so I don’t think my house would stick out if I made it deeper. Then, I’ll also be able to make the stairs be less steep. They are currently too steep for my liking.

Then, I think I’ll do something under the porch to make it a little room where I could put a plug and store my lawn mower. It would be really cool if I could make the sides of the porch out of brick that matched the house, though that would probably be pretty difficult. Especially since I don’t know what the brick looks like underneath the paint.

Which brings me to another item I’d like to fix, removing the paint from the brick. All the brick on the front of the house looks to be in good condition, so I think I should be able to remove the paint. Almost certainly, this paint is going to have lead in it. The safest way to remove it, is to use a paint stripper and then cover it with cloth. When the paint comes loose, it can be peeled off with the cloth. I have to test this idea this week to see if it really works. If the brick looks good on a test area, I’ll definitely do that to the front of the house.

Best.Corn.Ever (from Google Cache)

Originally posted August 20, 2008

I got some sweet corn from my Aunt Lucille the other day and it was the best corn I’ve had in a very long time. I also prepared it properly, I think, which helped a lot. So, here are my instructions for making corn on the cob:

Husk and clean the corn. (I also cut them in pieces so I don’t have to use a giant pot to cook.) Put the corn in a pot and fill with water. Cover the pot and bring the water to a boil. Remove the cover and let it boil for two minutes. Turn off heat and let stand for 10 minutes. Ready to eat.

Rails and params hash (from Google Cache)

Originally posted January 7, 2010

I’ve been working with Rails long enough that I should start to remember some things, but that is not always the case. I’d always been getting confused about the params[:id] line that I would see all over the place. I’m hoping that by writing this down, I’ll remember what it means.

The params object is simply a hash that holds all of the parameters passed in the browser request. Since most routes are of the form :controller/:action/:id, a url like this:

http://localhost:3000/users/list/7

params[:controller] = users
params[:action] = list
params[:id] = 7

The first two aren’t used that much, but params[:id] is very, very common.

Perhaps This is Stupid (from Google Cache)

Originally posted August 21, 2008

I’ve decided to go back to school and take a class called Engineering Hydrology. I picked the local state school because it should be cheaper than a private school. The photo below shows how much ONE class is costing me. I am paying just about the same amount in fees that I’m paying in tuition, which brings the total for the one class to just under $2300. Since this is a four hour class, it’s basically costing me $575 per credit hour, which is definitely in line with private schools. In fact, I just checked my old credit card statements and found, in 2006, the one class that I took at IIT only cost me $2076.

I realize that if I took more than one class the fees wouldn’t be such a large percentage of the bill. However, since I am working full-time, it’s highly unlikely that I’d be able to take three or four classes, which is what a full-time student would do. And it would even be rather difficult for me to take two classes. I wonder if I get to write-off the entire $2295 on my taxes or if only the tuition counts. I guess I’ll find out at tax-time.

iPhone Update (from Google Cache)

Originally posted June 28, 2009

I have the old 8gb original iphone that my brother bought a few years ago. It’s in my care because it appeared to be broken. I have this feeling that it might not really be broken, so I’m giving it a go at trying to bring it back to life. First step was to put it in DFU mode, which is done by:

1. Turn off
2. Hold the power and home buttons at the same time
3. When see Apple, let go of power, but keep holding home
4. When see cable icon pointing to itunes icon, you are in DFU mode

At this point, the iphone appears in itunes and I can upgrade it.

Interestingly, it took about 30 minutes for the iphone software update to download, as it was around 245MB. During this time, the iphone did not stay in DFU mode, but somehow reboot itself. I just repeated the steps to put it back in DFU mode.

It took a while, but after downloading and updating, I had what appeared to me to be a brand-new iphone. I set it up as My iPhone and things looked ok.

I then downloaded QuickPwn, using the torrent file from here:

http://blog.iphone-dev.org/post/74278878/close-the-stable-door

I ran the program and let it do it’s thing. As far as I can tell, everything works fine. Now I just need a valid sim card to try it out.

I then used Cydia to install openSSH. I didn’t get any errors. So I opened a terminal on my laptop and entered:

ssh [email protected]

After quite a long while, I was prompted to accept the host key and could enter the password alpine. It worked perfectly.

maryh$ ssh [email protected]
The authenticity of host '10.0.1.195 (10.0.1.195)' can't be established.
RSA key fingerprint is f2:20:b6:5a:b2:cc:7c:12:a4:29:62:03:40:e4:1b:d3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '10.0.1.195' (RSA) to the list of known hosts.
[email protected]'s password:
localhost:~ root# df -H
Filesystem Size Used Avail Use% Mounted on
/dev/disk0s1 525M 471M 49M 91% /
devfs 27k 27k 0 100% /dev
/dev/disk0s2 7.6G 84M 7.6G 2% /private/var

Now I just need a valid sim card to test this out.

The Little House All Alone (from Google Cache)

Originally posted June 6, 2009

I babysit and my niece wanted to tell me a story. She’s six. Here it is.

The Little House All Alone by Annie Heintz

Once upon a time, there was a house. The people didn’t go to their houses. Instead, they went to the store. Then, the people finally got home and then they ate dinner and then they put on their pajamas and went to sleep. In the morning, they walked down and had breakfast. When they were done, they got dressed. The mom said to the daughter, “You have soccer today”. She got her soccer stuff on and she played soccer and she got one goal. The other team had zero. Then, they got two and the other team got one. The girl got 10 and the other team just got two. Then, she played at the park. Her mom picked her up from soccer and they went back home.

THE END

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

Originally posted January 1, 2010

I was looking over some blogs while eating lunch and found something about a spamassassin bug. There’s a rule like this:

header FH_DATE_PAST_20XX Date =~ /20[1-9][0-9]/ [if-unset: 2006]

Unfortunately, that will match mail from 2010. I took a quick look at my junk mail and found a message from my bank that should have gone through, but which failed. So I manually changed the above line to:

header FH_DATE_PAST_20XX Date =~ /20[2-9][0-9]/ [if-unset: 2006]

and restarted spamassassin. Hopefully, that will fix things.

Blown Power Supply (from Google Cache)

Originally posted October 14, 2009

Blowing a fuse at my house last month killed the power supply on coldandheartless.com. But I got another old one and replaced it and we’re back in business. I still hope to replace the entire coldandheartless system, perhaps with a mac mini, sometime soon. But, until then, I’m working again. (Granted, it’s basically in pieces in my basement, but everything is hooked together and it’s working. That’s good enough for me.)