10 4 / 2011
06 4 / 2011
24 3 / 2011
06 1 / 2011
PDFKit and its middleware on Heroku
I run into this problem with PDFKit middleware where the PDF generation seems to hang indefinitely for no apparent reason on Heroku as well as locally when using Thin.
Wkhtmltopdf will load the HTML and then try to load all assets from it (js, css, images, etc.) On Heroku the asset is first served up by the rails server and when you have a single Dyno it will create a deadlock in the handling of the HTTP request. The user trying to access the pdf document will consume the Dynos and the PDF generator will wait for it. Deadlock.
Two ways around that:
- Access the static files directly from the web server and not Rails
- Access the static files locally
The first option requires some setup (cloudfront and such) and some actions at deployment. Overall this requires to much work.
The second option is the one I preferred. I used Rails asset_host to have all assets for a PDF generation fetch locally (file://). Here is the gist of it:
Works as intended! Hope this will save some people the time I spent on this.
(Note: You first have to follow Matt’s instructions on how to install wkhtmltopdf on Heroku )
Permalink 13 notes
06 1 / 2011
How to Pick the Perfect Brand Name
It is More than complicated to find a descriptive, powerful and nice name for a product/company. Even harder that when you cannot name something, it is like it doesn’t exist yet.
(via Instapaper)
30 12 / 2010
DIY Guide to Link Bait
I guess I will work on that for our new app. We need to get going!
(via Instapaper)
16 11 / 2010
Easier templating in Javascript
I just created a new repo on Github called template-fetch. The goal of those 60 lines of code is simple: retrieve an haml template from the server and process it on the client side using HAML (for now). I plan to add other templating engines when I have more time.
It uses jQuery, underscore.js and haml.js to do its magic.
It is mostly inspired from Sammy and was built when I was tinkering with Backbone.js . I think it can be useful to other, you tell me!
Comment are always welcome.
21 10 / 2010
Powerful message here. That should be my manifesto or my company’s manifesto. A lot to think about in a small page…
