March 31, 2015

Yosemite Full Screen problem :(

People hate Yosemite. But I don't know why. I like Yosemite more than Mavericks. But Yosemite has a problem with Maximize button.(Zoom) As you click Zoom or maximize button it will go to full screen mode.

To avoid this press zoom while you are pressing Alt (key).

If you want to maximize Chrome click zoom while you are pressing Alt + Shift

Enjoy yosemite!

March 30, 2015

Titan DB vs Neo4J

This comparison is an outdated comparison. I think Neo4J has improved a lot with the time. But I'm posting this because a person who wants to compare both of these technologies, can get an idea about the aspects they need to focus. If you know something is outdated please feel free to suggest using comments. I'll update the blog post accordingly.

LicenseGPL/AGPL/CommercialApache 2 License
Commercial SupportAvailable
Advanced: Email 5x10 USD 6000/yr
Enterprise: Phone 7x24 USD 24,000/yr
Available (Prices and availability of support not published officially.)
Graph TypeProperty GraphProperty Graph
Storage BackendNative Storage EngineCassandra, Hbase, Berkeley DB
Dependin on the requirement we should select Database Backend (eg : Cassandra for Availabilty and Partitionabilty, Hbase for Consistency and Partitionabilty)
ACID SupportYesACID is supported on BerkeleyDB Storage Backend
Has Transactions in Java API.On Cassandra Eventually consistent
ScalabiltyCan't Scale out like TitanOwns very good scalabilty
can scale like Cassandra if storage backend is cassandra
High AvailabiltyReplication is the only way to have high scalabilityTitan is like API because of that Availability of Storage backend is the availabilty for graph database
Failover is not smoothIf we are using cassandra with Titan No-Single-Point of failure. Extremely Available
Query LanguageCypher and GremlinGremlin
Cypher easy to learn but only suitable for simple queries.Gremlin has good algorithms to retrieve data in optimal way. (+ More generic)
Graph Sharding Not Available, under developmentNot Available, under development
Support for languagesJava/.NET/Python/PHP/NodeJS/Scala/GOJava
Written inJavaJava
ProtocolHTTP/RESTCan expose REST using Rexster
Use casesmore than 10 available0 use cases exposed officially
Number of edges vertices supported2^35 (~34 Billion) Nodes (Vertices)2^59 Vertices
2^35 (~34 Billion) Relationships (edges)2^60 (quintillion) edges
2^36 (~68 Billion) Properties
2^15 (~32 000) Relationship types
LimitationsKey Index must be created prior to key being used
Unable to drop key indices
For bulk graph operations we have to use Faunus otherwise storage backends get OutOfMemoryException
Types cannot be changed once created
Web AdminAvailableNot Available
MapReduce-Yes with Faunus
Lucene Indexing SupportYesYes
BackupsYesYes (+Titan Parellel backup)

This link is also very usefull -

March 06, 2015

Alfresco: How to write a simple Java based Alfresco web script?

If you want to develop new feature for Alfresco best way is WebScript! Let's start with a simple Alfresco web script. First you need to create an Alfresco AMP maven project using archetype. In this example I'll use the latest alfresco version 5.0.

First I generated Alfresco All-in-One AMP. (Please refer my blog post on generating AMP projects.)

If you go through the files structure which is generated, you will find out a sample web script. It is a JavaScript based WebScript. By this example, I'm going to explain how to write a simple Java based Hello World web script. service-context.xml helloworld.get.desc.xml helloworld.get.html.ftl
Create above files in below locations of your maven project.
  • - repo-amp/src/main/java/org/dedunu/alfresco/
  • helloworld.get.desc.xml - repo-amp/src/main/amp/config/alfresco/extension/templates/webscripts/org/dedunu/alfresco/helloworld.get.desc.xml
  • helloworld.get.html.ftl - repo-amp/src/main/amp/config/alfresco/extension/templates/webscripts/org/dedunu/alfresco/helloworld.get.html.ftl
  • service-context.xml - repo-amp/src/main/amp/config/alfresco/module/repo-amp/context/service-context.xml
Use below command to run the maven project.

mvn clean install -Prun 

It may take a while to run the project after that open a browser window. Then visit to below URL


March 05, 2015

Alfresco: .gitignore for Alfresco Maven Projects

If you are an Alfresco developer, you have to develop projects using Alfresco AMP modules. Previously Alfresco has used Ant to build projects. But latest Alfresco SDK is using Apache Maven. AMP maven projects generates whole lot of temporary files. Those files you don't want in your version control system. 

Nowadays almost everyone is using Git. If I say Git is the most popular version control system today, I hope a lot of people would agree on that. In Git you can use .gitignore file to mention what are the files that should not add to the repository. So if you mention the patterns on .gitignore, Git won't commit unwanted files. For that you need a good .gitignore file. Last year I wrote a blog post which has almost all the file patterns which you should emit from Java project.

You can create a file called .gitignore on root folder of your Git repository. Then copy above content and add it to that file. After that commit that file into your Git repository. Now you don't have to worry about unwanted files.

March 04, 2015

Alfresco: Calculate folder size using Java based WebScript

I was assigned to a training task to write a web script for calculating the size of a folder or a file. But you need to go through all the nodes recursively. If you don't calculate it recursively in folders you won't get accurate folder size.

  • Java Development Kit 1.7 or later
  • Text Editor or IDE (Eclipse/Sublime Text/Atom)
  • Apache Maven 3 or later
  • Web Browser (Chrome/Firefox/Safari)

For this project, I generated Alfresco 5 All-in-One maven project. You really don't want Alfresco  Share module in this project. But I included it because you may need to find a NodeRefId. It would be easier with Share.  Source code of this project is available at GitHub.

Create above files in below locations of your maven project. 
  • size.get.desc.xml - repo-amp/src/main/amp/config/alfresco/extension/templates/webscripts/org/dedunu/alfresco/size.get.desc.xml
  • size.get.html.ftl - repo-amp/src/main/amp/config/alfresco/extension/templates/webscripts/org/dedunu/alfresco/size.get.html.ftl
  • - repo-amp/src/main/java/org/dedunu/alfresco/
  • service-context.xml - repo-amp/src/main/amp/config/alfresco/module/repo-amp/context/service-context.xml
How to test the web script?
Take a terminal. Navigate to project folder. And type below command.

mvn clean install -Prun -Dmaven.test.skip

It may take a while to start the Alfresco Repository and Share server. Wait till it finishes completely. 

Then open a web browser and go to http://localhost:8080/share. Then login. Go to Document library.

Find a folder and click on "View Details". Then copy NodeRef from browser as shown below.

Open a new tab and type below URL. (Replace <NodeRef> with the NodeRef you copied from Alfresco Share interface.)

If you have followed instruction properly, you will get a page like below.

If you have any questions regarding this examples, please comment!!! Enjoy Alfresco!