- Current total: $2,109 toward our $10,000 goal. The SF office is ahead on donations per moustache, but not by much. Pivotal Labs Movember Mospace
Google deprecated their Local Search API and suggest to use the Maps API GoogleBar instead. However, as it turns out, the API GoogleBar is just a wrapper around the Local Search API, that was just deprecated. You could use the Google Places API instead, but that one is currently in developer preview only. What are we supposed to do Google? Googling it did not reveal any fully satisfying answer…
When attaching JQuery UI’s datepicker you should not use the class hasDatepicker since JQuery UI uses this class to mark DOM objects that already have a datepicker attached. So it won’t attach a datepicker to elements with that class.
It is possible to sort results in Solr using any criteria you want and use the Solr score for a secondary sort. Some people thought that you were only able to use the Solr score as your primary sorting criteria.
We request a PNG via IE7 from inside Parallels, but the file doesn’t get returned. The Nginx log just shows an empty line for the request.
Suggestion: Look also in Nginx’s error.log for the failing request. The request might be logged here and help find out what actually went wrong.
Sometimes .* in regular expressions matches more than we would like it too. Let’s say you have a string that includes some numbers you want to extract from a string. Our string might look like this:
some text 123 more text
now we might try to use the following regular expression to get the 123.
However, this will only get us the 3. This happens because .* will match as match as possible. Adding a ? will change this to only match what is needed.
Now we get the 123 as desired.
A nice toll to experiment with regular expressions is rubular.com. Rubular allows you to see the effects of your regex in combination with an example string instantly.
Sarah will give a Ruby introduction class for kids at RubyConf. However, there won’t be any Internet connection available, but the participants will need to install several gems.
A solution to this problem is the gem geminabox which allows you to run a server providing gems. Other users
who have geminabox installed then are able to install gems from that server.
bundle install --without test excludes the test group in your Gemfile from the install. It works well for reducing the size of your Heroku slug. However, there’s a glitch with this option on Heroku — when you specify it, Heroku reinstalls every included gem every time you deploy. It does respect your Gemfile.lock, so you’re trading a smaller slug for a longer deploy.
Pivotal’s open source CIMonitor project now supports OpenID! Thanks Tyler and Josh.
Arel has a bug that makes it difficult to use in
rails console. Every time you add a predicate, the number of internal objects in the Arel result increases exponentially. So, by the time you have 5 or 6 predicates, the console finishes generating the expression more or less instantly, and then spends 15+ minutes calling
to_s on the resulting Arel object in order to display it to you. tl;dr: when you’re playing with Arel in rails console, end every line with
; nil to avoid having it print out the result. The exponential object explosion will be fixed in Rails 3.1.
Is it possible in Jasmine to spy on a getter such as
myObject[key]? We want to know when local storage is accessed.
Local storage has a functionally equivalent
getValue function, which you can spy on, but the spy is not triggered when you access the value via
On unicorn, the random number generator is seeded before the fork. So if you are depending on a set of unicorns to generate different random numbers, you need to reseed the random number generator manually after the fork.
If you want to make absolutely sure you aren’t generating any queries in your Rails views, try no_querying_views – which explodes if your query comes from view code.
Skype 5 beta is out for Mac, which allows group video chat. Everyone must be on the beta for it to work.
Do people put bundler in the Gemfile?
Yes. Bundler is smart enough to omit it from the cache. It does, however, still follow the rules for version. We recommend using
~> 1.0.0 as the version string, because 1.x is supposed to be backwards-compatible with the current Gemfile format.
If you instead use
= 1.0.0 and your managed hosting environment updates bundler to something more recent, things will ASPLODE.
We made a branch in git called “–track” by accident, and now we can’t get rid of it. git thinks it’s a command-line argument, even when it’s in quotes.
Here’s the command what did it:
$ git checkout -b --track origin/actual_branch_name Branch --track set up to track remote branch refs/remotes/origin/actual_branch_name. Switched to a new branch "--track"
Consensus: kill it through RubyMine or gitX. There is also a way through the command line:
$ git branch -d -- --track
…but make sure you get the dashes in all the right places.
reset after tail – sometimes, if your PS1 has colors (or square brackets, or … ?) you can lose your Terminal after tailing a file. To get it back, type
reset, which should work even if you can’t see it echoing. You may need an extra return before it.
The Giants seem to have won! There’s a parade tomorrow, right in front of the office. If you’re coming for the tech talk, leave extra time as streets will be closed and they’re expecting a crowd.
Thursday, October 28 at 6:30PM
Pivotal Labs is hosting and our own Sarah Mei is leading an open source workshop for developers interested in learning about contributing to open source projects. Sarah will be using the Diaspora project as an example, and the Diaspora team will be on hand to assist. Email Sarah at sarahmei at pivotallabs dot com for more info, or view the meetup page here
“How do I use RVM on the server?”
RVM on the server can be fraught with peril. Be sure that your (or your process’s) shell is being invoked in a way which plays nice with RVM, for instance bash -lc or bash -ic in cron.
“Why does Google Street View give me a grey dead area instead of a picture of some dude’s house?”
Most likely this is due to having requested a view for an area where none is available. The Google docs have been found to be a bit misleading on this, however there is an api call to see if there is an available street view for a given radius — try increasing this radius near your lat & long until you get success in order to avoid a useless response.
Switching to resque might help, but not without first rewriting the jobs.
More research yielded the fact that delayed_job reopens all files (including the log files) when it spins up. Under Ruby 1.8, File#reopen defaults file mode to last set, while 1.9 defaults to read only. This could easily cause logging failures. (with a nod to Davis W. Frank for the followup info)
Calling .destroy on a has_one relationship does not update the record association to nil, which can cause problems when the relationship is subsequently updated. It was suggested that calling .clear on the association might help work around the issue.
Rails 3 request helper methods in ActionController::TestCase::Behavior take the session and flash hashes as parameters, as opposed to setting them explicitly before making a normal get request. Compare http://api.rubyonrails.org/classes/ActionController/TestCase/Behavior.html#method-i-get with http://api.rubyonrails.org/classes/ActionDispatch/Integration/RequestHelpers.html#method-i-get for more detail
“Anybody have any experience using the oath gem without net/http? There are some things we want to do that it’s not good at”
Like posting large files? Shell out to curl. There are a couple things nobody seems to have done right, yet, and that you just have to use curl for.
“What is the right gem to use for AWS? The official one seems newer than this right_aws that hasn’t had a commit in a couple years”
You are probably looking at the wrong version. Another project was using right_aws and they swear it’s newer than that. It sounds like the gem forked and you probably want the RightScale one. Either way it definitely works better than Amazons ec2 gem, which will get the job done sometimes, but is less than optimal.
Testing right_aws with webmock
A team was seeing webmock continuing to feed a bad result to all of their tests (within a timeout for the shared connection) when one failed, instead of trying again. They switched to using connection=dedicated instead of shared.