Joe Moore's blog



Standup 11/21/2008: Pro Bono Airwaves

edit Posted by Joe Moore on Saturday November 22, 2008 at 12:07AM

Interesting Things

  • Rails reminder: flash[:notice] = "Good Job" will survive a redirect, while flash.now[:notice] = "Good Job" will not. In general, flash.now is used when you render a template without a redirect, such as when a form submit has validation errors.
  • Good Books: Several folks have recommended JavaScript: The Good Parts.
  • Pro bono: Would anyone like to help out KUSF for free? Their new website project has been stalled for a year.

Ask for Help

"How do you get Selenium to work with Firefox 3?"

If you know how, pull the jar files out of a later release and use those. Good luck!

Standup 11/18/2008: Unbelievable has_many :through Gotcha

edit Posted by Joe Moore on Tuesday November 18, 2008 at 11:53PM

  • One team discovered a jaw-dropping issue with has_many :through. Given the following:

    class User < ActiveRecord::Base
      has_many :user_photos
      has_many :photos, :through => :user_photos
    
    • a_user.photos.create will create and persist both a Photo object and the UserPhoto join object
    • photo = a_user.photos.build followed by photo.save will create and persist the Photo object only, and will not persist an appropriate UserPhoto join object.
  • Rails 2.2: Test::Unit::TestCase extentions have been removed from Rails Core and are now in ActiveSupport::TestCase. As stated in the Groups Thread about this, use ActiveSupport::TestCase instead of Test::Unit::TestCase in test/test_helper.rb.

Standup 11/07/2008: Selenium for Flash

edit Posted by Joe Moore on Friday November 07, 2008 at 05:23PM

Interesting Things

  • Teaser: Selenium for Flash! We've developed a Selenium-like framework for Flash. It's pre-alpha, and needs to be extracted from it's current home inside a project. Are you interested in a Selenium-like framework for Flash, or have you written one yourself? Let us know!
  • STI-weirdness. Rails surprise of the day: given a query of a has_many :photos where Photos has STI subclasses (got that?) Rails will build a SQL query that includes the subclass types of Photo, which you might not want:

    foo.photos.find_by_type("Photo") 
    # query will have "... WHERE type IN ('Photo', 'OriginalPhoto', 'ThumbnailPhoto')"
    
  • It appears that the retardase_inhibitor might not work with Rails 2.1.X due to fixes in ActionMailer.

  • JetBrains has been hard at work: they have released both a new Ruby plugin for IntelliJ, and a ruby-specific IDE (based on IntelliJ) named RubyMine.
  • Check out Pivot Jonathan's wife's art exhibit at Artist-Xchange Gallery in San Francisco, Friday 11/7 from 7-10pm:

    Artist-Xchange Gallery
    3169 16th Street
    San Francisco
    CA 94103

Ask for Help

"I want to create a custom launcher for Firefox 2 and Firefox 3 with different profiles. Perhaps the real question is how do we create a custom version of a Mac application launcher, passing in the arguments we need?"

... without having to invoke it on the command line every time.

"We're trying to delete cookies in our Controller, but they keep appearing in the headers anyway."

Suggestion: make sure you are specifying your URL paths and domains correctly.

"Why won't our CSS and other assets load the first time when accessing an SSL-protected domain on Engine Yard?"

It's most likely not Engine Yard or Firefox 3's fault. More research needed.

Standup 10/20/2008: Preventing Flash from Reloading

edit Posted by Joe Moore on Monday October 20, 2008 at 03:39PM

Interesting Things

  • We discovered why a Flash widget was reloading itself: changes the CSS position value. We were hiding the Flash widget by moving it's containing div off the page with position: absolute; left: -9000, and removing the class that had those values to show it again. It turns out that changing that position value causes the Flash to reload. By keeping the position:absolute setting when we both show and hide our container div, the Flash no longer reloads.

Ask for Help

"When using Rails's date_select helper, is there a corresponding helper method to turn that date format into a Date object in the controller?"

Some Snippets are available, but how about a Rails built-in solution?

bookmark_fu: drop-in Iconistan

edit Posted by Joe Moore on Saturday December 22, 2007 at 12:50AM

We just implemented bookmark_fu on Pivots and the experience was very smooth, taking only a few minutes. We how have an "Iconistan" of social bookmarking chiclets for either remembering or promoting content on Digg, reddit, del.icio.us -- almost 20 sites in all.



Install via the normal plugin install process (the -x installs it as an SVN:EXTERNAL):

#> ruby script/plugin install -x svn://rubyforge.org/var/svn/pivotalrb/bookmark_fu/trunk/bookmark_fu

I did have one issue -- the script/plugin install script pulled all the code down but ultimately failed because we have multiple versions of Rails on our development machine (about 5); this seemed to confuse the install script. No problem, though: I ran the install.rb script manually:

#> script/runner vendor/plugins/bookmark_fu/install.rb

Standup 02/16/2007

edit Posted by Joe Moore on Saturday February 17, 2007 at 06:57AM

A shorty today.

Interesting Things

  • A massive group of developers is revisiting and debating the current state of our shared-code architecture. appable_plugins might not be a perfect match, and we might develop our own or plugin-sharing system.

Total Stand-up Meeting Time: 12:00 minutes

Standup 02/15/2007

edit Posted by Joe Moore on Thursday February 15, 2007 at 06:52AM

Interesting Things

  • Subversion Tip: We were reminded of a handy tip: when saving shell scripts in subversion, you can save them as both executable and also in a 'native' end-of-line style, which will run on any platform.
<code>
   $> svn propset svn:executable ON somescript.sh
   $> svn propset svn:eol-style native somescript.sh
</code>
  • If you want some easy but very effective charts, check out WebFX's Chart Javascript library. Clients love them! Chart the number of users signed-up per day, etc.
  • Another handy plugin we've used many times: QueryTrace. It helps you find slow database queries, but it really floods your logs with data, so make sure to turn it off in production!
  • We're using appable_plugins for several projects but having problems with dependencies between the plugins, especially in fixtures. This might be caused by our fancy-dancy fixture loading extensions.

Ask for Help

  • One project is doing another round of profiling and is looking at the the latest profiling tools for Ruby and Javascript. They are checking out Firebug's JS profiler, ruby -r profile, and our own custom ruby test benchmarker, amongst others.
  • One project is seeing a very strange memory leak that causes 100MB of memory loss per second (guh! guh!). It started when they begin using ActiveRecord.connection.execute("some sql") to build some reporting statistics, but it seems too early to blame that. Coincidental, though.

Brown Bag Lunch Topic: Rails 1.2 features, ideas, and gotchas.

Total Stand-up Meeting Time: 25:00 minutes

Interesting/Ask for Help for 02/14/2007

edit Posted by Joe Moore on Thursday February 15, 2007 at 12:12AM

Interesting Things

  • We'll be sending 6 people to RailsConf, so say 'hi' if you see the Pivots!
  • We have a fix to our Amazon S3-causing-mongrel-to-hang problem: you can tell the connection not to be persistent by passing in :persistent => false:
<code>
    AWS::S3::Base.establish_connection!(
        :access_key_id => access_key,
        :secret_access_key => access_key,
        :persistent => false
    )
</code>

Ask for Help

Total Stand-up Meeting Time: 14:00 minutes