July, 7th
Days are long, but years are short.
After Week One with a Kindle
So finally I’ve got myself an eBook-Reader. As I already own some Amazon eBooks the Amazon.com Kindle International Edition (which is almost the same as the Kindle 2) was the obvious choice. As I wasn’t too sure that I’m into eBooks I got one from ebay.at for around 130 Euro. How was the first week?
Provenance on Rails
First of all, what is provenance? The common description is that provenance describes how an object came into its current state. Think of it as versioning on crack: in addition to performed changes it also detects how and by whom those changes were performed.
..but do I need it?
Well that depends:
- do you have any objects in whose alteration history you’re interested in? Think about any financial or business object.
- social network app? think automatic activity feeds..
- do you have any analysis workflow that produces a single output from multiple input data points? Provenance can retroactively create the relationships between the input and output datums.
- do you want to monitor a given object’s access patterns temporary? Think debugging.
Actually, the longer you think the more use cases appear.
After the break I’ll talk about my master thesis (that dealt with provenance), the corresponding RoR prototype and future plans w.r.t. provenance within Ruby on Rails.
Generating PDFs from Ruby on Rails
The problem
Ruby on Rails provides various helpers for generating dynamic web content but sometimes you need documents that users can easily store and share between them. The ubiquitous file format for this is Adobe PDF nowadays.
The common solution fro this problem is Prawn [github, introduction]. Alas it requires a custom DSL for document description, no existing Rails views or partials can be reused. An alternative is princeXML which transforms HTML/CSS into pdf through an external binary. This would allow reuse of existing templates and knowledge (think CSS designers) but has the downside of its price tag of $3800.
The solution
Enters wicked_pdf: it utilizes wkhtmltopdf to create a PDF document from a Rails HTML template. HTML rendering is done through the well-known webkit-engine. This allows developers to do PDFs in the right way™: define the document’s structure through a simple HTML document and theme them through CSS. You’ll get the automatic benefit of themability: exchange the CSS and you have another format. There are also lots of CSS artists out there that can supply you with different designs.