Tuesday, December 31, 2013

Databases Comparison


DB Ranking 2013


Relational DBMS

Relational DBMS

Microsoft SQL Server
Relational DBMS

Relational DBMS

Relational DBMS

Document store

Microsoft Access
Relational DBMS

Relational DBMS

Relational DBMS

Wide column store

Relational DBMS

Search engine

Key-value store

Relational DBMS

Key-value store

Wide column store

Relational DBMS

Relational DBMS

Document store

Relational DBMS

Java Based Content Management Systems

CMS, or content management systems, are platforms for managing and administering website content. There is no denying that CMSes are important in today's web ecosystem. These content management systems not only provide an easy way to build and maintain websites, but they also lend a helping hand in updating and editing website content without the need to spend hours or days writing and altering codes and scripts.
Some of the leading CMSes are PHP-based, Ruby on Rails-based, ASP.NET-based, and Java-based. Among these, due to scalability, modernized architecture and open-source standards of a few, Java-based CMSs are getting quite a lot of attention lately, especially for enterprise websites, because of the scalable, modern, open source technology behind most of them.   
There are plenty of CMS tools based on Java to help developers create multi-lingual and multi-channel websites. But how do we decide on the best one for our use case?
we’re going to explore the top 21 content management systems based on Java. 

Alfresco is one of the top open-source content management systems of Java. It comes with enterprise repository and portlet capabilities along with document management, collaboration, records management, knowledge management, web content management, imaging, and a lot more.
Alfresco has a modular architecture and enables end users to efficiently manage websites across the cloud, mobile, hybrid and on-premise environments using open source Java technologies, such as Spring, Hibernate, Lucene and JSF.

Magnolia is a well-documented, easy to use, enterprise-grade open source CMS based on the Java Content Repository Standard. It is a highly popular CMS due to its out-of-the-box functionality and ease of use under an open source license. Moreover, Magnolia supports unique content delivery capabilities in a search-engine optimized manner and also follows W3C standards.
Magnolia CMS has been deployed by enterprises and governments in more than 100 countries across the world. Here's a case study on Magnolia-based website development 

Asbru is another powerful, fully-featured, easy to use content management system with database-driven capabilities. It is built on the Spring framework with integrated community, databases, eCommerce and statistics modules, which helps developers to create, publish and manage rich and user-friendly internet, extranet and intranet websites on the go.
Available in various editions, Asbru provides users with a simple, user-friendly platform to manage websites along with a host of other benefits and features such as custom templates and data, password protected content, multi-lingual content, communities, eCommerce and website analytics, a cutting-edge WYSIWYG content editor and a lot more.
OpenCMS is based on Java and XML technology that allows you to build highly customizable and interactive websites and portals. It comes integrated with a WYSIWYG editor and fully-featured Template Engine which is fully compliant with W3C standards.
OpenCMS can be deployed both in an open-source environment (Linux, Apache, Tomcat, MySQL) as well as a commercial environment (Windows NT, IIS, BEA Weblogic, Oracle)

Walrus is yet another Spring-based CMS that provides unique and effective content management capabilities with a smart administrative interface and drag-and-drop facilities. Easy-to-setup and undo/redo features make Walrus a highly preferred and suitable CMS for government and non-profit enterprises.
Pulse : 

Pulse is a Java-based framework and portal solution that offers easy-to-use and extensible patterns for creating rich browser web applications and responsive websites. It brings a bunch of innovative and powerful components including content management, web shops, user management and more.
A few of its key features include a WebDAV based virtual file system for digital asset management, mature user and role management, built-in internationalization, and more.

MeshCMS is an easy to use online editing system written in Java. It comes with a host of features that you will find in any ideal content management system however, it uses a conventional approach in managing and editing website content.
It is considered one of the fastest CMSes for editing files online, managing files, and building some very common components like menus, breadcrumbs, mail forms and so on.
MeshCMS is accompanied by cross-browser capabilities, a WYSIWYG editor, hot-linking prevention, and tag-library that makes content management an interesting affair.

