Posts

Showing posts from 2012

Splitting Mongo Driver

Image
In our application we decided to split the mongo db driver to improve performance of a certain module. This is how it was done: "mongo" is the default ID of a mongo driver. So we need to set the ID to a different value for the second declaration. It worked like a charm.

Mongo Db - First Look

Definition Mongo db is a scalable, high-performance, open source, schema-free, document-oriented database. Advantages Here are some of the advantages of MongoDB for building web applications: A document-based data model. The basic unit of storage is analogous to JSON, Python dictionaries, Ruby hashes, etc. This is a rich data structure capable of holding arrays and other documents. This means you can often represent in a single entity a construct what would require several tables to properly represent in a relational db. Deep query-ability. MongoDB supports dynamic queries on documents using a document-based query language that's nearly as powerful as SQL. No schema migrations. Since MongoDB is schema-free, your code defines your schema. Better performance. There are many reasons for this. One is that, since the document model frequently doesn't need joins, MongoDB doesn't support them; another is that MongoDB uses memory-mapped files and a different consistenc...

Cardspace issues

I wasted 2 days over this Cardspace issue . Which require us to " strip whitespace from xml signatures - a need of MicroSoft's CardSpace identity selector ". See the exact steps to enable this patch here . You would also need JCE security policy to be upgraded. Here are the installation instruction:

Maven script to deploy War file

Image
I hate copying the war file manually to the tomcat dir. Such a waste of time. So, decided to get this script handy. Sample maven script for auto deploying into deployment dir:                                

Dependency Injection of REST in Spring

Image
The configurations required in the Application context file is as below:

Group filter in LDAP import

Adding a group filter in LDAP import can be done as mentioned in this article . However I had to do a minor change. I had to use (name = myLDAPGroupName)            instead of (objectClass=Group) for the search filter under Setting->User->Edit LDAP config->Group section.

Struts MVC

Image
Struts is an application framework that allows the construction of dynamic Web applications using the MVC design pattern. The Controller layer is implemented by Servlets.  The view is implemented using JSPs.  The Model layer is typically implemented using JavaBeans or Enterprise JavaBeans. Struts MVC Architecture

jQgrid reload with new data

To reload a jQGrid with fresh data you need to set the data parameter on the grid and invoke reload on it. jQuery("#promotionsGrid").setGridParam({ 'data': newData}).trigger("reloadGrid"); Here newData is a JavaScript array with which I need to re-load the grid. The important thing here is that I had to place this statement just before the grid initialization code even though the reload was expected on change event of a text box. Without that there was simply no effect on my grid!

jQGrid and Date

jQgrid fails to sort or search Date columns correctly if you don't set proper format on the Date field. I finally corrected my problem by setting Date format before converting the object into JSON. SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd"); String formattedDate = formatter.format(date); object.setDate(formattedDate); Properties set in the grid was as below:

Properties to disable User private pages.

After a bit of struggle I found that to disable private pages of users in Liferay these properties can be applied in the portal-ext.properties file: layout.user.private.layouts.enabled=false layout.user.private.layouts.modifiable=false layout.user.private.layouts.auto.create=false layout.user.public.layouts.enabled=false layout.user.public.layouts.modifiable=false layout.user.public.layouts.auto.create=false

Fundamentals of Spring

Image
1. Lifecycle of Spring MVC The client sends a request to web container in the form of http request. This incoming request is intercepted by Front controller (DispatcherServlet) and degates the  control  to appropriate Handler Mappings. With the help of Handler Mappings, the DispatcherServlet dispatches the request to appropriate Controller. The Controller tries to process the request and returns the Model and View object (ModelAndView instance) to the Front Controller. The Front Controller resolves the View by consulting the View Resolver object. The selected view is then rendered back to client 

Flex in Liferay Portlets

Introduction to Adobe Flex Flex is a rich internet application(RIA). RIAs are self-contained applications. In contrast, the "traditional" web applications are HTML-page-based UI. Flex, Flash, rich AJAX applications and Java applets are all self-contained programs that maintain their own states. Elements of Flex programming MXML ActionScript Events Flex Data Access Destination Channels

Introduction to jQgrid

