In the event that I want to make a simple dropdown list in a form in rails, I can use this:
I was feeling pretty full of myself after replacing the screen on my iphone. Alas, I now have new troubles. It seems that my iphone thinks that headphones are plugged in all the time. This means that I cannot take calls, listen or speak on my phone without putting it on speaker. I thought that this was related to my changing the screen, but I don’t think it is. First of all, I didn’t have this problem after I replaced the screen. It appeared about a week later. Secondly, I searched this issue online and found that lots of people have it. Just another great apple product.
As I spend most weekends, I was working at my house today. I met my contractor in the morning to discuss putting in the back door. He’d rather just come back one more time to finish everything, so I have to buy my lights and then give him a call. So, I may be able to get all that done in a few weeks. Good thing I did my taxes, so I’ll have a little money to buy the lights.
Earlier this week, I had a bad day. I had two cars that I couldn’t drive, my bike had a flat, my iphone was in pieces, the power supply for my laptop was working sporadically (ended up buying a new one) and I was dreading doing my taxes. Today is much, much better.
Recently, I started using the ransack gem (https://github.com/ernie/ransack) for searching in one of my apps. I’m putting this here as an example, in case I ever need to make any more changes. The basics of ransack are pretty easy to do and work decently well. First step, add a search method to your controller. It should look something like this:
I didn’t feel like posting yet another pictures of the floor in my kitchen. However, it is now done, up to the back door. The next step is grouting. I’m debating whether I should grout or wait until I finish the whole thing before grouting. Either way, the tiles are all in. Took a while, but I think it looks pretty good.
I could be messing around with arranging tiles on the kitchen floor for years. I finally decided that I just need to set the tile and see how it turns out. If I make a mistake, so be it. I’ll figure out a way to fix it. So I spent today setting tile. I have about half of the area done that I want to do. I could have probably done the entire kitchen, but realized that this would block access to my bathroom. This meant that I couldn’t get to either bathroom in the house. The upstairs one is blocked because I started sanding the stairs. Blocking the downstairs one just seemed like a stupid idea. So I did half the area, to leave a path. I’ll do the other half after I can walk on the tile I just installed. So, here’s how things look so far.
Here’s where I am on the floor.
I’m working on a new app for work. Basically, it’s just another app that lets people put up some info and an image to go with it. The difference to this one is that I’m storing information on glass plates, which each have a unique identifier that’s not an integer. I didn’t want to mess around with changing the primary key from id to something else, because later I’m going to be using it with some other tables. Instead, what I’d like to do is be able to show the image associated with the plate at a url that uses the unique identifier. So, instead of something like plates/12, I could download the info at sample/538-12122. Here’s what I did.
I fixed most of the bad boards in the subfloor of the kitchen. And cut out some cement board to use as a sublayer. Here is how the house is looking.
Even though the floor has a definite slope, I figured I had to replace some bad boards in the subfloor. Here are the boards I’ve replaced so far. I probably need to do one more, but I think I’ll use a 1″x8″ instead of a 1″x6″, since there’s a bigger hole to fill.
I spent the days working on the house. Made a big mistake, but learned a valuable lesson.
My Aunt Lucille celebrated her 81st birthday just before the new year. Happy birthday to her!
While staying at my sister’s condo, I thought that her furnace seemed rather loud. In fact, it’s loud enough that it has woken me up a few times. I was thinking that maybe it was getting louder because the furnace filter needed to be changed. So, when it woke me up at 5am this morning, I decided to find out what size the filter was so I could buy a new one after work. Since it’s above the ceiling in the bathroom, I needed a ladder to reach it easily. There’s only a step stool here, so I was stretching quite a bit to try to get to it. I quickly saw that this was a size filter that I had never seen before. I figured it was roughly 12″x36″. I went to Home Depot after work, thinking there wouldn’t be many filters in that size and I’d notice it right away. Well, there were no filters in that size. Nothing remotely close. So, I got a tape measure and actually measured the filter when I got home. The size, 9 7/8″ x 39 3/4″. Basically, 10″x39″. Looked online and didn’t find anything remotely around that size. It looks like this was going to have to be custom made.
The floor is probably not going to be beautiful, but I think it’ll look ok. And I love the fact that I’m using the same wood that was in the floor. Stuff that had square nails in it when I pulled it out.
I finally decided that I was never going to get the floor perfect with sanding and that it was finally good enough. So today, I bought a can of stain and decided to just put it on to see what happens. I was going to just stain the one side of the floor that looked lighter, but then decided to do the whole thing. I didn’t really wipe any off on the lighter side of the floor, but did wipe off right away on the darker side. When I go back tomorrow, I’ll see how it turned out. If it’s ok, then I’ll put on the finish coat. If it’s not ok, I’ll probably also put on the finish coat because I have no idea how to fix this.
Happy New Year!
In one of my rails apps, I send out email to a particular user. But, I can look at the message before it goes out. Then, at the bottom of this preview page is a link to actually send the message. I’m pretty sure that since this action is changing a boolean value on the user along with sending the email, that I should be using a button instead of a link. However, just switching the link_to to button_to won’t work because link_to uses a GET request, but button_to uses a POST request. So I need to change the button_to to use GET. The way to do that is like this:
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.