Glenn Jahnke's blog



Glenn JahnkeGlenn Jahnke
Standup 11/18/2011
edit Posted by Glenn Jahnke on Friday November 18, 2011 at 09:31AM

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"

Glenn JahnkeGlenn Jahnke
Standup 11/17/2011 - Cloudy Cloud
edit Posted by Glenn Jahnke on Thursday November 17, 2011 at 09:37AM

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.

Glenn JahnkeGlenn Jahnke
Standup 11/16/2011 - Blamo things
edit Posted by Glenn Jahnke on Wednesday November 16, 2011 at 09:16AM

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.

Glenn JahnkeGlenn Jahnke
Polyglot Factorial
edit Posted by Glenn Jahnke on Tuesday November 15, 2011 at 09:35PM

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 ;)

Glenn JahnkeGlenn Jahnke
Is your XML foo savvy?
edit Posted by Glenn Jahnke on Tuesday November 15, 2011 at 09:25AM

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.

Glenn JahnkeGlenn Jahnke
Is your XML foo savvy?
edit Posted by Glenn Jahnke on Tuesday November 15, 2011 at 09:25AM

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.