<?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 Guneet Singh on Medium]]></title>
        <description><![CDATA[Stories by Guneet Singh on Medium]]></description>
        <link>https://medium.com/@guneetgstar?source=rss-f0e5da66d9bc------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*x7OecgtGybTZJy9X.jpg</url>
            <title>Stories by Guneet Singh on Medium</title>
            <link>https://medium.com/@guneetgstar?source=rss-f0e5da66d9bc------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 19 Nov 2026 19:01:26 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@guneetgstar/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[How to run Spring Boot Applications on IntelliJ IDEA For Free?]]></title>
            <link>https://guneetgstar.medium.com/how-to-run-spring-boot-applications-on-intellij-idea-for-free-381a2661d409?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/381a2661d409</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[spring-boot]]></category>
            <category><![CDATA[intelli]]></category>
            <category><![CDATA[jetbrains]]></category>
            <category><![CDATA[spring]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Sun, 13 Aug 2023 11:40:47 GMT</pubDate>
            <atom:updated>2023-08-13T11:40:47.332Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*KlkuzGtJHxmt8hYw.png" /></figure><p>It’s an integral part of a developer&#39;s journey to be a tech enthusiast to use the best tools available at their disposal to increase their productivity by simplifying tasks which allows more time for things that require their attention (e.g. quality code, architecture, logic building, etc.). And for all the folks reading this who have been using Android Studio (like me) which is based on JetBrains closed-source IntelliJ IDEA Community Edition IDE, you know how it can simplify the developer’s life.</p><p>Honestly, there is none other in comparison to InteliJ especially if you are writing in JAVA/Kotlin. In case you ain’t aware, <a href="https://www.jetbrains.com/products/">JetBrains</a> who is the creator of <a href="https://www.jetbrains.com/idea/">IntelliJ</a>, <a href="https://www.jetbrains.com/teamcity/">TeamCity</a>, <a href="https://www.jetbrains.com/youtrack/">YouTrack</a> and many robust and best-performing software development tools (which you also must give a try) is also the creator of <a href="https://kotlinlang.org/">Kotlin</a>. Hence, you get the First class support for development on Kotlin (for a comparison of Java and Kotlin refer <a href="https://medium.com/@guneetgstar/everything-wrong-with-kotlin-java-vs-kotlin-a8953a36cff7">here</a>), you get the capability to automatically add Kotlin to your project with the snap of a few clicks, you can convert your existing Java code to Kotlin, and you can add plugins to add more features at your convenience from its vast repository of plugins.</p><p>Recently, I stuck to using a Hardened Laptop which only offers the community version of IntelliJ as the preinstalled IDE and I had to run Spring Boot Application for testing and debugging. Although the IntelliJ IDEA Ultimate version offers First class support to Spring Applications this is not the case with the Community Edition so let’s see how we can integrate it. For the rest of the article, IntelliJ refers to the Community Edition version only.</p><h3>Steps to run Spring Boot Application in IntelliJ</h3><ol><li>Open the Spring Boot project in IntelliJ. IntelliJ will automatically identify the pom.xml or build.gradle file in your project and start resolving the dependencies.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*fI7Bkwxz41a_Oop50JXYZQ.png" /></figure><p>2. Once the dependencies are loaded successfully, go to the <em>Edit Configurations…</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*iafPOchZU5Htws1_X22Uzw.png" /></figure><p>3. From the configurations dialog box, select <em>Add new.. </em>then select <em>Application. </em>A new Java Application configuration will be created.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*R50z5jfKgryIEHAjc0GMTA.png" /></figure><p>4. In the created configuration, give a name and Enter/Select the class name of the main class of your Spring Boot Application and click ok.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B8VKOE_KOGb9Ehu8lEMEfA.png" /></figure><p>5. Once this is done, you will start seeing the Run/Debug option for your application similar to how it appears in the IntelliJ ultimate version.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*B20QnNqFfKp-BRZFrErH2Q.png" /></figure><p>That’s all! Now you are good to run, debug and test your Spring Boot Applications in IntelliJ. Thanks for Reading. Give it a clap if it was helpful.</p><blockquote>References:</blockquote><ul><li><a href="https://guneetgstar.medium.com/everything-wrong-with-kotlin-java-vs-kotlin-a8953a36cff7">Everything wrong with Kotlin | Java vs Kotlin</a></li><li><a href="https://www.jetbrains.com/products/">All Developer Tools and Products by JetBrains</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=381a2661d409" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jenkins for Android: Deploying to Firebase, Play Console]]></title>
            <link>https://guneetgstar.medium.com/jenkins-for-android-deploying-to-firebase-play-console-12f70e9a5007?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/12f70e9a5007</guid>
            <category><![CDATA[android]]></category>
            <category><![CDATA[google-play]]></category>
            <category><![CDATA[firebase]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Wed, 29 Jun 2022 15:50:04 GMT</pubDate>
            <atom:updated>2022-06-29T15:50:04.795Z</atom:updated>
            <content:encoded><![CDATA[<p>In the previous articles, I explained <a href="https://guneetgstar.medium.com/introduction-to-ci-cd-and-its-tools-f079ab8f4627"><strong>Introduction to CI/CD and its tools</strong></a><strong> </strong>and<strong> </strong><a href="https://guneetgstar.medium.com/jenkins-introduction-setup-22cb341f1935"><strong>Jenkins: Introduction &amp; Setup</strong></a>. Now, we will see how we can deploy to Firebase App Distribution and Google PlayStore Console.</p><p>There is a very nice article on how to distribute your app to <strong>Firebase App Distribution</strong> so I won’t duplicate the content here but rather share the link to it. Please check it out.</p><p><a href="https://medium.com/velos/setting-up-firebase-app-distribution-with-automatic-builds-from-jenkins-2587028e2a3a">Setting up Firebase App Distribution With Automatic Builds from Jenkins</a></p><p>Now moving to the next part, <strong>distributing to Play Store</strong> we have to set up our Google Play developer Account first. To publish or manage your app on the play store, Google provides a specific <a href="https://developers.google.com/android-publisher/api-ref/rest/?apix=true">API</a>. To access the said API first, we have to <strong>Link the developer console to a Google Cloud Project</strong>. To do so, you have to be the owner of the Developer Account (only the one who created the account has the said access).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1jcn6Z8ep3R3LX24xOxS0Q.png" /></figure><p>As you can see, you can either link an existing Google Cloud Project or create a new one via the developer console itself.</p><p>After this step you will the below screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*LVmmGQmp3TOb31re.png" /></figure><p>Next, we need to <strong>create a service account</strong> as we did for the <a href="https://medium.com/velos/setting-up-firebase-app-distribution-with-automatic-builds-from-jenkins-2587028e2a3a">Firebase</a> with the appropriate permissions. Here you can add developer’s email ids that may have access to this service account or those who can make changes to the service account (e.g. changing permissions, adding/deleting users etc.). Please note that this service account can only be created by the owner of the Google Play Developer Account or Google cloud project (as both will be the same) i.e. the one who created the account else you have to share your google cloud project with the developers via the same service account we are creating or giving them access via IAM. You can goto the service account section of the google cloud by visiting the following :</p><pre>https://console.cloud.google.com/iam-admin/serviceaccounts?orgonly=true&amp;project=&lt;your Google Play Console Developer project id&gt;&amp;supportedpurview=organizationId</pre><p>You will see something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*blrpQ-zrffzlDb415FTn-g.png" /></figure><p>Don’t forget to create and download the service key as will use it at the end of this story. Once you have created the service account the same will start appearing as in the list below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TBiPF24A_TmFMAj4q5_dKw.png" /></figure><p>You will also have to grant access in your developer console to the service account created like <a href="https://medium.com/@josealfonsomora/publishing-android-apps-with-github-actions-3cb9a90396ca">this</a>. Here you just simply add the created service accounts to the <strong>Users and permissions</strong> page of your developer console and grant access to the apps the said service account can make changes to.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*MCu-LsaFahLte2SIlvVGgA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bCCBRmFEM8W-aFMhVXFPHQ.png" /></figure><p>Here you can manage the operations service account can perform e.g. limiting access only to the testing channel.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EcUQbeDAgUTBhx3nAicsAA.png" /></figure><p>Next, you will also need to enable the Google Play Android Developer API from <a href="https://console.cloud.google.com/apis/library/androidpublisher.googleapis.com">here</a> in order to consume it.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*XxVb6enOTn9E8Ce5nsTTAg.png" /></figure><p>The last part is to use the API. We will use <a href="https://github.com/Triple-T/gradle-play-publisher"><strong>Gradle Play Publisher</strong></a> for this. For a POC configuration, all you need is to add the plugin in both the app and the project level build.gradle file and the service account key we will use as an environment variable (later). The default channel for deployment that GPP will use is <a href="https://github.com/Triple-T/gradle-play-publisher#common-configuration">internal</a>.</p><pre>// build.gradle (project level)<br>plugins <strong>{<br>    </strong>id &#39;com.android.application&#39; version &#39;7.2.0&#39; apply false<br>    id &#39;com.android.library&#39; version &#39;7.2.0&#39; apply false<br>    id &#39;org.jetbrains.kotlin.android&#39; version &#39;1.6.10&#39; apply false<br>    id &#39;com.github.triplet.play&#39; version &#39;3.7.0&#39; apply false<br><strong>}<br></strong>// build.gradle (app level)<strong><br></strong>plugins {<br>    id &#39;com.android.application&#39;<br>    id &#39;org.jetbrains.kotlin.android&#39;<br>    id &#39;com.github.triplet.play&#39;<br>}</pre><blockquote>Before you can start deployments through pipelining you have at least one build uploaded manually else it will complain that the <a href="https://github.com/r0adkll/upload-google-play/issues/60">package not found</a>.</blockquote><p>Moving to the Jenkins, all we need is to add a new stage to the existing pipeline like the below:</p><pre>pipeline {<br>  agent any <br>//.... other stages<br>stage(&#39;Deploy on Playstore&#39;) {<br>   environment {<br>      <strong><em>ANDROID_PUBLISHER_CREDENTIALS</em></strong><em> </em>= &quot;&quot;&quot;${sh(<br>      returnStdout: true,<br>      script: &#39;cat /path/to/serviceAccount/key.json&#39;<br>      )}&quot;&quot;&quot;<br>  }<br>  steps {<br>    sh &#39;&#39;&#39;./gradlew publishBundle&#39;&#39;&#39;<br>  }<br>//...<br>}</pre><p>Note that <strong>ANDROID_PUBLISHER_CREDENTIALS </strong>is taking a JSON object (i.e. the contents of the JSON file) not the path of the file.</p><p>I am dropping the <strong>repo</strong> below to recreate the project. Use the main branch for the P<strong>lay Console</strong> example code and the development branch for the F<strong>irebase App Distribution</strong> example. I hope you enjoyed it.</p><p><a href="https://github.com/Guneetgstar/android-example-cicd">GitHub - Guneetgstar/android-example-cicd</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=12f70e9a5007" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Jenkins: Introduction & Setup]]></title>
            <link>https://blog.devops.dev/jenkins-introduction-setup-22cb341f1935?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/22cb341f1935</guid>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[ci]]></category>
            <category><![CDATA[cicd]]></category>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[devops]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Wed, 29 Jun 2022 11:15:14 GMT</pubDate>
            <atom:updated>2022-07-11T10:42:12.111Z</atom:updated>
            <content:encoded><![CDATA[<p>Jenkins is among the top choice due to its open-source code, and its general acceptability to integrate with external services (e.g. GitLab, GitHub, etc.).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IpQghLbH-nVJnm1lBBGmIA.jpeg" /></figure><h3>But isn’t Jenkins just a CI tool?</h3><p>For most people, there is a hoax in their mind that CI and CD are two different processes and hence have specific tools for them. Certainly, they are two different tasks but the real answer lies in what you want to achieve with your setup. For some, only the CI can perform the CD part if the requirement is only limited to building and distributing the bundles but for others, monitoring after deployment is more critical (e.g. monitoring app crashes in the live environment) and hence require more advanced CD tools to enhance their SDLC.</p><h3>Installing Jenkins</h3><p>In my experience, most of the time I spent on Jenkins was its installation as I did not find it very straight forward which is also the motivation to write this article to make it straight forward.</p><p><strong>Requirements:</strong> <strong>Java 8 </strong>or<strong> 11</strong>. Jenkins uses <strong>JAVA_HOME</strong> variable as the path of you Java installation.</p><p>Although <a href="https://www.jenkins.io/doc/book/installing/">Jenkins provides setup for almost all the OS</a>, the only advantage of it is that in addition to Jenkins it intalls a demon service that runs automatically at startup.</p><p>The good news is that Jenkins is written in Java and can be downloaded as <a href="https://www.jenkins.io/download/">WAR file</a> wich can be used to run Jenkins in a platform independent manner.</p><p><strong>Steps to install Jenkins:</strong></p><ol><li>Download <a href="https://get.jenkins.io/war-stable/2.346.1/jenkins.war">jenkins.war</a> file.</li><li>Run the below command to start Jenkins:</li></ol><pre>java -Dmail.smtp.starttls.enable=true -Dhudson.plugins.git.GitSCM.ALLOW_LOCAL_CHECKOUT=true -jar jenkins.war -httpListenAddress=127.0.0.1 — httpPort=8080</pre><p>4. Go to <a href="http://127.0.0.1:8080/">http://127.0.0.1:8080/</a> or <a href="http://127.0.0.1:8080/">http://localhost:8080/</a>. It will take some to load the below screen:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/990/0*UnxJJaO8Db06RP6-.jpg" /></figure><p>4. On the first run you will find a key in the logs just like the below screenshot:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*5be5Kx_3eDJSGcUW.png" /></figure><p>Copy the key and paste it in the text box from step 3.</p><p>5. Now that you have unlocked Jenkins, it will ask you to install recommended plugins. Jenkins plugin are used to simplify tasks for various use cases. You can Select no plugin or recommended plugin and manage them later in <strong>Manage Jenkins</strong> &gt; <strong>Manage Plugins</strong> page in Jenkins.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/926/0*b3EmAmTDXBdTHLHy.png" /></figure><p>7. Finally, Jenkins asks you to <strong>Create First Admin User</strong>. Enter the details for your administrator user in the respective fields and click <strong>Save and Finish</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/652/0*nIKLfQlKRxTCJvnn.png" /></figure><p>8. When the <strong>Jenkins is ready</strong> page appears, click <strong>Start using Jenkins</strong>.</p><blockquote>This page may indicate <strong>Jenkins is almost ready!</strong> instead and if so, click <strong>Restart</strong>.</blockquote><blockquote>If the page does not automatically refresh after a minute, use your web browser to refresh the page manually.</blockquote><blockquote>If required, log in to Jenkins with the credentials of the user you just created and you are ready to start using Jenkins!</blockquote><p><em>Viola! You have entered the world of automation.</em></p><h3>Initialize your first Jenkins Pipeline</h3><p>Now the set up is complete, you can install the <a href="https://plugins.jenkins.io/blueocean">Blue Ocean</a> Plugin for Jenkins for the ease of creating pipeline using a User Interface in <strong>Manage Jenkins</strong> &gt; <strong>Manage Plugin </strong>&gt;<strong> Available </strong>&gt;<strong> </strong>Search and Select <strong>Blue Ocean</strong> and click<strong> Install without restart </strong>at the bottom<strong>.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/917/0*9mT0sFM0P9G0PP0P.png" /></figure><p>After Blue Ocean is installed you will start seeing <strong>Open Blue Ocean</strong> in the left panel:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*VAw6ZE5rEHDoyGQxnDG5Vg.png" /></figure><p>Open blue ocean from the side menu. It will ask you to create your first CICD pipeline</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/750/0*_72RRQmWPNohq4zH.png" /></figure><p>Now create a new pipeline using your local (git) or remote repos.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*D4OrNg1EiTIKZGLqSnw3ww.png" /></figure><p>Jenkins will look for an existing pipeline in the project root with in a file called <strong>Jenkinsfile</strong>. It will ask to create a pipeline if none was found.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KvPT03Mv_7prMpxAUI-gPA.png" /></figure><p>Click <strong>Create Pipeline</strong> and the pipeline wizard will appear. Click the plus icon to creat stages in the pipeline. Continuing with the developers tradition, we will print “Hello Jenkins”.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nzqIkmLtJUB9_nRExeYsHQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hVXPOp2eE485sm-9W5_3dg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*8U8Cg9HNi5W5k5mef64sUg.png" /></figure><p>Click S<strong>ave</strong> then <strong>Save and Run</strong> and Jenkins will run the pipeline automatically for you and save the logs.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ri60o934mHymg-Gj3uGOmw.png" /></figure><p>Now unlike other CI tools(e.g. TeamCity) if you want to this pipeline to run everytime you commit to your branch, one extra step is required. Select you project in <strong>Blue Ocean project list </strong>&gt; Click on the ⚙️ icon on the top right &gt; Scroll down or select <strong>Scan Multibranch Pipeline Triggers &gt; </strong>Select<strong> Periodically if not otherwise run &gt; </strong>Select an<strong> interval </strong>to poll for the changes in the repo &gt; Click <strong>Save.</strong></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WbpSssCaM3A_CXK4n-jjeA.png" /></figure><p>That was all for the Jenkins: Introduction &amp; Setup. Thankyou very much for reading till the end. In the next blog I will be sharing how you integrate Jenkins to deploy application directly to Playstore or Firebase app distribution.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=22cb341f1935" width="1" height="1" alt=""><hr><p><a href="https://blog.devops.dev/jenkins-introduction-setup-22cb341f1935">Jenkins: Introduction &amp; Setup</a> was originally published in <a href="https://blog.devops.dev/">DevOps.dev</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Introduction to CI/CD and its tools]]></title>
            <link>https://guneetgstar.medium.com/introduction-to-ci-cd-and-its-tools-f079ab8f4627?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/f079ab8f4627</guid>
            <category><![CDATA[ci-cd-pipeline]]></category>
            <category><![CDATA[jenkins]]></category>
            <category><![CDATA[gitlab]]></category>
            <category><![CDATA[devops]]></category>
            <category><![CDATA[teamcity]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Wed, 29 Jun 2022 08:11:21 GMT</pubDate>
            <atom:updated>2022-06-29T08:11:21.354Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*dyztTseYRbE3_kKexKUJ1A.png" /><figcaption>Toolbox of DevOps</figcaption></figure><p>At some point in our development lifecycle, we all get fed up doing the same tasks every time before making new releases. And that is the same time we wish to bring automation to work.</p><p>Although automation is a big topic depending upon the processes you want to automate (e.g. account creations, allocating resources, granting access, testing, etc.) it is among the basic tasks of DevOps and takes more advanced tools (check <a href="https://www.ansible.com/use-cases">Ansible</a> for example), CI/CD is the most common among developers to utilize.</p><p>CI/CD as we know stands for <em>Continuous Integration and Continuous Deployment </em>which includes but is not limited to the following tasks:</p><ol><li>Testing and compiling code</li><li>Generating builds</li><li>Signing builds</li><li>Releasing, publishing or distributing builds</li><li>Monitoring</li></ol><p>There are 3 common terms that are used while working with CI/CD:</p><ol><li><strong>Pipeline:</strong> A pipeline is a sequence of steps that needs to pass where the output of one step can be used as an input of another step to complete the desired task.</li><li><strong>Steps:</strong> Each step in a pipeline involves some computation job which will result in succession or halt of the current step.</li><li><strong>Jobs:</strong> Each step may involve one or more than one job which can run parallelly.</li></ol><p>This can also be understood with the below image:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*AR2DSKPwUEIMpxeOf5R3VQ.png" /><figcaption>Example CICD pipeline</figcaption></figure><p>There is a wide range of tools doing the same work as CI/CD with its own pros and cons. The main parameters of concern are cost, developer experience, and community support. The most famous ones are:</p><ol><li>Jenkins</li><li>GitLab</li><li>Bamboo by Atlassian</li><li>TeamCity by Jetbrains</li><li>TravisCI</li><li>CircleCI</li><li>Buildkite</li><li>Drone</li></ol><p>Let’s dig into the pros and cons of some of them:</p><h3>GitLab</h3><p>So far the fastest-growing CI/CD tool is <strong><em>GitLab</em></strong> due to its own ecosystem of tools starting from VCS, issue tracking, CICD (obviously) and a range of external app integration (e.g. Jira, YouTracker, Slack to name a few).</p><h3>Jenkins</h3><p>Another tool i.e. <strong><em>Jenkins</em></strong> is pretty much the only open-source CI/CD platform availabale that has good support when it comes to the third-party service integrations e.g. you can integrate GitLab to use Jenkins to handle CI/CD. Jenkins is also doing great to enhance its developer experience with the BlueOcean plugin which makes it easier to visualise and create CI/CD pipelines through UI.</p><h3>TeamCity</h3><p>But if you are not a big follower of open source products then <strong><em>TeamCity</em></strong> (by Jetbrains) might be a great fit for you due to its ease of setup, wider support and UI-driven pipeline creation. Also, it is completely free with up to 100 build configurations for your <em>“on-premise”</em> TeamCity setup.</p><h3>Wait, what’s this “on-premise” mean…</h3><p>This is very much like a local VCS (or git basically) where all the resources being used are the underlying device. There is a remote variant of the so-called on-premise setup of CI/CD that runs on the cloud infrastructure that you configure (e.g. storage, bandwidth, CPU, RAM, etc.)</p><p>All the CI/CD platforms provide their own cloud counterparts of their on-premise application and vice-versa. If one doesn&#39;t provide its own support to run the CI/CD pipelines over the cloud then you can always use Docker (or a similar container) to allocate the resources on the go and execute the pipeline.</p><p>CI/CD on cloud environments mostly incurs some cost and is mainly useful if your pipeline takes large enough time(e.g. &gt; 1 hour) on a local device that can compensate for the extra cost of executing it on a remote or virtual device where the same can execute in a few minutes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EU7Arn_LSe8rf-2imQi3rw.jpeg" /></figure><p>This was all for an introduction to CICD. As one can see in this above image, there is a lot more that can be added to a CICD pipeline as per the process requirement (e.g. integration with DataDog to monitor logs, Jira for issue tracking, deployment API integration, etc.), it is out of the scope of this blog. In the next blog, I will be sharing how you can set up Jenkins locally to bootstrap CICD in your project.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f079ab8f4627" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Common ProGaurd rules you must know for Android]]></title>
            <link>https://medium.com/codex/common-progaurd-rules-you-must-know-for-android-189205301453?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/189205301453</guid>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[androiddev]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[debugging]]></category>
            <category><![CDATA[java]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Sat, 03 Jul 2021 19:44:12 GMT</pubDate>
            <atom:updated>2021-07-11T08:58:54.089Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*3GeMbfqIVhX14bgiBOLpbA.png" /></figure><p>List of ProGaurd options you can use to secure/optimize/test/debug/fix your app!</p><p>For those who are new to ProGaurd, <a href="https://www.guardsquare.com/manual/home"><em>ProGuard is an open-sourced Java class file shrinker, optimizer, obfuscator, and preverifier. As a result, ProGuard processed applications and libraries are smaller, faster, and somewhat hardened against reverse engineering.</em></a><em> </em>To customize or set options to ProGaurd or R8 (a similar but open-source by google that supports the same options as ProGaurd) tool, you need to define a file inside the module build.gradle file like below and make the changes in the declared file or files:</p><pre>// app/build.gradle</pre><pre>android {<br>    buildTypes {<br>        release {<br>            // Enables code shrinking, obfuscation, and optimization for only<br>            // your project&#39;s release build type.<br>            minifyEnabled true<br><br>            // Enables resource shrinking, which is performed by the<br>            // Android Gradle plugin.<br>            shrinkResources true<br><br>            // Includes the default ProGuard rules files that are packaged with<br>            // the Android Gradle plugin. To learn more, go to the section about<br>            // <a href="https://developer.android.com/studio/build/shrink-code#configuration-files">R8 configuration files</a>.<br>            proguardFiles getDefaultProguardFile(<br>                    &#39;proguard-android-optimize.txt&#39;),<br>                    &#39;proguard-rules.pro&#39;<br>        }<br>    }<br>    ...<br>}</pre><p>Let’s break this story into 2 parts:</p><h3>Debugging ProGaurd/R8</h3><p>If you follow the android specifications and don’t use java’s reflection API at all then in most of the cases, you should be fine with the default ProGaurd/R8 application. But if not, you can use these options to help debug:</p><p>-dontshrink</p><p>Pauses <em>code-shrinking. </em>By default, ProGuard/R8 shrinks the code: it removes all unused classes and class members.</p><p>-dontoptimize</p><p>Pauses <em>code-optimization</em>. By default, ProGuard/R8 optimizes all code. It inlines and merges classes and class members, and it optimizes all methods at a bytecode level.</p><p>-dontobfuscate</p><p>The most important one, this option pauses the <em>code-obfuscation</em>. By default, ProGuard/R8 obfuscates the code: it assigns new short random names to classes and class members. It removes internal attributes that are only useful for debugging, such as source files names, variable names, and line numbers.</p><p>-printseeds &lt;file name&gt;</p><p>Specifies to exhaustively list classes and class members matched by the various -keep options that we will see next.</p><h3>Keep-ing the not-safe items</h3><p>Now, after digging into what’s exactly causing your code to stop working after <em>minifying</em> your code, you can instruct R8 what it must keep during <em>minification. </em>Unlike the debugging options we saw above, you can also instruct R8 with @androidx.annotation.Keep annotation in the Java classes, e.g. :</p><pre>@Keep<br>enum class EmailRegisterFlow {<br>    <em>REGISTRATION</em>, <em>BANK_TRANSACTION<br></em>}</pre><p>Although it seems pretty easy to add just an annotation to exclude the R8 <em>minification</em> but that also means that you may be piling up some unwanted code into your final release build as @Keep annotation will exclude the class from shrinking, obfuscation, and optimization all at once! To make it work the old way (which is more customizable and efficient) i.e. adding the rules or options in the ProGaurd file, you can use these:</p><p>-keep [<a href="https://www.guardsquare.com/manual/configuration/usage#keepoptionmodifiers">,<em>modifier</em></a>,...] <a href="https://www.guardsquare.com/manual/configuration/usage#classspecification"><em>class_specification</em></a></p><p>Just like the Java @Keep annotation, retains the specified classes. This option is mainly used to specify the entry points (like the main function) but also to retain the classes that are only used using Java’s reflection API and hence can’t be reached during <em>tree-shaking.</em></p><p>e.g.</p><pre>-keep enum com.example.bean.**</pre><p>-keepclassmembers [<a href="https://www.guardsquare.com/manual/configuration/usage#keepoptionmodifiers">,<em>modifier</em></a>,...] <a href="https://www.guardsquare.com/manual/configuration/usage#classspecification"><em>class_specification</em></a></p><p>Use this option when you want to only keep class members after tree-shaking has been applied to the classes. Mind the difference here, keepclassmembers will only be applied to retain the members of the classes (whether there is a reference to it or not, just like keep) if the class itself is retained during the tree-shaking.</p><p>e.g.</p><pre>-keepclassmembers enum * {<br>    <em>&lt;fields&gt;</em>;<br>}<br># This will retain all the enums fields for all the retained enum classes.</pre><p>-keepnames <a href="https://www.guardsquare.com/manual/configuration/usage#classspecification"><em>class_specification</em></a></p><p>This is when you want to only keep the names of the classes and class members after tree-shaking has been applied or during code obfuscation. This can be used if you are also referencing to a class or its member using reflection API (e.g. initializing a class using Class.forName(“Foobar”).newInstance()). Just likekeepclassmembers, keepnames is only applied if the class itself is retained during the tree-shaking (means “Foobar” or its members in the above e.g. won’t be saved until it R8 either finds a reference to it or is saved using keep option).</p><p>e.g.</p><pre>-keepnames class com.example.bean.**</pre><p>That’s it for the basic R8/Progaurd options that fit in almost all the cases (at least for me). For more advanced customization, you can check out the sources of this story below.</p><p><a href="https://www.guardsquare.com/manual/configuration/usage">ProGuard Manual: Usage | Guardsquare</a></p><p><a href="https://developer.android.com/studio/build/shrink-code">https://developer.android.com/studio/build/shrink-code</a></p><p><a href="https://www.preemptive.com/2019/04/r8-a-step-in-googles-android-build-performance-roadmap">R8: A Step in Google&#39;s Android Build Performance Roadmap | PreEmptive</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=189205301453" width="1" height="1" alt=""><hr><p><a href="https://medium.com/codex/common-progaurd-rules-you-must-know-for-android-189205301453">Common ProGaurd rules you must know for Android</a> was originally published in <a href="https://medium.com/codex">CodeX</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Top-must use Free-Tier Amazon Web Services | Getting Started]]></title>
            <link>https://guneetgstar.medium.com/top-must-use-free-tier-amazon-web-services-getting-started-c9f8f0c3f9fd?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/c9f8f0c3f9fd</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[cloud-computing]]></category>
            <category><![CDATA[cloud]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[amazon-web-services]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Mon, 18 Jan 2021 00:26:44 GMT</pubDate>
            <atom:updated>2021-01-19T00:32:08.725Z</atom:updated>
            <content:encoded><![CDATA[<h3>Top 10 must use Free-Tier Amazon Web Services | Getting Started</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/480/0*WPJO_Fu1lRNWFwpM.gif" /><figcaption><a href="https://giphy.com/gifs/1oC7IwSC0S1pYRNx5p">https://giphy.com/gifs/1oC7IwSC0S1pYRNx5p</a></figcaption></figure><p>When I signed up for AWS, I didn’t actually explore what I am really getting under the 1-year free-tier period from AWS but what I found later was huge. It’s worth knowing that the most useful services required for any application are mostly covered under the free tier.</p><p>I have also used the Google Cloud Platform(GCP) in the past and anyone like me might think that growing but comparatively new in the industry, GCP would be cheaper or at least should come with more inside the initial trial period but its totally wrong. Using AWS there is no going back to Google (but there are other cheaper cloud options one might go to if money is a thing e.g. <a href="https://vercel.com/">Vercel</a> which is no comparison to cloud giants and indeed uses AWS/GCP services as backends but gives free hosting to a lot of applications under the <em>hobby</em> tier, not for commercial use). GCP has one advantage though that it has a better UX ;)</p><p>Ok, that’s enough of comparison, let&#39;s see the best of AWS:</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fgiphy.com%2Fembed%2FZdgKTkvuedPxBrZA8m%2Ftwitter%2Fiframe&amp;display_name=Giphy&amp;url=https%3A%2F%2Fgiphy.com%2Fgifs%2Fshock-thegreatpotterythrowdown-potterythrow-ZdgKTkvuedPxBrZA8m&amp;image=https%3A%2F%2Fmedia1.giphy.com%2Fmedia%2FZdgKTkvuedPxBrZA8m%2Fgiphy.gif&amp;key=a19fcc184b9711e1b4764040d3dc5c07&amp;type=text%2Fhtml&amp;schema=giphy" width="435" height="244" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b3fe28d864fbb0764b497c006eb7bb8/href">https://medium.com/media/4b3fe28d864fbb0764b497c006eb7bb8/href</a></iframe><h3>1. EC2 Instance</h3><p>Elastic Compute Cloud or EC2 is a Platform as a Service which can be used to deploy any of your traditional monolith applications (e.g. spring-boot, django, Wordpress, etc.) on the cloud with usually no code changes. The free-tier covers the following:-</p><ul><li>750 hours/month x 12 (a little more than 31 days a month) of t2.micro Linux and Windows (t3.micro if t2 if not available in your region)</li><li>t2.micro covers the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/373/1*4sh8zrTXvRWdQ0bP-GmO1A.png" /><figcaption><a href="https://aws.amazon.com/ec2/instance-types/t2/">https://aws.amazon.com/ec2/instance-types/t2/</a></figcaption></figure><h3>2. RDS</h3><p>Relational Database Service or RDS is another PaaS but only limited to Database services. Amazon RDS supports traditional MySQL, postgres, SQLServer, MariaDB, and Oracle. The free-tier covers the following:-</p><ul><li>750 hours/month x 12 db.t2.micro instance.</li><li>db.t2.micro instance covers the following:</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/803/1*FM2IARBMS5VufafYp0uZ5g.png" /><figcaption><a href="https://aws.amazon.com/rds/instance-types/">https://aws.amazon.com/rds/instance-types/</a></figcaption></figure><h3>3. Cognito</h3><p>Cognito comes with a simplified but secure Authentication API. Cloud is mostly about breaking monoliths into microservices and Authentication is one of the basic features that any app has. Unlike the above two services, Cognito comes with all-time-free 50,000 MAUs(monthly active users, a parameter in which amazon measures each registered and calculates monthly bills for cognito). It basically translates to AWS managing at least 50,000 users for free although SNS (discussed next) for sending verification messages is chargeable.</p><p>You can read more about it here <a href="https://aws.amazon.com/cognito/pricing/">https://aws.amazon.com/cognito/pricing/</a></p><h3>4. SNS</h3><p>Simple notification service or SNS lets you send SMS(worldwide), emails and Firebase notifications. Although, it is not largely free but a lot cheaper than any other you can find at least for small quantity IMO. Free-tier covers as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/891/1*fXLyIixC2uCqfW4uQsxJpg.png" /><figcaption><a href="https://aws.amazon.com/sns/pricing/">https://aws.amazon.com/sns/pricing/</a></figcaption></figure><h3>5. Lambda Functions</h3><p>Lambdas are serverless compute service that lets you just write code without thinking about the platform it may run on(off course you get to choose the programming environment though). And guess what? AWS gives 1 lac lambda invocations for free-always. Read more about pricing <a href="https://aws.amazon.com/lambda/pricing/">https://aws.amazon.com/lambda/pricing/</a></p><h3>5. S3</h3><p>Simple Storage Service or S3 can be used to store objects/files on the cloud and access them. S3 provides the API to handle your cloud filesystem called buckets with authentication, permission, etc. Free-tier has:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BPRFyMJSkIfPaykRapPxVg.png" /><figcaption><a href="https://aws.amazon.com/s3/pricing/?nc=sn&amp;loc=4">https://aws.amazon.com/s3/pricing/?nc=sn&amp;loc=4</a></figcaption></figure><h3>6. Certificate Manager(ACM)</h3><p>If you have deployed a website before you must have encountered with Domain verified SSL. ACM lets manage your certificate (autorenewal, saving, serving SSL over the cloud, etc.), but can also issue (CA Amazon) certificates to be used for services over AWS for free though you can only get a Free-Amazon-issued SSL for AWS services if you have selected your region to N.Virginia (us-east-1). Note that it doesn’t give you the private key to download. If interested I have a whole article about how to deploy a static SSL website for free on AWS.</p><p><a href="https://guneetgstar.medium.com/how-to-host-static-website-with-https-using-amazon-s3-using-serverless-9d53124a4a93">How to host static website with https using amazon s3 using Serverless?</a></p><h3>8. CloudFront</h3><p>It is a content delivery network and helps you with caching and securing the communication between different microservices(if configured with CloudFront). But its also the most undervalued when someone looks into the free tier IMO. CloudFront free-tier includes 50GB data transfer out, 2,000,000 HTTP and HTTPS requests and that&#39;s huge! See more about it <a href="https://aws.amazon.com/cloudfront/?did=ft_card&amp;trk=ft_card">https://aws.amazon.com/cloudfront/?did=ft_card&amp;trk=ft_card</a></p><h3><strong>9. AppSync</strong></h3><p>AppSync Lets you deploy serverless scalable GraphQL APIs (authentication, hosting, etc. all includes) and the free tier covers the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/800/1*VC1jGCDPsft86rxCPuoatg.png" /><figcaption><a href="https://aws.amazon.com/appsync/pricing/">https://aws.amazon.com/appsync/pricing/</a></figcaption></figure><h3><strong>10. DynamoDB</strong></h3><p>It&#39;s a NoSQL DBMS service offered by AWS which is a lot different than any of the traditional DBMS and that is the reason why AWS is offering all of it for a lifetime(if this is what they mean with always which I personally doubt) free:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/264/1*MPYRkZ0FDnphLRpmfeqr4Q.png" /><figcaption><a href="https://aws.amazon.com/dynamodb/?did=ft_card&amp;trk=ft_card">https://aws.amazon.com/dynamodb/?did=ft_card&amp;trk=ft_card</a></figcaption></figure><p>Not to say but I have included all the URLs by AWS for pricings discussed here just at the end of each topic (either in the image ALT else attached in the text). Prices might change in the future so only trust the original sources.</p><p><a href="https://guneetgstar.medium.com/how-to-host-static-website-with-https-using-amazon-s3-using-serverless-9d53124a4a93">How to host static website with https using amazon s3 using Serverless?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c9f8f0c3f9fd" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Everything wrong with Kotlin | Java vs Kotlin]]></title>
            <link>https://guneetgstar.medium.com/everything-wrong-with-kotlin-java-vs-kotlin-a8953a36cff7?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a8953a36cff7</guid>
            <category><![CDATA[google]]></category>
            <category><![CDATA[android-app-development]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[kotlin]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Thu, 22 Oct 2020 23:17:08 GMT</pubDate>
            <atom:updated>2021-10-19T10:33:13.555Z</atom:updated>
            <content:encoded><![CDATA[<h3>Everything wrong with Kotlin | Java vs Kotlin | A hands-on comparison</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*cfYe8jWGvvrRAnRwPIX8bg.png" /></figure><p>After everything so good with Kotlin, what’s wrong with it? Can Kotlin be the next java? It&#39;s quite a while now but after Google making Kotlin a first-class language for writing Android apps, shouldn’t the whole world just copy that? Here is a caveat…</p><blockquote>If everything seems to be great, you are probably just getting started.</blockquote><p>With no doubt, <em>Kotlin</em> is a very elegant language, and most importantly Kotlin extension functions have made the work of a developer a lot easier and faster that one can just build up the logic as he/she codes as extension functions like Any.apply() and Any.also() makes it possible to build up logic on the fly <strong>(What?)</strong>. It actually means that you don&#39;t really need to declare variables before using it! Kotlin also keeps your code cleans removing boilerplates making it more readable and concise.</p><p>But even after a lot of great features, why is the world taking time to adopt it or why are people still writing in java? The reason is more than just the legacy java code!</p><h3>1. Kotlin has no package-access-modifier</h3><p>Although Kotlin has the internal keyword which it suggests as a replacement to package-visible access modifier, it doesn’t completely emit the same behaviour because members with internal visibility are visible within the same module and a module is defined as:</p><blockquote><a href="https://kotlinlang.org/docs/reference/visibility-modifiers.html#modules">A module could be an IntelliJ IDEA module, a Maven project, a Gradle source set (with the exception that the </a><a href="https://kotlinlang.org/docs/reference/visibility-modifiers.html#modules">test source set can access the internal declarations of </a><a href="https://kotlinlang.org/docs/reference/visibility-modifiers.html#modules">main) or a set of files compiled with one invocation of the </a><a href="https://kotlinlang.org/docs/reference/visibility-modifiers.html#modules">&lt;kotlinc&gt; Ant task.</a></blockquote><p><em>W</em>hen an application scales the line of code increases significantly hence for better code management, application developers look to cut out the unnecessary accesses between different parts of the code to make it more <strong><em>cohesive</em></strong> and reduce <strong><em>coupling</em></strong><em> </em>the two general goals in software engineering towards high maintainability and package access is a desirable feature.</p><p>But what really makes package visibility a need for developers is while <a href="https://discuss.kotlinlang.org/t/kotlin-to-support-package-protected-visibility/1544"><em>testing</em></a><em>. </em>Kotlin has no way to specify access limited only to test sources in one module leading to more public accessed resources whereas in java:</p><blockquote><em>With package-visible classes you can write test cases in the same package in different source sets (e.g. </em><em>test,</em><em>androidTest,etc.) while hiding them completely with the rest of the world.</em></blockquote><blockquote>EDIT: Though Android lib has made an annotation <a href="https://developer.android.com/reference/androidx/annotation/VisibleForTesting">@VisibleForTesting</a> to relax visibility restrictions while testing, it&#39;s still not the same as the package access modifier in java but can be used as a workaround in kotlin.</blockquote><p>It can be understood with the below comparison, Note that the access outside package fails to compile.:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*h_LOBSEDe46sKOEfCKQdwQ.png" /><figcaption>Comparision within package and outside package visibility</figcaption></figure><h3>2. Whereas Java 9+ has a robust module system</h3><p>Java has gone one step further in making the visibility even more explicit with the introduction to modules in Java 9. According to Java’s own references, Java modules were built under the <a href="https://openjdk.java.net/projects/jigsaw/">Project Jigsaw</a> and Java development team took almost a decade to build the J<em>ava Platform Module System (</em><strong><em>JPMS</em></strong><em>)</em>. Although the time they took was mainly due to the acceptance process, the result really works for all. It provides fine-grained control over modularization which increase the scalability of an application at any time. With a module descriptor i.e. module-info.java at the root of the module (e.g. maven modules) one can specify directives like Exports, Exports … To, Uses, and much more. You can read more about it <a href="https://www.baeldung.com/java-9-modularity">here</a>.</p><h3>3. No Checked exceptions</h3><p>Some may argue that it’s a good thing to not catch every checked exception for the sake of less boilerplate and code readability which kotlin nevertheless provides. But checked exceptions are there for a reason and not handling them could lead to unexpected app crashes. Unfortunately, with ignored <em>Checked Exceptions </em>at compile-time, kotlin makes it difficult to handle unwanted behaviours.</p><p>One example of this is:</p><p><strong>Kotlin:</strong></p><pre>val thread = Thread <strong>{ </strong>Thread.sleep(100000) <strong>}<br></strong>thread.start()<br>Thread<strong>{<br>    </strong>Thread.sleep(1000)<br>    thread.interrupt()<br><strong>}</strong>.start()<br><strong>// app crashes due to unandled exception but no error at compile //time</strong></pre><p><strong>Java:</strong></p><pre>Thread thread=new Thread(()-&gt; {<br>    try {<br>        Thread.<em>sleep</em>(100000);<br>    } catch (InterruptedException e) {<br>        System.<em>out</em>.println(e.getMessage());<br>    }<br>});<br>thread.start();<br>new Thread(()-&gt; {<br>    try {<br>        Thread.<em>sleep</em>(1000);<br>        thread.interrupt();<br><strong>// Exception must be handled before successful compile</strong> <br>} catch (InterruptedException e) {<br>        System.<em>out</em>.println(e.getMessage());<br>    }<br>}).start();</pre><h3>4. Null checks vs Optional in java</h3><p>Again, this is also related to unwanted exceptions as asserting not-null can surely leave you without NullPointerException but with the other IllegalStateException:</p><pre>var something:String?=null<br>val lenght=something!!.length</pre><pre>......</pre><pre>java.lang.IllegalStateException: [...] must not be null</pre><p>Whereas java’s Optional type checking system plays safer:</p><pre>Optional.<em>of</em>(&quot;Something&quot;).ifPresent((a-&gt; {<br>    //do with something<br>}));</pre><h3>5. Most of the libraries/frameworks are made with java in mind and not kotlin</h3><p>Last but an important limitation of using kotlin over java that one may realize eventually is the better support. Most of the frameworks or libraries are written for java is not intended to work with Kotlin and are better compatible with java. My own experience with Spring which itself has support for Kotlin still doesn’t go well as I had to include extra dependencies and plugins to make my code work e.g. kotlin-maven-allopen, kotlin-maven-noarg, kotlin-maven-plugin, etc. which otherwise would be pretty straightforward. So there might be a workaround if something fails and kotlin is officially supported but if not, the options you are left with is to either look for another similar library/framework that supports kotlin which in most cases, is not possible (e.g. using AWS SDK) or write code in java.</p><h3>6. Kotlin is just a wrapping over Java</h3><p>If you dig inside you will see that all the abilities that Kotlin has over Java are not fundamental but only provides a compile-time profit. One example of it is NonNullable fields in kotlin. I was working on a spring-boot application, when I found some of my non-nullable fields as null in the debugger because spring, for the most part, uses reflection to assign value to variable something that Kotlin has no control and one example of it was @Enitity fields on a @PrePersist hook (as I said even spring also fully supports kotlin but it was not actually designed for Kotlin and you can keep finding this unexpected behaviour everywhere). See the snippet below yourself:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/564/1*nd2VOmd1zs9PJXq6cD0vjQ.png" /></figure><p>Another behaviour that bothered me was when I used a not-null field in a @RequestBody object for a @RequestController argument and <a href="https://github.com/FasterXML/jackson">jackson</a>library (spring uses jackson to convert between json and Java objects) gave me an kotlin.NullPointerException because it tried to assign a non-nullable property to not-found-hence-null. Although it was not unexpected, seeing it working for some section of the same framework is not something one might expect!</p><h3>So, Why Kotlin became so popular?</h3><p>What justifies Google’s action to make Kotlin it’s the first-class language for android is mainly due to its extension functions as Android has minimum API level restrictions to use the APIs of new Java releases e.g. most features of Java 8 (which itself was released in 2014) requires API level 23 (Marshmallow). Although now Google itself has come up with a recent alternative as Android Studio now has built-in support for <a href="https://developer.android.com/studio/releases#4-0-0-desugar">Desugaring</a> that makes it possible to use Java 8 APIs for apps that support older versions of Android. With that said, using Java for android development was basically using a 9-year-old library APIs (which is 2011, when Java 7 was first released) if one doesn’t count the compile-time optimization that Android Studio provides since always.</p><p>Whereas the comparison of kotlin just with java won’t be justified itself as Kotlin also lets you write in <a href="https://kotlinlang.org/docs/reference/js-project-setup.html">JavaScript</a>, <a href="https://kotlinlang.org/docs/reference/native/c_interop.html">C</a>, <a href="https://kotlinlang.org/docs/reference/native/objc_interop.html">Swift/Objective-C</a> and even more projects. It also brings <a href="https://kotlinlang.org/docs/reference/mpp-intro.html">Multiplatform projects</a> which aims to reduce time spent writing and maintaining the same code for <a href="https://kotlinlang.org/docs/reference/mpp-supported-platforms.html">different platforms</a> (currently in alpha).</p><h3>Conclusion</h3><p>While comparing Java with Kotlin, apart from Android development, where kotlin is surely better than the rest, it&#39;s always about whether to go for a sweet-syntactic-sugar no-boilerplate code with kotlin with all the caveats we just talked about or look for high-level robustness that Java always provide.</p><p>Although the scope of Kotlin seeing its rapidly increasing popularity can’t be seen as a replacement to Java.</p><p><a href="https://medium.com/@guneetgstar/how-to-increase-code-reusability-26a2662f8d02">How to increase code reusability?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a8953a36cff7" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The truth behind why Apple bans sideloading apps on iOS]]></title>
            <link>https://medium.com/macoclock/the-truth-behind-why-apple-bans-sideloading-apps-on-ios-a21a2163c0e2?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/a21a2163c0e2</guid>
            <category><![CDATA[ios-app-development]]></category>
            <category><![CDATA[mobile-app-development]]></category>
            <category><![CDATA[ios]]></category>
            <category><![CDATA[wwdc]]></category>
            <category><![CDATA[apple]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Fri, 19 Jun 2020 08:17:10 GMT</pubDate>
            <atom:updated>2021-03-20T14:15:11.571Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*V1BVsD6kwGTcgETL.jpg" /><figcaption>Source: <a href="http://www.theverge.com/">www.theverge.com</a></figcaption></figure><p>I am a developer from the profession and I recently wrote a petition on change.org that I will be talking about later in this blog which is against how apple is manipulating users with its brand value made over promising security that Apple claims it provides to its users. Apart from that apple undoubtedly does provide great products to their customers with no affirmations required so without any offence the brand value is real.</p><p>Apple is dominating the mobile phone industry for quite a long time now and it’s mostly famous for its high-quality, high-priced products and in the technology’s world, quality is not approved if it lacks a robust security system. A lot of firms competing to provide better security through secure algorithms, hardening systems, putting restrictions over access to data, or the ability to compute but not a lot of firms manipulate these ways to make extreme profits at the loss of access to users from the power of technology.</p><p>Controlling what a user can and cannot for security measures is not bad or new until the user actually knows what he/she is doing. Bad starts when you gain access to what a user can/cannot and using that power for one’s own gain.</p><p>Apple charges developers <a href="https://developer.apple.com/support/compare-memberships/">$99/year</a>, higher and even incomparable than what its competitors&#39; charge (see below) making it impossible for a lot of developers to ever get their app on the App store and thus pertaining users from a lot of utility and highly productive apps (of course there will be a lot of deceiving and useless apps as well) that might have been available otherwise because there is no other store a user can download an app from, user cant even sideload apps for more than 7 days, (which is also not the official way of sideloading apps. It is the period given for free developer account holders to sign and test apps on an iOS).</p><ul><li>Google Play charges only a $25 one time registration fee. Read <a href="https://support.google.com/googleplay/android-developer/answer/6112435?hl=en">here</a></li><li>Microsoft Store requires just $19 for individual developer accounts and $99 for companies to register there for developer accounts as a one-time registration fee. Read <a href="https://developer.microsoft.com/en-us/store/register/#:~:text=Top%20questions,and%20no%20renewal%20is%20required.">here</a></li></ul><p>If Apple were honest about its take on disallowing sideloading on iOS “For security reasons” then why it has never been able to do so for its other products like MacOS where you can easily download and install great applications which are not and probably never be available to download via App store like Spotify, Adobe Photoshop, XD, and what not just because of its higher amount of charges as Apple doesn’t stop at charging $99/year for using their platform and also charges developers 30% of all the in-app purchases made through an app downloaded through the App Store. You can read more about it <a href="https://www.apple.com/ios/app-store/principles-practices/#:~:text=Free%20with%20in%2Dapp%20purchase,Apple%20collects%20a%2030%25%20commission.">here</a></p><p><em>Giving it a name “For security reasons” is simply a deception. Behind the doors, apple is controlling all the content that can be added or downloaded or used in or on an iPhone.</em> In some manner, apple is also imposing its opinion on its user but this is what most of the tech giants are doing which might be good to some extent if the opinion is not bad after all every idea is just someone&#39;s opinion at the first stage. But does every opinion serve a good intention? I don’t think so and that’s why I chose to stand against it to louder the voice of developers and awakening users to what they are lacking.</p><p>I <em>wrote a petition for providing a platform for the developers who make apps just because they have a solution to a problem at hand or just to help each other out or just for the user convenience, or in fewer words, their motive is not just to make money out of it. And this petition is to provide the users with the right to choose.</em></p><p>Although one may argue that iOS is Apple’s own platform and it can do whatever it wants. The answer is, with great power comes great responsibility and you can’t run away from your responsibilities to make more profits. To a very large extent apple provides a lot of information to the users through its iOS-driven-services and when we blame Google or Facebook or Twitter for putting curtails on what information a user has access to, Apple is just on the same run.</p><p><strong><em>Prohibiting sideloading apps in iOS gives apple access to a monopoly over the iOS app market allowing it to make whatever rules it wants and charge whatever it can which otherwise would not be possible and give users access to a lot of free cheap content and provide developers with a platform to embrace their skills rather than paying higher in fees just to make it available to the user to make use of it.</em></strong></p><p>I am dropping the link to the petition below. Please sign this petition in a fight for empowering the users in this tech world and to give developers fairness in embracing their skills.</p><h3><strong>UPDATE</strong></h3><p>As more people are signing this petition, I am encouraged to promote it and for that, I am starting a fundraising campaign. Please note that all the proceeds will directly go to promote <strong>#FreeMyiPhone</strong> and awareness of what a user is lacking due to @Apple’s monopolistic restrictions over the app store aka what can be installed on an iPhone. <strong>If you too feel it’s a good move and can lead to momentum if got the right eyes, please donate me any small amount you can via PayPal or BitCoin (link below).</strong></p><p><strong>PayPal: </strong><a href="https://paypal.me/guneetgstar"><strong>https://paypal.me/guneetgstar</strong></a></p><p><strong>BitCoin: 1ExyizBfPKCvqieN8z3xrLN8t4abwrDQtS</strong></p><p>I am currently not supporting GoFundMe or Patreon because of their higher charges. <strong>Please note that all the transfer will directly and only be used for #FreeMyiPhone</strong></p><p>Again, <a href="https://www.change.org/FreeMyiPhone"><strong>DO NOT FORGET TO SIGN THIS PETITION</strong></a></p><p><a href="http://chng.it/gPtjdkxh">Sign the Petition</a></p><h3><strong>Recent developments</strong></h3><ul><li><a href="https://www.protocol.com/apple-hey-rejection-letter">Apple sends a letter to Hey: Change your app or get out of the App Store</a></li><li><a href="https://www.theguardian.com/technology/2020/jun/21/microsoft-presidents-criticism-of-app-stores-puts-pressure-on-apple">Microsoft president&#39;s criticism of app stores puts pressure on Apple</a></li><li><a href="https://tech.hindustantimes.com/tech/news/ahead-of-wwdc-2020-voices-against-apple-s-app-store-tax-get-louder-71592647720271.html">Ahead of WWDC 2020, voices against Apple&#39;s App Store tax get louder</a></li><li><a href="https://www.news18.com/news/tech/apple-rejects-facebook-gaming-platform-from-coming-on-app-store-for-the-fifth-time-2678451.html">Facebook Gaming Rejected by Apple App Store For the Fifth Time</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=a21a2163c0e2" width="1" height="1" alt=""><hr><p><a href="https://medium.com/macoclock/the-truth-behind-why-apple-bans-sideloading-apps-on-ios-a21a2163c0e2">The truth behind why Apple bans sideloading apps on iOS</a> was originally published in <a href="https://medium.com/macoclock">Mac O’Clock</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Code Recipe: A Generic RecyclerView.Adapter Implementation]]></title>
            <link>https://guneetgstar.medium.com/recyclerview-adapter-made-simpler-6cfd209a95f5?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/6cfd209a95f5</guid>
            <category><![CDATA[recyclerview]]></category>
            <category><![CDATA[android]]></category>
            <category><![CDATA[abstract]]></category>
            <category><![CDATA[java]]></category>
            <category><![CDATA[android-app-development]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Thu, 07 May 2020 11:00:18 GMT</pubDate>
            <atom:updated>2020-05-12T06:54:09.264Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*gAV10f9sxx2hFVqy.jpg" /></figure><p>How many times have you created an Adapter for a RecyclerView? Maybe infinite! Every other list requires a new Adapter implementation which ends up with a lot of boilerplate code. But have you ever thought of making an implementation that can work for all of your lists?</p><p>Well, today we gonna make one and close it once for all. And I am not just gonna give you the code but also explain how it works, how you can write your own similar implementations and caveats:-</p><h3>How does it work?</h3><p>If you try you will find that it’s only the logic and basically under Adapter.onBindViewHolder call which changes for every other Adapter. The rest of it can be injected as a dependency at the time of instantiation. Same is done in the SimpleRecyclerViewAdapter, data and layout resource can be added at instantiation and the logic can be passed using:</p><pre>SimpleRecyclerViewAdapter.setOnBindViewHolderListener<br> (OnBindViewHolderListener onBindViewHolderListener)</pre><h3>Caveat</h3><p>This source code abides developer to call View.findViewById every time SimpleRecyclerViewAdapter.onBindViewHolder is called which is not appropriate in many ways. The best practice is always to store the reference of the View so that no unnecessary calls are made to View.findViewById() though nothing is a rule of thumb in programming and sometimes it&#39;s more of a convenience the developer has to think about.</p><h3>Code</h3><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/524f445abfe567323f99d279efe29e6f/href">https://medium.com/media/524f445abfe567323f99d279efe29e6f/href</a></iframe><h3>Example</h3><pre>final SimpleRecyclerViewAdapter&lt;Object&gt; adapter = new SimpleRecyclerViewAdapter&lt;&gt;(R.layout.<em>layout_activity_protein</em>);<br>adapter.setItems(items);<br>adapter.setOnBindViewHolderListener(((viewHolder, pos) -&gt; {<br>   .<br>   .<br>   .<br>}));<br>RecyclerView recyclerView = view.findViewById(R.id.<em>recyclerView</em>);<br>recyclerView.setLayoutManager(new LinearLayoutManager(activity, RecyclerView.<em>VERTICAL</em>, false));<br>recyclerView.setAdapter(adapter);</pre><h3>How to write similar implementations?</h3><p>To make things clearer I have a separated it out in different story:-</p><p><a href="https://medium.com/@guneetgstar/how-to-increase-code-reusability-26a2662f8d02">How to increase code reusability?</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6cfd209a95f5" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to increase code reusability?]]></title>
            <link>https://guneetgstar.medium.com/how-to-increase-code-reusability-26a2662f8d02?source=rss-f0e5da66d9bc------2</link>
            <guid isPermaLink="false">https://medium.com/p/26a2662f8d02</guid>
            <category><![CDATA[java]]></category>
            <category><![CDATA[oop]]></category>
            <category><![CDATA[programming]]></category>
            <category><![CDATA[code]]></category>
            <category><![CDATA[development]]></category>
            <dc:creator><![CDATA[Guneet Singh]]></dc:creator>
            <pubDate>Thu, 07 May 2020 10:51:22 GMT</pubDate>
            <atom:updated>2021-01-17T20:17:28.340Z</atom:updated>
            <content:encoded><![CDATA[<p>We all know about code reusability, its advantages, importance, etc. But do we really reuse our code? If yes then to what extent?</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*Cp9c2srQFTxUMFR8kIiSUQ.png" /></figure><p>Although, only following the best practices already in the industry can make do everything you want, but even following that comes with a price(lower short term productivity) and requires skill or more of a habit that comes with time.</p><p>Meaning, unless you not working on a big project you are better-off asking do you really need to improve it rather than focusing on how and start learning new architectures.</p><p>So, let’s talk about what part of code is doing nasty but really need a check following with the ways to code reusability and the tools come with different programming languages and paradigms.</p><h3>How to find reusable code?</h3><p>Basically, every block, every line, and even every statement whichever repeats more than once is reusable, it’s only up to you how much you want to your code to be concise. This is because there is always a trade-off between<em> Efficiency and Effectiveness.</em></p><p>That being said, finding reusable code is more of a selective process rather than an identifying process. Just think what is bothering you the most and you just can’t live with it.</p><h3><strong>Few questions to ask while deciding what part to Dedup.</strong></h3><ol><li>Can you make it better (both algorithmically and syntactically)?</li><li>What if I have to change it in the future?</li><li>If not sure what if you find a better way tomorrow?</li><li>What’s the trade-off? Is the current code is too naive and must be fixed soon enough?</li><li>Would changing it in the future would be easy?</li><li>Does a block of code is repeated or common but can be extracted out?</li></ol><h3>Tools and techniques</h3><p><em>Object-Oriented Programming </em>has made code reusability a breeze and most of the techniques for better code follows it not only but which we gonna explore next. Although, code reusability is nothing new and in functional programming, there are multiple tools to do it as well (e.g. function as a variable). Not only this, today even OOP languages are following the functional way (e.g. the development of <em>Java</em> over time and how the interface resemble a function as an argument) with the motive of making the best out of both paradigms.</p><p>Some of the common tools and techniques to look for are:-</p><h3>1. Abstraction</h3><p>To remove boilerplate code or reduce the number of lines from a source you might be using frequently (even twice), the best thing to think about first is pulling out the abstractions. And to do so, inheritance may work as your magic wand!</p><h3>2. Polymorphism</h3><p>This is actually the most common one. From constructor overloading function overriding we often encounter one of its usages.</p><h3>3. Dependency Injection</h3><p>Abstraction can only do a lot but not everything. Now after you have separated out the common code, you look for external dependencies just to make your implementation customizable.</p><h3>4. Injecting logics</h3><p>This is where interfaces come into play. You write an implementation and pass it to others. An example would be to think of as if you got a block of code which is almost the same with few lines changed depending on a condition(say variable), then you can simply replace it with a functional interface with the condition (or variable) as an argument.</p><h3>5. Generics</h3><p>Sometimes, the whole implementation is just the same but it is the only the data type which may change. This can simply be handled with generic types.</p><h3>6. Separation-of-concern</h3><p>Code with similar concerns should be cubbed together(e.g. APIs, UI, business logics, etc.). It won’t only help with better navigation but also hinder you to repeat the same lines.</p><h3>Tips</h3><ul><li>All the tools that your language has are only to write better code. When ever you want to reuse a piece of code just think about some of the tools your programming language has provided you and if any of them can be helpful.</li><li>Writing efficient code is not always gonna work and increase productivity. Although it does prove to be effective in the longer run, one must still think that how long it can run!</li><li>Do not focus a lot on reducing the LOC or the number of files. Sometimes you write more code just to not repeat it in the future.</li><li>Extract the duplicate code with the dependencies. (e.g. operation to mutate object is better placed inside the class definition but helper classes are preferred to inject dependencies)</li></ul><h3>Conclusion</h3><p>What I have given above are just a few examples. If you see, every other tool or feature that your programming language provides you can be used to reduce code duplication. Comparing to how to find reusable code which is more of a selective process, this is an identifying process. You need to identify which tool can be used to remove duplication.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=26a2662f8d02" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>