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"});
    }});
    
}