Glenn Jahnke's blog



Glenn JahnkeGlenn Jahnke
Standup 1/9/2012
edit Posted by Glenn Jahnke on Monday January 09, 2012 at 09:48AM

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.

Glenn JahnkeGlenn Jahnke
Standup 1/5/2012 - The Death of SOAP
edit Posted by Glenn Jahnke on Thursday January 05, 2012 at 09:17AM

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.

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.

Glenn JahnkeGlenn Jahnke
Standup 8/31/2011 - RubyMine and Compostable Utensils!
edit Posted by Glenn Jahnke on Wednesday August 31, 2011 at 09:31AM

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!

Glenn JahnkeGlenn Jahnke
Standup 8/11/2011: Whole lotta Rails
edit Posted by Glenn Jahnke on Thursday August 11, 2011 at 09:39AM

Ask for Help

"What do you tell Rails the default timezone is if your database has no concept like that?"

The best solution was to convert all rows in your DB to UTC and set Rails to also use UTC. There are MySQL commands to convert whole databases over to UTC, and can be run overnight if necessary.

Interesting Things

There is a new release of Fixture Builder!

  • Supports Rails 2 and 3
  • Supports using existing Rails style fixture files using config.legacy_fixture = Dir[path_to_old_fixtures] in your fixture_builder.rb file
  • Its better tested too!
  • Go grab it at https://github.com/rdy/fixture_builder#readme

Rails 3 Helpers

Rails now includes all helpers across your project in controllers that extends ApplicationController. Apparently there isn't a setting to override this behavior either, and this is a change from Rails 2 where the scaffold would just include a line at the top of your controller like helpers :all which could easily be deleted.

Other articles: