Announcing ... rela.tv!

Posted by ryan
at 5:38 PM on Friday, July 28, 2006

I’ve been tinkering away on a little side project called rela.tv for quite awhile now. The basic concept is that it will let you visualize and organize your relationships.

“Relationships” is a loaded term, but in this case it means any relationship that can be defined in the terms of a hyperlink. With the foundation of the XFN class of relationships this can be any one of a number of pre-defined personal relationships. But rela.tv goes one step further and lets you define your own types of relationships.

It’s like tagging your links with real-world relational values.

No more explanation. Check it out and keep in mind it’s still very raw and is likely to look like poop on anything but Firefox… Hit me with any feedback you have!

tags: ,

What's New in Edge Rails: Explicit Deprecation

Posted by ryan
at 4:55 AM on Friday, July 28, 2006

After a bit of a hiatus (due to little reportable action on the source tree), a deprecation tidbit was just committed. What’s this little nugget do? The ActiveSupport library now provides the ability to explicitly state what methods are deprecated – which will pump out a warning message when that method is called. This is a nice way of not breaking your codebase by removing deprecated methods, while still letting others know that they’re marked for future removal.

Here’s how it works – simply include the deprecation module in the class that has a deprecated method (in this example a User model object) – and mark the method symbol as deprecated:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
require 'active_support/deprecation'

class User < ActiveRecord::Base

  # The method to deprecate
  def permitted?(role)
    roles.include?(role)
  end

  # Formally deprecate it!
  deprecate :permitted?

end

# This method will execute as normal - except now there's a warning
# message printed to your log file or to standard out:

User.new.permitted?('ADMIN') #=> false

# "Your application calls User##permitted?, which is now deprecated.
# Please see the API documents at http://api.rubyonrails.org/ for more information."

You can also denote deprecation of methods baseed on runtime conditions as well (useful when a method with certain arguments have been deprecated, but the method as a whole is still valid)


require 'active_support/deprecation'

class User < ActiveRecord::Base

  # Single arg method is now deprecated
  def to_s(format)
    if format
      ActiveSupport::Deprecation.issue_warning("to_s with a " + 
      "format is now deprecated, please use the no-arg call.")
      # ...
    end
    #...
  end  
end

# This method will execute as normal - except now there's a warning
# message printed to your log file or to standard out:

User.new.to_s(:long) #=> "Ryan William Daigle" 

# "to_s with a format is now deprecated, please use the no-arg call." 
# Please see the API documents at http://api.rubyonrails.org/ for more information." 

# However, this method will not have a deprecation warning:

User.new.to_s #=> "Ryan Daigle" 

It may not seem like much – but the ability to warn developers that a method is on the path to deprecation can save a lot of pain by making it more apparent which called methods are deprecated and not relying on developers to do their own homework.

We hate homework.

tags: ,

GTD Tracks Has its Own Blog

Posted by ryan
at 5:20 PM on Thursday, July 27, 2006

So as not to pollute my core Ruby readership – I’ve setup a dedicated blog for GTDTracks.com. Stay tuned there for the latest upgrades, tips and features…

tags: , ,

BarCampRDU: Session Reclamation Project

Posted by ryan
at 5:31 AM on Tuesday, July 25, 2006

The spirit of BarCamp is best summarized in the ad-hoc, self-organizing schedule board where session presentors place their session titles up in their preferred timeslot and the day’s events miraculously materialize.

So that the event can live forever, I’ve started adding notes on the best pic of the schedule board I could find for the sessions I went to/knew about. If everybody fills in their events we can have one place where the day’s events are nicely recapped… (Click on the pic above to add your note – and stay within the lines!)

tags: ,

BarCamp RDU: Yes Please, I'll Have Another 0

Posted by ryan
at 3:55 AM on Tuesday, July 25, 2006

This weekend’s BarCamp RDU marked the culmination of a few weeks worth of work for myself and the organizing committee, and even more for Fred, the head maestro. It was my first such event, and here are my impressions:

Logistically, everything went really well, except for maybe a slight shortage of our lunch foods (for which I am to blame).The volunteers totally stepped up and the cogs of the bar camp wheel operated efficiently.

I would say the sessions were of varying quality. There were a few I heard about during the course of the day and wondered why I didn’t go to them – and some of the ones I went to I wondered why I chose them. I would say as a general rule when choosing which sessions to attend – choose the ones where either the topic or speaker, or preferrably both, are more discussion oriented. Probably the most interesting session I wend to was the session on social networks by Fred Stutzman. It wasn’t that Fred totally dominated and blew us away with some really bleeding edge concepts – it was that he really made it a conversation between Fred and the group, and within the group itself. Choose the sessions whose topic (i.e. ‘Social Networks’) and speaker both encourage active participiation. After all, that is what a BarCamp is about, right?

I was really impressed with the overall quality of people who attended. A lot of different backgrounds and a lot of interesting people. While it was definitely a technology based conference, I really felt like my parents or significant other could have sat in on some of the talks and remained interested. It’s not all about geekin’ out.

And where else can you learn to Teach Your Wife Version Control and study up on Dancing with Girls in the same day?

All in all, a great experience – let’s do it again, ay?

tags: ,

Almost Free Tracks Hosting

Posted by ryan
at 5:50 AM on Friday, July 21, 2006

My last offer was so well received that I thought I’d extend it – with the small caveat that I’m going to try and cover my hosting costs this time around.

If you’re interested in using a hosted version of Tracks to manage your GTD life – head on over to GTDTracks.com and signup. It’s really cheap.

Just to be sure we’re clear, I am not associated with bsag, who is the author of this great tool. Any features I add in response to user requests will be given back to the Tracks project, but for now consider Tracks and GTDTracks seperate (but amicable) entities.

