Search Here

Custom Search

Saturday, June 7, 2008

Properly display paragraphs in browser

When we write something in several paragraphs in textarea of browser then it shows as it is in teaxtarea. But when we want to show the text in read only mode then the paragraphs loose their identity. I mean you can not separate the paragraphs from each other. So we need to replace the newlines of the text by

I have written a simple function named ‘keepWhiteSpace’ to do this conversion and I used it in many of Therap's forms to display the saved text as it is. Usage is very simple.

For example, if you want to show your text in a cell then write as follows:


The implementation is very simple.

<#function keepWhiteSpace value>
<#return value?replace("\r\n","<br>")?replace("\n\r","<br>")?replace("\r","<br>")?replace("\n","<br>")>

Ftl(Free Marker Tag Library) users can use it without rewriting any new one. JSP users need to write a tag using the logic.

Note that I haven’t replaced spaces by

Thursday, June 5, 2008

The word ‘Mother’ in different languages

Definitely the first word a child learns after birth is the word ‘Mother’ in his own language. Its also the most favorite word of every human being. Surprisingly almost in every language mother is initialed by the letter ‘m’. Or at least contains ‘m’ in the word. This is really amazing. What may be the cause? May be its easy to produce sounds from lips for a child. Or they start creating sound like ‘mmmm….’ and ultimately they learn the word mother.

Here is a big list of translation.