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
  • Tools
  • Contact
    • Press Room
    • Press Releases
    • In The News
    • Press Kit
  • All
  • Labs
  • Standup
  • Tracker

7/13/2012 – Happy Friday

Glenn Jahnke
Friday, July 13, 2012

Helps

  • Heroku Maintenance Mode Fail

Does anyone know why maintenance mode doesn’t seem to work? Is there any way to check from the command line that we are in maintenance mode?

– (Ken) This is how I test it on heroku_san: https://github.com/fastestforward/heroku_san/blob/master/features/step_definitions/remote_steps.rb#L130

  • Sending Faxes from Rails

Anyone had to send a fax from Ruby/Rails? Any good SaaS you used to do it?

  • carrierwave custom processing is called twice

Dumb workaround:

def intelligent_crop
crop_to = model.crop_to
# crop_to = [left_x, top_y, width, height]

manipulate! do |img|
  # guard against the second time intelligent_crop is called
  if (img.columns != crop_to[2] || img.rows != crop_to[3])
    img.crop!(*model.crop_to)
  end

  img
end

end

version :cropped_preview do
process :intelligent_crop
end

No one seems to have heard of this particular bug, unfortunately.

  • acts_as_soft_delete

What is the best soft-delete gem to help you not actually delete records?

acts_as_soft_delete_by_field was recommended, however rolling your own is probably also a very reasonable idea: this is pretty closely tied to your business logic.

Interestings

  • validate_presence_of does not work with booleans

…because it fails if the boolean is set to false. Use

validates_inclusion_of :boolean_field, in: [true, false], allow_nil: false

instead.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

iOS Acceptance and Ruby Keywords

Glenn Jahnke
Wednesday, July 11, 2012

Helps

  • acceptance testing for iOS: Frank?

We’d like to do happy path end-end testing for an iOS project. What’s the state of the art?

We saw frank: https://github.com/moredip/Frank

Interestings

  • then is a keyword in ruby

If you want your ruby to read like bash:

if true then
  puts "For Sure"
end
  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 1/9/2012

Glenn Jahnke
Monday, January 9, 2012

Helps

CCMenu + Hudson w/o Basic Auth

“Has anyone figured out how to use CCMenu with Hudson and not have Basic Auth?”

Hudson has its own authorization mechanism, unlike Basic Auth, so it can’t be used with nice desktop tools like CCMenu which shows the red/green square in your system tray.

Consider using Jenkins.

Using Symlinks with Dropbox

Using the Linux Dropbox client seems to allow symlinks to be uploaded, but they will not behave as expect anywhere else. Someone was trying to have a “latest” folder point to the latest versioned folder.

The recommendation was just to have two copies of the files as a workaround.

Interestings

Rails Bridge Outreach for Women Workshop has space

Looking to learn Rails? There’s a great meetup to get you up and running. As of this writing there is still space available. Come check the event out.

Yammer Javascript Meetup on Tuesday

Yammer will be hosting a Javascript meetup, expect the usual snacks and beer, and good talks about our favorite client-side language.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 1/5/2012 – The Death of SOAP

Glenn Jahnke
Thursday, January 5, 2012

Helps

Soap4R and Ruby 1.9.2

“Soap4R and Ruby 1.9.2 don’t work, what’s the best alternative?”

Several people recommended the Savon gem. It was strongly suggested to not try and replicate any of the Soap protocol because it is pretty painful to implement.

Interestings

Constants versus Immutable Objects

Someone apparently had confusion around what it means to be constant in Ruby, and what it means to be immutable.

A constant prevents modifications to references to variables.

SOME_CONST = 3
SOME_CONST = 4
warning: already initialized constant SOME_CONST

Immutability means that the variables themselves cannot be modified.

an_array = [1,2,3]
an_array.freeze
an_array[3] = 4
RuntimeError: can't modify frozen array

You should note, though, that freezing an object only makes the variables that object contains immutable. For instance,

an_array = [1,2,3,{}]
an_array.freeze
an_array[3]["foo"] = "bar"

will not throw any errors or warnings.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 11/18/2011

Glenn Jahnke
Friday, November 18, 2011

Helps

Selenium Firefox Version

“What’s the canonical version of Firefox to use with Selenium”

Firefox 3.6 is recommended.

Compiling Ruby 1.8.7 on Lion

“I’m having trouble compiling Ruby 1.8.7 on Lion.”

Turns out there specifying the version of GCC to use fixed the problem.

CC=4.2 rvm install ruby-1.8.7

File Upload Plugin for jQuery

“What are the recommended jQuery plugins to do file uploading?”

There is a jQuery plugin by blueimp that is supposed to be customizable and backward-compatible for most browsers (even IE6!).

Also, Ajax Upload is supposed to be a reasonable alternative.

Interestings

Memorial Service for Ilya

Ilya Zhitomirskiy’s memorial service will be held today. Everyone is welcome to come from 5pm to 8pm