Oh, and if I signed you up for free earlier you’re in luck – you’ll never be charged.

tags: , ,

A Rails Feature You Should be Using: with_scope

Posted by ryan
at 5:48 AM on Thursday, July 20, 2006

The with_scope method provided by ActiveRecord has been talked about before (see the resources section below), but I don’t feel like people recognize what a great utility it is. Maybe awareness will increase with more tools that make use of this feature, like the MeantimeFilter by Roman, or just more public conversation about it. Add the following to the latter category:

with_scope lets you bind a block of code operating on an active record model to a particular subset of that model’s collection. For instance, using the standard blog application example, if I have a controller method that performs a series of operations on a single user’s articles I would need to pass in the user id condition on every operation:


def create_avoid_dups

  user_id = current_user.id
  # Find all user's posts
  user_posts = Post.find(:all, :conditions => ["user_id = ?", user_id])

  # Do some logic looking for dups in user_posts
  ...

  # then create new
  @post = Post.create(:body => params[:body], :user_id => user_id)

end

Notice we had to pass in the user_id on both the find and create method. with_scope lets us extract that parameter so the core operations aren’t obscured by excessive parameters:


def create_avoid_dups

  Post.with_scope(:find => {:conditions => "user_id = #{current_user.id}"},
                  :create => {:user_id => current_user.id}) do

    # Find all user's posts
    # No longer need user_id condition since we're in scope
    user_posts = Post.find(:all)

    # Do some logic looking for dups in user_posts
    ...

    # then create new without specifying user_id
    @post = Post.create(:body => params[:body])
    @post.user_id #=> user_id

  end
end

with_scope allowed us to specify conditions of the Post that would apply throughout the course of the block (conditions specified by operation, in this case :find and :create)

Contrived examples such as this one don’t do a great job of showcasing how useful this method is – but imagine never having to specify the user_id in any controller method because it’s been automatically scoped to that user for you. That’s exactly what the previously mentioned meantime filter does.

So don’t be shy. If you find yourself writing code that applies to a known subset of items, scope it with with_scope. All the cool kids are doing it.

Resources

tags: ,

This Man is Smokin!

Posted by ryan
at 8:59 AM on Wednesday, July 19, 2006

Smokin’ hot, that is (in the non-visual sense).

Joe puts his money where his mouth is and throws his hat into the Rails Engines ring with the new Help Engine.

In other news, the creation of a ‘HelpHelper’ rips a hole in the fabric of the cosmos, endangering millions.

What's New in Edge Rails: Nothing, Cause Tracs is Down

Posted by ryan
at 4:50 PM on Tuesday, July 18, 2006

The Rails Tracs is down, thus eliminating your sole purpose for coming to this site.

Sound of crickets chirping

It’s been down for quite a few days now – here’s hoping it’ll be back up shortly.

Free Tracks Hosting (GTD Galore)

Posted by ryan
at 3:20 PM on Sunday, July 16, 2006

Sorry, the handouts are over. However, if you’re the more motivated type, check this offer out

For those that are interested, I’ve set myself up with a hosted Tracks install and thought I’d offer a free account to anybody the first 12 people who are interested. It’s nice to have something not hosted on your local machine when you’re out and about or between machines. Or you just don’t want to manage the setup, upgrades and maintenance yourself.

So, if you’re a GTD weenie, or want to be, just comment here with your email address and I’ll send you your account info to GTDTracks.com

And if you already have a local install and want to import your existing data, I can do that for you too.

tags: , ,

Rails Engines Reference Guide

Posted by ryan
at 7:55 AM on Friday, July 14, 2006

An intern of mine took it upon himself to build this very complete Rails Engines guide. On behalf of everybody who has struggled to find good engines documentation, I say ‘Thanks Joe!’.

GDrive Finally Showing Some Love for Linux? 4

Posted by ryan
at 4:26 PM on Tuesday, July 11, 2006

Could it be? Could Google finally be throwing some support to the linux users amongst us?

Google Desktop, no linux client

Google Earth, no linux client (though the beta has mediocre Linux support)

Picasa, no linux client (woo-hoo!)

But now… the rumored GDrive release looks to have a linux client according to the screenshot. If it’s true, then thank you (finally) Google!

tags: , ,

gr.egario.us Gets an Update 0

Posted by ryan
at 4:17 AM on Friday, July 07, 2006

My RailsDay creation, gr.egario.us just got a little update. You can now set yourself up to be notified when a quote is commented on or voted on.

Right under the vote tally for a quote is the link you can use to be notified when somebody votes on that quote (when registered of course):


And right at the top of every quote’s comment thread is the same link for comment notifications:


If email notifications aren’t your thing, every listing page has it’s own rss feed – like the new quotes feed, the popular feed etc… so you can stay on top of the type of stuff that tickles your fancy.

Also new in this update is the ability to search for a quote. It currently searches on the quote body, context and who said it (no tag-based search yet). The nifty search box is brought to you by the wonder of scriptaculous’s auto-completing text fields and nice integration with Rails’ text_field_with_auto_complete javascript helper.


I’d love to hear what you think of the concept and what suggestions you have – so if you’re the opinionated type lemme have it!

tags: railsday, scriptaculous, gr.egario.us

Unit Testing Routes

Posted by ryan
at 3:41 AM on Wednesday, July 05, 2006

From the “I didn’t know this existed but now that I’ve found it I will use it more often file” – did’cha know you can actually unit test your routes using the assert_routing assertion?

Assuming a vanilla people_controller and this routes.rb:

map.connect '/:id', :controller => 'people', :action => 'show', :nother => 'woohoo'

You can test routing in your people_controller_test functional test with:

assert_routing "/#{model.id}", :action => 'show', :id => model.id, :nother => 'woohoo'

Good to know…