Introduction Why waste time in developing lists /customizing Liferay OOB search container to display data in tabular format. On top of that more often then not we end up coding for sorting of columns, pagination and formatting some data depending on their values. Trirand has come up with a jQuery plugin called jQgrid. jQgrid supports all of such ease. It provides a nice-looking grid with built-in features such as sorting, editing, search, drill-down, tree lists, and more. It is based upon jQuery and integrates well with Liferay.  The grid is dual-licensed under both the GPL and MIT licenses  (just like

Java Programming Fundamentals -2

12. Why java does not support multiple inheritance In Java any class can extend only a single class. However a class can implement several interfaces. So if multiple inheritance needs to be implemented we can use interfaces. 13. What is deep cloning & shallow cloning Shallow Copy Generally clone method of an object, creates a new instance of the same class and copies all the fields to the new instance and returns it. This is nothing but shallow copy. Object class provides a clone method and provides support for the shallow copy. It returns ‘Object’ as type and you need to explicitly cast back to your original object. Since the Object class has the clone method ( protected ) you cannot use it in all your classes. The class which you want to be cloned should implement clone method and overwrite  it. It should provide its own meaning for copy or to the least it should invoke the super.clone(). Also you have to implement Cloneable  marker interface  or else you w...

Java Programming Fundamentals -1

1.  Object - When do we override Hash code method and when equals method? hashCode() method : This method returns a hashcode value as an int for the object. Default implementation for hashcode() should be overridden in order to make searching of data faster. The implementation of hashCode() method for an user-defined object should be calculated based on the properties of the class which we wish to consider. equals() method : This method returns a boolean which specifies whether two objects are equal or not. The default implementation of equals() method given by the Object Class uses the ‘==’ operator to compare two object references, and returns true only if they refer to the same object. But, we can meaningfully re-define this equals() method to have en equality check based on our own criterias. 2.  Composition & Encapsulation Given that the inheritance relationship makes it hard to change the interface of a superclass, it is worth looking at an alternat...

Fundamentals of Liferay Portlets - part 2

1. Difference between JSR-168 & JSR-286 Java Portlet spefication168 (v1.0) has very basic portlet porgramming model and had lot of limitations for portlet development. Java Portlet spefication286 (v2.0) was developed to overcome the shortcomings on v1.0 specs(JSR 168) such as: 1. Inter portlet communicaiton (IPC) - IPC through events and public render parameters 2. Support for WSRP 2.0 3. Public render paremeters - Allows portlets to share parameters with other portlets. 4. Portlet filters and listeners. 5. Resource serving - Provide ability for portlets to server a resource 6. AJAX support 2. Life cycle of portlet init() - Initializes the Portlet processAction() - process input from a user action. render() - Renders the content output. destroy() - Cleans up the portlet 3. How is  Inter portlet communication achieved in Liferay? The Client side events mechanism This is a new mechanism introduced in Liferay v5.0 and provides a very lightwei...

My experience with Model Driven Architecture

OMG came up with Model Driven Architecture(MDA) which unifies and simplifies modeling, design, implementation, and integration of applications including large and complex systems. The core of MDA lies in defining the software fundamentally at the model level, expressed in Unified Modeling Language(UML). An MDA-based development goes through three steps  Producing models  Producing code  and  Typically iterates through these several times. John D. Pool  mentions in a paper published on MDA  that the MDA represents a major evolutionary step in the way the OMG defines interoperability standards. The MDA process places formal system models at the core of the interoperability problem.  What is most significant about this approach is the independence of the system specification from the implementation technology or platform.  The system definition exists independently of any implementation model and has for...

Design Patterns

The best material on design patterns that I have ever come across with very good examples. http://www.javacamp.org/designPattern/

Alfresco in a Jiffy

How is it different from Liferay ? Alfresco is usually used for its exceptional support for Document management and Web content management. Usually document management should be used for intranet application and Web content for Internet applications. Web content management in Alfresco supports versioning and archieving and stores content on the file system unlike Liferay which gives it an edge over other CMS (content management systems). For document management in Alfresco  the documents are stored on the file system and meta data of the documents are stored in the database which is similar to Liferay. However the documents are linked to each other in a fashion which make it every quickly searchable. Also the contents of he document is also searched (thru indexing in Luecen). the contents are stored in a non readable format for both web content and document management on the file system. Fundamentals of Alfresco Scopes There are 3 scopes on a Alfresco ap...

Eclipse Modeling Framework

A very interesting feature provided by Eclipse  http://wiki.eclipse.org/EMF-FAQ#What_is_Model_Driven_Architecture_.28MDA.29.3F I will try to re-collect and blog about how exactly I implemented Model Driven Architecture using EMF sometime soon.

Rich Client based UI technologies- A Comparison of Thick Client UI tools

Rich Client v/s Thin Client Software developers face many difficult decisions when building new applications, not the least of which is graphical user interface. There are various graphical user interface technologies used, but broadly they can be classified as Rich Client User interfaces and the thin client or web based user interfaces. To understand them better let us look at the history of rich and thin clients. While the Rich client GUI applications would support high quality end-user experience with features such a drag-and-drop, perspectives, customization, high speed local processing; it has had a traditional disadvantage of high deployment and upgrade costs. It was becoming highly difficult and costly to deploy and upgrade these applications. Then came the thin clients or the Web based applications. Thin clients solved many of the deployment and upgrade problems, but that was not without a cost, the cost was in terms of functionality and capability. Thin clients, based on...

OSS and BSS Systems

Image
OSS (Operational Support Systems) Software (occasionally hardware) applications that support back-office activities which operate a telco’s network, provision and maintain customer services. OSS is traditionally used by network planners, operations, architects, support, and engineering teams in the service provider. Increasingly product managers and senior staff under the CTO or COO may also use or rely on OSS to some extent. BSS (Business Support Systems) Software applications that support customer-facing activities. Billing, order management, customer relationship management, call centre automation, are all BSS applications. BSS may also encompass the customer-facing veneer of OSS application such as trouble-ticketing and service assurance – these are back-office activities but initiated directly by contact with the customer. OSS/BSS Structure Communication between OSS and BSS Apart from service assurance activities being cross-OSS-BSS processes, there...

Telecommunication Management Network

Image
Definition : The Telecommunications network (TMN) provides a framework for achieving interconnectivity and communication across heterogeneous operating systems and telecommunication networks. TMN was developed by the International Telecommunication Union (ITU) as an infrastructure to support management and deployment of dynamic telecommunications services. TMN Architecture The interface points between the TMN and the telecommunication network are formed by Exchanges and Transmission systems . For the purpose of management, these Exchanges and Transmission systems are connected via a Data Communication Network to one or more Operations Systems . The Operations Systems perform most of the management functions. These functions may be carried out by human operators but also automatically. It is possible that a single management function will be performed by multiple Operations Systems. In this case, the Data Communication Network is used to exchange managemen...