A Developers Blog: April 2015

This blog has moved to GitHub, and you should be redirected shortly...

Tuesday, April 28, 2015

AEM Interview Questions Part 6

This is part six of my AEM interview questions. You find the other parts here:

Part 1 - Part 2 - Part 3 - Part 4 - Part 5 - 
 Part 7 - Part 8 - PDF

Here are some more AEM interview questions that could come up during a technical interview:


Q: What is the difference between Parsys and Iparsys?


A: Parsys is a compound component that lets authors add components of different types to a page and contains all other paragraph components. Iparsys is a paragraph system that will allow to inherit the parent paragraphs from the parent.

Q: Can you restrict certain users from seeing digital assets?

A: Yes, you can restrict access to certain folders in the DAM by using closed user groups. You can do this from the digital assets menu, right click on the folder that you want to add this property to, and click “properties”. Then you go to the CUG tab and add the required information.

Q: What is segmentation?

A: Segmentation is used when you want to target your content towards your sites visitors in order to offer a more personalized site. This is done by analysing and characterizing a visitor’s activity on the website, their profile, and their activity on other websites.

    Q: What is the persistence manager?

    A: The persistence manager is handles the storage of the node/property tree that makes up the structure of the repository. This includes the name and the position of each node and property in the hierarchy. The default persistence manager is the TarPersistenceManager.

    Q: What is a farm file?

    A: A farm file is a file that is used in the configuration of a dispatcher. These are used when you want to break up the configuration file that is used for the dispatcher. They are then added under the “/farms” section in the “dispatcher.any” file.

    I plan to add more interview questions to this blog, so make sure to check back.

    I hope you enjoyed this post. Please feel free to post any comments below.

    Labels: ,

    Wednesday, April 15, 2015

    AEM Interview Questions Part 5

    This is part five of my AEM interview questions. You find the other parts here:

    Part 1 - Part 2 - Part 3 - Part 4 - 
    Part 6 - Part 7 - Part 8 - PDF

    Here are some more AEM interview questions that could come up during a technical interview:


    QWhat is a replication agent?


    A: A replication agent is used to publish active content from the author environment to the publish environment, to flush content from the dispatcher cache, and return user input from the publish environment to the author environment. The replication agents are central to AEM.

    Q: What is resource mapping?

    A: Resource mapping is used to define redirects, vanity URLs and virtual hosts for AEM. You can use resource mapping to prefix all requests with “/content” so the internal structure of the AEM site is hidden from your visitors. You can also use resource mapping to define a redirect so that all requests to the gateway page of your site are redirected to another site.

    Q: What is resource resolution in Sling?

    A: Resource resolution in Sling is how Sling takes a URL and attempts to resolve it to a script. This is done by extracting information from the URL. Here is an example URL:

    http://myhost/tools/spy.printable.a4.html/a/b?x=12

    It can be broken down as follows:

    Protocol
    Host
    Content path
    Selector(s)
    Extension

    Suffix

    Param(s)
    http://
    myhost
    tools/spy
    .printable.a4.
    html
    /
    a/b
    ?
    x=12

    Sling uses the content path that is extracted from the request to locate the resource in the JCR. When this resource is located, the sling resource type is extracted, and then it is used to located the script to be used for rendering that content.

      Q: What design patterns are used in AEM?

      A: Since AEM is built using OSGI, many of the design patterns for OSGI are valid. Some of these design patterns are Singleton (Service), Adapter Service, Resource Adapter Service, and Whiteboard. 

      Also, since AEM is modular, you should be able to use any design pattern in your application.

      Q: What is reverse replication?

      A: Reverse replication is the process of replicating content from publish environment to the author environment. In order to accomplish this you need a reverse replication agent on your author instance that is configured to get content from the publish environment outbox.

      I plan to add more interview questions to this blog, so make sure to check back.

      I hope you enjoyed this post. Please feel free to post any comments below.

      Labels: ,

      Tuesday, April 14, 2015

      Using GitHub To Share Your Code Tutorial

      The purpose of this tutorial is to show you how to use GitHub to share your code with others.

      For this tutorial we will be using GitHub for Windows. This tutorial does not go into full detail, but does provide all the steps that are needed for learning purposes.

      In order to follow along with this tutorial, you will need to install GitHub for Windows. You can download the program from here: https://windows.github.com/, and you will need to create an account on GitHub here: https://github.com/. Creating an account is free, and only takes a few minutes.

      If you have completed the previous steps, we can get started.

      1. Open GitHub for Windows. Once the program is loaded you will need to input your account information for GitHub. Click on options and fill out the "Name" and "Email Address" sections under configure git. Next you need to click on the "add account" button, and enter your account details.


      2. Make sure you save your changes. Now go to https://github.com/, and sign into your account. Once you do this, click on the "Create New Repository" button in the top right corner.


      3. You will then want to enter a repository name, and enter some optional information, such as a description, a readme file, gitignore file, a liscense, and whether the repository is public or private. An example is posted below:


      In order to make a private repository, you have to pay for a premium account. The .gitignore file is a file that will ignore certain files when you make commit changes to your repository. For this example, we will not be using one. You can find more information on the .gitignore here: http://git-scm.com/docs/gitignore

      4. Click on the "Create Repository" button. Your repository has now been created.

      5. Now, switch back to the GitHub for Windows program. Click on the "+" icon, and choose the "Clone" tab. You will now see a list of your repositories. Click on the repository that you just created, and click the "Clone repository" button.


      6. A window will pop up, and ask you for a location to store your local repository. GitHub will now clone your repository onto your computer. Now you can add files to your repository, update any files that are in your repository, or even remove files from your repository.

      7. Now navigate to where you told GitHub to store this repository on your computer. The default location is: C:\Users\yourUserName\Documents\GitHub. Once you find your repository folder, double click it, and choose to open the "README" file that is located there. This can be edited with Notepad, or a similar program.

      If you did not choose to create a "Readme" file when you created your repository, that is okay. You can just add a file to to this folder and skip the next step.

      8. Inside the "README" file, just edit the text inside the file, or add more text to the file. Save the file and close it.

      9. Now switch back to the GitHub for Windows program and you should see a button that says "Uncommitted changes". It may take a moment for the program to update.



      10. Click on the "Show" button, and a pop up will show a spot for a Summary and a Description. You will want to put in meaningful information here since these comments are kept with your repository, and can be reviewed in order to see what changes have been done to your repository.


      11. Click on the "Commit to master" button. Once you do this, you need to click the "sync" button at the top right to update your repository.

      12. Now, go back to the GitHub website, and go to the repository that you created. You should now see that it has been updated with the changes that you have made. Now you can share your files with anyone by giving them a link to that repository.

      Summary: This tutorial showed you how to create a repository on GitHub, and how to commit changes to that repository using the GitHub for Windows program. While this was a simple example, you can do many powerful things with GitHub. For example, you can create branches so you have a master branch and a working branch, you can update your local version of the repository by syncing it with the master repository, and you can add contributors so your team members can make changes to the

      I hope you enjoyed this tutorial. If you have any questions or comments, please feel free to post them below.

      Labels: ,

      Friday, April 10, 2015

      AEM Tutorial On Building A Sightly Page Component

      The purpose of this tutorial is to show you how to build an AEM page component using sightly. You can read more about sightly here: Sightly

      For this tutorial we will be using crxde lite. This tutorial does not go into full detail, but does provide all the code that was used in the creation of this component for learning purposes.

      For this tutorial I was using: AEM 6.0. You should be able to follow along with other versions of this software.

      In order to follow along with this tutorial, you will need to have a basic project structure already set up, or you can follow along with this tutorial here:

      Basic Project Setup Tutorial

      If you have not completed the tutorial listed above, you can download a package from GitHub that has the completed project from here: AEM-Getting-Started. Just follow the instructions in the "readme" file to install the package into your instance of AEM.

      If you have completed the previous steps, we can get started.

      1. Once your instance of AEM is up and running, navigate to crxde lite. Navigate to the "myProject" folder, click on the "components" folder, and then click on the "page" folder.

      2. Right click on this folder and choose "Create Component". Enter the following information:


      Keep clicking the "Next" button until you can click the "OK" button.

      3. Right click on the component you just created, and choose "Create File". Name the file: simplePageSightly.html.

      4. Right click on the "simplePageSightly.jsp" file, and choose delete.

      5. Now, open the "simplePageSightly.html" file, and add the following code to it:

      6. Next we need to create a template for the page component. Right click on the "templates" folder, and choose "Create Template". An example is posted below:


      Click the "Next" button. In the "Allowed Paths" section add the following: /content(/.*)?
      Keep clicking the "Next" button until you can click the "OK" button.

      7. Next go to the websites console and choose the option to create a page. Make sure to choose the "Simple Page Template - Sightly" from the template options.

      8. Now open up the page you just created, and you should see your simple page component that you just created with sightly.

      Summary: This tutorial showed you how to create a simple page component by using sightly. You can build upon this page by adding content to it, or by making a full site.

      I hope you enjoyed this tutorial. If you have any questions or comments, please feel free to post them below.

      You can download a package of the component on GitHub from here: Sightly Page Component

      Labels: , ,

      Thursday, April 9, 2015

      April Ask the Community Experts Session: Touch UI Components

      Adobe will be holding another "Ask the Community Experts Session" this month on April 21st at 11 A.M. - 12:00 P.M. EST. This session will be focusing on workflows in AEM. The session will be giving an in depth look at building touch UI components, touch UI dialogs, and using the Touch UI based APIs meant for component development.

      If you have not attended one of these AEM sessions, they are a great chance to listen to some of the best experts in the industry, a great place to ask questions, and a good way to start networking. I look forward to seeing you all there.

      Here is a link to sign up if you are interested: Ask the Community Experts

      This session will be hosted by Scott Macdonad and Sreekanth Choudry Nalabotu. You can find Scott Macdonad's blog here: http://scottsdigitalcommunity.blogspot.com/

      Labels: ,

      Wednesday, April 8, 2015

      AEM Interview Questions Part 4

      This is part four of my AEM interview questions. You find the other parts here:

      Part 1 - Part 2 - Part 3 - 
      Part 5 - Part 6 - Part 7 - Part 8 - PDF

      Here are some more AEM interview questions that could come up during a technical interview:


      QHow does sightly differ from other templating systems?


      A: Sightly differs from other templating systems in three ways. Sightly is secure by default, it offers separation of concerns, and sightly is HTML5 because it is a valid HTML5 file. Sightly is secure by default because it automatically filters and escapes all variables being output to the presentation layer to prevent cross-site-scripting vulnerabilities.

      Sightly offers seperation of concern because it is purposely limited to ensure that a real programming language is used to express the corresponding logic. This is done through the Use-API pattern.


      Q: Can you create a page without a template?

      A: Pages are usually created by selecting a template for the page when you create them in the Website console. However, a page can be created manually in the crxde by using the same properties that are created when you make a page in the Website console.


      For example, in crxde under the content folder, create a node with the following type “cq:Page” and save it. Then add a child node with the following type “cq:PageContent”. Then you can add the required properties to show any components you want displayed on the page.

      It is generally not good practice to create pages manually.

      Q: What are xtypes and how are they useful in AEM?

      A: In the ExtJS language an xtype is a symbolic name given to a class. In AEM these xtypes are widgets that used in the creation of components. AEM comes with a bunch of widgets that are available out of the box. You can also create and define your own xtype to be used in AEM.

      An example of an xytpe is when you are creating your dialog for your component, and you want the author to be able to enter text, you would add a “cq:Widget” that has an xtype property of “textfield”.

        Q: How do you add properties to the Page Properties dialog?

        A: You can add properties to your page properties dialog by copying the dialog located under “libs/foundation/components/page/dialog” and adding it to your page template. This will allow you to add new tabs and add new properties that you would like the author to chooses from for pages that use that template.


        You could modify the original page dialog as well to get the same result, however it is not recommended.

        Q: What is the difference between the Author and Publish environment?

        A: A production environment usually has two difference instances of AEM running. One is the author instance, and the other is the publish instance. These two instances are usually kept in two different settings.

        The author instance is where you will enter and manage content for your website. This is where you will administer your site as well. The author environment is usually kept behind a firewall. The publish instance is where you will make your content available for your targeted audience. The publish environment is usually kept in a Demilitarized Zone (DMZ).

        I plan to add more interview questions to this blog, so make sure to check back.

        I hope you enjoyed this post. Please feel free to post any comments below.

        Labels: ,

        Monday, April 6, 2015

        AEM GEM On "Tips and Tricks for AEM Sites Touch UI"

        Adobe will be holding another GEM on June 3rd, 2015. This session will be focusing on tips and tricks for the AEM Sites Touch UI. The session will be teaching you how to:

        • How to efficiently navigate and find content
        • How to author content
        • How to keep an overview of what is going on 
        • How to organize content and collaborate on it

        If you have not attended one of these AEM sessions, they are a great chance to listen to some of the best experts in the industry, a great place to ask questions, and a good way to start networking. 

        Here is a link to sign up if you are interested: AEM GEM

        This session will be hosted by Gabriel Walt, a Product Manager at Adobe.

        Labels: ,

        Wednesday, April 1, 2015

        AEM Interview Questions Part 3

        This is part three of my AEM interview questions. You find the other parts here:

        Part 1 - Part 2 - 
        Part 4 - Part 5 - Part 6 - Part 7 - Part 8 - PDF

        Here are some more AEM interview questions that could come up during a technical interview:

        QHow do you build a bundle through crxde?

        A: You can build a bundle through crxde by navigating to the source folder of your project located under “apps”. Once you do this, right click on the “src” folder and choose to create a bundle. This will open the wizard that will walk you through creating your bundle.

        It is recommended that you no longer use crxde to create OSGI bundles for AEM. Instead you should be using Maven.

        Q: What is the purpose of the Activator.java file?

        A: The purpose of the Activator.java file is that it is to be notified any time there are bundle start and stop events for that bundle. The Activator.java file is an optional listener class that is created when you create a bundle through crxde.

        Q: What is a CQ5 overlay/override component?

        A: The overlay/override component is used when you want to use an out of the box component in AEM and you want to add extra features to it and you want to change it across all instances of that component. For example if you want to add features to the out of the box “text” component, but you don’t want to create a new component, you would want to copy the “text” component from “libs/foundation/components” to “apps/foundation/components” and keep the same folder structure that is used.

        When this is done, any changes that done to this new component will be reflected in the out of the box “text” component, without changing the original code under “libs”. It is generally not a good practice to modify the original code, which is why CQ offers the ability to use overlays.

        Q: What is the difference between a dialog and a design dialog?

        A: A dialog is a key element of the component because they provide an interface for authors to configure and provide input to that component. This input will be stored at the page level in the jcr.


        A design dialog is a dialog that will only display when you are in design mode in AEM. The input that is received here will be stored at the template level and will be accessed across the whole site.

        Q: What is extending a component?

        A: Extending a component is when you want to create a new component that will not override a base component, but will have the same features as the original so that you can change or build upon that component.

        In order to extend a component, you must set the “sling:resourceSuperType” of the component to the base component you would like to extend. By doing this, you will inherit everything from the base component.
        I plan to add more interview questions to this blog, so make sure to check back.

        I hope you enjoyed this post. Please feel free to post any comments below.

        Labels: ,