<?xml version='1.0' encoding='UTF-8'?><?xml-stylesheet href="http://www.blogger.com/styles/atom.css" type="text/css"?><feed xmlns='http://www.w3.org/2005/Atom' xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:blogger='http://schemas.google.com/blogger/2008' xmlns:georss='http://www.georss.org/georss' xmlns:gd="http://schemas.google.com/g/2005" xmlns:thr='http://purl.org/syndication/thread/1.0'><id>tag:blogger.com,1999:blog-4433773573761530904</id><updated>2026-01-29T16:34:17.737-08:00</updated><category term="English"/><category term="aem"/><category term="adobe experience manager"/><category term="docker"/><category term="aem/cq5"/><category term="nodejs"/><category term="node.js"/><category term="reactjs"/><category term="machine learning"/><category term="cq5"/><category term="deep learning"/><category term="javascript"/><category term="tensorflowjs"/><category term="Frameworks"/><category term="Metamorph"/><category term="Spanish"/><category term="java"/><category term="maven"/><category term="vuejs"/><category term="aem courses"/><category term="angularjs"/><category term="galenframework"/><category term="tensorflow"/><category term="Marketing"/><category term="bulk editor"/><category term="dispatcher"/><category term="game"/><category term="langchain"/><category term="mongo"/><category term="nuxtjs"/><category term="selenium"/><category term="tensorflowjs converter"/><category term="unity"/><title type='text'>DLightHouse</title><subtitle type='html'></subtitle><link rel='http://schemas.google.com/g/2005#feed' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/posts/default'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default?redirect=false'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/'/><link rel='hub' href='http://pubsubhubbub.appspot.com/'/><link rel='next' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default?start-index=26&amp;max-results=25&amp;redirect=false'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><generator version='7.00' uri='http://www.blogger.com'>Blogger</generator><openSearch:totalResults>50</openSearch:totalResults><openSearch:startIndex>1</openSearch:startIndex><openSearch:itemsPerPage>25</openSearch:itemsPerPage><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-8832849973113553101</id><published>2025-02-27T16:00:00.000-08:00</published><updated>2025-02-27T16:00:00.221-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="cq5"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>Brighten Up Your AEM Assets: How to Configure Default Backgrounds and Transparent Modes in Adobe Dynamic Media</title><content type='html'>&lt;main&gt;
        &lt;div&gt;&lt;/div&gt;
        &lt;ul class=&quot;table-of-contents-section&quot;&gt;
            &lt;li&gt;
                &lt;div&gt;Introduction&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;The Importance of a Good Background&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;Defining Your Default Background in AEM&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;Defining Your Default Background in Dynamic Media Classic&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;Transparent Images with fmt=png-alpha&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;Explicit Background Colors with ?bgc&lt;/div&gt;
            &lt;/li&gt;
            &lt;li&gt;
                &lt;div&gt;Final Thoughts&lt;/div&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
        &lt;ul class=&quot;information-section&quot;&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Introduction&lt;/h2&gt;
                    &lt;p&gt;Welcome to our deep dive into the wonderful world of image backgrounds! In this post, we&#39;re
                        going to explore how to configure Dynamic Media Classic in Adobe Experience Manager (AEM) to not
                        only define a default background image but also how to get your images to pop with
                        transparency—or even that explicit background color, if you&#39;re feeling bold (or a little
                        red, as we&#39;ll see).&lt;/p&gt;
                    &lt;p&gt;Whether you&#39;re a seasoned AEM pro or just starting to dabble in Dynamic Media, this guide
                        will help you set the stage for impeccable image presentation. So, sit back, relax, and
                        let&#39;s set the right background for your digital assets!&lt;/p&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;The Importance of a Good Background&lt;/h2&gt;
                    &lt;p&gt;A background is more than just a blank canvas—it&#39;s the stage that elevates your image
                        content. In Dynamic Media Classic, you have the power to define a default background that
                        ensures a consistent look across your assets.&lt;/p&gt;
                    &lt;p&gt;Think of it like picking the perfect wall color for your living room: it can either highlight
                        your art or, if done poorly, clash horribly with every other element. We all want our images to
                        be dressed for success!&lt;/p&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Defining Your Default Background in Dynamic Media Classic&lt;/h2&gt;
                    &lt;p&gt;In Adobe Dynamic Media Classic, setting a default background is a breeze. Simply click on the
                        user icon to access your personal settings, then navigate to &lt;strong&gt;Application Setup &amp;gt;
                            Publish Setup &amp;gt; Image Server&lt;/strong&gt;. Once there, head over to the &lt;em&gt;Request
                            Attributes&lt;/em&gt; section where you&#39;ll find the &lt;strong&gt;Default Background Color&lt;/strong&gt;
                        field with its built-in color picker.&lt;/p&gt;
                    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlDwXgS6nA7HnoJpED4s4DKwpCXVt2yI-RcHyE9UxMQAyPtBsfWEaxoTkXCYiR3TDPH3l4BtT77UrueeKaRvmepTPaP72OG2Q0RN0uYibkEDZLjKyzGyOF0PyXUSNVqVf-NK5mUJ3wa5pYcS1iQCxqLPo3h9yPM5gQQNF8w6ZFkQbmGOS_wsQ91zB6PzA/s3454/Screenshot%202025-02-27%20at%2011.00.42%E2%80%AFAM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;150&quot; data-original-width=&quot;3454&quot; height=&quot;28&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlDwXgS6nA7HnoJpED4s4DKwpCXVt2yI-RcHyE9UxMQAyPtBsfWEaxoTkXCYiR3TDPH3l4BtT77UrueeKaRvmepTPaP72OG2Q0RN0uYibkEDZLjKyzGyOF0PyXUSNVqVf-NK5mUJ3wa5pYcS1iQCxqLPo3h9yPM5gQQNF8w6ZFkQbmGOS_wsQ91zB6PzA/w640-h28/Screenshot%202025-02-27%20at%2011.00.42%E2%80%AFAM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilrXM4Am1tTsHWyCLN_rDIrelbAycCA-AmsSl_o1y8NvliQCQglaXu_mAovKAVO7r9iSETTmhbS2eGCrkcUJuMmvUWxkdQPxILajNE4cDblfX3Y4Z39ec1j3LDE65Ti-cNr7eouq7eONBBI4Zv3Sf7ImumM9r57Xey5e1c-L-BQqDs3x0g-mNrtkevTwY/s2162/Screenshot%202025-02-27%20at%2011.01.46%E2%80%AFAM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;1342&quot; data-original-width=&quot;2162&quot; height=&quot;398&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEilrXM4Am1tTsHWyCLN_rDIrelbAycCA-AmsSl_o1y8NvliQCQglaXu_mAovKAVO7r9iSETTmhbS2eGCrkcUJuMmvUWxkdQPxILajNE4cDblfX3Y4Z39ec1j3LDE65Ti-cNr7eouq7eONBBI4Zv3Sf7ImumM9r57Xey5e1c-L-BQqDs3x0g-mNrtkevTwY/w640-h398/Screenshot%202025-02-27%20at%2011.01.46%E2%80%AFAM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;Use the color picker to choose the perfect backdrop for your images—whether that&#39;s a classic
                        white (&lt;code&gt;#FFFFFF&lt;/code&gt;) or a more adventurous hue.&lt;/p&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Defining Your Default Background in AEM&lt;/h2&gt;
                    &lt;p&gt;Configuring your default background in Adobe Experience Manager is just as straightforward. Start
                        by opening the Global Navigation Panel by clicking on the Adobe Experience Manager link at the
                        top-left of your screen. Next, click on the Tools icon, then navigate to &lt;strong&gt;Assets &amp;gt;
                            Dynamic Media Publish Setup&lt;/strong&gt;. In the &lt;em&gt;Request Attributes&lt;/em&gt; tab, locate the
                        &lt;strong&gt;Default Background Color&lt;/strong&gt; field to access the color picker.&lt;/p&gt;
                    &lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdRLKTWs9JLmJVyIn3bbFD48Ak1vCB4tcMi1B3_RsdX1VvCm4ROUygZj5fGPQ3BCIhAN4JFcwBbcpgpI7PjSgz3g7s1DpzJ0iIoby5TU-Z4-kDt9c-0Qkywu80KLyphuG0s3J3Ps9QKaFnwjQm6cJ0phTqicpQuC3goV2LNMM4fOs2LaaC-AZaiKEYopw/s2950/Screenshot%202025-02-27%20at%2010.58.30%E2%80%AFAM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;952&quot; data-original-width=&quot;2950&quot; height=&quot;206&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjdRLKTWs9JLmJVyIn3bbFD48Ak1vCB4tcMi1B3_RsdX1VvCm4ROUygZj5fGPQ3BCIhAN4JFcwBbcpgpI7PjSgz3g7s1DpzJ0iIoby5TU-Z4-kDt9c-0Qkywu80KLyphuG0s3J3Ps9QKaFnwjQm6cJ0phTqicpQuC3goV2LNMM4fOs2LaaC-AZaiKEYopw/w640-h206/Screenshot%202025-02-27%20at%2010.58.30%E2%80%AFAM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;br /&gt;&lt;div class=&quot;separator&quot; style=&quot;clear: both; text-align: center;&quot;&gt;&lt;a href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb8rmmSYCHFOTlOO_Wc2M1HgOV_6xfOzTbi09-92wEvS59ocQHfFQMd9cYfqRQCnyiQVLJ9Ps9c-pkrhTALCsbYw1pEo4jICbHFS1_SbEixM_IqN7JGtQEIvY5WdTUqvGj_n4cIcln2bFq49uIxxS_m9G5fd2TXNhE6G-05eNEqf_VTJzJ7KpOMqKkWpA/s3444/Screenshot%202025-02-27%20at%2011.00.14%E2%80%AFAM.png&quot; imageanchor=&quot;1&quot; style=&quot;margin-left: 1em; margin-right: 1em;&quot;&gt;&lt;img border=&quot;0&quot; data-original-height=&quot;876&quot; data-original-width=&quot;3444&quot; height=&quot;162&quot; src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEgb8rmmSYCHFOTlOO_Wc2M1HgOV_6xfOzTbi09-92wEvS59ocQHfFQMd9cYfqRQCnyiQVLJ9Ps9c-pkrhTALCsbYw1pEo4jICbHFS1_SbEixM_IqN7JGtQEIvY5WdTUqvGj_n4cIcln2bFq49uIxxS_m9G5fd2TXNhE6G-05eNEqf_VTJzJ7KpOMqKkWpA/w640-h162/Screenshot%202025-02-27%20at%2011.00.14%E2%80%AFAM.png&quot; width=&quot;640&quot; /&gt;&lt;/a&gt;&lt;/div&gt;&lt;p&gt;With these intuitive tools at your disposal, choosing the ideal default background for your
                        images has never been easier.&lt;/p&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Transparent Images with fmt=png-alpha&lt;/h2&gt;
                    &lt;p&gt;When it comes to transparency, Dynamic Media Classic has your back—literally. By appending the
                        &lt;code&gt;fmt=png-alpha&lt;/code&gt; parameter to your image URL, you instruct the server to process your
                        image with an alpha channel, allowing for a transparent background.&lt;/p&gt;
                    &lt;p&gt;This is ideal for when you need your images to seamlessly blend into varying backgrounds without
                        the harsh edges of a solid backdrop. Consider it your magic wand for making images disappear
                        into the background—while still remaining visible!&lt;/p&gt;
                    &lt;div&gt;
                        &lt;div&gt;Transparent Image URL Example&lt;/div&gt;
                        &lt;pre&gt;&lt;code class=&quot;plaintext&quot;&gt;https://example.com/path/to/image.jpg?fmt=png-alpha&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Explicit Background Colors with ?bgc&lt;/h2&gt;
                    &lt;p&gt;Sometimes, you might want to force a specific background color for your images. Enter the
                        &lt;code&gt;?bgc&lt;/code&gt; parameter. For example, using &lt;code&gt;?bgc=255,0,0&lt;/code&gt; will render an
                        explicit red background. (Warning: as one might say in the world of backgrounds, that red is so
                        ugly it might just steal the spotlight from your image!)&lt;/p&gt;
                    &lt;p&gt;This parameter offers granular control over the background rendering and is particularly useful
                        when you need a precise color output. For more technical details on this parameter, check out
                        the official documentation.&lt;/p&gt;
                    &lt;div&gt;
                        &lt;div&gt;Explicit Background Color Example&lt;/div&gt;
                        &lt;pre&gt;&lt;code class=&quot;plaintext&quot;&gt;https://example.com/path/to/image.jpg?bgc=255,0,0&lt;/code&gt;&lt;/pre&gt;
                    &lt;/div&gt;
                &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;section-&quot;&gt;
                &lt;div&gt;
                    &lt;h2&gt;Final Thoughts&lt;/h2&gt;
                    &lt;p&gt;In the end, the right background can make or break your image presentation. By configuring
                        default background settings in Dynamic Media Classic, utilizing the magic of
                        &lt;code&gt;fmt=png-alpha&lt;/code&gt; for transparency, and even forcing an explicit color with
                        &lt;code&gt;?bgc&lt;/code&gt; when necessary, you&#39;re well on your way to creating visually stunning and
                        consistent digital assets.&lt;/p&gt;
                    &lt;p&gt;Remember: in the world of images, the background might be the unsung hero. So, give it the
                        attention it deserves—and maybe even a little joke now and then to lighten the mood.&lt;/p&gt;
                &lt;/div&gt;
            &lt;/li&gt;
        &lt;/ul&gt;
        &lt;div&gt;&lt;a href=&quot;https://experienceleague.adobe.com/en/docs/experience-manager-65/content/assets/dynamic/dm-publish-settings&quot; target=&quot;_blank&quot;&gt;Dynamic Media Publish Settings Documentation&lt;/a&gt;&lt;/div&gt;
        &lt;div&gt;&lt;a href=&quot;https://experienceleague.adobe.com/en/docs/dynamic-media-developer-resources/image-serving-api/image-rendering-api/http-protocol-reference/http-protocol-command-reference/r-ir-bgc&quot; target=&quot;_blank&quot;&gt;HTTP Protocol: ?bgc Parameter Reference&lt;/a&gt;&lt;/div&gt;
        &lt;div&gt;&lt;a href=&quot;https://experienceleaguecommunities.adobe.com/t5/adobe-experience-manager/dynamic-media-png-image-with-transparent-background-served-with/m-p/454339&quot; target=&quot;_blank&quot;&gt;Transparent PNG Images Discussion&lt;/a&gt;&lt;/div&gt;
    &lt;/main&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8832849973113553101'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8832849973113553101'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2025/02/adobe-dynamic-media-background-color.html' title='Brighten Up Your AEM Assets: How to Configure Default Backgrounds and Transparent Modes in Adobe Dynamic Media'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhlDwXgS6nA7HnoJpED4s4DKwpCXVt2yI-RcHyE9UxMQAyPtBsfWEaxoTkXCYiR3TDPH3l4BtT77UrueeKaRvmepTPaP72OG2Q0RN0uYibkEDZLjKyzGyOF0PyXUSNVqVf-NK5mUJ3wa5pYcS1iQCxqLPo3h9yPM5gQQNF8w6ZFkQbmGOS_wsQ91zB6PzA/s72-w640-h28-c/Screenshot%202025-02-27%20at%2011.00.42%E2%80%AFAM.png" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-8404441075573002119</id><published>2024-12-30T12:00:00.000-08:00</published><updated>2024-12-30T12:00:00.112-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="langchain"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>Langchain Basic LLM with a Simple Schema Javascript</title><content type='html'>  &lt;main&gt;
    &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowFullScreen=&quot;&quot;
        class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/SlZcKCqCYNY/0.jpg&quot;
        frameBorder=&quot;0&quot; src=&quot;https://www.youtube.com/embed/SlZcKCqCYNY?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/SlZcKCqCYNY/0.jpg&quot; style=&quot;display:none&quot; /&gt;&lt;/div&gt;
    &lt;ul class=&quot;table-of-contents-section&quot;&gt;
      &lt;li&gt;
        &lt;div&gt;Introduction&lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;div&gt;Why Structured Output?&lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;div&gt;Notes &amp;amp; Code Walkthrough&lt;/div&gt;
      &lt;/li&gt;
      &lt;li&gt;
        &lt;div&gt;Conclusion&lt;/div&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
    &lt;ul class=&quot;information-section&quot;&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Introduction&lt;/h2&gt;
          &lt;p&gt;When building applications that interact with Large Language Models (LLMs), you often need more than just a
            plain text response. Structured outputs, such as JSON, make it much easier to integrate your AI-powered app
            with external systems or display specific data on the frontend. In this post, we&amp;#x27;ll explore how to
            achieve that using LangChain. We&amp;#x27;ll also walk through some personal notes on how we&amp;#x27;ve set up our
            React components, and finally we&amp;#x27;ll dive into our code to see it all in action.&lt;/p&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Why Structured Output?&lt;/h2&gt;
          &lt;p&gt;If you&amp;#x27;ve ever tried to build an API around an LLM, you may have run into a significant challenge: the
            LLM typically returns unstructured text. For a human reader, this is totally fine. But if you plan to feed
            that output into another process or system, you need a consistent structure—like JSON objects or arrays—to
            reliably parse the returned data.&lt;/p&gt;
          &lt;p&gt;In this post, we&amp;#x27;ll transform an ordinary text output into something more predictable. Whether you
            want to expose an API to external consumers or simply structure your own UI, having predictable keys and
            values will save you time and headaches.&lt;/p&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Explanation &amp;amp; Code Walkthrough&lt;/h2&gt;
          &lt;p&gt;Here&amp;#x27;s the general idea behind how to achieve a structured response using LangChain:&lt;/p&gt;
          &lt;p&gt;&lt;strong&gt;1.&lt;/strong&gt; You can define a schema (for example, with fields for the country, state, and zip code)
            that instructs the LLM to return data in JSON format.&lt;/p&gt;
          &lt;p&gt;&lt;strong&gt;2.&lt;/strong&gt; By leveraging LangChain&amp;#x27;s &lt;code&gt;StructuredOutputParser&lt;/code&gt;, you can specify
            which fields you want the LLM to fill.&lt;/p&gt;
          &lt;p&gt;&lt;strong&gt;3.&lt;/strong&gt; Then, by adding a “formatInstructions” variable to your prompt, you give the LLM a
            clear signal about how you want the final response to look.&lt;/p&gt;
          &lt;p&gt;&lt;strong&gt;4.&lt;/strong&gt; Finally, you parse the LLM&amp;#x27;s raw text output into a structured JSON object that
            your code can easily consume.&lt;/p&gt;
          &lt;p&gt;Incorporating these points into your own project is quite straightforward. Let&amp;#x27;s see how our own code
            structure implements them.&lt;/p&gt;
          &lt;p&gt;Set up a small React project with the following files:&lt;/p&gt;
          &lt;ul&gt;
            &lt;li&gt;&lt;code&gt;App.jsx&lt;/code&gt; where I import &lt;code&gt;AddressInformationExtractor&lt;/code&gt; and display it as my main
              component.&lt;/li&gt;
            &lt;li&gt;&lt;code&gt;llm.js&lt;/code&gt; which handles the LangChain logic, including the&lt;code&gt;PromptTemplate&lt;/code&gt; and
              &lt;code&gt;StructuredOutputParser&lt;/code&gt;.&lt;/li&gt;
            &lt;li&gt;&lt;code&gt;AddressInformationExtractor.jsx&lt;/code&gt; which is a React component that takes user input, sends it
              to the LLM, and displays the extracted country, state, and zip code.&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h3&gt;1. App.jsx&lt;/h3&gt;
          &lt;div&gt;
            &lt;div&gt;App.jsx&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;import &amp;#x27;./App.css&amp;#x27;
import { AddressInformationExtractor } from &amp;#x27;./components/AddressInformationExtractor&amp;#x27;

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;AddressInformationExtractor /&amp;gt;
    &amp;lt;/&amp;gt;
  )
}

