Back to Front
Well, well, well, here we are again. Another year, another blog, another attempt to write in something approaching a consistent manner. This year, things are different. I’ve started, well and truly, from scratch.
It seems as though every year I try to write online (or, really, anywhere), and while the intentions are great, it never really works out. Like a poor carpenter, I could blame my tools, and while they’re a part of the problem (see below), the main problem is me. Partially not having the confidence the words I write are written well, partially having trouble having anything to write about, and a whole heaping of laziness. This is probably true for a lot of people trying to write.
I can’t say I’ve figured out those problems, but I’m willing to try again. Try, try again. I’ll generally try to write about things I know about, or learning about. And link to nifty things. It’s really about just getting down to it and making that clackity noise (to awfully paraphrase Merlin Mann).
For this attempt at consistent writing, I decided to build a blogging platform from the ground up, and with it including the bare essential features necessary to publish. I’m often picky about the tools I use, and there are lots of platforms for writing on the web today. The most popular being Tumblr or WordPress. But for me, Tumblr is unstable and ugly; Wordpress is a huge mess and ugly. I understand my needs when it comes to a tool like this. I wanted something lightweight and fast; something I could update from anywhere; and quite selfishly, something using technologies I’ve been learning lately. So I wrote my own, on top of Sinatra and MongoDB.
I’m not exactly advocating everyone should rush out, ditch well tested blogging tools, and write new solutions. I do recommend, however, the evaluation of tools — Maybe try something else if your current tools frustrate you.
It’s not my first time at this rodeo
Like many web developers, I’ve hacked together my own blogging tools many times, and I’ve used various pre-built systems. But after some time dabbling with Sinatra and MongoDB, I made the decision to actually build the software I needed with them.
At some point in the near future I’ll make the Github repository public, after a little refactoring and adding all-important testing code (shame on me for not doing that already). I will almost certainly write some articles documenting parts of the project, problems that came up, and the things I’ve learned from developing it. As such, a few things first…
Tools of the trade
Sinatra — I knew I wanted to keep the code light and fast. While I’m most comfortable in Rails these days, I know full well how much overhead it has. I just didn’t need all the bells and whistles, and the ones I did need (partials, content_for), were easily replaced.
MongoDB - I’m a big fan of it’s performance, and query interface. A blogging system seemed like a nice use case for storing arbitrary data consisting mostly of text. I also exploited map/reduce to precache the archive listing.
On the ORM side of things I went with MongoMapper with its friendly, ActiveRecord-like API.
Memcached — The secret sauce for high-performance websites everywhere, or at least this one. An extremely simple Sinatra extension using a fast Ruby gem, allows this blog to be faster, and as light on the server as plain HTML files.
I also tried using various other caching methods including Sinatra::Cache and Rack::Cache, with varying degrees of success. But support and incompatibility with Sinatra’s sessions forced me away. So much so, I almost gave up with this project entirely for a Jekyll implementation.
Jekyll is really nice and all, but flat files aren’t my thing. I felt having to update files too constraining, without the ability to easily update things on the fly without lots of tinkering and hacking. I personally really like database backed systems and remote APIs.
Dropbox — I would be remiss if I didn’t mention this essential tool. I’ve been using it for years with my personal documents, and as anyone who uses it with multiple computes knows, it’s a great way to quickly and easily transfer files between systems. It’s definitely easier than building a complex file attachment system.
I followed these handy instructions to have multiple instances of Dropbox on my Mac, without forcing me to publish the contents of my personal account and keeping things nicely siloed.
There it is
With that out of the way, the page is blank and fresh for all manner of words.