Posts

Showing posts from May, 2014

JVM: Java Heap & Stack

When does Heap gets created?  Heap gets create on the startup of JVM.  What is Heap structure (young space/nursery and old space)  When an object created it is first stored and placed on young space or nursery and if it lives there for longer time it is moved to old space. The design goal behind young space and old space is that newly created objects are short lived and since they are placed on young space their access is faster.  How memory is allocated to Objects?  While assigning memory on Heap, Objects are first identified whether they are small or large? Small objects are allocated in Thread Local Areas (TLA). TLA are free chunk of space reserved from Heap and is given to thread for exclusive use. Thread can then allocate objects in its TLA without synchronizing with other threads. When the TLA becomes full, the thread simply requests a new TLA. The TLAs are reserved from the nursery if such exists; otherwise they are reserved anywher...

Scala: Another way of handling exceptions using Scala Try

A nicer way to handle a scenario where you are expecting an operation to return a value or an exception and based on result you want to perform some action. Let’s consider a very simple example/function below: def divide(x:Integer, y:Integer) = x/y     All we are doing here accepting 2 numbers as parameter to divide function and dividing them to return a result. When the parameter value of “y” is “0” we’ll get an error (divide by zero) and we want to handle that error. There are various ways in which this can be done: 1)    Using try catch block Or, 2)    Using Try class In this example we’ll use second method. Before look at the example, “Try” class in Scala provides a function where you can wrap a result in “Try” and it provides two methods to explicitly check whether the operation was success and “Try” has valid result or not. Let’s have a look at the example: val tryWrapper = Try(divide(1, 2)); tryWrapper.isSuccess match...

Create an AEM (CQ) project using Maven

Image
This article is mainly focused on setting up only project structure for CQ/AEM project using maven and guides you through how you can do your day to day development of AEM/CQ project with eclipse. In next article we’ll see how to develop templates, components and other things in details. Before you go through this article it highly recommended that you have fair knowledge of Maven and at least folder structure of an AEM/CQ project. If you are in hurry, I’ll try to provide a very high level explanation of these two things but, I’ll recommend you to explore that in detail. 1) Typical AEM/CQ project: any web application is mainly composed of view (HTML, JSP etc.), CSS, JavaScript and some server side code. An AEM application is nothing different than this. A typical AEM application will have following folder structure: /apps (Top level folder that is parent for all the code that you’ll develop) /apps/[YOUR_APP_NAME]/components/[CQ templates and components] (contains mostly JSP or...

CQ/AEM Dialog v/s Design Dialog

A component is CQ is a smallest unit that can dropped on a page and content author can fill in any content in it. Content can be of two types: Page specific (in this case component dialog is used) Design/Global (in this case design_dialog is used) The way a dialog or design_dialog is defined is exactly same, there are only two differences: The obvious difference is in their name i.e. “dialog” and “design_dialog” The way properties (stored content/values) are access: Retrieve values from dialog (widget) to jsp: String var= properties.get(" ",""); Retrieve values from design_dialog to jsp: String var= currentStyle.get(" ",""); Content/values stored via get stored at page level under component’s node. On the other hand, content/value stored via a design dialog is store at design path of your teamplate (see cq:designPath property of root node of your application/page), usually this location is under /etc/design/

Adobe CQ/AEM Useful Links

/crx/explorer/index.jsp  - CRX Explorer /crx/de/index.jsp – CRXDE Lit /damadmin     - DAMAdmin /libs/cq/search/content/querydebug.html – Query debug tool /libs/granite/security/content/admin.html – New user manager standalone ui  [5.6 only?] /libs/cq/contentsync/content/console.html – Content sync console /system/console/bundles – Felix web admin console /system/console/jmx/com.adobe.granite.workflow%3Atype%3DMaintenance - Felix web admin console JMX / Workflow maintenance tasks /system/console/jmx/com.adobe.granite%3Atype%3DRepository - Felix web admin console JMX / Repository maintenance tasks /system/console/depfinder – This new 5.6 tool will help you figure out what package exports a class and also prints a Maven Dependency for the class. /libs/granite/ui/content/dumplibs.rebuild.html?rebuild=true – Helpful link for debugging caching problems. Wipes the clientlibs and designs and forces it to rebuild it. Thanks to Mark Ellis for ...