<?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[Code道 - Medium]]></title>
        <description><![CDATA[The Tao (Chinese: 道; pinyin: Dào; literally: “the Way” ) Code道— is a publication about all things app development. Our way — Learn through sharing - Medium]]></description>
        <link>https://medium.com/lapis?source=rss----5b1d20c80b68---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Code道 - Medium</title>
            <link>https://medium.com/lapis?source=rss----5b1d20c80b68---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 16:23:12 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/lapis" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Setup Apache JMeter in MacBook(M1)]]></title>
            <link>https://medium.com/lapis/setup-apache-jmeter-in-macbook-m1-f12a2053ada5?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/f12a2053ada5</guid>
            <category><![CDATA[performance-testing]]></category>
            <category><![CDATA[jmeter]]></category>
            <category><![CDATA[technology]]></category>
            <dc:creator><![CDATA[Nayomi Edirisinghe]]></dc:creator>
            <pubDate>Thu, 29 Feb 2024 23:59:38 GMT</pubDate>
            <atom:updated>2024-02-29T23:59:38.509Z</atom:updated>
            <content:encoded><![CDATA[<h4>Performance Testing</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/521/1*4drTIVczF0IzReEg2nVqXg.png" /></figure><h3>Pre-requisites</h3><p><strong>Install Java</strong> : Since JMeter is a Java-based application, need to have SDK/JDK/JRE installed which compatibles with ARM architecture of the Apple M1 chip (java 8+ would do).</p><p><strong>Make sure Keytool has been properly setup upon java installation</strong> : In order for JMeter to handle embedded resources and certificate creation on fly, it use keytool utility (available on JDK/JRE). Run below command in your terminal. If you see the help output, it means the utility is available in your PATH.</p><pre>keytool --help</pre><p><a href="https://cwiki.apache.org/confluence/display/JMETER/TestRecording210"><em>https://cwiki.apache.org/confluence/display/JMETER/TestRecording210</em></a></p><p><strong>Download and install JMeter :</strong></p><p>Initially I installed JMeter via brew. But it blocked me at the step of generating .crt certificate. Continue Reading !!</p><pre>arch -arm64 brew install jmeter</pre><h3>Launch JMeter</h3><p>Search for the jmeter executable, which will give you the directory where JMeter is installed. It’s also something that can easily find in brew logs if you still have it !</p><pre>which jmeter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1006/1*SUp3GAU1IlkIh1y8v4fsnw.png" /></figure><p>Use commandopen /&lt;JMeter_Home&gt;/bin/jemeter to launch JMeter application in your computer. Make sure to provide the correct path toJMeter_home</p><pre><br>open /opt/homebrew/bin/jmeter</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oGWvB3ppt85ozEebRsBIXg.png" /></figure><h3>Generate Certificate</h3><p>After launching JMeter successfully on my mac, and following basic instruction 26.2 &gt; steps from 2- 6, under in the documentation<br><a href="https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.html">https://jmeter.apache.org/usermanual/jmeter_proxy_step_by_step.html</a>, I realised that <strong>ApacheJMeterTemporaryRootCA.crt </strong>certifiacate is not generated in <strong>JMETER_HOME/bin</strong> folder.The Certificate need to be installed in the browser, before recording and without it, I couldn’t proceed further. So had to take a step backward and do a manual installation of JMeter again.</p><p>For Apple Silicon (M1) I’m using apache-jmeter-5.6.3.zip. Download, extract it and move the folder somewhere suitable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TlaVkfVw_14omZ_n1ZpWuQ.png" /></figure><p>Add the JMETER_HOME to .zshrc file &amp; source</p><pre>export JMETER_HOME=/Users/ned/apache-jmeter-5.6.3/bin</pre><p>Launch JMeter again. Use the jmeter.sh file</p><pre>sh jmeter.sh</pre><p>Now follow the steps to start the proxy server. This time, it should generate the certificate &amp; should be available in the bin (Note that by default, certificate valid only 7 days)</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Rqjf8_0fUrEaMoN8UuMCtQ.png" /></figure><p>Following the steps to generate a test plan, it created a HTTP(S) Test Script Recorder by default. It looks like it’s disabled, but I could start it when generating the certificate. Anyways, without taking further risk , I manually created another recorder script. Just Right click on Test Plan &gt; Add &gt; Non-Test Elements &gt; HTTP(S) Test Script Recorder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*xT7NMUOQ8l-l9gk0iBzxVQ.png" /></figure><h3>Install Certificate -FireFox</h3><p>To import the certificate, pickup a browser (I will be using Firefox) &gt; go to settings &gt; search for certificate &gt; View Certificate. Under the Authorities tab, you will see the option to import certificate. Click it and browse the certificate from your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9en9E-9Ptsj8aWe1_Ijzag.png" /></figure><p>After importing, you should see the “Add Security Exception” dialog. Click on the “View…” button to review the certificate details. Ensure that the details match the ones displayed by the JMeter Test Script Recorder</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*QEJGsVerPSCfxIy_J0lTUA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B1uwQH08IPt1kdArDsMTjQ.png" /></figure><p>If the certificate details match, check the box that says “Trust this CA to identify websites” and click on the “OK” button.</p><p>Your JMeter certificate should now be installed and trusted in Firefox. You can now proceed to use JMeter for recording HTTP(S) traffic in your Firefox browser sessions.</p><h3>Configure JMeter Proxy in Firefox</h3><p><strong>Open browser, type </strong><strong>about:preferences#advanced</strong> as URL. Under Network settings &gt; go to settings. Make sure you still have JMerter running in your computer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*2NpATYM86MSBU8t-2FI_qA.png" /></figure><p>Select Manual configuration. Enter localhost or your IP address of your system and port 8888.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O3f-cgbdodJJhUrtG_dXPQ.png" /></figure><h3>Recording your navigation</h3><p>While HTTP(S) Test Script Recorder is Running, open your browser and navigate to the web application you wish performing load testing. Run the manual test steps you would like to do. Once finished, close your browser and bring up the JMeter window. Expand the <strong>Thread Group</strong> and there should be several samplers. At this point, the test plan can be saved as is.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/982/1*X-tB7TYa_FTUEfSnEL7rBw.png" /></figure><p>Once recorded, validate the script before running the test plan. Save</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/744/1*dc8Qy51C3_2xSx3ZVliY7g.png" /></figure><h3>Run the test on loop</h3><p>In order to run the script on multiple threads &amp; loops, configure the Thread Properties as you prefer.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GF-SxZ7fYqIxVda-rIIVYg.png" /></figure><p>While on the View Results Tree , run the test. It will run the script based on the defined threads &amp; loop count. You can see the request flow like you would see in browser developer tools network requests, if you check the scroll automatically checkbox.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iQY9iwljVlbPxByKg2w1jA.png" /></figure><p>AND WE DONE ! So we have recorded a script to perform load testing on a web application.</p><p>Additional Notes : use private browsing mode when recording the session. This should ensure that the browser starts with no stored cookies, and prevents certain changes from being saved. For example, Firefox does not allow certificate overrides to be saved permanently.</p><p>It was challenging to setup &amp; configure JMeter in MacBook M1, because of the limited/outdated resources available. Hope this helps ! Any comments, thoughts are welcome..</p><p>~~ HAPPY TESTING ~~</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f12a2053ada5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/setup-apache-jmeter-in-macbook-m1-f12a2053ada5">Setup Apache JMeter in MacBook(M1)</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Transitions and Journeys: From Mechatronics to Software Engineering]]></title>
            <link>https://medium.com/lapis/transitions-and-journeys-from-mechatronics-to-software-engineering-274d8e1be456?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/274d8e1be456</guid>
            <category><![CDATA[graduation]]></category>
            <category><![CDATA[mechanical-engineering]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[careers]]></category>
            <category><![CDATA[personal-development]]></category>
            <dc:creator><![CDATA[Xiaotian Li]]></dc:creator>
            <pubDate>Wed, 14 Feb 2024 06:20:16 GMT</pubDate>
            <atom:updated>2024-02-14T06:20:15.928Z</atom:updated>
            <content:encoded><![CDATA[<h3>Part 0: Introduction</h3><p>Hello, I’m Xiaotian Li. In 2022, I took a significant step by relocating to Australia, and by December 2023, I started my career journey as a graduate software engineer at Lapis. This transition, moving continents from China to Australia and shifting my academic focus from Mechatronic Engineering to Software Engineering, has been filled with its share of challenges and triumphs. As I navigate this new stage in my life, I’m keen to share the insights and experiences I’ve gathered along the way.</p><p>My journey unfolds in three distinct yet interconnected transitions:</p><ul><li><strong>Geographical</strong>: From Urumqi to Harbin, then to Melbourne;</li><li><strong>Professional</strong>: The shift from Mechatronics to Software Engineering;</li><li><strong>Personal</strong>: Evolving from a student into an engineer.</li></ul><p>Through sharing these experiences, I aim to offer insights and encouragement to those embarking on similar paths. Whether you are navigating cultural shifts or career changes, I hope my journey resonates with you, offering a sense of solidarity and inspiration.</p><h3>Part 1: Urumqi — The journey begins</h3><p>I was born in Urumqi, nestled within the Xinjiang province of China — a region renowned for its delectable cuisine and breathtaking natural landscapes. My childhood in Urumqi was filled with joy, surrounded by loving parents and friends.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KCG9hxSXyg5lGLQV7zV3Og.jpeg" /></figure><p>During my high school years, my fascination with science fiction novels and video games began to shape my dreams and ambitions. Titles like “Half-Life 2” and the “Portal” series were not just games to me, they were windows into possibilities and innovation. These experiences ignited my passion for engineering, especially in the field of robotics.</p><h3>Part 2: Harbin — Ready for the transition</h3><p>In 2016, my journey took me to Harbin for university. Harbin, renowned for its stunning winter scenery and warm-hearted residents, quickly became a place of inspiration and growth for me.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*6Jxh_DqOkifJxk1XymIOpw.jpeg" /></figure><p>At the Harbin Institute of Technology (HIT), I embarked on my academic journey in Mechatronic Engineering, a dynamic field blending Mechanical and Electronic Engineering. This period was marked by invaluable interactions with peers and professors who played a pivotal role in nurturing my engineering mindset.</p><p>My involvement in robotic clubs and smart car clubs, alongside courses on microcontrollers, IoT, and programming, was transformative. It was here that I discovered the critical role of software in engineering. Software became the lens through which I saw the potential to bridge abstract concepts with tangible outcomes, guiding the behaviour of robots and defining the operations of complex systems.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EINaIyDYyEZeM55UL266Pw.jpeg" /></figure><p>This realization deepened my interest in software engineering, an interest that was met with encouragement from my professors. They urged me to pursue this newfound passion, reinforcing my resolve to delve deeper into the software domain.</p><h3>Part 3: Melbourne — The big transition</h3><p>In 2022, I moved to Melbourne to pursue a Master’s in Software Engineering at the University of Melbourne, drawn by its familiar climate, vibrant multicultural environment, and welcoming people.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GjXqbvS05qMCEg1vftiJVw.jpeg" /></figure><p>My studies introduced me to fellow IT enthusiasts, leading to collaborative projects that ranged from mobile apps to web applications. My mechatronic engineering background proved advantageous, offering a shared mindset that eased my transition into software studies.</p><p>Adapting to Melbourne also presented challenges, particularly with the language barrier. My prior lack of focus on English led to initial communication struggles and feelings of isolation. Determined to overcome this, I immersed myself in various social activities — joining university events, local community groups / church, and seeking part-time jobs in software development. Despite facing numerous rejections, this proactive approach significantly improved my English proficiency, transforming my ability to communicate and connect with others.</p><p>Moreover, I also finished transitioning from student to software engineer. After graduation in Augest 2023, I joined a company specializing in IT solutions for logistics and warehousing. I diligently worked on improving my language proficiency through daily participation in meetings and discussions. I discovered that professional communication in engineering isn’t limited to verbal exchanges; diagrams, technical proposals, and documentation also play crucial roles. This realization was pivotal in my adaptation and growth.</p><p>Also, my work introduced me to Amazon Web Services(AWS), leading me into cloud computing. By learning about serverless systems, I directly observed how cloud services are changing IT, making things simpler and more efficient.</p><h3>Part 4: Journey continues with Lapis</h3><p>At the end of 2023, I received an call from Spatial Vision’s HR, inviting me to the graduate software engineer role within the Lapis team. This opportunity is a significant step forward in my career, and I made my decision to transit from my previous position to this one for the following reasons:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PaA2ZbcYoS00C8Nv7wPVGg.jpeg" /></figure><p>A pivotal factor in my decision was the presence of senior engineers within the team. This group is not just a collection of experienced IT professionals. They are approachable, enthusiastic mentors driven by a passion for innovation and problem-solving. Their wealth of knowledge spans several aspects of software engineering, from the intricacies of coding to the strategic planning of large-scale projects. Engaging with these industry veterans, I saw a unique opportunity not only to elevate my technical skills but also to gain insights into the professional nuances that only years of hands-on experience can teach.</p><p>The company culture also stood out to me. The team emphasized the importance of work-life balance, advocating for a focused and timely approach to tasks to ensure ongoing freshness and enthusiasm. Also, The diversity within the team was another draw. I worked with people from many different background and culture, which promising a broadening of perspectives and a richer understanding of the global IT and cultural landscape.</p><p>What’s more, the convenience of the company’s location was a practical benefit for me. Situated in the CBD, it’s easily accessible by tram and train, and the flexibility to work from home offered an ideal balance, enhancing my work arrangement flexibility.</p><p>From technical perspective, I’ve been involved in several projects at the company so far. With the help of my experienced colleague, Mingzhe, who guided me through the onboarding and mentoring process, I’ve gained the skills needed to tackle technical challenges. I’ve observed that the company’s projects are not only technically advanced but also meaningful to clients and society. The team aims to utilizing modern web and geospatial technologies to simplify and improve people’s lives. Since we use AWS, the projects run on a stable and robust cloud platform, which helps make managing infrastructure and the development process more efficient. I feel fortunate that my previous AWS experience is proving to be valuable here. I believe that this blend of cutting-edge projects, supportive mentorship, and the use of reliable cloud technology positions me for significant professional growth and enables me to contribute meaningfully to clients and society.</p><h3>Part 5: Summary</h3><p>Look back on the journey of my transitions, words fall short in expressing my gratitude towards my parents, friends, and colleagues. Below, I’ve outlined some strategies that I found beneficial, aimed at international university students and graduates in software engineering:</p><ol><li><strong>Build up technical skills:</strong> Academic performance is essential, and practical experience is also invaluable. Engage in IT-related internships, part-time jobs, or personal projects like websites or blogs. These activities provide a solid foundation for our professional journey.</li><li><strong>Improvement in Communication skills:</strong> Many international students face the hurdle of not being native English speakers, which can lead to hesitation in engaging with others. The key to improvement is consistent practice. Immersing ourselves in English-speaking settings, such as local TV shows or making friends with native speakers, can be beneficial. Among these, getting a job that demands English is perhaps the most effective method to enhance language skills and adapt more quickly.</li><li><strong>Be humble and ready to learn:</strong> The IT field is vast and ever-evolving, making continuous learning a cornerstone of success. Approach each opportunity with humility and eagerness to learn from everyone around us, regardless of their position. Remember, every interaction can offer new insights or perspectives. Embrace feedback, ask questions, and stay curious about the latest technologies and methodologies.</li><li><strong>Become a problem solver</strong>: It’s widely acknowledged that beginnings are inherently challenging, particularly for newcomers and recent graduates in the professional IT realm, there are always problems that block our ways. A crucial lesson my journey has taught me is that always to be a problem solver. As engineers, our essence is exactly in problem-solving; hence, we just need to apply this mindset to everyday challenges, such as overcoming language barriers, navigating social integration, and mastering technical skills.</li></ol><p>I hope this has been an insightful read for you. And shall we all have wonderful journeys, filled with growth, learning, and successful transitions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=274d8e1be456" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/transitions-and-journeys-from-mechatronics-to-software-engineering-274d8e1be456">Transitions and Journeys: From Mechatronics to Software Engineering</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Deploying a Multi-Service Application into Multiple Environments using AWS Copilot]]></title>
            <link>https://medium.com/lapis/deploying-a-multi-service-application-into-multiple-environments-using-aws-copilot-35deed692e5b?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/35deed692e5b</guid>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[cli-tool]]></category>
            <category><![CDATA[aws-fargate]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[aws-copilot]]></category>
            <dc:creator><![CDATA[Shanika Ediriweera]]></dc:creator>
            <pubDate>Thu, 31 Aug 2023 00:13:38 GMT</pubDate>
            <atom:updated>2023-08-24T00:48:11.287Z</atom:updated>
            <content:encoded><![CDATA[<h4>AWS CoPilot | DevOps | CICD</h4><p>Deploying applications to the cloud can be complex, especially when dealing with multiple services and environments. AWS Copilot, a command-line tool by Amazon Web Services (AWS), simplifies this process by providing an easy way to define, develop, deploy and operate containerised applications in AWS ECS, Fargate.</p><h3>Prerequisites</h3><p>As perquisites, I assume you have following in place:</p><ol><li>An AWS Account</li><li>AWS CLI installed</li><li>Docker installed</li><li>AWS Copilot CLI. If not follow <a href="https://aws.github.io/copilot-cli/en/docs/getting-started/install/">https://aws.github.io/copilot-cli/en/docs/getting-started/install/</a></li></ol><h3>Let’s get started! 🚀</h3><p>You can use AWS Copilot to deploy different types of services like Load Balanced Web Service, Backend Service, Request-Driven Web Service, Scheduled Job, Static Site and Worker Service. I am going to focus on deploying an application with 2 Load Balanced Web Services.</p><h4>Domain</h4><p>When deploying a Load Balanced Web Service, there are multiple ways we can go about the domain of the services. I am mentioning this at the beginning since you need to initiate the Copilot app the right way that suits your requirement.</p><ul><li>Use an app associated root domain (which you manage in the same AWS account) and let Copilot to manage subdomains for services and environments. Your service urls will be in ${SvcName}.${EnvName}.${AppName}.${DomainName} format</li><li>Use an app associated root domain and customise service domains as you need</li><li>Import SSL certificates if you manage the DNS somewhere other than the AWS account which you are deploying the Copilot services</li></ul><p>📖 This is the <a href="https://aws.github.io/copilot-cli/en/docs/developing/domain/">official document</a> on the above domain options!</p><h4>App code and Copilot manifests</h4><p>Main thing to consider is the 2 ways we can use to build the services. Either we can use a Dockerfile and build the service image as a part of Copilot flow or we can use an already built image.</p><p>Initiating Copilot app (storing Copilot manifests) within the app repository would be helpful if you are building the Docker image providing the Dockerfile to Copilot. This is suitable for monorepo setups, where all apps/services are in the same repo.</p><p>If you are building the Docker image as a part of a separate CI flow, you can provide the docker image to Copilot and store Copilot manifests either within the app code repo or in separate repo.</p><p>For this example, we are going to use the first option for app domain and let Copilot create hosted zones, subdomains, SSL certificates under the hood and provide Dockerfile to Copilot to build the image.</p><h4>Step 0: Sample app repo</h4><p>Clone the sample application git repository.</p><pre>git clone https://github.com/ShanikaEdiriweera/aws-copilot-example.git</pre><p>This is optional. You can start start with a fresh directory and add your own services source code (simple index.html files are used in the sample) and Dockerfiles according to the following structure. Copilot manifests will be generated when you follow the guide.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/454/1*9RaBJBgTbI8kgRLKlB1YVQ.png" /><figcaption>Directory structure of sample app</figcaption></figure><h4>Step 1: Init app</h4><p>Initialise the Copilot application with root domain</p><pre>copilot app init --domain your-domain.com</pre><p>You will see the following output creating CloudFormation stack test-app-infrastructure-roles (see the roles and DNS hosted zone created) and generating copilot directory. Note that if you started from scratch you will be prompted for an app name.</p><pre>Your workspace is registered to application test-app.<br>✔ Proposing infrastructure changes for stack test-app-infrastructure-roles<br>- Creating the infrastructure for stack test-app-infrastructure-roles                           [create complete]  [89.9s]<br>  - A StackSet admin role assumed by CloudFormation to manage regional stacks                   [create complete]  [17.1s]<br>  - Add NS records to delegate responsibility to the test-app.your-domain.com subdomain          [create complete]  [34.1s]<br>  - A hosted zone for test-app.your-domain.com                                                   [create complete]  [43.9s]<br>  - A DNS delegation role to allow accounts: 845688234888 to manage your domain                 [create complete]  [17.7s]<br>  - An IAM role assumed by the admin role to create ECR repositories, KMS keys, and S3 buckets  [create complete]  [34.5s]<br>✔ The directory copilot will hold service manifests for application test-app.</pre><p>Copilot will create a SSM parameter to hold the application metadata to uniquely identify the created application for the future CLI interactions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ug9BCd--LvVM3M3gLJryUg.png" /></figure><h4>Step 2: Deploy first service</h4><p>Init the first service and deploy into test environment</p><pre>copilot init</pre><p>Follow the prompts to configure your application. You’ll need to choose the service type (Load Balanced Web Service, Backend Service, Scheduled Job), application name, and other details.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7d5ukINNv3yGSZVEBGRjtg.png" /></figure><p>Copilot will identify existing service manifest file or generate one. Then deploy multiple CloudFormation stacks for the infrastructure, environment and the service as in above and below images. Then it will build your container image from the Dockerfile you specified and push to ECR.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Bv9A38pgO6Zu7TvCsXx9wQ.png" /></figure><p>Now you can access your service1 deployed in test environment at <a href="https://service1.test.test-app.your-domain.com/">https://service1.test.test-app.your-domain.com/</a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_8p3eER8WXPtP1KwXFcWRA.png" /><figcaption>service1 in test</figcaption></figure><h4>Step 3: Deploy second service</h4><p>Lets initialise and deploy another service!</p><pre>copilot svc init --name service2<br>copilot svc deploy --name service2 --env test</pre><p>At the end of deploying the CFN stacks, build container image and deploying into test environment you will be able to access service2 in test environment at <a href="https://service2.test.test-app.your-domain.com/">https://service2.test.test-app.your-domain.com</a> over the internet.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SNRUnDhE_xKBLi_SgPVHfQ.png" /><figcaption>Forgive me me for the ugly interface!</figcaption></figure><h4>Step 4: Deploy second environment</h4><p>Lets initialise and deploy our second environment dev and then deploy the 2 services into the dev environment.</p><pre>copilot env init --name dev<br>copilot env deploy --name dev</pre><p>Note that I used default configuration to allow AWS Copilot to create a new VPC and subnets. But have the option to import your existing VPC and subnets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1022/1*FSDIVQeUAly4-nyI1XzefQ.png" /><figcaption>copilot init env</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MamZqXmOg_UWcOJuu7rQuQ.png" /><figcaption>copilot env deploy — name dev</figcaption></figure><pre>copilot svc deploy --name service1 --env dev<br>copilot svc deploy --name service2 --env dev</pre><p>After deploying the 2 services in the dev environment you would be able to access them at <a href="https://service1.dev.test-app.your-domain.com/">https://service1.dev.test-app.your-domain.com</a> and at <a href="https://service2.dev.test-app.your-domain.com/">https://service2.dev.test-app.your-domain.com</a></p><p>TADA! 🦸🏼‍♂</p><p>Now you have 2 services deployed in 2 environments just within 30mins! How cool is that!</p><p>Next lets look at how we can automate the deployment of changes to the services.</p><h4>S️tep 5: Deploy deployment pipeline</h4><p>Lets initiate a pipeline and deploy it.</p><pre>copilot pipeline init \<br>-u https://github.com/ShanikaEdiriweera/aws-copilot-example \<br>-b main \<br>-n test-app-pipeline \<br>-p Workloads \<br>-e test,dev<br><br>copilot pipeline deploy</pre><p>This will initiate a pipeline which will be looking at changes to the main branch of <a href="https://github.com/ShanikaEdiriweera/aws-copilot-example">https://github.com/ShanikaEdiriweera/aws-copilot-example</a> (you can replace with your code repository) and deploy the workload changes to the 2 environments test and dev .</p><p>When deploying you will need to provide access to the Github repository from AWS connections.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q1k0YleColEYoEeAVzvAOg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQ0QGqfsvOBHd73WhsxLAw.png" /><figcaption>Provide access!</figcaption></figure><p>After deployment is completed you will get a super cool pipeline in AWS CodePipeline!</p><h4>Step 6: Clean up</h4><p>Lets delete all the resources Copilot set up for your application, including your ECS Service and the ECR Repository.</p><pre>$ copilot app delete</pre><h3>Support</h3><p>AWS Copilot is an open source tool and is backed by a great passionate dev community. If you run into any issue you can get support by creating an issue in official <a href="https://github.com/aws/copilot-cli/issues">AWS Copilot GH repository</a> or you can get help from ever so supportive fellow Copilots in the <a href="https://gitter.im/aws/copilot-cli?utm_source=badge&amp;utm_medium=badge&amp;utm_campaign=pr-badge&amp;utm_content=badge">chat on gitter</a>! 👨🏽‍✈️</p><h3>Conclusion</h3><p>AWS Copilot is a great tool which can be used for quickly deploy your service based application into AWS ECS Fargate, deploy multiple environments and deploy deployment pipelines. It currently has support to add secrets with AWS SSM and to storage with S3, DynamoDB and EFS.</p><p>And you should not worry if there is anything you need to implement, which is currently supported by Copilot, you can use the overrides feature to override the CFTs.</p><p>AWS Copilot abstracts the underlying complexities, allowing you to focus on your code and delivering value. In a nutshell, AWS Copilot reduces a bulk of CloudFormation template code into few manifest files!</p><p>Let me know how it goes and anything I missed or need improvement in!</p><p>Happy Copiloting! 👨🏽‍✈️🚀</p><p>Cheers! 🍻</p><h3>Reference</h3><ol><li>AWS Copilot Official Documentation — <a href="https://aws.github.io/copilot-cli/en/docs/overview/">https://aws.github.io/copilot-cli/en/docs/overview/</a></li><li>AWS Copilot GitHub Repository — <a href="https://github.com/aws/copilot-cli">https://github.com/aws/copilot-cli</a></li><li>Sample Application Repository — <a href="https://github.com/ShanikaEdiriweera/aws-copilot-example">https://github.com/ShanikaEdiriweera/aws-copilot-example</a></li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=35deed692e5b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/deploying-a-multi-service-application-into-multiple-environments-using-aws-copilot-35deed692e5b">Deploying a Multi-Service Application into Multiple Environments using AWS Copilot</a> was originally published in <a href="https://medium.com/lapis">Code道</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 implement DynamoDB single table designs with AWS Amplify (AppSync, Lambda)]]></title>
            <link>https://medium.com/lapis/how-to-implement-dynamodb-single-table-designs-with-aws-amplify-appsync-lambda-8838e86b2f71?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/8838e86b2f71</guid>
            <category><![CDATA[aws-lambda]]></category>
            <category><![CDATA[aws-dynamodb]]></category>
            <category><![CDATA[aws-appsync]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[software-development]]></category>
            <dc:creator><![CDATA[Junyou Lin]]></dc:creator>
            <pubDate>Tue, 14 Feb 2023 04:37:55 GMT</pubDate>
            <atom:updated>2023-02-14T04:37:55.057Z</atom:updated>
            <content:encoded><![CDATA[<p>In this article, we will explore the implementation of single table designs in an AWS Amplify application using AppSync and Lambda.</p><p>You should know some concepts beforehand since this article only focuses on the implementation of single table design. For example:</p><ul><li><a href="https://aws.amazon.com/blogs/compute/creating-a-single-table-design-with-amazon-dynamodb/">how to design single table</a></li><li><a href="https://docs.amplify.aws/cli/graphql/examples-and-solutions/">multiple tables in Amplify</a></li><li><a href="https://aws.amazon.com/blogs/mobile/single-table-vs-multi-table-dynamodb-appsync/">single table vs multiple tables</a></li></ul><p>While Amplify currently only supports multiple table designs, it is still possible to implement single table designs with some modifications as below structure:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/879/1*ziWssYy1p43YBphmYNQslQ.png" /></figure><h3>Step 1: Define Access Patterns</h3><p>Let’s assume a use case in which customers can buy products and place orders on an e-commerce website. To structure our partition key and sort key in the early stages, we need to define our access patterns. Let’s create three simple access patterns:</p><ol><li>Retrieve customer information using the customer ID.</li><li>Retrieve product information using the product ID.</li><li>Retrieve order information, including customer and product information, using the order ID.</li></ol><h3>Step 2: Create a Table in DynamoDB</h3><p>In the AWS DynamoDB console, we’ll create a table named “ecommerce” and name the partition key as “PK” and the sort key as “SK”. Since we’re using a single table design, we won’t be able to take advantage of the @model directive in Amplify GraphQL that automatically generates tables in DynamoDB.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EYT4_U3F2q0D8r2FCMCeBQ.png" /></figure><h3>Step 3: Create graphQL API in Amplify</h3><p>If you have not initialized the amplify project yet, please run this command:</p><pre>amplify init</pre><p>Otherwise, we can start to create a new GraphQL API in our Amplify project by running the following command:</p><pre>amplify add api<br>? Select from one of the below mentioned services: GraphQL<br>? Here is the GraphQL API that we will create. Select a setting to edit or continue Continue<br>? Choose a schema template: One-to-many relationship (e.g., &quot;Blogs&quot; with &quot;Posts&quot; and &quot;Comments&quot;)</pre><p>The schema template is not important as we will override it by our e-commerce use case. Now let’s override the code in schema.graphql as below. For the sake of the query test, we also create its mutation correspondingly.</p><pre># This &quot;input&quot; configures a global authorization rule to enable public access to<br># all models in this schema. Learn more about authorization rules here: https://docs.amplify.aws/cli/graphql/authorization-rules<br>input AMPLIFY { globalAuthRule: AuthRule = { allow: public } } # FOR TESTING ONLY!<br><br>type Query {<br>  getCustomerById(id: ID!): Customer @function(name: &quot;ecommerce-${env}&quot;)<br>  getProductById(id: ID!): Product @function(name: &quot;ecommerce-${env}&quot;)<br>  getOrderById(id: ID!): Order @function(name: &quot;ecommerce-${env}&quot;)<br>}<br>type Mutation {<br>  createCustomer(input: createCustomerInput!): Customer @function(name: &quot;ecommerce-${env}&quot;)<br>  createProduct(input: createProductInput!): Product @function(name: &quot;ecommerce-${env}&quot;)<br>  createOrder(input: createOrderInput!): Order @function(name: &quot;ecommerce-${env}&quot;)<br>}<br>type Customer {<br>  PK: ID!<br>  email: String!<br>}<br>type Product {<br>  PK: ID!<br>  qty: Int!<br>  price: Float!<br>  name: String!<br>  detail: AWSJSON!<br>}<br>type Order {<br>  PK: ID!<br>  SK: ID!<br>  type: String!<br>  amount: Float!<br>  orderItems: [OrderItem]<br>}<br>type OrderItem {<br>  PK: ID!<br>  SK: ID!<br>  price: Float!<br>  name: String!<br>  qty: Int!<br>  type: String!<br>}<br>input createCustomerInput {<br>  email: String!<br>}<br>input createProductInput {<br>  qty: Int!<br>  price: Float!<br>  name: String!<br>  detail: AWSJSON!<br>}<br>input createOrderInput {<br>  amount: Float!<br>  products: [createOrderItemInput!]!<br>  customerID: ID!<br>}<br>input createOrderItemInput {<br>  qty: Int!<br>  price: Float!<br>  name: String!<br>  productID: ID!<br>}</pre><h3>Step 4: Create Lambda function resolver</h3><p>You may notice the type of Query and Mutation above have @funciton directive which helps to resolve the request and respond between AppSync and DynamoDB. So let’s create this function in Amplify:</p><pre>amplify add function<br>? Select which capability you want to add: Lambda function (serverless function)<br>? Provide an AWS Lambda function name: ecommerce<br>? Choose the runtime that you want to use: NodeJS<br>? Choose the function template that you want to use: Hello World<br>? Do you want to configure advanced settings? No<br>? Do you want to edit the local lambda function now? No<br>Successfully added resource ecommerce locally.</pre><p>Now let’s write some code for this lambda resolve under amplify/backend/function/ecommerce/src directory:</p><h4>index.js</h4><p>The index.js file serves as the root for a Lambda function that handles API requests based on the field name and responds with the correct data structure, as defined in the schema.graphql file.</p><pre>const AWS = require(&#39;aws-sdk&#39;)<br>const {v4: uuid} = require(&#39;uuid&#39;)<br>const getCustomerById = require(&#39;./getCustomerById&#39;)<br>const getProductById = require(&#39;./getProductById&#39;)<br>const getOrderById = require(&#39;./getOrderById&#39;)<br>const createCustomer = require(&#39;./createCustomer&#39;)<br>const createProduct = require(&#39;./createProduct&#39;)<br>const createOrder = require(&#39;./createOrder&#39;)<br>const docClient = new AWS.DynamoDB.DocumentClient()<br><br>exports.handler = async (event) =&gt; {<br>  const {fieldName, arguments} = event<br>  switch (fieldName) {<br>    case &quot;getCustomerById&quot;:<br>      return await getCustomerById(arguments, docClient)<br>    case &quot;getProductById&quot;:<br>      return await getProductById(arguments, docClient)<br>    case &quot;getOrderById&quot;:<br>      return await getOrderById(arguments, docClient)<br>    case &quot;createCustomer&quot;:<br>      return await createCustomer(arguments, docClient, uuid)<br>    case &quot;createProduct&quot;:<br>      return await createProduct(arguments, docClient, uuid)<br>    case &quot;createOrder&quot;:<br>      return await createOrder(arguments, docClient, uuid)<br>    default:<br>      return null<br>  }<br>};</pre><h4>getCustomerById.js</h4><p>Retrieve customer information by its id.</p><pre>async function getCustomerById({id}, docClient) {<br>  const params = {<br>    TableName: &quot;ecommerce&quot;,<br>    Key: {PK: id, SK: id}<br>  }<br>  try {<br>    const {Item} = await docClient.get(params).promise()<br>    if (Item !== null) {<br>      return Item<br>    }<br>  } catch (err) {<br>    return err<br>  }<br>}<br>module.exports = getCustomerById</pre><h4>GetproductById.js</h4><p>Retrieve product information by its id.</p><pre>async function getProductById({id}, docClient) {<br>  const params = {<br>    TableName: &#39;ecommerce&#39;,<br>    Key: {PK: id, SK: id}<br>  }  <br>  try {<br>    const {Item} = await docClient.get(params).promise()<br>    if (Item !== null) {<br>      return Item<br>    }<br>  } catch (err) {<br>    return err<br>  }<br>}<br>module.exports = getProductById</pre><h4>getOrderById.js:</h4><p>To retrieve order information that includes products and customer information, we will use the docClient.query() method. This method will retrieve all items in the table with the same partition key. The result will be an array of items, so we have written a function called formatOrderResponseData to format the data into the order type schema defined in schema.graphql.</p><pre>async function getOrderById({id}, docClient) {<br>  const params = {<br>    TableName: &quot;ecommerce&quot;,<br>    KeyConditionExpression: `PK = :id`,<br>    ExpressionAttributeValues: {<br>      &quot;:id&quot;: id<br>    }<br>  }<br>  try {<br>    const {Items} = await docClient.query(params).promise()<br>    if (Items.length) {<br>      return formatOrderResponseData(Items)<br>    }<br>  } catch (err) {<br>    return err<br>  }<br>}<br><br>function formatOrderResponseData(orderData) {<br>  let order;<br>  orderData.forEach(({PK, SK, type, amount, price, name, qty}) =&gt; {<br>    if (type === &#39;order&#39;) {<br>      order =<br>        {<br>          PK,<br>          SK,<br>          type,<br>          amount,<br>          orderItems: []<br>        };<br>    }<br>    if (type === &#39;orderItem&#39;) {<br>      order.orderItems.push({<br>        PK,<br>        SK,<br>        price,<br>        name,<br>        qty,<br>        type<br>      });<br>    }<br>  });<br>  return order;<br>}<br><br>module.exports = getOrderById</pre><h4>createCustomer.js</h4><p>To create a customer, we need to first define its partition and sort key. The partition and sort key should start with “C#” to indicate that it’s a customer.</p><pre>async function createCustomer({input:{email}}, docClient, uuid) {<br>  const customerID = `C#${uuid()}`<br>  const params = {<br>    TableName: &quot;ecommerce&quot;,<br>    Item: {<br>      PK: customerID,<br>      SK: customerID,<br>      email,<br>      type: &#39;customer&#39;,<br>    },<br>  }<br>  const item =  await docClient.put(params).promise()<br>  if (item !== null){<br>    return params.Item;<br>  }<br>}<br><br>module.exports = createCustomer</pre><h4>createProduct.js</h4><p>To create a product, we can set its partition and sort key that start with “P#” to indicate that it’s a product.</p><pre>async function createProduct({input: {qty, price, name, detail}}, docClient, uuid) {<br>  const productID = `P#${uuid()}`;<br>  const params = {<br>    TableName : &quot;ecommerce&quot;,<br>    Item: {<br>      PK: productID,<br>      SK: productID,<br>      qty,<br>      price,<br>      name,<br>      detail,<br>      type: &#39;product&#39;,<br>    },<br>  }<br>  try {<br>    const item =  await docClient.put(params).promise()<br>    if (item !== null){<br>      return params.Item;<br>    }<br>  } catch (err) {<br>    return err<br>  }<br>}<br><br>module.exports = createProduct</pre><h4>createOrder.js</h4><p>To create an order, there are three write requests involved:</p><ol><li>creating the order</li><li>creating the order item</li><li>updating the product quantity</li></ol><p>The docClient.transactWrite function has atomicity, meaning that if any of the requests fail, all write transactions will be abandoned.</p><pre>async function createOrder({input: {amount, products, customerID}}, docClient, uuid) {<br>    const PK = `O#${uuid()}`<br>    const TableName = &#39;ecommerce&#39;<br>    const params = {<br>      TransactItems: [{<br>        Put: {<br>          TableName,<br>          Item: {<br>            PK,<br>            SK: customerID,<br>            amount,<br>            type: &#39;order&#39;<br>          }<br>        }<br>      }].concat(products.map(({productID, qty, price, name}) =&gt; [<br>        {<br>          Put: {<br>            TableName,<br>            Item: {<br>              PK,<br>              SK: productID,<br>              type: &#39;orderItem&#39;,<br>              qty,<br>              price,<br>              name<br>            }<br>          }<br>        },<br>        {<br>          Update: {<br>            TableName,<br>            Key: {<br>              PK: productID,<br>              SK: productID<br>            },<br>            UpdateExpression: &#39;SET qty = qty - :qty&#39;,<br>            ExpressionAttributeValues: {<br>              &#39;:qty&#39;: qty<br>            },<br>            ConditionExpression: &#39;qty &gt;= :qty&#39;<br>          }<br>        }<br>      ])).flat()<br>    }<br>  try {<br>    const item =  await docClient.transactWrite(params).promise()<br>    if (item !== null){<br>      return {<br>        PK,<br>        SK: customerID,<br>        amount,<br>        type: &#39;order&#39;,<br>        orderItems: products.map(({productID, qty, price, name}) =&gt; ({<br>          PK,<br>          SK: productID,<br>          price,<br>          name,<br>          qty,<br>          type: &#39;orderItem&#39;,<br>        }<br>        ))<br>      };<br>    }<br>  } catch (err) {<br>    return err<br>  }<br>  }<br><br>module.exports = createOrder</pre><h3>Step 5: Amplify push and test the API</h3><p>We’re almost done! To deploy our code, let’s run the command amplify push in the terminal. Upon successful deployment, we should see our schema in the AppSync console.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eiQnck0KfNO88KQq8rfWWw.png" /></figure><p>The final step in testing our API is to grant the Lambda function permission to read and write to DynamoDB. We need to locate the Lambda function name in the IAM role and add read and write policies for DynamoDB.</p><p>Now, we can test our API on the AppSync query page by first creating a customer and a product.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lffh-Iiek62HC-irimFdfw.png" /></figure><p>In our DynamoDB, we should be able to find those two new items</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4y6mVgCXCUZrh4jPScSgIA.png" /></figure><p>Next, let’s test the getCustomerById and getProductById query:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*peflITqhZRHyEooEMcagKQ.png" /></figure><p>Next, let’s create an order using the newly created customer and product:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1_eVEWQqnYdZLP-QxxD4RA.png" /></figure><p>The createOrder function will create two items in the database: one for the order itself and another for the order item. Besides the two new items, the quantity in P#ca11cf9c-17ea-4845–8566-fbb9a0961da7 was updated as well.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R3kO4QdU7WVdXqwxfd6JrQ.png" /></figure><p>Finaaly, lets run getOrderById query:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rg6kscVFsNNm7uDDB-UyAg.png" /></figure><h3>Conclusion</h3><p>In conclusion, the use of a single table design in DynamoDB requires careful consideration of partition and sort key assignments, as well as extra effort in writing Lambda resolver. However, it can offer outstanding query performance. Therefore, the decision to use single table design depends on whether its benefits outweigh its drawbacks.</p><p>If you have any questions, please let me know in the comments!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=8838e86b2f71" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/how-to-implement-dynamodb-single-table-designs-with-aws-amplify-appsync-lambda-8838e86b2f71">How to implement DynamoDB single table designs with AWS Amplify (AppSync, Lambda)</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[From GIS Developer to Software Engineer]]></title>
            <link>https://medium.com/lapis/from-gis-developer-to-software-engineer-3973431435d?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/3973431435d</guid>
            <category><![CDATA[news]]></category>
            <category><![CDATA[software-engineering]]></category>
            <dc:creator><![CDATA[Mingzhe]]></dc:creator>
            <pubDate>Thu, 02 Jun 2022 23:07:59 GMT</pubDate>
            <atom:updated>2022-06-02T23:07:59.089Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/940/1*35ASZ0hh9hsw-2MgHK6MSg.png" /></figure><p>Time flies, especially when we start working from home because of the pandemic beginning in 2020. Coincidentally, I started my career as a graduate cadet in Spatial Vision in Jan 2020. now I think it’s a good time to write something about my career journey from a GIS Developer to a Software Engineer in the last 2.5 years. I hope this blog can help someone looking for more career options.</p><h3>Why did I adjust my career path?</h3><p>In my first graduate year, I did entry-level GIS development and consultant work in Enterprise spatial solutions; this was an exciting graduate program. I stayed in the same team and worked as a GIS developer. After learning a lot of new knowledge and skills from different enterprise-level spatial projects, I started to think more about my career path planning. There are a few reasons to push me to make some changes:</p><ol><li>The first reason is some technical challenges to delay and slow my processes. Due to my lack of experience working in software development, even though I spent a lot of time, there were more struggling moments that took me a long time, especially when I tried to debug some complex issues in my daily work. I realised that I need to put myself in a professional environment to learn how to do development from the beginning. I should become a software engineer before becoming a spatial software engineer.</li><li>The second reason is about the industry trend. The development and tech upgrades in graphic processing, machine learning, and AI make online spatial processing and visualisation possible. There is a vast market growing in online mapping, and we can do more on browsers, for example, ArcGIS Online and GeoCortex are more used now in governments and industry. The game of GIS is changing now.</li></ol><p>Based on these reasons, learning how to develop as a professional software engineer seems essential in my career path. I realise there has been some precedent before switching between teams in Spatial Vision, and the Lapis team in our company is hiring developers. That’s how I started the transition. After a few weeks of processing, I started my journey as a junior software engineer in Lapis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nXidvYd30nu3cre8bLSvpA.png" /></figure><h3>What challenges did I have?</h3><p>Challenges come immediately. The hardest part for me was developing features using Angular. Angular is a framework based on typescript, and typescript is the superclass of Javascript. The learning curve is steep for me, who was working on Python and ArcGIS products. Adjusting to a new team is another challenge. Although I’m still working in the same company, the workspace culture, admin processing, and daily routine are different from my previous position.</p><p>Moreover, I also need to convince myself after moving from a professional to a junior-level position. When you see the colleagues who joined the company about the same time are promoted to senior positions, you might ask yourself if it’s worth sacrificing the progress you already had. Pressures from these different aspects came; a few weeks of tough times after the transition almost made me doubt my decision.</p><h3>What support did I receive?</h3><p>I think I am the lucky one. I couldn’t go over all the problems and challenges I had during the transition without all the support I had from Spatial Vision and my teammates.</p><h4>Supports from the management team:</h4><p>The movement inside a company is not the most interest beneficial decision for the management team since they need to put more cost on training and the predictable productivity reduction. However, my general manager Graeme supported me a lot after I raised my hand. Graeme and other management members planned the transition with me. They suggested I work on a web development related project before moving to Lapis, which made me more familiar with the tools like Git and Angular that I will use every day after the transition.</p><p>After moving to Lapis, team leaders like Imran, Kelly, Hiroki, and Parham treated me very well. They understood my background and gave me enough onboarding time to adjust myself and learn from working. Besides the regular onboarding, Hiroki also helped me create a PD (Professional Development) Trello board to guide me and track my learning progress.</p><h4>Support from teammates:</h4><p>Senior developers like Ti and Parham gave me many supports. They shared their experiences with me from my first day working- how to set up IDE, configure the development environment, and even explain the basic concepts of JavaScript patiently when I feel any confusion. I personally like the Pair coding part, pair coding is the working pattern that let junior developers work as pilots while senior developers work on the tasks, I get many skills that learned during pair coding and can be applied when I work individually.</p><p>Overall the quick response when I need help, well-split tasks that I can handle more and more gradually, and my lovely coworkers are key impacts that make me face all the challenges.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*yVYJO5OGe0qCvv0ZotLwUg.png" /></figure><h3>The journey so far…</h3><p>When I write down this blog, for no reason, I start thinking about a web map I created with the previous team. If I work on it now, I can improve it and make it more user-friendly with the knowledge I gained from my current position, which means I’m making progress now. Although the journey is long and there are tons of things to learn from now, I’m happy with my decision. What did I learn from my journey?</p><ol><li>The first and most important is to keep learning. Luck is what happens when preparation meets opportunity. Well, being prepared doesn’t mean you need to know anything, but keep learning, take the chance and try your best when you have it;</li><li>Don’t be afraid to ask when you need support. Asking others avoid me trapped myself and digging into some black holes, especially when there are talented guys around you that you can ask easily.</li><li>Keep positive when you face some challenges. I know it’s easy to tell others to keep positive, and it’s hard to keep ourselves positive. We cannot control many things, but keeping positive is something we can.</li><li>AI will take all our jobs in one day. 🤖</li></ol><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3973431435d" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/from-gis-developer-to-software-engineer-3973431435d">From GIS Developer to Software Engineer</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Here’s Why You Should Start Your Career with Lapis]]></title>
            <link>https://medium.com/lapis/heres-why-you-should-start-your-career-with-lapis-31272c642a64?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/31272c642a64</guid>
            <category><![CDATA[sofware-development]]></category>
            <category><![CDATA[australia]]></category>
            <category><![CDATA[women-in-tech]]></category>
            <category><![CDATA[graduate-students]]></category>
            <category><![CDATA[news]]></category>
            <dc:creator><![CDATA[Hiroki Gota]]></dc:creator>
            <pubDate>Mon, 16 Aug 2021 08:22:26 GMT</pubDate>
            <atom:updated>2022-06-21T05:53:18.545Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/912/1*t1P0Ild4ECP2-e3VUNK8Gw.png" /></figure><h3>Are you a fresh grad looking for a job?</h3><p>Hey 🌞! Are you a fresh grad looking for your first job in Software Development in Australia? You might:</p><ul><li>Enjoy problem-solving</li><li>Have hands-on experience in building apps using web and cloud technology</li><li>Be an excellent learner and enjoy learning by coding or talking</li><li>Want to master Software Service end to end</li><li>Be passionate about building apps</li><li>Have a GitHub account and use GitHub Actions</li></ul><p><strong>Spatial Vision’s 2022 Graduate Cadet Program now has a Software Development</strong> <strong>stream</strong>, working with our <strong>Lapis brand</strong>. The program offers A 12-month <strong>paid work placement</strong> for graduates with the opportunity to design and deliver your own project.</p><h3>1. Mentoring and Coaching</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*EdylmQj--tVQ6eJJBU0N4g.png" /></figure><p>At Lapis, you will learn everything about Software Development through mentoring and coaching. You will be a part of our experienced development team and you will be paring with a senior team member from day 1.</p><h4>Share your knowledge and grow</h4><p>Mentoring and coaching are key methods of our knowledge sharing across the team, not only for grads but also for any member who is willing to step up and take on a new challenge.</p><h3>2. Balanced, Cross-Functional Team</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*dYTU2yiy8tjFg_uTqc2jxA.png" /></figure><p>Our cross-functional team is made up of specialists in the fields including Product Owners, Business Analysts and Specialists in QA, Security, Mobile and DevSecOps.</p><h4>You’ll never be alone</h4><p>You will be with your cross-functional team every step of the way through for a range of service delivery projects, working with leaders, seniors and juniors alike so you can learn from a diverse and enriched learning experience.</p><h4>BdDevSecOps (you sell it, you build it and you run it)</h4><p>Thanks to the fixed service delivery team, you will also learn about Business Development and Operational pipeline end to end. We share it all within the team and encourage you to bring your idea to further help our clients.</p><h3>3. Diversity and Inclusion</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iE0IEZs7qJ9bXALBxuONiQ.png" /><figcaption>Lapis Team</figcaption></figure><p>Our team is culturally diverse and t<em>rust</em> is incredibly important to us. We do what we can to ensure everyone feels <em>safe</em> and supported in their opinions and ask for help when needed. We support the <a href="https://sdgs.un.org/goals/goal5">Sustainable Development Goals</a>, with a strong focus on <em>Diversity and Inclusion</em>. In pursuit of this goal, we’re always looking to support more <a href="https://wit.org.au/"><strong><em>Women in Tech</em></strong></a><strong><em> </em></strong>and develop a better gender balance internally. We encourage all people of all genders and cultural backgrounds to join us.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*O2dAUtZyLSGDejEe3Rj8Cg.jpeg" /></figure><h3>4. Work-Life Balance</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*I0AISxGA9MEbGytXjzUM6A.png" /></figure><p>Work-life balance is very important to us, and we believe it’s a key factor in developing a successful career. Your career journey is a marathon and not a sprint. We are strong proponents of the idea that can achieve your professional goals and still have a life outside of work.</p><h4>The 10,000-hour rules</h4><p>Software development can be a complex business and let’s be honest - it takes time to become a <em>Ninja</em>, along with deliberate, consistent practice and strong mentoring and coaches.</p><p>This does not mean you should be working late or on the weekend. At Lapis, we encourage you to focus on one task at a time and finish on time so you can come back the next day with a fresh mind.</p><p>Some people might spend their time for further learning in tech and others spent their time for recreational or with their family. You can learn so many other things outside your professional job, and we encourage you to do so!</p><h4>Taco, Ping-Pong and Social Events</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*rPdzFL2v8PGxQRYCFqfVKA.png" /></figure><p>We have an honest and direct reward system using <a href="https://www.heytaco.chat/">Taco</a> in our slack. You might receive a monthly staff award if you have achieved something amazing.</p><p>We love playing Ping-Pong at our office in the CBD and have a Friday drink and fun whenever we get together. Our leader (your boss), <a href="https://www.linkedin.com/in/imranqazi/">Imran</a> often arranges a quarterly team dinner with a fun social event.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*YZh3tK9Sin9MMxOB0Y6S-A.gif" /></figure><h3>5. Career Opportunities</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/128/1*R0XbFFnm67RgBytfScoa1A.png" /></figure><p>So what’s it really like to be a graduate at Lapis? Ask our most recent grad developer Ti:</p><ul><li>Ti Zou: <a href="https://www.linkedin.com/in/ti-zhou/?originalSubdomain=au">Senior Software Engineer at Lapis</a></li></ul><p>You may be wondering, what opportunities can come my way from being a graduate at Lapis? Here are some people who started their careers with Spatial Vision. Reach out to them for more 😸!</p><ul><li>Srishti Chaudhary: <a href="https://www.linkedin.com/in/srishti-chaudhary-88058224/">People, Transformation &amp; Consulting Expert at ANZ</a></li><li>Anastasia Foulidis: <a href="https://www.linkedin.com/in/anastasia-foulidis-5a690165/">QA Lead at Lais</a></li><li>Linda Warui: <a href="https://www.linkedin.com/in/linda-warui/?originalSubdomain=ke">Head of Shared Technology at Interswitch Group</a></li><li>Ryan Xiao: <a href="https://www.linkedin.com/in/ryan-haoruo-xiao-796221a0/?originalSubdomain=au">Software Engineer at Atlassian</a></li></ul><p>Apply to be a 2022 Graduate today 🙇!</p><p><a href="https://spatialvision.com.au/graduate-cadet-program/">Graduate Cadet Program | Software, Geospatial and Consulting Streams Available</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=31272c642a64" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/heres-why-you-should-start-your-career-with-lapis-31272c642a64">Here’s Why You Should Start Your Career with Lapis</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Migrate Kotlin backend APIs into Nx workspace]]></title>
            <link>https://medium.com/lapis/migrate-kotlin-backend-apis-into-nx-workspace-2b170c292ab8?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/2b170c292ab8</guid>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[pipeline]]></category>
            <category><![CDATA[nx]]></category>
            <category><![CDATA[monorepo]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Hiroki Gota]]></dc:creator>
            <pubDate>Mon, 14 Jun 2021 22:59:56 GMT</pubDate>
            <atom:updated>2021-06-11T01:58:19.419Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hFwTXRnfLjy-1NFxEYUbJg.png" /></figure><p><a href="https://nx.dev/">Nx</a>, a TypeScript based monorepo tool, is not only a great tool for Node.js based technology such as Angular, Ionic or NestJS but also works well with Kotlin based backend APIs with multiple modules.</p><h4>Modular Monolithic Kotlin Backend APIs</h4><p>At <a href="https://lapisit.com.au/">Lapis</a>, we are busy migrating existing <strong><em>manyrepo</em></strong> projects into the Nx workspace, in order to <a href="http://manyrepo/">simplify and streamline the development life cycle</a>.</p><p>We have recently built and released <a href="https://www.dpi.nsw.gov.au/__data/assets/pdf_file/0006/871737/AquaOnline-Stakeholder-Update-February-2019.pdf">AquaOnline</a>, a Commercial Aquaculture Management System for <a href="https://www.dpi.nsw.gov.au/">NSW DPI</a>. AquaOnline manages government administrative information for commercial aquaculture farms (land-based facilities) and leases (sea and rivers) with regulated permissions. The following diagram shows an initial domain model identified prior to the development.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qgnHxe5iQd_YxRclQZk75Q.png" /><figcaption>Domain Model</figcaption></figure><p>We use a <a href="https://www.infoq.com/news/2020/01/monolith-architectural-drivers/">Modular Monolithic architecture</a> approach, with a single SQLServer database and multiple schemas (each schema contains feature specific entities) and run on <a href="https://aws.amazon.com/fargate/">AWS Fargate</a>, a managed Docker Container Service.</p><h3>Manyrepos by feature modules</h3><p>The following diagram shows the Kotlin-based Backend-For-Frontend APIs and feature modules, which use to have their own GIT repository and CI processes before migrating to the Nx workspace.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rk2DxNu8D22ViH9sU_nsBw.png" /><figcaption>AquaAssist Backend API Modules</figcaption></figure><h3>Apps and Libs</h3><p>Nx workspace provides a standard folder structure to organise project artefacts. <strong>The apps</strong> <strong>folder</strong> contains frontend and backend applications, such as Angular or NestJS. <strong>The libs folder</strong> contains any reusable feature modules, which could be shared between the apps, both the frontend and backend. We can simply follow the same convention and place our Kotlin based modules in apps and libs folders.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*66whcpJS5C9oBUZUiCaDZQ.png" /><figcaption><a href="https://nx.dev/latest/angular/getting-started/nx-setup">https://nx.dev/latest/angular/getting-started/nx-setup</a></figcaption></figure><h3>Generators to create apps and libs</h3><p>Nx comes with a set of generators to scaffold an application or a library and configure it in nx.json, workspace.json, Typescript, ESLint and Jest configuration files. We could even create <a href="https://nx.dev/latest/angular/nx-plugin/overview">a custom generator plugin</a> for Kotlin. (The <a href="https://nx.dev/nx-community">Nx community plugins</a> have a generator for SprintBoot).</p><h4>Generate Kotlin based Feature Library</h4><p>Since we’re migrating existing repositories, we use a Node generator to scaffold a library instead of building a new generator.</p><p><strong>Naming Conventions</strong></p><p>We decided to prefix Kotlin based modules with kotlin-, so we can differentiate them from other Typescript based modules. The following command will generate a new folder structure in the libs folder and configure it in the configuration files. We delete the generated files in libs/kotlin-lib-core and copy Kotlin resources from the existing repository.</p><pre>nx generate @nrwl/node:library --name=kotlin-lib-core --no-interactive --dry-run</pre><pre>CREATE libs/kotlin-lib-core/README.md<br>CREATE libs/kotlin-lib-core/.babelrc<br>CREATE libs/kotlin-lib-core/src/index.ts<br>CREATE libs/kotlin-lib-core/src/lib/kotlin-lib-core.spec.ts<br>CREATE libs/kotlin-lib-core/src/lib/kotlin-lib-core.ts<br>CREATE libs/kotlin-lib-core/tsconfig.json<br>CREATE libs/kotlin-lib-core/tsconfig.lib.json<br>UPDATE tsconfig.base.json<br>UPDATE workspace.json<br>UPDATE nx.json<br>CREATE libs/kotlin-lib-core/.eslintrc.json<br>CREATE libs/kotlin-lib-core/jest.config.js</pre><h3>nx.json</h3><p>nx.json defines projects and the generator adds the new project in it. The project specifies 2 attributes, implicitDependencies and tags. implicitDependencies specifies a list of dependant modules. <a href="https://nx.dev/latest/angular/cli/affected">Nx affected</a> command will build the module when the dependant module has been changed in the build pipeline. tags will limit the usage of the library for apps and libs having the same tag.</p><pre>“kotlin-lib-core”: {<br> “implicitDependencies”: [“kotlin-aquaonline-pom”],<br> “tags”: [“scope:kotlin”]<br>},<br>&quot;kotlin-lib-transaction&quot;: {<br>  &quot;implicitDependencies&quot;: [&quot;kotlin-lib-core&quot;],<br>  &quot;tags&quot;: [&quot;scope:kotlin&quot;]<br>},</pre><p>nx dep-grapth uses implicitDependencies to visualise your dependency graph.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*lrPCXmP-EmXvkiY06O_nSg.png" /><figcaption>nx dep-grapth</figcaption></figure><h3>workspace.json</h3><p>workspace.json defines the project configuration such as the root folder (libs/kotlin-lib-core) and the builders, a set of tasks executed via Nx. Nx provides a set of builders for known architecture (Angular or NestJS), including build, serve, lint and test. We’ll follow similar DSLs in order to build a CI pipeline seamlessly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dGaK9qjgdn69LIXNOKO0Vg.png" /><figcaption>The project configuration in workspace.json</figcaption></figure><p>The above configuration shows 4 tasks, lint, build, test and deploy. These can be executed as follows:</p><pre>nx lint kotlin-lib-core<br>nx build kotlin-lib-core<br>nx test kotlin-lib-core<br>nx deploy kotlin-lib-core</pre><h4>Run Commands Builder</h4><p>We use <strong><em>run-commands builder</em></strong>, which allows you to run any CLI. The following shows the build task details. The builder simply executes the defined <em>commands</em>. install.sh runs maven install within a Docker container; change the owner of the target folder and copy the result into the dist folder. This is mimicking how Nx builds a typescript based project and the transpiled files are stored in the dist folder.</p><pre>&quot;build&quot;: {<br>          &quot;builder&quot;: &quot;<a href="http://twitter.com/nrwl/workspace">@nrwl/workspace</a>:run-commands&quot;,<br>          &quot;options&quot;: {<br>            &quot;commands&quot;: [<br>              &quot;./install.sh&quot;,<br>              &quot;./chown.sh&quot;,<br>              &quot;mkdir -p ../../dist/kotlin-lib-core&quot;,<br>              &quot;mv ./target ../../dist/kotlin-lib-core&quot;<br>            ],<br>            &quot;cwd&quot;: &quot;libs/kotlin-lib-core&quot;,<br>            &quot;parallel&quot;: false<br>          }<br>        }</pre><p>You can define any tasks for a project or set of projects with the same architecture. For Kotlin APIs, we also want to build a Docker image and push it to a Container Registry.</p><p>The following shows slightly different tasks for a Kotlin API, including prepare-docker and build-push-docker tasks:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*s5TvhQFNV6E5kS11DJKjsw.png" /><figcaption>The project configuration for the Kotlin application</figcaption></figure><h4>Force build order with strictlyOrderedTargets</h4><p>When you define your custom tasks, it’s important to specify the build order to ensure they run sequentially, as Nx, by default, executes tasks in parallel to minimise the total execution time. You can specify it using strictlyOrderedTargets in nx.json.</p><pre>&quot;tasksRunnerOptions&quot;: {<br>    &quot;default&quot;: {<br>      &quot;runner&quot;: &quot;<a href="http://twitter.com/nrwl/nx-cloud">@nrwl/nx-cloud</a>&quot;,<br>      &quot;options&quot;: {<br>        &quot;cacheableOperations&quot;: [&quot;build&quot;, &quot;lint&quot;, &quot;test&quot;, &quot;e2e&quot;],<br>        &quot;accessToken&quot;: &quot;...&quot;,<br>        &quot;canTrackAnalytics&quot;: false,<br>        &quot;showUsageWarnings&quot;: true,<br>        &quot;strictlyOrderedTargets&quot;: [<br>          &quot;build&quot;,<br>          &quot;prepare-test&quot;,<br>          &quot;test&quot;,<br>          &quot;lint&quot;,<br>          &quot;e2e&quot;,<br>          &quot;prepare-docker&quot;,<br>          &quot;build-push-docker&quot;,<br>          &quot;deploy&quot;,<br>          &quot;deploy-ec2&quot;<br>        ]<br>      }<br>    }</pre><h3>CI/CD Pipeline</h3><p>We now have a set of tasks that can be executed in the CI pipeline. We use the GitLab CI and execute them, by mapping these tasks with <strong><em>GitLab CI stages and jobs</em></strong>.</p><pre>stages:<br>    - init<br>    - init-test-db<br>    - build<br>    - test<br>    - build-push-docker<br>    - deploy</pre><p>You can simply execute nx affected command in each stage and jobs. Nx looks up any changes in the repository and only run tasks for projects which have changed or dependant on the changed projects.</p><pre>nx affected:build --base=HEAD~1 --head=HEAD --with-deps<br>nx affected:test --base=HEAD~1 --head=HEAD --with-deps<br>nx affected:build-push-docker --base=HEAD~1 --head=HEAD --with-deps<br>nx affected:deploy --base=HEAD~1 --head=HEAD --with-deps</pre><p>nx affected greatly simplifies the pipeline configuration for multi-module Kotlin-based APIs as you no longer need to worry about which repo should be pushed first or how to trigger another pipeline that is dependant on a particular feature module.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IDQavVf4Ur9F_icaxqRMbQ.png" /><figcaption>CI Pipeline</figcaption></figure><h3>Summary</h3><ul><li>Nx workspace can manage apps and libs using any technology, including Kotlin-based APIs</li><li>Nx Generators help you to configure a new project, even you don’t need scaffolded resources</li><li>Having a good naming convention will help to organise related apps and libs</li><li>implicitDependenciesspecifies Kotlin module dependencies and let you leverage nx affected command</li><li>run-commands builder lets you run any CLI via Nx on any platform (Linux, Mac and Windows)</li><li>strictlyOrderedTargets specified how the task should be executed sequentially</li><li>nx affected simplifies multi-module project pipeline by automatically discover changes and only run the pipeline that is affected</li></ul><p>Thanks for reading!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2b170c292ab8" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/migrate-kotlin-backend-apis-into-nx-workspace-2b170c292ab8">Migrate Kotlin backend APIs into Nx workspace</a> was originally published in <a href="https://medium.com/lapis">Code道</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 debug Ionic apps?]]></title>
            <link>https://medium.com/lapis/how-to-debug-ionic-apps-d73c6667c0e7?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/d73c6667c0e7</guid>
            <category><![CDATA[capacitorjs]]></category>
            <category><![CDATA[logrocket]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[ionic-framework]]></category>
            <dc:creator><![CDATA[Parham]]></dc:creator>
            <pubDate>Tue, 06 Apr 2021 20:32:37 GMT</pubDate>
            <atom:updated>2021-04-06T00:07:16.396Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pOyzJ7yr3TAVc-vbB-4L6w.jpeg" /><figcaption>Photo by <a href="https://www.pexels.com/@kevin-ku-92347?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Kevin Ku</a> from <a href="https://www.pexels.com/photo/black-farmed-eyeglasses-in-front-of-laptop-computer-577585/?utm_content=attributionCopyText&amp;utm_medium=referral&amp;utm_source=pexels">Pexels</a></figcaption></figure><p>Debugging a mobile application is an essential part of development and maintenance.<br>Using Ionic to create mobile apps gives us a lot of leverage when it comes to debugging.<br>In this article, I share some of the techniques I use to debug Ionic apps and some example from the projects that I have done.</p><p>The article is broken into two parts:</p><ul><li><a href="https://pazel.medium.com/how-to-debug-ionic-apps-during-development-19d5df51c6bf"><strong>How to debug Ionic mobile apps during development?</strong></a></li><li><a href="https://pazel.medium.com/how-to-debug-ionic-apps-in-production-202bb10f7c55"><strong>How to debug Ionic mobile apps in production?</strong></a></li></ul><p>Apart from what I have explained in my article, there are several guides in Ionic docs around debugging that I encourage you to read.</p><p><a href="https://ionicframework.com/docs/troubleshooting/debugging">Debugging - Ionic Documentation</a></p><p>Also, there is a good video by <a href="https://medium.com/u/bca45c04dc66">Simon Grimm</a> that covers a lot of good techniques and tips for debugging.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fwww.youtube.com%2Fembed%2Fakh6V6Yw1lw%3Ffeature%3Doembed&amp;display_name=YouTube&amp;url=https%3A%2F%2Fwww.youtube.com%2Fwatch%3Fv%3Dakh6V6Yw1lw&amp;image=https%3A%2F%2Fi.ytimg.com%2Fvi%2Fakh6V6Yw1lw%2Fhqdefault.jpg&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=youtube" width="854" height="480" frameborder="0" scrolling="no"><a href="https://medium.com/media/fe7934eab146595186ac6c96c0e470b2/href">https://medium.com/media/fe7934eab146595186ac6c96c0e470b2/href</a></iframe><p>Depending on which framework you use along with Ionic, make sure to check the debugging guide for that specific framework as well.</p><p>Here is a blog by <a href="https://medium.com/u/314f82b7e8">Emma Twersky</a> on debugging published on the Angular blog.</p><p><a href="https://blog.angular.io/angular-debugging-guides-dfe0ef915036">Angular Debugging Guides</a></p><p>By all means, there are many more issues that you may run into when building Ionic mobile apps. Like how to manage signing and deployment? How to avoid common problems with app store reviews?<br>How to deploy code updates without going through app stores? <br>How to avoid common pitfalls with PWAs? And many more topics.</p><p>I have spent years on this platform from the early days of Cordova up to now. So if there is anything else you would like me to cover and write about, please leave me a comment and let me know.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d73c6667c0e7" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/how-to-debug-ionic-apps-d73c6667c0e7">How to debug Ionic apps?</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Mastering functional programming with Ramda Part 1: Why ‘both’ instead of ‘and’]]></title>
            <link>https://medium.com/lapis/similar-yet-different-logic-functions-of-ramda-js-b10ae4051d4?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/b10ae4051d4</guid>
            <category><![CDATA[ramda]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[functional-programming]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Imab Asghar]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 09:36:21 GMT</pubDate>
            <atom:updated>2020-11-12T02:12:16.241Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eSCzEnoMPpWvrjKqvOXwZA.png" /></figure><p>When I was first introduced to <a href="https://ramdajs.com/">ramda</a> by our tech lead, I wanted to use it asap. The first thing I did was replace my &amp;&amp; operator with the <a href="https://ramdajs.com/docs/#and">and</a> function. <em>It worked like a charm!</em> The next time I had to use || operator, I accidentally used <a href="https://ramdajs.com/docs/#either">either</a> instead of the <a href="https://ramdajs.com/docs/#or">or</a> function. And guess what, It did not work. I replaced with the or function and it worked and I reported to my tech lead that either does not work, I don’t even know why it exists. <em>True Story!</em></p><p>However as time passed and I dived more into pipe chaining functions, curried functions and higher order functions, I came to know the usage of some of the logic functions of ramda.</p><p>Basically there are two types of logic functions in ramda:</p><ul><li>that accept value(s) as argument</li><li>that accept other function(s) as argument. (aka higher order functions)</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/498/1*iWMt1H05GHRVLMNaqSlHQQ.png" /></figure><p>As example let’s compare the syntax for and vs both. Let’s first look at an example using the and function.</p><pre>const isPendingDebitTransaction = (transaction) =&gt; {<br>  const isPendingTransaction = transaction.status === &#39;Pending&#39;<br>  const isDebitTransaction = transaction.type === &#39;Debit&#39;<br>  <br>  return <strong>and</strong>(isPendingTransaction, isDebitTransaction)<br>};</pre><p>Here is the <a href="https://ramdajs.com/repl/?v=0.27.0#?const%20isPendingDebitTransaction%20%3D%20%28transaction%29%20%3D%3E%20%7B%0A%20%20const%20isPendingTransaction%20%3D%20transaction.status%20%3D%3D%3D%20%27Pending%27%0A%20%20const%20isDebitTransaction%20%3D%20transaction.type%20%3D%3D%3D%20%27Debit%27%0A%20%20%0A%20%20return%20and%28isPendingTransaction%2C%20isDebitTransaction%29%0A%7D%3B%0A%0A%2F%2F%20isPendingDebitTransaction%28%7B%0A%2F%2F%20%20status%3A%20%27Approved%27%2C%0A%2F%2F%20%20type%3A%20%27Credit%27%2C%0A%2F%2F%20%7D%29%0A%0AisPendingDebitTransaction%28%7B%0A%20%20status%3A%20%27Pending%27%2C%0A%20%20type%3A%20%27Debit%27%2C%0A%7D%29%0A">ramda repl</a> for the above and functions code snippet.</p><p>Now let’s look at the same example but using the both function now.</p><pre>const isPendingTransaction = transaction =&gt; transaction.status === &#39;Pending&#39;<br>const isDebitTransaction = transaction =&gt; transaction.type === &#39;Debit&#39;</pre><pre>const isPendingDebitTransaction = (transaction) =&gt; {  <br>  return <strong>both</strong>(isPendingTransaction, isDebitTransaction)(transaction)<br>};</pre><pre>// Above function could also be shortened to<br>const isPendingDebitTransaction = <strong>both</strong>(<br>  isPendingTransaction,<br>  isDebitTransaction<br>);</pre><p>Here is the <a href="https://ramdajs.com/repl/?v=0.27.0#?const%20isPendingTransaction%20%3D%20transaction%20%3D%3E%20transaction.status%20%3D%3D%3D%20%27Pending%27%0Aconst%20isDebitTransaction%20%3D%20transaction%20%3D%3E%20transaction.type%20%3D%3D%3D%20%27Debit%27%0A%0Aconst%20isPendingDebitTransaction%20%3D%20%28transaction%29%20%3D%3E%20%7B%20%20%0A%20%20return%20both%28isPendingTransaction%2C%20isDebitTransaction%29%28transaction%29%0A%7D%3B%0A%0A%2F%2F%20isPendingDebitTransaction%28%7B%0A%2F%2F%20%20status%3A%20%27Approved%27%2C%0A%2F%2F%20%20type%3A%20%27Credit%27%2C%0A%2F%2F%20%7D%29%0A%0AisPendingDebitTransaction%28%7B%0A%20%20status%3A%20%27Pending%27%2C%0A%20%20type%3A%20%27Debit%27%2C%0A%7D%29%0A">ramda repl</a> for the above both functions code snippet.</p><p>The end result of both functions is same however one can see the number of reusable functions increased by using the both functions without any extra effort. Additionally higher order functions help us with composing other functions with less code and less complexity. Guess what we would do if we want to create a function called isPendingDebitTransactionUnder10?</p><pre>const isTransactionUnder10 = transaction =&gt; transaction.amount &lt; 10</pre><pre>const isPendingDebitTransactionUnder10 = <strong>both</strong>(<br>  isPendingDebitTransaction, <br>  isTransactionUnder10,<br>)</pre><p>Here are some more examples of ramda’s logic functions which accept value arguments (similar to the and function):</p><ul><li><a href="https://ramdajs.com/docs/#or">or</a></li><li><a href="https://ramdajs.com/docs/#not">not</a></li><li><a href="https://ramdajs.com/docs/#xor">xor</a></li></ul><p>Here are some more examples of logic functions which accept other functions as arguments (similar to the both function):</p><ul><li><a href="https://ramdajs.com/docs/#either">either</a></li><li><a href="https://ramdajs.com/docs/#complement">complement</a></li><li><a href="https://ramdajs.com/docs/#allPass">allPass</a></li><li><a href="https://ramdajs.com/docs/#anyPass">anyPass</a></li></ul><p>either and both work with two conditions. On the other hand anyPass and allPass work with multiple conditions. anyPass and allPass expect the first argument to be an array of functions.</p><p>As an example usage of allPass , I will use the exact code from one of our angular app’s async validator:</p><pre>public fishingActivityAlreadyAddedValidator = ({ value: { fishingDate, aln, areaCode, potSoaked, targetSpecies }}: FormGroup) =&gt;<br>    this.fishingActivityStore.select(this.selectFishingActivities)<br>      .pipe(<br>        take(1),<br>        map((fishingActivities) =&gt;<br>          fishingActivities<br>            .some(<strong>allPass([<br>              (fa: FishingActivity) =&gt; moment(fishingDate).isSame(prop(&#39;fishingDate&#39;, fa), &#39;day&#39;),<br>              propEq(&#39;aln&#39;, aln),<br>              propEq(&#39;areaCode&#39;, areaCode),<br>              propEq(&#39;potSoaked&#39;, potSoaked),<br>              propEq(&#39;targetSpecies&#39;, targetSpecies),<br>            ])</strong>) ? { fishingActivityAlreadyExists: true } : null,<br>        ),<br>      )</pre><p>Here is the <a href="https://ramdajs.com/repl/?v=0.27.0#?const%20fishingActivitiesList%20%3D%20%5B%0A%20%20%7B%0A%20%20%20%20aln%3A%20%2723%27%2C%0A%20%20%20%20areaCode%3A%2024%2C%0A%20%20%20%20potSoaked%3A%2030%2C%0A%20%20%20%20targetSpecies%3A%20%27Lobster%27%2C%0A%20%20%20%20someProp%3A%20%27It%20Does%20not%20matter%27%2C%0A%20%20%7D%2C%0A%20%20%7B%0A%20%20%20%20aln%3A%20%2723%27%2C%0A%20%20%20%20areaCode%3A%2026%2C%0A%20%20%20%20potSoaked%3A%2020%2C%0A%20%20%20%20targetSpecies%3A%20%27Crab%27%2C%0A%20%20%20%20someProp%3A%20%27It%20Does%20not%20matter%27%2C%0A%20%20%7D%2C%0A%5D%0A%0Aconst%20isExisting%20%3D%20%28fishingActivities%2C%20%7B%20aln%2C%20areaCode%2C%20potSoaked%2C%20targetSpecies%20%7D%29%20%3D%3E%20%0AfishingActivities%0A%20.some%28allPass%28%5B%0A%20%20propEq%28%27aln%27%2C%20aln%29%2C%0A%20%20propEq%28%27areaCode%27%2C%20areaCode%29%2C%0A%20%20propEq%28%27potSoaked%27%2C%20potSoaked%29%2C%0A%20%20propEq%28%27targetSpecies%27%2C%20targetSpecies%29%2C%0A%5D%29%29%0A%0AisExisting%28fishingActivitiesList%2C%20%7B%0A%20%20%20%20aln%3A%20%2723%27%2C%0A%20%20%20%20areaCode%3A%2024%2C%0A%20%20%20%20potSoaked%3A%2030%2C%0A%20%20%20%20targetSpecies%3A%20%27Lobster%27%2C%0A%20%20%20%20someProp%3A%20%27Dit%20it%20matter%3F%27%2C%0A%20%20%7D%0A%29%0A">ramda repl</a> for the above code showcasing the allPass.</p><p>Note about above code: Inside the fishingActivity object, fishingDate will have date and time both. However we want to just check against the date of each objects. I used <a href="https://momentjs.com/">Moment.js</a> isSame function inside our arrow function. This also means we can use any similar custom functions and not necessarily we need to use ramda functions as arguments to the higher order functions of ramda.</p><p>Although ramda is not yet fully typescript friendly, it is still very powerful and useful if you want to do functional programming.</p><p>If you are keen on trying out ramda, I would suggest you read a bit more about functional programming. If you think the learning curve of functional programming is a bit too much, I would suggest stick to imperative programming while using the ramda functions which pass value arguments (like and, or, not, etc.). Then gradually transition to more functional programming by trying out higher order functions and composing your own higher order functions.</p><p>Thanks for reading! Feel free to ask any questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b10ae4051d4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/similar-yet-different-logic-functions-of-ramda-js-b10ae4051d4">Mastering functional programming with Ramda Part 1: Why ‘both’ instead of ‘and’</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Searching through a list reactively in Angular]]></title>
            <link>https://medium.com/lapis/searching-through-a-list-reactively-in-angular-c61c9d1832df?source=rss----5b1d20c80b68---4</link>
            <guid isPermaLink="false">https://medium.com/p/c61c9d1832df</guid>
            <category><![CDATA[reactive-programming]]></category>
            <category><![CDATA[software-engineering]]></category>
            <category><![CDATA[javascript]]></category>
            <category><![CDATA[rxjs]]></category>
            <category><![CDATA[angular]]></category>
            <dc:creator><![CDATA[Imab Asghar]]></dc:creator>
            <pubDate>Fri, 06 Nov 2020 00:29:31 GMT</pubDate>
            <atom:updated>2020-11-30T22:54:45.244Z</atom:updated>
            <content:encoded><![CDATA[<h3>Reactive Search Feature with Angular</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*4LvvdmiYP3IxfAH4.jpg" /></figure><p>Every application we build will most likely include a search feature. Developers will build this differently based on their experience. Some will build reactively where as some will build non reactive (<em>hint: (change)=”search()”). </em>I will try to write reactively and simplify our observables down for different features within the search feature itself. Down below is a simplistic demo of what a search feature looks like.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*6O91YAKTPUJvb531ruWbXA.gif" /></figure><p>A component with reactive version would look something like below:</p><pre>@Component()<br>export class SearchComponent implements OnInit {<br>  public searchControl: FormControl;<br>  public searchResults$: Observable&lt;SearchResult[]&gt;;<br>  constructor(<br>    private searchService: SearchService, <br>    private formBuilder: FormBuilder,<br>  ) {}</pre><pre>  ngOnInit() {<br>    this.searchControl = this.formBuilder.control(&#39;&#39;);<br>    this.searchResults$ = this.searchControl.valueChanges<br>      .pipe(<br>        switchMap(searchString =&gt; this.searchService.search(searchString))<br>      )<br>  }<br>}</pre><p>Now we have two options. Either subscribe and unsubscribe in the component or use the async pipe.</p><p>However the search feature is not limited to just this main feature. There are other small features (UX) that will often popup when you are building a search feature. For example <strong>start searching only if minimum number of characters have been typed</strong>. This is to avoid having too many results which don’t add value to the user. The primary instinct is to just add a filter in the pipe like this:</p><pre>this.searchResults$ = this.searchControl.valueChanges<br>      .pipe(<br>        filter(searchString =&gt; searchString.length &gt;= 3),<br>        switchMap(searchString =&gt; this.searchService.search(searchString))<br>      )</pre><p>On the contrary, there is a bug introduced now. When I type in 3 characters and then remove a character it will still show you the last search results for 3 characters. To fix this bug, you can remove the filter and change the switchMap to use the javascript ternary operator along with rxjs <strong>of </strong>operator:</p><pre>this.searchResults$ = this.searchControl.valueChanges<br>      .pipe(<br>        switchMap(searchString =&gt; searchString.length &gt;= 3 ? this.searchService.search(searchString): of([]))<br>      )</pre><p>This is good enough for functionally but it is still not good enough for UX since you want to have the following messages in the template depending on the state of the search:</p><ul><li>“Enter minimum 3 characters to start searching”. You want this message to be showing until the user has typed in 3 characters in the search field.</li><li>“No results found”. In case the search string does not match with any search results.</li></ul><p>To handle these two user experience it becomes hard with the current observable we have. One option is to switchMap to of(null) and in the template you can check if null show the “Min 3 character” message. However if it is an empty array (searchResult.length === 0) you can show the “No Results found” message.</p><p>To me this is not satisfying enough. If I need to add another UX in it sometime later, I will try to patch it in the switchMap. So I want to refactor it. I think there is a chance we can leverage separation of concern design principle to this code:</p><pre>this.areMinimumCharactersTyped$ = this.searchControl.valueChanges<br>  .pipe(<br>    map(searchString =&gt; searchString.length &gt; 3)<br>  )</pre><pre>const searchString$ = merge(      <br>    defer(() =&gt; of(this.searchControl.value)),<br>    this.searchControl.valueChanges,<br>  )</pre><pre>this.searchResults$ = searchString$<br>  .pipe(<br>    switchMap((searchString: string) =&gt;<br>      this.searchService.search(searchString)<br>    ), <br>    share() // To share with areNoResultsFound$ and avoid double api calls<br>  );</pre><pre>this.areNoResultsFound$ = this.searchResults$<br>  .pipe(<br>    map(results =&gt; results.length === 0)<br>  );</pre><p>Explanation for the searchString$:</p><p>I need to get the initial value since valueChanges would only trigger for changes. So why use defer instead of startWith? In the template searchResults$ observable is invoked after minimum characters are typed and startWith will always take the initial empty string (‘’) value instead of the current value. This will make more sense when looking through the template further down.</p><p>Additionally since I need to optimize and reduce api calls, I can:</p><ul><li>add debounceTime to start searching once the user has finished typing so it reduces the api calls.</li><li>add distinctUntilChanged to only search if the searchString has changed.</li></ul><pre>const searchString$ = merge(      <br>      defer(() =&gt; of(this.searchControl.value)),<br>      this.searchControl.valueChanges,<br>    ).pipe(<br>      debounceTime(1000),<br>      distinctUntilChanged(),<br>    );</pre><pre>// Other options for adding these two operators:<br>// - In the this.searchResults$ variable<br>// - create a new variable called distinctDebouncedSearchString$</pre><p>Use these observables in the template with async pipe:</p><pre>&lt;ng-container<br>    *ngIf=&quot;areMinimumCharactersTyped$ | async; else lessThanMinimumCharactersTyped&quot;<br>  &gt;<br>    &lt;ng-container *ngIf=&quot;areNoResultsFound$ | async; else results&quot;&gt;<br>      No Results found.<br>    &lt;/ng-container&gt;<br>    &lt;ng-template #results&gt;<br>      Got results<br>      &lt;ul&gt;<br>        &lt;li *ngFor=&quot;let result of searchResults$ | async&quot;&gt;<br>          {{ result | json }}<br>        &lt;/li&gt;<br>      &lt;/ul&gt;<br>    &lt;/ng-template&gt;<br>  &lt;/ng-container&gt;<br>  &lt;ng-template #lessThanMinimumCharactersTyped&gt;<br>    Enter minimum 3 characters to start searching.<br>  &lt;/ng-template&gt;</pre><blockquote>“I hope someone could show me a better way to write the template.” — <em>Desperate Author</em></blockquote><p>Additionally if I use ngrx and effects to make the api calls, I can easily handle the loading, success and error states and show UI accordingly. Although I would have to change my search component slightly. How to use ngrx and effects with exposing the necessary UI states is explained well in another one of my blogs: “<a href="https://medium.com/lapis/elevate-your-code-series-blush-a845e9df96a2">Handling Success/Failure/Loading when calling an API with Angular and ngrx</a>”.</p><p>Although I ended up writing more code, however I think I was able to write cleaner, more maintainable code with more Domain Specific Language (<a href="https://en.wikipedia.org/wiki/Domain-specific_language">DSL</a>) and simplifying each observable to single responsibility. Overall it would be easier to add more features later down the track and people would avoid the pitfall of technical debt.</p><p>Here is the final version on <a href="https://stackblitz.com/edit/angular-oqrb82?file=src%2Fapp%2Fapp.component.ts">stackblitz</a>.</p><p>Thanks for reading!! Feel free to comment or ask any questions.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c61c9d1832df" width="1" height="1" alt=""><hr><p><a href="https://medium.com/lapis/searching-through-a-list-reactively-in-angular-c61c9d1832df">Searching through a list reactively in Angular</a> was originally published in <a href="https://medium.com/lapis">Code道</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>