If you are reading other books on Ruby, Rails, etc., . . .

Posted by john in Ruby on Rails, Ruby, Announcements

If you’re reading other books, articles, blogs, on Ruby, Rails, etc., by all means post a review or comment in our books section. If you find a resource that is truly outstanding, I’ll get it and add my own review to our annotated list of resources.

Also, I notice that I hadn’t actually published that “John’s To-dos” page. It’s there now.

John’s Todos

Posted by john in Uncategorized

Oops. Reproduced the “todo” list in a post: Go over here if you want to make comments: resources/johns-to-dos/

Your one-liners?

Posted by john in Ruby

Now that we are past the one-liner era in our progress along the Ruby Way, I’d like to invite you to propose some one liners of your own.

Just to kick it off:

Given a dictionary d with bad words:

d = [ ‘Yankees’, ‘Rockies’, ‘Indians’ ]

write a one-liner that replaces any usage of such bad words in a sentence with the first letter of the bad word followed by stars, one star for each of the remaining letters.

Input:

“As much as I can’t stand the Yankees and relish beating them, I’m glad we faced the Indians.”

Output:

“As much as I can’t stand the Y****** and relish beating them, I’m glad we faced the I******.”

P.S. I haven’t implemented this one. Seems like a one-liner . . .

Overview of Assignments 4, 5, and 6 posted

Posted by john in Assignments, Announcements

I’ve added a page with an overview of Assignments 4, 5, and 6 (also in the sidebar under “Assignments”). Comments most welcome on the general project / product; questions for Assignment 4 and ActiveRecord specifically will be more appropriate for the page on Assignment 4, which will be appearing shortly…

Perlisms in Ruby

Posted by john in Ruby

Here’s a link for some Perlisms in Ruby. There are of course many more that those the author lists here:

http://blog.nicksieger.com/articles/2007/10/06/obscure-and-ugly-perlisms-in-ruby

The whole discussion is very interesting. I think the author is being awfully harsh on the defined? method, because it is easy to imagine scenarios where you’re having a little trouble determining if Ruby is understanding something as a method or constant.

Widened theme for course site

Posted by john in Announcements

While working on the page that will display Ruby style suggestions, I discovered that the 800 width was really not too hot for code snippets.

So I have hacked the theme to assume that the screen is 1024 pixels wide or larger. Even if you are in that 14% (probably less now) of users with an 800-pixel wide screen, the main page area still fits within that width.

There are still a couple of widths that are funky (e.g., for comments) and I had to lose (for now) the banner image and the background behind the sidebar, but those will come back in some form.

Amazon referral earnings

Posted by john in Announcements

As you will recall, I set up this site so that books ordered on Amazon through it (and I also put some links on my personal blog) would generate referral earnings.

Well, we’ve now earned $144.53, which we will be spent on ourselves [i.e., people in the course] toward the end of the semester . . . for food and drink at some kind of post-meeting event.

Key topics for ActiveRecord

Posted by john in Ruby on Rails

I have to pick and choose a bit for ActiveRecord topics; we actually have two weeks for this, and I got rdoc and Test::Unit out of the way, so, really, you should get your key knowledge earlier (which will help for the assignment). The first lecture will begin with the briefest relational/SQL refresher.

Basically I am trying to identify the core aspects of the relational model so that I can show how each one is dealt with in ActiveRecord.

Below are the topics that I think are most important.

Requests for you:

  • If you feel like you need more than the briefest relational/SQL refresher, speak up. I can provide, for example, a PDF of some pages to help you re-activate that knowledge.
  • If there are other things (besides what’s below) you want to hear about based on your experience with relational databases and SQL, make comments.

ActiveRecord Menu

  1. Migrations
  2. Creating a class that leverages ActiveRecord
  3. Key datatypes
  4. Basic Create / Read / Update / Delete operations
  5. Validations
  6. How ActiveRecord manages 1:Many and Many:Many relationships; and how ActiveRecord manages data related to the Many:Many relationship (e.g., join tables)
  7. How ActiveRecord models relational “group by”
  8. How ActiveRecord manages aggregate functions
  9. How ActiveRecord manages what would be suitable for left join
  10. How ActiveRecord provides single-table inheritance

—–

Things that I will mention but will not detail:

  • ActiveRecord and transactions
  • Polymorphic associations

D’oh! My numlock issue was . . .

Posted by john in Technology

D’oh!

Because of the placement of the ThinkPad NumLk key, it seems as though you would have to press the function (Fn) key. So I did that. Didn’t work. Then I tried it in conjunction with many other keys: Ctrl, Shift, Alt, etc., etc. A student came up and did the same things. Couldn’t budge it.

After perusing the deeply buried documentation on the Status lights, to turn off NumLk you simply type: SHIFT NumLk. No Fn.

Obvious. But I have seen other wrestle with this in exactly the same way I did!

Thanks for bearing with me . . .

Ruby Debugger

Posted by amy in Ruby on Rails, Ruby

Someone in my section asked about debuggers for ruby code, and I said something unhelpful like “What’s wrong with puts?!” but promised to get back to them with something more useful. So if you want to, go read about Ruby-Debug here.

WP Theme & Icons by N.Design Studio
Entries RSS Comments RSS Login