Sunday, December 13, 2009

Facebook application for Goodread

If you use Goodreads and Facebook, then this application will be useful. You can provide a box or tab for Goodreads and you can showcase your books in Facebook.
http://apps.facebook.com/good_reads/

My Goodread bookshelf

Check out my bookshelves on Goodreads - where you can see what your friends are reading.

http://www.goodreads.com/friend/i?i=LTM2MDQ1MzAxNTI6MzY3

Sunday, November 29, 2009

Application Architecture guide Version 2 from Microsoft

Application Architecture guide v2 has been released by microsoft. I have not yet read it. Version 1 was good, table of content of v2 looks promising. this is guide is not specific to .net. it is very good discussion on enterprise application architecture in general.
http://www.microsoft.com/downloads/details.aspx?FamilyID=ce40e4e1-9838-4c89-a197-a373b2a60df2&displaylang=en

Shuttle service from city to Bangalore airport

There are Volvo Bus (Vayu Vajra) shuttle service from city to Bangalore International Airport (BIAL). You can find the details at http://www.bmtcinfo.com/site/BSBusServicesDetails.jsp?bsserviceid=1. Click on the route link you think relevant to you, details of the route is mentioned. On the rightside there is button (not very intuitive) clicking you can view a google map with stops marked.

You can download a route list at http://www.bmtcinfo.com/uploads/Files/Vayu_Vajra_route_List.pdf.

At the airport bus terminal (which is just in front of the main entrance), there is route map displayed which is very useful, different routs ard marked in different colour.

Vayu Vajra buses are having ample space for keeping the luggage.

On the whole it is very good service, even though it is expensive (about Rs 150 to the city)

Saturday, November 28, 2009

Glassbox

Glassbox is a good monitoring tool for Java web applications. It provides the response time statistics for key methods like servlets, database calls etc. You can extend methods you want to monitor by specifying the aspects (It uses Aspectj aop.xml for this). This is tool built using Aspectj AOP. This tool is particularly good monitoring performance of web applications in production.

Sunday, November 22, 2009

Some keyboard shortcuts for Apple Mac OS X

Here are some keyboard shortcuts for Apple Mac OS X. Very few now. Plan to build as I go (started using MacBook Pro now). May be useful for beginners. I have built this using Google doc and published as html. Is there any way I can publish it such that public can edit it?
Link: http://spreadsheets.google.com/pub?key=t_EbCAybhNOGuNpN3FVFzzQ&single=true&gid=0&output=html

Monday, November 16, 2009

Joined Yahoo!

Joined Yahoo! today. Shall be working on the Yahoo Platforms team. Looking forward to lot of fun!

Wednesday, September 16, 2009

Character encoding in Web Development

If you have static HTML page, use the following tag in <head> section.
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">

If you have a dynamic page (JSP or Servlet), use the following code
response.setCharacterEncoding("UTF-8");

If this method is called, web server will set the Content-Type HTTP header accordingly.
Content-Type: text/html; charset=UTF-8

Assume you have a page which accepts Russian characters.
Then according the standards you need to specify accept-charset="UTF-8" in form tag
<form accept-charset="UTF-8" >

However Internet explorer does not supports accept-charset. Nevertheless it is better to specify this attribute, howeve that is not sufficient.
However most of the browsers use the same encoding used for rendering the page (specified by Content-Type HTTP header), for encoding the forms submitted from the page. Hence specify the encoding for the page which contains the form (as mentioned above). This will force the browser to use the same encoding for form submission.
Browsers are supposed to send the Content-Type HTTP header along with HTTP reqeust for the form submission. however most of the browsers including IE and Firefox don't do so. Hence server side there is no way to acertain the encoding used by client.
Best work around is to use Content-Type (as mentined above) for the web pages containing forms and hence force the browser to use specific encoding scheme. Then specify the encoding at server while processing the reqeust by specifying
if(request.getCharacterEncoding() == null) request.setCharacterEncoding("UTF-8");

However there is another catch. If you want to submit a form with some other encoding scheme (for whateve reason - typically this can happen when you want to submit form to another website). Then it will be difficult from IE.
On the whole the best practice is to use always
response.setCharacterEncoding("UTF-8"); -- in JSP/Servlet
if(request.getCharacterEncoding() == null) request.setCharacterEncoding("UTF-8"); -- in JSP/Servlet
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"> -- in static pages
<form accept-charset="UTF-8" > -- all forms

Allways use "UTF-8" as the encoding which is much better scheme than all other available schemes.

Wednesday, September 09, 2009

String literals and Garbage Collection in Java

String literals are loaded during class loading. String literal objects are created in heap and a reference to each String literal object is stored in String literal pool. String literals are never garbage collected.
Can this cause OutOfMemory? Not really! The amount of memory required to load String laterals is not more than the size of the class it loaded from. You cannot dynamically create String literals. Unlike other memory leak issues where objects can be created dynamically.

Here is a interesting article on String literals http://www.javaranch.com/journal/200409/ScjpTipLine-StringsLiterally.html