McAvoy O’Hara
4545 Geary Blvd
San Francisco, CA 94118

Javascript Strangeness

Oh Javascript, you prankster.

typeof(NaN) => “number”

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 11/17/2011 – Cloudy Cloud

Glenn Jahnke
Thursday, November 17, 2011

Interestings

Travis CI: Javascript Testing in the Cloud

Jasmine gem test suites are now being run on Travis CI which is an open, distributed build system for the open source community.

Check out Travis CI.

Fix Git Author

As Pivots move to different machines frequently when we pair switch, its often a problem that we forget to switch the author when we commit to Git. Here’s how you can fix the author of a commit (before you’ve pushed to remote).

  1. change your git author
  2. git commit –amend –reset-author -C HEAD

This changes the author of commit to whomever is configured in the git config, and uses the same message you previously used (the -C HEAD part).

TDDium Cloud Test Runner

TDDium is an easy-to-use, secure, hosted testing environment that takes the tedium out of building high quality Ruby web applications using Test Driven Development and Continuous Integration.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 11/16/2011 – Blamo things

Glenn Jahnke
Wednesday, November 16, 2011

Helps

Rails Shopping Carts

“Can anyone recommend a good Rails shopping cart?”

Spree was mentioned as reasonable suitable, but it does not support multiple merchants.

Interestings

Modernizer < 2.0 hates IE7

A Pivot was experiencing Modernizer at versions less than 2.0 throwing insecure content exceptions because of version detection code that it was using. Upgrading to version higher than 2.0 or removing Modernizer solved the problem.

Resque and New Relic outstanding but

There is a bug when using RPM contrib in New Relic while also using Resque that causes Resque workers to die. Definitely something to watch out for.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Polyglot Factorial

Glenn Jahnke
Tuesday, November 15, 2011

Someone on Hacker News mentioned the number of orderings of a deck of cards. I took up the challenge in some of my favorite and not so favorite languages, I’ll let you guess :).

Ruby

ruby-1.9.2-p180> (1..52).inject{|a,b|a*b}
=>
80658175170943878571660636856403766975289505440883277824000000000000

Scala

scala> BigInt(1).to(BigInt(52)).toList.foldLeft(BigInt(1))((a,b) => a*b)
res23: scala.math.BigInt =>
80658175170943878571660636856403766975289505440883277824000000000000

Haskell

Prelude> foldl1 (x -> y -> x*y) [1..52]
80658175170943878571660636856403766975289505440883277824000000000000

CoffeeScript

coffee> [1..52].reduce (a,b) -> a*b

8.065817517094388e+67

Java

Non-existent REPL>
import java.math.*;
public class Factorial {
public static void main(String[] args) {
BigInteger result = BigInteger.ONE;
BigInteger fiftyTwo = new BigInteger(”52″);
for(BigInteger i = BigInteger.ONE; i.compareTo(fiftyTwo) <= 0; i = i.add(BigInteger.ONE)) {
result = result.multiply(i);
}
System.out.println(result);
}
}

$ java Factorial
80658175170943878571660636856403766975289505440883277824000000000000

** I could have used the product function in most of those examples, but I wanted to play with foldL ;)

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Is your XML foo savvy?

Glenn Jahnke
Tuesday, November 15, 2011

Helps

  • “How do you change the address and port that Solr is running on?”

Somewhere in the server.xml file was suggested, however that didn’t seem to work. The workaround was using IP Tables.

Interestings

  • as_json (with options) seems to always be called with an explicit nil argument from to_json under Rails 3. Some people just use as_json explicitly, or pass an explicit empty hash as the arg to get around this oddity.

  • Jenkins now supports Ruby plugins.

  • Support Movember! Pivotal has raised quite a bit of money and you can too.

  • 0 Shares
  • Share on Facebook
  • Share on Twitter

Standup 8/31/2011 – RubyMine and Compostable Utensils!

Glenn Jahnke
Wednesday, August 31, 2011

Ask for Help

“Does anyone know about random highlighting occurring in RubyMine / IntelliJ on all OSes?”

RubyMine 3.1 apparently had issues with random highlighting which were resolved simply by upgrading to at least 3.2 release.

Interesting Things

Compostable Utensils

The office got compostable utensils that meet San Francisco city requirements!

  • 0 Shares
  • Share on Facebook
  • Share on Twitter
Glenn Jahnke

Glenn Jahnke
San Francisco

Subscribe to Glenn's Feed

Author Topics

rails (3)
ios (1)
ruby (8)
testing (1)
javascript (4)
jenkins (2)
tdd (2)
scala (2)
rubymine (2)
mysql (1)
agile (5)
iteration planning meetings (1)
performance (1)
jasmin (2)
rspec (1)
data processing (1)
cruisecontrol (1)
rvm (1)
android (1)
mobile (1)
mongodb (1)
concurrent programming (1)
  • About
  • Case Studies
  • Team
  • Community
  • Careers
  • Tools
  • 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 >