Friday, June 29, 2007

change boot splash screen ubuntu

Easy steps to change the boot splash screen in ubuntu 7.04

1. firstly get the available splash screens. Do a

sudo apt-get install usplash*

It will display a list of available splash screens with ubuntu.

2. Next check out the available splash screens in /usr/lib/usplash

ls -lh /usr/lib/usplash

total 12M
-rw-r--r-- 1 root root 43K 2006-11-23 17:42
-rw-r--r-- 1 root root 2.3M 2007-03-30 17:33
lrwxrwxrwx 1 root root 36 2007-05-17 23:20 -> /etc/alternatives/
-rw-r--r-- 1 root root 2.0M 2006-10-17 15:13
-rw-r--r-- 1 root root 2.3M 2007-04-07 15:36
-rw-r--r-- 1 root root 2.6M 2007-04-10 18:28
-rw-r--r-- 1 root root 2.0M 2007-03-19 16:17

Here you can see that you have 6 splash screens and one soft link. Check out the softlink.

ls -lh /etc/alternatives/

lrwxrwxrwx 1 root root 41 2007-06-29 08:38 /etc/alternatives/ -> /usr/lib/usplash/

It points back to one of the screens from the /usr/lib/usplash directory. So to change the screen simply change the soft link

sudo ln -sf /usr/lib/ /etc/alternatives/

And now check the new link

3. reconfigure the linux image

sudo dpkg-reconfigure linux-image-

Running depmod.
update-initramfs: Generating /boot/initrd.img-2.6.20-16-generic
Updating /boot/grub/menu.lst ... done

Thats done...

To check the new screen, no dont reboot simply type in

sudo usplash

And you can see the new screen - bingo. To get back to your xwindows environment press CTRL-ALT-F7


here is the link for advanced users for creating their own splash screens
Anyone who develops his/her own splash screen can share it out with other ubuntians...

Thursday, June 07, 2007

lucene in php & lucene in java

Something i found out while solving some issue from Mr. Nguyen from vietnam.

He used lucene-php in zend framework for building a lucene index and searching on the index, and was facing issues with search times. It turned out that mysql full text index was performing better than lucene index.

So i did a quick benchmark and found the following stuff

1. Indexing using php-lucene takes a huge amount of time as compared to java-lucene. I indexed 30000 records and the time it took was 1673 seconds. Optimization time was 210 seconds. Total time for index creation was 1883 seconds. Which is hell lot of time.

2. Index created using php-lucene is compatible to java-lucene. So index created by php-lucene can be read by java-lucene and vice versa.

3. Search in php-lucene is very slow as compared to java-lucene. The time for 100 searches are -

jayant@jayantbox:~/myprogs/java$ java searcher
Total : 30000 docs
t2-t1 : 231 milliseconds

jayant@jayantbox:~/myprogs/php$ php -q searcher.php
Total 30000 docs
total time : 15 seconds

So i thought that maybe php would be retrieving the documents upfront. And changed the code to extract all documents in php and java. Still the time for 100 searches were -

jayant@jayantbox:~/myprogs/java$ java searcher
Total : 30000 docs
t2-t1 : 2128 milliseconds

jayant@jayantbox:~/myprogs/php$ php -q searcher.php
Total 30000 docs
total time : 63 seconds

The code for php search for lucene index is:

* searcher.php
* On 2007-06-06
* By jayant


$index = new Zend_Search_Lucene("/tmp/myindex");
echo "Total ".$index->numDocs()." docs\n";
$query = "java";
$s = time();
for($i=0; $i<100; $i++)
$hits = $index->find($query);
// retrieve all documents. Comment this code if you dont want to retrieve documents
foreach($hits as $hit)
$doc = $hit->getDocument();

$total = time()-$s;
echo "total time : $total s";

And the code for java search of lucene index is

* On 2007-06-06
* By jayant

import org.apache.lucene.queryParser.*;
import org.apache.lucene.analysis.*;
import org.apache.lucene.analysis.standard.*;
import org.apache.lucene.document.*;

public class searcher {

public static void main (String args[]) throws Exception
IndexSearcher s = new IndexSearcher("/tmp/myindex");
System.out.println("Total : "+s.maxDoc()+" docs");
QueryParser q = new QueryParser("content",new StandardAnalyzer());
Query qry = q.parse("java");

long t1 = System.currentTimeMillis();
for(int x=0; x< 100; x++)
Hits h =;
// retrieve all documents. Comment this code if you dont want to retrieve documents
for(int y=0; y< h.length(); y++)
Document d = h.doc(y);

long t2 = System.currentTimeMillis();
System.out.println("t2-t1 : "+(t2-t1)+" ms");

Hope i havent missed anything here.