<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Knowledge Lens: A Rockwell Automation Company - Medium]]></title>
        <description><![CDATA[Drive Digital Transformation with our state-of-the art IoT, Big Data, AI and Blockchain technology solutions. - Medium]]></description>
        <link>https://medium.com/knowledgelens?source=rss----cfda567a8094---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Knowledge Lens: A Rockwell Automation Company - Medium</title>
            <link>https://medium.com/knowledgelens?source=rss----cfda567a8094---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Fri, 27 Nov 2026 18:42:28 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/knowledgelens" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[It’s time to REACT]]></title>
            <link>https://medium.com/knowledgelens/its-time-to-react-7b57ac3dcbbf?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/7b57ac3dcbbf</guid>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[react]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[front-end-development]]></category>
            <dc:creator><![CDATA[Thimmaraju Budupa]]></dc:creator>
            <pubDate>Fri, 18 Aug 2023 12:30:10 GMT</pubDate>
            <atom:updated>2023-08-18T12:30:10.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/868/1*das3eMt7JQrb62VDWgKcwg.png" /><figcaption>Image from Orient Software</figcaption></figure><h3><strong>Introduction:</strong></h3><p>React has become one of the most popular JavaScript libraries for building user interfaces.With its component-based architecture and efficient rendering,React offers several significant advantages over other frontend frameworks. In this blog post, we’ll explore key advantages that make React stand out from the crowd.</p><h3><strong>JavaScript or TypeScript?</strong></h3><p>React can be used with both JavaScript (JS) and TypeScript (TS). When using React with JS, you benefit from its dynamic typing and flexibility, but you might encounter runtime errors due to lack of static type checking. On the other hand, React with TS introduces static typing, which enhances code quality, catches errors during development, and provides better refactoring tools. The choice between JS and TS depends on project complexity, team familiarity, and the desired level of type safety and tooling support.</p><h4><strong>The Virtual DOM Algorithm</strong></h4><p>React’s Virtual DOM lies at the core of its outstanding performance. By using a smart algorithm, React minimizes unnecessary DOM <br>manipulations, leading to faster rendering and improved user experiences. When a component’s state changes, React creates a virtual representation of the updated UI. It then employs a reconciliation process, comparing the previous and updated virtual DOMs to compute the minimum required changes to update the actual DOM. This efficient <a href="https://legacy.reactjs.org/docs/reconciliation.html"><strong>diffing</strong></a><strong> </strong>algorithm drastically reduces the time and resources spent on rendering, ensuring smooth and snappy user interfaces even in complex applications.</p><h4><strong>Unidirectional Data Flow</strong></h4><p>React follows a unidirectional data flow, ensuring a clear and predictable data flow pattern within the application. Data changes flow in a single direction, from parent components to child components. This pattern simplifies data management and debugging, reducing the likelihood of data inconsistencies and making the codebase more maintainable and easier to reason about.</p><h4><strong>SEO(Search Engine Optimization)-Friendly</strong></h4><p>React can be used on the server side (with frameworks like <a href="https://nextjs.org/"><strong>Next.js</strong></a>), enabling server-rendered content that is more accessible to search engines and social media crawlers, improving SEO.</p><h4><strong>React Hooks</strong></h4><p>The introduction of React hooks brought a more functional approach to managing state and side effects in functional components. Hooks allow developers to write more concise and readable code, making it easier to handle complex logic.</p><h4><strong>Performance Optimization</strong></h4><p>React’s performance optimization techniques, like memoization with useMemo and useCallback, allow developers to avoid unnecessary re-renders and improve application performance.</p><h4><strong>Functional Programming Paradigm</strong></h4><p>React encourages a functional programming approach, which promotes writing pure functions that do not mutate data. This approach helps prevent unexpected side effects, leading to more predictable code behavior. By following functional programming principles, developers can build cleaner and more robust applications that are easier to test and debug.</p><h4><strong>JavaScript ES6+ Features</strong></h4><p>React embraces the latest features of JavaScript, especially the ECMAScript 6 (ES6) standard and beyond. This allows developers to use modern syntax and language features such as arrow functions, destructuring, spread operators, and classes. Leveraging these powerful features enhances code readability, maintainability, and expressiveness, making React codebases more concise and easier to work with.</p><h4><strong>State Management</strong></h4><p><a href="https://redux.js.org/introduction/getting-started"><strong>Redux</strong></a> offers a centralized state management solution for React applications. In complex projects where multiple components need access to the same data, passing props down the component tree can become cumbersome and lead to prop drilling. Redux addresses this challenge by maintaining the entire application state in a single global store.</p><h4><strong>HTTP requests with AXOIS</strong></h4><p><a href="https://github.com/axios/axios"><strong>Axios</strong></a> plays a vital role in React applications by streamlining the process of making HTTP requests to APIs, simplifying error handling, enabling data transformation, ensuring cross-browser compatibility, and facilitating efficient response management. Its promise-based structure and built-in features, such as request cancellation and interceptors, contribute to a more seamless and reliable data-fetching experience within React components.</p><h4><strong>Styling</strong></h4><p>Styling in React involves the application of CSS techniques to create visually appealing and responsive user interfaces. Developers can choose from various approaches, including traditional CSS, <a href="https://create-react-app.dev/docs/adding-a-css-modules-stylesheet/"><strong>CSS modules</strong></a>, and CSS-in-JS libraries like<strong> </strong><a href="https://styled-components.com/"><strong>styled-components</strong></a>. CSS modules allow local scoping of styles, preventing global conflicts. Styled-components offer the ability to write CSS directly within JavaScript, enhancing component encapsulation and reusability. Selecting the appropriate styling approach depends on project requirements, team preferences, and the desired balance between styling flexibility and maintainability.</p><h4><strong>Stable API</strong></h4><p>React maintains a stable API, ensuring that updates and changes are well-documented and backward-compatible, minimizing the impact on existing codebases during upgrades.</p><h4><strong>React Native</strong></h4><p>One of React’s unique advantages is its ability to leverage the same codebase to build both web and mobile applications. <a href="https://reactnative.dev/"><strong>React Native</strong></a>, an extension of React, enables developers to write native mobile apps using JavaScript and React syntax. This cross-platform compatibility accelerates mobile app development, reducing development costs and time-to-market.</p><h4><strong>Backed by Facebook</strong></h4><p>React is maintained and backed by Facebook, which ensures continuous development, bug fixes, and updates. This support from a major tech company adds to the confidence and stability of using React.</p><h4><strong>Active Community and Ecosystem</strong></h4><p>React boasts an active and vibrant community of developers, which has led to a thriving ecosystem of third-party libraries, tools, and resources. This ecosystem provides developers with a wide range of options to extend React’s capabilities, speeding up development and allowing for easy integration with other technologies and frameworks.</p><h4><strong>Conclusion</strong></h4><p>React’s algorithmic brilliance, demonstrated through its Virtual DOM and reconciliation algorithm, empowers developers to build high-performance web applications. By optimizing rendering processes and minimizing DOM manipulations, React achieves impressive speed and responsiveness, elevating user experiences to new heights. Additionally, React’s proficiency in using JavaScript’s latest features and functional programming paradigms offers developers an elegant and efficient way to create scalable and maintainable codebases. As we continue to witness advancements in web development, React’s algorithmic prowess and JavaScript expertise position it as a frontrunner in the ever-evolving landscape of frontend frameworks. to REACT</p><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=7b57ac3dcbbf" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/its-time-to-react-7b57ac3dcbbf">It’s time to REACT</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Starting with Cypress Automation]]></title>
            <link>https://medium.com/knowledgelens/starting-with-cypress-automation-72f319e29b77?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/72f319e29b77</guid>
            <category><![CDATA[cypress]]></category>
            <category><![CDATA[testing-framework]]></category>
            <category><![CDATA[ui-automation-testing]]></category>
            <category><![CDATA[test-automation]]></category>
            <category><![CDATA[testing]]></category>
            <dc:creator><![CDATA[Nagaraj Maleppanavar]]></dc:creator>
            <pubDate>Thu, 03 Aug 2023 07:32:42 GMT</pubDate>
            <atom:updated>2023-08-03T07:32:42.567Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*SVIqgZ5D7FnWuI7I" /><figcaption>Photo by <a href="https://unsplash.com/@sortino?utm_source=medium&amp;utm_medium=referral">Joshua Sortino</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><p>Cypress is a next generational test automation tool which is used for end-end UI Automation testing of a web application. It is an open-source test automation framework for testing web based applications or web applications which uses JavaScript as test scripting language used to perform unit testing, integration testing and end-to-end testing.</p><p>Cypress is often compared to Selenium which performs web-based testing, however it is architecturally and fundamentally different from selenium.</p><h3><strong>Cypress Architecture:</strong></h3><p>Many of test automation tools operate by executing outside the browser and executing remote commands across the network. However, in cypress it is the browser that is executing your test code.</p><p>By modifying DOM and network requests and answers, Cypress is able to listen and alter browser behavior in real time. Cypress provides complete control over your application and opens possibilities to new types of testing.</p><p>Cypress supports the following browser at present:</p><ul><li>Chrome</li><li>Electron</li><li>Firefox &amp; IE Browser</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/939/1*hSo9m8tWIrYsPhJ4fqta6w.png" /><figcaption>Fig 1: Architecture diagram</figcaption></figure><h3><strong>How Cypress is Unique from other Automation tools?</strong></h3><ul><li>It <a href="https://docs.cypress.io/guides/core-concepts/introduction-to-cypress.html#Cypress-is-Not-Like-jQuery">automatically waits</a> for commands and assertions before moving on. No more async hell</li><li>Ability to test Edge Testcases by Mocking the server response</li><li>Cypress takes screenshots as your tests run. We can hover over each commands in the <a href="https://docs.cypress.io/guides/core-concepts/test-runner.html#Command-Log">Command Log</a> to see exactly what happened at each step</li><li>Due to its Architectural design, Cypress delivers fast and reliable test execution compared to other Automation tools</li><li>We can view videos of your entire tests execution when run from the Cypress Dashboard.</li></ul><h3><strong>Cypress Components:</strong></h3><h4>Test Runner</h4><p>Cypress runs tests in a unique interactive runner that allows you to see commands as it is executing and viewing application under test.</p><h4>Cypress Dashboards</h4><p>It is an web-based companion to the test runner, it provides great and powerful insights of all tests under one bucket.</p><h4><strong>Installation</strong></h4><p>Prerequisites</p><p>1. Visual Studio IDE installed or any other similar IDE</p><p>2. node.js</p><p>3. npm package</p><h4>Steps</h4><p>1. npm -i init-&gt; this will create a package.json file</p><p>2. npm install cypress — save-dev -&gt; the latest version of cypress will be installed using this command in your system.</p><p>3. node_modules/.bin/cypress open -&gt; we can open cypress window using this command.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*d1O5K9sCWG-MWAKEya2AFw.png" /><figcaption>Fig 2: Cypress runner Window</figcaption></figure><p>Once the cypress runner window opens, we can see a new folder created in a project named <strong>cypress.</strong></p><p><strong>Folder structure inside cypress folder is as follows:</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*2mH9KKO6ASiC5k8HcJLF8Q.png" /><figcaption>Fig 3: Folder structure (Visual studio IDE)</figcaption></figure><p><strong>Downloads</strong>: Folder where files downloaded during a test are saved.</p><p><strong>Fixtures</strong>: It is used to put all test data files.</p><p><strong>Integration</strong>: All test scripts created will be here.</p><p><strong>Support</strong>: Reusable methods or custom methods created can be put here.</p><p><strong>Videos</strong>: It has recordings of test execution</p><p>To run tests from terminal, we use node_modules/.bin/cypress run -&gt; This will run all test under integration folder.</p><h4><strong>Cypress Test Runner</strong></h4><p>Cypress runs tests in a unique interactive way, which allows users to see the steps as it is executing and application under test at same time.</p><p>The following features of Cypress Test Runner are:</p><ul><li>Test Status: It shows the summary of test executions, which includes pass and failed test cases and count.</li><li>Command Logs: It shows logs we get while interacting with web applications.</li><li>URL section: Shows the URL of application under test</li><li>App section: Shows real time interaction with web application.</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hvlXcuLqrwJrwLHJlve-yQ.png" /><figcaption>Fig4: Cypress Test Runner Window</figcaption></figure><h4><strong>Writing a test in cypress:</strong></h4><p>The test script can be written only using JavaScript framework like chai, mocha.</p><p>It is similar to how we use frameworks such as TestNG in Selenium Java or Pytest in Python Selenium.</p><p>It is better to use mocha framework for our testing in Cypress and we need not download mocha explicitly as it will be installed with cypress library.</p><h4><strong>Sample code snippet</strong>:</h4><pre>/// &lt;reference types=&quot;Cypress&quot; /&gt;<br>import &quot;cypress-iframe&quot;<br>describe(&#39;My first test suite&#39;, function()<br>{<br>it(&#39;My first test case&#39;, function() {<br>cy.visit(&quot;www.amazon.com&quot;);<br>})<br>}<br>)</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/914/1*dppG6WEZmYsB3wdMznkpmQ.png" /><figcaption>Fig 5: Test case sample</figcaption></figure><p>“describe” can be treated as test suite and “it” as test case which comes under mocha framework.</p><h4><strong>Locators:</strong></h4><p>Cypress supports CSS selectors only and doesn’t support other locator strategy, however we have option to use xpath using external plugin like chropath.</p><h4><strong>Cypress vs Selenium:</strong></h4><p>PROS</p><ul><li>It takes screenshots automatically after the completion/failure of test case and records the test execution when running from Command Line</li><li>We need not put explicit sleep timing while the page is loading, it waits automatically for commands or validations before going to next step</li><li>As it is directly involved with browser while interacting, it will control the browser without externally adding any web drivers.</li><li>We as a tester can see each and every step of test execution and once after completion of test case and if we find any errors we can add pause() or debug() in script to debug the code</li><li>Due to its architectural design, Cypress delivers fast, consistent, and reliable test execution compared to other Automation tools.</li></ul><p>CONS</p><ul><li>It is new to the testing community and doesn’t have much community support like Selenium</li><li>It doesn’t support multiple browser tabs automation inbuilt itself in cypress, but we have work around for that using Jquery commands</li><li>It supports only JavaScript language for creation of test scripts, so a person who is using this should have basic knowledge of JavaScript</li></ul><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=72f319e29b77" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/starting-with-cypress-automation-72f319e29b77">Starting with Cypress Automation</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[PyTest Framework for Test Automation: Unlocking its potential — Part 1]]></title>
            <link>https://medium.com/knowledgelens/pytest-framework-for-test-automation-unlocking-its-potential-part-1-33f316b92656?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/33f316b92656</guid>
            <category><![CDATA[python-automation]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[pytest]]></category>
            <category><![CDATA[selenium-test-automation]]></category>
            <category><![CDATA[automation-testing]]></category>
            <dc:creator><![CDATA[Madhuri Yerrannagari]]></dc:creator>
            <pubDate>Tue, 18 Jul 2023 12:30:53 GMT</pubDate>
            <atom:updated>2023-07-18T12:38:49.268Z</atom:updated>
            <content:encoded><![CDATA[<h3>PyTest Framework for Test Automation: Unlocking its potential — Part 1</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*zHIvr4EQBGKNDsKCyyy6Cw.png" /><figcaption>Google Image</figcaption></figure><p>The PyTest framework is a popular choice for test automation in the Python ecosystem. It provides a simple and powerful testing framework for writing and executing test cases efficiently. In this article, we will explore the key features and benefits of PyTest, along with practical examples to demonstrate its usage.</p><h3><strong>What is PyTest?</strong></h3><p>Pytest is a software test framework, which means pytest is a command-line tool that automatically finds tests you’ve written, runs the tests, and reports the results.</p><p>A robust Python testing tool, pytest can be used for all types and levels of software testing. Pytest can be used by development teams, QA teams, independent testing groups, individuals practicing TDD, and open source projects.</p><h3><strong>Why to choose Pytest?</strong></h3><p>Pytest supports unit testing. I started my Python adventure with UI test automation using Selenium. I started to prepare a test automation plan and make some research for what to use. I tried to find the best possible tool to use which gains the most for the test automation project. This is where test automation planning is important to have before starting. It is where I met with Pytest.</p><h3><strong>Advantages of Pytest:</strong></h3><p>· Pytest has its own way to detect the test file and test functions automatically, if not mentioned explicitly.</p><p>· It allows us to execute a specific part of a test suite and also skip a subset of the entire test suite.</p><p>· Pytest can run multiple tests in parallel, so it reduced the execution time of the test suite significantly.</p><p>· It has a simple syntax and is easy to learn and start using.</p><p>· It is open source and free.</p><p>· It has many documentation available and IDE support.</p><h3><strong>Getting started with Pytest:</strong></h3><h4><strong>Installation:</strong></h4><p>To follow along here, you will need to have pytest installed. On most systems, you can do this by running the following code at the command line:</p><p>Pip install pytest</p><h4><strong>Writing test functions:</strong></h4><p>Lets assume we have a simple function to test</p><pre>def add_numbers(x, y):</pre><pre>    return x + y</pre><pre># Now, let&#39;s write test functions for the above function</pre><pre>def test_add_numbers():</pre><pre>    # Test case 1: Adding positive numbers</pre><pre>    result = add_numbers(2, 3)</pre><pre>    assert result == 5, &quot;Addition of positive numbers failed&quot;</pre><pre>    # Test case 2: Adding negative numbers</pre><pre>    result = add_numbers(-5, -10)</pre><pre>    assert result == -15, &quot;Addition of negative numbers failed&quot;</pre><pre>test_add_numbers()</pre><p>In the example above, we have a function <strong>add_numbers</strong> that takes two arguments and returns their sum. We then define a test function <strong>test_add_numbers</strong> that contains multiple test cases. Each test case verifies the expected result using the <strong>assert</strong> statement. If the condition in <strong>assert</strong> is False, an error message will be displayed.</p><h4><strong>Running tests:</strong></h4><p>1. Download the updated webdriver and place it in the specified location where you gonna run your test project.</p><p>2. Import the WebDriver and Keys classes from Selenium.</p><pre>from selenium import webdriver<br>from selenium.webdriver.common.keys import Keys</pre><p>The WebDriver class will connect you to a browser’s instance, which we will shortly cover. The Keys class lets you emulate the stroke of keyboard keys, including special keys like “<strong>Shift</strong>” and “<strong>Return</strong>”.</p><p>3. Next, create an instance of Chrome with the path of the driver that you downloaded through the websites of the respective browser. In this example, we assume that the driver is in the same directory as the Python script that you will execute.</p><pre>chrome_executable_path = &quot;./Driver/chromedriver.exe&quot;</pre><p>4. Next, use the <strong>.get()</strong> method of the driver to load a website. You may also load a local development site as this process is equivalent to opening a window of Chrome on your local machine, typing a URL and hitting Enter. The <strong>.get()</strong> method not only starts loading a website but also waits for it to render completely before moving on to the next step.</p><pre>Login_locators = {<br>    &#39;URL&#39;:&#39;http://mzs.zsservices.com/&#39;,<br>}<br><br>def get_url(https://medium.com/self):<br>    url = Login_locators[&#39;URL&#39;]<br>    return url<br><br>driver.get(get_url())</pre><p>In this example, I have defined the URL value in the file ‘Login_locators’ and getting the respective value by importing the class I used in Login_locators file.</p><h4><strong>Finding Xpaths:</strong></h4><p><strong>XML Path</strong> or commonly known as <strong>XPath</strong>, is a query language for <strong>XML</strong> documents. It is made of <em>path expression</em> governed by some pre-defined conditions. Moreover, <em>XPath</em> can be effectively used to identify and locate almost any element present on a web page. It is quite helpful while working on a dynamic web page where the web element’s unique attributes are not constant. Moreover, it allows us to write <strong>XML document navigation flow</strong> for locating web elements.</p><h4><strong>Syntax of Xpath:</strong></h4><pre>XPath = //tag_name[@Attribute_name = “Value of attribute”]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/707/1*4VhG9woTP3IZanCVw0FlVQ.png" /><figcaption>Image by Author</figcaption></figure><h3><strong>What is HTML/XML DOM?</strong></h3><p>All the <a href="https://en.wikipedia.org/wiki/HTML"><strong>HTML</strong></a> web pages are internally represented as an <a href="https://en.wikipedia.org/wiki/XML#:~:text=Extensible%20Markup%20Language%20(XML)%20is,free%20open%20standards%E2%80%94define%20XML."><strong>XML</strong></a> document. Additionally, the XML document has a tree-like structure, where we have different tags and attributes. For example, if we open the Chrome Dev tools section by right-clicking on any page and selecting the “<strong>Inspect</strong>” option, the HTML structure will look as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*SEwvF2XH1QTskDmXtMCj5A.png" /><figcaption>Image by Author</figcaption></figure><p>It starts with a tag <strong>&lt;html&gt;</strong> which has two child nodes <strong>&lt;head&gt;</strong> and <strong>&lt;body&gt;</strong>. Here <strong>&lt;body&gt;</strong> again has a child node like <strong>&lt;div&gt;</strong>, which has its child nodes. Further, you can also see the first <strong>&lt;div&gt;</strong> tag has an “<strong>id</strong>” attribute, which has a value “<strong>app</strong>”. Similarly, the child node of the <strong>&lt;div&gt;</strong> also has its own set of attributes and values.</p><p>One thing that we can notice here is every node that opens is again closed by using forward slash before the tag name, such as the <strong>&lt;body&gt;</strong> tag is closed using <strong>&lt;/body&gt;</strong>. So, this way, we can see that all the HTML pages are internally represented as an XML document and constitute the XML DOM (Document Object Model).</p><p><strong>Different Kinds of XPaths:</strong></p><p>Selenium uses two strategies to locate elements using XPaths :</p><ul><li>Locating a web element using an Absolute XPath.</li><li>Locating a web element using Relative XPath.</li></ul><h4>Absolute Path:</h4><p><strong>Absolute XPath</strong> is the direct way of finding the element. Moreover, it starts from the <em>first/root</em> node of the <em>XML/HTML</em> document and goes all the way to the required node following one node at a time.</p><p>Example:</p><pre>&#39;/html/body/app-root/app-team-member/div[2]/div/main/div[3]/app-survey-email/div[1]/fieldset/div[3]/div/div/div[2]/app-mr-task/div/div/div/div/div[1]/div[1]/div[3]/div/input&#39;</pre><h4>Relative Path:</h4><p><strong>Relative XPath</strong> starts from <em>any node</em> inside the <em>HTML DOM</em>; it need not start from the root node. It beings with a <strong>double forward slash.</strong></p><p>Example<strong>:</strong></p><pre>//input[@id= &quot;ctl00_PageContentPlaceholder_UserNameInput&quot;]</pre><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=33f316b92656" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/pytest-framework-for-test-automation-unlocking-its-potential-part-1-33f316b92656">PyTest Framework for Test Automation: Unlocking its potential — Part 1</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Component Communication in Angular]]></title>
            <link>https://medium.com/knowledgelens/component-communication-in-angular-2be0e478ec85?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/2be0e478ec85</guid>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Mohan N]]></dc:creator>
            <pubDate>Fri, 07 Jul 2023 10:54:51 GMT</pubDate>
            <atom:updated>2023-07-07T10:54:51.785Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1OX3C6BK3DtsMjlV_4sDZQ.jpeg" /><figcaption>Photo by Alex Andrews: <a href="https://www.pexels.com/photo/three-black-handset-toys-821754/">https://www.pexels.com/photo/three-black-handset-toys-821754/</a></figcaption></figure><p>In this article, we will show you a few ways in which Angular Components can communicate or interact with each other.</p><p>The Component is the main building block of an Angular App. A typical Angular application consists of a lot of components. Each component handles a small part of the UI. These components must interact or communicate together to produce the complete user interface of the application</p><p>There are few ways in which components can communicate or share data between them. And methods depend on whether the components have a Parent-child relationship between them are not.</p><p>Here are the three Possible scenarios:</p><ol><li>Parent to Child Communication</li><li>Child to Parent Communication</li><li>Interaction when there is no parent-child relation</li></ol><p>A common pattern in Angular is sharing data between a parent component and one or more child components. Implement this pattern with the @Input() and @Output() decorators.</p><h3>Parent to Child Communication</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*3Qwio4c-G-errw8R" /><figcaption>Image by Author</figcaption></figure><p>If the Components have a parent-child relationship then, then the parent component can pass the data to the child using the <a href="https://www.tektutorialshub.com/angular/angular-input-output-eventemitter/#input">@</a>Input Property.</p><p>To use the @Input() decorator in a child component class, first import Input and then decorate the property with @Input(), as in the following example.</p><p><strong>In the parent component template:</strong></p><pre>&lt;app-child [message]=&quot;myText&quot;&gt;&lt;/app-child&gt;</pre><p>Use property binding to bind the message property in the child to the parentMessage property of the parent.</p><p><strong>In the child component:</strong></p><p>To use the @Input() decorator in a child component class, first import Input and then decorate the property with @Input(), as in the following example:</p><pre>import { Component, EventEmitter, Input, Output, OnInit } from &#39;@angular/core&#39;;<br>@Component({selector: &#39;app-child&#39;,<br>templateUrl: &#39;./child.component.html&#39;,<br>styleUrls: [&#39;./child.component.css&#39;] })<br>export class ChildComponent implements OnInit {<br>@Input() message: any;<br>constructor() { }<br>ngOnInit(): void { }<br>}</pre><p><strong>Child Component Html</strong></p><pre>&lt;p&gt;Child Component : {{message}} &lt;/p&gt;</pre><p>The Child Component can get the values from the <em>message</em>. But it also important for the child component to get notification when the values change.</p><p>To watch for changes on an @Input() property, use OnChanges, one of Angular’s lifecycle hooks.</p><h3>Child to Parent Communication</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/616/0*pbuuJJJSTPi0l0XB" /><figcaption>Image by Author</figcaption></figure><p>@Output() marks a property in a child component as a doorway through which data can travel from the child to the parent.</p><p>The child component uses the @Output() property to raise an event to notify the parent of the change. To raise an event, an @Output() must have the type of <em>EventEmitter</em>, which is a class in @angular/core that you use to emit custom events.</p><p><strong>In the child component—</strong></p><p><strong>In the parent component template:</strong></p><pre>&lt;app-child (dataEvent)=&quot;receiveData($event)&quot;&gt;&lt;/app-child&gt;</pre><p><strong>In the parent component:</strong></p><pre>&lt;p&gt;Parent Component : {{childData}}&lt;/p&gt; <br>&lt;app-child (dataEvent)=&quot;receiveData($event)&quot;&gt;&lt;/app-child&gt;</pre><pre>import { Component, OnInit } from &#39;@angular/core&#39;;<br><br> @Component({selector: &#39;app-parent&#39;,<br> templateUrl: &#39;./parent.component.html&#39;,<br>styleUrls: [&#39;./parent.component.css&#39;]<br> }) <br>export class ParentComponent implements OnInit {   <br>public myText = &quot;Data from Parent Component&quot;;  <br>public childData : any;  <br>constructor() { }<br> ngOnInit(): void {   }<br> <br>receiveData(data : any) {  <br> this.childData = data; <br>  }   <br><br>}</pre><p><strong>Child Component</strong></p><pre>import { Component, EventEmitter, Input, Output, OnInit } from &#39;@angular/core&#39;;<br>@Component({selector: &#39;app-child&#39;,<br>templateUrl: &#39;./child.component.html&#39;,<br>styleUrls: [&#39;./child.component.css&#39;] })<br>export class ChildComponent implements OnInit {<br>@Output() dataEvent = new EventEmitter&lt;any&gt;();<br>constructor() { }<br>ngOnInit(): void { }<br>sendData() {<br>this.dataEvent.emit(&quot;Data From Child&quot;);<br>}<br>}</pre><h3>Interaction when there is no parent-child relation</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/432/0*-D_nP1km9egPXkfG" /><figcaption>Image by Author</figcaption></figure><p>When there is no relation between the components we can not pass the data using the above methods(@Input and @output). This happens when your components have no parent child relation or components are in different modules. In these kinds of scenarios, we have share data between components using a service as a central communication mechanism.</p><p>A service is a class that can be injected into components and other services, allowing them to share data and functionality.</p><h4><strong>Data service</strong></h4><p>Inject the service into the components where you want to share the data. You can do this by adding the service as a constructor parameter:</p><pre>import { Injectable } from &#39;@angular/core&#39;;<br>@Injectable({<br>providedIn: &#39;root&#39;<br>})<br>export class DataService {<br>private sharedData: string;<br>constructor() { }<br>setSharedData(data: string): void {<br>this.sharedData = data;<br>}<br>getSharedData(): string {<br>return this.sharedData;<br>}<br>}</pre><p><strong>In the receiving component, inject the service and use it to access the shared data:</strong></p><pre>import { Component } from &#39;@angular/core&#39;;<br>import { DataService } from &#39;../service/data.service&#39;;<br>@Component({<br>selector: &#39;app-component2&#39;,<br>template: `<br>&lt;div&gt;{{ sharedData }}&lt;/div&gt;<br>`<br>})<br>export class Component2 {<br>sharedData: string;<br>constructor(private dataService: DataService) { }<br>ngOnInit(): void {<br>this.sharedData = this.dataService.getSharedData();<br>}<br>}</pre><p><strong>Inject the service into the components where you want to share the data. You can do this by adding the service as a constructor parameter:</strong></p><pre>import { Component } from &#39;@angular/core&#39;;<br>import { DataService } from &#39;../service/data.service&#39;;<br>@Component({<br>selector: &#39;app-component1&#39;,<br>template: `<br>&lt;button (click)=&quot;updateData()&quot;&gt;Update Data&lt;/button&gt;<br>`<br>})<br>export class Component1 {<br>constructor(private dataService: DataService) { }<br>updateData(): void {<br>this.dataService.setSharedData(&#39;New data from Component1&#39;);<br>}<br>}</pre><p>Now, when you update the data in Component1 using the <em>updateData</em>() method, the changes will be reflected in Component2 through the shared service.</p><h3>Reference :</h3><p><a href="https://angular.io/guide/inputs-outputs">https://angular.io/guide/inputs-outputs</a></p><p>Git Repo: <a href="https://github.com/mohanacchu/angular-communication/tree/dev">https://github.com/mohanacchu/angular-communication/tree/dev</a></p><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2be0e478ec85" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/component-communication-in-angular-2be0e478ec85">Component Communication in Angular</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Storybook for Angular]]></title>
            <link>https://medium.com/knowledgelens/storybook-for-angular-87b22c585694?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/87b22c585694</guid>
            <category><![CDATA[nodejs]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[html]]></category>
            <dc:creator><![CDATA[Aswinjith M]]></dc:creator>
            <pubDate>Fri, 30 Jun 2023 12:48:54 GMT</pubDate>
            <atom:updated>2023-06-30T12:48:53.971Z</atom:updated>
            <content:encoded><![CDATA[<h4><strong>Easy way to build and document UI components isolated from the business logic</strong></h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*xNcShhBifzGgqFwy51bJuQ.jpeg" /><figcaption>Photo by <a href="https://unsplash.com/@markfb?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Mark Fletcher-Brown</a> on <a href="https://unsplash.com/photos/nN5L5GXKFz8?utm_source=unsplash&amp;utm_medium=referral&amp;utm_content=creditCopyText">Unsplash</a></figcaption></figure><p>Storybook is a freely available resource that facilitates the creation and documentation of user interfaces isolated for React, Vue, Angular, and more. By using this tool we can make UI components that can run alongside our actual application.</p><p>Developers will be able to test the functionality and behavior of each component without running the entire application. Moreover it also provides the facility to do the documentation so that other users can view it and understand how it’s working and for what purpose it’s using.</p><p>Creating a storybook for an Angular application can be a great way to document and showcase your UI components. Storybook is a development environment and UI component explorer that allows you to build, test, and document your components in isolation.</p><h3>Set up Storybook for Angular</h3><p>To set up Storybook for an Angular project, you can follow these steps:</p><ul><li>Use a new Angular project or use an existing one</li><li>Install the required dependencies by using the following command in your project’s root directory — <strong>npm install @storybook/angular — save-dev</strong></li><li>Once the installation is done, initialize our Storybook using the following command — <strong>npx sb init</strong></li><li>This command will set up the necessary configuration files and folder structure for Storybook</li><li>Once the initialization is done, we can add stories for Angular components</li></ul><h4><strong>What is story</strong></h4><p>Stories are individual pieces of UI that define different states of a component. Create a new file with a <strong>.stories.ts</strong> extension in the same directory as our component.</p><p>Suppose, if we have a component called <strong>StoryDemoComponent</strong>, create a file named <strong>storyDemo.stories.ts.</strong></p><pre>import { stories of } from @storybook/angular&#39;;<br>import { StoryDemoComponent} from &#39;./storyDemo.component&#39;;<br>storiesOf(&#39;storyDemo&#39;, module).add(&#39;Default&#39;, () =&gt; ({<br>component: StoryDemoComponent,<br>props: {<br>text: &#39;Click me&#39;,},}})<br>.add(&quot;Disabled&#39;, () =&gt; ({<br>component: StoryDemoComponent,<br>props: {<br>text: &#39;Disabled&quot;,<br>disabled: true,<br>},}));</pre><p>Use the following command to run Storybook locally — <strong>npm run storybook</strong></p><p>While Storybook is active, any modifications applied to our component will be instantly reflected, enabling us to work on it independently, examine its functionality, and evaluate its visual design through the Canvas tab.</p><p>So first, let’s give our component some properties :</p><h4><strong>storyDemo.component.ts</strong></h4><pre>export class storyDemoComponent {<br>@Input () color: &#39;primary&#39; | &#39;secondary&#39; = &#39;primary&#39;;<br>@Input () href: string;<br>@Input () target?: &#39;_self&#39; | &#39;_blank&#39; | &#39;_parent&#39; | &#39;_top&#39;<br>public get classes (): Array&lt;string&gt; {<br>return [&#39;link&#39;, ${this.color}-link`];<br>}<br>}</pre><h4><strong>storyDemo.component.html</strong></h4><pre>&lt;a [ngclass]=&quot;classes&quot; [href]=&quot;href&quot; [target]=&quot;target&quot;&gt;<br>&lt;ng-content&gt; &lt;/ng-content&gt; &lt;/a&gt;</pre><h4><strong>storyDemo.component.scss</strong></h4><pre>.link {<br> text-decoration:<br> border-bottom:<br> none;<br> 1px dotted;<br> @media screen and (min-width: 600px) {<br> font-size: 1.15em;<br>}<br>}<br>.primary-link {<br> color: #ff4785;<br> border-color: #ff4785;<br>}<br>.secondary-link {<br> color: #1ea7fd;<br> border-color: #1ea7fd;<br>}</pre><p>We need to update our story file as well.</p><h4><strong>storyDemo.stories.ts</strong></h4><pre>const Template: Story&lt;StoryDemoComponent&gt;<br>component: Story Demo Component,<br>props: {<br>color: &#39;primary&#39;,<br>content: &#39;Visit Storybook&#39;,<br>href: &#39;https://storybook.js.org/&#39;,<br>target: &#39;_blank&#39;,<br>},<br>template:<br>`&lt;app-link [color]=&quot;color&quot; [href]=&quot;href&quot; [target]=&quot;target&quot;&gt;<br>{{ content }} &lt;/app-link&gt;`,<br>});</pre><h3><strong>Output</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/787/0*pLRhmgR2xCu0lIUX" /><figcaption>Image by Author</figcaption></figure><h3>Documenting Component</h3><p>Storybook offers support for .mdx files, enabling us to construct pages efficiently by leveraging the capabilities of both markdown and HTML elements.</p><p>Consequently, we can seamlessly integrate documentation into our component. To accomplish this, we’ll create a new file called <strong>storyDemo.stories.mdx</strong>, as illustrated below.</p><pre>import { Meta } from &#39;@storybook/addon-docs/blocks&#39;;<br>&lt;Meta title=&quot;Components/Link/Documentation&quot; /&gt;<br>&lt;style&gt;{`<br> #colors {<br> margin: 20px 0px;<br> }`<br>}&lt;/style&gt;</pre><h4>StoryBook Documentation</h4><p>While Storybook already offers numerous advantages, the addition of the docs plugin further enhances its value. One of the key benefits of Storybook Docs is the ability to maintain component documentation in close proximity to the code, simplifying maintenance and updates as the project evolves. Developers can seamlessly incorporate documentation into Stories using markdown files.</p><h4>About — StoryBook</h4><p>This documentation encompasses various aspects of the component, including its description, intended behavior, recommended usage scenarios, props and their types, and even interactive examples showcasing the component’s functionality. Additionally, Storybook Docs supports global documentation, providing a centralized space to document guidelines and best practices for the entire component library.</p><p>The resulting perks are remarkable: a unified source of truth as all component-related information is stored and managed in a single location. The documentation is readily accessible through the published Storybook web app. Furthermore, Storybook’s editability is limited to developers, ensuring that any modifications to styling guidelines or a component’s appearance cannot be made without the developers’ awareness. All additions and changes must be deliberated by designers and developers, passing through the development team’s approval process before being incorporated into Storybook.</p><p>The following demonstrates the potential results we can achieve with it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*au-BVl_TqU8kAN5i" /><figcaption>Image by Author</figcaption></figure><p>Complete source code of this storybook you can find in the following github repository — <a href="https://github.com/Aswinjithm/angular-storybook-scaleup"><strong>Source Code</strong></a></p><h4><strong>References:</strong></h4><ul><li><a href="https://storybook.js.org/tutorials/">Storybook</a></li><li><a href="https://angular.io/docs">Angular</a></li><li><a href="https://docs.angularjs.org/guide">Angular developer guide</a></li><li><a href="https://nodejs.dev/en/learn/">Node js learning</a></li><li><a href="https://nodejs.org/en/docs">Node js package</a></li><li><a href="https://docs.npmjs.com/">Npm</a></li><li><a href="https://www.typescriptlang.org/docs/handbook/angular.html">Typescript</a></li><li><a href="https://devdocs.io/javascript/">Javascript</a></li></ul><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=87b22c585694" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/storybook-for-angular-87b22c585694">Storybook for Angular</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Understanding Subject and BehaviorSubject in RxJs]]></title>
            <link>https://medium.com/knowledgelens/understanding-subject-and-behaviorsubject-in-rxjs-d92c300c5850?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/d92c300c5850</guid>
            <category><![CDATA[subject]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[behaviorsubject]]></category>
            <dc:creator><![CDATA[Dayal Dev]]></dc:creator>
            <pubDate>Thu, 15 Jun 2023 14:14:20 GMT</pubDate>
            <atom:updated>2023-06-16T06:31:50.684Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8AZFf47xbHkGW4VJP9wVZA.jpeg" /><figcaption>Photo by ROMBO: <a href="https://www.pexels.com/photo/blue-and-brown-guitar-picks-3477581/">https://www.pexels.com/photo/blue-and-brown-guitar-picks-3477581/</a></figcaption></figure><p>Angular applications benefit from the robust capabilities of RxJS (Reactive Extensions for JavaScript) when it comes to managing asynchronous data streams.</p><p>Within RxJS, <strong>Subject and BehaviorSubject</strong> are essential constructs that are sometimes confused with one another. Nonetheless, these two entities possess unique attributes and are employed in distinct scenarios.</p><p>In this article, we will examine the disparities between Subject and BehaviorSubject, investigating their functionalities, providing practical instances, and outlining appropriate use cases for each.</p><p>Before moving into the difference, let’s go through some basics.</p><h4>What is <strong>Asynchronous </strong>programming?</h4><p><em>Asynchronous</em> refers to a programming approach where tasks can be executed independently and concurrently, without blocking the program’s execution flow. Instead of waiting for each task to complete before moving on to the next one, asynchronous programming allows tasks to be initiated and run in the background.</p><p>Asynchronous programming is commonly used when dealing with tasks that may take a long time to complete, such as fetching data from a remote server or performing complex calculations, as it helps improve efficiency and responsiveness.</p><p>In Angular to get this asynchronous data, the RxJS library is providing a tool called Observable. <strong>Observable</strong> is like a pipeline or channel through which data flows. It can contain data retrieved from asynchronous calls and emit multiple values asynchronously, and observers can subscribe to it to receive and handle those values as they are emitted.</p><p>Example:</p><pre>import { Observable } from &#39;rxjs&#39;;<br><br>const numbersObservable = new Observable&lt;number&gt;((observer) =&gt; {<br> for (let i = 1; i &lt;= 5; i++) {<br> observer.next(i);<br> }<br> observer.complete();<br>});<br>const subscription = numbersObservable.subscribe((value: number) =&gt; {<br> console.log(value);<br>});</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/782/1*-yw5st6p_O5s_633y_5z0w.png" /></figure><p>The numbersObservable emits values from 1 to 5 using the observer.next() method inside the for loop. Each emitted value is then received by the subscription’s callback function. An Observable will be updated each time when new data is available.</p><p>Subject and BehaviorSubject are both types of observables in RxJS that can be used to handle data streams.</p><p>Let’s explore the characteristics and behavior of each observable.</p><h4><strong>What is a Subject?</strong></h4><p>Subject is a specialized type of observable in RxJS that allows values to be multicast to multiple subscribers simultaneously. In other words, a Subject acts as an event emitter, dispatching values or triggering events to all subscribed observers at the same time.</p><p>Example:</p><pre>import { Subject } from &#39;rxjs&#39;;<br><br>const mySubject = new Subject();<br>mySubject.subscribe(value =&gt; {<br> console.log(&#39;Subscriber 1:&#39;, value);<br>});<br><br>mySubject.next(&#39;Hello World&#39;);<br><br>mySubject.subscribe(value =&gt; {<br> console.log(&#39;Subscriber 2:&#39;, value);<br>});<br><br>mySubject.next(&#39;RxJS is amazing!&#39;);</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/778/1*SdfYeQbz70LOsvu8zqY9Yg.png" /></figure><p>In the above example, we instantiate a Subject called mySubject. We subsequently subscribe two distinct observers to it, and upon emitting values using the next() method, all subscribers receive the emitted values concurrently.</p><h4><strong>What is BehaviorSubject?</strong></h4><p>Behaviorsubject is another variant of a Subject that retains the current value and conveys it to new subscribers.</p><p>When a new observer subscribes to a BehaviorSubject, it instantly obtains the most recently emitted value, or a default value if no value has been emitted yet. This feature makes BehaviorSubject particularly useful in scenarios where accessing the latest value is essential.</p><p>Unlike Subject, we need to initialize a default value to BehaviorSubject whenever it is declared.</p><p>Example:</p><pre>import { BehaviorSubject } from &#39;rxjs&#39;;<br><br>const myBehaviorSubject = new BehaviorSubject(&#39;Initial value&#39;);<br><br>myBehaviorSubject.subscribe(value =&gt; {<br> console.log(&#39;Subscriber 1:&#39;, value);<br>});<br><br>myBehaviorSubject.next(&#39;New value&#39;);<br><br>myBehaviorSubject.subscribe(value =&gt; {<br> console.log(&#39;Subscriber 2:&#39;, value);<br>});</pre><p>Output:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/773/1*rB4tuMWfuPiKibVi76SoOA.png" /></figure><p>In the above example, when the first observer subscribes, it promptly receives the initial value. Later, when we emit a new value using next(), both observers receive the updated value.</p><h4>Key Differences:</h4><p>If you subscribe to a Subject, it won’t provide anything until it is triggered by calling the next() method. But if you subscribe to a BehaviorSubject, it will provide you the default value as the initial value / current value.</p><p>A Subject in RxJS will emit only the upcoming values to its subscribers. When you subscribe to a Subject, it will start emitting values from the point of subscription onward.</p><p>On the other hand, a BehaviorSubject, in addition to emitting upcoming values, also emits the most recent (previous) value to new subscribers. This means that when you subscribe to a BehaviorSubject, you will immediately receive the last emitted value, even if it was emitted before you subscribed.</p><h4><strong>Conclusion</strong></h4><p>Subject and BehaviorSubject are invaluable constructs in RxJS, enabling developers to handle and manipulate data streams proficiently.</p><p>While Subject facilitates multicast behavior, allowing multiple observers to receive emitted values concurrently, BehaviorSubject ensures that fresh subscribers receive the most recently emitted value, making it suitable for scenarios where the latest value holds significance.</p><p>By comprehending their distinctions and capabilities, you can judiciously select the most appropriate option to cater to your reactive programming requirements.</p><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d92c300c5850" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/understanding-subject-and-behaviorsubject-in-rxjs-d92c300c5850">Understanding Subject and BehaviorSubject in RxJs</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to switch Node.js versions with NVS]]></title>
            <link>https://medium.com/knowledgelens/how-to-switch-node-js-versions-with-nvs-35273b27b225?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/35273b27b225</guid>
            <category><![CDATA[node]]></category>
            <category><![CDATA[angular]]></category>
            <category><![CDATA[nvm]]></category>
            <category><![CDATA[vn]]></category>
            <category><![CDATA[nodejs]]></category>
            <dc:creator><![CDATA[Deepak Kumar Panda]]></dc:creator>
            <pubDate>Fri, 26 May 2023 11:36:09 GMT</pubDate>
            <atom:updated>2023-05-26T11:36:09.507Z</atom:updated>
            <content:encoded><![CDATA[<h4>Easy Way to Install Multiple Versions of Node JS with NVS</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EoysqU_HNd5B2IoygpTcdg.jpeg" /><figcaption>Photo by Miguel Á. Padriñán: <a href="https://www.pexels.com/photo/photo-of-golden-cogwheel-on-black-background-3785927/">https://www.pexels.com/photo/photo-of-golden-cogwheel-on-black-background-3785927/</a></figcaption></figure><p><strong>Node version switcher</strong> is a tool that allows you to manage multiple versions of Node.js on your system and switch between them as needed. It is particularly useful when working on projects that require different versions of Node.js due to compatibility or specific requirements. or if you need to test a project with a newer version of Node.</p><p>There are several popular version switchers available for Node.js, including:</p><ol><li><strong>NVM (Node Version Manager)</strong>: NVM is a widely used version manager for Node.js. It allows you to install and manage multiple versions of Node.js on your system. You can easily switch between installed versions using simple commands in the terminal. NVM is available for Unix-based systems (such as macOS and Linux).</li><li><strong>NVM for Windows</strong>: NVM for Windows is a version manager specifically designed for Windows systems. It provides similar functionality to NVM, allowing you to install and switch between different Node.js versions on your Windows machine.</li><li><strong>N</strong>: N is a version manager for Node.js built on top of NVM. It provides a simpler command-line interface and focuses on ease of use. N also supports installing and switching between multiple Node.js versions.</li></ol><p>These version switchers typically work by installing different versions of Node.js in separate directories and updating the system’s PATH environment variable to point to the desired version. This allows you to switch between versions seamlessly without conflicts.</p><h3><strong>NVM vs NVS:</strong></h3><p>NVS is a cross-platform versatile tool designed to facilitate the management of various Node.js versions and forks. It is implemented using node JavaScript and draws inspiration from other popular node version managers, particularly nvm, incorporating similar command-line syntax and concepts.</p><p>Unlike NVM, which may entail permissions or authorization hurdles when changing Node.js versions, NVS provides a seamless experience with no such restrictions. You can effortlessly switch between Node.js versions without encountering any authorization processes or limitations.</p><p>NVS also offers support for convenient switching between different node forks, such as node-chakracore. Additionally, being written in node JavaScript, it encourages node developers to actively contribute and participate in its development.</p><h3><strong>NVS Installation Process</strong></h3><p>To install NVS, We need to follow some steps :</p><ul><li>Visit the URL: <a href="https://github.com/jasongin/nvs/releases">https://github.com/jasongin/nvs/releases</a> and Download the latest NVS msi file</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*KCjaCXk-uezAAxeICTgB9g.png" /><figcaption>Image by Author</figcaption></figure><ul><li>Install the NVS file.</li><li>Now Open Command Prompt and Type “nvs”</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*k6NzFsVK9ySZJveyxRA1OQ.png" /><figcaption>Image by Author</figcaption></figure><ul><li>You will see your current node version as the output, Now you have to select ‘<em>Download another version’</em></li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*0E021EDr2UTKgE1GWnqp5Q.png" /><figcaption>Image by Author</figcaption></figure><ul><li>From the node versions list we can select the desired node version by using the Down/Up arrows and press the enter button</li><li>The selected node version will start downloading…</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*zZiCgaG84Vzw9jkqOIsPGg.png" /><figcaption>Image by Author</figcaption></figure><ul><li>Now check the Node Version using node -v</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*C--8m12GC13wQFgYpzDCgQ.png" /><figcaption>Image by Author</figcaption></figure><ul><li>Now we have successfully changed the node version to our desired node version</li></ul><h3>Command reference</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/801/1*CrZDs1R3s67yzyvBt6J-ew.png" /><figcaption>Image by Author</figcaption></figure><h4>Reference URLs :</h4><ol><li><a href="https://github.com/jasongin/nvs">https://github.com/jasongin/nvs</a></li><li><a href="https://github.com/jasongin/nvs/releases">https://github.com/jasongin/nvs/releases</a></li><li><a href="https://github.com/nvm-sh/nvm">https://github.com/nvm-sh/nvm</a></li></ol><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35273b27b225" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/how-to-switch-node-js-versions-with-nvs-35273b27b225">How to switch Node.js versions with NVS</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Hosting static website using amazon s3]]></title>
            <link>https://medium.com/knowledgelens/hosting-static-website-using-amazon-s3-b4bf428bedc4?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/b4bf428bedc4</guid>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[static-websites]]></category>
            <dc:creator><![CDATA[Punithraj KP]]></dc:creator>
            <pubDate>Wed, 24 May 2023 13:53:00 GMT</pubDate>
            <atom:updated>2023-05-24T13:53:00.214Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GvvE9vQ_j7nTfcUU-z88xg.jpeg" /><figcaption>Photo by Pixabay: <a href="https://www.pexels.com/photo/blue-bright-lights-373543/">https://www.pexels.com/photo/blue-bright-lights-373543/</a></figcaption></figure><h4>What is AWS?</h4><p><strong>AWS (Amazon Web Services)</strong> is the cloud computing platform provided by Amazon that includes a mixture of Infrastructure as a service (IaaS), Platform as a service (PaaS), and packaged Software as a service (SaaS) offerings. AWS offers various kinds of services like computing services, storage services, database services, etc.</p><h4><strong>What is AWS S3?</strong></h4><p><strong>Amazon Simple Storage Service (Amazon S3)</strong> is an object-based storage service. You can store any amount of data of any size in S3. You can also access the data over the internet. It gives any developer access to the same highly scalable, reliable, fast, and inexpensive data storage solution.</p><h4>Static Website Hosting:</h4><p>AWS S3 provides the service through which you can host your static website without having to worry about availability and server maintenance. We need to focus on developing the code rest of the things will be managed by AWS.</p><h3>Prerequisites:-</h3><ol><li>AWS Account</li><li>Basic understanding of DNS, Domain, IP Address &amp; AWS S3.</li></ol><h4>Now let’s start with the process:</h4><p><strong>Step 1:</strong> Log in to your AWS Account — Login to your AWS account and go to S3 Service</p><p><strong>Step 2:</strong> Create a Bucket — Create an S3 bucket and give the name as per your domain name only. Don’t give any other name otherwise, it won’t work</p><p><strong>Step 3:</strong> Upload all the content</p><p><strong>Step 4:</strong> Configure the bucket — Now in order to create the website, we need to modify our newly created bucket so that it can work properly. So, for that follow the below steps:</p><ul><li>Click on your bucket</li><li>Click on the “Properties”</li><li>Select the “Static website hosting” option</li><li>Select “Use this bucket to host a website”</li><li>Enter “index.html” as the index document</li><li>You can leave it blank in the Error (as it is optional) document part, or if you have some file for the error, you can also give a name there</li><li>Click on “Save”</li></ul><p>You can also use below AWS CLI command in order to do all the work from CLI — <strong><em>aws s3 website s3:&lt;Your-bucket-name&gt; — index-document index.html — error-document error.html</em></strong></p><p>After configuring the bucket you will have a URL like this — <strong><em>http://&lt;bucket-name&gt;.s3-website.&lt;region-of-bucket&gt;.amazonaws.com</em></strong></p><p><strong>Step 5:</strong> Modify the Access — In AWS S3 by default, all the buckets are private so, so it won’t allow access over the internet so, in order to access our website we need to make the bucket public. So, follow the below steps:</p><ul><li>Click into your bucket</li><li>Select the “Permissions” tab at the top</li><li>Under “Public Access Settings” click on “Edit”</li><li>Change the Block all public access and set it to False</li></ul><blockquote>Note: You must complete this step before adding the bucket policy to your static website bucket</blockquote><p>Making changes in the above settings is not enough to access the website over the internet. We just need to add the bucket policy also.</p><ul><li>Select the “Permissions” tab at the top</li><li>Under the bucket, policy add the below content</li></ul><pre>{<br>&quot;Version&quot;: &quot;2012–10–17&quot;,<br>&quot;Statement&quot;: [<br>{<br>&quot;Sid&quot;: &quot;PublicReadForGetBucketObjects&quot;,<br>&quot;Effect&quot;: &quot;Allow&quot;,<br>&quot;Principal&quot;: &quot;*&quot;,<br>&quot;Action&quot;: &quot;s3:GetObject&quot;,<br>&quot;Resource&quot;: &quot;arn:aws:s3:::&lt;your-bucket-name&gt;/*&quot;<br>}<br>]<br>}</pre><ul><li>The policy opens up your bucket to anyone in the world. Any object in this bucket is available to the public via the S3 website URL.</li></ul><p><strong>Step 6:</strong> Create a hosted zone — Follow the below steps to create e hosted zone</p><ul><li>Navigate to Route S3 service</li><li>Under the DNS management, click on “Create hosted zone”</li><li>Enter your domain name</li><li>Click on “Public hosted zone”</li><li>Click on save</li></ul><p><strong>Step 7:</strong> Change the name servers</p><ul><li>Navigate the website from where you manage your domain</li><li>Modify the name servers of your domain</li><li>Add the name servers which are provided by the AWS</li></ul><p><strong>Step 8:</strong> Create an Alias</p><ul><li>Navigate to Route 53 service</li><li>Click on Create Record</li><li>Click on Alias</li><li>Select your bucket name</li><li>Click on Create</li></ul><p><strong>Step 9:</strong> Check the website</p><blockquote><strong>Note</strong>: In order to check your newly created website, you need to wait for mins so that AWS can configure all the things for you</blockquote><ul><li>Navigate to your domain and check your newly created website.</li></ul><p>So, that’s it now you have learned how to create a static website using AWS S3. You can now modify the content of the website and play with it.</p><h4>Benefits of using AWS S3 for static website hosting</h4><ul><li>High Availability: S3 is AWS’s high availability and durable service. If the load on your website goes increases then you do not need to worry about that AWS will manage it for you</li><li>No Server maintenance: For hosting the website you don’t need to manage the server and its maintenance all the things will be managed by AWS so that, you can focus on building the code.</li></ul><p><em>If you have reached this far, thank you for reading this blog, I hope you found it insightful 😃. Give us a </em><a href="https://medium.com/knowledgelens"><em>follow</em></a><em> for more content on technology, productivity, work habits, and more!</em></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b4bf428bedc4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/knowledgelens/hosting-static-website-using-amazon-s3-b4bf428bedc4">Hosting static website using amazon s3</a> was originally published in <a href="https://medium.com/knowledgelens">Knowledge Lens: A Rockwell Automation Company</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Keywords to Semantics: The Next Generation of Search with Milvus Vector Databases]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/knowledgelens/keywords-to-semantics-the-next-generation-of-search-with-milvus-vector-databases-6da3cd6c4fdf?source=rss----cfda567a8094---4"><img src="https://cdn-images-1.medium.com/max/1920/1*NvvnEmb3DEOcAK0PYJEdJg.jpeg" width="1920"></a></p><p class="medium-feed-snippet">In today&#x2019;s world of Artificial Intelligence (AI) and Machine Learning (ML), data is everything. As the amount of data generated increases&#x2026;</p><p class="medium-feed-link"><a href="https://medium.com/knowledgelens/keywords-to-semantics-the-next-generation-of-search-with-milvus-vector-databases-6da3cd6c4fdf?source=rss----cfda567a8094---4">Continue reading on Knowledge Lens: A Rockwell Automation Company »</a></p></div>]]></description>
            <link>https://medium.com/knowledgelens/keywords-to-semantics-the-next-generation-of-search-with-milvus-vector-databases-6da3cd6c4fdf?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/6da3cd6c4fdf</guid>
            <category><![CDATA[vector-database]]></category>
            <category><![CDATA[milvus]]></category>
            <dc:creator><![CDATA[Teja sai]]></dc:creator>
            <pubDate>Tue, 16 May 2023 09:50:17 GMT</pubDate>
            <atom:updated>2024-11-18T17:35:34.158Z</atom:updated>
        </item>
        <item>
            <title><![CDATA[Hyperparameter Optimisation with MLOps: From Grid Search to Bayesian Optimisation]]></title>
            <description><![CDATA[<div class="medium-feed-item"><p class="medium-feed-image"><a href="https://medium.com/knowledgelens/hyperparameter-optimisation-with-mlops-from-grid-search-to-bayesian-optimisation-5c93a390676d?source=rss----cfda567a8094---4"><img src="https://cdn-images-1.medium.com/max/1280/1*BBtMF1EOvFHx5cPHhhC22w.jpeg" width="1280"></a></p><p class="medium-feed-snippet">Machine learning models rely on a set of hyperparameters that define the architecture and settings of the model.</p><p class="medium-feed-link"><a href="https://medium.com/knowledgelens/hyperparameter-optimisation-with-mlops-from-grid-search-to-bayesian-optimisation-5c93a390676d?source=rss----cfda567a8094---4">Continue reading on Knowledge Lens: A Rockwell Automation Company »</a></p></div>]]></description>
            <link>https://medium.com/knowledgelens/hyperparameter-optimisation-with-mlops-from-grid-search-to-bayesian-optimisation-5c93a390676d?source=rss----cfda567a8094---4</link>
            <guid isPermaLink="false">https://medium.com/p/5c93a390676d</guid>
            <category><![CDATA[model-training]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[hyperparameter-tuning]]></category>
            <category><![CDATA[bayesian-statistics]]></category>
            <dc:creator><![CDATA[Teja sai]]></dc:creator>
            <pubDate>Wed, 22 Mar 2023 11:13:03 GMT</pubDate>
            <atom:updated>2024-11-18T17:34:00.399Z</atom:updated>
        </item>
    </channel>
</rss>