export default App&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
          &lt;h3&gt;2. llm.js&lt;/h3&gt;
          &lt;div&gt;
            &lt;div&gt;llm.js&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;import { OpenAI } from &amp;quot;@langchain/openai&amp;quot;;
import { LLMChain } from &amp;quot;langchain/chains&amp;quot;;
import { PromptTemplate } from &amp;quot;@langchain/core/prompts&amp;quot;;
import { StructuredOutputParser } from &amp;quot;langchain/output_parsers&amp;quot;;

const simpleParser = StructuredOutputParser.fromNamesAndDescriptions({
  country: &amp;quot;The country extracted from the text&amp;quot;,
  state: &amp;quot;The state extracted from the text&amp;quot;,
  zipcode: &amp;quot;The zipcode extracted from the text&amp;quot;,
});

const formatInstructions = simpleParser.getFormatInstructions();

const model = new OpenAI({
  modelName: &amp;quot;gpt-3.5-turbo&amp;quot;,
  openAIApiKey: &amp;quot;API-KEY&amp;quot;,
});

const myPrompt = new PromptTemplate({
  template: `Extract from the following text the country, state and zipcode: {text}
${formatInstructions}`,
  inputVariables: [&amp;quot;text&amp;quot;],
  partialVariables: { formatInstructions },
});

const myChain = new LLMChain({
  llm: model,
  prompt: myPrompt,
  outputKey: &amp;quot;questions&amp;quot;,
  verbose: true,
  outputParser: simpleParser,
});

export const executePrompt = async (promptKeys) =&amp;gt; {
  const response = await myChain.call(promptKeys);
  return response;
};&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
          &lt;h3&gt;3. AddressInformationExtractor.jsx&lt;/h3&gt;
          &lt;div&gt;
            &lt;div&gt;AddressInformationExtractor.jsx&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;import React, { useState } from &amp;quot;react&amp;quot;;
import { executePrompt } from &amp;quot;./llm&amp;quot;

