Saturday, March 29, 2008

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...

Monday, January 28, 2008

Best Mac vs PC spoof.. ever

Tuesday, December 25, 2007

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.

<?php
$feed = simplexml_load_file($feedURL);
?>


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.

<script type="'text/javascript'">
//<!--[CDATA[
if(document.location.href == 'http://blog.botmonster.com/' && navigator.userAgent.match(/iPhone|iPod/i)){ document.location='http://botmonster.com/blog/?feedURL=http://feeds.feedburner.com/BotmonstersWired'; }
//]]-->
</script>



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.

Sunday, December 23, 2007

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:

//Enter your Amazon Web Services IDs
define("Access_Key_ID", "");
define("Associate_tag", "");

//Set up the operation in the request
function ItemSearch($SearchIndex, $Keywords){
$Operation = "ItemSearch";
$Version = "2007-07-16";
$ResponseGroup = "ItemAttributes,Images";
$request=
"http://ecs.amazonaws.com/onca/xml"
. "?Service=AWSECommerceService"
. "&AssociateTag=" . Associate_tag
. "&AWSAccessKeyId=" . Access_Key_ID
. "&Operation=" . $Operation
. "&Version=" . $Version
. "&SearchIndex=" . $SearchIndex
. "&Keywords=" . $Keywords
. "&ResponseGroup=" . $ResponseGroup;

$response = file_get_contents($request);
$parsed_xml = simplexml_load_string($response);
if(isset($parsed_xml->OperationRequest->Errors->Error) || isset($parsed_xml->Items->Request->Errors))
return null;
else
return $parsed_xml;
}
$it = new RecursiveDirectoryIterator($argv[1]);
foreach (new RecursiveIteratorIterator($it, 2) as $path) {
if(!$path->isDir())
continue;
$search = preg_replace(array('#'.addslashes($argv[1]).'#','/[\\\_\-]/','/\([0-9a-zA-Z ]+\)/',),
array('',' ','',),$path);
$item = ItemSearch('Music', urlencode($search));
if($item !== null)
file_put_contents($path.'\cover.jpg',file_get_contents($item->Items->Item[0]->LargeImage->URL));
}
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:
/**
* (c) 2007 botmonster http://blog.botmonster.com
*/
var iTunesApp = WScript.CreateObject("iTunes.Application");
var fso = new ActiveXObject("Scripting.FileSystemObject");
var tracks = iTunesApp.LibraryPlaylist.Tracks;
var numTracks = tracks.Count;
var i;
var c = 0;WScript.Echo(numTracks);
for (i = 1; i <= numTracks; i++) { var currTrack = tracks.Item(i); if ( currTrack.Artwork.Count == 0 && currTrack.Location != ''){ var songFile = fso.GetFile(currTrack.Location); var size = songFile.Size; var cover = fso.GetParentFolderName(currTrack.Location) + '\\cover.jpg'; if (fso.FileExists(cover)){ if (songFile.attributes & 1){ songFile.attributes = songFile.attributes - 1; } try{ currTrack.AddArtworkFromFile(cover); }catch (e){ WScript.Echo(e.description + '\n'); } } } }

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 :)

Saturday, December 22, 2007

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 :)

Saturday, September 1, 2007

PostIt time to think!

In Scrum you use postIt's every day... Just found out some inspirations

Sunday, June 10, 2007

Aquango - blog solution for aquarists

Aquango.com is a free web blog system, but it's not average weblog - it's the place where aquarists can show off.
They can submit photos, write about aquarium and even measure temperature and display on graph. But, it's not all, Aquango is open source - php code available over SourceForge.net
You can obtain aquango demo blog here or check phpaquablog - open source system for your own.
Great aquarium gallery.