Liferay is one of the most popular CMSes based on Java, and is recommended by many industry experts. It comes with awesome features that can make your content management tasks simple. Liferay is a very popular for developing personal as well as professional websites with ease.
DotCMS is a next-gen enterprise CMS that wears an open-source hat. It is highly popular and widely used CMS due to its open APIs, extensible and scalable architecture that it used to create personalized and engaging websites, intranets, extranets and applications with ease.
Jease highly known as ‘Java with ease’ is another open source content management system that is built on popular Java technologies like db40, Perst, Lucence and ZK. It is an extremely lightweight CMS with excellent Ajax interface. Due to its intuitive and interactive interface, it is highly simple and easy to customize and deploy websites in Jease even for inexperienced Java developers.

Hippo is again a powerful open-source CMS made in Java that features enterprise level capabilities that helps in delivering personalized websites and channels. Hippo outlines its competitor by delivering outstanding customer experience through innovative solutions. Hippo has come a long way since 1999 serving medium to large organizations by offering a personalized multichannel content distribution platform including website, mobile, tablet, extranets and intranets.
Its major version update was in December 2012 and since then it is seeing minor updates every couple of months.

Apache Lenya is another open-source Java CMS that features revision control , multisite management, scheduling, search, WYSIWYG editors, and workflow which makes website development and management quite interesting and easy for developers. Available in a variety of languages, Apache Lenya is highly preferred CMS among enterprises that desire to develop multi-lingual websites.

Conteligent is another smart CMS solution offered under Java technology stack. It is fully compliant with J2EE and offers great solution for creating and managing personalized websites.

InfoGlue again is a Java-based CMS that is known for its advanced, scalable and robust open-source architecture. It is a highly flexible CMS built on JSR-168 and comes with full multi-language support, excellent information reuse and high integration capabilities.

OpenEdit CMS is a dynamic tool for managing website content with online editing capabilities. Built in open-source architecture, OpenEdit provides facilities like user manager, file manager, version control and notification tools for managing media-rich websites.
OpenCMS features enterprise grade plugins such as eCommerce, Content Management, Blog, Events Calendar, Social Networking Tools and more.

Atleap is a multi-lingual CMS based on Java which offers amazing content delivery assistance with SEO and full text search functionalities. AtLeap, a product of Blandware, is not only a CMS but a highly robust framework for developing website and web applications

Weceem is yet another open source content management system, unlikely other CMS it is built upon well-known Java framework grails, spring and Java itself. Weceem has garner positive reviews and is an ideal CMS when it comes to grails, but faces tough competition in best Java CMS category.
I came across a LinkedIn discussion which was enough for me to put this CMS in the Best Java CMS list.
Nuxeno is a powerful open source CMS built on Java-based architecture. It offers solutions related to document management, case management and digital asset management. It is free from licensing free but do costs you when reach out for support and maintenance help.
It has strong groups of customers including Electronic Arts, U.S. Navy and as stated on the company website, it’s been used in over 145 countries across thousands of organizations.
Xperien central is currently the only CMS that offers unique content to a visitor as per his earlier journey, so you can tailor the content to increase the conversion. It offers multi-channel content delivery across website, mobile social media channels and applications. It is built on Java and hence it is extremely scalable and agile.

Atex is a web CMS that uses polopoly technology to deliver content. As per claims, it is the only industry leading CMS with built in paywall. Atex again is one of the premium CMS that offers amazing solutions for managing websites and helps marketers deliver the right content to relevant audiences. It has rich set of clientele.
Customers of escenic include News of the World, The Sun, The Times, the Independent titles. It’s a closed source Java  framework.
Both Atex and Escenic are found to be highly popular in Sweden. Some of the biggest sites in Sweden use both these CMS. idg.se uses Atex and Aftonbladet.se uses Escenic 
This completes the list 21 top Java-based content management system. Hope after reading about all the CMS, you have got enough inferences and insight as to which CMS would be best for your website development project.

Friday, December 27, 2013

Commonly Questions About Multi Threading

1. What is synchronisation in respect to multi-threading in Java?

