I’ve found that a little bit of planning helps me get much more accomplished than just trying to do things willy-nilly. I look back with great satisfaction at my decision to learn Ruby on Rails about three years ago. It took quite a bit of time and I’m not a guru yet, but I can and have created some websites that have been helpful. Since I had a personal day that I needed to use before the end of the year, I’ve taken it today and will use that to lay out my plans. And because I think that making the plans public will help me stick to them, I’ll post them as soon as they’re done.
In my latest app, I’m emailing reports to people who click on a link. (Yes, I know this should be a button, but I just did it with a link because it was easy. If I have time, I’ll change it to a button.) Anyway, I’m attempting to use Process.fork to do this. What I have that works is:
I finally had my fill of all the crap of Godaddy. Actually, that’s not quite true. That was a push, but the thing that really got me to switch is just the terrible website that one has to use to do anything with Godaddy. I found a new registrar Badger.com and decided on a whim to switch to them. I got one free credit (so I could transfer one domain for free) from Hacker News and I ended up buying two more for $8 each. I then started the process and was amazed to find that I had my three domains transferred in about 10 mintues. And they added an extra year to my domains. Their website is nice and clean. It’s easy to find stuff and they don’t try to sell me more crap each time I login. I can’t believe I waited this long to switch, but right now, I’m glad I did.
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.
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:
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.
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.
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>
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.
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:
I’ve used rvm to install ruby 1.9.3-p0. Unfortunately, after installing, I get these errors:
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:
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.
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.
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.
I am sure that there’s a better way to do this, but I got this working and I wanted to document it.
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.
If I have a number of different versions of rails, I can create projects for a particular version with:
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.
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.
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.
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.
I have an openldap server running and wanted to use it for authentication on a rails 3 application.
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.