Javascript – Add Float numbers upto 2 Decimal

Hi,

Today I was creating a page that is basically a calculator page have many text fields. All of them can accept number upto 2 decimal and onBlur() I have to total that numbers and display on the page

 <script language="JavaScript" type="text/javascript">

function something()
{
    var val = parseFloat('2.22') + parseFloat('3.33');
    val = parseInt( val * 100 ) / 100;
    alert(val)

}

</script>

it results 5.5500000000000001 but my expected result was 5.55

Continue reading “Javascript – Add Float numbers upto 2 Decimal”

Lucene 2.3 – working example of Indexer and Searcher

Hi All,

Now days I was working on Lucene a Java API that offers you search capability for your application.
Lucene is a powerful search library that lets you easily add search to any application. One of the key
factors behind Lucene’s popularity is its simplicity, but don’t let that fool you under the hood there are
sophisticated, state of the art Information Retrieval techniques quietly at work.

Current version available is 2.3.2.

The book i am referring for Lucene is Manning series "Lucene in Action ", but problem with this book is , this is handling Lucene 1.4 version that is entirely different from the latest one. There are many new syntax changes because of that you will no be able to run this books example with 2.3 Version.

I have modified its basic Indexer and Searcher example to run with latest version and posting here for your reference.

Indexer.java

This will create Index of directory provided by the user 

Continue reading “Lucene 2.3 – working example of Indexer and Searcher”