Friday, 17 November 2017

Apache Webserver on Mac

Quick handy command and details for Apache Webserver on Mac. 

Start Apache
sudo apachectl start

Stop Apache
sudo apachectl stop

Restart Apache 
sudo apachectl restart

Configuration Test
sudp apachectl configtest

Apache Installation Location
/usr/libexec/apache2/

Apache Conf Location
/private/etc/apache2/

Default Doc location
/Library/Webserver/Documents/

Error File location
/private/var/log/apache2/

Host File location
/etc/hosts

You can also get some of these details by running following command
httpd -V

Note: Details from Mac OS X El Capitan / Sierra

Friday, 8 September 2017

Experience Fragments Vs Content Fragment

Namastey & Welcome !

It's quite a common questions these days, What is the difference between Experience Fragments and Content Fragments ?

Its Simple !

A Fragment is useful because we can reuse them on multiple pages and
whenever required you can edit them from one single location.

To differentiate between CF and XF it's important to understand who is the target user.
Experience Fragment is mainly for authors
And Content Fragment is mainly for content writers.



Usually content writers ( e.g. news editors, magazine authors ) are more concerned of writing textual content and provide associated images.

They may worry about creating variations of content for different channel like mobile, print,tablet etc or different variation of content like teasers, summary etc.

Once the content is created, Authors may use the content on AEM Page as authors are more responsible for presenting content in appropriate layout

EXPERIENCE FRAGMENT

Lets take an example, You have contact information section on your AEM page which contains a few custom components like address, phone number and email details and a map view of address. This set of component is a meaningful experience in itself.

You can create this set of component as Experience fragment and then you can use this experience fragment on any number of the pages.

Please let me know if you have any other question.

Dhanywad !

Wednesday, 14 June 2017

Javascript Use API Example


  • HTL ( previously known as Sightly ) focuses on separation of concerns. 
  • UI Developers shouldn't worry about back-end logic as they use to be with JSPs,
  • With HTL back-end logic should come from Java or Javascript.
  • As a HTL Developer , you are provided with Use API  you can simply call logic by data-sly-use operator.
  • Syntax: 
    • data-sly-use.objectName =" JAVA class  /Java script name "
  • An object is created and that object can be used for accessing properties returned by Java or javascript.



Sunday, 21 May 2017

AEM Static Template Vs Editable Template

Namastey, 

Templates are basis of AEM page. Author can create a page using a template . These templates define basic structure of the page, what components can be used on the page and design of the page.

With AEM 6.2 , Editable Templates were introduced to reduce dependency of authors on developers.
In AEM 6.3 Editable Templates are quite a mature and powerful feature.

AEM Static Templates 

  • Static templates are created by developers ( It defines page rendering component , availability of template for authors to create the page ) 
  • Stored in /apps directory of CRX
  • Once a page is created using templates, after that if we make any change in static template it wouldn't affect the page.
  • Design mode is available for applying Page design.

AEM Editable Templates

  • Editable Templates can be created by template-authors ( non-developers ).
  • Stored in /conf directory of CRX
  • Pages created using editable templates would affect if any changes on editable templates are done.
  • Page design is controlled by content and page policies.Hence no design mode available.


Dhanywad.



Create AEM Templates - Everything about AEM Templates

Namastey,

Defining Templates

  • A template is the basis of a page.
  • A Template is like a stencil or frame or blueprint which is used to create multiple pages with same page structure. 
  • Template defines which components can be added on the created page.
  • All the pages having same template is going to have same design.

Steps to create a template 

