bootpag - jQuery pagination plugin

jquery paginationBootpag is simple jQuery plugin which helps you create dynamic pagination. Additionally it works well with twitter bootstrap.

When dynamic pagination is needed? 

Whenever our page uses heavy asynchronous loading and we don't know exact number of paginated pages until we make some AJAX requests. Also when our total number of pages changes - for example when we implement dynamic search feature.

Getting started

First of all we need to download bootpag plugin. Let's create basic HTML page. We should prepare HTML elements where we will show content of dynamic loaded pages.

Easiest way to have instant HTTP server

Sometimes you want to test some JavaScript/CSS on HTML page with some libraries you just downloaded. Opening *.html file in browser from a folder isn't always best solution - especially when scripts on page think it is HTTP protocol (not "file://" protocol). You can always try WAMP on Windows or native HTTP sharing on OSX, but it takes time. If you have only 5 seconds to start up a server - go to preferred folder in your terminal window and type this command:


python -m SimpleHTTPServer 8000

Just it! Go to your server http://localhost:8000.Works on Windows (with python installed), OSX and Linux.

Node.js simple server

For node.js fans: here is simple snippet for serving files

Install connect module (globally)
npm install -g connect
Save snippet as server.js file and run:
node server.js

Opera and Webkit releases experimental public build that passes Acid3

Opera finally passes ACID3 tests. Now everyone can confirm this by downloading WinGogi snapshot
WebKit team also announces Acid3 compatibility
Good for them! IE8 and Firefox teams are very quiet lately. Maybe they're focused on their public releases instead of making web platform better...

How to put your own blog on iPhone...

As you know, iPhone has Safari browser onboard. It's pretty neat and great working... but sites with huge layouts don't look good on small iPhone screen. When you have own blog it would be good to display it in customized way.
Today almost all blogs have RSS Feeds so if we want to display our blog in cusomized, iPhone ready look it's just to put blog's feed through some RSS parser and display it as iPhone ready web page. Let's use iui - project started by Joe Hewitt - creator of firebug. It's a simple JavaScript framework for iPhone web pages.
So, we have iui now we need some PHP RSS reader. We'll use SimpleXMLObject class because it's ... simple.

As you can notice in php code we have function calls to something called xcache - it's very nice plugin for php speeding up your code by doing magic opcode caching. But for now we'll use different advantage of cache - you can store variables just in your server memory and get access to it on different php file calls. I this case we use this to download RSS feed once and store it for a while. So if you refresh your browser or some one else will go on your blog we do not need to download feed again.

Now we have our blog's feed and we can display it in nice iui internface.
Putting all things together we have pretty simple and neat iPhone blog: http://botmonster.com/iFeed/
Now, let's make browser detection - if browser is iPhone's Safari redirect user to our "iPhone ready" blog page. Just paste this JavaScript snippet into html section of your blog template. Replace "feedURL=" with link to your blog's feed.

It's very simple detection, if you need more sophisticated detection I'll recommend using this webkit detect script Just try to enter this address into your iPhone: blog.botmonster.com - you'll be redirect into iFeed page and you will see something like this:

You can download all iFeed code from google code at http://code.google.com/p/ifeed/
Available under MIT licence.

iTunes Album Art With Amazon Covers Using PHP/JS

How to get album art for your favorite mp3 album? It's pretty easy. There's lot of little programs and scripts to add custom covers for albums, but when you have hundreds of thousands albums it's better to make some batch programming.

How to setup itunes album art in 3 easy steps?
  1. Put all your mp3's in artist - album names.
  2. Download album cover from amazon.com
  3. Put this cover for all tracks in itunes album.
Let's play with Amazon.com api

Ok, so let's get started. First of all we need Amazon Web Services account.After the registration progress we can create cust
om app that will search and download covers of our albums. We'll be using amazon web services api with our secret Access Key ID and Secret Access Key. We want to have a little PHP crawler that will go through all of folders and search for album art.
Fille called getCovers.php:
We can execute this script from command line
c:> php getCovers.php "c:\mp3"

first parameter is our main folder name where we have stored all our mp3 albums. In each folder an cover.jpg file will appear.
Now, we must put this covers to iTunes. We can do it manually by right click on song and adding cover from disc. Of course it's not very efficient way to do that specially when we have tons of mp3's. So we can use apple scripting advantages. Specially when we work on Windows we'll use COM api for iTunes. You can obtains Apple's COM SDK from here if you are curious what can be done with iTunes.

iTunes remote control via JScript

Now we have to iterate trough all files in our iTunes library and put cover.jpg file to each of them. We'll use simple Windows JScript with Apples COM interface and FileSystemObject to operate on our disc. Let's call out script putCovers.js:

We can execute this script from command line
c:> cscript putCovers.js

It will take a while depending on your mp3 database size. Now you see all covers in your Cover Flow View in iTunes and you can synchronize albums to your iPod touch or iPhone for even better album view experience :)

IE 8 finally passing ACID2 test


Heh, at last IE 8 passes ACID2 test. Full coverage can be found here. What it means? Nothing really, as all of average users uses IE 6, a little bit of FF 2.0. Today we just now that in 4 years time we probably could see some of advantages what happened in December 2007... Let's focus on what we have today and make it work for browsers which are on the market now.
Oh, that creepy Halloween face :)