Joe Moore's blog



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?

Standup 10/15/2008: this_method; dynamically creating tables for testing

edit Posted by Joe Moore on Wednesday October 15, 2008 at 03:56PM

  • Where am I? -- Ever need to find the name of the method you are currently within? Here's a this_method method! The magic is in the REGEX, of course.
module Kernel
  private
  def this_method
    caller[0] =~ /`([^']*)'/ and $1
  end
end
  • One project wanted to test a very ActiveRecord-specific Module in an isolated, generic way. After spending time researching techniques of mocking and stubbing the many, many ActiveRecord methods that would be touched, they decided to just dynamically create an ActiveRecord and a DB Table for it on the fly! They even used single table inheritance (STI)
  describe "MyMagicModule Mixin" do
    before(:all) do
      ActiveRecord::Base.connection.create_table "some_base_models",
                                                   :force => true do |t|
        t.string   "name"
        t.string   "type"
        t.integer  "some_model_b_id", :limit => 11
      end
    end

    after(:all) do
      ActiveRecord::Base.connection.drop_table "some_base_models"
    end


    class SomeBaseModel < ActiveRecord::Base;end

    class SomeModelA < SomeBaseModel
      include MyMagicModule

      belongs_to: :some_model_b
    end

    class SomeModelB < SomeBaseModel
      include MyMagicModule
    end

    it 'should use special belongs_to stuff from MyMagicModule' do
       model_a = SomeModelA.create!(
                        :name=> "Model A",
                        :some_model_be => SomeModelB.create!(:name => "Model B"))
       # test the functionality from MyMagicModule
    end
  end

Pivotal Labs Tech Talks now on iTunes!

edit Posted by Joe Moore on Saturday October 11, 2008 at 09:34PM

At Pivotal, we host tech talks for our and guest developers. You can now subscribe to these video and audio tech talks on iTunes!

Just search for "Pivotal Labs" in iTunes, or click on the 'Video' or 'Audio' buttons on our Talks page. The current playlist includes:

  • Scrum - Christian Sepulveda gives an overview of the Scrum development process as it applies to software.
  • HAML - Felix Mario and Aaron Peckham talk about HAML.
  • Vertebra - Ezra Zygmuntowicz talks about Vertebra, the distributed cloud application programming platform Engine Yard is building.
  • Fire Eagle - Seth and Blaine talk about Fire Eagle, a location-awareness provider for online applications. Fire Eagle is a Yahoo! venture and gives applications and websites user-configurable information about the user's location.
  • New Relic - Lewis Cirne demos New Relic's real-time Rails performance monitoring and analysis tool.
  • Devver - Benk Brinkerhoff and Dan Mayer talk about Devver
  • Rubini.us - Evan Phoenix answers questions about Rubinius, a Ruby virtual machine and compiler written as much as possible in Ruby.

Standup 10/9/2008: IE 6 Alpha Transparency Fixes?

edit Posted by Joe Moore on Friday October 10, 2008 at 04:36AM

Ask For Help

Once again, a project is asking for everyone's favorite IE 6 .PNG alpha transparency fixes -- more rounded corners! Examples include the CSS Behavior code, using .PNGs or .GIFs with on/off transparency, regulating IE 6 to the square Web 1.0 world, and even using on/off transparency and just knocking a pixel or two off of corners for a "good enough" rounded look.

What are your favorite IE 6 rounded-corner and/or alpha-transparency fixes?