Step 1. Open CRXDE Lite ( http://localhost:4502/crx/de)
Step 2. Go to your project folder or create one   ( E.g  / apps/training )
Step 3. Create a folder to organise all templates ( E.g templates ) 
Step 4. Right click and select "create template "


Label : Name of the node
Title  : Name of the template
ResourceType : Location of page component which will be used to render the page
Ranking : Order of the template which will be visible to Author.





















Step 5 .Click Next and Enter allowedParents : /content(./*)? 
Step 6. Click Next , Next & Finish.

A template node will be created of type cq:Template with some properties that we have added until Step 6.

Restrict usage of template 
You may want to restrict usage of template by author , For Example 

  • A product page should never be created as home page.
  • A homepage should never be created under products page.
  • A page can only be created under path /content/training/en/.


allowedPath : Path of a page that is allowed to be based on this template.
allowedParents : Path of a template that is allowed to be a parent of this template.
allowedChildren : Path of a template that is allowed to be a child of this template.

Some common regex for restrictions.

  • /content : Restrict creation of page only under content node.
  • /content(./*)? :Restrict creation under content node and it's child node
  • /content/training : Restrict creation of page under /content/training node only , Template will not be available at /content node or for child nodes of training.
  • /content/training(./*)? : Restrict creation of page under training node under content and child node.


Adding Thumbnail to Template

Thumbnail of template is defined by thumbnail.png node inside template node.
To show a thumbnail for page/template , either you can create a new thumbnail node for template node and add images of different renditions OR you can easily generate thumbnail for a page and use the node structure for template. 


Step 1. Select the page created by the template
Step 2. Click on view properties in Touch UI
Step 3. Go to Thumbnail tab and upload an image or generate a preview from page content.

Go to CRXDe and go to the page which you have created , You will find node named 'file' containing dam:thumbnails. 














Step 4. Copy file node and paste it at /apps/training/templates/basicartile/jcr:content
Step 5. Rename file node to thumbnail.png so that AEM can recognize this node as thumbnail as shown below.
















Now create page wizard will show you a template with thumbnail and  the pages created with the template as well.

















Dhanywad !


Monday, 28 March 2016

Simply Sightly


Namastey,

  • Sightly means "pleasing to eyes"
  • It is new and powerful HTML templating language used in AEM. 
  • It is expected to be a replacement of JSP and ECMA script, however you will not be able to write complex code using sightly.  
  • The expressiveness of sightly is intentionally limited as you should be using real programming languages like Java to write complex code.Although you can easily pass inputs via sightly to Java code and also easy to use output from Java code in front-end using Sightly.



Code Syntax : 

   1.   Sightly code is written using dollar sign '$' and braces '{}' ,
         e.g ${currentPage.title} where currentPage is a global object and title is a variable.
       
           You can use global objects as listed in [0]


   2.  You can add sightly as an attribute to any HTML element. In this case dollar sign and braces are not required.
        e.g  < div data-sly-include="main.html"/>   where data-sly is used to indicate sightly language and include is action.


Dhanywaad,

[0] https://docs.adobe.com/docs/en/aem/6-0/develop/sightly/global-objects.html

Tuesday, 7 July 2015

Adding newly created component in sidekick / siderail

Namastey, 

Creating a component is not enough if it cannot be used on the pages. In order to display the component on the page we have following two ways :
  1. Directly include the component on page rendering jsp/sightly as shown below
<cq:include path="comp1" resourceType="mySite/components/myComp" />

  2. Enable the component in sidekick and then drag it to the parsys to use it.
        Only those component which has either cq:inplaceEditing node or  cq:dialog node can be enabled to appear in sidekick,because a component is logically not needed if author doesn't input any content to it.

    Now component is available but still we need to enable it to see in sidekick:

  1. 1. Go to design view of page ( available only in classic UI ).
  2. 2. Go to 'Edit' of parsys on which you want to drag -drop your component.
  3. 3. List of available components will show up , you can check your component to show up in sidekick.
  4. 4. Exit the pop-up and you will see the checked component showing up in sidekick.
Dhanywaad !




Sunday, 27 July 2014

Instance does not start caused by Access is denied / Bad file descriptor


Namastey,

Sometimes the instance doesn't start up and you recieve following error :

*INFO* [FelixStartLevel] com.day.crx.persistence.tar.TarSet scanning index E:\adobe-cq.5.5.0\Author\crx-quickstart\.\repository\workspaces\crx.default\data_04935.tar id:4945 length:102764544 append:-1 1898032864

 *ERROR* [FelixStartLevel] org.apache.jackrabbit.core.RepositoryImpl Failed to initialize workspace 'crx.default' javax.jcr.RepositoryException: Cannot instantiate persistence manager com.day.crx.persistence.tar.TarPersistenceManager
at com.day.crx.core.CRXRepositoryImpl$CRXWorkspaceInfo.createPersistenceManager(CRXRepositoryImpl.java:1290)
..
        ...
Caused by: java.io.IOException: Access is denied
at java.io.RandomAccessFile.writeBytes(Native Method)
at java.io.RandomAccessFile.write(Unknown Source
... 59 more

*ERROR* [FelixStartLevel] org.apache.jackrabbit.core.RepositoryImpl Unable to start repository, forcing shutdown...

In Linux machine, you will get
Caused by: java.io.IOException: Bad file descriptor

Theis error stack is due to inconsistencies between index_*.tar and data_*.tar files.

Solution 

0/ Stop the instance.
1/ Go to path as per *INFO* e.g. repository\workspaces\crx.default\data_04935.tar
2/ Change the permission of data_xxx.tar file to read write. 
    a) In windows , just right click on the tar file and uncheck readonly.
    b) In Linux , use chmod command to set file permissions right again
3/ Delete the index_*.tar and locks file present in the folder.
4/ Open the workspace.xml add parameters in searchindex tag as following  to check ,fix consistency and rebuilding of indexes.

<SearchIndex class="com.day.crx.query.lucene.LuceneHandler">
    <param name="path" value="${wsp.home}/index"/>
    <param name="enableConsistencyCheck" value="true"/>
    <param name="forceConsistencyCheck" value="true"/>
    <param name="autoRepair" value="true"/>

</SearchIndex>

5/ Restart the instance and tail the logs.
6/ Once the issue is resolved remove the parameters added in step 4 so that the consistency check doesn't run on every start of instance.

Dhanywaad,

Sunday, 20 July 2014

Overriding jQuery version in cq

Namastey !!

Sometimes you need to override the default version of Jquery present in cq.
Steps to upgrade Jquery Version :
1/ Go to /etc/clientlibs/granite/jquery/source
CQ itself uses jquery , however it uses $CQ instead of $ as in standard jquery.
Overriding ofjquery is not suggested if you are intended to use CQ in portlet mode.


For this you can simply follow below steps to to override the jQuery version in CQ.


2/ Create a folder according to jquery version. e.g. "2.0.1"
3/ Downlaod and copy the source code of jquery to that folder.
4/ Open /etc/clientlibs/granite/jquery/js.txt
5/ In that file, replace the old jquery path to the new one

But overriding jquery version is not known to conflict as such, but still to avoid any issue proper testing must be done in development environment.

Dhanywaad,


Friday, 4 July 2014

Color Coding in CQ blueprint and livecopy relationship.

Namastey , 

Do you really wonder what's the exact message of color button you see in blueprint control center  ?

Color Codes of Blueprint Livecopy relationship.

This information is directly available on CQ instance as well,
You can go to "Blueprint Control Center" and click "Legend".

Dhanywaad, 

Saturday, 21 June 2014

Manage OSGi Console / Felix Console Permissions.

Namastey ,

By default only user 'admin' has got access on  OSGi console / Felix Console.
You would probably need give permission to some more user who can access this console but don't want to share admin password with them.

But this provide access to those users doesn't seems to be possible from /useradmin console of AEM , as it manages rights on repository content specifically and it doesn't have any option of OSGi console.

So , If you are in same scenario , you can follow below steps :
1. Create a group through /useradmin console of AEM, e.g osgi_console_admin
2. Add the user whom you want to provide access to OSGi console.
3. Go to Apache Sling Web Console Security Provider configuration in OSGi console through admin user.
http://host:port/system/console/configMgr/org.apache.sling.extensions.webconsolesecurityprovider.internal.SlingWebConsoleSecurityProvider

4. Add the created group name in the configurations and save .

5. You can also add username directly , but it is not a recommended approach.

Quick Tip : To change password of admin user for felix console , you can simply change the password of admin user present in /useradmin console.



Dhanywaad !!

Basic Sling Model Exporter

/* Open a page which is having component /apps/project/components/page/page /content/project/en/jcr:content.model.json Don't miss...