RLB3.COM

Objects on Rails

| Comments

This week I was at YAPC::NA in Austin, Tx. While there I took the time to get some reading done. The first book I read was Everyday Rails Testing with RSpec by Aaron Summer. This was an excellent book on how to think about testing in rails. The mix of RSpec, factory_girl, capybara, and other gems serve as a good base for tackling most testing issues.

The other book I read, Objects On Rails by Avid Grimm, was the one that made me rethink many things on how to write apps in rails. The simple idea of starting with plain ruby objects to model the problem domain was an eye opener. I have toyed with web development in common lisp and one of the aspects I liked was I could start with simple lisp lists to persist objects at the start instead of jumping right in to a database.

I knew the decorator pattern but the only real example I had of one was java’s decorator pattern for IO and because of that I avoided it. But Avid’s use to decorate a model for the view was beautiful. I plan to explore this pattern more.

There was so much information in the book that I can’t explain here. I plan to re-read the book to get a better understanding of the ideas and the techniques. I also want to do a talk at my local ruby group so I need to build an example rails app that uses the ideas from the book. Avid uses a blog as an example. I think I want to do an online election system. Anyway, great book. I recommend to anyone studying rails or object oriented design.

Org-mode TODOs

| Comments

I’m going to start a little series on org-mode. If you find it boring or want to talk about something else let me know.

The first use of org-mode is a todo list.

Headlines start with a *. For example:

* Case 42453: Fix spelling error

Multiple * will setup a hierarchy so that when you hit [tab] on a Headline at the top of the hierarchy the rest will be folded under it.

* Top ** Detail

Hitting tab on Top will result in

* Top…

The ellipses alway mark that something is underneath that header.

To mark something as a TODO you must be on a header line at hit S-right. That is the Shift and the Right arrow. This will add the keyword TODO to the RIght after the ‘*’. This can also be done with C-c C-t.

You can also add more TODO keywords by adding lines like this to the top of your file:

#+TODO: TODO | DONE #+TODO: CASE BUG KNOWNCAUSE | FIXED #+TODO: | CANCELED

Remember to C-c when you add headers like this to the file.

Keyword after the pipe are consider Closed conditions for the TODO. Also as you S-right the keywords will cycle through the list.

Tags may also be added for any headline. As when adding TODO keywords you must be on the line of the header then hit C-c C-c. In the minibuffer you will be asked for the name of a tag.

Once added a take will look like this:

* Start orgmode tutorial :blog:

The colons will be add for you. The next time you want to add a tag in the minibuffer you can use tab completion to find previously added tags. You can also add more than one tag. In the minibuffer you just need to separate the tags with a colon. For example:

* Start orgmode tutorial :blog:

You can also add tags to the top of the file like the todo keywords.

#+TAGS: @work @home #+TAGS: laptop car

Tags can have letters, numbers, the _ and @.

That’s all for today. I’m think about org-mode agendas for next time.

You Need a Budget

| Comments

I don’t remember learning much about money in school. There were word problems in math class, and in the 7th grade we learned to write checks. But I didn’t learn much about personal finance. The only thing I ever heard was that I needed to save money. Every once in a while you would hear, “Spend less than you earn”. Everyone expected you to know what to do.

Then I got my first job. I never seemed able to save money. I played gigs every once in a while which helped, but not enough. Eventually, I was able to cut my spending so I would have about $300 at the end of the month. I thought I was saving. I had no savings account or investments I just wasn’t spending everything I earned.

At the end of January I ran across YNAB. Which stands for “You need a budget”. That resonated with me because yes, I needed a budget.

The YNAB software is base on four rules:

  1. Give every dollar a job.
  2. Save for a rainy day.
  3. Roll with the punches.
  4. Learn to live on last months income.

When I read those it all made sense. I now know how to save money. The rules are pretty self explanatory except for number three. But it’s also an easy concept. Basically you are not going to be perfect when you make your budget, at least not for the first couple of months. So if you over spend in an area, move money from another budgeted area to cover the overage. It’s that simple.

I recommend YNAB to anyone that wants to save money. Which is pretty much everyone.

There is also a mobile app for iPhone and android. If you get the desktop software the phone app is invaluable.