Friday, January 12, 2007

SOLR

Wow !

If you have worked with Lucene, then you owe it to yourself to check out SOLR. It's just about to graduate to a full fledged apache project and it's a doozy. Basically take Lucene, add a REST'ful interface on top, basic web administration and goodies like replication & caching. What makes this cool is it is usable by both Java and non-Java tools. So you can run SOLR for your search engine but have a Django based front end. Did I mention it powers the search for some major sites - like shopper.com and was donated by CNET.

Just post xml docs following a dead simple format to SOLR and it takes care of indexing them. Post another xml doc to query it and it shoots you back the search results.

I'm working on scaling up www.getlocalbiz.com and SOLR will definitely be a part of it (we are already using Lucene for search)

Sunday, January 7, 2007

Mochislide

Ok, here's how to do a simple slideshow with fading images in mochkit. Simple and powerful, Lord how I love mochikit ! Example is here


var images = new Array();
// Set up your images here
images[0]="images/deedee.gif";
images[1]="images/dexter.jpg";

var imageObjs = new Array();

var currentIdx = 0;

// preload images
for(idx in images){
var tmp = new Image();
var imageName = images[idx];
tmp.src = imageName;
imageObjs[idx] = tmp;
}

// start interval times
var slideInterval = setInterval('onInterval()', 5000);

function onInterval(){
// increment image index and reset if necessary
currentIdx = currentIdx + 1;
if(currentIdx >= images.length){
currentIdx = 0;
}
// fade out existing image
// and pull in next image
fade("slideshow", {"to" : "0.1", "duration" : "0.4", afterFinish: function () {
$("slideshow").src = imageObjs[currentIdx].src;
appear("slideshow", {"duration" : "0.4"});
}});

}

Sunday, December 17, 2006

Image fade with MochiKit

MochiKit rocks. I needed to add an image fade for a site I am revamping and it was suprisingly easy using Mochikit. Go here for an example. Here's the relevant code

var deedee = new Image();
deedee.src = 'images/deedee.gif';
var dexter = new Image();
dexter.src = 'images/dexter.jpg';


function onImageMouseover(){
fade("bigPic", {"to" : "0.1", "duration" : "0.4",
"queue" : "break", afterFinish: function () {
$("bigPic").src = dexter.src;
appear('bigPic', {"duration" : "0.4", "queue" : "break"});
}});
}

function onImageMouseout(){
fade("bigPic", {"to" : "0.1", "duration" : "0.4",
"queue" : "break", afterFinish: function () {
$("bigPic").src = deedee.src;
appear('bigPic', {"duration" : "0.4", "queue" : "break"});
}});
}

Saturday, December 2, 2006

Insanely Great

I've been reading Stephen Levy's book about the rise of the Macintosh - Insanely Great. It's a really good read if a little dated. I still remember that tingly feeling when I first saw a Mac Plus and it really was insanely great for it's time. We owe a lot to the Mac and the emphasis on instant usability and intuitive interfaces is something we would do well to emulate in our fancy Web 2.0 interfaces.