<?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 Aditya Chandra on Medium]]></title>
        <description><![CDATA[Stories by Aditya Chandra on Medium]]></description>
        <link>https://medium.com/@addeeandra?source=rss-f2b6ccf668c3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*-_fokCWtxTqMrS6FWM4oog.png</url>
            <title>Stories by Aditya Chandra on Medium</title>
            <link>https://medium.com/@addeeandra?source=rss-f2b6ccf668c3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 05 Dec 2026 15:58:00 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@addeeandra/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[The struggle when deploying software and collaborate with our team; This is how we wrap it up with…]]></title>
            <link>https://medium.com/@addeeandra/the-struggle-when-deploying-software-and-collaborate-with-our-team-this-is-how-we-wrap-it-up-with-e752fd783ba3?source=rss-f2b6ccf668c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e752fd783ba3</guid>
            <category><![CDATA[laravel]]></category>
            <category><![CDATA[linux]]></category>
            <category><![CDATA[docker-compose]]></category>
            <category><![CDATA[web-development]]></category>
            <category><![CDATA[docker]]></category>
            <dc:creator><![CDATA[Aditya Chandra]]></dc:creator>
            <pubDate>Tue, 14 Jun 2022 10:13:35 GMT</pubDate>
            <atom:updated>2022-06-14T10:22:24.708Z</atom:updated>
            <content:encoded><![CDATA[<h3>The struggle when deploying software and collaborate with our team; This is how we wrap it up with <strong>Docker</strong>.</h3><p>We were so done getting errors on server while deploying our work. Here is how we wrap our Laravel Project with Docker and make our team happier and onboard faster.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*QnfFJqSWeKuYqsTt" /></figure><p>Based on our experience when building small-mid software; our top 3 most challenging problems that <strong>often occur but trivial to notice</strong> within our team are :</p><ol><li>The hand-over,<strong> </strong>and teach your team how to <strong>run the project, might take for a week </strong>— or two? 😢 — We didn’t notice it, but it wasting time! We think it should be done 2–3 days at most in small-medium projects.</li><li><strong>The fear of touching Legacy Software</strong> because we think it’s so fragile — and could break anytime. We scare to touch it, make change on it, and even struggle to run the project 😫</li><li><strong>The overthink and overdoing stuffs </strong>on server because a lot of setup and multiple environment to be configured (e.g. a project with php5, another with php7 and another with the latest version) — it’s also happen in our team member environment — and we didn’t talk about monitoring stuffs, yet. 😿</li></ol><p>Then we ask ourself :</p><ol><li>Can we have the <strong>same development environment</strong> with others without a lot of setup?</li><li>Can we have the <strong>same environment also on server</strong> without a lot of configuration needed?</li><li>Can we develop and run project with <strong>a single-line command</strong> to up?</li></ol><p>We decided to take the “Yes” answer for all questions.</p><h4>Understanding our existing-environment</h4><p>First and foremost, we need to understand what we dealing with. What we want is to make our environment into a <strong>Re-usable Docker</strong> setup, and we don’t want it to be messy around and make us a hard time, again.</p><p>What we really need to pay attention to is <strong>how the current and existing environment running</strong>, so we take <strong>simplest environment</strong> and got the visual like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/738/1*SjO89NBGvY4XPdmfPX9Efw.png" /><figcaption>Illustration of current &amp; existing environment (without npm, redis, web-socket etc)</figcaption></figure><ol><li>We need a <strong>gateway </strong>(nginx) and <strong>site.conf</strong> to the project path</li><li>We need our <strong>project to be placed</strong> correctly on it path (/var/www)</li><li>We need a <strong>database </strong>(postgreSQL)</li></ol><p>Then we simplify the visual into more practical and efficient way as containers :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/442/1*LfwDA4jt4ZDR4eg2tb96kg.png" /><figcaption>Illustration of target containers architecture would like.</figcaption></figure><p>Yes, it’s only need two (2) containers to run the project itself. So then we decide to build our own image :</p><ul><li>Called <a href="https://github.com/digital-entropy/dokar-php">dokar-php</a> using <a href="https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-container-registry#pushing-container-images">Github Container Registry</a></li><li>Being auto-registered and pushed to GHCR using <a href="https://github.com/aevea/action-kaniko">Github Action</a></li></ul><p>So we might build Docker Image from our repository and pull it out as Docker Image in our computer or servers.</p><h4>Decide what image and how it to be built</h4><p>We decide to build some Containers with our own Image, and another with existing Image from <a href="https://hub.docker.com/">Docker Hub</a>.</p><ul><li>Core → our own image composer + php-cli + php-fpm+ nginx)</li><li>Database → use existing from Docker Hub (Postgres or Timescale)</li></ul><p>For visualization of our <strong>build pipeline</strong> is to be shown below :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/700/1*UvcH5rNVzVZCIaP8UOR5Bw.png" /><figcaption>Docker Image &amp; Compose Pipeline</figcaption></figure><p>So we decide to build the <em>php-cli</em>, <em>php-fpm</em> and <em>nginx </em>as below :</p><ol><li>php-cli; We decide to build our own <strong>php-cli Image </strong>from <a href="https://hub.docker.com/_/ubuntu">ubuntu:focal (20.04)</a>. The Dockerfile can be seen <a href="https://github.com/digital-entropy/dokar-php/blob/7.1/cli/Dockerfile">here</a>. We install basic utility such us apt-utils, git and php extensions. We also install <a href="https://getcomposer.org/">composer</a> in this build.</li><li>php-fpm; We decide to add <strong>php-fpm Image </strong>as we might need to use php with Nginx. We might be able to combine php-fpm with Nginx Image (as shown above), but we wanted to make it clean. We also override some configurations also. The Dockerfile can be seen <a href="https://github.com/digital-entropy/dokar-php/tree/7.1/fpm">here</a>.</li><li>nginx; We decide to make our own <strong>Nginx Image </strong>because we want to install <a href="http://supervisord.org/">supervisor</a> as our common tools. In this image we override Nginx and Supervisor configuration. The Dockerfile can be seen <a href="https://github.com/digital-entropy/dokar-php/tree/7.1/nginx">here</a>.</li></ol><h4>Compose and Running the Project</h4><p>We already had the simplest image we need (<em>nginx with php</em>). Now we should create our image into existence, how?</p><p>Let’s say we run a new project :</p><blockquote>composer create-project laravel/laravel my-project</blockquote><ol><li><strong>Get into the my-project folder</strong></li><li>Create <strong>docker-compose.yml</strong> in the project with <a href="https://gist.github.com/addeeandra/281c5b607ddbb3a2f8477c87ad9edadf">this content</a>.</li><li>Based on that docker-compose, you also need to <strong>add DOCKER_PORT in .env file</strong>, you can see the example <a href="https://gist.github.com/addeeandra/281c5b607ddbb3a2f8477c87ad9edadf">there</a>.</li><li>Run <strong>docker-compose up -d</strong></li><li>You up!</li></ol><p>Open your site in browser at <a href="http://127.0.0.1:8888/">http://localhost:8888</a> you’ll see Laravel welcome page.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iL6k3VSKaOOMcOLnOkMu6Q.png" /></figure><p>To <strong>run command such us artisan or composer</strong> in container. Firstly, try to run <strong>docker-compose ps </strong>and you will see something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/747/1*bnJY0DzRuq7e7v5GgFzGig.png" /></figure><p>You’ll need that <strong>NAME </strong>on the left for the <strong>core</strong> container.</p><p>Then run <strong>docker exec -it my-project-core-1 php artisan</strong></p><p>Then to run composer try <strong>docker exec -it my-project-core-1 composer -v</strong></p><p>Yay! When you need to hand-over the project, you just need :</p><ol><li>Install docker and docker-compose</li><li>Get into the project and run <strong>docker-compose up </strong>— you done!</li><li>Lastly, run <strong>composer install</strong> etc.</li></ol><h4>The command to long!</h4><p>Yes, we know that typing <strong>docker exec -it my-project-core-1 {command}</strong> is exhausting, so we made some shortcut for it that we called <strong>./nge</strong> command.</p><p>The file can be seen <a href="https://gist.github.com/addeeandra/281c5b607ddbb3a2f8477c87ad9edadf">here</a>. It should be placed on your project folder with exec permission: <strong>chmod +x nge</strong></p><p>Then you might run something like this :</p><p>./nge up</p><p>./nge restart</p><p>./nge composer</p><p>./nge artisan</p><p>Which you might look any other commands in the file.</p><h4>Let’s wrap it up.</h4><ol><li>For the team; Run the project by running <strong>./nge up</strong> — then install all needed dependencies using <strong>./nge composer</strong>, done, you might access the website in localhost with your preferred DOCKER_PORT.</li><li>Legacy Software? <em>Meh</em>. It’s easy, we don’t need to install multiple PHP versions on our computer. We need Docker only. Let the docker-compose do it. Just run <strong>./nge up</strong> and it fine, even with different PHP versions for each project.</li><li>Server? Well, at least we don’t need to install multiple environments also! We just need to <strong>setup proxy_pass</strong> to directly forward access into our container port (e.g mydomain.example.com → 8080).</li></ol><h4>Summary</h4><p>Setting up and onboarding web project within team might needs time, we effectively make it faster by using this approach. Well, at least we <strong>successfully reduce the “environment” problem</strong> about 1–2 weeks (or that appear suddenly) into 2–3 days only without sudden problem.</p><p><strong>Legacy software is not the fear anymore</strong>, we could upgrade the legacy into modern architecture better now, slowly but surely, with this approach. We increase the confidence within the team, which make the team more productive and effective to work on a project.</p><p><strong>Server setup might need some tweaking for security</strong>, but this approach “okay” for small project we had. We still had a lot to improve in the future. It’s considerably simple to use for now, let’s see what improvements we might brings.</p><p><strong>Not only for specific Laravel version</strong>, we successfully running Laravel 5 to 9 with this Docker Environment. I would like to write another article on how we setup a project with Redis, Horizon, NPM and Web Socket in the future.</p><p>This article written to share our practical step-by-step approach to Containerize our development and server environment for small-projects within our company, <a href="https://github.com/digital-entropy">DEV (Digital Entropy Venture)</a>. You might had similar case to Containerize your project even though isn’t a Laravel one, I hope this content helpful to you.</p><p>Please share if you think it’s useful.</p><p>Thank you for reading!</p><p>—</p><p>Also thanks to <a href="https://medium.com/u/b6210216a8">Muhajirin Ilyas</a> that contribute a lot in this project ;)</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e752fd783ba3" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Use ViewStub to Lazy Load and Make your Users Happy.]]></title>
            <link>https://towardsdev.com/use-viewstub-to-lazy-load-and-make-your-users-happy-e7916ccd240?source=rss-f2b6ccf668c3------2</link>
            <guid isPermaLink="false">https://medium.com/p/e7916ccd240</guid>
            <category><![CDATA[kotlin]]></category>
            <category><![CDATA[lazy-loading]]></category>
            <category><![CDATA[landing-page-optimization]]></category>
            <category><![CDATA[dashboard]]></category>
            <category><![CDATA[android]]></category>
            <dc:creator><![CDATA[Aditya Chandra]]></dc:creator>
            <pubDate>Sun, 13 Mar 2022 11:19:12 GMT</pubDate>
            <atom:updated>2022-03-17T07:55:30.441Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/800/0*qYJ9QvB-432INlnU.png" /><figcaption><a href="https://dribbble.com/shots/3293651-B2B-application-KPI-view">B2B application KPI view by Sam on Dribbble</a></figcaption></figure><p>A landing page or “that page” that has a long-scrolling heavy-content (not a list) generally had soooo bad loading behavior that could stagger the UI and make users sad. I learned a ‘pretty good’ way to make them happy.</p><p>—</p><p>Let’s first understand what our problems are :</p><ul><li>We had that single page with multiple ‘sections’</li><li>We had that sections with multiple ‘contents’</li><li>We need to scroll 2–4 times or more to end this page</li><li>If there’s 6 sections — <em>e.g. sales numbers, inventories information, statistics, popular x, popular y </em>— within this page, then we need to fetch 6 difference API’s simultaneously.</li><li>If there’s multi API <em>fetching</em>, then we’ll simultaneously <strong>render</strong> the UI that might resulted on ‘staggered’ and <em>laggy</em> UI and make our users unhappy.</li><li><strong>We might end up to ‘block’ the users </strong>from any interactions for some seconds to cover up that unhappy UI rendering.</li></ul><p>This illustrate what that problematic page is like,</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KmycWU3tHgIaLUr2IMJD2A.png" /><figcaption>illustration for a single page with multi-sections that load multi-endpoint.</figcaption></figure><p>Then let’s understand what <strong>ViewStub </strong>is :</p><blockquote>A <strong>ViewStub </strong>is an invisible, zero-sized View that can be used to lazily inflate layout resources at runtime.</blockquote><blockquote>When a ViewStub is made visible, or when <a href="https://developer.android.com/reference/android/view/ViewStub#inflate()">inflate()</a> is invoked, the layout resource is inflated. The ViewStub then replaces itself in its parent with the inflated View or Views.</blockquote><blockquote>Therefore, the ViewStub exists in the view hierarchy until <a href="https://developer.android.com/reference/android/view/ViewStub#setVisibility(int)">setVisibility(int)</a> or <a href="https://developer.android.com/reference/android/view/ViewStub#inflate()">inflate()</a> is invoked. The inflated View is added to the ViewStub&#39;s parent with the ViewStub&#39;s layout parameters.</blockquote><p>—</p><p>It’s pretty interesting, <strong>we don’t need to manually ‘inflate’.</strong></p><p>The key point is, that behavior <strong>to ‘inflate’ then replace the parent </strong>has been provided be <strong>ViewStub</strong>.</p><h4>But remember.</h4><p><strong>ViewStub </strong>will <strong>not automatically </strong>inflate,<strong> </strong>we need to provide <strong>when</strong> the <strong>ViewStub </strong>should inflate the layout. The <strong>OnInflateListener</strong> would be helpful to us.</p><h4>So, what we wants are :</h4><ul><li>A view <strong>being inflated</strong> when the user <strong>scroll to it’s position</strong></li><li>An API <strong>being fetched</strong> when the user <strong>scroll to it’s position</strong></li><li>View or API wouldn’t be inflated nor fetched when the user <strong>not scrolling to it’s position.</strong></li></ul><p>—</p><p>Then I came up with this code based on above behavior :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/ad89dfd78a5808b338d29faa5f796c9e/href">https://medium.com/media/ad89dfd78a5808b338d29faa5f796c9e/href</a></iframe><p>We saw at line 23, if the <strong>diff </strong>is ≤ 0 then we inflate the stub, else we wouldn’t inflate anything. Then after being inflated, the we just need to skip the calculation (line 16) or <em>remove the listener</em>.</p><h4>Why I added a wrapper?</h4><p>We can’t detect <strong>ViewStub </strong>top or bottom position without a <strong>wrapper </strong>(in this case I used a <strong>FrameLayout</strong>).</p><blockquote>Because <strong>ViewStub </strong>default visibility is GONE. We wouldn’t be able to get position of a View with GONE visibility.</blockquote><h3>So, how to use it?</h3><p>To illustrate, example of our <strong>XML layout files wi</strong>ll be like :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WONdhANZljyp8axG2zxQOA.png" /></figure><p>What is within the <strong>activity_dashboard</strong>, it’s like this :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*O73D6Le__F7naKTvSmK0xg.png" /></figure><p>Then, to illustrate which <strong>layout </strong>for which <strong>ViewStub</strong> we might use :</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*eRsCgjsNlh-4jvyXCaOTDg.png" /></figure><p>At the end, we should end up to the Activity / Fragment code like this :</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/910da2d8f72bf6af8833cf16053dcb14/href">https://medium.com/media/910da2d8f72bf6af8833cf16053dcb14/href</a></iframe><p>Above code illustrate the use of <strong>ViewModel </strong>(passed from Activity / Fragment) and use of <strong>ViewBinding</strong>, so we could handle what should happens with the inflated layout / view at single <strong>ViewModel</strong>.</p><p>We also <strong>lazily </strong>fetching the data <strong>when stub wrapper </strong>is visible on scroll.</p><blockquote>This might be able to be improved at some point, but it’s pretty good to me for now.</blockquote><p>Thanks for reading! 😃</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=e7916ccd240" width="1" height="1" alt=""><hr><p><a href="https://towardsdev.com/use-viewstub-to-lazy-load-and-make-your-users-happy-e7916ccd240">Use ViewStub to Lazy Load and Make your Users Happy.</a> was originally published in <a href="https://towardsdev.com/">Towards Dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>