This is a guest post by Andreas Tiefenthaler, Software Developer at Contentful. During a hack day at Contentful two weeks ago, he wrote a simple Sinatra blog app, backed by Contentful’s Content Delivery API, and deployed it on anynines (where else?). We asked him to share his experience.
My plan was to create a dead-simple blog application, to demonstrate how to use the contentful.com Ruby Gem. I decided I wanted to deploy the app from the very first commit on to avoid a hassle at the end of the hackathon, as we were supposed to showcase running applications.
Getting started with Contentful
Contentful is a CMS as a Service and allows you to create your own platforms without building the same backend over and over again. Contentful’s Content Delivery API works with JSON data; images, videos and other media is delivered as files. The API is a globally distributed CDN for content: All content, both JSON and binary, is served from the server closest to where a user is requesting content from, minimizing latency. (more…)
On Thursday we attended the Ruby User Group (RUG::B) April meetup at Kauferportal. With 3 normal talks and 5 lightning talks the program was pretty packed. Good thing I summarized it for you:
Migrating databases like a Pro!
Hans Hasselberg, responsible for Ops at 6wunderkinder, talked about migrating databases. And not just your usual db/migrate, but actually moving an entire database to another server. 6wunderkinder uses AWS with PostgresSQL type db.m2.2xlarge. Preparing to move to a smaller server and improving efficiency (and thus optimizing for scalability), Hans had to simulate production load to make sure the new, tinier server won’t die under its load. How? By enabling query logging maybe, but that would mean touching the database. Or one could sniff the traffic. Say hello to
<a href="https://ngrep.sourceforge.net/" target="_blank">ngrep</a>. With a one time operation and a fixed set of operations however, you might miss an important set and you can’t compare how the new database behaves as apposed to the old one. (more…)
In this post we will generate PDF’s with Ruby, exploring the exemplary use case of creating customer invoices. In order to output PDF’s from your (custom) billing system, you’ll need a library that exports PDF’s. There are different ways to achieve HTML to PDF conversion in Ruby. Let’s take a closer look.
HTML to PDF libraries
Two major players in this field are PDFlib and Prawn. PDFlib is a commercial library, and as such more advanced than Prawn. You’ll find table configuration and formatting to be a helpful feature. PDFlib has many more bindings, with support for PHP, Perl, Python, Ruby, Java, .NET and C++/C.
Yet, the Prawn ‘API’ will feel more natural to a Rubyists The PDFlib extension doesn’t feel like Ruby most of the time, it’s just a wrapper for the normal PDFlib C calls. Plus: Prawn is open source (and thus free of charge).