I can just imagine how this got designed:
“We’ve always had a handle on our jugs.” “But it’s too small to be useful.” “People won’t know it’s maple syrup without a handle.”
I can just imagine how this got designed:
“We’ve always had a handle on our jugs.” “But it’s too small to be useful.” “People won’t know it’s maple syrup without a handle.”
This morning I started using Pow, a tool for running Rack applications (like Rails or Sinatra) on your local machine.
One of the handy features of Pow is that it sets up a tiny local DNS server so you can access your applications at addresses like http://myapp.dev.
For whatever reason, though, this process didn’t work perfectly on Mac OS Lion 10.7.2. After starting Pow, I tried to pull from GitHub and received this message:
pcalvin@nebula $ git pull origin rez-ui
You don't exist, go away!
fatal: The remote end hung up unexpectedly
This seemed like the sort of message you’d get if github.com was being resolved as localhost, so I tried that:
pcalvin@nebula $ ssh git@localhost
You don't exist, go away!
Sure enough—same message. Manually resolving github.com against Pow’s local DNS server yielded an NXDOMAIN, which is correct and did not jive with my hypothesis that Pow was responding on behalf of github.com:
pcalvin@nebula $ dig -p 20560 @localhost github.com
;; Warning: Message parser reports malformed message packet.
; <<>> DiG 9.7.3-P3 <<>> -p 20560 @localhost github.com
; (3 servers found)
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NXDOMAIN, id: 18901
;; flags: qr aa rd; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0
;; WARNING: recursion requested but not available
;; QUESTION SECTION:
;github.com. IN A
Sensing a naughty, stale cache somewhere, I whipped out one of Mac OS’s few Big Guns:
pcalvin@nebula $ dscacheutil -flushcache
… which, as it so often does, solved the resolution problem:
pcalvin@nebula $ git pull origin rez-ui
From github.com:eleostech/global-driver-2
* branch rez-ui -> FETCH_HEAD
Already up-to-date.
Despite this small problem, I highly recommend Pow: it’s many times better than rails server’s WEBrick.
In our app, we were getting the following error under certain circumstances when we created a new object:
ActiveRecord::HasManyThroughNestedAssociationsAreReadonly in ReservationsController#create
Cannot modify association 'Location#affiliates' because it goes through more than one other association.
Rails.root: /Users/pcalvin/global-driver-2
Luckily, this was easy to resolve: just tell Rails it doesn’t need to save that association. This meant changing
has_many :affiliates, :through => :master, :source => :affiliates
to
has_many :affiliates, :through => :master, :source => :affiliates, :autosave => false
This morning, I went to start up my Solr server:
$ rake sunspot:solr:start
I received the following bizarre error:
rake aborted!
Operation not permitted
Tasks: TOP => sunspot:solr:start
(See full trace by running task with --trace)
After a little digging, I found out that the PID file for Solr was pointing to coreaudiod, which had stolen Solr’s PID after a reboot. This is a relatively common problem with PID files, and one of the reasons IPC-based solutions (like Upstart) are becoming popular.
The solution was to just delete the PID file, since the server was no longer running:
rm tmp/pids/sunspot-solr-*.pid