This is the power to control access to multiple threads to shared resources. Without proper synchronisation, one Java thread may modify a shared variable while another thread may still be using it. This would in turn lead to errors and glitches in a program.

2. Explain different ways of using threads?

Java threads can be implemented using runnable interfaces or by extending the thread class itself. Of the two methods, the runnable interface is considered to be more advantageous, when the programmer is going with multiple inheritance. 

3. Difference between Thread.start() & Thread.run() method?

The thread.start() method is a native method that runs the thread.run() method. Calling the thread.run() method will execute it in the same thread, which defeats the purpose of creating a new thread. 

4. Why do we need run() & start() method both? Can it be achieved by only the run method?

The run() and start() methods are both needed for the Java Virtual Machine (JVM) to create a separate thread that can not be differentiated from normal method calls. This is the task performed by the start() method, which has to be called explicitly. The other advantage of having these two methods is that the programmer can run any object as a thread if it is implementing a runnable interface. This solves the multiple inheritance problems that you may face with Java.

5. What is ThreadLocal class? How can it be used?

The following points about ThreadLocal variables should help:

- This variable gives a separate copy of its value to each thread that is using it.
- These variable are usually static fields in the classes that want to work with the thread.
- When multiple threads access the instance, each gets its own copy of the variable.
- The ThreadLocal variable is often used in the DAO pattern. In this, the DAO class can be kept as a singleton, but the database connection can be maintained for each thread separately. This is called Per Thread Singleton.

6. When InvalidMonitorStateException is thrown? Why?

The InvalidMonitorStateException is thrown when the user tries to call the wait(), notify() or notifyAll() methods for an Object. The Object needs to call the method(s) from a place in the program where you do not have a lock on the object. This means that you do not have a synchronised block or method of the object but are still trying to call the notify(), wait() or notifyAll() methods. They all throw the same IllegalMonitorStateException exception. The exception is a subclass of the RuntimeException.

7. What is the difference between sleep(), suspend() and wait()?

The sleep() method takes the currently running thread to the Not Runnable state for a specified amount of time. A sleeping thread can not be entered by another thread and if a thread is running a synchronised block or method when it is put to sleep, then no other thread will be able to call this block or method either. A sleeping thread can be woken up by a thread calling t.interrupt on it. Sleep() will always affect the current thread since it is a static method.

Suspend() on the other hand is a deprecated method. It sends a thread into suspended state, which means that it keeps all its monitors and can not be interrupted. It has been deprecated since it may cause deadlocks.

The wait() method also puts the current thread into the Not Runnable mode but it is invoked on a locked object and not a thread.

Here is the sequence of operations you can think

- A thread X is running a synchronised block with a lock on object A
- Another thread Y comes to execute the synchronized block and finds that it’s already acquired.
- Now Y calls A.wait() method for waiting on the lock to be released the X thread.
- X thread finishes all its synchronised block work.
- X thread calls A.notifyAll() to notify all waiting threads that its done using the lock.
- Since Y thread is first in the queue of waiting it acquires the lock and starts processing.

8. What happens when a static method is made synchronised?

When a thread enters a synchronised static method, the class itself will get locked by the thread monitor. This is because synchronised static methods have a lock on the class they are in. So, no other thread can enter the synchronised static methods in that class anymore. 

9. Can a thread call a non-synchronized instance method of an Object when a synchronised method is being executed?

Yes, non synchronised instance methods can be called always and no lock object check is performed for such methods. In fact, the method is called even when it is not declared if you are working with shared data.

That is why it is important to be careful while working with this. You declare a method as synchronised based on the critical section access. If a method does not access a critical section, then it doesn’t need to be a synchronised method.

10. What is a deadlock?

If two or more threads have been blocked forever, they are said to be in a deadlock and waiting for each other. This usually happens when the two threads, each of which has a lock on one resource, tries to get a lock on the others’ resource. 

The most common causes are:

- When two threads call Thread.join() on each other.
- When two threads use nested synchronised blocks to lock two objects and the blocks lock the same objects in different order.

Most Wanted Tech 2014

