Pither.com / Simonhttps://www.pither.com/simon/blog/2013-07-29T13:58:20+00:00Development, systems administration, parenting and businessTicket sales (PayPal, Jasper Reports, Barcodes) with Grails2011-07-25T00:00:00+00:002013-07-29T13:53:16+00:00Simon Pitherhttps://www.pither.com/simon/blog/2011/07/25/ticket-sales-paypal-jasper-reports-barcodes-with-grails<article>
<h1>Ticket sales (PayPal, Jasper Reports, Barcodes) with Grails</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2011-07-25T00:00:00+00:00">Mon 25th Jul 2011</time>
(updated <time datetime="2013-07-29T13:53:16+00:00">Mon 29th Jul 2013</time>)
</div>
<div>
<p>Please see <a href="/articles/2011/07/19/tickets-selling-sending-supporting-and-checking-all-in-three-weeks">Part 1</a> for the start of this series and links to all parts.</p>
<p>For the <a href="http://www.supajam.com/">SupaJam</a> ticket outlet, we didn't need anything too fancy, just enough to present people with a couple of ticket types to choose from and a way to pay for them. Of course we still had the extra requirement of collecting a real name for each and every ticket as well though.</p>
<p>We kept the structure online pretty simple, sticking to a single web page, either re-displaying with errors or sending the user straight to PayPal (our chosen payment processor purely for reasons of technical experience).</p>
<p>So far this was all fairly basic coding, a command object, controller, a couple of views and a few new domain objects to keep it all. This is where <a href="http://grails.org/">Grails</a> really shines, making all of this simple and quick.</p>
<p>There is already a PayPal plugin for grails, but in this case I didn't feel it fitted, so the PayPal integration was custom coded. This included building and passing a cart, based on user selections as well as an IPN endpoint to make sure all the purchases were dealt with automatically.</p>
<p>Once a user has visited one of our ticket pages and decided to take up an offer, been to PayPal and paid, it's generally useful to then provide a ticket. This was the part that presented the first interesting challenge.</p>
<p>We hadn't finalised how we were going to run our festival entrance yet but it seemed like a fast method to check unique ticket codes might be handy. The quick and simple answer to this seemed like a barcode. So each person would need a physical ticket to bring along that we could scan and quickly check validity. We didn't want to add postage costs to what we charged, so email was the simplest solution. As for the most controllable and widely readable document format to send people - PDF of course!</p>
<p>So we needed to make PDFs that would contain some useful instructions to the owner, a few critical ticket details plus the essential unique code and its barcode representation. To make them look nicer and also to better fill an A4 page we also decided to add an image about the festival.</p>
<p>I had read about Jasper Reports before and knew there was a Grails plugin for it, so I decided it would be a good place to start. I soon had iReport downloaded, running and a simple ticket report designed.</p>
<p>While the basics of the ticket looked simple enough, there were two elements that proved slightly tougher. The most critical was the barcode. When adding a barcode in iReport you first get a choice of barcode library. So I researched each and picked the one I preferred.</p>
<p>This worked fine in iReport, but it soon became apparent that the Grails Jasper Reports plugin deliberately excludes most of the optional components and dependencies of Jasper. This included both of the barcode libraries. So off I went trying to add <a href="http://barcode4j.sourceforge.net/">Barcode4J</a> to my grails project. </p>
<p>After an hour or so of fighting to include one layer of dependencies while desperately excluding the next layer (mostly to avoid XML parser conflicts), I admitted defeat and had a crack at the <a href="http://barbecue.sourceforge.net/">Barbecue</a> barcode library instead. Thankfully this turned out to be trivial in comparison and just needed:</p>
<pre><code>compile('net.sourceforge.barbecue:barbecue:1.5-beta1') {
excludes 'portlet-api', 'servlet-api', 'junit'
}
</code></pre>
<p>The only downside was that I couldn't get the code to be automatically included under the barcode (even in iReport). Just including the code in a text field was a simple work around though.</p>
<p>Next up was the included images - for branding, page filling and information. I wanted to change these for different events and fetching each image from an event configured URL seemed like a good way to go. At least I thought that until I tried it!</p>
<p>For quite some time Jasper Reports stubbornly refused to load the images into the report. Test images from another site would work, but not those from my development grails server.</p>
<p>After much debugging and eventually resorting to tcpdump(!), I tracked this down to the zipped-resources plugin which currently does two bad things (as documented). It doesn't check to see if a client actually supports gzip and it gzip's images! So this meant that Jasper was being given gzipped images which it couldn't deal with.</p>
<p>Once I realised this, simply removing the zipped-resources plugin solved the problem. Although in the end I actually re-instated the zipped-resources plugin and decided to host the images on one of our external (ie not Grails) web servers.</p>
<p>My final little niggle with Jasper was font based. I could not seem to find a font that both Jasper could measure (for alignment purposes) and clients could find when rendering the PDF. I ended up solving this by using the Jasper-fonts package and choosing to embed the fonts within the PDF. This needed another line in my grails-app/conf/BuildConfig.groovy file:</p>
<pre><code>compile('net.sf.jasperreports:jasperreports-fonts:4.0.0')
</code></pre>
<p>And that was it.</p>
<p>In less than a (short, due to bank holidays) week I built an e-commerce ticket agent system that created pretty, barcoded e-tickets. This promptly went live on <a href="http://www.supajam.com/">SupaJam</a> and sold several hundred (up to thousands by now) festival tickets.</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=grails">grails</a>
<a rel="tag" href="/simon/blog/?tag=jasper">jasper</a>
<a rel="tag" href="/simon/blog/?tag=reports">reports</a>
<a rel="tag" href="/simon/blog/?tag=barcode">barcode</a>
<a rel="tag" href="/simon/blog/?tag=resources">resources</a>
<a rel="tag" href="/simon/blog/?tag=zipped-resources">zipped-resources</a>
<a rel="tag" href="/simon/blog/?tag=technology">technology</a>
</div>
</div>
</article>
Tickets: selling, sending, supporting and checking; all in three weeks2011-07-19T00:00:00+00:002013-07-29T13:52:49+00:00Simon Pitherhttps://www.pither.com/simon/blog/2011/07/19/tickets-selling-sending-supporting-and-checking-all-in-three-weeks<article>
<h1>Tickets: selling, sending, supporting and checking; all in three weeks</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2011-07-19T00:00:00+00:00">Tue 19th Jul 2011</time>
(updated <time datetime="2013-07-29T13:52:49+00:00">Mon 29th Jul 2013</time>)
</div>
<div>
<p>Towards the end of May, <a href="http://www.supajam.com/">SupaJam</a> launched the first round of several festival ticket give aways planned for this summer. This wasn’t the first time SupaJam has given away festival tickets, but it is the first time that we've done it in this way.</p>
<p>Technically, it all went well. The days afterwards did include a rather large number of support emails though!</p>
<p>In hind sight, this isn't entirely surprising, we do make life a little difficult for ourselves. These give aways are providing a limited number of quite valuable tickets, so to protect ourselves and the festivals we want to make sure that the tickets we give away are not resold. We don't want a ticket tout to end up benefiting. Hence we always collect a real (ID-able) name for each ticket. If that wasn't enough to ask of people claiming these tickets, we gave them away first-come-first-served, so everyone typing in their details was typing in a hurry!</p>
<p>So in flooded the requests to change names, correct spellings, return duplicates that were got for or by friends and assorted other amendments.</p>
<p>It quickly became apparent that giving away tickets in this way had a fairly high support cost associated with it.</p>
<p>So we put our thinking caps on and decided that we should charge a small administration fee to cover some of the support costs that seemed to be inevitable. Of course, this meant we needed some kind of e-commerce setup in order to process these fees.</p>
<p>Part of the deal that we made with the festival for these tickets meant that we had to run our own box office, on site at the festival, to process and verify each of our ticket holders. A process for making that happen, both reliably and quickly was also a challenge we hadn't solved yet.</p>
<p>By the time we'd revised our approach, we had just three weeks until the first festival - the <a href="http://londonfeis.com/">London Feis</a> in Finsbury Park. This story (which I've split into four further parts to ease my writing as much as your reading) is my journey through the technology solutions I developed and built to enable hundreds of people to enjoy a free festival courtesy of SupaJam.</p>
<p>(Each part below will become a link as I write the articles.)</p>
<p><a href="/articles/2011/07/25/ticket-sales-paypal-jasper-reports-barcodes-with-grails">Part 2 - Ticket sales</a><br />
Part 3 - Customer support and search<br />
Part 4 - Creating and running the technology for a box office<br />
Part 5 - Lessons from becoming a ticket agent and box office in 3 weeks</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=grails">grails</a>
<a rel="tag" href="/simon/blog/?tag=technology">technology</a>
</div>
</div>
</article>
Follow the FIB Final on SupaJam2010-06-08T10:39:00+00:002010-07-18T19:28:38+00:00Simon Pitherhttps://www.pither.com/simon/blog/2010/06/08/follow-the-fib-final-on-supajam<article>
<h1>Follow the FIB Final on SupaJam</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2010-06-08T10:39:00+00:00">Tue 8th Jun 2010</time>
(updated <time datetime="2010-07-18T19:28:38+00:00">Sun 18th Jul 2010</time>)
</div>
<div>
<p>Today is the Fast Track to FIB 2010 final. For the first time there will be live footage uploaded to SupaJam as the day and night progresses.</p>
<p>This means I get to spend the day in London editing, preparing and uploading photos and videos.</p>
<p>Thankfully I've spent the last couple of weeks preparing the SupaJam site to make my job nice and easy - if it all goes according to plan I might even get to enjoy some of the entertainment!</p>
<p>If you want to see what's happening and witness my hard work, keep your eyes on <a href="http://www.supajam.com/events/sj/fib2010-final">The Fast Track to FIB 2010 Final</a> page on SupaJam.</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=fib">fib</a>
</div>
</div>
</article>
FIB 2010 Music Contest Launched2010-02-16T09:37:00+00:002010-07-18T19:49:11+00:00Simon Pitherhttps://www.pither.com/simon/blog/2010/02/16/fib-2010-music-contest-launched<article>
<h1>FIB 2010 Music Contest Launched</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2010-02-16T09:37:00+00:00">Tue 16th Feb 2010</time>
(updated <time datetime="2010-07-18T19:49:11+00:00">Sun 18th Jul 2010</time>)
</div>
<div>
<p>I'm not convinced this will apply to many of the people who read this, but if you know someone in an unsigned band who fancies a chance of playing at this years <a href="http://fiberfib.com/en/line-up/benicassim-festival-2010/">FIB festival in Spain</a>, then <a href="http://www.supajam.com/fib2010">SupaJam's Fast Track to FIB contest</a> has now opened it's doors.</p>
<p>We've only just put the contest live and the official PR launch isn't due for a little while yet, so you're now among a privileged few with early notice!</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=fib">fib</a>
</div>
</div>
</article>
Writing HTML email is unpleasant!2009-09-04T00:00:00+00:002013-07-29T13:58:20+00:00Simon Pitherhttps://www.pither.com/simon/blog/2009/09/04/writing-html-email-is-unpleasant<article>
<h1>Writing HTML email is unpleasant!</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2009-09-04T00:00:00+00:00">Fri 4th Sep 2009</time>
(updated <time datetime="2013-07-29T13:58:20+00:00">Mon 29th Jul 2013</time>)
</div>
<div>
<p>Unfortunately I must admit that a nicely formatted HTML email looks rather better and more catchy as a newsletter than a simple string of plain text. This goes against my general email preference, but even I have relented in recent times and started allowing my mail client to display HTML email (although I still never send it)!</p>
<p>So with this in mind, I have been spending time this week working on the <a href="http://www.supajam.com/newsletter/show/issue1">first SupaJam newsletter</a>.</p>
<p>I started out with a nice big graphic from our designer that provided the layout and all the images to be used, plus the copy from David. Taking these parts and creating a nice (self-contained, with embedded styles) web page that looked almost identical to the original design only took a couple of hours.</p>
<p>Then I emailed it to myself. And cried!</p>
<p>It would appear that many email clients really don't support much HTML at all and sadly even less CSS...</p>
<p><a href="http://www.campaignmonitor.com/css/">http://www.campaignmonitor.com/css/</a></p>
<p><a href="http://www.onenw.org/toolkit/guidelines-for-css-and-email-newsletters">http://www.onenw.org/toolkit/guidelines-for-css-and-email-newsletters</a></p>
<p>With a slightly painful learning curve, another day or so of effort and lots of trial, error and cursing, I do finally have a newsletter that looks a little bit like the original design and displays (fairly) consistently across all of the web browsers and email clients I have available to test with.</p>
<p>Thankfully it will be another month before I get to do this again and with some luck we'll stick with the same template.</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=html">html</a>
<a rel="tag" href="/simon/blog/?tag=email">email</a>
<a rel="tag" href="/simon/blog/?tag=technology">technology</a>
</div>
</div>
</article>
New SupaJam Unsigned Band Contest2009-04-20T08:27:00+00:002009-10-15T15:52:46+00:00Simon Pitherhttps://www.pither.com/simon/blog/2009/04/20/new-supajam-unsigned-band-contest<article>
<h1>New SupaJam Unsigned Band Contest</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2009-04-20T08:27:00+00:00">Mon 20th Apr 2009</time>
(updated <time datetime="2009-10-15T15:52:46+00:00">Thu 15th Oct 2009</time>)
</div>
<div>
<p>Last year <a href="http://www.supajam.com/">SupaJam</a> ran a contest to offer an unsigned band the chance to play at a <a href="http://www.fiberfib.com/">huge music festival</a> in Spain. They got over a thousand entries and one lucky band got flown out to Spain for a few days and got to play live at the festival.</p>
<p>This year the <a href="http://www.supajam.com/">SupaJam site</a> has been revamped and the new <a href="http://www.supajam.com/fib-2009">FIB contest</a> has already been running for a couple of weeks. This year's contest looks set to be even bigger and better. They are already fast approaching the number of entries from last year and there are still a few weeks left to enter.</p>
<p>As I don't think many of the (2 or 3) people who read this blog actually play in a band...</p>
<p>Last year <a href="http://www.seoss.co.uk/">SEOSS</a> was looking after the servers running the site and we had some limited involvement in keeping an eye on the development of the site. The actual development was outsourced to an Indian company who chose to base it on Typo3. By the time they had finished, there wasn't really very much of Typo3 actually visible, pretty much all of the site was custom extensions.</p>
<p>This year I have taken on a far more active role. <a href="http://www.seoss.co.uk/">SEOSS</a> is still looking after the servers involved, however now I am personally managing the development (done by a small outsourced team and myself). This time around I have based the site on <a href="http://socialwebcms.com/">Social Web CMS</a>, although there is still an awful lot of custom code involved.</p>
<p>We've still got a lot of exciting features in the development plan, plus a few rough edges to sort out. But the site is live and running well.</p>
<p>On that point, a slight aside - last year serving the homepage (which at that time was far simpler with less dynamic news content) to the local machine took approximately 1 second. This time around, the homepage takes just 0.1 seconds to serve to the local machine!</p>
<p>Both systems use PHP. The hardware, operating system and database have not changed. In theory the new system pays less attention to caching (we haven't optimised much yet) and it includes more dynamic content on the homepage. So my conclusion is not really a recommendation for SWCMS, but instead a <a href="http://typo3.com/">warning to avoid Typo3</a>!</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=work">work</a>
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
<a rel="tag" href="/simon/blog/?tag=swcms">swcms</a>
<a rel="tag" href="/simon/blog/?tag=typo3">typo3</a>
</div>
</div>
</article>
Supajam competition launch2008-05-19T07:29:00+00:002009-10-15T15:52:36+00:00Simon Pitherhttps://www.pither.com/simon/blog/2008/05/19/supajam-competition-launch<article>
<h1>Supajam competition launch</h1>
<div class="article-meta">
Posted
by <span>Simon Pither</span>
on <time datetime="2008-05-19T07:29:00+00:00">Mon 19th May 2008</time>
(updated <time datetime="2009-10-15T15:52:36+00:00">Thu 15th Oct 2009</time>)
</div>
<div>
<p>One of my customers today launches their latest <a href="http://www.supajam.com/contests/fasttrack/home.html">competition</a>. This contest is looking for unsigned bands to upload their best track and after a few rounds and filtering and a public vote the winner will get to perform live in Spain in front of thousands of people!</p>
<p>Certainly not my idea of fun, but I'm sure many will disagree with me there! As for my fun, I shall be making another post about the development of their site. For now though, feel free to spread the word about the contest and good luck to anyone entering.</p>
</div>
<div class="tags-panel panel panel-default">
<div class="panel-body">
Tags:
<a rel="tag" href="/simon/blog/?tag=work">work</a>
<a rel="tag" href="/simon/blog/?tag=supajam">supajam</a>
</div>
</div>
</article>