JSON is a fantastic format, anywhere people in your organization want to reach for XML, it's always a good thing to ask the question "Why not JSON?". The question I'd like you to ask the next time you're reaching for your JSON hammer, is "Why not MessagePack?".
MessagePack has the following things going for it when compared to JSON.
For the record, I'd probably still use JSON for a public facing API in most cases, but for internal ones, MessagePack generally wins.
The following example, written in Ruby, illustrates the advantages of MessagePack in action:
For more info, check out the Message Pack Website.
Loving byobu terminal for dev at the moment. It's like a super-nice, and sanely configured screen.
We recently moved to a new office here at Vokle, and that means brand new, blank, chalk walls!
I've got a giant chalk wall next to my desk now just waiting to be filled. So, since this wall's in the engineering office, I figured we needed something a little geeky, hence Unicode Chalkpoints!
So, let's see what we have here:
Do you know what code is running on your servers? Perhaps someone deployed something in a weird way and circumvented your normal deploy-logging process. Maybe you suspect an application server didn't actually restart. Maybe you just want to know quickly because you're lazy.
My answer to this question has been adding the Git SHA of the currently running code to the HTTP headers of my app. By doing this, figuring out what's actually running is as simple as a:
curl -I http://www.example.net | grep X-GitSHA
Accomplishing this is pretty simple, first, you'll want to run and store the output of:
git rev-parse HEAD
in whatever directory your deployed code runs in. This is the fastest, and easiest way to determine the current SHA. In Rails this is easily done in an initializer or application.rb using something like:
GIT_SHA = `git rev-parse HEAD`.chomp
Then, just make sure the constant gets inserted as a header. Again, in Rails you could do this with a before_filter in controllers/application_controller.rb
headers['X-GitSHA'] = MyApp::Application::GIT_SHA
And you're done! It should just work. Of course there's a million ways to actually do this.
Now that you have this info you can see what code is different between what's deployed and what's on say your master branch with a `git diff`:
PROD_SHA=`curl -I http://www.example.net | grep X-GitSHA | cut -d':' -f2` git diff $PROD_SHA...master
Or, you can see what the difference is in terms of commits messages rather than actual lines changed with `git show-branch`
PROD_SHA=`curl -I http://www.example.net | grep X-GitSHA | cut -d':' -f2` git show-branch $PROD_SHA master
Lastly, if you need the cache on a resource busted between deploys be it in either HTTP or Memcached, having a GIT_SHA constant available in your app makes it pretty easy to do. Note that this isn't great for a lot of situations where a file may NOT have changed between deploys.
Bruce Momjian is best known as a member of the PostgreSQL core team, what most people don't know is that in the early '90s, before he was working on Postgres, he wrote another SQL database.
And he wrote it in shell.
The result, SHQL is a pretty damn cool piece of software. I had an informal chat about it with Bruce a couple weeks ago at SCALE, and just had to write about it. The source is definitely a fun browse because not only is it a cool idea, it's the kind of software that belongs to a specific time. Asking Bruce how he picked shell, he mentioned that it was a language he knew, and that Perl just seemed like it was too heavy at the time.
What's immediately striking about SHQL is its completeness given its mere 760 SLOC. It supports, CREATE, DELETE, DROP, INSERT, SELECT, UPDATE, WHERE, PRINT, EDIT as commands, but has surprising completeness, including UNION and DISTINCT. It even supports a rudimentary form of views, through which you can do a basic sort of joining!
SHQL is not pure shell, it makes heavy use of both awk and grep. For instance, updating a table involves filtering the entire table through awk, directing the output to a tmp file, then replacing the current data file with the new one.
The source is definitely a fun browse, I'd recommend you download the file, and check out the README and demo as well!
One install note, on my ubuntu system /bin/sh has a few issues with it, I'd definitely use bash proper to run it. Also, be sure to mkdir -p ~/shql/MYDBNAME.
In the third act of Hamlet, Shakespeare erects a stage on the stage; the fact that the play enacted there—the poisoning of a king—in some way mirrors the primary play suffices to suggest the posibility of infinite involutions. (In an 1840 article, De Quincey observes that the stolid, heavy-handed style of this minor play makes the overall drama that includes it appear, by contrast, more lifelike. I would add that its essential aim is the opposite: to make reality appear unreal to us.)
-- Jorge Luis Borges, From his essay "When Fiction Lives in Fiction"
So, it's been a month, and I still haven't put it up here, I'm now working as a Rails developer for online invitations and greetings company cocodot.
If you haven't see cocodot, it's a pretty interesting concept that I'm quite excited about. We occupy the the greetings space, but have better execution than the competition, we probably have the best designed greetings and cards of anyone out there, thanks to an amazing creative staff. The wedding invitations system is pretty slick as well, it's probably the best way to do online wedding invitations at the moment.I've recently finished reading the Project Gutenberg edition of The Adventures of Sherlock Holmes. Since, I was reading it on my oh so Convenient Kindle, annotation was quite easy. I ended up making a list words and phrases I needed to look up. Some of these words are still in common use in the British Isles, so be forewarned there's an American bias here.
1. Pips - Small, hard seed in a fruit.