<?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 Harish Prabhu Veerasekaran on Medium]]></title>
        <description><![CDATA[Stories by Harish Prabhu Veerasekaran on Medium]]></description>
        <link>https://medium.com/@blenderous?source=rss-595af50637b3------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*kJuVIjFfysuMCyUCR4csoA.jpeg</url>
            <title>Stories by Harish Prabhu Veerasekaran on Medium</title>
            <link>https://medium.com/@blenderous?source=rss-595af50637b3------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Thu, 03 Dec 2026 22:01:16 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@blenderous/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[An Open letter to the Prime Minister of India]]></title>
            <link>https://medium.com/@blenderous/open-letter-to-the-prime-minister-of-india-48b05da2fbab?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/48b05da2fbab</guid>
            <category><![CDATA[protest]]></category>
            <category><![CDATA[open-letter]]></category>
            <category><![CDATA[jantar-mantar]]></category>
            <category><![CDATA[prime-minister-of-india]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Tue, 14 Jul 2026 13:42:32 GMT</pubDate>
            <atom:updated>2026-07-14T13:53:23.399Z</atom:updated>
            <content:encoded><![CDATA[<p>Honourable Prime Minister of India,</p><p>I wish I could have written this in your mother tongue, Hindi. But I am trying my best to express myself, so I chose English.</p><p>You may have heard about the protest led by the parody group Cockroach Janata Party at Jantar Mantar, Delhi. I would like to bring to your attention that although the name of the group is a joke, the cause they are standing for is not to be taken lightly.</p><p>They are protesting at this site in Delhi for the sake of students who laid down their lives by committing suicide after the cancellation of the NEET medical entrance exam due to a leak in the question paper. You may already be aware of this, but it is my duty as a student who has achieved success in life after writing entrance exams like the IIT-JEE, to bring to light that there are students whose lives have been destroyed due to the re-examination of the NEET entrance exam.</p><p>Educationist and climate activist Sonam Wangchuk and student members Neha Bora, Manish, and Aameen have been on a hunger strike for the past 16 days. Another student, Deepak, who was also on a hunger strike, had to be hospitalized due to hypovolemic shock, an emergency caused by severe blood or fluid loss that can affect the heart.</p><p>All these people are asking for is a dialogue with the government, for the government to take accountability for the deaths of the students who were preparing for NEET, for the education system of the country to improve, and for never letting a tragedy like this happen again.</p><p>They have put forward their demands, one of them being that the present Education Minister, Dharmendra Pradhan, must resign from his position, and the students who committed suicide due to the cancellation of the NEET medical entrance exam must be given compensation of one crore rupees each.</p><p>Why am I speaking for them? Being a web developer who has a job and works from home for a living, I could stop worrying about this protest and let the people who are on hunger strike suffer. But being a conscious citizen of this country, which has seen such non-violent protests in the past by great figures like Mahatma Gandhi and Shaheed Bhagat Singh, for the sake of being heard for a just cause, I find no way but to make a choice. Either to silently lead my life, ignoring the cries of my brothers and sisters, or to take a step towards waking up those who are still sleeping.</p><p>I have made my choice, Prime Minister, lending my hand as a support for the students who fight for the cause of a better education system in the country. It is now time for you to make your choice, whether you want to be silent, knowing the suffering that our students and protesters are going through, or to lend your hand in dialogue, which is all you need to do in this great democracy of ours.</p><p>Jai Hind</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=48b05da2fbab" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Yes, I am changing the direction of my career. But not so soon]]></title>
            <link>https://medium.com/@blenderous/yes-i-am-changing-the-direction-of-my-career-but-not-so-soon-84c1722d494a?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/84c1722d494a</guid>
            <category><![CDATA[phd]]></category>
            <category><![CDATA[life-goals]]></category>
            <category><![CDATA[small-business]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Fri, 27 Mar 2026 17:56:11 GMT</pubDate>
            <atom:updated>2026-03-27T17:56:11.621Z</atom:updated>
            <content:encoded><![CDATA[<p>In my last article, I wrote about how being a web developer is not satisfying to me and I wish to change my career path by choosing to study Biology instead.</p><p>It was a wonderful idea and I love Biology.</p><p>But unfortunately, since I did not do a Bachelors in Biology, I am left with only one option, to study Computer Science. And in fact, I am not disappointed. I don’t mind studying Computer Science again. Algorithms, databases and software architecture. In fact I need to be good at these things in order to be able to use AI judiciously and to write better code myself.</p><p>Learning about these things is interesting. It is only the end goal of getting a promotion or securing a raise that doesn’t excite me. I wish to learn concepts in Computer Science for the sake for leaning them and to get better at coding, not to get a higher paying job or get a better pay. I am satisfied with the money I make. It keeps me happy.</p><p>What I lack is a sense of purpose. Doing a PhD certainly makes sense, since I would get to do research and publish my work and not simply work for the profit of a company which is not aligned with my emotional needs.</p><p>But again, reality is different from dreams and you can’t always get what you want. I checked some websites for opportunities in doing a PhD while getting paid and I was disappointed to see that since I am turning thirty six this June and my grades in the subjects that I studied in my Bachelors weren’t up to the mark, my chances of getting a fellowship in a college in Tamil Nadu are next to null.</p><p>The most I can expect is a full time MS plus PhD in Computer Science in Anna University for a very nominal fees. And since I was never interested in getting a promotion at work, I kept moving from job to job and never settled for a big organisation. This has left me with zero savings and using a monthly income as the only way to make a living. So doing a PhD without income is a no go for me.</p><p>But my story does not end there. I would still like to do something that gives me a sense of purpose and also pays me. I have been thinking about starting a business. A business based on teaching technology skills to college graduates, to make them industry ready. I was lucky enough to get a job on the get go where I was trained in website development and I sort of learned things from the internet since then. But not everyone who graduates from an engineering college is lucky enough to get a job in tech as soon as they graduate, even if they are interested. I want to help these people. I want to give them a self-motivated and self-driven learning experience to pick up a skill among a wide variety of skills that are relevant in the market today. This would not only give me sense of purpose, but also help me make some money.</p><p>And since I don’t want this to be another passing thought that I never act upon, I have set a goal for myself. I would like to set up a learning centre in Chennai, the city where I live, for at least ten members within the next two years. And that is a goal that I want to actively work towards, while working for the company where I am currently employed at.</p><p>And as far as my contribution to the political scene of India and Tamil Nadu is concerned, I would like to stop posting the seven most relevant posts from the past week. The reason is simple. It doesn’t pay me. And although it gives me a sense of purpose, it occupies too much time of my day going through different opinions on different issues faced by the people of my state and my country; and I could use this time to build a business from scratch or to learn concepts in Computer Science that would help me do a PhD at some point.</p><p>So, there. I have made some difficult decisions in the past two weeks and hope to keep myself committed to this journey I have chosen. As a responsible citizen, I will continue to express my opinions on matters of political importance on my X (twitter) account and will continue writing on these matters of personal importance as I move through this exciting time of my life.</p><p>Peace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=84c1722d494a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[I am thinking of making a transition in my career]]></title>
            <link>https://medium.com/@blenderous/i-am-thinking-of-making-a-transition-in-my-career-2523d57c76e1?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/2523d57c76e1</guid>
            <category><![CDATA[biology]]></category>
            <category><![CDATA[politics]]></category>
            <category><![CDATA[life-goals]]></category>
            <category><![CDATA[web-development]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Mon, 23 Mar 2026 16:15:41 GMT</pubDate>
            <atom:updated>2026-03-23T16:15:41.136Z</atom:updated>
            <content:encoded><![CDATA[<p>Right now, I am in my comfort zone. I have a work-from-home IT job that pays me enough to enjoy a meal at a restaurant every now and then and visit a coffee shop or watch a movie at the mall every weekend. have been working in the field of web development for more than ten years. I do not wish to continue my career in IT . It’s not because AI is disrupting the field, in fact, I feel that AI is making the job of IT engineers easier and exciting in some ways.</p><p>It’s because I don’t get a sense of satisfaction after working from Monday to Friday, from 9 to 5, solving problems in web development. Sure, I am good at it and that’s why I am still relevant at the job and I wish to keep it for the sake of taking care of my parents.</p><p>I wanted to become a political leader. But I haven’t been confident or brave enough to step up and start working towards that goal. But I still like to express my opinions on vital issues of the state of Tamil Nadu and the nation which is why I have started posting updates from what happened in the political landscape of the country, especially in Tamil Nadu, on X (twitter), so that those who work on the lines of social welfare and fellow citizens could benefit from my insights.</p><p>For now, I would like to study Biology. I have a background in Information Systems and I would like to use this knowledge in a field like Computational Neuroscience. Otherwise, I am looking at working in the field of Cognitive Neuroscience. I am still trying to figure out if I have to do a master’s course before I can do a PhD in one of these fields or if I can do a PhD directly while also getting paid for it (a fellowship) if possible. Any suggestions about how I can go about it are welcome in the comments below.</p><p>I want to get out of my comfort zone and start following my passion. It is this decision that made me write this post and I wish to bring some order to my life. I will continue posting weekly news updates on my X (twitter) account until I have more important things to do with my life.</p><p>Peace.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=2523d57c76e1" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[CSS Starting Style]]></title>
            <link>https://medium.com/@blenderous/css-starting-style-243e8feb365a?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/243e8feb365a</guid>
            <category><![CDATA[css]]></category>
            <category><![CDATA[starting-styles]]></category>
            <category><![CDATA[css-animation]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Fri, 28 Feb 2025 13:47:01 GMT</pubDate>
            <atom:updated>2025-02-28T13:47:01.550Z</atom:updated>
            <content:encoded><![CDATA[<p>This post is about something very simple yet effective.</p><p>If you have been building interfaces using HTML, CSS, and JavaScript, you might have encountered the problem of making an element appear gracefully on the interface with some animation.</p><p>The problem with making an element appear is that it goes from “doesn’t exist” to a node in the DOM, and any animation applied to it will be of no use since the element&#39;s final state will be applied without any transition.</p><p>This has changed thanks to CSS Starting Style</p><p>We can now have elements that animate from a starting point and transition all the way to the styles defined normally in the CSS.</p><p>Let’s see how it works with an example app. Take a look at the example below.</p><figure><img alt="A simple app with a button to add items to a list of items, which already has two items" src="https://cdn-images-1.medium.com/max/706/1*Sd06gZJ6AJmszoPIxGuRPA.png" /></figure><p>On clicking the “Add Item” button, a new item should be added to the list of items. The HTML and JavaScript for the application is as follows:</p><h4>HTML</h4><pre>&lt;div class=&quot;container&quot;&gt;<br>  &lt;p&gt;<br>    &lt;button id=&quot;btn&quot;&gt;Add Item&lt;/button&gt;<br>  &lt;/p&gt;<br>  &lt;ul id=&quot;list&quot;&gt;<br>    &lt;!-- Empty list --&gt;<br>  &lt;/ul&gt;<br>&lt;/div&gt;</pre><h4>JavaScript</h4><pre>// the button<br>const btn = document.getElementById(&quot;btn&quot;);<br><br>// the list<br>const list = document.getElementById(&quot;list&quot;);<br><br>// function to add new element<br>function addElement() {<br>  var count = 0;<br>  return function () {<br>    count += 1;<br><br>    // create a new list item and fill it with text<br>    const newElement = document.createElement(&quot;li&quot;);<br>    const elementContent = document.createTextNode(&quot;Item &quot; + count);<br>    newElement.appendChild(elementContent);<br><br>    // add newElement to list<br>    list.appendChild(newElement);<br><br>    // add click event to the newElement<br>    newElement.addEventListener(&quot;click&quot;, function () {<br>      // remove this element<br>      this.remove();<br>    });<br>  };<br>}<br><br>// add click event to button<br>btn.addEventListener(&quot;click&quot;, addElement());</pre><h4>CSS</h4><pre>ul li {<br>  opacity: 1;<br>  transition: opacity 600ms ease;<br>}</pre><p>This makes the items appear abruptly as they are added newly into the DOM.</p><figure><img alt="Items appear abruptly, without any animation" src="https://cdn-images-1.medium.com/max/1000/1*W5DN7d_B2ka7ApID9eJnwQ.gif" /></figure><h3>Starting Styles to the rescue!</h3><p>Just add these lines to the CSS and see the magic happen!</p><pre>ul li {<br>  opacity: 1;<br>  transition: opacity 600ms ease;<br>  /* starting styles */<br>  @starting-style {<br>    opacity: 0;<br>  }<br>}</pre><p>When the items are added to the DOM, they appear with an animation. They fade in.</p><figure><img alt="Items added by clicking on the Add Item button now appear with an animation, they fade in" src="https://cdn-images-1.medium.com/max/1000/1*FWlOHtrnDKznnveCxU0iyQ.gif" /></figure><p>So far so good.</p><p>On clicking on one of the items, it disappears; but when it does, it does so without any animation.</p><figure><img alt="Items disappear abruptly as they are removed from the list" src="https://cdn-images-1.medium.com/max/1000/1*wZtfe3O2XGkRRTU1cYjqQQ.gif" /></figure><p>Unfortunately, we don’t have exit styles similar to starting styles, which could help us make the items fade out when they leave the DOM.</p><p>For achieving this, we need to use a combination of CSS and some JavaScript.</p><p>We first create a class name called exiting which denotes the exiting state of the item.</p><pre>ul li {<br>  opacity: 1;<br>  transition: opacity 600ms ease;<br>  /* starting styles */<br>  @starting-style {<br>    opacity: 0;<br>  }<br>  /* exiting styles */<br>  &amp;.exiting {<br>    opacity: 0;<br>    display: none;<br>  }<br>}</pre><p>We update the transition property to include the display property in it.</p><p>We also add a transition-behavior property with the value allow-discrete so that when the display property changes from <em>block</em> to <em>none</em>, it waits a while (600ms in this case) for any transitions to happen.</p><pre>ul li {<br>  opacity: 1;<br>  transition: opacity 600ms ease, display 600ms;<br>  transition-behavior: allow-discrete;<br>  /* starting styles */<br>  @starting-style {<br>    opacity: 0;<br>  }<br>  /* exiting styles */<br>  &amp;.exiting {<br>    opacity: 0;<br>    display: none;<br>  }<br>}</pre><p>We change our JavaScript to add a class called <em>exiting</em>, 600ms before the element is removed from the DOM.</p><pre>// ...<br><br>    // add click event to the newElement<br>    newElement.addEventListener(&quot;click&quot;, function () {<br>      // add class &quot;exiting&quot;<br>      this.classList.add(&quot;exiting&quot;);<br><br>      const thisElement = this;<br><br>      setTimeout(() =&gt; {<br>        // element is removed from DOM<br>        thisElement.remove();<br>      }, 600);<br>    });<br><br>// ...</pre><p>Now, we get a fade out effect when a list item is removed from the list.</p><figure><img alt="Items fade out as they are removed from the list" src="https://cdn-images-1.medium.com/max/1000/1*8lw1bPonEEe9_JL5akhHCA.gif" /></figure><p>And voila! We have a list in which items fade in when they are added and fade out when they are removed.</p><p>A complete working codepen of this application can be found below.</p><iframe src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fcodepen.io%2FHarish-Prabhu-Veerasekaran%2Fembed%2Fpreview%2FzxYYZrp%3Fdefault-tabs%3Djs%252Cresult%26height%3D600%26host%3Dhttps%253A%252F%252Fcodepen.io%26slug-hash%3DzxYYZrp&amp;display_name=CodePen&amp;url=https%3A%2F%2Fcodepen.io%2FHarish-Prabhu-Veerasekaran%2Fpen%2FzxYYZrp&amp;image=https%3A%2F%2Fshots.codepen.io%2Fusername%2Fpen%2FzxYYZrp-512.jpg%3Fversion%3D1740673772&amp;type=text%2Fhtml&amp;schema=codepen" width="800" height="600" frameborder="0" scrolling="no"><a href="https://medium.com/media/e38ea11dc8278a6879f842ec23a5e4fe/href">https://medium.com/media/e38ea11dc8278a6879f842ec23a5e4fe/href</a></iframe><p>CSS Starting Styles is supported in Chrome and Chromium based browsers. For complete information on browser support, visit the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/@starting-style">MDN page on Starting Styles</a>.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=243e8feb365a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How to format data from an SQL database into a Tremor Bar Chart? A NextJS Example]]></title>
            <link>https://medium.com/@blenderous/how-to-format-data-from-an-sql-database-into-a-tremor-bar-chart-a-nextjs-example-6fccd235c9d4?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/6fccd235c9d4</guid>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[postgres]]></category>
            <category><![CDATA[nextjs]]></category>
            <category><![CDATA[bar-chart]]></category>
            <category><![CDATA[tremor]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Tue, 17 Dec 2024 10:40:32 GMT</pubDate>
            <atom:updated>2024-12-17T10:45:20.835Z</atom:updated>
            <content:encoded><![CDATA[<p>Say we are building a Next JS application for tracking expenses and incomes and we need to display a bar chart showing the total expenses and total income for each month. Something like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*vydTpfRPQ7_siSoYN4R__Q.png" /></figure><p>This article assumes that you are comfortable with writing SQL queries, know how to write server-side code using Next JS and understand how an ORM works. I am using Drizzle ORM and Postgres database for this example, but you could be using any ORM and database of your choice.</p><h3>Shaping the data</h3><p>We have the data in the form of three tables namely <em>expenses</em>, <em>incomes</em> and <em>members</em>.</p><p>The expenses table looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*LxBBuk5ZIDEvV2Iu4SKmvw.png" /><figcaption>you can view the structure of a table by using the command: \d table_name on the Postgres CLI</figcaption></figure><p>The <em>id</em> column is the primary key and the <em>memberId</em> column is a foreign key referring to the <em>id</em> column of the members table.</p><p>Similarly, the income table looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_-6Ycs3SYE5IsI4Ub-IbxQ.png" /></figure><p>Again the <em>id</em> column is the primary key and the <em>memberId</em> column is a foreign key referring to the <em>id</em> column of the members table.</p><p>And, the members table looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TDhzCVOoSoATyIQzVtsF8w.png" /></figure><p>To get the total expenses for each month from the <em>expenses</em> table, we can use the following SQL code:</p><pre>const expensesData: ExpensesMonthly[] = await db.execute(sql`<br>  SELECT <br>    DATE_TRUNC(&#39;month&#39;, &quot;createdAt&quot;) AS month,<br>    SUM(amount) AS total_expenses<br>  FROM                             <br>    expenses<br>  GROUP BY                            <br>    DATE_TRUNC(&#39;month&#39;, &quot;createdAt&quot;)<br>  ORDER BY<br>    month;`);<br>console.log(expensesData);</pre><p>This will generate a result which looks like the following:</p><pre>[<br>  { month: &#39;2024-10-01 00:00:00&#39;, total_expenses: &#39;717.00&#39; },<br>  { month: &#39;2024-11-01 00:00:00&#39;, total_expenses: &#39;3753.00&#39; },<br>  { month: &#39;2024-12-01 00:00:00&#39;, total_expenses: &#39;1308.00&#39; }<br>]</pre><p>We use a similar SQL for getting the total income for each month:</p><pre>const incomeData: IncomeMonthly[] = await db.execute(sql`<br>  SELECT <br>    DATE_TRUNC(&#39;month&#39;, &quot;createdAt&quot;) AS month,<br>    SUM(amount) AS total_income<br>  FROM                             <br>    income<br>  GROUP BY                            <br>    DATE_TRUNC(&#39;month&#39;, &quot;createdAt&quot;)<br>  ORDER BY<br>    month;`);<br>console.log(incomeData);</pre><p>And, we get a result that looks like this:</p><pre>[<br>  { month: &#39;2024-11-01 00:00:00&#39;, total_income: &#39;3500.00&#39; },<br>  { month: &#39;2024-12-01 00:00:00&#39;, total_income: &#39;1500.00&#39; }<br>]</pre><p>Now the months are ordered from first to last, but we cannot be sure if the months that constitute the <em>expensesData </em>array are same as that of <em>incomeData </em>array. We need to create a union of the months of the <em>expensesData</em> and the <em>incomeData</em> arrays.</p><p>For this we install the <em>date-fns</em> and <em>date-fns/tz</em> libraries.</p><p>The <em>date-fns</em> library provides a way to manipulate date values and the <em>date-fns/tz</em> library offers a way to include timezone data wherever the <em>date-fns</em> library accepts such information.</p><pre>npm install date-fns date-fns/tz</pre><p>We import the following functions from the <em>date-fns</em> and <em>date-fns/tz</em> libraries.</p><pre>import {<br>  eachMonthOfInterval,<br>  format,<br>  isAfter,<br>  isBefore,<br>  isSameDay,<br>} from &quot;date-fns&quot;;<br>import { tz } from &quot;@date-fns/tz&quot;;</pre><p>And now, the magic.</p><p>We write one function (<em>findStartingMonth</em>) to calculate which month among given two months is the earliest and another function (<em>findEndingMonth</em>) to calculate which month among given two months is the latest.</p><pre>const findStartingMonth: (month1: string, month2: string) =&gt; string = (<br>  month1,<br>  month2<br>) =&gt; {<br>  return isBefore(month1, month2) ? month1 : month2;<br>};<br><br>const findEndingMonth: (month1: string, month2: string) =&gt; string = (<br>  month1,<br>  month2<br>) =&gt; {<br>  return isAfter(month1, month2) ? month1 : month2;<br>};</pre><p>After that, we use the functions written above to find the starting month for our Bar Graph by comparing the first month in the array <em>expensesData</em> and the first month in the array <em>incomeData.</em> We find the ending month for our Bar Graph by comparing the last month in the array <em>expensesData</em> and the last month in the array <em>incomeData</em>, like this:</p><pre>const startingMonth = findStartingMonth(<br>  expensesData[0].month,<br>  incomeData[0].month<br>);<br>const endingMonth = findEndingMonth(<br>  expensesData[expensesData.length - 1].month,<br>  incomeData[incomeData.length - 1].month<br>);</pre><p>We then figure out all the months in between the <em>startingMonth</em> and <em>endingMonth </em>using the function <em>eachMonthOfInterval.</em></p><pre>const allMonths = eachMonthOfInterval(<br>  {<br>    start: startingMonth,<br>    end: endingMonth,<br>  },<br>  {<br>    in: tz(&quot;Asia/Calcutta&quot;),<br>  }<br>);<br>console.log(allMonths);</pre><p>This will give us a result like the following (it is all months between <em>startingMonth</em> and <em>endingMonth</em> including <em>startingMonth</em> and <em>endingMonth</em>)</p><pre>[<br>  TZDate 2024-09-30T18:30:00.000Z {<br>    timeZone: &#39;Asia/Calcutta&#39;,<br>    internal: 2024-10-01T00:00:00.000Z<br>  },<br>  TZDate 2024-10-31T18:30:00.000Z {<br>    timeZone: &#39;Asia/Calcutta&#39;,<br>    internal: 2024-11-01T00:00:00.000Z<br>  },<br>  TZDate 2024-11-30T18:30:00.000Z {<br>    timeZone: &#39;Asia/Calcutta&#39;,<br>    internal: 2024-12-01T00:00:00.000Z<br>  }<br>]</pre><p>Make sure the <em>internal</em> date is proper even though the one after <em>TZDate</em> may be offset.</p><p>Now, we need this information and also need to add additional information (total income and total expenses) to each month. We do this by mapping the array <em>allMonths</em> and adding the total income and total expenses for each of the months that is contained in the <em>allMonths</em> array.</p><pre>const barChartData: ChartData[] = allMonths.map((month) =&gt; {<br>  // get total income for this particular month<br>  const incomeOfThisMonth = incomeData.find((monthlyData) =&gt;<br>    isSameDay(month, monthlyData.month)<br>  )?.total_income;<br>  // get total expenses for this particular month<br>  const expensesOfThisMonth = expensesData.find((monthlyData) =&gt;<br>    isSameDay(month, monthlyData.month)<br>  )?.total_expenses;<br>  return {<br>    date: format(month, &quot;MMM yyyy&quot;),<br>    Income: incomeOfThisMonth ? parseFloat(incomeOfThisMonth) : 0,<br>    Expenses: expensesOfThisMonth ? parseFloat(expensesOfThisMonth) : 0,<br>  };<br>});<br>console.log(barChartData);</pre><p>Finally, the array <em>barChartData</em> looks like the following. This is the format that is accepted by the Tremor’s <em>BarChart</em> component.</p><pre>[<br>  { date: &#39;Oct 2024&#39;, Income: 0, Expenses: 717 },<br>  { date: &#39;Nov 2024&#39;, Income: 3500, Expenses: 3753 },<br>  { date: &#39;Dec 2024&#39;, Income: 1500, Expenses: 1308 }<br>]</pre><h3>Tremor charts in Next JS</h3><p>Follow the steps from <a href="https://tremor.so/docs/getting-started/installation/next">here</a> to install Tremor charts in your application.</p><p>After installing Tremor charts, create a function that returns <em>barChartData. </em>Say we keep it in the file “<em>@/app/lib/data”</em></p><pre>export async function fetchBarChartData() {<br>try {<br>  /* all the code we have written */<br>  return barChartData;<br>} catch (error) {<br>  console.error(error);<br>  throw new Error(&quot;Error fetching BarChart data&quot;);<br>}<br></pre><p>Create a client component called <em>BarChartCustom </em>at the location <em>“@/components/ui/custom-bar-chart”. </em>I am using tailwind classes to style the bar chart.</p><pre>&quot;use client&quot;;<br><br>import { BarChart } from &quot;@/components/bar-chart&quot;;<br><br>type ChartData = {<br>  date: string;<br>  Income: number;<br>  Expenses: number;<br>};<br><br>export const BarChartCustom = ({<br>  barChartData,<br>}: {<br>  barChartData: ChartData[];<br>}) =&gt; (<br>  &lt;BarChart<br>    className=&quot;h-64 w-96&quot;<br>    data={barChartData}<br>    index=&quot;date&quot;<br>    categories={[&quot;Income&quot;, &quot;Expenses&quot;]}<br>    valueFormatter={(number: number) =&gt;<br>      `₹${Intl.NumberFormat(&quot;en-IN&quot;).format(number).toString()}`<br>    }<br>    onValueChange={(v) =&gt; console.log(v)}<br>  /&gt;<br>);</pre><p>Create a page that will show the bar chart. Say we place this at <em>app/bar-chart/page.tsx. </em>It will have the following code.</p><pre>import { fetchBarChartData } from &quot;@/app/lib/data&quot;;<br>import { BarChartCustom } from &quot;@/components/ui/custom-bar-chart&quot;;<br>import { Suspense } from &quot;react&quot;;<br><br>export default async function Page() {<br>  const barChartData = await fetchBarChartData();<br>  return (<br>    &lt;main&gt;<br>      &lt;h1 className=&quot;mb-4 text-xl md:text-2xl&quot;&gt;<br>        Income and Expenses<br>      &lt;/h1&gt;<br>      &lt;div className=&quot;mt-6&quot;&gt;<br>        &lt;Suspense fallback={&lt;p&gt;Loading...&lt;/p&gt;}&gt;<br>          &lt;BarChartCustom barChartData={barChartData} /&gt;<br>        &lt;/Suspense&gt;<br>      &lt;/div&gt;<br>    &lt;/main&gt;<br>  );<br>}</pre><p>We keep the <em>BarChartCustom </em>component inside a <em>&lt;Suspense&gt;&lt;/Suspense&gt;</em> so that the whole page doesn’t wait for the chart to load.</p><p>And that’s it! When you load the url <em>“/bar-chart”</em>, you should be able to see the bar chart load with the months in the X axis and the amount in the Y axis. The bars for Income and Expenses will be stacked next to each other for each month we passed using the data.</p><p>The end result will look like the figure below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/860/1*vydTpfRPQ7_siSoYN4R__Q.png" /></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6fccd235c9d4" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Creating a contact form using React JS and validating it using React Hook Form]]></title>
            <link>https://medium.com/@blenderous/creating-a-contact-form-using-react-js-and-validating-it-using-react-hook-form-16f6c8680425?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/16f6c8680425</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[css-animation]]></category>
            <category><![CDATA[react-hook-form]]></category>
            <category><![CDATA[useeffect-hook]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Sun, 01 Dec 2024 15:46:47 GMT</pubDate>
            <atom:updated>2024-12-02T14:05:01.934Z</atom:updated>
            <content:encoded><![CDATA[<p>React Hook Form is a popular library for building forms in React applications. It simplifies the process of managing form state, validation, and submission. By leveraging React Hooks, we can provide a declarative and performant way to handle forms.</p><p>Let’s build a simple contact form and validate it using React Hook Form.</p><p>This articles assumes that you already know these three things:</p><ol><li>How to create components in React JS.</li><li>How to create and use custom hooks</li><li>How to create a certain look and feel using Tailwind CSS.</li></ol><p>Say our contact form should look like the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1014/1*TRu4mF8TkuM7_G9qz1nfFQ.png" /></figure><h3>Creating the form and adding validation</h3><p>First we install <em>react-hook-form.</em></p><pre>npm install react-hook-form</pre><p>Then, we make some imports.</p><pre>import { useForm } from &quot;react-hook-form&quot;;<br>import { useSendEmail } from &quot;@/app/utils/useSendEmail&quot;;</pre><p><em>useSendEmail</em> is a custom hook that exposes the state variables <em>success</em>, <em>loading</em>, <em>error</em> and a function <em>handleSendEmail. </em>If you are curious, you can view the code of this hook <a href="https://gist.github.com/blenderous/2587ad9d6cedd72f5da8475af69e3b96">here</a>.</p><p>The JSX of the form component would look like this:</p><pre>export default function ContactForm() {<br><br>  return (<br>    &lt;form className=&quot;mx-auto max-w-md&quot;&gt;<br>      &lt;div className=&quot;mb-5 flex gap-2&quot;&gt;<br>        &lt;div&gt;<br>          &lt;label<br>            htmlFor=&quot;firstName&quot;<br>            className=&quot;mb-2 block text-lg text-brand-brown&quot;<br>          &gt;<br>            First Name<br>          &lt;/label&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            id=&quot;firstName&quot;<br>            className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>            placeholder=&quot;&quot;<br>          /&gt;<br>        &lt;/div&gt;<br>        &lt;div&gt;<br>          &lt;label<br>            htmlFor=&quot;lastName&quot;<br>            className=&quot;mb-2 block text-lg text-brand-brown&quot;<br>          &gt;<br>            Last Name<br>          &lt;/label&gt;<br>          &lt;input<br>            type=&quot;text&quot;<br>            id=&quot;lastName&quot;<br>            className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>            placeholder=&quot;&quot;<br>          /&gt;<br>        &lt;/div&gt;<br>      &lt;/div&gt;<br>      &lt;div className=&quot;mb-5&quot;&gt;<br>        &lt;label<br>          htmlFor=&quot;emailId&quot;<br>          className=&quot;mb-2 block text-lg text-brand-brown&quot;<br>        &gt;<br>          Your email<br>        &lt;/label&gt;<br>        &lt;input<br>          type=&quot;email&quot;<br>          id=&quot;emailId&quot;<br>          className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>          placeholder=&quot;&quot;<br>        /&gt;<br>      &lt;/div&gt;<br>      &lt;div className=&quot;mb-5&quot;&gt;<br>        &lt;label<br>          htmlFor=&quot;message&quot;<br>          className=&quot;mb-2 block text-lg text-brand-brown&quot;<br>        &gt;<br>          Your message<br>        &lt;/label&gt;<br>        &lt;textarea<br>          id=&quot;message&quot;<br>          className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>          placeholder=&quot;&quot;<br>          rows={4}<br>        &gt;&lt;/textarea&gt;<br>      &lt;/div&gt;<br>      &lt;div className=&quot;&quot;&gt;<br>        &lt;button type=&quot;submit&quot;&gt;Submit&lt;/button&gt;<br>      &lt;/div&gt;<br>    &lt;/form&gt;<br>  );<br>}</pre><p>We define the type for our form data.</p><pre>export type FormData = {<br>  firstName: string;<br>  lastName: string;<br>  email: string;<br>  message: string;<br>};</pre><p>We de-structure the custom hook <em>useSendEmail.</em></p><pre>export default function ContactForm() {<br>  const [success, loading, error, handleSendEmail] = useSendEmail();<br><br>  return (<br>    &lt;form className=&quot;mx-auto max-w-md&quot;&gt;<br>      {/* ... */}<br>    &lt;/form&gt;<br>  )<br>}<br></pre><p>We de-structure the <em>useForm</em> hook imported from <em>react-hook-form</em> and access the variables <em>regi</em>ster, <em>handleSubmit</em>, <em>formState</em> and <em>reset</em>. We then create a function called <em>onSubmit</em> like you see below<em>. </em>We also add an <em>onSubmit</em> attribute to the<em> form </em>element like below<em>.</em></p><pre>export default function ContactForm() {<br>  const [success, loading, error, handleSendEmail] = useSendEmail();<br>  <br>  const {<br>    register,<br>    handleSubmit,<br>    formState: { errors },<br>    reset,<br>  } = useForm&lt;FormData&gt;();<br><br>  const onSubmit = (data: FormData) =&gt; {<br>    handleSendEmail(data);<br>  };<br><br>  return (<br>    &lt;form onSubmit={handleSubmit(onSubmit)} className=&quot;mx-auto max-w-md&quot;&gt;<br>      {/* ... */}<br>    &lt;/form&gt;<br>  )<br>}</pre><p>To add an error message in case the <em>firstName</em> field is left blank, we add the following code to the JSX. The message “Please enter your first name” in a <em>p</em> tag will be shown in case the user submits the form without entering the first name.</p><pre>export default function ContactForm() {<br>  <br>  // ...<br><br>  return (<br>    &lt;form onSubmit={handleSubmit(onSubmit)} className=&quot;mx-auto max-w-md&quot;&gt;<br>      {/* ... */}<br>          &lt;input<br>            type=&quot;text&quot;<br>            id=&quot;firstName&quot;<br>            className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>            placeholder=&quot;&quot;<br>            {...register(&quot;firstName&quot;, { required: true })}<br>          /&gt;<br>          {errors.firstName &amp;&amp; (<br>            &lt;p className=&quot;text-red-400&quot;&gt;Please enter your first name&lt;/p&gt;<br>          )}<br>      {/* ... */}<br>    &lt;/form&gt;<br>  )<br>}</pre><p>Similarly, we can add validation for the <em>lastName </em>and the <em>message</em> fields.</p><p>For the <em>email</em> field though there is a slight difference. We need to check if the field is empty or not and also if the entered value is a valid email address. For this, we add the following code to the JSX.</p><pre>export default function ContactForm() {<br>  <br>  // ...<br><br>  return (<br>    &lt;form onSubmit={handleSubmit(onSubmit)} className=&quot;mx-auto max-w-md&quot;&gt;<br>      {/* ... */}<br>        &lt;input<br>          type=&quot;email&quot;<br>          id=&quot;emailId&quot;<br>          className=&quot;block w-full rounded-lg border-2 border-brand-brown bg-gray-50 p-2.5 text-lg text-brand-brown focus:border-brand-dark-brown focus:ring-brand-dark-brown&quot;<br>          placeholder=&quot;&quot;<br>          {...register(&quot;email&quot;, {<br>            required: &quot;Please enter email&quot;,<br>            pattern: {<br>              value:<br>                /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\.[A-Z]{2,}$/,<br>              message: &quot;Please enter a valid email&quot;,<br>            },<br>          })}<br>        /&gt;<br>        {errors.email &amp;&amp; &lt;p className=&quot;text-red-400&quot;&gt;{errors.email.message}&lt;/p&gt;}<br>      {/* ... */}<br>    &lt;/form&gt;<br>  )<br>}</pre><p>And that’s it. We have added validation to our form using React Hook Form.</p><h3>Bonus: Adding loading state to the submit button and displaying a success or error message</h3><p>What we are trying to achieve is the following:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*hyFZOP1C7DlarpT2xO0ZSQ.gif" /></figure><p>On entering all fields of the form and clicking on the “Submit” button, the button should expand its width and show a loading spinner until the success state or error state is attained. To the right of the button, the success or error message should be displayed.</p><p>For achieving this, we use the state variables already de-structured from the <em>useSendEmail </em>custom hook.</p><pre>export default function ContactForm() {<br>  const [success, loading, error, handleSendEmail] = useSendEmail();<br><br>  return (<br>      {/* ... */}<br>  )<br>}</pre><p>We add a couple of more imports.</p><pre>import clsx from &quot;clsx&quot;;<br>import { useEffect, useState } from &quot;react&quot;;</pre><p>The <em>clsx </em>library is used to conditionally add CSS classes to an element. It works in the following way:</p><pre>className={clsx(&quot;base-class&quot;, {<br>  &quot;class-1&quot;: condition1,<br>  &quot;class-2&quot;: condition2,<br>  &quot;class-3&quot;: condition3,<br>})}</pre><p>The <em>base-class</em> is the class that is applied no matter what conditions are satisfied or not. The class <em>class-1</em> is applied when the value of <em>condition1</em> evaluates to true, <em>class-2 </em>is applied when the value of <em>condition2 </em>evaluates to true and so on.</p><p>Now, in the <em>ContactForm</em> component, we create a state variable called <em>showLoadingSpinner </em>to show or hide the loading spinner and then using the <em>useEffect</em> hook, set it to <em>true</em> with a delay of <em>300ms</em> if the <em>loading</em> state is set to <em>true </em>(to wait for the button to expand); else, if the <em>loading</em> state is set to <em>false</em>, we set <em>showLoadingSpinner</em> to <em>false</em>.</p><pre>const [showLoadingSpinner, setShowLoadingSpinner] = useState(false);<br><br>useEffect(() =&gt; {<br>  if (loading) {<br>    setTimeout(() =&gt; {<br>      setShowLoadingSpinner(true);<br>    }, 300);<br>  } else {<br>    setShowLoadingSpinner(false);<br>  }<br>}, [loading]);</pre><p>Next, we update the JSX of the <em>ContactForm</em> component. We add different classes to the Submit button using the <em>clsx</em> tool, one for the normal state and one for the expanded state depending on the <em>loading</em> state. We also include a loading spinner inside the Submit button and show it according to the state variable <em>showLoadingSpinner</em>. The loading spinner is rendered using a simple CSS class, <em>loading-spinner</em>. We also add success and failure messages next to the Submit button.</p><pre>export default function ContactForm() {<br>  {/* ... */}<br><br>  return (<br>    {/* ... */}<br>    &lt;div className=&quot;flex items-center&quot;&gt;<br>      &lt;div&gt;<br>        &lt;button<br>          type=&quot;submit&quot;<br>          className={clsx(&quot;btn transition-all ease-in-out duration-300&quot;, {<br>            &quot;w-40&quot;: !loading,<br>            &quot;w-56&quot;: loading,<br>          })}<br>          disabled={loading}<br>        &gt;<br>          &lt;span className=&quot;flex items-center&quot;&gt;<br>            &lt;span&gt;Submit&lt;/span&gt;<br>            {showLoadingSpinner &amp;&amp; (<br>              &lt;span className=&quot;loading-spinner ml-4&quot;&gt;&lt;/span&gt;<br>            )}<br>          &lt;/span&gt;<br>        &lt;/button&gt;<br>      &lt;/div&gt;<br>      {success &amp;&amp; !loading &amp;&amp; (<br>        &lt;p className=&quot;ml-5&quot;&gt;Form submitted successfully!&lt;/p&gt;<br>      )}<br>      {error &amp;&amp; !loading &amp;&amp; (<br>        &lt;p className=&quot;ml-5 text-red-400&quot;&gt;Oops! Something went wrong.&lt;/p&gt;<br>      )}<br>    &lt;/div&gt;<br>  )<br>}</pre><pre>.loading-spinner {<br>  width: 40px;<br>  height: 40px;<br>  border: 5px solid #c47d0b;<br>  border-bottom-color: transparent;<br>  border-radius: 50%;<br>  display: inline-block;<br>  box-sizing: border-box;<br>  animation: rotation 1s linear infinite;<br>}</pre><p>And that’s it! We have a Submit button that animates and shows a loading indicator when clicked on and the success or failure message is shown next to it when the form is submitted to the server.</p><p>We finally have one more thing left to do. We need to clear the form in case it is successfully submitted. For this, we use the <em>reset</em> function that we de-structured from the <em>useForm </em>hook.</p><pre>export default function ContactForm() {<br>  {/* ... */}<br>  <br>  const {<br>    register,<br>    handleSubmit,<br>    formState: { errors },<br>    reset,<br>  } = useForm&lt;FormData&gt;();<br><br>  {/* ... */}<br><br>  return (<br>    {/* ... */}<br>  )<br>}</pre><p>We call this <em>reset </em>function in case the state of the<em> success </em>function changes to<em> true.</em> We use the useEffect hook for this.</p><pre>export default function ContactForm() {<br>  {/* ... */}<br>  <br>  useEffect(() =&gt; {<br>    if (success) {<br>      reset();<br>    }<br>  }, [success]);<br><br>  return (<br>    {/* ... */}<br>  )<br>}</pre><p>And that’s the end of this long post about how to create a contact form using React JS. We added validation to it and also added animation on submitting the form and finally showed a message of success or failure. Hope you enjoyed building this contact form along with me.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=16f6c8680425" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I developed a calendar widget using React JS and the date-fns library, a tutorial]]></title>
            <link>https://medium.com/@blenderous/how-i-developed-a-calendar-widget-using-react-js-and-the-date-fns-library-a-tutorial-d9244f35729b?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d9244f35729b</guid>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[reactjs]]></category>
            <category><![CDATA[date-fns]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Tue, 26 Nov 2024 12:26:24 GMT</pubDate>
            <atom:updated>2024-11-27T09:42:53.776Z</atom:updated>
            <content:encoded><![CDATA[<p>This is a part of the series of posts about the Habits Tracker App where one could record daily activities and visualize the activity being carried out through the days. For each activity, there is a calendar which highlights the days on which the activity was done.</p><p>This article assumes that you are familiar with beginner level React JS and Javascript. Also it’s better if you understand Tailwind CSS utility classes and CSS grid layout. I have used Typescript for this example and I recommend you use Typescript as well because it is useful to catch type errors early on in the development process.</p><p>The expected end result has to look like the following.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*TjBiggoBgK_z-Ct3jcMoOQ.png" /></figure><p>The widget takes three props.</p><ol><li>An array of days in the form of “yyyy-mm-dd” which represents the days on which the activity was carried out.</li><li>A string that represents the timestamp of the moment when the activity was created.</li><li>A string representing the hex value of the colour that denotes the activity.</li></ol><p>So initially, the code looks like this:</p><pre>export default function MonthlyHighlighterWidget({<br>  days,<br>  createdAt,<br>  paintColour,<br>}: {<br>  days: string[];<br>  createdAt: string;<br>  paintColour: string;<br>}) {<br>  return &lt;&gt;&lt;/&gt;<br>}</pre><p>The entire code for this widget can be found on <a href="https://gist.github.com/blenderous/bf9f348ea0b3e2b13a0cd4282e79a422">this gist</a>. Feel free to skip the explanation below and look at the code directly to know how it works. I have heavily commented the lines for readability.</p><p>We then declare a type called <em>shownDay</em> which is as follows:</p><pre>export type ShownDay = {<br>  date: Date;<br>  dayOfWeek: number; // 0 represents Sunday, 1 represents Monday and so on<br>  habitDone: boolean;<br>  validDay: boolean; // the day is not valid before createdAt day and after today<br>};</pre><p>From here on, we will be heavily using the functions that are given under the <em>date-fns</em> library. It is a library to manipulate dates in different ways.</p><p>Inside the <em>M</em>onthly<em>HighlighterWidget</em>, first, we get <em>today</em>.</p><pre>// today<br>const today = new Date();</pre><p>We need to load all the days that need to be displayed in the <em>MonthlyHighlighterWidget. </em>We begin by loading the first day among all the days that need to be loaded (the function <em>startOfMonth</em> comes from the <em>date-fns</em> library).</p><pre>// first day among all days to be loaded<br>const firstDay = startOfMonth(createdAt);</pre><p>Next, we load the last day among all the days that need to be loaded (again, the function <em>endOfMonth</em> comes from the <em>date-fns</em> library).</p><pre>// last day among all days to be loaded<br>const lastDay = endOfMonth(today);</pre><p>Now we load all the days in between (with <em>eachDayOfInterval</em> coming from <em>date-fns</em>).</p><pre>// all the days that need to be shown<br>const allDays = eachDayOfInterval({<br>  start: firstDay,<br>  end: lastDay,<br>});</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*pcOClIiAQTuvUsn3_XB2TQ.png" /><figcaption>The array <em>allDays represents all the days right from the first day of the month on which createdAt (28th August 2024) exists up until the last day of the month on which today (26th November 2024) exists.</em></figcaption></figure><p>Next, we load the list of months between <em>firstDay</em> and <em>lastDay</em> using the <em>eachMonthOfInterval</em> function of <em>date-fns</em>. This function loads an array of the first days of each month between <em>firstDay</em> and <em>lastDay</em>.</p><pre>// list of first days of each month<br>const allMonths = eachMonthOfInterval({<br>  start: firstDay,<br>  end: lastDay,<br>});<br>// find the number of months shown<br>const nMonths = allMonths.length;</pre><p>Say we call the month currently shown in the calendar, the <em>ithMonth</em>. The initial value of <em>ithMonth</em> will be the index of the present month in the array <em>allMonths.</em> We use the <em>isSameDay</em> function from <em>date-fns</em>.</p><pre>// initial value of ithMonth<br>// (find out what is the index of the current month in the allMonths array)<br>const ithMonthInitialValue = allMonths.findIndex((beginningDayOfMonth) =&gt;<br>  isSameDay(beginningDayOfMonth, startOfMonth(today))<br>);</pre><p>We then create a state variable called <em>ithMonth</em> and set its initial value to<em> ithMonthInitialValue.</em></p><pre>// month index<br>const [ithMonth, setIthMonth] = useState(ithMonthInitialValue);</pre><p>Then, we find the index of the first day of the <em>ithMonth</em> and declare it as <em>j</em> and find the index of the last day of <em>ithMonth</em> and declare it as <em>k</em>. Don’t worry, it will make sense why we are doing this soon.</p><pre>// first day of ith month<br>let firstDayOfMonth = allMonths[ithMonth];<br>let firstDayOfMonthDay = getDay(firstDayOfMonth); // returns 0 for Sunday, 1 for Monday and so on<br><br>// index of, first day of ith month (in the allDays array)<br>let j = allDays.findIndex((dayElement) =&gt;<br> isSameDay(dayElement, firstDayOfMonth)<br>);<br><br>// last day of ith month<br>let lastDayOfMonth = endOfMonth(allMonths[ithMonth]);<br><br>// index of, last day of ith month (in the allDays array)<br>let k = allDays.findIndex((dayElement) =&gt;<br> isSameDay(dayElement, lastDayOfMonth)<br>);</pre><p>Next, we write a function that decides if a certain day is valid or not. A day is valid if it is on or after the <em>createdAt </em>date and on or before today’s date.</p><pre><br>// function to check if given day is a valid day<br>function isValidDay(day: Date, createdAt: string, today: Date) {<br>  // if given day is same as createdAt day or if given day is same as today<br>  if (isSameDay(day, createdAt) || isSameDay(day, today)) {<br>    return true;<br>  }<br>  // if given day is before createdAt or if given day is after today<br>  if (isBefore(day, createdAt) || isAfter(day, today)) {<br>    return false;<br>  }<br>  // if given day is between createdAt and today<br>  else {<br>    return true;<br>  }<br>}</pre><p>We calculate different properties of each day in the <em>allDays</em> array like so:</p><pre>// calculate different properties of each of the days in the allDays array<br>const allShownDays: ShownDay[] = allDays.map((day) =&gt; ({<br>  date: day,<br>  habitDone: days.includes(format(day, &quot;yyyy-MM-dd&quot;)),<br>  dayOfWeek: getDay(day),<br>  validDay: isValidDay(day, createdAt, today),<br>}));</pre><p>We now have an <em>allShownDays</em> array of type <em>ShownDay[]</em> which is the information of all the days that needs to be shown in the calendar right from the month on which <em>createdAt</em> happened until the month of today. The days that will be displayed as the <em>ithMonth</em> are between the indices <em>j</em> and <em>k</em> that we declared before.</p><p>Finally, we declare the functions that need to be called when the “Next” and “Previous” buttons are clicked.</p><pre>// on clicking the &quot;Previous&quot; button<br>const handlePreviousMonth = () =&gt; {<br>  setIthMonth((prevIthMonth) =&gt;<br>    prevIthMonth &gt; 0 ? prevIthMonth - 1 : prevIthMonth<br>  );<br>};<br><br>// on clicking the &quot;Next&quot; button<br>const handleNextMonth = () =&gt; {<br>  setIthMonth((prevIthMonth) =&gt;<br>    prevIthMonth &lt; nMonths - 1 ? prevIthMonth + 1 : prevIthMonth<br>  );<br>};</pre><p>And, the JSX for the calendar widget would look like this:</p><pre>return (<br>  &lt;&gt;<br>    &lt;div className=&quot;bg-mildGreen-100 rounded-xl p-4 mt-4&quot;&gt;<br>      &lt;p className=&quot;text-themeBrown-800 mb-2&quot;&gt;<br>        {format(allMonths[ithMonth], &quot;MMMM yyyy&quot;)}<br>      &lt;/p&gt;<br>      &lt;ul className=&quot;list-none grid grid-cols-7 grid-flow-row gap-2&quot;&gt;<br>        {/* List of days (Sunday to Saturday) */}<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Su&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Mo&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Tu&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;We&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Th&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Fr&lt;/li&gt;<br>        &lt;li className=&quot;text-inactiveGreen-300 text-center&quot;&gt;Sa&lt;/li&gt;<br>        {/* slice of ith month among the array allShownDays */}<br>        {allShownDays.slice(j, k + 1).map((shownDay, index) =&gt; (<br>          &lt;li<br>            key={format(shownDay.date, &quot;yyyy-MM-dd&quot;)}<br>            className={clsx(&quot;rounded-md p-[6px] flex place-content-center&quot;, {<br>              &quot;bg-inactiveGreen-200&quot;: shownDay.validDay,<br>              &quot;bg-inactiveGreen-100 text-inactiveGreen-300&quot;:<br>                !shownDay.validDay,<br>              &quot;border-2 border-themeBrown-800 p-[14px]&quot;: isSameDay(<br>                shownDay.date,<br>                today<br>              ),<br>              &quot;col-start-1&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 0,<br>              &quot;col-start-2&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 1,<br>              &quot;col-start-3&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 2,<br>              &quot;col-start-4&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 3,<br>              &quot;col-start-5&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 4,<br>              &quot;col-start-6&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 5,<br>              &quot;col-start-7&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 6,<br>            })}<br>            style={<br>              shownDay.habitDone<br>                ? { backgroundColor: paintColour, color: &quot;white&quot; }<br>                : {}<br>            }<br>          &gt;<br>            {/* date */}<br>            &lt;p&gt;{format(shownDay.date, &quot;dd&quot;)}&lt;/p&gt;<br>          &lt;/li&gt;<br>        ))}<br>      &lt;/ul&gt;<br>    &lt;/div&gt;<br>    &lt;p className=&quot;mt-4 pb-4 flex justify-between gap-4&quot;&gt;<br>      {/* Previous month button */}<br>      &lt;button<br>        disabled={ithMonth === 0}<br>        className={clsx(&quot;flex-grow p-4&quot;, {<br>          &quot;bg-inactiveBrown text-inactiveBrownForeground&quot;: ithMonth === 0,<br>        })}<br>        onClick={() =&gt; handlePreviousMonth()}<br>        role=&quot;button&quot;<br>      &gt;<br>        Previous<br>      &lt;/button&gt;<br>      {/* Next month button */}<br>      &lt;button<br>        disabled={ithMonth === nMonths - 1}<br>        className={clsx(&quot;flex-grow p-4&quot;, {<br>          &quot;bg-inactiveBrown text-inactiveBrownForeground&quot;:<br>            ithMonth === nMonths - 1,<br>        })}<br>        onClick={() =&gt; handleNextMonth()}<br>        role=&quot;button&quot;<br>      &gt;<br>        Next<br>      &lt;/button&gt;<br>    &lt;/p&gt;<br>  &lt;/&gt;<br>);</pre><p>Note that the list of days is a <em>ul</em> with the Tailwind classes <em>grid, grid-cols-7, grid-flow-row </em>and<em> gap-2, </em>which means it’s a grid with seven columns and elements in the grid flow in the direction of row (from left to right).</p><pre>className={clsx(&quot;rounded-md p-[6px] flex place-content-center&quot;, {<br>  &quot;bg-inactiveGreen-200&quot;: shownDay.validDay,<br>  &quot;bg-inactiveGreen-100 text-inactiveGreen-300&quot;:<br>    !shownDay.validDay,<br>  &quot;border-2 border-themeBrown-800 p-[14px]&quot;: isSameDay(<br>    shownDay.date,<br>    today<br>  ),<br>  &quot;col-start-1&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 0,<br>  &quot;col-start-2&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 1,<br>  &quot;col-start-3&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 2,<br>  &quot;col-start-4&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 3,<br>  &quot;col-start-5&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 4,<br>  &quot;col-start-6&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 5,<br>  &quot;col-start-7&quot;: index === 0 &amp;&amp; firstDayOfMonthDay === 6,<br>})}</pre><p>In the above <em>className</em> attribute of an <em>li</em> element that shows one particular date, we have used the <em>clsx</em> tool to conditionally add classes<em>.</em> The <em>clsx</em> tool works in the following way:</p><pre>className={clsx(&quot;base-class&quot;, {<br>  &quot;class-1&quot;: condition1,<br>  &quot;class-2&quot;: condition2,<br>  &quot;class-3&quot;: condition3,<br>})}</pre><p>The <em>base-class</em> is the class that is applied no matter what conditions are satisfied or not. The class <em>class-1</em> is applied when the value of <em>condition1</em> evaluates to true, <em>class-2 </em>is applied when the value of <em>condition2 </em>evaluates to true and so on.</p><p>Now back to our <em>li </em>element. We have certain classes for if the day is a valid day (if it is on or after <em>createdAt</em> date or on or before today). We achieve this by using the variable <em>shownDay.validDay</em>. We have certain classes for the opposite of this which is if <em>shownDay.validDay</em> is false. Then we add a border of 2px to the day if it is same as today (so we have today’s date highlighted in the calendar). Finally, we add the class <em>col-start-n</em> to the first <em>li </em>in the array (hence we use the condition <em>index === 0</em>) where <em>n</em> is a number between 1 and 7 depending on what day is the first day which can be obtained from the variable <em>firstDayOfMonthDay</em>.</p><p>We still have one more thing to add to the day element. That is, if the activity or habit was done on that particular day or not. For this, we can add inline styles like so (the value of <em>paintColour</em> can be obtained from the prop we passed to the <em>MonthlyHighlighterWidget</em> component):</p><pre>style={<br>  shownDay.habitDone<br>    ? { backgroundColor: paintColour, color: &quot;white&quot; }<br>    : {}<br>}</pre><p>And that’s it. We have a calendar widget which is highlighted on the days a particular activity has been carried out, which highlights the current day and has a disabled style for all the days that are not valid. It has the days of the week labelled above and the name of the month and the year written at the top.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/694/1*Dd5kcE2QiIifcglWH_yLPQ.png" /></figure><p>Thank you for following this tutorial till the end.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d9244f35729b" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[How I created a checkbox that registers it’s value on click (like a “like” button).]]></title>
            <link>https://medium.com/@blenderous/how-i-created-a-checkbox-that-registers-its-value-on-click-like-a-like-button-439921275d9d?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/439921275d9d</guid>
            <category><![CDATA[supabase]]></category>
            <category><![CDATA[dynamic-button]]></category>
            <category><![CDATA[typescript]]></category>
            <category><![CDATA[tailwind-css]]></category>
            <category><![CDATA[nextjs]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Thu, 21 Nov 2024 14:07:45 GMT</pubDate>
            <atom:updated>2024-11-21T14:07:45.927Z</atom:updated>
            <content:encoded><![CDATA[<p>This article assumes that you already know how to create a web application using Next JS, Supabase, Typescript and Tailwind CSS.</p><p>I have created a simple Habit Tracker Application which is used to track habits everyday. The application has a “Today” page where all habits added by the user are listed. The user can check or uncheck the habits that are done or not done on that particular day.</p><p>This is what the page looks like:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*aBX0Jx8CwS39haJfTrqhfw.png" /><figcaption>Note that this is not a form where you have checkboxes and a submit button where the value is submitted after the checkboxes are checked and the submit button is clicked. These checkboxes are updated real-time.</figcaption></figure><h3>What we need to build</h3><p>The habits are listed in the form of checkboxes next to buttons and clicking on the checkbox should send a message to the server that this particular habit has been completed and clicking on the button again should send a message that the habit has not been completed on that particular day.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/870/1*Muawnq3OkxAu5EXibz5q1A.png" /></figure><h3>Let us see how to implement this functionality step by step</h3><ol><li>We add a <em>DayButton</em> component and get the look and feel right using Tailwind CSS. We also add an <em>onClick</em> event handler to the button and call it <em>handleClick</em>.</li></ol><pre>&quot;use client&quot;;<br><br>export default function DayButton({ habit, userId }: DayButtonProps) {<br>  const today: string = format(new Date(), &quot;yyyy-MM-dd&quot;);<br>  const [done, setDone] = useState&lt;boolean&gt;(habit.done);<br><br>  const handleClick = async () =&gt; {<br>    setDone((done) =&gt; !done);<br>  };<br><br>  return (<br>    &lt;button<br>      role=&quot;button&quot;<br>      className=&quot;text-white text-2xl text-left w-full p-0&quot;<br>      onClick={handleClick}<br>    &gt;<br>      &lt;span<br>        style={{ backgroundColor: habit.colour }}<br>        className=&quot;relative rounded-md inline-block w-full p-2 pr-12&quot;<br>      &gt;<br>        {habit.name}<br>        &lt;span className=&quot;absolute top-0 right-0 h-full flex items-center&quot;&gt;<br>          &lt;span className=&quot;w-8 h-8 mx-2 inline-block rounded-md bg-white text-themeBrown-800&quot;&gt;<br>            {done &amp;&amp; &lt;CheckIcon /&gt;}<br>          &lt;/span&gt;<br>        &lt;/span&gt;<br>      &lt;/span&gt;<br>    &lt;/button&gt;<br>  );<br>}</pre><p>This would give us a checkbox which toggles between the states of checked and unchecked when we click on it.</p><p>2. Now let’s update the <em>handleClick</em> function and add an SQL query to add the day to the <strong>days</strong> table if the box is checked or delete the entry from the days table in case the box is unchecked.</p><p>The <strong>days</strong> table looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SDfZxs4VMkmbuld8ny6eFw.png" /></figure><p>And the <em>handleClick</em> function would look like this:</p><pre>const handleClick = async () =&gt; {<br>    setDone((done) =&gt; !done);<br><br>    const supabase = createClient();<br>    // if habit is already done<br>    if (done) {<br>      // delete the row<br>      const { error } = await supabase<br>        .from(&quot;days&quot;)<br>        .delete()<br>        .match({ user_id: userId, habit_id: habit.id, day: today });<br>      if (!error) {<br>        setDone(false);<br>      } else {<br>        console.error(error.message);<br>      }<br>    } else {<br>      // add day as today for the particular habit<br>      const { error } = await supabase<br>        .from(&quot;days&quot;)<br>        .upsert({ user_id: userId, habit_id: habit.id, day: today });<br>      if (!error) {<br>        setDone(true);<br>      } else {<br>        console.error(error.message);<br>      }<br>    }<br>  };</pre><p>Notice that using <em>Supabase</em>’s API, we are deleting a row from <strong>days</strong> table if the state variable <em>done</em> is true and then we the entry is deleted we set the <em>done</em> state variable to false.</p><p>Similarly when the state variable <em>done</em> is false, we “<a href="https://supabase.com/docs/reference/javascript/upsert">upsert</a>” a new row to the <strong>days</strong> table and if is added without any error, we set the <em>done </em>variable to true.</p><p>The result is a checkbox that updates the database according to it’s state.</p><p>3. But there’s a problem here. If we tap on the checkbox quickly one time after the other, we send a request to the server that many times, which could be avoided. Also, when the network speed is throttled to Regular 2G and the user checks and unchecks quickly in succession, the checkbox shows a checked and unchecked state another time; like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1000/1*xtwOMZR14Mriwv1iPACDVg.gif" /></figure><p>3. <strong>Debouncing</strong> is a technique used to delay the execution of a function until a certain amount of time has passed since the last time it was invoked. This is particularly useful in scenarios where a function might be called multiple times in a short period, such as during rapid user input.</p><p>After adding <strong>debouncing</strong>, this would be our final code (I have added a debounce interval of 600ms, which means that a user click would be considered only if there is no click following it for 600ms):</p><pre>export default function DayButton({ habit, userId }: DayButtonProps) {<br>  const today: string = format(new Date(), &quot;yyyy-MM-dd&quot;);<br>  const [done, setDone] = useState&lt;boolean&gt;(habit.done);<br>  const debounceTimeout = useRef&lt;NodeJS.Timeout | null&gt;(null);<br><br>  const handleClick = async () =&gt; {<br>    setDone((done) =&gt; !done);<br><br>    if (debounceTimeout.current) {<br>      clearTimeout(debounceTimeout.current);<br>    }<br><br>    debounceTimeout.current = setTimeout(async () =&gt; {<br>      const supabase = createClient();<br>      // if habit is already done<br>      if (done) {<br>        // delete the row<br>        const { error } = await supabase<br>          .from(&quot;days&quot;)<br>          .delete()<br>          .match({ user_id: userId, habit_id: habit.id, day: today });<br>        if (!error) {<br>          setDone(false);<br>        } else {<br>          console.error(error.message);<br>        }<br>      } else {<br>        // add day as today for the particular habit<br>        const { error } = await supabase<br>          .from(&quot;days&quot;)<br>          .upsert({ user_id: userId, habit_id: habit.id, day: today });<br>        if (!error) {<br>          setDone(true);<br>        } else {<br>          console.error(error.message);<br>        }<br>      }<br>    }, 600);<br>  };<br><br>  return (<br>    &lt;button<br>      role=&quot;button&quot;<br>      className=&quot;text-white text-2xl text-left w-full p-0&quot;<br>      onClick={handleClick}<br>    &gt;<br>      &lt;span<br>        style={{ backgroundColor: habit.colour }}<br>        className=&quot;relative rounded-md inline-block w-full p-2 pr-12&quot;<br>      &gt;<br>        {habit.name}<br>        &lt;span className=&quot;absolute top-0 right-0 h-full flex items-center&quot;&gt;<br>          &lt;span className=&quot;w-8 h-8 mx-2 inline-block rounded-md bg-white text-themeBrown-800&quot;&gt;<br>            {done &amp;&amp; &lt;CheckIcon /&gt;}<br>          &lt;/span&gt;<br>        &lt;/span&gt;<br>      &lt;/span&gt;<br>    &lt;/button&gt;<br>  );<br>}</pre><p>So, that’s a wrap. I know I have skipped through much of the implementation details of the application itself but that is beyond the scope of this article.</p><p>Also there are plenty of resources which you can find online to learn how to build an application using Next JS, Supabase, Typescript and Tailwind CSS. There is <a href="https://egghead.io/lessons/deploy-next-js-app-router-project-to-production-with-vercel">this very resourceful tutorial</a> that shows how to build a Twitter clone.</p><p>Happy building!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=439921275d9d" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[19-Aug-2017 : A quick look]]></title>
            <link>https://medium.com/@blenderous/19-aug-2017-a-quick-look-d82b96b1169c?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/d82b96b1169c</guid>
            <category><![CDATA[india]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Fri, 18 Aug 2017 19:15:28 GMT</pubDate>
            <atom:updated>2017-08-18T19:15:28.939Z</atom:updated>
            <content:encoded><![CDATA[<h3>The Gorakhpur Tragedy</h3><p>http://indianexpress.com/article/india/gorakhpur-tragedy-brings-under-scanner-newborn-care-units-in-hospitals-deaths-yogi-adityanath-brd-medical-college-uttar-pradesh-encephalitis-4795487/</p><h3>Tamil Nadu Education : Exemption from NEET</h3><p>http://www.livemint.com/Education/AIsFkw3Od6m8yE6nR0NE9J/Centre-to-cooperate-if-Tamil-Nadu-brings-ordinance-for-NEET.html</p><h3>Tamil Nadu Politics : Probe into Jayalalitha’ s death</h3><p>http://www.livemint.com/Politics/7UwhAnYMFYRvM2FKaRrv3N/Tamil-Nadu-govt-announces-probe-into-Jayalalithaas-death.html</p><h3>Bengaluru : Inauguration of Indira canteen</h3><p>http://www.livemint.com/Politics/1zPK1tpF5pbODCjHBuK3pJ/Rahul-Gandhi-launches-Indira-Canteen-in-Bengaluru.html</p><h3>Economics : RBI’s lowering of repo rate</h3><p>http://indianexpress.com/article/opinion/columns/reserve-bank-of-india-rbi-repo-rate-cut-cautious-gdp-demonetisation-4801713/</p><h3>Prime Minister’s speech on Independence day</h3><p>http://www.livemint.com/Politics/QfyCWRmJFnqDagH5CYeizL/Independence-Day-2017-Live-Prime-Minister-Narendra-Modi-add.html</p><h3>Yashwant Sinha demands centre’s views on Article 35A</h3><p>http://m.jagran.com/news/national-central-government-should-declear-his-point-on-article-35a-says-yashvant-sinha-16562971.html</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d82b96b1169c" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Farmer suicides rise in India as climate warms, shows study — Livemint]]></title>
            <link>https://medium.com/@blenderous/farmer-suicides-rise-in-india-as-climate-warms-shows-study-livemint-842406a2741c?source=rss-595af50637b3------2</link>
            <guid isPermaLink="false">https://medium.com/p/842406a2741c</guid>
            <category><![CDATA[opinion]]></category>
            <category><![CDATA[india]]></category>
            <category><![CDATA[sharing]]></category>
            <category><![CDATA[news]]></category>
            <dc:creator><![CDATA[Harish Prabhu Veerasekaran]]></dc:creator>
            <pubDate>Sat, 05 Aug 2017 05:10:55 GMT</pubDate>
            <atom:updated>2017-08-05T05:10:55.524Z</atom:updated>
            <content:encoded><![CDATA[<p>I am going to keep posting about the farmers crisis as long as the government keeps ignoring it and as long as the bourgeois think rising tomato prices is a subject matter for jokes.</p><p><a href="http://www.livemint.com/Politics/eEpkYgP1dWkVSomICmKjaK/Farmer-suicides-rise-in-India-as-climate-warms-shows-study.html">Farmer suicides rise in India as climate warms, shows study</a></p><h3>NEET: Tamil Nadu makes ‘final effort’ for exemption — Livemint</h3><p>Tamil Nadu makes a final attempt for the exemption for NEET exams by pulling strings in the political arena. Although I can totally empathise with the plight of the students who have to compete with students from all over India in an exam that promises them limited number of seats in their home state, a better viable solution for this crisis could be a push for more medical colleges in the state of Tamil Nadu.</p><p><a href="http://www.livemint.com/Education/W8TCgsESvd4J3VvoPzly7N/Tamil-Nadu-makes-final-effort-for-exemption-from-NEET.html">NEET: Tamil Nadu makes &#39;final effort&#39; for exemption</a></p><h3>Tamil Nadu fisherfolk concerned over Centre’s coastal policies — Livemint</h3><p>I condemn the insensitivity of the Centre towards the livelihood of the fishermen. There have been countless incidents of fishermen’s boats being confiscated by Sri Lanka about which there has been no visible diplomatic action is being taken.</p><p><a href="http://www.livemint.com/Politics/gtCHQEbJ9WNJwTo09UkjBM/Tamil-Nadu-fisherfolk-concerned-over-Centres-coastal-polici.html">Tamil Nadu fisherfolk concerned over Centre&#39;s coastal policies</a></p><h3>Stalin hits back after CM’s allegations against DMK — The Hindu</h3><p>Opposition leader MK Stalin and Left parties have been pointing out the ruling party’s passivity when it comes to saving water for irrigation, or vouching for students who are aspiring to study medicine or the agrarian crisis. The recent arrest of the opposition leader brings back memories of when the ruling and opposition parties constantly played blame games.</p><p><a href="http://www.thehindu.com/todays-paper/tp-national/tp-tamilnadu/wont-hesitate-to-bring-down-govt/article19393376.ece">&#39;Won&#39;t hesitate to bring down govt.&#39;</a></p><h3>Only a united AIADMK can be an ally, says BJP — The Hindu</h3><p>The ruling party has been divided for a long time and this could be a good opportunity to make a contract with the centre.</p><p><a href="http://www.thehindu.com/news/national/tamil-nadu/only-a-united-aiadmk-can-be-an-ally-says-bjp/article19403712.ece">Only a united AIADMK can be an ally, says BJP</a></p><h3>Rajiv Gandhi was genuinely interested in US military ties: CIA — Livemint</h3><p>Found an interesting article about the life of former Prime Minister, Rajiv Gandhi. I am not posting anything this week about India — China relations because I have lost hopes and I do not wish to share pessimistic worldviews.</p><p><a href="http://www.livemint.com/Politics/q6xoc52bqbTg9nDU4JIvbM/Rajiv-Gandhi-was-genuinely-interested-about-US-military-ties.html">Rajiv Gandhi was genuinely interested about US military ties: CIA</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=842406a2741c" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>