• Rails Integration Tests

    After unit tests, for me, the important tests are integration tests. This is where I can test logging in and checking authorizations and calculations. They are a bit more involved, but not too difficult once you get the hang of them.

  • Rails Unit/Functional Tests

    In my latest rails project, I am trying to write good tests for everything important. My first tests were all unit tests. These are pretty easy. All they basically do is make sure that the data that’s stored in the database is formatted properly. So I have a bunch of tests that make sure that my validations are correct. A sample test looks like this:

  • *#$!^&*! Spam

    I hadn’t been blogging much, so I didn’t realize that I was getting slammed with trackback and pingback spam. After my last post, I noticed that there were over 800 comments. I knew this was going to just about all be spam, so I had to figure out what was happening. Since I had already turned off comments, I knew that wasn’t how it was coming in. I went to the dashboard and noticed that pingbacks and trackbacks were still on, so I turned them off and thought I was finished. Only after deleting the over 800 comments, did I see them keep coming. So I had to do a little more research to find that the checkboxes only turned off trackbacks and pingbacks for future posts. The earlier posts still had it on, which is why I kept getting the spam. These had to be turned off manually, which was going to be a pain, since I have a number of posts. But then I found a simple mysql command to turn them all off at once.

  • My Turn

    When I was a kid, I played in lots of sports. My parents were big believers in organized sports as a way to keep kids out of trouble. Since I tended to find them fun, I, for the most part, happily went along with it. Looking back, I had no idea how much time people freely gave in order for me to have all these opportunities. I didn’t appreciate the gift that these teachers and coaches gave me of their time and knowledge. Now, however, I do realize how very generous they were. And, since I’m now an adult, I think that it’s my turn. I’ve made monetary donations in the past to various organizations. But now, it’s time for me to give more back. I’ve been very lucky to have so many opportunities and I think that I now have something that I can offer people. So I need to decide what to do.

  • A Device Attached to the System is Not Functioning

    I have a server running openldap and samba, acting like a windows domain controller. I have had no problems with adding windows 7 computers and users until today. One user could not login and this was the error.<pre class=brush:bash> A device attached to the system is not functioning. </pre>

  • Toggling a Div On/Off and Setting Default State

    In order to have a section of a webpage toggle on and off, I need to use the toggle function that is provided by jquery.

  • Nested Attributes, Forms and Validations

    I have a simple app where people can apply for a position. The table for this is applicants. Then, all users are allowed to rate each applicant. The ratings are in a table called ratings, which just has an applicant_id, user_id and score. So our tables are:

  • Moving to <strike>Ruby 1.9.3 and</strike> Rails 3.1.1

    I’ve used rvm to install ruby 1.9.3-p0. Unfortunately, after installing, I get these errors:

  • My New Rails Deploy Method

    I recently learned that capistrano can temporarily take down the web server while it’s being updated. This sounded like a very good idea to me, so I’ve started to use it. The only change I needed to make was to my /etc/httpd/conf/httpd.conf file. My virtual host now looks like this:

  • WordPress Issue

    I’ve changed the permalinks on my blog to show the year, month and title. This edited my .htaccess file so that the links worked. But my new problem is that images are not showing. So, I’m making this post as a little test. I’m posting a new image to see if it works.

  • Odd Jobs

    I am one of those people who considers herself completely replaceable. So, at work, I tend to try to continually make myself useful, so that even if I’m not needed to do what I was originally hired for, I can do something else that is required. I don’t think that I’m an expert at anything, but I like to learn enough so that I can solve problems that come up. Basically, I consider myself a generalist.

  • Things that Drive Me Nuts (or Why I&#8217;d Rather Build My Own Computers)

    I recently purchased two Dell Optiplex 380s. Dual core pentiums with 3gb of ram and windows 7 professional for $434 each. I was quite busy and needed to get them quickly for my Mom’s office. Normally, I prefer to build my own systems because I know exactly what I’m getting. But the Dells were the right price and easy to order. After I ordered the Dells, I also ordered four Western Digital enterprise drives (WD5003ABYX) to use for a mirrored raid in each system. I did check that the optiplex systems had space for two more internal drives. I also knew that I’d be buying a separate raid card to put in the systems. I didn’t order that ahead of time because I wasn’t exactly sure what slots would be present/available in the system.

  • Validating Nested Attributes

    I am sure that there’s a better way to do this, but I got this working and I wanted to document it.

  • Server Updated

    I had noticed that my webpages from my server at Slicehost were very, very slow. A quick look showed that I was out of memory and using a lot of swap space. A few times, I even caused my system to crash because I ran out of memory. Today, I cloned my server to a new one with more memory. This is my first post using the new server. I’m testing things to make sure everything is working. So far, so good.

  • Multiple Rails Versions

    If I have a number of different versions of rails, I can create projects for a particular version with:

  • rvm notes

    rvm list
    
  • Supermicro X7SPE-H D525 and Antec ISK300-150

    This motherboard does NOT fit in this case. After rereading the specs, the motherboard is in the Flex ATX size and the case is mini ITX. While I thought I read that these were compatible, I can now state emphatically that they are not. So, my decision now is whether to return the case or modify it. If I knew I could find another case that fit the motherboard, I’d do that. But I’m not clear that I’ll be able to find a flex ATX case. In which case, I’m going to have to modify something anyway, so why not this cheapo case that I have.

  • Rails3 and Standard Library CSV

    Recently I had learned how to write a csv file in my rails app using the fasterCSV gem. In Rails3, CSV is now part of the standard library, so things are a little different. I also did a few trickier things this time around, so I’m updating my notes.

  • 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