<?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 Remya Vava on Medium]]></title>
        <description><![CDATA[Stories by Remya Vava on Medium]]></description>
        <link>https://medium.com/@remyapvava?source=rss-e0e8138ed2ce------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*s73EUgQH-aQvZo36jsPF7g.jpeg</url>
            <title>Stories by Remya Vava on Medium</title>
            <link>https://medium.com/@remyapvava?source=rss-e0e8138ed2ce------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 04:28:22 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@remyapvava/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[Debugging with Git]]></title>
            <link>https://medium.com/@remyapvava/debugging-with-git-c2cfd650b823?source=rss-e0e8138ed2ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/c2cfd650b823</guid>
            <category><![CDATA[git-debugging]]></category>
            <category><![CDATA[git-bisect]]></category>
            <category><![CDATA[git-blame]]></category>
            <category><![CDATA[git]]></category>
            <dc:creator><![CDATA[Remya Vava]]></dc:creator>
            <pubDate>Tue, 19 Jun 2018 18:34:44 GMT</pubDate>
            <atom:updated>2018-06-19T18:34:44.231Z</atom:updated>
            <content:encoded><![CDATA[<p><em>Everyone knows that debugging is twice as hard as writing a program in the first place : Brian Kernighan</em></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*AUk0xeDS9Ww53F-f15y9Zw.jpeg" /></figure><p>Thought of sharing a few tips with Git as a debugging tool. Git being the most common version control system now, lets make sure we take most of its advantages.</p><p>Git provides a few commands which would help us to debug the source code when things don’t go the way we expect.</p><h3>File Annotation</h3><pre>git blame</pre><p>It helps you to find out the details of commits against each line of any file and thereby helps you to dig deeper in your code to find out when and why the change was introduced.</p><p>Though I don’t fully support the usage of ‘<em>blame</em>’ keyword (it should have been something like <em>git who</em>), I use this command a lot for debugging.</p><p>Here’s an example on how to annotate a file with the above command to find out which commit was responsible for the introduction of that buggy line.</p><pre>$ git blame {filename}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/724/1*HoGx2cSDmKT0NUH3QIWB7w.png" /></figure><p>Another example which uses the -L option to restrict the output of the annotation to lines 133 through 146 of that file:</p><pre>$ git blame -L 133,146 {filename}</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/745/1*cnzN58BIuFmOdo-JgEYCHg.png" /></figure><p>Another interesting feature is to figure out all sorts of code movement as well. If you pass -C to git blame, Git analyzes the file you’re annotating and tries to figure out where snippets of code within it originally came from if they were copied from elsewhere. For example, say you are refactoring a file named <em>OrdersController.php</em> into multiple files, one of which is <em>CompaniesController.php</em>. By blaming<em> CompaniesController.php</em> with the -C option, you can see where sections of the code originally came from.</p><pre>$ git blame -C -L 163,176 CompaniesController.php</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/991/1*P_r-5vohxqVcvHUbcKReeQ.png" /></figure><h3>Binary Search</h3><p>By annotating a file we could easily find out the commit which caused the issue. But what if there are a hundreds of commits since everything was working fine. ie, you know a commit where your code worked and there’s the latest commit where everything is broken. All you need is to find out that particular commit which broke everything. And there comes the <strong>bisect</strong> command which help you identify the commit which introduced the issue as quickly as possible.</p><p>Let’s find out how <strong>bisect</strong> command works,</p><p>All you know is that latest deployment breaks a few features in production which was working fine a few weeks ago and you could replicate that in development environment as well.</p><p>To start bisecting, run the command <strong>git bisect start</strong> and then run <strong>git bisect bad</strong> to tell the system that the current commit you’re on is broken.</p><p>The next step is to identify the commit where everything was working fine. Mark this commit as good commit use this command.</p><p><strong>git bisect good &lt;good_commit&gt;</strong></p><pre>$ git bisect start<br>$ git bisect bad<br>$ git bisect good e9bab0<br>Bisecting: 6 revisions left to test after this (roughly 4 steps)<br>[95dc7ce39e3e6ce2659e394c69f882361e8981bd] Implementing error handling</pre><p>Git figured out that about 12 commits came between the commit you marked as the last good commit (e9bab0) and the current bad version, and it checked out the middle one for you. At this point, you can run your test to see if the issue exists as of this commit. If it does, then it was introduced sometime before this middle commit; if it doesn’t, then the problem was introduced sometime after the middle commit. It turns out there is no issue here, and you tell Git that by typing git bisect good and continue your journey:</p><pre>$ git bisect good<br>Bisecting: 3 revisions left to test after this<br>[b047b02ea83310a70fd603dc8cd7a6cd13d15c04] secure this thing</pre><p>Now you’re on another commit, halfway between the one you just tested and your bad commit. You run your test again and find that this commit is broken, so you tell Git that with git bisect bad:</p><pre>$ git bisect bad<br>Bisecting: 1 revisions left to test after this<br>[f71ce38690acf49c1f3c9bea38e09d82a5ce6014] drop exceptions table</pre><p>This commit is fine, and now Git has all the information it needs to determine where the issue was introduced. It tells you the SHA-1 of the first bad commit and show some of the commit information and which files were modified in that commit so you can figure out what happened that may have introduced this bug:</p><pre>$ git bisect good<br>b047b02ea83310a70fd603dc8cd7a6cd13d15c04 is first bad commit<br>commit b047b02ea83310a70fd603dc8cd7a6cd13d15c04<br>Author: &lt;&gt; &lt;&gt;<br>Date: Tue Jan 27 14:48:32 2009 -0800<br>secure this thing<br>:040000 040000 40ee3e7821b895e52c1695092db9bdc4c61d1730<br>f24d3c6ebcfc639b1a3814550e62d60b8e68a8e4 M config</pre><p>When you’re finished, you should run git bisect reset to reset your HEAD to where you were before you started, or you’ll end up in a weird state:</p><pre>$ git bisect reset</pre><p>Available bisect options are,</p><pre>usage: git bisect [help|start|bad|good|skip|next|reset|visualize|replay|log|run]</pre><p>Reference official documentation for more:</p><ul><li><a href="https://git-scm.com/docs/git-blame">Git - git-blame Documentation</a></li><li><a href="https://git-scm.com/docs/git-bisect">Git - git-bisect Documentation</a></li></ul><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=c2cfd650b823" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Laravel Collection Methods]]></title>
            <link>https://medium.com/@remyapvava/laravel-collection-methods-dc9cb4e0c54c?source=rss-e0e8138ed2ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/dc9cb4e0c54c</guid>
            <category><![CDATA[collection]]></category>
            <category><![CDATA[php]]></category>
            <category><![CDATA[laravel]]></category>
            <dc:creator><![CDATA[Remya Vava]]></dc:creator>
            <pubDate>Mon, 11 Jun 2018 14:21:33 GMT</pubDate>
            <atom:updated>2018-06-11T14:23:05.417Z</atom:updated>
            <content:encoded><![CDATA[<p>Laravel collections are one of the best things I found in the laravel framework. A lot of things can be made easy with the collection methods.</p><p>One of the major thing we came across while dealing with arrays /collections is to filter it using a particular condition. A lot of useful methods are there which can be used against collections. Listing out a few methods to filter out the items using a condition.</p><p>Most of them are already explained in Laravel Collection methods <a href="https://laravel.com/docs/5.6/collections">here</a>. Grouping it here by making it easy to remember.</p><h4><strong>Filter out the items from collections using a condition — where</strong></h4><p><strong>where</strong><br>Returns the first element in the collection.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0461d18faa983c10518d632791e9d48a/href">https://medium.com/media/0461d18faa983c10518d632791e9d48a/href</a></iframe><p><strong>whereStrict</strong><br>Same as where, but all values are compared using “strict” comparisons.</p><p><strong>firstWhere</strong><br>Returns the first element with the given key-value pair</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/d32b896a5fac1e631b85b46ed17bb9af/href">https://medium.com/media/d32b896a5fac1e631b85b46ed17bb9af/href</a></iframe><p><strong>whereIn</strong><br>Filters the collection by a given key / value contained within the given list</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0f5de015f569b80f5856df13fc56cfaa/href">https://medium.com/media/0f5de015f569b80f5856df13fc56cfaa/href</a></iframe><p><strong>whereInStrict</strong><br>Same as whereIn, but all values are compared using “strict” comparisons.</p><p><strong>whereNotIn</strong><br>Filters the collection by a given key / value not contained within the given list</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4886a72604e490c4f7eb819c5808a3ef/href">https://medium.com/media/4886a72604e490c4f7eb819c5808a3ef/href</a></iframe><p><strong>whereNotInStrict</strong><br>Same as whereNotIn, but all values are compared using “strict” comparisons.</p><p>References:</p><p><a href="https://laravel.com/docs/5.6/collections">Collections - Laravel - The PHP Framework For Web Artisans</a></p><p>Will be adding more on my github <a href="https://github.com/remyapv/laravel-collections">repo</a> soon.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=dc9cb4e0c54c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Git commit messages]]></title>
            <link>https://medium.com/@remyapvava/git-commit-messages-eaa8a4ecf389?source=rss-e0e8138ed2ce------2</link>
            <guid isPermaLink="false">https://medium.com/p/eaa8a4ecf389</guid>
            <category><![CDATA[commit-messages]]></category>
            <category><![CDATA[git]]></category>
            <category><![CDATA[best-practices]]></category>
            <dc:creator><![CDATA[Remya Vava]]></dc:creator>
            <pubDate>Fri, 08 Jun 2018 06:24:24 GMT</pubDate>
            <atom:updated>2018-06-08T06:25:04.807Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/990/1*Z65ZuqFrCa7aqZLD29HBkg.png" /><figcaption><strong>This should be the only one situation where you shouldn’t be worried about your commit messages !!</strong></figcaption></figure><p>There has already been lot of discussions about writing good commit messages. Here’s my turn summarizing them.</p><p>Like almost all code reviewers I too used to get annoyed seeing inappropriate commit messages.</p><p><strong>A few examples of bad commit messages.</strong></p><ul><li>Fix issue</li><li>Bug fix</li><li>Resolved conflicts</li><li>Completed task</li></ul><p>There&#39;s no point in adding these one liners if you&#39;re not explaining what changes you&#39;ve actually made to the ni repo with the commit.</p><p><strong>Structure of a good commit message</strong></p><ul><li>A brief summary as the first liner.</li><li>A blank line after the first line.</li><li>A detailed description of the change you have made, break this into paragraphs if necessary.</li><li>Reference links</li></ul><p><strong>A few points to consider while writing commit messages.</strong></p><ul><li>Keep in mind you have made changes to the existing repo and you’re going to help someone understand that.</li></ul><p>Your commit messages should answer a <strong><em>Why</em></strong> (why a change is being made), <strong><em>How</em></strong> (how did you address the issue) and <strong><em>What</em></strong> (what’s the impact of this commit)</p><ul><li>Divide your commit messages into several sections. It should contain a summary, description, reference links if any</li><li>Summarize your commit message in one line and keep it separate from the description that follows.</li><li>Don’t go for lengthy descriptions which would take the whole page. Instead break it down as short paragraphs explained with bullet points.</li><li>Descriptions should also include any limitations in the current code which you’ve identified</li><li>Add reference links if any. This could be a reference link to your task id or a link pointing to a forum from where you got the solution.</li></ul><p>An example of a <strong>good commit message</strong>:</p><pre>commit 3114a97ba188895daff4a3d337b2c73855d4632d<br>  Author: [removed]<br>  Date:   Mon Jun 11 17:16:10 2012 +0100<br><br>    Update default policies for KVM guest PIT &amp; RTC timers<br><br>    The default policies for the KVM guest PIT and RTC timers<br>    are not very good at maintaining reliable time in guest<br>    operating systems. In particular Windows 7 guests will<br>    often crash with the default KVM timer policies, and old<br>    Linux guests will have very bad time drift<br><br>    Set the PIT such that missed ticks are injected at the<br>    normal rate, ie they are delayed<br><br>    Set the RTC such that missed ticks are injected at a<br>    higher rate to &quot;catch up&quot;<br><br>    This corresponds to the following libvirt XML<br><br>      &lt;clock offset=&#39;utc&#39;&gt;<br>        &lt;timer name=&#39;pit&#39; tickpolicy=&#39;delay&#39;/&gt;<br>        &lt;timer name=&#39;rtc&#39; tickpolicy=&#39;catchup&#39;/&gt;<br>      &lt;/clock&gt;<br><br>    And the following KVM options<br><br>      -no-kvm-pit-reinjection<br>      -rtc base=utc,driftfix=slew<br><br>    This should provide a default configuration that works<br>    acceptably for most OS types. In the future this will<br>    likely need to be made configurable per-guest OS type.<br><br>    Closes-Bug: #1011848<br><br>    Change-Id: Iafb0e2192b5f3c05b6395ffdfa14f86a98ce3d1f</pre><p>For more details please refer this article: <a href="https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages">https://wiki.openstack.org/wiki/GitCommitMessages#Information_in_commit_messages</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=eaa8a4ecf389" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>