<?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[Stories by Nethmin Dulsara on Medium]]></title>
        <description><![CDATA[Stories by Nethmin Dulsara on Medium]]></description>
        <link>https://medium.com/@nethmindulsara?source=rss-35d52eeecd7c------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*CmKIOrjBSdbfXCSZViWDew.jpeg</url>
            <title>Stories by Nethmin Dulsara on Medium</title>
            <link>https://medium.com/@nethmindulsara?source=rss-35d52eeecd7c------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 20:55:55 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@nethmindulsara/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Slim Down Your Containers: Docker Multi-Stage Builds Explained — Part 03]]></title>
            <link>https://nethmindulsara.medium.com/slim-down-your-containers-docker-multi-stage-builds-explained-f780bb9c1114?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f780bb9c1114</guid>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Mon, 04 Mar 2024 04:46:51 GMT</pubDate>
            <atom:updated>2024-03-04T08:50:17.163Z</atom:updated>
            <content:encoded><![CDATA[<p>Hello, everyone! I hope you’re all doing great. Welcome to the third part of our Docker series. Today, we’re going to talk about something that many of us face when we use Docker: our Docker images are getting too big. This can be a bit of a problem because it means we need more space to store them, and it can make things like updating our apps slower. Plus, our apps might not run as smoothly.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*L8xuW86vIuflOkAL1vqyqw.png" /></figure><p>You might be wondering, ‘What can we do to make these Docker images smaller?’ Well, there are a few tricks, like making sure we’re not adding extra stuff we don’t need, choosing lighter tools, or keeping our code neat and tidy. Another cool method is using something called ‘multi-stage builds’ in Docker. This is a great way to make our Docker images smaller without missing out on anything important.</p><p>In this article, I’m going to explain how multi-stage builds work and why they’re so helpful for keeping our Docker images lean. So, let’s get started on making our Docker containers better and our lives a little easier!</p><p>We’ll discuss,<br> 1) <a href="#6338">Understanding Docker Multi-Stage Builds</a><br> ∘ <a href="#97f2">What Are Multi-Stage Builds?</a><br> ∘ <a href="#ab2e">How Do They Help?</a><br> ∘ <a href="#8931">A Simple Example</a><br>2) <a href="#acf0">Practical Example: Optimizing a Next.js Application with Docker</a><br> ∘ <a href="#05dc">Step 1: Dockerfile Without Multi-Stage Builds</a><br> ∘ <a href="#35e3">Step 2: Refactoring to Use Multi-Stage Builds</a><br> ∘ <a href="#b655">Comparing the Results</a><br> ∘ <a href="#fe2a">Benefits Realized</a><br>3) <a href="#248c">Conclusion: Embracing Efficiency with Docker Multi-Stage Builds</a></p><h3>Understanding Docker Multi-Stage Builds</h3><p>Imagine you’re making a delicious pizza. First, you prepare the dough, add the toppings, and finally, bake it. In the end, all you want is the pizza, not the extra flour or the mixing bowl you used. Docker multi-stage builds work similarly. When we’re creating Docker images (our digital “pizza”), we often need tools and files just for the building part (like the dough and toppings preparation), which aren’t needed when we’re actually running the software (the final delicious pizza).</p><h4>What Are Multi-Stage Builds?</h4><p>Multi-stage builds in Docker are a smart way to make your Docker images as small as possible, without losing any of the essentials. It’s like being able to clean up all the mess from cooking (building software) before you serve the meal (run your software).</p><p>When we use Docker, we write a recipe (called a Dockerfile) that tells Docker how to make our image. With multi-stage builds, we can use more than one ‘recipe’ in the same Dockerfile. This means we can have one part of our Dockerfile for building the application with all the tools and files we need, and another part for the final image that only has what is absolutely necessary to run the application.</p><h4>How Do They Help?</h4><ol><li>Smaller Images: By removing unnecessary tools and files, the final image is much lighter. This means it takes up less storage space and can be moved around (like from your computer to the cloud) much faster.</li><li>Faster Deployment: Smaller images can be transferred more quickly, which means your apps can be updated or deployed faster.</li><li>Improved Security: Fewer tools and files in your final image also mean fewer ways for bad actors to attack your app.</li></ol><h4>A Simple Example</h4><p>Let’s consider a very basic example to illustrate this:</p><ul><li>Without Multi-Stage Builds: You have a single Dockerfile that includes everything — tools to build your app, dependencies, and your app itself. This makes the image big because it includes stuff you don’t need to run the app.</li><li>With Multi-Stage Builds: You divide your Dockerfile into two parts. The first part includes everything needed to build the app. The second part starts fresh and only copies over the built app from the first part. This way, the final image is much smaller and contains only what you need to run the app.</li></ul><p>In the next part of our article, we’ll dive deeper into how to actually write a Dockerfile using multi-stage builds, complete with a step-by-step guide and examples.</p><h3>Practical Example: Optimizing a Next.js Application with Docker</h3><p>To clearly demonstrate the advantages of multi-stage builds, let’s walk through a real-life scenario with a simple Next.js application. We’ll first create a Docker image without using multi-stage builds, note its size, and then refactor our Dockerfile to use multi-stage builds and compare the results.</p><h4>Step 1: Dockerfile Without Multi-Stage Builds</h4><p>First, let’s start with a basic Dockerfile for our Next.js application without multi-stage builds:</p><pre>ARG NODE_VERSION=18.18.2<br><br>FROM node:${NODE_VERSION}-alpine<br><br>WORKDIR /app<br><br>COPY package*.json ./<br><br>RUN npm install --omit-dev<br><br>COPY . .<br><br>RUN npm run build<br><br>CMD [&quot;npm&quot;, &quot;run&quot; ,&quot;start&quot;]<br></pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uqeKt23Z2MsnKYij6N6Kvw.png" /></figure><p>After building the image with this Dockerfile, let’s say the image size is approximately 699MB. This size includes not only our application but also all the build tools and dependencies. Note that our image size is small because our project is nothing but a very simple project with less number of dependencies.</p><h4>Step 2: Refactoring to Use Multi-Stage Builds</h4><p>Now, let’s refactor our Dockerfile to leverage multi-stage builds. This way, we’ll end up with an image containing only what’s necessary to run the application, excluding the build tools and development dependencies.</p><pre>ARG NODE_VERSION=18.18.2<br><br>#Stage one<br>FROM node:${NODE_VERSION}-alpine as base<br>WORKDIR /app<br>COPY package*.json ./<br>RUN npm install --omit-dev<br>COPY . .<br>RUN npm run build<br><br>#Final Image<br>FROM node:${NODE_VERSION}-alpine as production<br>WORKDIR /app<br>COPY --from=base /app/package*.json ./<br>COPY --from=base /app/.next ./.next<br>COPY --from=base /app/node_modules ./node_modules<br><br>CMD [&quot;npm&quot;, &quot;run&quot; ,&quot;start&quot;]</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*M4NzyouyvDWMAD-69lCc7Q.png" /></figure><p>In this multi-stage Dockerfile, the first stage (base) is where we install dependencies and build our Next.js application. The second stage starts with a lighter base image (node:18.18.2-alpine) and only copies the build artifacts necessary to run the application from the base stage. We deliberately exclude the development tools and dependencies.</p><h4>Comparing the Results</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/678/1*MQEBAZ-bg9NMhVaCimos3g.png" /></figure><p>After building the image with the multi-stage Dockerfile, the image size drops significantly, let’s say to around 579MB. Note when your application gets bigger and bigger, this size difference can be from 1 to 2 GB or more.</p><h4>Benefits Realized</h4><ul><li>Reduced Image Size: The multi-stage build process drastically reduces the image size, making it quicker to upload, download, and deploy.</li><li>Enhanced Security: By excluding unnecessary build tools and files, we minimize the potential attack surface of our application.</li><li>Optimized Resources: Smaller images consume less storage and bandwidth, leading to cost savings and more efficient resource use.</li></ul><h3>Conclusion: Embracing Efficiency with Docker Multi-Stage Builds</h3><p>Throughout this article, we’ve explored the concept of Docker multi-stage builds, a powerful technique that can significantly slim down your Docker images. By walking through a practical example with a Next.js application, we’ve seen firsthand the dramatic reduction in image size that multi-stage builds can achieve — from a bulky 699MB image to a sleek 579MB counterpart. This not only speeds up deployment but also enhances security and optimizes resource usage.</p><p>I encourage you to experiment with multi-stage builds in your projects. Start small, perhaps by refactoring a Dockerfile for an existing application, as we did with our Next.js example. You’ll quickly see the benefits and wonder how you managed without it.</p><p>Docker multi-stage builds are more than just a best practice; they’re a testament to the evolution of containerization technology, enabling developers to build and deploy applications more efficiently than ever before. So, dive in, streamline your Docker images, and take your containerization strategy to the next level.</p><p>Happy Dockerizing!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f780bb9c1114" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to the Docker Basics]]></title>
            <link>https://nethmindulsara.medium.com/introduction-to-the-docker-basics-4677a139f399?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4677a139f399</guid>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Tue, 20 Feb 2024 11:28:30 GMT</pubDate>
            <atom:updated>2024-03-04T08:49:46.553Z</atom:updated>
            <content:encoded><![CDATA[<h3>Introduction to Docker Basics: Navigating the World of Containers — Part 02</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MusDSLOdfY3oCJmdnhofAg.png" /></figure><p>Hey there, fellow tech enthusiasts! Following our previous chat about the incredible role of Docker in modern software development, it’s time to peel back another layer and get our hands dirty with the basics of Docker. If you’ve ever wondered how this technology makes software deployment as easy as pie, you’re in for a treat. Today, we’re going from zero to hero, covering everything from Docker images and containers to networking and docker-compose files. Let’s jump right in, shall we?</p><p><strong>Outline of Today’s Journey</strong></p><ol><li><a href="#d297">Image vs Container</a></li><li><a href="#d2f8">Layer Concept in Docker</a></li><li><a href="#f57d">Run Your First Container</a></li><li><a href="#4fc5">What is Dockerfile?</a></li><li><a href="#2053">Your First Image</a></li><li><a href="#47c4">Understanding Docker Ports</a></li><li><a href="#1dc6">Working with Multiple Containers</a></li><li><a href="#e93f">Docker Compose: The Conductor of Containers</a></li><li><a href="#8959">Let’s Wrap-Up</a></li><li><a href="#8fe2">Conclusion</a></li></ol><h3>Image vs Container</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*mAIZLvV4qr1wcPKKjrELAg.jpeg" /></figure><p>In the vibrant world of Docker, understanding the difference between an image and a container is like knowing the difference between a recipe and a meal. A Docker image is a lightweight, standalone, executable package that includes everything needed to run a piece of software: the code, a runtime, libraries, environment variables, and configuration files. It’s the master blueprint that sits in your repository, immutable and ready to be brought to life. You can think of it as a recipe that outlines all the ingredients and steps required to create your dish.</p><p>On the flip side, a Docker container is the running instance of a Docker image. When you decide it’s time to eat, you take the recipe (image), cook (run) it, and voila, you have a meal (container) ready to serve. Containers encapsulate everything needed to run the application, ensuring that it works seamlessly in any environment. While the image is static, the container is dynamic, living in the moment it’s executed. It’s the process of turning those static ingredients listed in your recipe into a delicious meal ready to be enjoyed. This distinction is crucial in the Docker ecosystem, enabling developers to easily share, scale, and deploy applications across any environment with confidence.</p><h3>Layer Concept in Docker</h3><p>Let’s unravel the magic behind Docker’s efficiency — the layered filesystem. Think of it as building a cake, layer by layer. Each instruction in your Dockerfile adds a new layer to the cake, like adding a layer of frosting, then sprinkles, then another layer of cake, and so on. These layers stack neatly on top of each other, creating a final product that’s both delicious and efficient to assemble. In Docker’s world, these layers represent changes to the image, like adding files, running commands, or setting environment variables.</p><p>Now, why is this approach such a big deal? Picture this: you and your friend are baking two cakes, both needing the same base layer. Instead of making two separate bases from scratch, you just share one. That’s exactly how Docker layers work. When different images are built on the same base layer, they share that layer, saving space on your hard drive and making your images lighter and faster to transport across the Docker universe. It’s like getting the efficiency of a baking assembly line in your software deployment process. When it’s time to update your application, Docker only needs to change the layers that got tweaked, not the whole image. It’s a bit like patching a pair of jeans instead of buying a new pair every time there’s a tiny tear. This layered wizardry makes deploying and updating your applications as easy as pie, ensuring that your development cycle is as smooth as butter.</p><h3>Run Your First Container</h3><p>Before we jump into the thrilling experience of running your first Docker container, there’s a small but crucial step we need to take — installing Docker itself. Now, don’t worry; this isn’t one of those complicated setups that require a wizard’s spell to complete. Simply head over to Docker’s official documentation and select the installation guide that matches your operating system. Whether you’re a Windows wizard, a macOS master, or a Linux legend, the documentation has you covered with straightforward, step-by-step instructions. So, take a moment to get Docker up and running on your machine. It’s like setting up your artist’s palette before you start painting your masterpiece. Once you’ve got Docker installed, you’ll be all set to dive into the world of containers and images. Let’s get ready to Dockerize!</p><p>Now that you’ve got Docker installed, thanks to the straightforward guides from Docker’s own treasure trove of documentation, it’s time to truly embark on our Docker journey. Let’s dive in and run our very first Docker container. For our inaugural adventure, we’ll be summoning the trusty Ubuntu image from Docker Hub. Think of Docker Hub as the grand library of Docker images, where countless images are neatly cataloged for your perusal and use.</p><p>Here’s the step-by-step guide to get your first container up and running:</p><ol><li>Pull the Ubuntu Image: First, we need to fetch the Ubuntu image from Docker Hub. Open up your terminal and enter the magical incantation: docker pull ubuntu. This command reaches out to Docker Hub, finds the Ubuntu image, and downloads it to your local machine, much like fetching a book from the library&#39;s shelves.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/981/1*Ip-zXuXjTFAIQs45SWQdgQ.png" /></figure><ol><li>Run Your Ubuntu Container: With the Ubuntu image now residing on your local machine, it’s time to breathe life into it. Type in docker run -it ubuntu into your terminal. This command does a few things: it tells Docker to run a container based on the Ubuntu image you just downloaded, and the -it flags are there to open an interactive terminal session inside the container. Think of it as stepping into a virtual room that&#39;s been set up exactly like an Ubuntu environment.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*asSe2Of8y_ORSeUVcBaXnQ.png" /></figure><p>Congratulations! You’re now inside your very first Docker container. It’s a bit like stepping into a parallel universe where you have a fresh Ubuntu system at your fingertips. Feel free to explore and experiment. Want to see what’s inside? Try running ls to list directories and files, or whoami to see your user name. When you&#39;re ready to return to your original world, simply type exit. This will close down your container session and bring you back to your host system&#39;s terminal.</p><p>This moment marks your first hands-on experience with Docker, opening the door to a realm of possibilities. Running a Docker container is a foundational skill in the Docker universe, akin to casting your first spell in the world of magic. You’ve just taken the first step on a path that leads to vast landscapes of development and deployment opportunities. Welcome to the world of Docker, where the potential for innovation is as boundless as your imagination!</p><h3>What is Dockerfile?</h3><p>Embarking further into our Docker journey, we arrive at a pivotal moment where we introduce the architect of Docker images — the Dockerfile. Imagine you’re a chef preparing to create a culinary masterpiece. The Dockerfile is your recipe, outlining every ingredient and step needed to create your dish. It’s a simple text file, yet it holds the power to assemble containers that run seamlessly across any environment.</p><p>A Dockerfile starts with a base image, specifying the foundation upon which your application will be built. Think of it as choosing the main ingredient for your dish. From there, you layer on additional instructions like adding spices or cooking at a certain temperature. In Docker terms, these instructions could be installing software packages, copying files into the image, or setting environment variables. Each instruction adds a new layer to the image, building up your application piece by piece.</p><p>Why do we need a Dockerfile? It ensures that your application can be consistently built and deployed anywhere. It eliminates the “but it works on my machine” conundrum, making sure that if it works in one environment, it will work in others. Plus, it’s an essential tool for automation. With a Dockerfile, you can automate the building of your images, making the process repeatable and error-free.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/672/1*LXz3mtfOIhKZZ7TLLLjNKw.png" /></figure><p>The structure of a Dockerfile is both powerful and elegant. Starting with a base image using the FROM command, you then use various directives like RUN, COPY, ADD, CMD, and more to assemble your image. Each line in a Dockerfile is a step in the recipe, and Docker builds the image by following these steps in order. By the end of the process, you have a Docker image that&#39;s ready to be run as a container, anywhere Docker is available.</p><p>Creating a Dockerfile is like writing your own guide to constructing a world-class application. It’s an invitation to creativity, efficiency, and consistency in the software development process. With a Dockerfile in hand, you’re not just a developer; you’re an architect, designing portable, scalable, and reliable applications that can thrive in the diverse landscape of modern computing environments.</p><h3>Your First Image</h3><p>Now that you’re familiar with the blueprint of Docker magic — the Dockerfile — it’s time to put theory into practice and craft your very first Docker image. We’re going to build an image for a simple Node.js-Express application. This process not only demystifies the steps behind creating Docker images but also hands you the keys to building and deploying your applications with Docker.</p><h4>Step-by-Step Guide to Crafting Your First Docker Image</h4><ol><li>Prepare Your Application: Begin with a simple Node.js application. If you don’t have one ready, just create a new directory, and inside it, place an app.js file with a basic Express server that listens on port 8080. Don&#39;t forget a package.json file specifying your dependencies.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/956/1*411qpDbGOVzTXdloF6VVzw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/342/1*hcw5yYQEyM26u5b7VgrzOg.png" /></figure><p>2. Craft Your Dockerfile: Now, open your text editor and create a new file named Dockerfile in the root of your application directory. This Dockerfile will be the recipe for building your application&#39;s image. Here&#39;s a simple example to get you started:</p><pre>FROM node:18<br><br>WORKDIR /app<br><br>COPY . .<br><br>RUN npm install<br><br>EXPOSE 3000<br><br>CMD [&quot;node&quot;, &quot;app.js&quot;]</pre><p>3. Build Your Image: With your Dockerfile ready, it’s time to build the image. Open your terminal, navigate to your application directory, and run the following command: docker build -t my-nodejs-app .. This tells Docker to build an image from the Dockerfile in the current directory and tag it as my-nodejs-app.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4JKwesIStjUaP-cUU-uL7A.png" /></figure><p>4. Run Your Container: Once the build completes, launch your container using: docker run -p 3000:3000 -d my-nodejs-app. This command runs your container in detached mode, maps port 3000 of the container to port 3000 on your host, and uses the image you just built.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*VWpoMQ0ZmIobkq3bpvFL3g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/647/1*WszJsnSLLWvNM3loWiM1fw.png" /></figure><p>Congratulations! You’ve just built and run your first Docker container from an image you created. This container hosts your Node.js application, encapsulated in a portable, lightweight environment. By mastering this process, you unlock a new level of development efficiency and deployment flexibility. Docker images ensure your applications run consistently across any machine, eliminating the infamous “it works on my machine” problem. Welcome to the future of app development and deployment — simplified, streamlined, and secured with Docker.</p><h3>Understanding Docker Ports</h3><p>Before we venture further, let’s take a brief detour and demystify an essential aspect of Docker containers — port mapping. In the realm of Docker, ports play a critical role in enabling communication between your containerized applications and the outside world. Understanding how Docker handles ports is key to ensuring your applications are accessible and functioning correctly.</p><h4>How Docker Ports Work</h4><p>Imagine your container as a house in a vast neighborhood (the Docker host). This house has windows and doors (ports), which can be opened or closed to allow communication and interaction with the outside world. By default, all the doors and windows are closed; your application might be running smoothly inside the container, but no one outside can interact with it.</p><p>When you run a container and specify port mappings using the -p flag (e.g., docker run -p 3000:3000 -d my-nodejs-app), you&#39;re instructing Docker to create a pathway between a port on your Docker host (the first 3000) and a port inside the container (the second 3000). This is akin to opening a window in our house analogy, allowing traffic to flow in and out through that specific port.</p><p>Understanding Docker ports and port mapping is like learning the rules of the road for container traffic. It ensures that your applications are not just running smoothly but are also reachable, secure, and operating as expected in their Dockerized environments.</p><h3>Working with Multiple Containers</h3><p>As you delve deeper into the Docker universe, you’ll quickly discover the power of orchestrating multiple containers to create more complex, scalable, and resilient applications. Just like a symphony orchestra combines the sounds of different instruments to create a harmonious performance, working with multiple containers allows you to build sophisticated applications where each container plays a specific, isolated role in the overall application architecture.</p><h4>Why We Need Multiple Containers</h4><p>In the world of microservices and distributed systems, the philosophy of “one process per container” reigns supreme. This approach offers several compelling advantages:</p><ul><li>Modularity: By dividing your application into smaller, self-contained units (containers), you can develop, update, and scale each part independently. This modularity makes managing and updating your application components more manageable and less risky.</li><li>Scalability: Need more power for your database or web server? With multiple containers, scaling up a specific component of your application is as simple as launching more containers for that service. This targeted scalability is efficient and cost-effective.</li><li>Resilience: Distributing your application across multiple containers can enhance its overall resilience. If one container fails, it doesn’t necessarily bring down your entire application. This compartmentalization can lead to higher availability and reliability.</li></ul><h3>Docker Compose: The Conductor of Containers</h3><p>While running multiple containers manually is possible, Docker Compose acts as the conductor, orchestrating the deployment and interaction of your containers with ease. Docker Compose allows you to define a multi-container application in a single file, then spin up your application with a single command: docker-compose up. This simplicity is a game-changer for developers and DevOps professionals alike.</p><h4>A Simple Example</h4><p>Imagine you are working on a project which has mongoDB database. And, you need some visualization software to visualize the database. With all that, you don’t have mongoDB in your local setup. So you can use the power of docker-compose. Here is the simple docker-compose file all you need to run both your computer without even installing any of it on your local computer.</p><pre>version: &quot;3&quot;<br>services:<br>  mongoDB:<br>    image: mongo:latest<br>    ports:<br>      - 27017:27017<br>    environment:<br>      MONGO_INITDB_ROOT_USERNAME: root<br>      MONGO_INITDB_ROOT_PASSWORD: root<br>    networks:<br>      - my-network<br>    volumes:<br>      - mongo-data:/data/db<br><br>  mongo-express:<br>    image: mongo-express<br>    ports:<br>      - 8081:8081<br>    environment:<br>      ME_CONFIG_MONGODB_ADMINUSERNAME: root<br>      ME_CONFIG_MONGODB_ADMINPASSWORD: root<br>      ME_CONFIG_MONGODB_SERVER: mongoDB<br>    depends_on:<br>      - mongoDB<br>    networks:<br>      - my-network<br><br>networks:<br>  my-network:<br>    driver: bridge<br><br>volumes:<br>  mongo-data:<br>    driver: local</pre><p>This configuration tells Docker Compose about your two services: mongoDB, and mongo-express. Each service is configured with its specific settings, such as build context, ports, and environment variables. With Docker Compose, launching your entire application stack is as straightforward as running docker-compose up from the directory containing your docker-compose.yml file.</p><p>Working with multiple containers introduces a new layer of complexity to your Docker adventures, but it’s also where the true power of Docker shines. By orchestrating multiple, interconnected containers, you create robust, scalable applications that mirror the complex, real-world scenarios they’re designed to handle. As you continue your Docker journey, embrace the challenge and creativity of multi-container orchestration. It’s your gateway to building state-of-the-art applications in the cloud-native world.</p><h3>Let’s Wrap-Up</h3><p>As we reach the conclusion of our Docker basics exploration, it’s time to take a step back and reflect on the ground we’ve covered. From the foundational concepts of images and containers to the architectural blueprints of Dockerfiles, and the orchestration magic of docker-compose, you’ve embarked on a journey that’s unlocked the essentials of containerization with Docker.</p><h4>Key Takeaways</h4><ul><li><strong>Images and Containers:</strong> You’ve learned that Docker images are the blueprints for containers, providing a lightweight, standalone package for your software. Containers, in turn, are the live instances of these images, running your applications in isolated environments.</li><li><strong>Dockerfile Mastery:</strong> We dove into the Dockerfile, your recipe for creating Docker images. This essential component allows you to automate the creation of your images, ensuring consistency and repeatability across environments.</li><li><strong>Your First Image:</strong> By building your first Docker image for a simple Node.js-Express application, you’ve taken the leap from theory to practice, applying your newfound knowledge in a practical setting.</li><li><strong>Docker-Compose File:</strong> The introduction of the docker-compose file opened the doors to multi-container applications, simplifying the complexity of running and managing multiple containers with a single, declarative file.</li></ul><h3>Conclusion</h3><p>Thank you for joining me on this introductory journey through Docker basics. I hope this guide has illuminated the path forward in your Docker exploration and demystified the core concepts of containerization. As we wrap up, remember that the journey to mastering Docker is a marathon, not a sprint. Take your time, practice, and continue learning.</p><p>Stay tuned for our next adventure, where we’ll delve into Docker volumes, networks, and beyond. Until then, happy Dockering!</p><p>Thank you.<br>Nethmin Dulsara</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4677a139f399" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unleashing Efficiency: The Essential Role of Docker in Modern Software Development — Part 01]]></title>
            <link>https://nethmindulsara.medium.com/unleashing-efficiency-the-essential-role-of-docker-in-modern-software-development-fa8e48ab51a0?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/fa8e48ab51a0</guid>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Sat, 17 Feb 2024 07:02:35 GMT</pubDate>
            <atom:updated>2024-03-04T08:49:11.173Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fujx0p_U8wfqQjkltb1wNw.png" /></figure><p>Hey there! Let’s talk about something that’s revolutionized the way we deploy software: Docker. You’ve probably heard about it, but why is it such a big deal? Let’s dive in with a friendly chat about the good old days of software deployment, the challenges we faced, and how Docker has come to the rescue.</p><h4>The Good Old (Complicated) Days</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*beimfDoVnfeV20IWxgs2Mw.png" /></figure><p>Remember the time when deploying software was like planning a trip without Google Maps? That’s how it was before Docker came along. Back then, the operations team had a tough job. They had to set up environments manually for each project — development, testing, production — you name it. And boy, was it a challenge!</p><p>Challenges Operations Teams Faced:</p><ul><li><strong>Environment Inconsistency:</strong> Ever heard the infamous “but it works on my machine”? That was the anthem of the day. Moving software from one environment to another was a nightmare because of slight differences between them.</li><li><strong>Resource Intensiveness: </strong>Using virtual machines (VMs) for different applications was like packing your entire closet for a weekend trip. It was heavy and unnecessary.</li><li><strong>Scalability Issues:</strong> Trying to scale your application felt like trying to fit more passengers into an already full car.</li><li><strong>Deployment Complexities:</strong> Setting up servers manually for each application was like doing a complicated dance, but without the fun.</li><li><strong>Dependency Management:</strong> Juggling application dependencies across different environments was as confusing as trying to solve a Rubik’s Cube in the dark.</li></ul><h4>The Light at the End of the Tunnel: Docker</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*V8oDzN2YGSD5W5RPk1u6nA.png" /></figure><p>So, what changed? Enter Docker, the superhero of software deployment. Docker brought in the concept of containerization, making everything we knew about deployment seem like ancient history.</p><p>How Docker Solved These Issues:</p><ul><li><strong>Consistent Environments:</strong> Docker containers are like portable environments. They run the same, no matter where you take them. This means no more “works on my machine” scenarios.</li><li><strong>Resource Efficiency: </strong>Containers are lightweight and share resources. It’s like having a suitcase that only weighs as much as the essentials you pack in it.</li><li><strong>Ease of Scalability:</strong> With Docker, scaling up is as easy as copying your favorite playlist. Containers can be easily replicated to handle more load.</li><li><strong>Simplified Deployment Process:</strong> Docker uses Dockerfiles to define container specifications. It’s like having a recipe that anyone can follow to recreate your software environment.</li><li><strong>Improved Dependency Management:</strong> Each container bundles its own dependencies. Imagine every application coming with its own set of instructions and materials, neatly packed and ready to go.</li></ul><h4>The Real-World Impact</h4><p>Developers love Docker because it lets them focus on coding rather than worrying about deployment. Operations teams are happier because managing deployments is now a breeze. Companies are adopting Docker because it makes their entire software development process more efficient and reliable.</p><h4>Final Thoughts</h4><p>Docker isn’t just another tool. It’s a paradigm shift in how we think about developing, deploying, and managing applications. It’s made our lives easier, our deployments faster, and our applications more reliable. If you haven’t given Docker a try, maybe it’s time to see what all the fuss is about.</p><p>And there you have it! A friendly chat about Docker and why it’s the knight in shining armor for software deployment. Here’s to making our software development journey a little less bumpy and a lot more fun. Cheers to Docker!</p><h3>Want to Learn More?</h3><p>Feeling intrigued? Dive deeper into Docker with <a href="https://docs.docker.com/">official documentation</a>, tutorials, and join <a href="https://forums.docker.com/">community forums</a>. There’s a whole world out there waiting to make your software deployment process as smooth as butter. Happy Dockering!</p><p>And guess what? This is just the beginning. I’m on a journey to explore Docker and its ecosystem even further, and I’d love for you to join me. In the coming weeks, I’ll be diving into more topics related to Docker, containerization, and how these technologies are shaping the future of software development. From hands-on tutorials to deep dives into Docker’s advanced features, we’ve got a lot of exciting stuff ahead.</p><p>So, stay tuned! Whether you’re just starting out with Docker or looking to level up your skills, I’m here to share insights, tips, and stories from the trenches. Let’s demystify Docker together and unlock new possibilities in our software development adventures.</p><p>Best regards,<br>Nethmin Dulsara</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=fa8e48ab51a0" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Database Landscape: Understanding Key-Value, Relational, Document, Graph, and Search…]]></title>
            <link>https://nethmindulsara.medium.com/exploring-the-database-landscape-understanding-key-value-relational-document-graph-and-search-22394059ecb4?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/22394059ecb4</guid>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Wed, 14 Feb 2024 14:11:56 GMT</pubDate>
            <atom:updated>2024-02-14T14:11:56.464Z</atom:updated>
            <content:encoded><![CDATA[<h3>Exploring the Database Landscape: Understanding Key-Value, Relational, Document, Graph, and Search Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/626/1*LEFsERsuxnA1IHj-iSH_rA@2x.png" /></figure><p>In today’s digital age, databases are the backbone of nearly every application, storing and managing all the data that powers our digital world. From social media platforms to banking systems, databases ensure that the right information is accessible at the right time. This blog post aims to demystify the diverse landscape of databases, covering key-value, relational, document, graph, and search databases. Let’s dive in and understand what makes each type unique and how to choose the right one for your needs.</p><h3>Section 1: Key-Value Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/900/1*vxz_NOjZkB6qRHqy_tTJ4w.png" /></figure><p><strong>Definition and Core Principles:</strong> Key-value databases are all about simplicity and speed. They store data as a collection of key-value pairs, where a key serves as a unique identifier to access its corresponding value. This model allows for efficient data retrieval and high performance.</p><p><strong>Use Cases and Advantages:</strong> These databases are ideal for scenarios requiring fast lookups, such as caching, session storage, or real-time recommendations. Their simplicity and speed are the main draws.</p><p><strong>Examples:</strong> Redis and DynamoDB are popular choices, known for their performance and scalability.</p><p><strong>Limitations:</strong> The simplicity of key-value stores also means they’re not suited for complex queries or relationships between data. They’re best used when the data structure is simple and not interconnected.</p><h3>Section 2: Relational Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/640/1*POIimbsOmPnP_qsBJhk51Q.png" /></figure><p><strong>Definition and Core Principles:</strong> Relational databases store data in tables, which can relate to each other through keys. This structure supports complex queries and transactions, making data management more flexible and powerful.</p><p><strong>Use Cases and Advantages:</strong> They’re the go-to for applications requiring complex transactions, data integrity, and relationships among data, such as financial systems or customer relationship management (CRM) systems.</p><p><strong>Examples:</strong> MySQL, PostgreSQL, and Oracle are stalwarts in this category, offering robust features and reliability.</p><p><strong>Limitations:</strong> The complexity of relational databases can lead to performance bottlenecks for high-volume, high-velocity data. They may also require more maintenance and skilled personnel to manage.</p><h3>Section 3: Document Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/582/1*1ShEWkJPGdS00TMDkJivmw.png" /></figure><p><strong>Definition and Core Principles:</strong> Document databases store data in documents (think JSON, BSON), allowing for a more flexible schema than the rigid structure of relational databases. This means you can store related information together without predefined tables.</p><p><strong>Use Cases and Advantages:</strong> Perfect for content management systems, e-commerce applications, and any scenario where the data structure can vary or evolve over time.</p><p><strong>Examples:</strong> MongoDB and Couchbase are leading examples, prized for their flexibility and ease of use.</p><p><strong>Limitations: </strong>While their flexibility is a strength, it can also lead to data inconsistency if not managed properly. They may not be the best choice for highly transactional systems.</p><h3>Section 4: Graph Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/901/1*Hyh5zbTb_Rn0F7D_O4O9AA.png" /></figure><p><strong>Definition and Core Principles:</strong> Graph databases excel at handling interconnected data. They store entities as nodes and relationships as edges, making them ideal for analyzing complex relationships with high efficiency.</p><p><strong>Use Cases and Advantages:</strong> Social networks, recommendation engines, and fraud detection systems benefit from graph databases due to their ability to quickly traverse and analyze complex networks of data.</p><p><strong>Examples:</strong> Neo4j and Amazon Neptune are popular for their powerful querying capabilities and performance in graph operations.</p><p><strong>Limitations: </strong>Their specialized nature means they’re not suited for general-purpose data storage. They require a specific type of problem or dataset to shine.</p><h3>Section 5: Search Databases</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TYTON_aQhF3GeG8c_0xMng.png" /></figure><p><strong>Definition and Core Principles:</strong> Search databases are optimized for indexing and searching text or other content to quickly find relevant information. They can handle fuzzy searches, text analysis, and aggregation.</p><p><strong>Use Cases and Advantages:</strong> Ideal for building search engines, log analysis systems, and any application needing powerful search capabilities over large datasets.</p><p><strong>Examples:</strong> Elasticsearch and Apache Solr are widely used for their robust, scalable search features.</p><p><strong>Limitations:</strong> While powerful for search operations, they may not be suitable as the primary database for transactional data or where relationships between data are complex.</p><h3>Comparison Table</h3><p>To help you quickly compare:</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d10ffe3066ab0516812f681b3700eeef/href">https://medium.com/media/d10ffe3066ab0516812f681b3700eeef/href</a></iframe><h3>Conclusion</h3><p>Choosing the right database depends on your specific needs: the nature of your data, the complexity of your queries, and the scalability requirements of your application. While this guide offers a starting point, diving deeper into each database type will help you make the best choice for your project.</p><h3>Further Reading and Resources</h3><p>For those eager to explore further, here are some resources:</p><ul><li>Official documentation for <a href="https://redis.io/documentation">Redis</a>, <a href="https://docs.aws.amazon.com/dynamodb/">DynamoDB</a>, <a href="https://dev.mysql.com/doc/">MySQL</a>, <a href="https://www.postgresql.org/docs/">PostgreSQL</a>, <a href="https://docs.mongodb.com/">MongoDB</a>, <a href="https://docs.couchbase.com/">Couchbase</a>, <a href="https://neo4j.com/docs/">Neo4j</a>, <a href="https://docs.aws.amazon.com/neptune/latest/userguide/">Amazon Neptune</a>,<a href="https://www.elastic.co/guide/en/elasticsearch/reference/current/index.html"> Elasticsearch</a>, and <a href="https://solr.apache.org/guide/">Apache Solr</a>.</li><li>Tutorials and community forums related to each database technology.</li></ul><p>By understanding the strengths and limitations of each database type, you can better align your technology choices with your project’s requirements, ensuring your application is built on a solid foundation. Happy exploring!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22394059ecb4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Exploring the Power of SVG in Web Development]]></title>
            <link>https://nethmindulsara.medium.com/exploring-the-power-of-svg-in-web-development-4ead0a7d2aee?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/4ead0a7d2aee</guid>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Mon, 12 Feb 2024 14:20:37 GMT</pubDate>
            <atom:updated>2024-02-12T14:20:37.484Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*wYAcQi6-OihQ1S_R" /><figcaption>Photo by <a href="https://unsplash.com/@halacious?utm_source=medium&amp;utm_medium=referral">Hal Gatewood</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><h3>Unveiling SVGs</h3><p><a href="https://en.wikipedia.org/wiki/Scalable_Vector_Graphics">Scalable Vector Graphics</a>, commonly known as SVG, have been transforming the landscape of web design and front-end development. Their versatility and advantages over other image formats make them an indispensable asset in the digital world. As a resolution-independent format, SVG ensures high-quality images on any screen size, making it a preferred choice for modern web design. Additionally, its compatibility with <a href="https://en.wikipedia.org/wiki/HTML">HTML</a> and CSS empowers developers to create visually stunning and interactive web experiences. With its impact on web design and front-end development, SVG is redefining the way we perceive and utilize digital images.</p><h3>Advantages of SVG</h3><ul><li>Scalable Vector Graphics, commonly referred to as SVG, offer several distinct advantages over other image formats.</li><li>One of the primary benefits of SVG is its resolution independence, ensuring that images retain their high quality on any screen size.</li><li>Additionally, SVGs boast smaller file sizes when compared to raster images, resulting in faster load times for web pages.</li></ul><h3>Accessibility and SEO</h3><ul><li>SVGs play a crucial role in enhancing web accessibility as they are easily accessible to screen readers, making digital content more inclusive for users with disabilities.</li><li>Furthermore, search engines can effectively index SVG content, thereby contributing to improved SEO performance for websites.</li></ul><p>By leveraging the power of SVG in web development, developers can create visually stunning and interactive web experiences while ensuring high-quality images on any screen size. Additionally, SVGs contribute to faster load times, address performance issues, and enhance user experience. Their compatibility with HTML and CSS empowers developers to craft dynamic and engaging user interfaces, making them an indispensable asset in modern web design. <strong>SVGs:</strong> Revolutionizing web design with unparalleled flexibility and accessibility.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=4ead0a7d2aee" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Flutter Streams and Stream Builder.]]></title>
            <link>https://nethmindulsara.medium.com/flutter-streams-and-stream-builder-f267aa714673?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/f267aa714673</guid>
            <category><![CDATA[streambuilder]]></category>
            <category><![CDATA[dart]]></category>
            <category><![CDATA[flutter]]></category>
            <category><![CDATA[steam-controller]]></category>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Wed, 06 Apr 2022 22:35:02 GMT</pubDate>
            <atom:updated>2022-04-06T22:52:19.151Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fObAmfTR55a_m_Ph-IpYyA.png" /></figure><p>In this tutorial, I am going to discuss the stream concept of the Flutter (Dart). After referring to this, you can gain a better understanding of Streams and how to implement them in your future Flutter Projects.</p><p><strong>What is a stream?</strong></p><p>In simple, the stream is like a river that has two ends. Think you are at the top end of the river and your friend is at the other end of the river. From time to time you put paper boats in the river and on the other hand, your friend can collect boats, that you put into the river.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*neSma1k3AxDLij_suS-E1Q.png" /><figcaption>Stream example.</figcaption></figure><p>Your friend doesn’t know when the next boat arrives (Asynchronous). But he always looking for a boat(Listening). You can put boats anytime you want. (Sinking data)</p><p>In a similar manner, we can explain how the stream works in Flutter or Dart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SX-JsGXdrseoRs44idpC5g.png" /></figure><p>stream has two main concepts. Sink and Source.</p><ul><li><strong>Sink — </strong>where the put data into the stream.</li><li><strong>Stream — </strong>Where we listen to the stream.</li></ul><p><strong>Where the streams are used?</strong></p><p>Flutter user stream in various places.</p><ul><li>Listen to notifications.</li><li>work with real-time chat servers.</li><li>Build apps witch UI change continuously according to the data. (eg: Stock exchange application)</li><li>BLoC design pattern, that uses in a flutter as a state management tool. also uses the stream concept.</li></ul><p><strong>How to Implement</strong></p><p>In this section, you will learn how to create and listen to a Stream. I will show you how to build a simple Timer application using the stream concept in Flutter/Dart.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/600/1*AEvajMqvKvzVdreXtOAZ8w.gif" /><figcaption>final output</figcaption></figure><p>There are two main ways to implement Streams. we are going to use both methods to build our simple app.</p><ol><li>Using StreamController class.</li><li>using the <strong>yield</strong> keyword.</li></ol><p><strong>Using StreamController class</strong></p><p>This way is more customizable and has its own pros and cons. First, we create a simple stateful widget as<strong> <em>home.dart</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*rOGl_aMGO3fRwvM2ocbhHA.png" /></figure><p>then we create an instance of the <em>StreamController</em> class and by using this controller we’ll declare a function to add data to the stream. Finally, we start the stream by calling <em>increament</em> function inside the<em> initState</em> method.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LhWDu02VjCw9ZfSCtnv3bA.png" /></figure><p>Please remember, even though we create a stream manually. in real-world scenarios. we can use provided streams.</p><p><strong>StreamBuilder Widget</strong></p><p>Now our stream is ready. all we have to do is listen to the stream and re-build the UI accordingly. For that purpose, flutter gives a Builder widget called <strong><em>StreamBuilder</em></strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*qDpEpr4xBn-im8BY8DiKgQ.png" /><figcaption>Stream Builder</figcaption></figure><p>Streambuilder requires <strong><em>stream</em></strong> argument. so we provide our stream controller object for that. The next argument is <strong><em>builder, </em></strong>it requires a widget, that needs to be built<em>. </em><strong><em>snapshot</em> </strong>is a variable that includes data, coming from the stream.<em> </em>we use some <strong><em>if-else</em> </strong>conditions to build UI widgets accordingly.</p><ul><li><strong><em>snapshot.hasData — </em></strong>true, if snapshot has data.</li><li><strong><em>snapshot.hasError — </em></strong>true, when an error occured.</li><li><strong><em>snapshot.connectionState —</em></strong> show connection state like<strong><em> waiting.</em></strong></li></ul><p><em>Since the </em><strong><em>StreamBuilder </em></strong><em>way is very manual, we need to close the stream subscription manually before leaving it to the next screen. Otherwise, the Stream might run in the background of the application and caused to happen memory leaks in the application.So we call</em><strong>&lt;StreamController object name&gt;.close()</strong><em> method inside the </em><strong>dispose()</strong><em> method.</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Xdxwb1xo1GhKf7vcuBCWuw.png" /><figcaption>dispose method</figcaption></figure><p>Congratulations, you successfully completed the first way of using Flutter Streams. As well you have learned <strong><em>StreamBuilder widgets</em></strong> also. Here is the full code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*I6Ogd6Vr4BlKukFZEbwfGg.png" /></figure><p><strong>Using <em>yield</em> keyword.</strong></p><p>This way you don’t need to create StreamController. Use <strong><em>yield</em></strong> keyword instead.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*08BPpXU1PFgpTT8ei67nAg.png" /></figure><p>we modified our previous increment function with <strong><em>yield </em></strong>keyword. By using <strong><em>yield </em></strong>keyword, you can put data into the stream. But remember to use <strong><em>async* </em></strong>instead of <strong><em>async.</em></strong></p><p>since we don’t have a <strong><em>StreamController object,</em></strong> we put <strong><em>the increment method</em></strong> for the stream argument in the <strong><em>StreamBuilder widget.</em></strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*5AnCCGf5ENbWqmrPyZwFvQ.png" /></figure><p>This second way is much handier than our manual StreamController way. We don’t need to worry about closing the stream after using it. It’ll handle by the program itself.</p><p>But the second way is not much more customizable than the StreamController way.</p><p>However congratulations. You just completed the second part of the tutorial also.</p><p>Here is the full code.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MSwqWUQ2NWXG7PVY_4fEFA.png" /></figure><p><strong>Conclusion</strong></p><p>So let me summarize what we have learned so far.</p><ul><li>We use Streams when we need to listen to a continuous but asynchronous data flow.</li><li>Sink — end, put data to the stream.</li><li>Stream — end, listen to the data.</li><li>StreamController — by creating an instance of the class we can listen to the stream. But need to close the stream after using it.</li><li>yield and async* — handier way to handle streams.</li></ul><p>Github link for code: <a href="https://github.com/DulsaraNethmin/streams.git">https://github.com/DulsaraNethmin/streams.git</a></p><p>Thank you for reading.❤️</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f267aa714673" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[All about array methods-Java Script]]></title>
            <link>https://nethmindulsara.medium.com/all-about-array-methods-java-script-278153765dc8?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/278153765dc8</guid>
            <category><![CDATA[methods]]></category>
            <category><![CDATA[arrays]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 15:59:24 GMT</pubDate>
            <atom:updated>2021-02-23T15:59:24.317Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*sF9s4pBfgeKBz84N.jpeg" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*mdHcGyDdO954dOQIqV8GAg.png" /><figcaption>the-code-monk</figcaption></figure><p>You know how important arrays. here are all about essential java script array functions to you to learn.</p><p>Arrays are one of the most common things that you’re going to use as a programmer. So today I’m going to be covering a JavaScript array, methods that are going to make your coding life so much easier and more enjoyable. And also, these are really important to the guys, who is hoping to <br>learn web development frameworks like MERN or MEAN.</p><h3><strong>Filter method</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/de5ac78f2d57914fce37f98cc0dceaea/href">https://medium.com/media/de5ac78f2d57914fce37f98cc0dceaea/href</a></iframe><p>filter function takes one parameter, the function used to filter items. here I have used java script’s new arrow function as the function.</p><p>let’s say I have an array of 7 objects there includes price details about 7 items. I wanna filter this items array in order to get the items their prices are above 100 units.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/fa620980a1dc58dfe1a3537b73f8ed56/href">https://medium.com/media/fa620980a1dc58dfe1a3537b73f8ed56/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MpM-RCIDtVRwh_Mx92kEHA.png" /><figcaption>the result window</figcaption></figure><p>as you can see, filter function will create a new array of filtered items and does not change our old array.</p><h3><strong>Map method</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f66a58f0f6cdb9f6b45cfb6223c858d/href">https://medium.com/media/0f66a58f0f6cdb9f6b45cfb6223c858d/href</a></iframe><p>the method take one parameter, a function to map through the array. this map method is very useful, if you wanna run complex function through out a array and make a new one.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/a47f8e9a6837ca94695021f2d91f2cba/href">https://medium.com/media/a47f8e9a6837ca94695021f2d91f2cba/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*JQrPg-f5gsfN3CDlYjSn4Q.png" /><figcaption>result window</figcaption></figure><p>as in filter method section, here we use map method and make a new array by using properties of each object and does not change the old one.</p><h3><strong>forEach method</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ac36b84d4e4678fc9b387308bd37fc55/href">https://medium.com/media/ac36b84d4e4678fc9b387308bd37fc55/href</a></iframe><p>we can just say for each is going to work very similarly to a for loop, but it’s going to take a function here instead. And we have our first parameter and function, which is item just like before, and we could just print out the item name. So for every single item it’s going to do what’s inside of this function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5a5429776f3567e4350d813ecd5714df/href">https://medium.com/media/5a5429776f3567e4350d813ecd5714df/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bLScF8y-5F4ku1ocsgLhqw.png" /><figcaption>example for foreach function</figcaption></figure><h3><strong>some and every method</strong></h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8679c817f2b76afd4cdc15c7d7f5154d/href">https://medium.com/media/8679c817f2b76afd4cdc15c7d7f5154d/href</a></iframe><p>the some function, which is a bit different than most of our other functions since instead of returning a brand new array, it’s actually going to return, true or false. the every function is also pretty similar to some function. that will return true, only if every item make the condition true.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/f1924ee619c832cfea917600b1b9c1e4/href">https://medium.com/media/f1924ee619c832cfea917600b1b9c1e4/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*DLIE7kAMS7nH71FSfuWZZA.png" /><figcaption>example</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*Z11SRZ4AiDOTs8uvyBco8w.png" /></figure><p>remember these methods. witch are really useful when you dealing with MERN or MEAN stack to develop a web app.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=278153765dc8" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[7 Thing you should know as a web developer]]></title>
            <link>https://nethmindulsara.medium.com/7-thing-you-should-know-as-a-web-developer-aac7b0d19b2?source=rss-35d52eeecd7c------2</link>
            <guid isPermaLink="false">https://medium.com/p/aac7b0d19b2</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[full-stack-developer]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[curd]]></category>
            <category><![CDATA[javascript]]></category>
            <dc:creator><![CDATA[Nethmin Dulsara]]></dc:creator>
            <pubDate>Tue, 23 Feb 2021 11:02:39 GMT</pubDate>
            <atom:updated>2022-04-07T17:14:57.095Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iIPUXfe2A2-Drl-PuUUg3w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*07uxCLuZmWhZZckzr2Z_fQ.png" /></figure><p>Please monk help me, what are the best abilities should I learn to become a good web developer…?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*Z11SRZ4AiDOTs8uvyBco8w.png" /><figcaption>The codeMONK</figcaption></figure><p>ok. read this, you could find-out all your answers…</p><h3><strong>1) Fundamentals of HTML CSS and JAVA SCRIPT</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/474/0*xHPt5-8yuM71CMdv" /></figure><p>For anyone who, interested in Web development it is essential to know basics of HTML CSS and Java scripts. so, before dive in deep you should learn basics of HTML 5(THE newer version) , some CSS stylings and Java Script. HTML will design skeleton of your web project then CSS gives flesh and blood to your child and finally adding some JS, will make your child alive.</p><p>But I’m not saying you to learn all the stuff inside three of them. But it is important to be very good at Java Script other than rest of two. Because making a dynamic web project is really important — most of the projects’ front-end and back-end are currently base on java script libraries.</p><h3><strong>2)GIT and GitHub</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*bl_BIzHanmb9Y1tN.jpeg" /></figure><p>May be you would surprise, is it important to know git and github, without Git and GitHub can’t I become a Web developer…?</p><p>answer: Git is a version control system-one of the most popular version control system. GitHub is a service of Git. when your are seeking a job in a it company, you should definitely have a knowledge of git and github. cloning / pushing to repositories/ making pull request /margin branches like that thing you will learn when you are learning GIT. Learning git and github will make your job very easy. It basically keeps track on your works and changes, host your files. so, learn git.</p><h3><strong>3)Browser dev tools</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/856/0*Df9yxmNQgyf_xNVU.png" /></figure><p>browser dev tool is other really cool thing you should learn as a developer. this’s a lot where you can do with your dev tool.</p><p>Element tab: here you can edit your HTML and CSS elements. see graphical view of your elements and lot a thing.</p><p>Console tab: here you can test your java scripts of your page. Track your java script errors and warnings.</p><p>Network tab: very important. it basically shows all the response and requests, status code executing time and many more. so it is very important to know Network tab as a developer.</p><p>Application tab: it has your cash storage, cookies, service workers , browser base local storage</p><h3><strong>4)Building REST API and CURD App</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*lJObP11ws0ZqxPV0" /></figure><p>Next one is rest API and dealing with crud, which is create, read, update and delete. So instead of just<br>consuming the API, now you’re building it and usually you’re going to work with some kind of database. So you<br>need to learn how to connect to a database, how to make queries, get data, how to insert data into the database.<br>And this could be a rest API. Basically you need to know How to connect an application to a database, and it could be MongoDB, MySQL or any other.<br>I’m not really specifying, you know, any any certain framework language database that’s up to you. But these are<br>just some generalized things that you need to do and need to learn.</p><h3><strong>5)Understanding about MVC</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*kQd053R5Wdh8mTKO" /></figure><p>If you understand MVC, it’s really easy to understand different iterations of it.So, the model is,your database interactions. So when you query data or you insert data into the<br>database, that’s usually the model logic. Then you have the view, which is just that. It’s what the user sees. It could<br>be a server rendered template. It could be something like react a lot of the time. A lot of times you’ll hear that<br>react Is the V in MVC, which is pretty much the same for any front end library or framework controller as like the<br>the director of an all or the traffic controller where it takes a request and then decides what to do,get some data, load the view, load some data within the view. So it kind of controls that through whatever<br>route is hit. So MVC is an important step, an important thing to learn in full stack developer or a web developer.</p><h3><strong>6)Problem Solving and Searching</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*4hU8k3NetG7YG1ye.jpg" /></figure><p>If you become a developer, you probably have some natural problem solving skills.<br>It’s important to to to build on that through projects, through algorithms, challenges, stuff like that searching. You’re always going to be searching for stuff. Don’t worry to search sometimes for the exact syntax. And then, of course, you’re going to get strange errors and error codes that you need to look up. So, you know, Google and Stack Overflow are going to be two of your best friends if you’re a developer. — just google it :)</p><h3><strong>7) Writing test</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*07uxCLuZmWhZZckzr2Z_fQ.png" /></figure><p>Ooh no, is it really important..?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*Z11SRZ4AiDOTs8uvyBco8w.png" /><figcaption>The codeMONK</figcaption></figure><p>They are useless for small applications. You really don’t need to do this. But when you’re building a large production application, it’s it’s nice to have unit tests and other types of tests<br>because it just helps make your whole process more robust. Your debugging is easier. It saves problems in the long run. And it might seem like a waste of time at first, but it can actually save you time in the long run. So definitely<br>something you want to look into.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/65/1*07uxCLuZmWhZZckzr2Z_fQ.png" /></figure><p>Mmmm… I think i got my answers &lt;codeMONK&gt;</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=aac7b0d19b2" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>