Pivotal Labs

Main menu

Skip to primary content
Skip to secondary content
  • About
  • Case Studies
  • Team
    • Executives
    • Locations
      • San Francisco (HQ)
      • Boston
      • Boulder
      • Denver
      • London
      • Los Angeles
      • New York
  • Community
    • Blogs
    • Tech Talks
    • Events
  • Careers
    • Lifestyle
    • Principles & Practices
    • Benefits
    • FAQ
    • Apply
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

Standup 9/8/11

Ryan Richard
Thursday, September 8, 2011

Ask for Help

“What’s the best gem for Google Calendar integration? There are a few out there.”

It was suggested to look for a gem which is implemented using CalDAV, instead of the old Google APIs. Anyone have any specific suggestions?

Interesting Things

  • Iconfinder.com: search for icons filtered by license
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Embedding VideoViews in your UI: Caution!

Ryan Richard
Wednesday, August 3, 2011

Using a VideoView to play streaming videos is quite easy on Android, and the class provides handy callbacks to manage your UI too. For example:

    // set the Uri of the video
    videoView.setVideoURI(Uri.parse(videoUriString));
    // start streaming/playing the video
    videoView.start();

    videoView.setOnPreparedListener(new MediaPlayer.OnPreparedListener() {
        @Override
        public void onPrepared(MediaPlayer mp) {
            // about to start playing
        }
    });

    videoView.setOnCompletionListener(new MediaPlayer.OnCompletionListener() {
        @Override
        public void onCompletion(MediaPlayer mp) {
            // reached the end of the video
        }
    });

VideoViews can be embedded into your layouts and sized any way that you’d like. However, there is one serious limitation.

According to Romain Guy, SurfaceViews (such as VideoView, etc.) inside ScrollViews (or ListView, etc.) are not supported by Android.

For example, playing a video using a VideoView inside of a row of a ListView seems to work at first, until the user tries to scroll the list. As soon as the list starts to scroll, the video turns black. It keeps playing in the background but you can’t see it anymore because it renders the rest of the video as a black box.

As another example, when the VideoView is scrolled so that it is partially off-screen at the time that the video starts playing, the VideoView does not render the video in the correct location on screen, causing the video to appear mostly black.

So be careful where you decide to put your VideoViews. At first it seems that they can go anywhere, but they cannot.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/11/2011

Ryan Richard
Wednesday, May 11, 2011

Ask for Help

“How can you resize the browser window from a Capybara test before visiting the page under test?”

Interesting Things

Tommy had a suggestion for testing scopes in Rails controller tests.

Here is an example of the type of test that he does not enjoy writing:

<code>
it "scopes products to active and available" do
    not_active = Factory(:product, :active => false)
    not_available = Factory(:product, :available => false)
    active_available = Factory(:product, :active => true, :available => true)
    get :index
    assigns(:products).should_not include(not_active)
    assigns(:products).should_not include(not_available)
    assigns(:products).should include(active_available)
end
</code>

Here is a nice way that he found to write the same test:

<code>
it "scopes products to active and available" do
    get :index
    assigns(:products).should == assigns(:products).active
    assigns(:products).should == assigns(:products).available
end
</code>

The only question is what to do with pagination? A work-around is for the controller to do:

<code>
def index
  @products_scope = Product.active.available
  @products = @products_scope.paginate(:per_page => blah blah blah)
end
</code>
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 5/9/2011

Ryan Richard
Monday, May 9, 2011

Ask for Help

“Any general advice for writing Rails generators?”

One person suggested this Rails guide. Another suggested looking in the Rails source code at the existing generators. Any other ideas?

Interesting Things

  • Hack night this Wednesday, 6:30pm, at the new office of TRUECar.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 9/10/10

Ryan Richard
Friday, September 10, 2010

Interesting Things

  • Using gem install with the soap4r gem doesn’t work. Fear not! It can be installed by downloading the tar file and manually unpacking it.

  • There is a node.js meetup at Dogpatch Labs tonight at 6:30.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 9/9/10

Ryan Richard
Thursday, September 9, 2010

Helps

“Has anyone experienced fuzzy PDF rendering at some zoom levels on iOS?”

One project was having trouble with their iOS app which shows a PDF file. When you zoom the view, the text becomes fuzzy looking. The text in the PDF is only fuzzy at certain, seemingly nondeterministic, zoom levels. They are drawing the PDFs with CGContextDrawPDFPage and scaling with CGContextScaleCTM. Does anyone know what could cause this?

Interesting Things

  • There doesn’t seem to be any reliable way to know if an HTML checkbox got checked by simply looking in the DOM. There’s an attribute on the INPUT called “checked”, but this is only read during page load to set the initial value of the checkbox.

  • Interesting Amazon EC2 announcement:

    “Micro instances provide 613 MB of memory and support 32-bit and 64-bit platforms on both Linux and Windows. Micro instance pricing for On-Demand instances starts at $0.02 per hour for Linux and $0.03 per hour for Windows.”

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 9/8/10

Ryan Richard
Wednesday, September 8, 2010

Helps

“Is anyone using Devise (authentication solution for Rails) with SSL for an app’s login page (on Heroku)?”

One project was having trouble with the redirects caused by this and is looking for help. Has anyone experienced trouble with this?

Interesting Things

  • There is a Ruby meetup tonight at 6:30 pm in San Francisco on the subject of unicode and internationalization in Ruby.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 9/7/10

Ryan Richard
Tuesday, September 7, 2010

Helps

“Using bundler vs. gemsets?”

These can be used separately or together depending on the needs of your project. Bundler checks dependencies to make sure you have the gems that your application needs, while RVM gemsets keep your gems separate to prevent conflicts (between Rails 2 and 3, or example).

“Anyone ever see IE fall over when parsing 500 KB of JSON?”

Try explicitly using eval()

Interesting Things

  • If you have any strange, unexplained errors with RVM, try upgrading to see if it solves them.
  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Ryan Richard

Ryan Richard
San Francisco

Subscribe to Ryan's Feed

Author Topics

agile (6)
android (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Contact
  • Labs
  • Events

Contact Us

contact@pivotallabs.com
+1 415-77-PIVOT
TwitterLinkedInFacebook

Pivotal Tracker

Tracker is the award-winning agile project management tool that enables real-time collaboration around a shared, prioritized backlog.
Visit pivotaltracker.com >