1. Application development and Programmer: According to the survey, 49 per cent of the respondents want to hire programmers and application developers in 2014. This skill was also the most coveted last year.

2. Technical support or Help Desk: Last year’s number three, takes the second position for 2014. 37 per cent of the respondents told ComputerWorld that they will be hiring people skilled in this department in 2014.

3. Networking: This has come up five steps since yesterday. 31 per cent of ComputerWorld’s respondents said that they would be hiring in this department, making this the third most coveted hiring option for 2014.

4. Mobile applications and device management: Another skill that came up by five spots. Mobile apps and device management skills would apparently receive hiring calls from 27 per cent of ComputerWorld’s respondents.

5. Project Management: 25 per cent of the companies want to hire personnel skilled in the project management department. The skill though has dropped three places and was placed at number two in 2013.

6. Database Administration: Database administration wasn’t even ranked last year, but this year it is the sixth most favoured job option. 24 per cent of the companies are looking for employees in this department.

7. Security Compliance/Governance: While security experts are on a roll in 2013, it seems that the skill won’t be quite as coveted in 2014. Still, it makes the seventh spot on the list with 21 per cent votes. Perhaps because the best have all been hired in 2013.

8. Business Intelligence/Analytics: This is the last one on ComputerWorld’s top eight list. 18 per cent of the companies said that they would hire personnel in this department. 

Failed to load the jni shared library jvm.dll while starting Eclipse


Failed to load JNI shared library jvm.dll while starting eclipse on Windows 7 64 bit and eclipse 64 bit.


Incompatible java with eclipse. Both should be 64 bit.


If eclipse is 64 bit , update Java in Path to C:\Program Files\Java\jre7 

or else 

check the Java location being referred by eclipse and copy the content C:\Program Files\Java\jre7 to eclipse jre location.

This error can occur for 2 reasons:

1) Your Eclipse and jdk both must be either 32 bit OR both 64 bit.
You cannot have 32 bit jdk and 64 bit Eclipse OR vice-versa.

2) The -vm argument in your eclipse.ini file is either absent or incorrect.
You will find your eclipse.ini (Configuration File) in your eclipse root folder.

Following are the content your Eclipse File must contain.


 Look at the red coloured (2 lines) in the above content.
make sure -vm must point to correct location of your javaw.exe file..

Java Stories 2013

Release of Java EE 7 Java EE 7 was the result of industry-wide development involving open review, ongoing builds, and extensive collaboration between hundreds of engineers from more than 30 companies. Key features included better support for HTML5, websockets, JAX-RS 2.0, an update to JMS 2.0 andmore.
Java and the Internet of Things From Forbes to Business Insider, everyone was waking up to the Internet of Things (IoT) in 2013. The Java language and platform were ready for this new wave. From from hackathons to demos: robots, sensors, smart homes, medical devices, phones, raspberry Pi's and Java worked together to collect information and respond intelligently.
JavaFX is Open Source In January, first code drop of JavaFX 2.0 source code was made public on OpenJFX. Anybody is welcome to contribute to this project, port it to other platforms or devices, or do anything else that a free software license allows you to do!

Java SE Update Releases
Oracle focused and addressed several security issues with Java SE Updates throughout the year: Java SE 7 Update 11 and Java 7 Update 25Java SE 7 Update 21 introduced new security features, including a Server Java Runtime Environment (Server JRE). Java SE 7 Update 40 included Java Mission Control, set of tools to monitor, manage, profile, and eliminate memory leaks in your Java applications.
Oracle Ends Commercial Support of GlassFish 
Oracle announced it will no longer release future major releases of Oracle GlassFish Server with commercial support. The primary role of GlassFish Server Open Source Edition has been, and continues to be, driving adoption of the latest release of the Java Platform, Enterprise Edition.
The Java Community Keeps On Truckin' 
Developers swarmed San Francisco for JavaOne, and the Java Rock Stars delivered. The Duke's Choice Awards recognized continuing innovation. The JCP Awards celebrated community successes. New Java Champions came on board. Java Magazine covered Performance, theInternet of Things, Community and more.
Java SE 8 Java SE 8 is well underway, and early access builds are availableLambdas are a key feature. Stay tuned for much more about this release in 2014.