export const AddressInformationExtractor = () =&amp;gt; {
  const [text, setText] = useState(
    &amp;quot;there is a place in USA, a really interesting place and inside something called New York, in particular 10001.&amp;quot;
  );
  const [addressInfo, setAddressInfo] = useState(&amp;quot;&amp;quot;);

  const extractAddressInfo = async () =&amp;gt; {
    const response = await executePrompt({ text });
    setAddressInfo(response);
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Address Information Extractor&amp;lt;/h1&amp;gt;
      &amp;lt;textarea
        value={text}
        onChange={(e) =&amp;gt; setText(e.target.value)}
        placeholder=&amp;quot;Enter text here&amp;quot;
      /&amp;gt;
      &amp;lt;button onClick={extractAddressInfo}&amp;gt;Extract Address Information&amp;lt;/button&amp;gt;
      &amp;lt;p&amp;gt;{addressInfo.questions?.country}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;{addressInfo.questions?.state}&amp;lt;/p&amp;gt;
      &amp;lt;p&amp;gt;{addressInfo.questions?.zipcode}&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Conclusion&lt;/h2&gt;
          &lt;p&gt;And that&amp;#x27;s it! With just a few tweaks—defining a schema, adding format instructions, and parsing the
            response—you can quickly turn a ChatGPT response into JSON that is easy to consume. Whether you are building
            a front-facing UI or an external API endpoint, structured outputs make your applications more robust.&lt;/p&gt;
          &lt;p&gt;Ready to expand this approach with more complex schemas or even local LLMs? Stay tuned for the next steps
            in this series!&lt;/p&gt;
        &lt;/div&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
    &lt;/div&gt;
  &lt;/main&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8404441075573002119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8404441075573002119'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2024/12/basic-llm-javascript-langchain-simple-schema.html' title='Langchain Basic LLM with a Simple Schema Javascript'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/SlZcKCqCYNY/default.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-4870484671427442056</id><published>2024-12-23T16:00:00.000-08:00</published><updated>2024-12-24T14:57:30.193-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="nodejs"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>Langchain Basic LLM Javascript</title><content type='html'>  &lt;main&gt;
    &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowFullScreen=&quot;&quot;
        class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot; data-thumbnail-src=&quot;https://i.ytimg.com/vi/nQw2VncrbCY/0.jpg&quot;
        frameBorder=&quot;0&quot; src=&quot;https://www.youtube.com/embed/nQw2VncrbCY?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/nQw2VncrbCY/0.jpg&quot; style=&quot;display:none&quot; /&gt;&lt;/div&gt;
    &lt;ul class=&quot;information-section&quot;&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;This post shows how to create a simple React application that communicates with an LLM using LangChain. It
          includes steps for installing dependencies, building a prompt, integrating with OpenAI’s GPT-3.5-turbo, and
          extracting country, state, and ZIP code information.&lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;ul class=&quot;table-of-contents-section&quot;&gt;
          &lt;li&gt;
            &lt;div&gt;Project Setup&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;div&gt;Dependencies&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;div&gt;llm.js&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;div&gt;AddressInformationExtractor.jsx&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;div&gt;App.jsx&lt;/div&gt;
          &lt;/li&gt;
          &lt;li&gt;
            &lt;div&gt;Running the App&lt;/div&gt;
          &lt;/li&gt;
        &lt;/ul&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Project Setup&lt;/h2&gt;
          &lt;div&gt;
            &lt;div&gt;
              &lt;div&gt;Unix-like Shells&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm create vite my-llm-app --template react&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Mac&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm create vite my-llm-app --template react&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm create vite my-llm-app --template react&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Windows PowerShell&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm create vite my-llm-app --template react&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Dependencies&lt;/h2&gt;
          &lt;div&gt;
            &lt;div&gt;
              &lt;div&gt;Unix-like Shells&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm add langchain @langchain/core @langchain/openai&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Mac&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm add langchain @langchain/core @langchain/openai&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm add langchain @langchain/core @langchain/openai&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
            &lt;div&gt;
              &lt;div&gt;Windows PowerShell&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm add langchain @langchain/core @langchain/openai&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;llm.js&lt;/h2&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;div&gt;llm.js&lt;/div&gt;
          &lt;pre&gt;&lt;code class=&quot;javascript&quot;&gt;import { OpenAI } from &amp;quot;@langchain/openai&amp;quot;;
import { LLMChain } from &amp;quot;langchain/chains&amp;quot;;
import { PromptTemplate } from &amp;quot;@langchain/core/prompts&amp;quot;;

const model = new OpenAI({
  modelName: &amp;quot;gpt-3.5-turbo&amp;quot;,
  openAIApiKey: &amp;quot;API_KEY&amp;quot;
});

const myPrompt = new PromptTemplate({
  template: `Extract from the following text the country, state and zipcode: ${text}`,
  inputVariables: [&amp;quot;text&amp;quot;]
});

const myChain = new LLMChain({
  llm: model,
  prompt: myPrompt,
  outputKey: &amp;quot;questions&amp;quot;,
  verbose: true
});

export const executePrompt = async (promptKeys) =&amp;gt; {
  const response = await myChain.call(promptKeys);
  return response;
};&lt;/code&gt;&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;AddressInformationExtractor.jsx&lt;/h2&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;div&gt;AddressInformationExtractor.jsx&lt;/div&gt;
          &lt;pre&gt;&lt;code class=&quot;jsx&quot;&gt;import React, { useState } from &amp;quot;react&amp;quot;;
import { executePrompt } from &amp;quot;./llm&amp;quot;;

export const AddressInformationExtractor = () =&amp;gt; {
  const [text, setText] = useState(
    &amp;quot;there is a place in USA, a really interesting place and inside something called New York, in particular 10001.&amp;quot;
  );
  const [addressInfo, setAddressInfo] = useState(&amp;quot;&amp;quot;);

  const extractAddressInfo = async () =&amp;gt; {
    const response = await executePrompt({ text });
    setAddressInfo(response);
  };

  return (
    &amp;lt;div&amp;gt;
      &amp;lt;h1&amp;gt;Address Information Extractor&amp;lt;/h1&amp;gt;
      &amp;lt;textarea
        value={text}
        onChange={(e) =&amp;gt; setText(e.target.value)}
        placeholder=&amp;quot;Enter text here&amp;quot;
      /&amp;gt;
      &amp;lt;button onClick={extractAddressInfo}&amp;gt;Extract Address Information&amp;lt;/button&amp;gt;
      &amp;lt;p&amp;gt;{addressInfo.questions}&amp;lt;/p&amp;gt;
    &amp;lt;/div&amp;gt;
  );
};&lt;/code&gt;&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;App.jsx&lt;/h2&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;div&gt;App.jsx&lt;/div&gt;
          &lt;pre&gt;&lt;code class=&quot;jsx&quot;&gt;import &amp;#x27;./App.css&amp;#x27;;
import { AddressInformationExtractor } from &amp;#x27;./components/AddressInformationExtractor&amp;#x27;;

function App() {
  return (
    &amp;lt;&amp;gt;
      &amp;lt;AddressInformationExtractor /&amp;gt;
    &amp;lt;/&amp;gt;
  );
}

export default App;&lt;/code&gt;&lt;/pre&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;h2&gt;Running the App&lt;/h2&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;
          &lt;div&gt;
            &lt;div&gt;Unix-like Shells&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm install \
pnpm run dev&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;div&gt;Mac&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm install \
pnpm run dev&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm install ^
pnpm run dev&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
          &lt;div&gt;
            &lt;div&gt;Windows PowerShell&lt;/div&gt;
            &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;pnpm install `
pnpm run dev&lt;/code&gt;&lt;/pre&gt;
          &lt;/div&gt;
        &lt;/div&gt;
      &lt;/li&gt;
      &lt;li class=&quot;section-&quot;&gt;
        &lt;div&gt;Once the development server is running, open your browser at the provided URL and enter a text with a
          country, state, and ZIP code. Click “Extract Address Information” to see the response.&lt;/div&gt;
      &lt;/li&gt;
    &lt;/ul&gt;
  &lt;/main&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4870484671427442056'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4870484671427442056'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2024/12/basic-llm-javascript-langchain.html' title='Langchain Basic LLM Javascript'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/nQw2VncrbCY/default.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-7307225915237410211</id><published>2024-07-15T17:00:00.000-07:00</published><updated>2024-07-15T17:00:00.117-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="aem/cq5"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="nodejs"/><title type='text'>AEM - Switching from NPM to PNPM in your AEM Application</title><content type='html'>
    &lt;main&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width: 100%&quot;&gt;
        &lt;iframe
          allowfullscreen=&quot;&quot;
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/mGsGY-Ms9YI/0.jpg&quot;
          frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/mGsGY-Ms9YI?feature=player_embedded&quot;
        &gt;&lt;/iframe
        &gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/mGsGY-Ms9YI/0.jpg&quot;
          style=&quot;display: none&quot;
        /&gt;
      &lt;/div&gt;
      &lt;ul class=&quot;information-section&quot;&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            If you want to use pnpm instead of npm on your AEM application for
            better performance or additional features, here&amp;#x27;s a
            comprehensive guide on how to make the switch. In this post, you
            will learn how to:
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;ul class=&quot;table-of-contents-section&quot;&gt;
            &lt;li&gt;&lt;div&gt;Create AEM App&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Modify root&amp;#x27;s pom.xml&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Select pnpm&amp;#x27;s Version&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Modify ui.frontend&amp;#x27;s pom.xml&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Build the project&lt;/div&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Hi there, I&amp;#x27;m Manuel Gutierrez from dlighthouse.co, and in this
            quick tips series, I will share snackable videos focusing on just
            one feature or problem. Let&amp;#x27;s start by creating a new app using
            Adobe&amp;#x27;s archetype. Make sure you define the appTitle, appId,
            and groupId:
            &lt;div&gt;
              &lt;div&gt;
                &lt;div&gt;Unix-like Shells&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate  -D archetypeGroupId=com.adobe.aem  -D archetypeArtifactId=aem-project-archetype  -D archetypeVersion=48  -D appTitle=&amp;quot;AEM Project&amp;quot;  -D appId=&amp;quot;aem-project&amp;quot;  -D groupId=&amp;quot;com.project&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Mac&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate  -D archetypeGroupId=com.adobe.aem  -D archetypeArtifactId=aem-project-archetype  -D archetypeVersion=48  -D appTitle=&amp;quot;AEM Project&amp;quot;  -D appId=&amp;quot;aem-project&amp;quot;  -D groupId=&amp;quot;com.project&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate  -D archetypeGroupId=com.adobe.aem  -D archetypeArtifactId=aem-project-archetype  -D archetypeVersion=48  -D appTitle=&amp;quot;AEM Project&amp;quot;  -D appId=&amp;quot;aem-project&amp;quot;  -D groupId=&amp;quot;com.project&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows PowerShell&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate  -D archetypeGroupId=com.adobe.aem  -D archetypeArtifactId=aem-project-archetype  -D archetypeVersion=48  -D appTitle=&amp;quot;AEM Project&amp;quot;  -D appId=&amp;quot;aem-project&amp;quot;  -D groupId=&amp;quot;com.project&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            After generating the app, open the root pom.xml file and replace all
            instances of the word npm with pnpm. The first instance should be
            the npm version:
            &lt;div&gt;
              &lt;div&gt;Change npm to pnpm&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;pnpmVersion&amp;gt;8.15.5&amp;lt;/pnpmVersion&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Go to npmjs.com, search for pnpm, and select the desired version. In
            this case, use the latest version available, and remember to prefix
            it with a &amp;#x27;v&amp;#x27;:
            &lt;div&gt;
              &lt;a
                href=&quot;https://www.npmjs.com/package/pnpm?activeTab=versions&quot;
                target=&quot;_blank&quot;
                &gt;pnpm Versions&lt;/a
              &gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Continue replacing instances of npm with pnpm throughout the file.
            Ensure the arguments configuration for the execution with id
            &amp;quot;pnpm ci&amp;quot; reflects the change:
            &lt;div&gt;
              &lt;div&gt;Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;arguments&amp;gt;install --frozen-lockfile&amp;lt;/arguments&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            com.github.eirslett frontend-maven-plugin configurations using pnpm:
            &lt;div&gt;
              &lt;div&gt;Plugin Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;com.github.eirslett&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;frontend-maven-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;${frontend-maven-plugin.version}&amp;lt;/version&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;nodeVersion&amp;gt;v16.17.0&amp;lt;/nodeVersion&amp;gt;
    &amp;lt;pnpmVersion&amp;gt;8.15.5&amp;lt;/pnpmVersion&amp;gt;
  &amp;lt;/configuration&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;install node and pnpm&amp;lt;/id&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;install-node-and-pnpm&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;pnpm ci&amp;lt;/id&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;pnpm&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;install --frozen-lockfile&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Next, navigate to the ui.frontend folder and update the pom.xml file
            similarly. Replace npm with pnpm in all relevant sections:
            &lt;div&gt;
              &lt;div&gt;Frontend Plugin Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;com.github.eirslett&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;frontend-maven-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;pnpm run prod&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;pnpm&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;run prod&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;pnpm run dev&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;pnpm&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;run dev&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Congratulations! You have successfully configured your AEM project
            to use pnpm instead of npm. Now you can push this code into your
            repository.
          &lt;/div&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;div&gt;
        &lt;a
          href=&quot;https://stackoverflow.com/questions/70154568/pnpm-equivalent-command-for-npm-ci&quot;
          target=&quot;_blank&quot;
          &gt;pnpm equivalent command for npm ci&lt;/a
        &gt;
      &lt;/div&gt;
    &lt;/main&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/7307225915237410211'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/7307225915237410211'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2024/07/aem-using-pnpm.html' title='AEM - Switching from NPM to PNPM in your AEM Application'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/mGsGY-Ms9YI/default.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-7406859670020539424</id><published>2024-06-17T17:30:00.000-07:00</published><updated>2024-07-02T08:20:27.507-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="aem/cq5"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="nodejs"/><title type='text'>AEM - Switching from NPM to Yarn in your AEM Application</title><content type='html'>    &lt;main&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width: 100%&quot;&gt;
        &lt;iframe
          allowfullscreen=&quot;&quot;
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/kJm0G0_j6fE/0.jpg&quot;
          frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/kJm0G0_j6fE?feature=player_embedded&quot;
        &gt;&lt;/iframe
        &gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/kJm0G0_j6fE/0.jpg&quot;
          style=&quot;display: none&quot;
        /&gt;
      &lt;/div&gt;
      &lt;ul class=&quot;information-section&quot;&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            If you want to use Yarn instead of npm on your AEM application for
            better performance or additional features, here I will guide you
            through the process. On this post you will:
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;ul class=&quot;table-of-contents-section&quot;&gt;
            &lt;li&gt;&lt;div&gt;Create AEM App&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Modify root&amp;#x27;s pom.xml&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Select Yarn&amp;#x27;s Version&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Modify ui.frontend&amp;#x27;s pom.xml&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Build the project&lt;/div&gt;&lt;/li&gt;
            &lt;li&gt;&lt;div&gt;Generate the yarn.lock file&lt;/div&gt;&lt;/li&gt;
          &lt;/ul&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            First, let’s create a new app if you don&amp;#x27;t have one already
            using Adobe&amp;#x27;s archetype. Make sure you define the appTitle,
            appId, and groupId:
            &lt;div&gt;
              &lt;div&gt;
                &lt;div&gt;Unix-like Shells&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \
 -D archetypeGroupId=com.adobe.aem \
 -D archetypeArtifactId=aem-project-archetype \
 -D archetypeVersion=48 \
 -D appTitle=&amp;quot;AEM using Yarn&amp;quot; \
 -D appId=&amp;quot;aem-yarn&amp;quot; \
 -D groupId=&amp;quot;com.usingyarn&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Mac&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate \
 -D archetypeGroupId=com.adobe.aem \
 -D archetypeArtifactId=aem-project-archetype \
 -D archetypeVersion=48 \
 -D appTitle=&amp;quot;AEM using Yarn&amp;quot; \
 -D appId=&amp;quot;aem-yarn&amp;quot; \
 -D groupId=&amp;quot;com.usingyarn&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate ^
 -D archetypeGroupId=com.adobe.aem ^
 -D archetypeArtifactId=aem-project-archetype ^
 -D archetypeVersion=48 ^
 -D appTitle=&amp;quot;AEM using Yarn&amp;quot; ^
 -D appId=&amp;quot;aem-yarn&amp;quot; ^
 -D groupId=&amp;quot;com.usingyarn&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows PowerShell&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;mvn -B org.apache.maven.plugins:maven-archetype-plugin:3.2.1:generate `
 -D archetypeGroupId=com.adobe.aem `
 -D archetypeArtifactId=aem-project-archetype `
 -D archetypeVersion=48 `
 -D appTitle=&amp;quot;AEM using Yarn&amp;quot; `
 -D appId=&amp;quot;aem-yarn&amp;quot; `
 -D groupId=&amp;quot;com.usingyarn&amp;quot;&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            After generating the app, open the root pom.xml file and replace all
            instances of the word npm with yarn. The first instance should be
            the npm version:
            &lt;div&gt;
              &lt;div&gt;Change npm to yarn&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;yarnVersion&amp;gt;v1.22.22&amp;lt;/yarnVersion&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Go to npmjs.com, search for Yarn, and select the desired version. In
            this case, use the latest version available, and remember to prefix
            it with a &amp;#x27;v&amp;#x27;:
            &lt;div&gt;
              &lt;a
                href=&quot;https://www.npmjs.com/package/yarn?activeTab=versions&quot;
                target=&quot;_blank&quot;
                &gt;Yarn Versions&lt;/a
              &gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Continue replacing instances of npm with yarn throughout the file.
            Ensure the arguments configuration for the execution with id
            &amp;quot;yarn ci&amp;quot; reflects the change:
            &lt;div&gt;
              &lt;div&gt;Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;arguments&amp;gt;install --frozen-lockfile&amp;lt;/arguments&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            com.github.eirslett frontend-maven-plugin configurations using Yarn:
            &lt;div&gt;
              &lt;div&gt;Plugin Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;com.github.eirslett&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;frontend-maven-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;version&amp;gt;${frontend-maven-plugin.version}&amp;lt;/version&amp;gt;
  &amp;lt;configuration&amp;gt;
    &amp;lt;nodeVersion&amp;gt;v16.17.0&amp;lt;/nodeVersion&amp;gt;
    &amp;lt;yarnVersion&amp;gt;v1.22.22&amp;lt;/yarnVersion&amp;gt;
  &amp;lt;/configuration&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;install node and yarn&amp;lt;/id&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;install-node-and-yarn&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;yarn ci&amp;lt;/id&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;yarn&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;install --frozen-lockfile&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Next, navigate to the ui.frontend folder and update the pom.xml file
            similarly. Replace npm with yarn in all relevant sections:
            &lt;div&gt;
              &lt;div&gt;Frontend Plugin Configuration&lt;/div&gt;
              &lt;pre&gt;&lt;code class=&quot;xml&quot;&gt;&amp;lt;plugin&amp;gt;
  &amp;lt;groupId&amp;gt;com.github.eirslett&amp;lt;/groupId&amp;gt;
  &amp;lt;artifactId&amp;gt;frontend-maven-plugin&amp;lt;/artifactId&amp;gt;
  &amp;lt;executions&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;yarn run prod&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;yarn&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;run prod&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
    &amp;lt;execution&amp;gt;
      &amp;lt;id&amp;gt;yarn run dev&amp;lt;/id&amp;gt;
      &amp;lt;phase&amp;gt;generate-resources&amp;lt;/phase&amp;gt;
      &amp;lt;goals&amp;gt;
        &amp;lt;goal&amp;gt;yarn&amp;lt;/goal&amp;gt;
      &amp;lt;/goals&amp;gt;
      &amp;lt;configuration&amp;gt;
        &amp;lt;arguments&amp;gt;run dev&amp;lt;/arguments&amp;gt;
      &amp;lt;/configuration&amp;gt;
    &amp;lt;/execution&amp;gt;
  &amp;lt;/executions&amp;gt;
&amp;lt;/plugin&amp;gt;&lt;/code&gt;&lt;/pre&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Finally, build the project and then after the node folder has been
            created, delete the package-lock.json file and run Yarn to generate
            a yarn.lock file:
            &lt;div&gt;
              &lt;div&gt;
                &lt;div&gt;Unix-like Shells&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;./node/yarn/dist/bin/yarn&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Mac&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;./node/yarn/dist/bin/yarn&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows Command Prompt (cmd)&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;./node/yarn/dist/bin/yarn&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
              &lt;div&gt;
                &lt;div&gt;Windows PowerShell&lt;/div&gt;
                &lt;pre&gt;&lt;code class=&quot;powershell&quot;&gt;./node/yarn/dist/bin/yarn&lt;/code&gt;&lt;/pre&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;/li&gt;
        &lt;li class=&quot;section-&quot;&gt;
          &lt;div&gt;
            Congrats! You have successfully configured your AEM project to use
            Yarn instead of npm. Now you can push this code into your
            repository.
          &lt;/div&gt;
        &lt;/li&gt;
      &lt;/ul&gt;
      &lt;div&gt;
        &lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;
          &gt;AEM Project Archetype on GitHub&lt;/a
        &gt;
      &lt;/div&gt;
      &lt;div&gt;
        &lt;a
          href=&quot;https://stackoverflow.com/questions/58482655/what-is-the-closest-to-npm-ci-in-yarn&quot;
          target=&quot;_blank&quot;
          &gt;npm ci equivalent in Yarn&lt;/a
        &gt;
      &lt;/div&gt;
    &lt;/main&gt;</content><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/7406859670020539424'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/7406859670020539424'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2024/06/aem-using-yarn.html' title='AEM - Switching from NPM to Yarn in your AEM Application'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/kJm0G0_j6fE/default.jpg" height="72" width="72"/></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-1950226387166727910</id><published>2020-10-12T15:34:00.001-07:00</published><updated>2020-10-12T15:34:51.102-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>JavaScript ES6 Features - Computed Property Names</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/Gq6nXkaxCxI/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/Gq6nXkaxCxI/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/Gq6nXkaxCxI?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/Gq6nXkaxCxI/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            Sometimes you may want to initialize an object by setting the property names dynamically using strings
            defined somewhere else. You can use the ES6’s Computed property names for this, in this quick tips episode,
            you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have a browser like Chrome, Edge or Firefox installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Using Computed Property Names in Javascript&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Initialize and Object with a computed property name

                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;const fieldName = &#39;creature&#39;;

let myObject = {
  [fieldName]: &#39;🐉&#39;
};
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Getting the values from the object using the dot or the bracket notation

                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;console.log(myObject.creature);
console.log(myObject[fieldName]);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        A more complex example of computed property names
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;let stuff = {
  [&#39;food&#39; + 1]: &#39;🍌&#39;,
  [&#39;something&#39;.toUpperCase() + 1 + &#39;_function&#39; + 2]: () =&gt; &#39;🏺&#39;
}

console.log(stuff.food1);
console.log(stuff.SOMETHING1_function2());
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Defining Class methods and getters or setters using computed property names
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;const aDynamicMethodName = &#39;weirdHuh&#39;,
      aDynamicPropertyName = &#39;something&#39;;

class SomethinInteresting {
  [aDynamicMethodName]() {
    console.log(&#39;Interesting way of naming methods&#39;);
  }

  get [aDynamicPropertyName]() {
    return &#39;a dynamic getter name is born!&#39;;
  }
}
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        Calling the methods or getters using the dot or the bracket notation
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;const myNewObject = new SomethinInteresting();

myNewObject[aDynamicMethodName]();
myNewObject.something;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a
                      href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Object_initializer#Computed_property_names&quot;
                      target=&quot;_blank&quot;&gt;JavaScript: Computed Property Names&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Classes&quot;
                      target=&quot;_blank&quot;&gt;Javascript: Classes&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/1950226387166727910/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/10/javascript-es6-computed-property-names.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1950226387166727910'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1950226387166727910'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/10/javascript-es6-computed-property-names.html' title='JavaScript ES6 Features - Computed Property Names'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/Gq6nXkaxCxI/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-562379244481241801</id><published>2020-09-28T17:58:00.002-07:00</published><updated>2020-09-28T17:58:59.508-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>Exposing Reactjs component methods to Javascript or non-reactjs applications</title><content type='html'>&lt;!doctype html&gt;
&lt;html data-n-head-ssr&gt;

&lt;head&gt;
  &lt;title&gt;blog-static-generator-new&lt;/title&gt;
  &lt;meta data-n-head=&quot;ssr&quot; charset=&quot;utf-8&quot;&gt;
  &lt;meta data-n-head=&quot;ssr&quot; name=&quot;viewport&quot; content=&quot;width=device-width,initial-scale=1&quot;&gt;
  &lt;meta data-n-head=&quot;ssr&quot; data-hid=&quot;description&quot; name=&quot;description&quot;
    content=&quot;to run and create the post npm run dev then&quot;&gt;
  &lt;link data-n-head=&quot;ssr&quot; rel=&quot;icon&quot; type=&quot;image/x-icon&quot; href=&quot;/favicon.ico&quot;&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;/_nuxt/runtime.56865d4.js&quot; as=&quot;script&quot;&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;/_nuxt/commons.app.9f66399.js&quot; as=&quot;script&quot;&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;/_nuxt/app.ceb3ff4.js&quot; as=&quot;script&quot;&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;/_nuxt/pages_006-reactjs_003-QT-expose-react-component-2-js.5038fef.js&quot; as=&quot;script&quot;&gt;
  &lt;link rel=&quot;preload&quot;
    href=&quot;/_nuxt/vendors.pages_000-template.pages_001-docker_005-aem-instances.pages_001-docker_006-selenium-grid.pag.90ce5e8e.5876425.js&quot;
    as=&quot;script&quot;&gt;
  &lt;style data-vue-ssr-id=&quot;7e56e4e3:0 56b15182:0 65d6326a:0 46794f71:0 49d66da3:0&quot;&gt;
    .nuxt-progress {
      position: fixed;
      top: 0;
      left: 0;
      right: 0;
      height: 2px;
      width: 0;
      opacity: 1;
      transition: width .1s, opacity .4s;
      background-color: #000;
      z-index: 999999
    }

    .nuxt-progress.nuxt-progress-notransition {
      transition: none
    }

    .nuxt-progress-failed {
      background-color: red
    }

    html {
      font-family: Source Sans Pro, -apple-system, BlinkMacSystemFont, Segoe UI, Roboto, Helvetica Neue, Arial, sans-serif;
      font-size: 16px;
      word-spacing: 1px;
      -ms-text-size-adjust: 100%;
      -webkit-text-size-adjust: 100%;
      -moz-osx-font-smoothing: grayscale;
      -webkit-font-smoothing: antialiased;
      box-sizing: border-box
    }

    *,
    :after,
    :before {
      box-sizing: border-box;
      margin: 0
    }

    .button--green {
      display: inline-block;
      border-radius: 4px;
      border: 1px solid #3b8070;
      color: #3b8070;
      text-decoration: none;
      padding: 10px 30px
    }

    .button--green:hover {
      color: #fff;
      background-color: #3b8070
    }

    .button--grey {
      display: inline-block;
      border-radius: 4px;
      border: 1px solid #35495e;
      color: #35495e;
      text-decoration: none;
      padding: 10px 30px;
      margin-left: 15px
    }

    .button--grey:hover {
      color: #fff;
      background-color: #35495e
    }

    .code-segment {
      margin: 0
    }

    .ordered-listicle {
      padding: 0;
      list-style-type: none
    }

    .ordered-listicle .ordered-list-item {
      position: relative
    }

    .ordered-listicle .ordered-list-item .ordered-list-body {
      padding-left: 60px
    }

    .ordered-listicle .ordered-list-item .ordered-list-body .ordered-list-title {
      margin: 0;
      padding: 0;
      font-size: 2rem
    }

    .ordered-listicle .ordered-list-item .ordered-list-text {
      color: #ccc;
      font: 700 italic 45px/1.5 Helvetica, Verdana, sans-serif;
      position: absolute
    }

    .information-section {
      list-style-type: none;
      margin: 0;
      padding: 0
    }
  &lt;/style&gt;
  &lt;link rel=&quot;preload&quot; href=&quot;/_nuxt/static/1601340802/006-reactjs/003-QT-expose-react-component-2-js/payload.js&quot;
    as=&quot;script&quot;&gt;
&lt;/head&gt;

&lt;body&gt;
  &lt;div data-server-rendered=&quot;true&quot; id=&quot;__nuxt&quot;&gt;
    &lt;!----&gt;
    &lt;div id=&quot;__layout&quot;&gt;
      &lt;div&gt;
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/rsuI8IaN_jc/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/rsuI8IaN_jc/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/rsuI8IaN_jc?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/rsuI8IaN_jc/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            If you want to integrate your javascript or non-reactjs application with a reactjs app and be able to access
            reactjs components and call their methods to execute actions or get information out of them, in this quick
            tips episode, you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Exposing React JS to Javascript or non-reactjs applications&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        For a component created using classes you just need to add a ref attribute when including the
                        component:
                        &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&amp;lt;ComponentName ref={(componentReference) =&gt; {window.componentReference = componentReference}}/&gt;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        If it is a component created using functions then, you would also need: to import forwardRef and
                        useImperativeHandle
                        &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;import React, { useState, forwardRef, useImperativeHandle } from &#39;react&#39;;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Use forwardRef when defining the functional component:
                        &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const YourFunctionalComponent = forwardRef((props, ref) =&gt; {
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Finally, inside the useImperativeHandle hook, you need to define the methods you need to expose:
                        &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;useImperativeHandle(ref, () =&gt; ({
    methodToExpose(name) {
        //Some code here!
    }
}));
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/expose-reactjs-component&quot; target=&quot;_blank&quot;&gt;Github link for the
                      code&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/&quot; target=&quot;_blank&quot;&gt;React.js&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/create-a-new-react-app.html&quot; target=&quot;_blank&quot;&gt;Create a New React
                      App&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  &lt;script&gt;window.__NUXT__ = { staticAssetsBase: &quot;/_nuxt/static/1601340802&quot;, layout: &quot;default&quot;, error: null, serverRendered: !0, routePath: &quot;/006-reactjs/003-QT-expose-react-component-2-js&quot;, config: {} }&lt;/script&gt;
  &lt;script src=&quot;/_nuxt/runtime.56865d4.js&quot; defer&gt;&lt;/script&gt;
  &lt;script src=&quot;/_nuxt/pages_006-reactjs_003-QT-expose-react-component-2-js.5038fef.js&quot; defer&gt;&lt;/script&gt;
  &lt;script
    src=&quot;/_nuxt/vendors.pages_000-template.pages_001-docker_005-aem-instances.pages_001-docker_006-selenium-grid.pag.90ce5e8e.5876425.js&quot;
    defer&gt;&lt;/script&gt;
  &lt;script src=&quot;/_nuxt/commons.app.9f66399.js&quot; defer&gt;&lt;/script&gt;
  &lt;script src=&quot;/_nuxt/app.ceb3ff4.js&quot; defer&gt;&lt;/script&gt;
&lt;/body&gt;

&lt;/html&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/562379244481241801/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/09/exposing-reactjs-components.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/562379244481241801'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/562379244481241801'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/09/exposing-reactjs-components.html' title='Exposing Reactjs component methods to Javascript or non-reactjs applications'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/rsuI8IaN_jc/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-5930485600155940875</id><published>2020-09-14T16:48:00.001-07:00</published><updated>2020-09-14T16:48:54.653-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="docker"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to test your application for XSS vulnerabilities using XSStrike</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/qy1bnrxsv8o/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/qy1bnrxsv8o/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/qy1bnrxsv8o?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/qy1bnrxsv8o/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            When testing an application for XSS vulnerabilities it can be sometimes hard to come up with a successful
            attack and test multiple alternatives. You can use an app like XSStrike to automate this, in this quick tips
            episode, you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed for the sample
                        app&lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;Have Docker installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Using XSStrike&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Create the dockerfile with xsstrike
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;FROM continuumio/anaconda3

WORKDIR /workdir

RUN apt-get install -y unzip

ADD https://github.com/s0md3v/XSStrike/archive/master.zip ./

RUN unzip master.zip &amp;&amp; \
    rm master.zip

RUN conda config --append channels conda-forge &amp;&amp; \
    conda install fuzzywuzzy requests

ENTRYPOINT [&quot;python&quot;, &quot;./XSStrike-master/xsstrike.py&quot;]
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Build the image
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker build -t xsstrike .
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Run xsstrike to check options
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -it --rm --name xsstrike xsstrike
&lt;/code&gt;&lt;/pre&gt;
                        Run xsstrike to test against the vulnerable app from the video
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -it --rm --name xsstrike xsstrike -u &quot;http://192.168.99.1:3000/?name=testing&quot;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/docker-xsstrike&quot; target=&quot;_blank&quot;&gt;Github link for the code&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/s0md3v/XSStrike&quot; target=&quot;_blank&quot;&gt;XSStrike&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://hub.docker.com/r/continuumio/anaconda3/&quot; target=&quot;_blank&quot;&gt;continuumio/anaconda3 -
                      Docker hub&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://expressjs.com/en/starter/hello-world.html&quot; target=&quot;_blank&quot;&gt;Nodejs Hello world
                      example App&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/5930485600155940875/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/09/pentest-app-xss-using-xsstrike.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/5930485600155940875'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/5930485600155940875'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/09/pentest-app-xss-using-xsstrike.html' title='How to test your application for XSS vulnerabilities using XSStrike'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/qy1bnrxsv8o/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-4043830584400935078</id><published>2020-09-07T16:27:00.000-07:00</published><updated>2020-09-07T16:27:02.136-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="docker"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to test your application for XSS vulnerabilities using XSSer</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/EQsk7OpOY8A/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/EQsk7OpOY8A/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/EQsk7OpOY8A?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/EQsk7OpOY8A/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            When testing an application for XSS vulnerabilities it can be sometimes hard to come up with a successful
            attack and test multiple alternatives. You can use an app like XSSer to automate this, in this quick tips
            episode, you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed for the sample
                        app&lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;Have Docker installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Using XSSer&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Create the dockerfile with xsser
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;FROM kalilinux/kali-rolling

WORKDIR /workdir

RUN apt-get update &amp;&amp; \
    apt-get install -y xsser

ENTRYPOINT [&quot;xsser&quot;]
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Build the image
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker build -t xsser .
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Run xsser to check options
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -it --rm --name xsser xsser
&lt;/code&gt;&lt;/pre&gt;
                        Run xsser to test against the vulnerable app from the video
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -it --rm --name xsser xsser -u &quot;http://192.168.99.1:3000/?name=XSS&quot;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/docker-xsser&quot; target=&quot;_blank&quot;&gt;Github link for the code&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/epsylon/xsser&quot; target=&quot;_blank&quot;&gt;XSSer&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://hub.docker.com/r/kalilinux/kali-rolling/&quot; target=&quot;_blank&quot;&gt;kalilinux/kali-rolling
                      - Docker hub&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://expressjs.com/en/starter/hello-world.html&quot; target=&quot;_blank&quot;&gt;Nodejs Hello world
                      example App&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/4043830584400935078/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/09/pentest-app-xss-using-xsser.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4043830584400935078'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4043830584400935078'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/09/pentest-app-xss-using-xsser.html' title='How to test your application for XSS vulnerabilities using XSSer'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/EQsk7OpOY8A/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-2651487531653174518</id><published>2020-08-31T16:58:00.001-07:00</published><updated>2020-08-31T16:58:37.363-07:00</updated><title type='text'>Creating a Local Private NPM registry using Verdaccio</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/dYE9vc8KtE4/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/dYE9vc8KtE4/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/dYE9vc8KtE4?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/dYE9vc8KtE4/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            If you want to be able to publish npm packages to a local npm registry so that they can be used and tested,
            either before publishing them to a remote one or because npm link or even yalc are not working for you or if
            you just need a really easy to use and install private npm registry, in this quick tips episode, you will
            learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;Have Docker installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Using Verdaccio as a local Private NPM registry&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Download Verdaccio’s image
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker pull verdaccio/verdaccio
&lt;/code&gt;&lt;/pre&gt;

                        Start the container
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -it --rm --name verdaccio -p 4873:4873 verdaccio/verdaccio
&lt;/code&gt;&lt;/pre&gt;

                        Open the server in the browser
                        &lt;a href=&quot;http://localhost:4873/&quot; target=&quot;_blank&quot;&gt;http://localhost:4873/&lt;/a&gt;&lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Add the user into Verdaccio:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm adduser --registry http://localhost:4873
&lt;/code&gt;&lt;/pre&gt;

                        For publishing a package into Verdaccio use:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm publish --registry http://localhost:4873
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        For downloading the nodejs library, either, create a &#39;.npmrc&#39; at the root of your nodejs
                        application:
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;registry=http://localhost:4873/
&lt;/code&gt;&lt;/pre&gt;

                        Or set the new private registry globally:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm set registry http://localhost:4873/
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        After that, as always use npm or yarn to install the package:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install LIBRARY-NAME
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/testing-local-npm-registry&quot; target=&quot;_blank&quot;&gt;Github link for
                      the code&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://hub.docker.com/r/verdaccio/verdaccio/&quot; target=&quot;_blank&quot;&gt;Verdaccio - Docker
                      Hub&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://verdaccio.org/en/&quot; target=&quot;_blank&quot;&gt;Verdaccio&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/2651487531653174518/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/08/creating-local-private-npm-registry-verdaccio.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2651487531653174518'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2651487531653174518'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/08/creating-local-private-npm-registry-verdaccio.html' title='Creating a Local Private NPM registry using Verdaccio'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/dYE9vc8KtE4/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-3948517477822306560</id><published>2020-08-24T16:40:00.000-07:00</published><updated>2020-08-24T16:40:22.855-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="javascript"/><title type='text'>Javascript Destructuring assignment</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/NkS8m4q_duE?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            Sometimes you have a javascript object and you would like to just populate some variables with its
            properties or pass them as parameters to a function in a quick, clean and easy way or if it’s an array,
            extract its elements without having to use the indexes for each element. You can use the Destructuring
            assignment for this, in this quick tips episode, you will learn how. Above is the vid and below you will
            find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have a browser like Chrome, Edge or Firefox installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Using the Destructuring Assignment&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Object Destructuring
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;let myObject = {
  a: 10,
  b: 20,
  c: 30
}
let { a, b, c } = myObject
console.log(a, b, c);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Object Destructuring for Function Parameters

                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function printValues({ a, b, c }) {
  console.log(a, b, c);
}
printValues(myObject);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Array Destructuring
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;let myArray = [
  40,
  50,
  60
];
let [ d, e, f ] = myArray;
console.log(d, e, f);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Array Destructuring for Function Parameters
                        &lt;pre&gt;&lt;code class=&quot;language-javascript&quot;&gt;function printValues([ d, e, f ]) {
  console.log(d, e, f);
}
printValues(myArray);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://caniuse.com/#search=destructuring&quot; target=&quot;_blank&quot;&gt;Can I Use - JavaScript
                      operator: Destructuring assignment&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a
                      href=&quot;https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Destructuring_assignment&quot;
                      target=&quot;_blank&quot;&gt;Destructuring assignment&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/3948517477822306560/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/08/javascript-destructuring-assignment.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/3948517477822306560'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/3948517477822306560'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/08/javascript-destructuring-assignment.html' title='Javascript Destructuring assignment'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/NkS8m4q_duE/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-6241646080055207985</id><published>2020-08-16T16:04:00.000-07:00</published><updated>2020-08-17T18:02:54.657-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="docker"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to copy files from and to a running Docker container</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/M9aM6Jir-is/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/M9aM6Jir-is/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/M9aM6Jir-is?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/M9aM6Jir-is/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            Sometimes you want to copy files to or from a container that doesn’t have a volume previously created, in
            this quick tips episode, you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have Docker installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Start a Docker container&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        For this video I will be using a Jenkins image as an example, so let’s first download it by
                        using docker pull
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker pull jenkins/jenkins:lts
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Then I will use one of the suggested ways to run the instance and do it in the background. If
                        you don&#39;t use pull first this command will work given that it will also try to download the
                        image if it&#39;s not found locally.
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -d -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        You can check what&#39;s the container id, you can just type docker ps for this
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        for copying something into a docker container we just need to specify which local file or folder
                        to copy, then the container id followed by a colon and the target folder inside the container

                        You can execute a command in a running container with the following:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker cp LOCAL_FILE_OR_FOLDER CONTAINER_ID:TARGET_FOLDER_INSIDE_CONTAINER
&lt;/code&gt;&lt;/pre&gt;

                        If you want to copy the local &quot;./upload/test.txt&quot; file into the &quot;/var/jenkins_home/secrets&quot;
                        folder inside the container, do the following:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker cp ./upload/test.txt CONTAINER_ID:/var/jenkins_home/secrets
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        Finally, for copying something from a container into your local file system, you just need to
                        specify the container id, a colon, the source file or folder inside the container and then the
                        target local folder where the files or folders will be placed


                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker cp CONTAINER_ID:SOURCE_FOLDER_INSIDE_CONTAINER LOCAL_FOLDER
&lt;/code&gt;&lt;/pre&gt;

                        If you want to copy the local &quot;/var/jenkins_home/secrets/initialAdminPassword&quot; file, that is
                        currently inside the container, into your local &quot;.\download\&quot; folder, do the following:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker cp CONTAINER_ID:/var/jenkins_home/secrets/initialAdminPassword .\download\
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://hub.docker.com/r/jenkins/jenkins/&quot; target=&quot;_blank&quot;&gt;Jenkins - Docker Hub&lt;/a&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/6241646080055207985/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/08/how-to-copy-files-from-to-running-docker-container.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6241646080055207985'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6241646080055207985'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/08/how-to-copy-files-from-to-running-docker-container.html' title='How to copy files from and to a running Docker container'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/M9aM6Jir-is/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-2877478379730848404</id><published>2020-08-10T16:03:00.000-07:00</published><updated>2020-08-10T16:03:13.063-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="docker"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to execute a command in running Docker container</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/YMUdfbqsypQ/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/YMUdfbqsypQ/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/YMUdfbqsypQ?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/YMUdfbqsypQ/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            Sometimes you need to run a particular command on a running container perhaps to check where some files are
            located or to see their contents, in this quick tips episode, you will learn how. Above is the vid and below
            you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have Docker installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Start a Docker container&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        For this video I will be using a Jenkins image as an example, so let’s first download it by
                        using docker pull
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker pull jenkins/jenkins:lts
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Then I will use one of the suggested ways to run the instance and do it in the background. If
                        you don&#39;t use pull first this command will work given that it will also try to download the
                        image if it&#39;s not found locally.
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker run -d -p 8080:8080 -p 50000:50000 jenkins/jenkins:lts
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        You can check what&#39;s the container id, you can just type docker ps for this
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker ps
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;

                        You can execute a command in a running container with the following:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker exec -ti CONTAINER_ID COMAND_TO_RUN
&lt;/code&gt;&lt;/pre&gt;

                        To run bash and do stuff inside the container:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker exec -ti CONTAINER_ID  /bin/bash
&lt;/code&gt;&lt;/pre&gt;

                        To print the contents of a file, like the one with the initial password for the jenkins image
                        (/var/jenkins_home/secrets/initialAdminPassword):
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker exec -ti CONTAINER_ID  cat /var/jenkins_home/secrets/initialAdminPassword
&lt;/code&gt;&lt;/pre&gt;

                        To list files and folders:
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;docker exec -ti CONTAINER_ID  ls
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://hub.docker.com/r/jenkins/jenkins/&quot; target=&quot;_blank&quot;&gt;Jenkins - Docker Hub&lt;/a&gt;
                  &lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/2877478379730848404/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/08/how-to-execute-command-in-running-container.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2877478379730848404'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2877478379730848404'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/08/how-to-execute-command-in-running-container.html' title='How to execute a command in running Docker container'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/YMUdfbqsypQ/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-9006848584442921329</id><published>2020-08-03T15:44:00.000-07:00</published><updated>2020-08-03T15:44:48.910-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>Creating a Reactjs Component Using the Styled Components Library</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/LTL_OPkGAKY/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/LTL_OPkGAKY/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/LTL_OPkGAKY?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/LTL_OPkGAKY/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            When you want to use a particular HTML element and define its styles using CSS classes in Reactjs and also
            reuse it elsewhere, it can be helpful to be able to define it as a react component and style it in the same
            file without recurring to inline styling. You can achieve this by using the styled-components library, in
            this quick tips episode, you will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Create the Styled Component&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Create the app using npx create-react-app
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npx create-react-app quick-tips-react-styled-components
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Install the styled-components library
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install --save styled-components
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Start the app
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm start
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Create the styled component HTML element to use by typing styled.HTML-ELEMENT. In this case, I
                        am using an h1 (styled.h1).
                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;import styled from &quot;styled-components&quot;;

const Title = styled.h1`
  color: palevioletred;
  border-left: 5px palevioletred solid;
  padding-left: 5px;
`;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        Use the new component in the same way you would for the type of styled component that you
                        selected (h1 in this case).
                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&amp;lt;Title&gt;
    This is the styled Title
&amp;lt;/Title&gt;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/quick-tips-react-styled-components&quot; target=&quot;_blank&quot;&gt;Github
                      link for the code&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/&quot; target=&quot;_blank&quot;&gt;React.js&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/create-a-new-react-app.html&quot; target=&quot;_blank&quot;&gt;Create a New React
                      App&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://styled-components.com/&quot; target=&quot;_blank&quot;&gt;Styled Components&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://medium.com/styled-components/why-styled-components-2deeed757cfa&quot;
                      target=&quot;_blank&quot;&gt;Why styled-components? 💅&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/9006848584442921329/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/07/reactjs-component-using-styled.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/9006848584442921329'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/9006848584442921329'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/07/reactjs-component-using-styled.html' title='Creating a Reactjs Component Using the Styled Components Library'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/LTL_OPkGAKY/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-6574797754309091119</id><published>2020-07-27T16:26:00.000-07:00</published><updated>2020-07-27T16:26:12.803-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>Creating a Reactjs Component that Renders Nested Children Components Inside</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/NkS8m4q_duE?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/NkS8m4q_duE/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            If you want to pass some nested HTML elements or components to be rendered in a specific place by a parent
            component in react.js and create some reusable components that define the surrounding structure like
            defining a generic dialog or modal component to wrap arbitrary elements in, in this quick tips episode, you
            will learn how. Above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Rendering a Nested Component in React.js&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Create the app using npx create-react-app
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npx create-react-app quick-tips-react-children
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        Start the app
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm start
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Create the parent component using the children property

                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;import React from &#39;react&#39;;

const ParentComponent = (props) =&gt; {
    return (
        &amp;lt;div&gt;
            &amp;lt;p&gt;Parent component&amp;lt;/p&gt;
            {props.children}
            &amp;lt;p&gt;After children content&amp;lt;/p&gt;
        &amp;lt;/div&gt;
    );
};

export default ParentComponent;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Use the parent component and nest some components inside it

                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;&amp;lt;ParentComponent&gt;
    &amp;lt;a
        className=&quot;App-link&quot;
        href=&quot;https://reactjs.org&quot;
        target=&quot;_blank&quot;
        rel=&quot;noopener noreferrer&quot;&gt;
        Learn React
    &amp;lt;/a&gt;
&amp;lt;/ParentComponent&gt;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/quick-tips-react-children&quot; target=&quot;_blank&quot;&gt;Github link for the
                      code&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/&quot; target=&quot;_blank&quot;&gt;React.js&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/create-a-new-react-app.html&quot; target=&quot;_blank&quot;&gt;Create a New React
                      App&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/composition-vs-inheritance.html&quot; target=&quot;_blank&quot;&gt;Composition vs
                      Inheritance&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/6574797754309091119/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/07/reactjs-nested-children-component.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6574797754309091119'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6574797754309091119'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/07/reactjs-nested-children-component.html' title='Creating a Reactjs Component that Renders Nested Children Components Inside'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/NkS8m4q_duE/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-799659942885459251</id><published>2020-07-16T16:56:00.000-07:00</published><updated>2020-07-16T16:56:18.990-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="angularjs"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to configure the Sling Model for the AEM Angularjs component</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/AncUsms-48k/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/AncUsms-48k/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/AncUsms-48k?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/AncUsms-48k/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            In the previous video we saw &lt;a href=&quot;/2020/07/creating-aem-component-using-angularjs.html&quot;
              target=&quot;_blank&quot;&gt;How to create an AEM SPA component using Angularjs&lt;/a&gt;, but we found one problem, whenever
            we made a change we had to refresh the page to see the changes.
            In this second part I will show how to configure the sling model to expose the component&#39;s properties to fix
            the issue, above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or
                        newer.&lt;/div&gt;
                      &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s
                        archetype, you can watch my video about Adobe&#39;s archetype here: &lt;a
                          href=&quot;/2020/06/creating-aem-application-using-adobe-archetype-23.html&quot;
                          target=&quot;_blank&quot;&gt;Creating an AEM Application using Adobe&#39;s archetype version 23 and avoiding
                          typical issues&lt;/a&gt;&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Exposing the model&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Go to your IDE or editor and look for the model inside the core module, the model name is
                        BasicModel and should be located inside the models package
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        First, let’s set the model’s adaptables to SlingHttpServletRequest and import the class

                        &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import org.apache.sling.api.SlingHttpServletRequest;
@Model(adaptables = SlingHttpServletRequest.class)
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Then we need to import and implement the ComponentExporter interface and also define the
                        getExportedType method to return the name for the resource type associated with the basic
                        component

                        &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import com.adobe.cq.export.json.ComponentExporter;
...
public class BasicModel implements ComponentExporter {
    protected static final String BASIC_COMPONENT_RESOURCETYPE = &quot;angularjs-simple-example/components/basic-component&quot;;
    ...

    public String getExportedType() {
        return BASIC_COMPONENT_RESOURCETYPE;
    }

    ...
}
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Finally import ExporterConstants and the Exporter annotation, add the ComponentExporter as an
                        adapter and define the resourceType. For the exporter set the name as SLING_MODEL_EXPORTER_NAME
                        and the extension as SLING_MODEL_EXTENSION.

                        &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import org.apache.sling.models.annotations.Exporter;
import com.adobe.cq.export.json.ExporterConstants;
&lt;/code&gt;&lt;/pre&gt;
                        &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;@Model(adaptables = SlingHttpServletRequest.class,
        adapters = {ComponentExporter.class},
        resourceType = BASIC_COMPONENT_RESOURCETYPE)
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        Let’s build and deploy the app again

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot6&quot;&gt;
                      &lt;div&gt;
                        Go now to the page edit the component make some changes and click save, the changes get
                        reflected right away
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/angularjs-simple-example&quot; target=&quot;_blank&quot;&gt;Repository with the
                      examples&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://augury.rangle.io/&quot; target=&quot;_blank&quot;&gt;Angular Augury&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a
                      href=&quot;https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/adobe/cq/export/json/ComponentExporter.html&quot;
                      target=&quot;_blank&quot;&gt;ComponentExporter Interface&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://helpx.adobe.com/experience-manager/6-3/release-notes/json-exporter-dev-fp.html&quot;
                      target=&quot;_blank&quot;&gt;Enabling JSON Export for a Component&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/799659942885459251/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/07/how-to-configure-sling-model-for-aem-angularjs.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/799659942885459251'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/799659942885459251'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/07/how-to-configure-sling-model-for-aem-angularjs.html' title='How to configure the Sling Model for the AEM Angularjs component'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/AncUsms-48k/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-1042773128525918474</id><published>2020-07-06T17:24:00.000-07:00</published><updated>2020-07-16T16:56:27.096-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="angularjs"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to create an AEM component using Angularjs</title><content type='html'>
      &lt;div&gt;
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/Xd7fsbug24Q/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/Xd7fsbug24Q/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/Xd7fsbug24Q?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/Xd7fsbug24Q/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            If you want to create an AEM app using Angular.js components and add them into a page, in this series, you
            will learn how. Above is the vid and below you will find some useful notes.
            In the second part we will see &lt;a href=&quot;/2020/07/how-to-configure-sling-model-for-aem-angularjs.html&quot; target=&quot;_blank&quot;&gt;How to configure the Sling Model for the AEM Angularjs component&lt;/a&gt;.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or
                        newer.&lt;/div&gt;
                      &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s
                        archetype, you can watch my video about Adobe&#39;s archetype here: &lt;a
                          href=&quot;/2020/06/creating-aem-application-using-adobe-archetype-23.html&quot;
                          target=&quot;_blank&quot;&gt;Creating an AEM Application using Adobe&#39;s archetype version 23 and avoiding
                          typical issues&lt;/a&gt;&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Creating an AEM application with Angular.js support&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        You will need Adobe&#39;s archetype for creating your AEM application with SPA support. The support
                        was added starting from the 23rd version of the archetype.
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        So let’s create the app from scratch. I am providing the most important properties in a single
                        line here given that the other properties will be inferred from them, notice that the
                        frontendModule property was set to angular

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn -B archetype:generate `
    -D archetypeGroupId=com.adobe.granite.archetypes `
    -D archetypeArtifactId=aem-project-archetype `
    -D archetypeVersion=23 `
    -D aemVersion=6.5.0 `
    -D appTitle=&quot;Angularjs Simple Example&quot; `
    -D appId=&quot;angularjs-simple-example&quot; `
    -D groupId=&quot;co.dlighthouse.aem.angularjs.simpleexample&quot; `
    -D frontendModule=angular `
    -D includeExamples=y `
    -D includeDispatcherConfig=n
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        Let’s build and deploy our new app (make sure that you have AEM up and running)
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;AEM component using angularjs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        For creating an AEM component using angular we need at least 4 things, a skeleton AEM component
                        with a dialog, a angular component, an entry importing the component inside the app.module.ts
                        file and a sling model which I’ll be configuring in the next video.
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        I am going to use the yeoman generator for creating the skeleton AEM component for me with some
                        additional example fields in the dialog. I am calling it basic-component and I am making sure
                        that the names for the folders and component group match my current application’s configuration.
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;yo aem-application:aem-component `
    mavenAppsModuleName=ui.apps `
    componentParentPath=angularjs-simple-example/components `
    componentNodeName=basic-component `
    componentName=&quot;Basic Component&quot; `
    componentGroup=&quot;Angularjs Simple Example - Content&quot; `
    mavenBundleModuleName=core `
    javaRootPackageName=co.dlighthouse.aem.angularjs.simpleexample.core `
    javaModelRelativePackageName=models `
    javaModelClassName=BasicModel
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        We should end up with a component inside componentParentPath=angularjs/components called Basic
                        Component, if you check the dialog’s xml file you will find two example fields, one for the text
                        and another for the checkbox.
                        &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;items
  jcr:primaryType=\&quot;nt:unstructured\&quot;&gt;
    &amp;lt;text
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/coral/foundation/form/textfield\&quot;
        fieldLabel=\&quot;Text\&quot;
        name=\&quot;./text\&quot;/&gt;
    &amp;lt;checkbox
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/coral/foundation/form/checkbox\&quot;
        text=\&quot;Checkbox\&quot;
        uncheckedValue=\&quot;false\&quot;
        value=\&quot;true\&quot;
        name=\&quot;./checkbox\&quot;/&gt;
    &amp;lt;checkboxType
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/foundation/form/hidden\&quot;
        name=\&quot;./checkbox@TypeHint\&quot;
        value=\&quot;Boolean\&quot;/&gt;
&amp;lt;/items&gt;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Before creating the component make sure that you have the Angular command-line interface (CLI)
                        by first installing it in your computer

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install -g @angular/cli
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        Use the Angular.js CLI to create the component inside the components folder.

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;ng generate component components/basic-component
&lt;/code&gt;&lt;/pre&gt;

                        In the ui.frontend module you will find the Angular.js components inside the src/app/components
                        folder. Add the imports for the Input annotation object from the angular/core library and the
                        MapTo helper from adobe.

                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;import { Component, Input, OnInit } from &#39;@angular/core&#39;;
import { MapTo } from &#39;@adobe/cq-angular-editable-components&#39;;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot6&quot;&gt;
                      &lt;div&gt;
                        Create an editconfig obj which will be used for displaying some text when the component is
                        empty, in this case given that the component’s properties like the ones defined on the dialog
                        are available through the angular’s cqModel object we can just check if cqModel.text doesn’t
                        have a value so that we can mark this component as empty
                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;const BasicComponentEditConfig = {
  emptyLabel: &#39;Basic Component&#39;,
  isEmpty: cqModel =&gt;
    !cqModel || !cqModel.text || cqModel.text.trim().length &amp;lt; 1
};
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot7&quot;&gt;
                      &lt;div&gt;
                        Then we have the component which looks like a typical angular component. Here we declare that we
                        are going to receive the text and checkbox properties.
                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;
export class BasicComponentComponent implements OnInit {
  @Input() text: string;
  @Input() checkbox: boolean;
...
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot8&quot;&gt;
                      &lt;div&gt;
                        Finally we call the MapTo helper function that maps the angular component to a particular
                        resourceType inside AEM so that aem knows which angular component to use when rendering our page

                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;MapTo(&#39;angularjs-simple-example/components/basic-component&#39;)(
  BasicComponentComponent,
  BasicComponentEditConfig
);
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot9&quot;&gt;
                      &lt;div&gt;
                        Then inside the app.module.ts file we just add an entry into the entryComponents array given
                        that the basic component is added dynamically.

                        &lt;pre&gt;&lt;code class=&quot;language-ts&quot;&gt;
@NgModule({
  ...
  entryComponents: [TextComponent, PageComponent, BasicComponentComponent],
  ...
})
export class AppModule {}
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot10&quot;&gt;
                      &lt;div&gt;
                        Build and deploy the application again

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/angularjs-simple-example&quot; target=&quot;_blank&quot;&gt;Repository with the
                      examples&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s Archetype&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype/releases&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s
                      Archetype Releases&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;
      &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/1042773128525918474/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/07/creating-aem-component-using-angularjs.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1042773128525918474'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1042773128525918474'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/07/creating-aem-component-using-angularjs.html' title='How to create an AEM component using Angularjs'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/Xd7fsbug24Q/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-4927672864224105401</id><published>2020-06-22T16:45:00.000-07:00</published><updated>2020-06-22T16:45:20.323-07:00</updated><title type='text'>Creating an AEM Application using Adobe&#39;s archetype version 23</title><content type='html'>
        &lt;div&gt;
          &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt; &lt;img
            src=&quot;https://i.ytimg.com/vi/lbDApnZDI9I/0.jpg&quot; style=&quot;display:none&quot;&gt;
          &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
              data-thumbnail-src=&quot;https://i.ytimg.com/vi/lbDApnZDI9I/0.jpg&quot; frameborder=&quot;0&quot;
              src=&quot;https://www.youtube.com/embed/lbDApnZDI9I?feature=player_embedded&quot;
              class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;&gt;&lt;/iframe&gt; &lt;img
              src=&quot;https://i.ytimg.com/vi/lbDApnZDI9I/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
          &lt;div&gt;
            In this tutorial, I will show how to use Adobe&#39;s archetype to create an AEM application using version
            23rd and up, above is the vid and below you will find some useful notes.
          &lt;/div&gt;
          &lt;ol class=&quot;ordered-listicle&quot;&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Pre-reqs&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.3 Service Pack 3,
                        AEM 6.4 or AEM 6.5&lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Creating an AEM application using archetype version 23&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;ul class=&quot;undefined information-section&quot;&gt;
                    &lt;li class=&quot;section-slot1&quot;&gt;
                      &lt;div&gt;
                        Look for the .m2 folder inside your user for your particular Operating System
                        (C:\Users\YOUR-USERNAME\.m2\settings.xml for Windows or ~/.m2/settings.xml for Linux or Mac) and
                        create or edit the settings.xml file inside that folder.
                        &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;settings xmlns=&quot;https://maven.apache.org/SETTINGS/1.0.0&quot; xmlns:xsi=&quot;https://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation=&quot;https://maven.apache.org/SETTINGS/1.0.0
                      https://maven.apache.org/xsd/settings-1.0.0.xsd&quot;&gt;
    &amp;lt;profiles&gt;
        &amp;lt;!-- ====================================================== --&gt;
        &amp;lt;!-- A D O B E   P U B L I C   P R O F I L E                --&gt;
        &amp;lt;!-- ====================================================== --&gt;
        &amp;lt;profile&gt;
            &amp;lt;id&gt;adobe-public&amp;lt;/id&gt;
            &amp;lt;activation&gt;
                &amp;lt;activeByDefault&gt;true&amp;lt;/activeByDefault&gt;
            &amp;lt;/activation&gt;
            &amp;lt;properties&gt;
                &amp;lt;releaseRepository-Id&gt;adobe-public-releases&amp;lt;/releaseRepository-Id&gt;
                &amp;lt;releaseRepository-Name&gt;Adobe Public Releases&amp;lt;/releaseRepository-Name&gt;
                &amp;lt;releaseRepository-URL&gt;https://repo.adobe.com/nexus/content/groups/public&amp;lt;/releaseRepository-URL&gt;
            &amp;lt;/properties&gt;
            &amp;lt;repositories&gt;
                &amp;lt;repository&gt;
                    &amp;lt;id&gt;adobe-public-releases&amp;lt;/id&gt;
                    &amp;lt;name&gt;Adobe Public Repository&amp;lt;/name&gt;
                    &amp;lt;url&gt;https://repo.adobe.com/nexus/content/groups/public&amp;lt;/url&gt;
                    &amp;lt;releases&gt;
                        &amp;lt;enabled&gt;true&amp;lt;/enabled&gt;
                        &amp;lt;updatePolicy&gt;never&amp;lt;/updatePolicy&gt;
                    &amp;lt;/releases&gt;
                    &amp;lt;snapshots&gt;
                        &amp;lt;enabled&gt;false&amp;lt;/enabled&gt;
                    &amp;lt;/snapshots&gt;
                &amp;lt;/repository&gt;
            &amp;lt;/repositories&gt;
            &amp;lt;pluginRepositories&gt;
                &amp;lt;pluginRepository&gt;
                    &amp;lt;id&gt;adobe-public-releases&amp;lt;/id&gt;
                    &amp;lt;name&gt;Adobe Public Repository&amp;lt;/name&gt;
                    &amp;lt;url&gt;https://repo.adobe.com/nexus/content/groups/public&amp;lt;/url&gt;
                    &amp;lt;releases&gt;
                        &amp;lt;enabled&gt;true&amp;lt;/enabled&gt;
                        &amp;lt;updatePolicy&gt;never&amp;lt;/updatePolicy&gt;
                    &amp;lt;/releases&gt;
                    &amp;lt;snapshots&gt;
                        &amp;lt;enabled&gt;false&amp;lt;/enabled&gt;
                    &amp;lt;/snapshots&gt;
                &amp;lt;/pluginRepository&gt;
            &amp;lt;/pluginRepositories&gt;
        &amp;lt;/profile&gt;
    &amp;lt;/profiles&gt;
    &amp;lt;activeProfiles&gt;
        &amp;lt;activeProfile&gt;adobe-public&amp;lt;/activeProfile&gt;
    &amp;lt;/activeProfiles&gt;
&amp;lt;/settings&gt;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot2&quot;&gt;
                      &lt;div&gt;
                        With the 23rd version of the archetype&#39;s release there have been many changes to the properties
                        that you can use to configure how the new AEM app is going to be generated.
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot3&quot;&gt;
                      &lt;div&gt;
                        So let’s create the app from scratch. I am providing the most important properties in a single
                        line here given that the other properties will be inferred from them.

                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn -B archetype:generate &quot;-DarchetypeGroupId=com.adobe.granite.archetypes&quot; &quot;-DarchetypeArtifactId=aem-project-archetype&quot; &quot;-DarchetypeVersion=23&quot; &quot;-DaemVersion=6.5.0&quot; &quot;-DappTitle=First App Example&quot; &quot;-DappId=first-app&quot; &quot;-DgroupId=co.dlighthouse.aem.firstapp&quot; &quot;-DfrontendModule=none&quot; &quot;-DincludeExamples=y&quot; &quot;-DincludeDispatcherConfig=n&quot;
&lt;/code&gt;&lt;/pre&gt;

                        PowerShell
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn -B archetype:generate `
  -D archetypeGroupId=com.adobe.granite.archetypes `
  -D archetypeArtifactId=aem-project-archetype `
  -D archetypeVersion=23 `
  -D aemVersion=6.5.0 `
  -D appTitle=&quot;First App Example&quot; `
  -D appId=&quot;first-app&quot; `
  -D groupId=&quot;co.dlighthouse.aem.firstapp&quot; `
  -D frontendModule=none `
  -D includeExamples=y `
  -D includeDispatcherConfig=n
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot4&quot;&gt;
                      &lt;div&gt;
                        Let’s build and deploy our new app (make sure that you have AEM up and running)
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                    &lt;li class=&quot;section-slot5&quot;&gt;
                      &lt;div&gt;
                        If you&#39;re using a different port for AEM
                        &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public &quot;-Daem.port=PORT-NUMBER&quot;
&lt;/code&gt;&lt;/pre&gt;
                      &lt;/div&gt;
                    &lt;/li&gt;
                  &lt;/ul&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
            &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
              &lt;div class=&quot;ordered-list-body&quot;&gt;
                &lt;h4 class=&quot;ordered-list-title&quot;&gt;
                  &lt;div&gt;Resources&lt;/div&gt;
                &lt;/h4&gt;
                &lt;div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://helpx.adobe.com/experience-manager/kb/SetUpTheAdobeMavenRepository.html&quot;
                      target=&quot;_blank&quot;&gt;Configuring the settings.xml File with Adobe&#39;s Eepository&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s Archetype&lt;/a&gt;
                  &lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype#available-properties&quot;
                      target=&quot;_blank&quot;&gt;Adobe&#39;s Archetype Available Properties&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype/blob/master/VERSIONS.md&quot;
                      target=&quot;_blank&quot;&gt;AEM Supported Versions&lt;/a&gt;&lt;/div&gt;
                  &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype/releases&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s
                      Archetype Releases&lt;/a&gt;&lt;/div&gt;
                &lt;/div&gt;
              &lt;/div&gt;
            &lt;/li&gt;
          &lt;/ol&gt;
        &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/4927672864224105401/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/06/creating-aem-application-using-adobe-archetype-23.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4927672864224105401'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/4927672864224105401'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/06/creating-aem-application-using-adobe-archetype-23.html' title='Creating an AEM Application using Adobe&#39;s archetype version 23'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/lbDApnZDI9I/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-8263683661762251957</id><published>2020-02-29T07:04:00.000-08:00</published><updated>2020-02-29T07:04:56.032-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="aem/cq5"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><title type='text'>How to Create Feature Toggles in AEM</title><content type='html'>    &lt;div&gt;
      &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/gboApK9EB2U/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/gboApK9EB2U/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/gboApK9EB2U?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/gboApK9EB2U/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In this is a tutorial I&#39;ll show how to configure and create Feature toggles in AEM using sling feature flags,
        above is the vid and below you will find some useful notes.
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or
                    newer.&lt;/div&gt;
                  &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s archetype,
                    you can watch my video about maven here: &lt;a
                      href=&quot;/2019/06/creating-aem-application-using-maven.html&quot; target=&quot;_blank&quot;&gt;Creating an AEM
                      application using Maven and Adobe&#39;s archetype&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Implementing feature toggles in AEM&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    If needed, create the new aem-feature-toggles application by using adobe’s archetype
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate &quot;-DarchetypeGroupId=com.adobe.granite.archetypes&quot; &quot;-DarchetypeArtifactId=aem-project-archetype&quot; &quot;-DarchetypeVersion=19&quot; &quot;-DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/&quot; &quot;-DgroupId=co.dlighthouse.aem.featuretoggles&quot; &quot;-DartifactId=aem-feature-toggles&quot; &quot;-Dversion=0.1.0-SNAPSHOT&quot; &quot;-Dpackage=co.dlighthouse.aem.featuretoggles&quot; &quot;-DappsFolderName=feature-toggles&quot; &quot;-DconfFolderName=feature-toggles&quot; &quot;-DartifactName=Feature Toggles Example&quot; &quot;-DcomponentGroupName=Feature Toggles Example&quot; &quot;-DcontentFolderName=feature-toggles&quot; &quot;-DcssId=feature-toggles&quot; &quot;-DpackageGroup=feature-toggles&quot; &quot;-DsiteName=Feature Toggles Example&quot; &quot;-DoptionAemVersion=6.5.0&quot;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Create a new file named org.apache.sling.featureflags.impl.ConfiguredFeature-someFeature.xml inside
                    your /apps/my-app/config folder
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&amp;lt;jcr:root xmlns:sling=&quot;http://sling.apache.org/jcr/sling/1.0&quot;
    xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot; jcr:primaryType=&quot;sling:OsgiConfig&quot;
    name=&quot;some-feature&quot;
    description=&quot;This is Some Feature&quot;
    enabled=&quot;{Boolean}false&quot;/&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    First, Import the Features interface
                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import org.apache.sling.featureflags.Features;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Inject it into the model by using the OSGiService annotation
                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;@OSGiService
private Features features;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Add the code to enable or disable the new feature
                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;if(features.isEnabled(&quot;some-feature&quot;)) {
    //New functionality that is only enabled when the feature toggle is enabled
}
else {
    //Original functionality that is disabled when the feature toggle is disabled
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    Build and deploy your application
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Configure the Feature Toggle in AEM&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Go to the Felix console(&lt;a href=&quot;http://localhost:4502/system/console/configMgr&quot;
                      target=&quot;_blank&quot;&gt;/system/console/configMgr&lt;/a&gt;), look for ConfiguredFeature then click on the
                    “someFeature”
                    &lt;div&gt;&lt;a
                        href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5FCURFPq6g1aiNIl4BOVVNuTIeRsx2V5qgvUQnsX_epuSrwBM1CUzBOU1qn3PAwnbPX6Pjwf4qhxfZvCWCdJN9BD3tlyuMB8_xhs7sLYw2XFud57SuYa3NoqBFq7_XWLxYlGeRt3DDqE/s1600/004-AEM-003-1-configmgr.png&quot;
                        imageanchor=&quot;1&quot;&gt;&lt;img
                          src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi5FCURFPq6g1aiNIl4BOVVNuTIeRsx2V5qgvUQnsX_epuSrwBM1CUzBOU1qn3PAwnbPX6Pjwf4qhxfZvCWCdJN9BD3tlyuMB8_xhs7sLYw2XFud57SuYa3NoqBFq7_XWLxYlGeRt3DDqE/s1600/004-AEM-003-1-configmgr.png&quot;
                          border=&quot;0&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;720&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
                  &lt;div&gt;
                    Enable the feature toogle and after that check that the new feature is working now
                    &lt;div&gt;&lt;a
                        href=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1gpkYlx7_BV83g7ZcRVKkrEldjPLeajWrKy1YyeKOSOCbzNq_EuDYhBHyDt7vKwy3m-_WC1v2xCW8GTidGfOCtnR8NlrYpgcg20kQ17luQUTHnCbe8ZIgklcQCznf4Kd9wTLEl3NZHpw/s1600/004-AEM-003-2-enable.png&quot;
                        imageanchor=&quot;1&quot;&gt;&lt;img
                          src=&quot;https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1gpkYlx7_BV83g7ZcRVKkrEldjPLeajWrKy1YyeKOSOCbzNq_EuDYhBHyDt7vKwy3m-_WC1v2xCW8GTidGfOCtnR8NlrYpgcg20kQ17luQUTHnCbe8ZIgklcQCznf4Kd9wTLEl3NZHpw/s1600/004-AEM-003-2-enable.png&quot;
                          border=&quot;0&quot; data-original-width=&quot;1280&quot; data-original-height=&quot;720&quot;&gt;&lt;/a&gt;&lt;/div&gt;&lt;br&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/aem-feature-toggles&quot; target=&quot;_blank&quot;&gt;Github link for the code&lt;/a&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://martinfowler.com/articles/feature-toggles.html&quot; target=&quot;_blank&quot;&gt;Feature Toggles (aka
                  Feature Flags) - Martin Fowler&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://www.optimizely.com/optimization-glossary/feature-flags/&quot; target=&quot;_blank&quot;&gt;Feature
                  Flags - Optimizely&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://sling.apache.org/documentation/the-sling-engine/featureflags.html&quot;
                  target=&quot;_blank&quot;&gt;Feature Flags - Sling&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://aemtreasury.wordpress.com/2015/10/20/feature-flags/&quot; target=&quot;_blank&quot;&gt;Feature Flags -
                  aemtreasury&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;http://aemlab.blogspot.com/2018/06/sling-feature-flag.html&quot; target=&quot;_blank&quot;&gt;Sling – Feature
                  Flags in AEM - aemlab&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js&quot;&gt;&lt;/script&gt;
      &lt;script
        src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/8263683661762251957/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/02/how-to-create-feature-toggles-in-aem.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8263683661762251957'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/8263683661762251957'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/02/how-to-create-feature-toggles-in-aem.html' title='How to Create Feature Toggles in AEM'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/gboApK9EB2U/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-1270382324200641235</id><published>2020-02-16T14:46:00.000-08:00</published><updated>2020-02-16T14:46:47.859-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deep learning"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="machine learning"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><category scheme="http://www.blogger.com/atom/ns#" term="tensorflowjs"/><title type='text'>Creating a tensorflow.js + react.js simple application in javascript</title><content type='html'>    &lt;div&gt;
      &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/QJx-rt1T_ec/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/QJx-rt1T_ec/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/QJx-rt1T_ec?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/QJx-rt1T_ec/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In this tutorial I will show how to create a really simple Tensorflow.js model and use it for predicting values
        using React.js, above is the video and below you will find some of the steps followed.
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;React.js&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Reactjs is a javascript framework for building user interfaces which is mostly used for creating
                    Single-Page Applications, I am going to use it to create a simple static but interactive site and
                    then deploy it into github pages.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    First we need to create a React.js app

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npx create-react-app &amp;lt;project-name&gt;
npx create-react-app simple-reactjs-tensorflow
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    Run the app in development mode so that we can make changes in the code and see the results on the
                    browser

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm start
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Start by creating a simple empty component for the TensorflowExample.js (Don&#39;t forget to add it into
                    the App.js file)

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;import React, { useState } from &#39;react&#39;;

const TensorflowExample = () =&gt; {
    return (
        &amp;lt;div className=&quot;tensorflow-example&quot;&gt;
        &amp;lt;/div&gt;
    );
};

export default TensorflowExample;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Install the immutability helper for making changes to the model
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install immutability-helper --save
npm start
&lt;/code&gt;&lt;/pre&gt;

                    Import the immutability helper inside the TensorflowExample.js file
                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;import update from &#39;immutability-helper&#39;;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    We need to keep the state for the value pairs to hold an array of inputs and outputs so that we can
                    train our new model and the state to hold the properties related to the model.

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;//Value pairs state
const [valuePairsState, setValuePairsState] = useState([
    { x: -1, y: -3 },
    { x: 0, y: -1 },
    { x: 1, y: 1 },
    { x: 2, y: 3 },
    { x: 3, y: 5 },
    { x: 4, y: 7 },
]);

//Define the model state
const [modelState, setModelState] = useState({
    model: null,
    trained: false,
    predictedValue: &#39;Click on train!&#39;,
    valueToPredict: 1,
});
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot7&quot;&gt;
                  &lt;div&gt;
                    Add the handlers for managing changes to the inputs and outputs

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;//Event handlers
const handleValuePairChange = (e) =&gt; {
    const updatedValuePairs = update(valuePairsState, {
        [e.target.dataset.index]: {
            [e.target.name]: { $set: parseInt(e.target.value) }
        }
    })

    setValuePairsState(
        updatedValuePairs
    )
};
&lt;/code&gt;&lt;/pre&gt;

                    Adding new items

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const handleAddItem = () =&gt; {
    setValuePairsState([
        ...valuePairsState,
        { x: 1, y: 1 }
    ]);
};
&lt;/code&gt;&lt;/pre&gt;

                    And also changes into the model&#39;s properties

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const handleModelChange = (e) =&gt; setModelState({
    ...modelState,
    [e.target.name]: [parseInt(e.target.value)],
});
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot8&quot;&gt;
                  &lt;div&gt;
                    Add the controls for training the model by iterating over the value pairs properties and rendering a
                    field per input and output. Also create a button for adding new items and another one for training
                    the model.

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&amp;lt;div className=&quot;train-controls&quot;&gt;
    &amp;lt;h2 className=&quot;section&quot;&gt;Training Data (x,y) pairs&amp;lt;/h2&gt;
    &amp;lt;div className=&quot;row labels&quot;&gt;
        &amp;lt;div className=&quot;field-label column&quot;&gt;X&amp;lt;/div&gt;
        &amp;lt;div className=&quot;field-label column&quot;&gt;Y&amp;lt;/div&gt;
    &amp;lt;/div&gt;

    {valuePairsState.map((val, index) =&gt; {
        return (
            &amp;lt;div key={index} className=&quot;row&quot;&gt;
                &amp;lt;input
                    className=&quot;field field-x column&quot;
                    value={val.x}
                    name=&quot;x&quot;
                    data-index={index}
                    onChange={handleValuePairChange}
                    type=&quot;number&quot; pattern=&quot;[0-9]*&quot; /&gt;
                &amp;lt;input
                    className=&quot;field field-y column&quot;
                    value={val.y}
                    name=&quot;y&quot;
                    data-index={index}
                    onChange={handleValuePairChange}
                    type=&quot;number&quot; /&gt;
            &amp;lt;/div&gt;
        );
    })}

    &amp;lt;button
        className=&quot;button-add-example button--green&quot;
        onClick={handleAddItem}&gt;
        +
    &amp;lt;/button&gt;
    &amp;lt;button
        className=&quot;button-train button--green&quot;
        onClick={handleTrainModel}&gt;
        Train
    &amp;lt;/button&gt;
&amp;lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot9&quot;&gt;
                  &lt;div&gt;
                    For the prediction controls create an input field to allow the user to enter a value so that its
                    output can be predicted, a field to show the predicted value and a button to perform the actual
                    prediction which will only be enabled once the model has been trained.
                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;&amp;lt;div className=&quot;predict-controls&quot;&gt;
    &amp;lt;h2 className=&quot;section&quot;&gt;Predicting&amp;lt;/h2&gt;
    &amp;lt;input
        className=&quot;field element&quot;
        value={modelState.valueToPredict}
        name=&quot;valueToPredict&quot;
        onChange={handleModelChange}
        type=&quot;number&quot;
        placeholder=&quot;Enter an integer number&quot; /&gt;&amp;lt;br /&gt;
    &amp;lt;div className=&quot;element&quot;&gt;
        {modelState.predictedValue}
    &amp;lt;/div&gt;
    &amp;lt;button
        className=&quot;element button--green&quot;
        onClick={handlePredict}
        disabled={!modelState.trained}&gt;
        Predict
    &amp;lt;/button&gt;
&amp;lt;/div&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Tensorflow.js&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Tensorflowjs is a javascript library that allows us to train and use machine learning models on the
                    browser and nodejs.

                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Install tensorflowjs
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install --save @tensorflow/tfjs
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;

                    And import it into your react app
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;import * as tf from &#39;@tensorflow/tfjs&#39;;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Add the train handler and create a simple model that just has one layer, one hidden unit and also
                    that will receive just one input. The model will be compiled using the mean squared error loss
                    function, stochastic gradient descent and will run for 250 epochs.

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const handleTrainModel = () =&gt; {
    let xValues = [],
        yValues = [];

    valuePairsState.forEach((val, index) =&gt; {
        xValues.push(val.x);
        yValues.push(val.y);
    });

    // Define a model for linear regression.
    const model = tf.sequential();
    model.add(tf.layers.dense({ units: 1, inputShape: [1] }));

    // Prepare the model for training: Specify the loss and the optimizer.
    model.compile({ loss: &#39;meanSquaredError&#39;, optimizer: &#39;sgd&#39; });
    const xs = tf.tensor2d(xValues, [xValues.length, 1]);
    const ys = tf.tensor2d(yValues, [yValues.length, 1]);

    // Train the model using the data.
    model.fit(xs, ys, { epochs: 250 }).then(() =&gt; {
        setModelState({
            ...modelState,
            model: model,
            trained: true,
            predictedValue: &#39;Ready for making predictions&#39;,
        });
    });
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Add the predict handler and set the predictedValue property to the output from the model given the
                    value to predict provided by the user.

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const handlePredict = () =&gt; {
    // Use the model to do inference on a data point the model hasn&#39;t seen before:
    const predictedValue = modelState.model.predict(tf.tensor2d([modelState.valueToPredict], [1, 1])).arraySync()[0][0];

    setModelState({
        ...modelState,
        predictedValue: predictedValue,
    });
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    Go into the browser, add some more inputs, click on train and try different values.
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Github Pages&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    To publish our code into github pages first make sure that the package.json file has the homepage
                    property set to “.”

                    &lt;pre&gt;&lt;code class=&quot;language-json&quot;&gt;&quot;homepage&quot;: &quot;.&quot;,
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Generate the static site and make sure to create a new repository for your project inside GitHub

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm run build
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    Initialize your local repository for the code, add all the files, commit the code, add the
                    repository so that you can push the code into your repo and finally push the code.

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;git init
git add -A
git commit -m &quot;First version simple tensorflojs + react app&quot;
git remote add origin https://github.com/drginm/simple-reactjs-tensorflow.git
git push origin master
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Create a detached branch with the special name gh-pages

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;git checkout --orphan gh-pages
git status
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Delete everything but the build directory and move its contents to the root of your git’s
                    repository, then again add everything, commit the changes and push them into your new gh-pages
                    branch

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;git add -A
git status
git commit -m &quot;Static site for - simple tensorflojs + react app&quot;
git push origin gh-pages
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    Go into your page by using your github username and the name for the repository we just created and
                    test that the &lt;a href=&quot;https://drginm.github.io/simple-reactjs-tensorflow/&quot;
                      target=&quot;_blank&quot;&gt;application&lt;/a&gt; is working
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;5.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/simple-reactjs-tensorflow&quot; target=&quot;_blank&quot;&gt;Github link for the
                  code&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://create-react-app.dev/docs/deployment/#building-for-relative-paths&quot;
                  target=&quot;_blank&quot;&gt;Building for Relative Paths&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/tensorflow/tfjs-examples/blob/master/getting-started/index.js&quot;
                  target=&quot;_blank&quot;&gt;Simple Tensorflow.js model&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/create-a-new-react-app.html#create-react-app&quot;
                  target=&quot;_blank&quot;&gt;Create a New React App&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/kolodny/immutability-helper&quot; target=&quot;_blank&quot;&gt;Mutate a copy of data
                  without changing the original source with the immutability-helper&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js&quot;&gt;&lt;/script&gt;
      &lt;script
        src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/1270382324200641235/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/02/creating-tensorflowjs-reactjs-js-app.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1270382324200641235'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/1270382324200641235'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/02/creating-tensorflowjs-reactjs-js-app.html' title='Creating a tensorflow.js + react.js simple application in javascript'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/QJx-rt1T_ec/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-3335091889629553286</id><published>2020-02-09T12:22:00.001-08:00</published><updated>2020-07-07T16:16:21.624-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>How to configure the Sling Model for the AEM Reactjs component</title><content type='html'>    &lt;div&gt;
      &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/MXt73EWy8f0/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/MXt73EWy8f0/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/MXt73EWy8f0?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/MXt73EWy8f0/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In the previous video we saw &lt;a href=&quot;/2020/01/creating-aem-component-using-reactjs.html&quot; target=&quot;_blank&quot;&gt;how to
          create an AEM component with react.js support&lt;/a&gt; but we found one problem, whenever we made a change we had
        to refresh the page to see the changes.
        In this second part I will show how to configure the sling model to expose the component&#39;s properties to fix the
        issue, above is the vid and below you will find some useful notes.
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or
                    newer.&lt;/div&gt;
                  &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s archetype,
                    you can watch my video about maven here: &lt;a
                      href=&quot;/2019/06/creating-aem-application-using-maven.html&quot; target=&quot;_blank&quot;&gt;Creating an AEM
                      application using Maven and Adobe&#39;s archetype&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Exposing the model&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Go to your IDE or editor and look for the model inside the core module, the model name is BasicModel
                    and should be located inside the models package
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    First, let’s set the model’s adaptables to SlingHttpServletRequest and import the class

                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import org.apache.sling.api.SlingHttpServletRequest;
@Model(adaptables = SlingHttpServletRequest.class)
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    Then we need to import and implement the ComponentExporter interface and also define the
                    getExportedType method to return the name for the resource type associated with the basic component

                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import com.adobe.cq.export.json.ComponentExporter;
...
public class BasicModel implements ComponentExporter {
    ...

    public String getExportedType() {
        return &quot;react-simple-example/components/basic-component&quot;;
    }

    ...
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Finally import ExporterConstants and the Exporter annotation, add the ComponentExporter as an
                    adapter and define the resourceType. For the exporter set the name as SLING_MODEL_EXPORTER_NAME and
                    the extension as SLING_MODEL_EXTENSION.

                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;import org.apache.sling.models.annotations.Exporter;
import com.adobe.cq.export.json.ExporterConstants;
&lt;/code&gt;&lt;/pre&gt;
                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;@Model(adaptables = SlingHttpServletRequest.class,
        adapters = {ComponentExporter.class},
        resourceType = BASIC_COMPONENT_RESOURCETYPE)
@Exporter(name = ExporterConstants.SLING_MODEL_EXPORTER_NAME, extensions = ExporterConstants.SLING_MODEL_EXTENSION)
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Let’s build and deploy the app again

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    Go now to the page edit the component make some changes and click save, the changes get reflected
                    right away
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/aem-react-simple-example&quot; target=&quot;_blank&quot;&gt;Github link for the
                  code&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://reactjs.org/blog/2015/09/02/new-react-developer-tools.html&quot; target=&quot;_blank&quot;&gt;React
                  Developer Tools&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a
                  href=&quot;https://helpx.adobe.com/experience-manager/6-4/sites/developing/using/reference-materials/javadoc/com/adobe/cq/export/json/ComponentExporter.html&quot;
                  target=&quot;_blank&quot;&gt;ComponentExporter Interface&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://helpx.adobe.com/experience-manager/6-3/release-notes/json-exporter-dev-fp.html&quot;
                  target=&quot;_blank&quot;&gt;Enabling JSON Export for a Component&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js&quot;&gt;&lt;/script&gt;
      &lt;script
        src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/3335091889629553286/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/02/how-to-configure-sling-model-for-aem-react.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/3335091889629553286'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/3335091889629553286'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/02/how-to-configure-sling-model-for-aem-react.html' title='How to configure the Sling Model for the AEM Reactjs component'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/MXt73EWy8f0/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-2293546765135491636</id><published>2020-02-02T16:03:00.000-08:00</published><updated>2020-06-22T15:33:13.226-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="reactjs"/><title type='text'>How to create an AEM component using Reactjs</title><content type='html'>    &lt;div&gt;
      &lt;link href=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/themes/prism.css&quot; rel=&quot;stylesheet&quot;&gt;&lt;img
        src=&quot;https://i.ytimg.com/vi/nec_MDPzMYk/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/nec_MDPzMYk/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/nec_MDPzMYk?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/nec_MDPzMYk/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In this tutorial, I will show how to use use Adobe&#39;s archetype to create an AEM application with React.js
        support and also how to add a new React.js component so that it can be added into a page, above is the vid and
        below you will find some useful notes.
        In the second part we will see &lt;a href=&quot;/2020/02/how-to-configure-sling-model-for-aem-react.html&quot;
          target=&quot;_blank&quot;&gt;how to configure the Sling Model for the AEM React component.&lt;/a&gt;
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have access to an Adobe Experience Manager instance. You will need aem 6.4 Service Pack 2 or
                    newer.&lt;/div&gt;
                  &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s archetype,
                    you can watch my video about maven here: &lt;a
                      href=&quot;/2019/06/creating-aem-application-using-maven.html&quot; target=&quot;_blank&quot;&gt;Creating an AEM
                      application using Maven and Adobe&#39;s archetype&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Creating an AEM application with React.js support&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    You will need Adobe&#39;s archetype for creating your AEM application with SPA support. The support was
                    added starting from the 23rd version of the archetype.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    If the 23rd version is not out yet you will have to clone and compile the archetype locally to be
                    able to use it
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;git clone https://github.com/adobe/aem-project-archetype.git
&lt;/code&gt;&lt;/pre&gt;

                    Change into the new directory and build the archetype
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;cd aem-project-archetype
mvn clean install
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    So let’s create the app from scratch. I am providing the most important properties in a single line
                    here given that the other properties will be inferred from them, notice that the version that I am
                    using is the 23-SNAPSHOT and that optionFrontendModule was set to react

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn archetype:generate  &quot;-DarchetypeGroupId=com.adobe.granite.archetypes&quot;  &quot;-DarchetypeArtifactId=aem-project-archetype&quot;  &quot;-DarchetypeVersion=23-SNAPSHOT&quot; &quot;-DoptionFrontendModule=react&quot; &quot;-DoptionAemVersion=6.5.0&quot; &quot;-DgroupId=co.dlighthouse.aem.reactsimpleexample&quot; &quot;-DappsFolderName=react-simple-example&quot; &quot;-DartifactId=aem-react-simple-example&quot;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Let’s build and deploy our new app (make sure that you have AEM up and running)
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;AEM component using reactjs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    For creating an AEM component using react we need at least 4 things, a skeleton AEM component with a
                    dialog, a react component, an entry importing the component inside the import-components.js file and
                    a sling model which I’ll be configuring in the next video.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    I am going to use the yeoman generator for creating the skeleton AEM component for me with some
                    additional example fields in the dialog. I am calling it basic-component and I am making sure that
                    the names for the folders and component group match my current application’s configuration.
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;yo aem-application:aem-component mavenAppsModuleName=ui.apps componentParentPath=react-simple-example/components componentNodeName=basic-component componentName=&quot;Basic Component&quot; componentGroup=&quot;react-simple-example - Content&quot; mavenBundleModuleName=core javaRootPackageName=co.dlighthouse.aem.reactsimpleexample.core javaModelRelativePackageName=models javaModelClassName=BasicModel
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    We should end up with a component inside react-simple-example/components called Basic Component, if
                    you check the dialog’s xml file you will find two example fields, one for the text and another for
                    the checkbox.
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;items
  jcr:primaryType=\&quot;nt:unstructured\&quot;&gt;
    &amp;lt;text
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/coral/foundation/form/textfield\&quot;
        fieldLabel=\&quot;Text\&quot;
        name=\&quot;./text\&quot;/&gt;
    &amp;lt;checkbox
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/coral/foundation/form/checkbox\&quot;
        text=\&quot;Checkbox\&quot;
        uncheckedValue=\&quot;false\&quot;
        value=\&quot;true\&quot;
        name=\&quot;./checkbox\&quot;/&gt;
    &amp;lt;checkboxType
        jcr:primaryType=\&quot;nt:unstructured\&quot;
        sling:resourceType=\&quot;granite/ui/components/foundation/form/hidden\&quot;
        name=\&quot;./checkbox@TypeHint\&quot;
        value=\&quot;Boolean\&quot;/&gt;
&amp;lt;/items&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    Inside the ui.frontend module you will find the React.js components inside the src/components
                    folder. Create a new folder inside it, call it BasicComponent and also create an index.js file. Add
                    the imports for the reactjs library and mapTo helper from adobe
                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;//Imports
import React, { Component } from &#39;react&#39;;
import { MapTo } from &#39;@adobe/cq-react-editable-components&#39;;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Create an editconfig obj which will be used for displaying some text when the component is empty, in
                    this case given that the component’s properties like the ones defined on the dialog are available
                    through the react’s props object we can just check if props.text doesn’t have a value so that we can
                    mark this component as empty
                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;const BasicComponentEditConfig = {
  emptyLabel: &#39;Basic Component&#39;,

  isEmpty: function(props) {
    return !props || !props.text;
  }
};
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot6&quot;&gt;
                  &lt;div&gt;
                    Then we have the component which looks like a typical react component with its render method. Here
                    we can output the values for the text and checkbox properties inside the props object
                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;class BasicComponent extends Component {
  render() {
    return (
      &amp;lt;div&gt;
        My Text Property Value: {this.props.text},
        and checkbox: {this.props.checkbox ? &#39;checked&#39; : &#39;unchecked&#39;}
      &amp;lt;/div&gt;
    );
  }
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot7&quot;&gt;
                  &lt;div&gt;
                    Finally we call mapTo helper function that maps the react component to a particular resourceType
                    inside AEM so that aem knows which react component to use when rendering our page

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;export default MapTo(&#39;react-simple-example/components/basic-component&#39;)(
  BasicComponent,
  BasicComponentEditConfig
);
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot8&quot;&gt;
                  &lt;div&gt;
                    Then inside the import-components.js file we import the basic component

                    &lt;pre&gt;&lt;code class=&quot;language-jsx&quot;&gt;import &#39;./BasicComponent&#39;;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot9&quot;&gt;
                  &lt;div&gt;
                    Build and deploy the application again

                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/aem-react-simple-example&quot; target=&quot;_blank&quot;&gt;Repository with the
                  examples&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s Archetype&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype/releases&quot; target=&quot;_blank&quot;&gt;Adobe&#39;s Archetype
                  Releases&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://reactjs.org/docs/react-component.html&quot; target=&quot;_blank&quot;&gt;React.Component&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
      &lt;script src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/components/prism-core.min.js&quot;&gt;&lt;/script&gt;
      &lt;script
        src=&quot;https://cdnjs.cloudflare.com/ajax/libs/prism/1.17.1/plugins/autoloader/prism-autoloader.min.js&quot;&gt;&lt;/script&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/2293546765135491636/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2020/02/creating-aem-component-using-reactjs.html#comment-form' title='2 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2293546765135491636'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/2293546765135491636'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2020/02/creating-aem-component-using-reactjs.html' title='How to create an AEM component using Reactjs'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/nec_MDPzMYk/default.jpg" height="72" width="72"/><thr:total>2</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-6790422144587848045</id><published>2019-09-26T17:01:00.000-07:00</published><updated>2019-09-26T17:01:18.164-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="aem/cq5"/><title type='text'>Create a custom AEM workflow process step with a dialog</title><content type='html'>
    &lt;div&gt;
      &lt;img
        src=&quot;https://i.ytimg.com/vi/zgdBZOmOKWM/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/zgdBZOmOKWM/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/zgdBZOmOKWM?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/zgdBZOmOKWM/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In this tutorial I talk about how to create a custom workflow step process with an additional dialog for
        configuring it, above is the vid and below you will find some useful notes.
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have access to an Adobe Experience Manager instance.&lt;/div&gt;
                  &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s archetype,
                    you can watch my video about maven here: &lt;a
                      href=&quot;/2019/06/creating-aem-application-using-maven.html&quot; target=&quot;_blank&quot;&gt;Creating an AEM
                      application using Maven and Adobe&#39;s archetype&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;What is an AEM Workflow and workflow model&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Workflows allow you to automate different tasks inside AEM by defining a sequence of steps to be
                    executed and the actions to be performed at each step.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    A workflow model represents the definition of a workflow using nodes for the steps or actions to be
                    executed and transitions to define how the steps are organized and what is going to be the execution
                    sequence
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Creating the base app with the custom workflow step&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Create the app using adobe&#39;s archetype
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate &quot;-DarchetypeGroupId=com.adobe.granite.archetypes&quot; &quot;-DarchetypeArtifactId=aem-project-archetype&quot; &quot;-DarchetypeVersion=20&quot; &quot;-DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/&quot; &quot;-DgroupId=co.dlighthouse.aem.workflowstepdialog&quot; &quot;-DartifactId=aem-workflow-step-dialog&quot; &quot;-Dversion=0.1.0-SNAPSHOT&quot; &quot;-Dpackage=co.dlighthouse.aem.workflowstepdialog&quot; &quot;-DappsFolderName=workflow-step-dialog&quot; &quot;-DconfFolderName=workflow-step-dialog&quot; &quot;-DartifactName=Workflow Step Dialog&quot; &quot;-DcomponentGroupName=Workflow Step Dialog&quot; &quot;-DcontentFolderName=workflow-step-dialog&quot; &quot;-DcssId=workflow-step-dialog&quot; &quot;-DpackageGroup=workflow-step-dialog&quot; &quot;-DsiteName=Workflow Step Dialog&quot; “-DoptionIncludeExamples=n” “-DoptionIncludeFrontendModule=n” “-DoptionAemVersion=6.5.0”
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Use the yeoman generator and create the custom workflow step, you can also check the code on github
                    or do it by hand.
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;npm install -g yo
npm install -g generator-aem-application
cd aem-workflow-step-dialog
yo aem-application:workflow workflowName=&quot;Sample Application - Sample Workflow Process Step&quot; componentParentPath=workflow-step-dialog/components/workflow componentNodeName=workflow-process javaRootPackageName=co.dlighthouse.aem.workflowstepdialog.core javaWorkflowClassName=SampleWorkflowProcess
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    &lt;div&gt;
                      For the dialog for the custom workflow step component we need the following:
                    &lt;/div&gt;
                    &lt;div&gt;
                      Component node (.content.xml)
                    &lt;/div&gt;
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&amp;lt;jcr:root xmlns:sling=&quot;http://sling.apache.org/jcr/sling/1.0&quot; xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot;
    jcr:primaryType=&quot;cq:Component&quot;
    jcr:title=&quot;Sample Application - Sample Workflow Process Step&quot;
    sling:resourceSuperType=&quot;cq/workflow/components/model/process&quot;
    allowedParents=&quot;[*/parsys]&quot;
    componentGroup=&quot;Workflow&quot;/&gt;
&lt;/code&gt;&lt;/pre&gt;
                    &lt;div&gt;
                      cq:EditConfig node (_cq_editConfig.xml)
                    &lt;/div&gt;
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&amp;lt;jcr:root xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot; xmlns:nt=&quot;http://www.jcp.org/jcr/nt/1.0&quot;
    cq:dialogMode=&quot;floating&quot;
    cq:inherit=&quot;{Boolean}true&quot;
    jcr:primaryType=&quot;cq:EditConfig&quot;&gt;
    &amp;lt;cq:formParameters
        jcr:primaryType=&quot;nt:unstructured&quot;
        jcr:title=&quot;Sample Application - Sample Workflow Process Step&quot;
        PROCESS=&quot;co.dlighthouse.aem.workflowstepdialog.core.workflows.SampleWorkflowProcess&quot;
        PROCESS_AUTO_ADVANCE=&quot;true&quot;/&gt;
&amp;lt;/jcr:root&gt;
&lt;/code&gt;&lt;/pre&gt;
                    &lt;div&gt;
                      Touch UI dialog cq:dialog node (_cq_dialog/.content.xml)
                    &lt;/div&gt;
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;?xml version=&quot;1.0&quot; encoding=&quot;UTF-8&quot;?&gt;
&amp;lt;jcr:root xmlns:sling=&quot;http://sling.apache.org/jcr/sling/1.0&quot; xmlns:cq=&quot;http://www.day.com/jcr/cq/1.0&quot; xmlns:jcr=&quot;http://www.jcp.org/jcr/1.0&quot; xmlns:nt=&quot;http://www.jcp.org/jcr/nt/1.0&quot;
    jcr:primaryType=&quot;nt:unstructured&quot;
    jcr:title=&quot;Sample Application - Sample Workflow Process Step Properties&quot;
    sling:resourceType=&quot;cq/gui/components/authoring/dialog&quot;&gt;
    &amp;lt;content
        jcr:primaryType=&quot;nt:unstructured&quot;
        sling:resourceType=&quot;granite/ui/components/coral/foundation/fixedcolumns&quot;&gt;
        &amp;lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;
            &amp;lt;common
                jcr:primaryType=&quot;nt:unstructured&quot;
                cq:hideOnEdit=&quot;true&quot;/&gt;
            &amp;lt;process
                jcr:primaryType=&quot;nt:unstructured&quot;
                cq:hideOnEdit=&quot;true&quot;/&gt;
            &amp;lt;column
                jcr:primaryType=&quot;nt:unstructured&quot;
                sling:resourceType=&quot;granite/ui/components/coral/foundation/container&quot;&gt;
                &amp;lt;items jcr:primaryType=&quot;nt:unstructured&quot;&gt;
                    &amp;lt;text
                        jcr:primaryType=&quot;nt:unstructured&quot;
                        sling:resourceType=&quot;granite/ui/components/coral/foundation/form/textfield&quot;
                        fieldLabel=&quot;Something Important&quot;
                        name=&quot;./metaData/somethingImportant&quot;/&gt;
                &amp;lt;/items&gt;
            &amp;lt;/column&gt;
        &amp;lt;/items&gt;
    &amp;lt;/content&gt;
&amp;lt;/jcr:root&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    We need the class that implements WorkflowProcess and overrides the execute method.
                    &lt;pre&gt;&lt;code class=&quot;language-java&quot;&gt;package co.dlighthouse.aem.workflowstepdialog.core.workflows;

import com.adobe.granite.workflow.WorkflowException;
import com.adobe.granite.workflow.WorkflowSession;
import com.adobe.granite.workflow.exec.WorkItem;
import com.adobe.granite.workflow.exec.WorkflowData;
import com.adobe.granite.workflow.exec.WorkflowProcess;
import com.adobe.granite.workflow.metadata.MetaDataMap;
import org.apache.commons.lang3.StringUtils;
import org.osgi.service.component.annotations.Component;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Component(
    service=WorkflowProcess.class,
    property = {&quot;process.label=Sample Application - Sample Workflow Process Step&quot;}
)
public class SampleWorkflowProcess implements WorkflowProcess {
    private static final Logger log = LoggerFactory.getLogger(SampleWorkflowProcess.class);

    @Override
    public void execute(WorkItem workItem, WorkflowSession workflowSession, MetaDataMap args) throws WorkflowException {

        final WorkflowData workflowData = workItem.getWorkflowData();
        final String type = workflowData.getPayloadType();

        // Check if the payload is a path in the JCR; The other (less common) type is JCR_UUID
        if (!StringUtils.equals(type, &quot;JCR_PATH&quot;)) {
            return;
        }
        // Get the path to the JCR resource from the payload
        final String path = workflowData.getPayload().toString();

        String somethingImportant = args.get(&quot;somethingImportant&quot;, &quot;not set&quot;);

        log.info(&quot;Sample Application - Sample Workflow Process Step - somethingImportant: {} - payload: {}&quot;, somethingImportant, path);
    }
}
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Finally build and deploy your new app into AEM
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn clean install -PautoInstallPackage -Padobe-public
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/aem-workflow-step-dialog&quot; target=&quot;_blank&quot;&gt;Repository with the
                  examples&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/generator-aem-application&quot; target=&quot;_blank&quot;&gt;AEM application -
                  Yeoman Generator&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/workflows-models.html&quot;
                  target=&quot;_blank&quot;&gt;Creating Workflow Models&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://helpx.adobe.com/experience-manager/6-5/sites/developing/using/workflows.html&quot;
                  target=&quot;_blank&quot;&gt;Developing and Extending Workflows&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;&gt;Maven template to create new
                  Adobe Experience Manager (AEM) projects that follow best practices&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/6790422144587848045/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2019/09/create-custom-aem-workflow-process-step.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6790422144587848045'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/6790422144587848045'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2019/09/create-custom-aem-workflow-process-step.html' title='Create a custom AEM workflow process step with a dialog'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/zgdBZOmOKWM/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-278256413373303741</id><published>2019-09-05T17:02:00.000-07:00</published><updated>2019-09-05T17:02:17.904-07:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="adobe experience manager"/><category scheme="http://www.blogger.com/atom/ns#" term="aem"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="java"/><category scheme="http://www.blogger.com/atom/ns#" term="maven"/><category scheme="http://www.blogger.com/atom/ns#" term="node.js"/><category scheme="http://www.blogger.com/atom/ns#" term="nodejs"/><title type='text'>Integrating Nodejs and Maven using The Maven Frontend Plugin</title><content type='html'>    &lt;div&gt;
      &lt;img
        src=&quot;https://i.ytimg.com/vi/jXtqtb5sYVQ/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/jXtqtb5sYVQ/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/jXtqtb5sYVQ?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/jXtqtb5sYVQ/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        In this tutorial I show how to integrate nodejs with maven using the Maven Frontend Plugin, above is the vid and
        below you will find some useful notes.
      &lt;/div&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have access to an Adobe Experience Manager instance if you want to install the AEM application
                    and test it. The same pom configs shown here can be used for different types of applications&lt;/div&gt;
                  &lt;div&gt;Have Maven installed, understand how it works and also understand how to use Adobe&#39;s archetype,
                    you can watch my video about maven here: &lt;a
                      href=&quot;/2019/06/creating-aem-application-using-maven.html&quot; target=&quot;_blank&quot;&gt;Creating an AEM
                      application using Maven and Adobe&#39;s archetype&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Creating the base app&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Create the app using adobe&#39;s archetype
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;mvn org.apache.maven.plugins:maven-archetype-plugin:2.4:generate &quot;-DarchetypeGroupId=com.adobe.granite.archetypes&quot; &quot;-DarchetypeArtifactId=aem-project-archetype&quot; &quot;-DarchetypeVersion=19&quot; &quot;-DarchetypeCatalog=https://repo.adobe.com/nexus/content/groups/public/&quot; &quot;-DgroupId=co.dlighthouse.aem.firstapp&quot; &quot;-DartifactId=aem-first-app&quot; &quot;-Dversion=0.1.0-SNAPSHOT&quot; &quot;-Dpackage=co.dlighthouse.aem.firstapp&quot; &quot;-DappsFolderName=first-app&quot; &quot;-DconfFolderName=first-app&quot; &quot;-DartifactName=First App Example&quot; &quot;-DcomponentGroupName=First App Example&quot; &quot;-DcontentFolderName=first-app&quot; &quot;-DcssId=first-app&quot; &quot;-DpackageGroup=first-app&quot; &quot;-DsiteName=First App Example&quot; &quot;-DoptionAemVersion=6.4.0&quot;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Create the nodejs module inside the multimodule maven project using yeoman
                    &lt;pre&gt;&lt;code class=&quot;language-shell&quot;&gt;yo aem-application:galen-module
co.dlighthouse.aem.firstapp
aem-first-app
0.1.0-SNAPSHOT
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    Don&#39;t forget to add the submodule to the list of modules inside your parent pom file
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;modules&gt;
    &amp;lt;module&gt;core&amp;lt;/module&gt;
    &amp;lt;module&gt;ui.apps&amp;lt;/module&gt;
    &amp;lt;module&gt;ui.content&amp;lt;/module&gt;
    &amp;lt;module&gt;it.tests&amp;lt;/module&gt;
    &amp;lt;module&gt;it.launcher&amp;lt;/module&gt;
    &amp;lt;module&gt;ui.npm.galen&amp;lt;/module&gt;
&amp;lt;/modules&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Maven Frontend Plugin&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    The maven Frontend Plugin allows you to integrate nodejs into your build by just adding a few
                    configurations into the POM file.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    For this, first you need a plugin configuration on your pom file using the group and artifact Id for
                    the frontend plugin, a version and finally a list of executions that would configure a couple of
                    things about the plugin.
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;&amp;lt;project&gt;

    ...

    &amp;lt;build&gt;
        &amp;lt;plugins&gt;
            &amp;lt;plugin&gt;
                &amp;lt;groupId&gt;com.github.eirslett&amp;lt;/groupId&gt;
                &amp;lt;artifactId&gt;frontend-maven-plugin&amp;lt;/artifactId&gt;
                &amp;lt;version&gt;1.8.0&amp;lt;/version&gt;
                &amp;lt;executions&gt;
                    ...
                &amp;lt;/executions&gt;
            &amp;lt;/plugin&gt;
        &amp;lt;/plugins&gt;
    &amp;lt;/build&gt;
&amp;lt;/project&gt;
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    The first execution allows you to set the version for node and npm (you can also use yarn).
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;    ...

    &amp;lt;executions&gt;
        &amp;lt;execution&gt;
            &amp;lt;id&gt;install node and npm&amp;lt;/id&gt;
            &amp;lt;goals&gt;
                &amp;lt;goal&gt;install-node-and-npm&amp;lt;/goal&gt;
            &amp;lt;/goals&gt;
            &amp;lt;configuration&gt;
                &amp;lt;nodeVersion&gt;v12.9.0&amp;lt;/nodeVersion&gt;
                &amp;lt;npmVersion&gt;6.10.2&amp;lt;/npmVersion&gt;
            &amp;lt;/configuration&gt;
        &amp;lt;/execution&gt;

        ...

    &amp;lt;/executions&gt;

    ...
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot4&quot;&gt;
                  &lt;div&gt;
                    The second execution installs or updates the packages given what you’ve configured on the
                    package.json file.
                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;    ...

    &amp;lt;executions&gt;
        ...

        &amp;lt;execution&gt;
            &amp;lt;id&gt;npm-install&amp;lt;/id&gt;
            &amp;lt;goals&gt;
                &amp;lt;goal&gt;npm&amp;lt;/goal&gt;
            &amp;lt;/goals&gt;
            &amp;lt;configuration&gt;
                &amp;lt;arguments&gt;install&amp;lt;/arguments&gt;
            &amp;lt;/configuration&gt;
        &amp;lt;/execution&gt;

        ...

    &amp;lt;/executions&gt;

    ...
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot5&quot;&gt;
                  &lt;div&gt;
                    Finally we just need one execution for galen, here we need provide the same name of the script that
                    we have inside the package.json file

                    &lt;pre&gt;&lt;code class=&quot;language-xml&quot;&gt;
    ...

    &amp;lt;executions&gt;
        ...

        &amp;lt;execution&gt;
            &amp;lt;id&gt;npm-galen&amp;lt;/id&gt;
            &amp;lt;goals&gt;
                &amp;lt;goal&gt;npm&amp;lt;/goal&gt;
            &amp;lt;/goals&gt;
            &amp;lt;configuration&gt;
                &amp;lt;arguments&gt;run galen&amp;lt;/arguments&gt;
            &amp;lt;/configuration&gt;
        &amp;lt;/execution&gt;
    &amp;lt;/executions&gt;

    ...
&lt;/code&gt;&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/maven-frontend-plugin-aem-examples&quot; target=&quot;_blank&quot;&gt;Repository with the examples&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/drginm/generator-aem-application&quot; target=&quot;_blank&quot;&gt;AEM application - Yeoman Generator&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;http://chromedriver.chromium.org/downloads&quot; target=&quot;_blank&quot;&gt;ChromeDriver - WebDriver for
                  Chrome&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/adobe/aem-project-archetype&quot; target=&quot;_blank&quot;&gt;Maven template to create new
                  Adobe Experience Manager (AEM) projects that follow best practices&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/eirslett/frontend-maven-plugin&quot; target=&quot;_blank&quot;&gt;frontend-maven-plugin&lt;/a&gt;
              &lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://mvnrepository.com/artifact/com.github.eirslett/frontend-maven-plugin&quot;
                  target=&quot;_blank&quot;&gt;Maven Frontend Plugin Versions&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://nodejs.org/en/download/releases/&quot; target=&quot;_blank&quot;&gt;Nodejs and npm releases&lt;/a&gt;&lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/278256413373303741/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2019/09/integrating-nodejs-and-maven.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/278256413373303741'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/278256413373303741'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2019/09/integrating-nodejs-and-maven.html' title='Integrating Nodejs and Maven using The Maven Frontend Plugin'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/jXtqtb5sYVQ/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry><entry><id>tag:blogger.com,1999:blog-4433773573761530904.post-561188957234285170</id><published>2019-07-14T17:09:00.001-07:00</published><updated>2019-11-14T16:22:16.586-08:00</updated><category scheme="http://www.blogger.com/atom/ns#" term="deep learning"/><category scheme="http://www.blogger.com/atom/ns#" term="English"/><category scheme="http://www.blogger.com/atom/ns#" term="machine learning"/><category scheme="http://www.blogger.com/atom/ns#" term="tensorflow"/><category scheme="http://www.blogger.com/atom/ns#" term="vuejs"/><title type='text'>House price prediction 3/4: What is One Hot Encoding</title><content type='html'>
    &lt;div&gt;&lt;img src=&quot;https://i.ytimg.com/vi/-Pyqp5tD0pk/0.jpg&quot; style=&quot;display:none&quot;&gt;
      &lt;div class=&quot;embed-responsive embed-responsive-16by9&quot; style=&quot;width:100%&quot;&gt;&lt;iframe allowfullscreen
          class=&quot;embed-responsive-item YOUTUBE-iframe-video&quot;
          data-thumbnail-src=&quot;https://i.ytimg.com/vi/-Pyqp5tD0pk/0.jpg&quot; frameborder=&quot;0&quot;
          src=&quot;https://www.youtube.com/embed/-Pyqp5tD0pk?feature=player_embedded&quot;&gt;&lt;/iframe&gt;&lt;img
          src=&quot;https://i.ytimg.com/vi/-Pyqp5tD0pk/0.jpg&quot; style=&quot;display:none&quot;&gt;&lt;/div&gt;
      &lt;div&gt;
        A series about creating a model using Python and Tensorflow and then importing the model and making predictions
        using Javascript in a Vue.js application, above is the vid and below you will find some useful notes.
      &lt;/div&gt;
      &lt;ul class=&quot;undefined information-section&quot;&gt;
        &lt;li class=&quot;section-slot1&quot;&gt;
          &lt;div&gt;Here, in part 3 of this series, I will show what is and how does one hot encoding works. &lt;/div&gt;
          &lt;div&gt;In the first post, called &lt;a href=&quot;/2019/04/tensorflow-keras-predict-house-prices-1-4.html&quot;
              target=&quot;_blank&quot;&gt;House price prediction 1/4: Using Keras/Tensorflow and python&lt;/a&gt;, I talked about how to
            create a model in python, pre-process a dataset I&#39;ve already created, train a model, post-process, predict,
            and finally about creating different files for sharing some information about the data for use on the second
            part.&lt;/div&gt;
          &lt;div&gt;Then in part 2, called &lt;a href=&quot;/2019/05/tensorflowjs-vuejs-predict-house-prices-2-4.html&quot;
              target=&quot;_blank&quot;&gt;House price prediction 2/4: Using Tensorflow.js, Vue.js and Javascript&lt;/a&gt;, I took the
            model, the data for pre and post processing and after loading everything we were finally able to predict
            hose prices using Vue.js.&lt;/div&gt;
          &lt;div&gt;And finally in part 4 I will show what and why normalizing the inputs is important. &lt;/div&gt;
      &lt;/ul&gt;
      &lt;ol class=&quot;ordered-listicle&quot;&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;1.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Pre-reqs&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;Have &lt;a href=&quot;https://nodejs.org/en/&quot; target=&quot;_blank&quot;&gt;node.js &lt;/a&gt;installed&lt;/div&gt;
                  &lt;div&gt;Have &lt;a href=&quot;https://www.anaconda.com/&quot; target=&quot;_blank&quot;&gt;Python 3.x &lt;/a&gt;installed&lt;/div&gt;
                  &lt;div&gt;Have the code for the previous posts: &lt;a href=&quot;https://github.com/drginm/real-estate-tensorflow&quot;
                      target=&quot;_blank&quot;&gt;Python Real Estate - Github&lt;/a&gt; and &lt;a
                      href=&quot;https://github.com/drginm/real-estate-tensorflowjs-vuejs&quot; target=&quot;_blank&quot;&gt;Real Estate price
                      prediction using Tensorflow.js and Vue.js&lt;/a&gt;&lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;2.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;What is One Hot Encoding&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    One hot encoding is a process with which we take a set of named categories in which the order
                    between the values is not implicit,
                    like colors, for example red, green and blue, or fruits, for example apples, lemons and blueberries
                    and so on
                    and transform them into a numeric representation so that a machine learning algorithm can perform
                    operations on those values.

                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    A named category in which the order between the values is implicit does not need to be One Hot
                    Encoded.
                    One such category could be for example medals with values like Gold, Silver or Bronze which are
                    awarded given a position in an ordered ranking like who came first, second or third, in such cases
                    we can say that gold is better than silver, which is also better than bronze for example.
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot3&quot;&gt;
                  &lt;div&gt;
                    So for a list of neighborhoods, at a high level, the encoding or transformation process would
                    typically entail
                    &lt;pre&gt;Neighborhoods:
medellin aranjuez
medellin centro
medellin belen rosales
medellin la castellana
medellin la castellana
&lt;/pre&gt;
                    Transforming the named categories into numbers by for example assigning an index into each one of
                    them:
                    &lt;pre&gt;Neighborhood:
0,medellin aranjuez
1,medellin centro
2,medellin belen rosales
3,medellin la castellana
4,medellin la castellana
&lt;/pre&gt;
                    Then we would create a vector representation of them with as many columns as categories we have, in
                    which case we would take the previous indexes and assign a “One” into the column that corresponds
                    with the index of the category and “Zeros” on the other columns,
                    &lt;pre&gt;Column Indexes,Neighborhood:
0,1,2,3,4
1,0,0,0,0,medellin aranjuez
0,1,0,0,0,medellin centro
0,0,1,0,0,medellin belen rosales
0,0,0,1,0,medellin la castellana
0,0,0,0,1,medellin la castellana
&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;3.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Using a Scikit Learn Preprocessor&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    For using a preprocessor like the label encoder you need to first instantiate it, fit it with the
                    complete dataset and then use transform when you need to encode a particular set of values.
                    &lt;pre&gt;  &lt;code class=&quot;python hljs&quot;&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; sklearn.preprocessing &lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; OneHotEncoder, LabelEncoder

neighborhoods = [
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;envigado&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;poblado&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;centro&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;laureles&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;bello&#39;&lt;/span&gt;,
]

labels_to_test = [
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;laureles&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;centro&#39;&lt;/span&gt;,
    &lt;span class=&quot;hljs-string&quot;&gt;&#39;laureles&#39;&lt;/span&gt;,
]

label_encoder = LabelEncoder()
label_encoder.fit(neighborhoods)

print(&lt;span class=&quot;hljs-string&quot;&gt;&#39;Label Encoded String&#39;&lt;/span&gt;, label_encoder.transform(labels_to_test))
  &lt;/code&gt;
&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;4.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Using the Label Encoder and the One Hot Encoder&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    First you should configure both encoders by calling fit on both of them and also transform on the
                    Label encoder
                    &lt;pre&gt;  &lt;code class=&quot;python hljs&quot;&gt;
label_encoder = LabelEncoder()
label_encoder.fit(complete_set_of_data)

onehot_encoder = OneHotEncoder(sparse=&lt;span class=&quot;hljs-keyword&quot;&gt;False&lt;/span&gt;)

categorical_column = label_encoder.transform(complete_set_of_data)
integer_encoded = categorical_column.reshape(len(categorical_column), &lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;)
onehot_encoder.fit(integer_encoded)
  &lt;/code&gt;
&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Then you would call transform on both when transforming a set of values
                    &lt;pre&gt;  &lt;code class=&quot;python hljs&quot;&gt;
values_to_transform = label_encoder.transform(values_to_transform)
integer_encoded = values_to_transform.values.reshape(len(values_to_transform), &lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;)
onehot_encoded = onehot_encoder.transform(integer_encoded)
  &lt;/code&gt;
&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;5.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Onehot encode in Javascript&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;ul class=&quot;undefined information-section&quot;&gt;
                &lt;li class=&quot;section-slot1&quot;&gt;
                  &lt;div&gt;
                    Before using the model created in python inside Javascript we have to One hot encode the data we
                    want to predict, in this case I used a javascript library for that

                    &lt;pre&gt;  &lt;code class=&quot;javascript hljs&quot;&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;import&lt;/span&gt; * &lt;span class=&quot;hljs-keyword&quot;&gt;as&lt;/span&gt; onehot &lt;span class=&quot;hljs-keyword&quot;&gt;from&lt;/span&gt; &lt;span class=&quot;hljs-string&quot;&gt;&#39;one-hot-enum&#39;&lt;/span&gt;;

&lt;span class=&quot;hljs-keyword&quot;&gt;let&lt;/span&gt; reducedlist = &lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.completeSetOfData.slice(&lt;span class=&quot;hljs-number&quot;&gt;1&lt;/span&gt;);
&lt;span class=&quot;hljs-keyword&quot;&gt;let&lt;/span&gt; enumaration = onehot.enumaration(reducedlist);
&lt;span class=&quot;hljs-keyword&quot;&gt;let&lt;/span&gt; encoded = onehot.encode(reducedlist);
&lt;span class=&quot;hljs-keyword&quot;&gt;let&lt;/span&gt; zeros = &lt;span class=&quot;hljs-built_in&quot;&gt;Array&lt;/span&gt;.apply(&lt;span class=&quot;hljs-literal&quot;&gt;null&lt;/span&gt;, &lt;span class=&quot;hljs-built_in&quot;&gt;Array&lt;/span&gt;(encoded[&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;].length)).map(&lt;span class=&quot;hljs-built_in&quot;&gt;Number&lt;/span&gt;.prototype.valueOf, &lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;);

&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.dictionary = {};

&lt;span class=&quot;hljs-keyword&quot;&gt;for&lt;/span&gt; (&lt;span class=&quot;hljs-keyword&quot;&gt;let&lt;/span&gt; i &lt;span class=&quot;hljs-keyword&quot;&gt;in&lt;/span&gt; enumaration) {
  &lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.dictionary[enumaration[i]] = encoded[i];
}

&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.dictionary[&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.neighborhoods[&lt;span class=&quot;hljs-number&quot;&gt;0&lt;/span&gt;]] = zeros;
  &lt;/code&gt;
&lt;/pre&gt;
                  &lt;/div&gt;
                &lt;li class=&quot;section-slot2&quot;&gt;
                  &lt;div&gt;
                    Then for transforming a string into it&#39;s one hot encoded vector representation you just need to
                    provide the string into the dictionary
                    &lt;pre&gt;  &lt;code class=&quot;javascript hljs&quot;&gt;
&lt;span class=&quot;hljs-keyword&quot;&gt;this&lt;/span&gt;.dictionary[valueToTransform]
  &lt;/code&gt;
&lt;/pre&gt;
                  &lt;/div&gt;
              &lt;/ul&gt;
            &lt;/div&gt;
          &lt;/div&gt;
        &lt;li class=&quot;ordered-list-item&quot;&gt;&lt;span class=&quot;ordered-list-text&quot;&gt;6.&lt;/span&gt;
          &lt;div class=&quot;ordered-list-body&quot;&gt;
            &lt;h4 class=&quot;ordered-list-title&quot;&gt;
              &lt;div&gt;Resources&lt;/div&gt;
            &lt;/h4&gt;
            &lt;div&gt;
              &lt;div&gt;&lt;a href=&quot;https://machinelearningmastery.com/why-one-hot-encode-data-in-machine-learning/&quot;
                  target=&quot;_blank&quot;&gt;Why One-Hot Encode Data in Machine Learning?&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a
                  href=&quot;https://hackernoon.com/what-is-one-hot-encoding-why-and-when-do-you-have-to-use-it-e3c6186d008f&quot;
                  target=&quot;_blank&quot;&gt;What is One Hot Encoding? Why And When do you have to use it?&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.LabelEncoder.html&quot;
                  target=&quot;_blank&quot;&gt;sklearn.preprocessing.LabelEncoder&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;http://scikit-learn.org/stable/modules/generated/sklearn.preprocessing.OneHotEncoder.html&quot;
                  target=&quot;_blank&quot;&gt;sklearn.preprocessing.OneHotEncoder&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://github.com/ansteh/one-hot-enum&quot; target=&quot;_blank&quot;&gt;one-hot-enum&lt;/a&gt;&lt;/div&gt;
              &lt;div&gt;&lt;a href=&quot;https://www.youtube.com/watch?v=v_4KWmkwmsU&quot; target=&quot;_blank&quot;&gt;One-hot Encoding explained&lt;/a&gt;
              &lt;/div&gt;
            &lt;/div&gt;
          &lt;/div&gt;
      &lt;/ol&gt;
    &lt;/div&gt;</content><link rel='replies' type='application/atom+xml' href='http://www.dlighthouse.co/feeds/561188957234285170/comments/default' title='Enviar comentarios'/><link rel='replies' type='text/html' href='http://www.dlighthouse.co/2019/07/what-is-one-hot-encoding-3-4.html#comment-form' title='0 comentarios'/><link rel='edit' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/561188957234285170'/><link rel='self' type='application/atom+xml' href='http://www.blogger.com/feeds/4433773573761530904/posts/default/561188957234285170'/><link rel='alternate' type='text/html' href='http://www.dlighthouse.co/2019/07/what-is-one-hot-encoding-3-4.html' title='House price prediction 3/4: What is One Hot Encoding'/><author><name>Manuel Gutierrez</name><uri>http://www.blogger.com/profile/14390576471930997539</uri><email>noreply@blogger.com</email><gd:image rel='http://schemas.google.com/g/2005#thumbnail' width='16' height='16' src='https://img1.blogblog.com/img/b16-rounded.gif'/></author><media:thumbnail xmlns:media="http://search.yahoo.com/mrss/" url="https://img.youtube.com/vi/-Pyqp5tD0pk/default.jpg" height="72" width="72"/><thr:total>0</thr:total></entry></feed>