Querying it JQuery way: getElementsByClass

I have got a JSP page which after being rendered needs to call an onload event to look for all divs (believe me there are many of them) having some style class assigned to them and hide them from view. This is one of those kitchen sink problem that came back to haunt me making me realize that JS DOM API doesn’t give me anything to fetch elements containing a class as one of its style attributes.

I came across one of the implementation which goes like this: (more…)

3 comments July 7, 2008

Concurrency and HashMap

Author: Pavitar Singh

In theory everyone knows Hash Map is not Thread Safe and it shouldn’t be used in multi Threaded applications. But still people come out with their own theories that they can use HashMap in their context. Some say they are just reading the data and map is not written to a lot. Unfortunately none of these explanations holds good when one lands up in a synchronization issue. Normally most of the guys do not understand fundamentals around Java Memory Model and Concurrency .One cannot blame them for not knowing their fundamentals as its hard for people to visualize concurrent executions since from college days we are used to sequential executions of program. (more…)

3 comments June 29, 2008

J2EE Applications and Clusters

Author: Fazal Gupta

Issues in porting existing Applications on Clustered Environments

The ideas mentioned below are based on the practical experience of porting an existing application over a clustered environment. The work around and the solutions mentioned below should not be taken as “best practice guidelines” but possible quick fixes which may be needed to make sure that the application can run in a stable fashion without causing serious issues though with some trade off on scalability.

Environmental Setup of Cluster

The typical cluster being discussed here is not application severs cluster where the App servers are started in a clustered mode. Here multiple instances of App servers were started on different machines connecting to the same DB and a load balancer was placed in front of them for receiving requests and forwarding it to one of the App Server instances. (more…)

1 comment June 19, 2008

Java Volatile is Powerful

Author : Pavitar Singh

Java supports two intrinsic concurrency mechanisms “synchronized” and “volatile”. We tend to use synchronized or its newer avatar “locks” from java.util.concurrent most of the times without even checking if volatile or some other option could have been a fit. A careful analysis from concurrency perspective could yield a much smarter and performant solution in many of these scenarios. This analysis would need a good understanding of the properties of each of this mechanism, some of the guarantees that they hold and how it impacts a typical program.

This article takes a look from a Java perspective at some of these semantics and guarantees and does a comparison between synchronized and volatile on some of these parameters. I am also going to go over usages of volatile to build highly performant concurrent programs. (more…)

4 comments May 25, 2008

String Concatenation and Optimizations

Author: Apurba and Pavitar

A smarter brain than mine at work, pointed out this interesting article to me.
Java String Performance testing
It talks about string performance testing. I could make sense of most of the observations made in this test and thought of sharing it.

In short the test compares string operations like “+”, “new String” and then “+”, “+” with fields and then StringBuffer append. One of the conclusions of the test is

the ‘+’ operator is not evil when used with Strings

I agree with this statement and a look at the generate byte code pretty much convinces us of so. But, a word of caution here, it always makes sense to check this on our target compiler before committing to it. (more…)

Add comment May 5, 2008

Hibernate query cache

Author: Apurba

In this blog, I take a look at the query cache, well it is more than a cursory glance, would try to dive in some detail. The blog would explain some of the details of it (enough introduction, lets get to the meat).

As most of us already know, hibernate supports plugging in external cache providers for addressing certain aspects of performance. There are some very good articles on hibernate caching, some of which are
Understanding the second level and query cache
Chapter 19: Improving performance

Lets start with what we are trying to achieve by query cache. The intention is to cache the results against the query (the sql along with the parameters and their values). The effectiveness of the cache is determined to a large extent by its invalidation logic. The isolation level semantics that we want the cache to follow also impacts this logic. In this blog I will go over some of the these details and how it impacts some of the performance choices I need to make. Rather than detail the implementation logic, will run over some common scenarios explaining the implementation detail along the way. (more…)

Add comment May 5, 2008

Internationalization - Registering Custom Fonts for Apache FOP

Author: Fazal Gupta

This is a small article which explains the steps to register custom fonts with Apache FOP engine. Registering custom fonts with Apache FOP becomes important in the context of Internationalization, especially if one wants to display CJK languages in the PDF being generated. The context of this article is when fop is being used in other application for generating PDF for some XML data.

Step 1:
Install the required fonts to your OS. E.g. for Windows the fonts should be installed using the Control Panel or by copying the fonts to Windows Directory\Fonts.
If one is looking for Chinese/Korean Language, MS GOTHIC is a good font carrying a wide range of symbols.
The font can be in a standalone ttf (TrueType Font) file or a ttc (TrueType Collection) (more…)

Add comment April 28, 2008

ExtJS DataGrid

Author : Abhishek Khurana

In its second innings, World Wide Web has introduced a newer approach to interact, organize & categorize information. With new Web 2.0 sites cropping up all over the place, the value of tools (& libraries) coming up to facilitate creativity and giving browser a bigger role to play in business interaction are talk of the town for the developers all around the world.

Apart from Ext JS library (http://extjs.com/), JackBuilder (JackBe), Flex (Adobe), GWT (Google), GI (Tibco) are other few Ajaxified GUI development tools that come to my mind, serving the similar cause. This article is first up in the series of Web 2.0 technologies that we will continue, and star of the show today is ext js. (more…)

2 comments April 14, 2008

Persistence and Locking

Author : Apurba Nath

Persistence in enterprise solutions is not only about CRUD operations, but handling concurrency. Concurrency is handled mostly by locks at the database levels. These locks are configured at the dataobject level and cannot be easily controlled from the flow. The only way of controlling it based on the flow is a programmatic approach to it (via JPA locking api or equivalents). Most of the concurrency issues are discovered only in the later stages of development or at times only after the application goes live, a code change at these points is very difficult. (more…)

3 comments April 7, 2008

Internationalization with Java

Author : Fazal Gupta

Overview and Scope

The main idea of the presentation is not to discuss how Internationalization is done in Java but to highlight some of the problems which one comes across while developing an internationalized application in Java. Most of the observations listed below are based on the personal experience while trying to internationalize a Java based Web Application. Attendees are expected to have basic idea about the features provided by Java to support Internalization. A good resource for the basic reading is OReilly - Java Internationalization.

(more…)

3 comments April 7, 2008

Previous Posts


Categories

Blog Stats

Top Posts

Authors

Feeds