<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>Forem: Pulkit</title>
    <description>The latest articles on Forem by Pulkit (@droidpulkit).</description>
    <link>https://forem.com/droidpulkit</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F201232%2Fe8014c50-b747-407a-9632-f013977ff277.jpg</url>
      <title>Forem: Pulkit</title>
      <link>https://forem.com/droidpulkit</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/droidpulkit"/>
    <language>en</language>
    <item>
      <title>Do you test edge cases?</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Sun, 21 Apr 2024 03:43:44 +0000</pubDate>
      <link>https://forem.com/droidpulkit/do-you-test-edge-cases-hg</link>
      <guid>https://forem.com/droidpulkit/do-you-test-edge-cases-hg</guid>
      <description>&lt;p&gt;Often when we learn programming, we are never taught to think outside the box. Yes, we are given some set of requirements, and a vision of what to build. It is our job as Software Engineers to build that product.&lt;br&gt;
So you folks might have heard of this, famous code to find factorial of a number, the recursive method.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;int factorial(int n)
{
    int ans = 1;
    if(n == 0 || n == 1)
    {
        return 1;
    }
    ans = n * factorial(n-1);
    return ans;
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;blockquote&gt;
&lt;p&gt;Question: What happens when we enter negative number?&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;A penny for your thoughts&lt;/p&gt;

</description>
      <category>programming</category>
    </item>
    <item>
      <title>Download XCode previous version</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Wed, 28 Jun 2023 19:21:15 +0000</pubDate>
      <link>https://forem.com/droidpulkit/download-xcode-previous-version-3bln</link>
      <guid>https://forem.com/droidpulkit/download-xcode-previous-version-3bln</guid>
      <description>&lt;p&gt;In order to download XCode previous version, just go to link below: &lt;a href="https://developer.apple.com/download/all/?q=xcode"&gt;https://developer.apple.com/download/all/?q=xcode&lt;/a&gt; and search for your version and click on View Details and download zip file&lt;/p&gt;

</description>
      <category>xcode</category>
      <category>ios</category>
    </item>
    <item>
      <title>How to upgrade Kotlin plugin in Android Studio</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Wed, 08 Jun 2022 17:49:53 +0000</pubDate>
      <link>https://forem.com/droidpulkit/how-to-upgrade-kotlin-plugin-in-android-studio-179j</link>
      <guid>https://forem.com/droidpulkit/how-to-upgrade-kotlin-plugin-in-android-studio-179j</guid>
      <description>&lt;p&gt;Problem: I am on Android Studio Bumblebee, and every time, I get an error saying that "Outdated Bundled Kotlin Compiler" error, and whenever I go to Tools &amp;gt; Kotlin &amp;gt; Configure Kotlin Plugin Update, I see the "Update" button, but when I do that, I get an error: "plugin kotlin was not installed: request failed with 404"&lt;/p&gt;

&lt;p&gt;Solution: We need to install the plugin manually: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;p&gt;Go to this webpage: &lt;a href="https://plugins.jetbrains.com/plugin/6954-kotlin"&gt;https://plugins.jetbrains.com/plugin/6954-kotlin&lt;/a&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Click on GET button, and select Android studio from dropdown&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Next you gotta figure out your android studio version, and expected plugin version to download. I found which plugin to download by going to Android Studio &amp;gt; Preferences &amp;gt; Plugins &amp;gt;  search for kotlin and note down the plugin version there.&lt;/p&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;I just downloaded the plugin version mentioned in above step and to install that, in  Android Studio &amp;gt; Preferences &amp;gt; Plugins, there is a settings button, which shows a dropdown to install plugin from disk, choose that, choose the plugin file and restart android studio&lt;br&gt;
&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--vdAnk83e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8go08yxd8dcvgwynzsq.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--vdAnk83e--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_880/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/l8go08yxd8dcvgwynzsq.png" alt="Dropdown where the install plugin from disk option is" width="880" height="363"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
    </item>
    <item>
      <title>Quick regex to find a word and delete the whole line</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Mon, 13 Dec 2021 18:13:07 +0000</pubDate>
      <link>https://forem.com/droidpulkit/quick-regex-to-find-a-word-and-delete-the-whole-line-30m2</link>
      <guid>https://forem.com/droidpulkit/quick-regex-to-find-a-word-and-delete-the-whole-line-30m2</guid>
      <description>&lt;p&gt;Use the replace command in your IDE, Android studio and run this regex&lt;br&gt;
^.&lt;em&gt;\b(WORD_HERE)\b.&lt;/em&gt;$\r?\n&lt;br&gt;
Replace WORD_HERE with the word you are trying to find and keep the replacing text as blank.&lt;/p&gt;

</description>
      <category>regex</category>
    </item>
    <item>
      <title>Solution for time machine backup stuck on Big Sur</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Sun, 21 Mar 2021 23:02:05 +0000</pubDate>
      <link>https://forem.com/droidpulkit/solution-for-time-machine-backup-stuck-on-big-sur-53cn</link>
      <guid>https://forem.com/droidpulkit/solution-for-time-machine-backup-stuck-on-big-sur-53cn</guid>
      <description>&lt;p&gt;Backups are important, but should they take infinite amount of time?&lt;/p&gt;

&lt;p&gt;No&lt;/p&gt;

&lt;p&gt;My last backup was in 2018, and since then I didn't backup my Macbook as it didn't complete at all. I have a patience of 0 it seems.&lt;/p&gt;

&lt;p&gt;Googling all possible solutions, I found this interesting article &lt;a href="https://medium.com/macoclock/time-machine-backups-too-slow-5ed1e5e347a4"&gt;https://medium.com/macoclock/time-machine-backups-too-slow-5ed1e5e347a4&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Following the article we can do&lt;br&gt;
&lt;code&gt;sudo sysctl debug.lowpri_throttle_enabled=0&lt;/code&gt; to speed up the backup, by removing limits on background jobs such as timemachine backups.&lt;br&gt;
And after backup we have to revert the settings to &lt;code&gt;sudo sysctl debug.lowpri_throttle_enabled=1&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Now, I followed the command &lt;code&gt;sudo sysctl debug.lowpri_throttle_enabled=0&lt;/code&gt; to increase the speed of background job done on the backup, but I am still stuck, so let's investigate the source. But according to article, I have to run this &lt;code&gt;sudo fs_usage -w |grep -i backupd |grep -i fsctl&lt;/code&gt; to find the source of problem, but it doesn't print anything on the terminal. Maybe &lt;code&gt;sudo fs_usage -w | grep -i backupd&lt;/code&gt; works? &lt;/p&gt;

&lt;p&gt;Yes, it works. I see, now that timemachine is trying to figure out .cocopods directory, which has bazillion files. I don't need them, so I excluded them from the backup, and voila, I can now backup my whole machine in an hour&lt;/p&gt;

</description>
      <category>apple</category>
      <category>timemachine</category>
      <category>backup</category>
      <category>bigsur</category>
    </item>
    <item>
      <title>How to use lazy in Kotlin</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Tue, 08 Oct 2019 15:39:05 +0000</pubDate>
      <link>https://forem.com/droidpulkit/how-to-use-lazy-in-kotlin-29p2</link>
      <guid>https://forem.com/droidpulkit/how-to-use-lazy-in-kotlin-29p2</guid>
      <description>&lt;p&gt;We all have been there. Kotlin is good, and we want to declare a variable outside of onCreate() so that we can access the member variable anytime outside of it too. Now to make it non null, you have to either send some data and init the variable in the constructor. Which is not possible in most cases.&lt;/p&gt;

&lt;p&gt;For performance reasons&lt;br&gt;
Now don't just use lazy just like this:-&lt;/p&gt;

&lt;p&gt;private val someString by lazy {&lt;br&gt;
    "someData"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;but do like this :- &lt;/p&gt;

&lt;p&gt;private val someString by lazy(LazyThreadSafetyMode.NONE) {&lt;br&gt;
    "someData"&lt;br&gt;
}&lt;/p&gt;

&lt;p&gt;&lt;a href="https://www.youtube.com/watch?v=mNviUg0ocsk"&gt;https://www.youtube.com/watch?v=mNviUg0ocsk&lt;/a&gt;&lt;/p&gt;

</description>
      <category>kotlin</category>
    </item>
    <item>
      <title>Samsung LogCat Fix</title>
      <dc:creator>Pulkit</dc:creator>
      <pubDate>Tue, 20 Aug 2019 03:47:08 +0000</pubDate>
      <link>https://forem.com/droidpulkit/samsung-logcat-fix-55o7</link>
      <guid>https://forem.com/droidpulkit/samsung-logcat-fix-55o7</guid>
      <description>&lt;p&gt;Are you tired of the cluttered Logcat?&lt;br&gt;
Well I got you, I own a Samsung Note 9, and according to Samsung experts they add all kind of randoms in the Logcat window in Android Studio.&lt;/p&gt;

&lt;p&gt;Basically I am inspired from this blog &lt;/p&gt;

&lt;p&gt;&lt;a href="https://medium.com/@vlonjatgashi/how-to-filter-out-android-logcat-logs-66945a4a0e0a"&gt;https://medium.com/@vlonjatgashi/how-to-filter-out-android-logcat-logs-66945a4a0e0a&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Just create a new log tag as this&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;^(?!.*(AbsListView|ActivityThread|gies.*|ScrollView|OpenGLRenderer|InputTransport|InputMethodManager|InputMethodManager|zygote64|dalvik|ViewRootImpl*)).*$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;This is for the emulator giving bunch of random Logs&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;^(?!.*(libEGL|libc|EGL_emulation|eglCodecCommon|RenderThread|HostConnection|Gralloc3|OpenGLRenderer|AbsListView|ActivityThread|gies.*|ScrollView|OpenGLRenderer|InputTransport|InputMethodManager|InputMethodManager|zygote64|dalvik|ViewRootImpl*)).*$
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;and package name as app package name.&lt;/p&gt;

&lt;p&gt;Enjoy clutter free life ;)&lt;/p&gt;

</description>
      <category>android</category>
      <category>kotlin</category>
    </item>
  </channel>
</rss>