Tuesday, December 24, 2013

Character encoding

When files are moved between different operating systems, or stored in a common file system such as AFS, you may sometimes find that characters such as ÅÄÖ are shown incorrectly.
A character encoding determines which binary sequence is used to represent each letter, or other character. Many different ways to encode text have been used throughout the years. CSC's Unix systems have traditionally used “Latin-1” (ISO-8859-1), which contains the letters used in western European languages. Other operating systems have used other encodings, e.g. “Mac Roman” on Mac OS, “CP-1252” on MS Windows, or “CP-437” on MS DOS. All of these are extensions of ASCII (basically, American letters, digits and punctuation), which means that such characters are displayed correctly. But accented letters differ. In particular, the Swedish letters ÅÄÖ are not displayed correctly
These days, most OSs can use some form of UTF-8, but you may need to configure the applications to use it. To do so you choose a locale, which defines formatting many settings specific to a language and region, for example:
  • Number formatting (e.g. using “1 234,5” or “1,234.5”)
  • Date and time formatting
  • String collation (i.e. sort order, so that “ångström” is sorted under A in English but Å in Swedish)
The locale is written as «language»_«variant».«encoding», e.g. “en_US.UTF-8” (American English, UTF-8) or “en_GB.ISO8859-1” (British English, latin-1).

Converting a file

To convert the contents of a file, you can open it in a locale-aware editor, and “save as...”
a different encoding, or use the iconv command-line tool:
iconv -f iso8859-1 -t utf-8 < original.txt > new.txt
When logging in remotely (with SSH), you can normally configure your local settings to be forwarded. Unfortunately, not all SSH servers support this. Currently (as of November 2010), CSC's Solaris SSH server does not permit forwarding of environment variables, which is needed for this to work. The relevant locales (en_US.UTF-8, sv_SE.UTF-8) are available on Solaris, and you can set them manually, but they won't be used by default.

Problem: ÅÄÖ shown as ���

Your application uses latin1 characters, but your terminal (or editor) tries to display them as UTF-8. Configure your application to use UTF-8 (see below), or change your terminal settings to use ISO-8859-1.

Problem: ÅÄÖ shown as åäö

Your application uses UTF-8, but they are displayed as latin1. Configure your application to use ISO-8859-1 (see below), or change your terminal settings to use UTF-8.

Problem: ÅÄÖ shown as ���

Your application is printing U+FFFD, the Unicode replacement character (�, usually displayed as a question mark on inverted background). This is then converted as if it were in latin1 to UTF-8 (a U+FFFD character in UTF-8 uses three bytes). Check the settings for all applications — including the terminal window — to ensure that they all agree on which encoding to use.

Select locale (application settings)

If your application is locale aware (most are, but not some legacy CSC applications), then you can select the locale by
export LC_ALL=en_US.UTF-8 ## bash
setenv LC_ALL en_US.UTF-8 ## tcsh
and then run your application. To only configure the character encoding, change the LC_CTYPE environment variable instead.
You can also select which locale to use when you log in locally, but this may cause trouble when you use a different operating system. We recommend that you use the default settings and re-configure the applications instead.

We know different encoding styles like UTF-8, ISO-8859-1. 

Java Charset problem on linux

In short, don't use -Dfile.encoding=...
    String x = "½";
Since U+00bd (½) will be represented by different values in different encodings:
windows-1252     BD
UTF-8            C2 BD
ISO-8859-1       BD
...you need to tell your compiler what encoding your source file is encoded as:
javac -encoding ISO-8859-1 Foo.java
Now we get to this one:
As a PrintStream, this will encode data to the system encoding prior to emitting the byte data. Like this:
That may or may not work as you expect on some platforms - the byte encoding must match the encoding the console is expecting for the characters to show up correctly.

FileInputStream fis = new FileInputStream(new File(fileName));
UnicodeReader ur = new UnicodeReader(fis, "UTF-8");
BufferedReader in = new BufferedReader(ur);