Quantcast
Viewing latest article 4
Browse Latest Browse All 101

Penny Books launched, books for a penny À gogo

Image may be NSFW.
Clik here to view.
penny books logo

I'm pleased to announce the launch of a little side project of mine, Penny Books. It is a quirky book search engine that uses the Amazon API to find books which are on sale for one penny.

This idea originally came to me years ago. I bought a book called The Web Developers Guide to Amazon eCommerce Service by Jason Levitt, but being the coding pup I was then, the contents went over my head. Today I'm more than intellectually equipped for the job!

Amazon uses SOAP as its preferred information sharing protocol but, thankfully, I didn't have to spend time on the details of this technology because I used Jan Eichhorn's Amazon Product Lookup and Product Search Library. This little script is fantastically user-friendly and I never had any problems that couldn't be easily overcome.

Another part of the server-side code was limiting the number of searches per person per hour. Amazon places very strict limits on access to its data and it would have taken only a small number of visitors to exhaust the hourly rate. The only foolproof method is by building a database and tracking visitors' IP addresses and their number of searches. It's important as well to have fields for the time of their last visit and the time of their “banning”. By using all these fields it is possible to effectively block access to the remote API call if the user exceeds the limit and also delete old and unwanted database entries.

Also on the server-side, the site uses Bad Behavior and Project Honeypot to help repulse spam.

For the client-side code I used the jQuery library for the usual cross-browser compatibility issues and the wonderful Backstretch plugin for the central fixed background image. It is possible to use a background image in CSS and the background-size property, but, like all CSS3, it isn't supported in Internet Explorer 8 and below. Also, I've used Backstretch on a number of different projects now and I've found that it renders the images a lot sharper than “background-size: contain” does.

As the site uses AJAX, I also used the HTML5 History API in order to create usable URLs (Twitter is currently in the process of swapping over to this new API). The only sane way of beginning to achieve acceptable cross-browser working code is to use Benjamin Lipton’s History.js. I write “beginning” on purpose because there are bugs in the code and it is necessary to write more JavaScript to fill in this hole.

The CSS is fully responsive with a dependence on relative and percentage measurements.

On the left hand side on the home page are social media buttons. I wanted these removed from the mobile version. The lazy way is to hide it with “display: none” but the mobile platform will still download the code. The method I used was to build the social media buttons with JavaScript and, using screen.width, to only access the code on large devices.

So, I hope you have fun with Penny Books and you find those reading bargains!


Viewing latest article 4
Browse Latest Browse All 101

Trending Articles