Convert HTML to PDF

As a background task for our web application BeeBole, I was looking for an easy and efficient way to produce PDF documents without being stuck with postscript like syntax or being feature limited in a design point of view.

Last week I discovered the tool I was looking for : WKHTMLTOPDF

By leveraging the power of the webkit engine through QtWebKit module, this thing is converting HTML with full CSS support to PDF the same way you “Save as PDF” from your browser ;)

In this article, I’ll show you the very first prototype I did of a possible WKHTMLTOPDF integration with our application.
Continue reading

Test the Performance and Scalability of Your Web Applications With Tsung

What is Tsung ?

The purpose of Tsung is to simulate users in order to test the scalability and performance of IP based client/server applications. You can use it to do load and stress testing of your servers.

(Definition coming from the Tsung website)

In this post, I will introduce the use of Tsung in order for you to stress test your web applications.

Why Tsung ?

Because it’s an Open-Source project and, to tell the truth, mainly because this application has been coded in Erlang which gives Tsung a little advantage on the other tools: it has the potential to simulate A LOT of concurrent requests … without crashing. That’s what we expect from a stress testing app, isn’t it?

Continue reading

Sandbox Your Cross Domain JSONP To Improve Mashup Security

JSONP is a very neat way to get JSON data from other domains. The concept was brought by Bob Ipolito in 2005, and today it is widely available from API providers.

The big issue about JSONP is security. If you inject an unknown script in your page, you give to the script author a potential way to read the entire page content, scripts, cookies and data.

So, if you think, like us, the cool way to build web apps today is about building services and aggregating them with external APIs in Mashups, you have a problem. How can we securely fetch these nice services available everywhere?

Continue reading

Erlang Resources For Web Applications

We have been very happy to see more and more interest for the Erlang material we were providing (our video has just reached 1000 plays).

And with the growing number of posts and tutorials, we decided it was time to give them a real dedicated Erlang page

In the future, more content and more links will be added to this page. All your feedback is also very welcome to help us create a comprehensive and complete guide.

It is really nice to see so much enthusiasm and a vibrant community starting around Erlang for web apps. Two new Erlang blogs we came across and that are definitively worth a look:

Good luck to Chad and Lloyd.

How To Send Emails From An Erlang Web Application

Do you want to quickly be able to send an email from your Erlang web application to one or more email addresses?

In this post I will show you an easy two steps method to achieve that goal:

  1. We are going to make our Ubuntu box (See how to install Erlang on Ubutntu) capable of sending emails to the outside world … and only that, nothing more (no mailbox configuration, spam assassin, etc …).
  2. Write an Erlang function responsible for building the message and sending it.

Continue reading

Video Tutorial To Start Developing Web Applications on Erlang

Please find hereunder a video tutorial highlighting the key points of developing a JSON based web application with Erlang and Mochiweb.

Note that, for best performances (HD Definition), you have to directly go to the Vimeo website where the video is stored and watch it in full screen mode.

You may want to download the video. In that case, you will have to follow the instructions at the bottom of the video page on the Vimeo website.

Click on the image below to go the the video page.

Go to the video page

The purpose of all this, aside from arousing your curiosity, is to provide you with a getting started pack and allow you to go a step further in the Erlang web application sphere.

I invite you to download the example application (as illustrated in the video stickyNotes.zip) in order for you to understand all the pieces of the puzzle and to venture behind the scene.

Just keep in mind that stickyNotes is a one shot application that I’ve developed from scratch with the unique aim of illustrating the video example.

Having said that, any comment or suggestion is always welcome, especially about ‘struct.erl’, a module that I’ve created when I was learning the language in order to play with the tree structure resulting from the mochijson2 decode function.

We are using it in our mainstream development and I’m still wondering if I might have missed something important with regard to the Erlang distro or Mochiweb itself.

In order to install this stuff on your system and assuming that Erlang is properly setup on your box, just follow these steps:

1) Download stickyNotes and extract the archive in your home directory:

stickyNotes.zip

2) cd to stickyNotes dir and compile the code :

make clean && make

3) Start the application and initialize the db from the Erlang console (only once)

./start-dev.sh
stickydb:reset().

4) Browse the following address 127.0.0.1:8000

Super easy isn’t ?

Enjoy

Web Application on Erlang: Configure Nginx with Mochiweb

My previous post, the first of our series dedicated to the Erlang world, was definitively getting too long, so here is the second chapter of this marvelous article.

I’ll assume that you have successfully installed Erlang and Mochiweb and deployed your first small tiny app.

When it comes to deliver static content at lightning speed and do reverse proxy job, there is one name : Nginx, the Igor Sysoev high-performance HTTP server.

It plays well with ssl and in the last dev version you can even find an interesting module for uploading files, nothing less … we will probably tell you more about that in the series.

Nginx is really turning itself into a real handy swiss knife.

Continue reading

How To Quickly Set Up Ubuntu 8.04 loaded with Erlang, Mochiweb and Nginx

Let’s say you want to give a try to Erlang (Discover our post about Why Erlang?) for your next web development project and you want to be up and running as quickly as possible… you just landed smoothly in the right place.

This post is the starting point of a series of posts in which I’m going to provide you with all the commands you’ll need to set up an Ubuntu 8.04 server loaded with Erlang, Mochiweb proxied by Nginx.

In the same series, I’ll also cover:

  • The basic configuration of Postfix (mail)
  • The use of Imagemagick to create dynamically a captcha for your application
  • The configuration of Bind9 in order to play with the url CNAME

The goal here is not to set up an hardened production server with all the optimizations and security niceties in head (I definitively want to avoid a ‘Why not Gentoo, or Slackware, or Debian, or FreeBSD, …?’, I love them all).

Continue reading

Generate HTML from a JSON Without any Template but HTML and Javascript

The post below explains why we developed PURE a templating engine for Javascript.
PURE is ultra-fast and binds JSON data with clean HTML(no special syntax or logic required).

A few weeks back now, we started the development of our new web application BeeBole.

Of course we had to make several important choices for our IT architecture.

We started by choosing a light, flexible and really fast back-end as mentioned in our post: Why Erlang ?

For the front-end, we wanted the browser to be the center for rendering and aggregating services. (Read our post about True Aggregation, the Browser as a Platform).

To achieve this goal, we had to decide for:

  1. a JavaScript library to ease the cross-browser issues and advanced DOM functionality
  2. a communication language between the browser and the back-end: JSON ? XML ?
  3. a template engine to render the back-end services in HTML

Continue reading