[{"content":"&ldquo;What&rsquo;s a serialVersionUID used for?&rdquo; &ldquo;What if you do not define it?&rdquo; These seem to be pretty popular Java interview questions. The second one builds on the top of the first. But, what&rsquo;s more popular than these questions are the blog posts explaining what the right answer is.\nHere&rsquo;s the gist: serialVersionUID is used to track the version of an object. Each JVM, when serializing an object, by uses this field to version it. When deserializing this object, the JVM then references the version again, to check if the objects are of the same class, and if the version does not match, throws up the InvalidClassException.\nIn what case is there a version mismatch? When you do not define the serialVersionUID, and the JVM compiler implementation differs. For example: Oracle JDK vs Amazon Corretto JDK. The autogenerated serialVersionUID may have different values.\nThe intention of using in the same serialVersionUID is that when a class changes, the version should be kept intact to allow for backward compatibility.\nFair, this is correct. But what these blogs fail to mention, and the interviewers fail to question is, why would you use Java serialization in the current age?\nIf the intention is backward compatibility amongst different JVMs, there are better encodings available - JSON, Protobuf, etc.\nOver the network transfer and serialization in most modern apps has been taken over by these encodings. It&rsquo;s human-readable, inherently backward compatible (for adding\/removing fields, not modifying fields), for plain serialization and deserialization at the very least.\nThe most underrated part - these encodings can be used to test APIs. Imagine trying to create a Java Serialized object to test a simple API with Postman.\nMost APIs now use JSON, and if you indeed want to version it, you can, without breaking the backward compatibility! No going over the hoops to learn the why&rsquo;s and when&rsquo;s to use serialVersionUID.\nWant to read more on Java Serialization? Look up these links:\nSerializable Interface Javadoc What is the purpose of Serialization in Java? Java Serialization vs JSON vs XML Towards Better Serialization ","permalink":"https:\/\/darshit.dev\/posts\/using-java-serialversionuid\/","summary":"<h3 id=\"whats-a-serialversionuid-used-for\">&ldquo;What&rsquo;s a serialVersionUID used for?&rdquo;<\/h3>\n<h3 id=\"what-if-you-do-not-define-it\">&ldquo;What if you do not define it?&rdquo;<\/h3>\n<p>These seem to be pretty popular Java interview questions. The second one builds on the top of the first. But, what&rsquo;s more popular than these questions are the blog posts explaining what the right answer is.<\/p>","title":"Using Java's serialVersionUID"},{"content":"It was around 2007-08, when it made the headlines. By it, I mean &ldquo;Harry Potter and the Deathly Hallows&rdquo;, of course. What did you think? I would not care much if The White Tiger by Aravind Adiga won an award or not. Honestly. I pestered my Dad about the book, Harry Potter, of course - and it&rsquo;d take some time to come by my hands. There was barely any library in my vicinity, except my school&rsquo;s, and I surely knew that new releases would never come in.\nI did read about it in papers though. By it, I mean The White Tiger by Aravind Adiga, winning the Man Booker Prize. It was probably Hindustan Times, or DNA, or both. (I used to read a lot of newspapers then). Or I probably heard it in the news. Likely all three. But my first thought was - &ldquo;Who cares?&rdquo;, especially not a school-going kid who wanted his Harry Potter fix more than any critically acclaimed book.\n&ldquo;The White Tiger by Aravind Adiga&rdquo;. That&rsquo;s how I remember it. Never just The White Tiger, but always &ldquo;The White Tiger by Aravind Adiga&rdquo;. As if the people couldn&rsquo;t let the man exist without the book. But hey, I still didn&rsquo;t care. I only vaguely remember discussing with a friend about it winning the prize. We were a lot into trivia and General Knowledge those days. Remember I used to read a lot of newspapers? But what the hell is a Man Booker? Who in their right mind names it Man Booker? What is a &ldquo;Booker&rdquo; anyway? Just because it has &ldquo;Book&rdquo; in the name, doesn&rsquo;t mean it deserves to be named as an award. OK. I&rsquo;ll assume a Booker may have meant a Book. A Book prize, that&rsquo;s what it should have been. What&rsquo;s the significance of &ldquo;Man&rdquo; in the &ldquo;Man Booker&rdquo;. Clearly, the world is full of more people stupider than myself. But, seriously, what is it really? I still don&rsquo;t know. Maybe I&rsquo;ll Google. Or ask an AI. Yes, that&rsquo;s the most &ldquo;it&rdquo; thing to do.\nI had seen the cover of the book plastered over newspapers. A white cover, with the typeface almost out of The Pink Panther movie graphic, and less serious at that. I knew that if given a choice, I&rsquo;ll probably not read it. Not that I wanted to read it anyway, choice or not. Being a critically acclaimed novel, it was probably out of my comprehension anyway. The White in The White Tiger by Aravind Adiga meant it related to some white collar workers. Unlikely it meant something else. Especially when it has a car on the cover. Obviously, why not?\nAll through the years after that, I&rsquo;d occasionally see the name pop up somewhere or the other. Some bookstore I used to visit once a year, someone&rsquo;s GoodReads list, or something on the back of my subconscious mind. And then some years ago, somehow, a copy of the book landed in my Home. My Dad occasionally brings books like this sometimes, at random. Sometimes a copy of Chetan Bhagat&rsquo;s latest, sometimes The White Tiger by Aravind Adiga.\nThere it sat within my shelf. By it, I mean The White Tiger by Aravind Adiga. Ignored, and yellowing, waiting for me to pick it up and crack the spine open. Unfortunately, to its utter disappointment, I never crack the spine open of a book, but to the delight, I do pick up books to read. And after lying dead for years like Imhotep, the curse lifts, and it is resurrected.\nI read the first chapter of the book and I visibly scowled. It is one of the most unexpected starts to a novel I&rsquo;ve read. White Collar and cars?! Critically acclaimed = incomprehensible? My assumptions were put into dust on the first page itself. It was as if a pair of hands sprung up from the pages, held my head in their palms, and turned my head and eyes on itself. It says &ldquo;Shut up, and keep your attention here&rdquo;, and I read.\nHow do I describe the book? I&rsquo;d rather not. I cannot. But I&rsquo;ll make an attempt. The lesser details the reader knows, the better.\nThe plot starts like a neo-Noir movie set in rural India. The movies where there is a yellowish tint of the old world &ldquo;charm&rdquo;, the days from before the urban Internet as we know of today, and definitely a different era than the AI. The book is set in Delhi, and rural Bihar, as all rugged, earthy stories do. It almost reads like a particularly gory scene in a movie, when the protagonist takes revenge on his enemies. Disgusting to the eyes, but you love it. You wouldn&rsquo;t wish it any other way.\nAravind Adiga starts at full throttle. No gradual gear shifts, no trickling, no edging. A straight punch to the guts. A no-holds-baared monologue, with the voice like as if you yourself are the one speaking. The prose is scathing, and he dissects the India that was then (and is still now), with a finesse of an experienced surgeon with a scalpel. After the dissection is complete, a sucker punch, one after another. It&rsquo;ll leave you breathless, revolted, and disgusted. It&rsquo;ll make you cynical, and a pessimist. It&rsquo;ll anger you, sadden you, and make you despair. You&rsquo;ll feel naked on the streets, even if you wear a 3 piece suit. And you&rsquo;ll ask &ldquo;Why?&rdquo;. Why has India been the way it has? Why it still is that way? Does India even make sense? And a 100 other questions you have no answers for. The Harry Potter fan in me will not hesitate it comparing to a dementor, sucking the life out of you.\nThe characters in the book are few but well developed. Written from a first person point of view, it holds you in a way such that you won&rsquo;t need to leave anything to the imagination. The writing is simple but the voice it speaks with is raw. The protagonist&rsquo;s monologue almost makes him feel like an older version of Holden Caulfield. Eccentrically deranged, slightly crazy, mildly stupid, and a whole lot clever. The story feels like you&rsquo;re writing a journal yourself, and who better to put the thoughts into words than you?! That&rsquo;s the sign of a good writer - you feel you&rsquo;re writing the work, and is written especially for you. If you&rsquo;re thinking this to be a relaxing read, it isn&rsquo;t. It&rsquo;ll shake you out of stupor, and will suck your energy out. You&rsquo;ll question, &ldquo;What am I reading it for?&rdquo;. I already answered above &ndash; because you like the gore.\nAs far as characters go, none of them are likeable, especially not the protagonist himself. And that&rsquo;s what makes this book the way it is. We always think of Mahabharata as a &ldquo;grey&rdquo; story, with no black and white, no right or wrong. Well, good news for you, this story is greyer. The protagonist has a knack of finding the ironies in our lives. A dark comedy of sorts, sometimes you&rsquo;ll laugh by yourself, and curse yourself like I did - why didn&rsquo;t I read it earlier? This work is a realistic satire of the highest order, and will rile so many people up, from all sections of the society. From politicians, working class, higher class, lower class, the administration, the bureaucracy - everyone. Thank gods (all the Thirty-six million and five!) that most of them won&rsquo;t care to read this book. I&rsquo;m surprised he wasn&rsquo;t put behind bars for this! But I guess that&rsquo;s what being someone from a higher class means.\n&ldquo;Savage&rdquo; is what &ldquo;The White Tiger&rdquo; by Aravind Adiga fits into. (I picked it up from the book&rsquo;s back cover review snippet by Neel Mukherjee)\nIn retrospect, I realize it was the best that I had the wrong idea of how the book would be. I went into it blind, with no expectations in mind, and I was blown away.\nTime for the rating &ndash; 7\/7.\n","permalink":"https:\/\/darshit.dev\/posts\/review-the-white-tiger\/","summary":"<p>It was around 2007-08, when it made the headlines. By it, I mean &ldquo;Harry Potter and the Deathly Hallows&rdquo;, of course. What did you think? I would not care much if <em>The White Tiger<\/em> by Aravind Adiga won an award or not. Honestly. I pestered my Dad about the book, Harry Potter, of course - and it&rsquo;d take some time to come by my hands. There was barely any library in my vicinity, except my school&rsquo;s, and I surely knew that new releases would never come in.<\/p>","title":"The White Tiger, by Aravind Adiga - A Review"},{"content":"If your first thought about me after seeing the title is - &ldquo;How old are you?&rdquo; - I&rsquo;ll not be surprised. This is because you&rsquo;ll not be the first person to comment a similar thought.\nAround a decade ago (2013-14), when I was in college, I decided to utilize the College library for its full worth. I borrowed a copy of Bhagavad Gita, As It Is, By A. C. Bhaktivedanta Swami Prabhupad. I had seen a Gujarati language copy of it at my home and a couple of places, and the &ldquo;art&rdquo; within the book interested me. Of course, we&rsquo;ve all heard great things about the Bhagavad Gita, and when I managed to get my hands on an English copy, I had to try it. When I took the book to the library checkout, the librarian asked me in a sneering tone in Marathi &ndash; &ldquo;Are you old already?&rdquo; (Speakers of the language would know what I&rsquo;m talking about). I got a bit stumped at that, and so I equally answered, &ldquo;Why, only old people are supposed to read this book?&rdquo;. I don&rsquo;t exactly remember the librarian&rsquo;s reply, but I like to think he was as stumped as I was. For some reason, I didn&rsquo;t even read a single page of the book then, and so I returned it back after it spending a couple of months alone in my closet. So, I&rsquo;ll forgive you the original thought.\nMy last read - Devi, for Millennials wasn&rsquo;t very fruitful for me. But I did want to read the Gita. And boy, I am glad I did. This book satisfies most of the things the other was falling short on. In hindsight, I&rsquo;d say it&rsquo;s better to read this book first, and then pick up the other one.\nThe book starts small - Bibek ji, in his characteristic professorial style provides an informative background of the book, the original Gita, who composed it, when, and how it evolved. He then explains why the Gita is a part of Mahabharata, and how a knowledge of Sanskrit is essential to getting the &ldquo;essence&rdquo; of Gita - because a lot of meaning and subtext is lost while translating it to English. He even goes to the extent of explaining how to read Sanskrit for the book, to make a novice reader make sense of how it should be read. However, this isn&rsquo;t enough for novice readers like me, but I appreciate Bibek ji for the attempt. He mentions the original Sanskrit shlokas, and then rewrites the Sanskrit to typical Devanagari form for making sense of the Sanskrit grammar, for the reader to help them understand better, besides the translation in English. Since this book is not a translation of the Bhagavad Gita, it is not a series of shlokas as found in the original. Instead, the book is grouped into ideas of Gita, and how different parts of Gita explain the ideas. To illustrate my point, it would be essential to provide an index of the book for perusal.\nIndex illustrates the ideas explained in the book\nThe Mahabharata Sanskrit and Poetry Krishna as a Historical Person The Bhagavad Gita Synthesis The Smriti Background Who Am I? Who Am I Not? The Jivatman and the Paramatman Birth, Death, Samsara and Karma Ahamkara, and the Path of Bhakti If you feel that the index is quite bare-bones, don&rsquo;t worry; it has a decent amount of ideas covered, and actually references other texts, authors, and even modern popular science when required!\nBibek ji, in his quintessential style, dissects each idea, and makes it as easy to understand as possible. The chapter on Krishna is very much intriguing. Bibek ji also explains how the Bhagavad Gita has ideas for all the ages of readers - the complication of reading and comprehension notwithstanding. There are more stories from different texts explained to illustrate the ideas of Gita. What is dharma, what is karma, how they are interlinked, and how it is very difficult to know what the correct dharma is. A lot of the ideas are ingrained into the Indian way of upbringing as Sanskar.\nIf you read this book, you&rsquo;ll get to know a lot about Indian culture and the accompanying texts with it. As a novice etymology student, this book is a goldmine on different types of words we use daily, for granted! Of course, the original Gita, is also a deeply philosophical book. The genius of the author is that it doesn&rsquo;t feel so. Each of the ideas has an addendum for references for further reading. There is a lot to unpack here, and not for nothing it took me quite some time to finish this book (around 3 months). However, a lot of it is also because I had made up my mind to read the shlokas, and not just jump to the translation as I inadvertently do, and delays in picking up the book to read.\nEven though the Gita is considered as a Hindu text, and certainly the context is Hindu - the ideas are quite &ldquo;secular&rdquo;. What most religious texts espouse is preachiness, but I never observed any such overt ideas. If only we read and understood what the shlokas mean, instead of reciting them by rote without understanding, we would all be better off. What are shlokas, if not what the modern people call affirmations. Shlokas are magic in the sense that they put ideas in you, and the world as a means of positive affirmation.\nI would keep this in a must-read list for someone trying to learn more about Indian\/Hindu culture, texts, and Philosophy. Speaking about Indian Philosophy, I always recommend the History of Philosophy in India podcast. I always say, India has probably the richest culture in the world - and neither the Indians, not the world, fully appreciate it.\nIf you have read the book, what are your thoughts?\n","permalink":"https:\/\/darshit.dev\/posts\/review-the-bhagavad-gita-millennials\/","summary":"<p>If your first thought about me after seeing the title is - &ldquo;How old are you?&rdquo; - I&rsquo;ll not be surprised. This is because you&rsquo;ll not be the first person to comment a similar thought.<\/p>","title":"The Bhagavad Gita for Millennials, by Bibek Debroy - A Review"},{"content":"Let&rsquo;s say you want to execute some tasks. Since executing it through a single thread might take you quite some time to get the result, you decide to use the ever dependable ExecutorService to process it through multiple threads.\nHere&rsquo;s a sample:\npublic static void main(String[] args) { ExecutorService executorService = Executors.newFixedThreadPool(5); for (int i = 0; i &lt; 5; i++) { int temp = i; executorService.submit(() -&gt; { task(temp); }); } executorService.shutdown(); System.out.println(&#34;ExecutorService is shutdown&#34;); } private static void task(int temp) { try { TimeUnit.SECONDS.sleep(1L); System.out.println(&#34;Task &#34; + temp + &#34; completed&#34;); } catch (InterruptedException e) { throw new RuntimeException(e); } } Of course, as usual, no example of Threads is ever complete without using &ldquo;sleep&rdquo; as an archetype of task execution.\nIt outputs,\nExecutorService is shutdown Task 1 completed Task 2 completed Task 0 completed Task 4 completed Task 3 completed Now imagine there&rsquo;s an endless queue of tasks, the number of which you don&rsquo;t know about. Maybe they are determined by the number of entries in a database which get added dynamically.\nFor example, a bank, wherein which it has to process a number of transactions throughout the day. The transaction end time will be 5 PM, beyond which it will not accept any additional tasks.\nHowever, you do know that the number of tasks will be finite, and will end at some point of time.\nHow do you know the point in time when all the tasks have completed?\nIf you notice the above code snippet, the ExecutorService.shutdown() enables the main thread to exit immediately, but the background threads still process the accepted tasks to completion. Is there a way when you can get notified about the completion?\nA couple of solutions come to mind:\nUse a CountDownLatch to count the tasks - but since you don&rsquo;t know the number of tasks, it&rsquo;s impractical to use it. Use ExecutorService.awaitTermination(). However, the time here is still undeterministic. You can use a very liberal ExecutorService.awaitTermination(Long.MAX_VALUE, TimeUnit.DAYS) or something similar. But that is again a blocking call. Is there a better way to solve this?\nJava does provide a better and relatively unknown way to get around this. The &ldquo;trick&rdquo; here is to know that Executors.newFixedThreadPool is essentially a ThreadPoolExecutor with predefined values. Let&rsquo;s check the implementation of Executors.newFixedThreadPool.\npublic static ExecutorService newFixedThreadPool(int nThreads) { return new ThreadPoolExecutor(nThreads, nThreads, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue&lt;Runnable&gt;()); } I really recommend to read the doc for ThreadPoolExecutor here. ExecutorService is a convenient wrapper over ThreadPoolExecutor.\n&hellip; programmers are urged to use the more convenient Executors factory methods Executors.newCachedThreadPool() (unbounded thread pool, with automatic thread reclamation), Executors.newFixedThreadPool(int) (fixed size thread pool) and Executors.newSingleThreadExecutor() (single background thread), that preconfigure settings for the most common usage scenarios.\nThe section that will help us resolve out problem is:\nHook methods This class provides protected overridable beforeExecute(Thread, Runnable) and afterExecute(Runnable, Throwable) methods that are called before and after execution of each task. These can be used to manipulate the execution environment; for example, reinitializing ThreadLocals, gathering statistics, or adding log entries. Additionally, method terminated() can be overridden to perform any special processing that needs to be done once the Executor has fully terminated.\nWe can use the terminated method to notify us of the same! But how do we use it?\npublic static void main(String[] args) { ExecutorService executorService = new ThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue&lt;&gt;()) { @Override protected void terminated() { super.terminated(); System.out.println(&#34;ExecutorService is terminated&#34;); } }; for (int i = 0; i &lt; 5; i++) { int temp = i; executorService.submit(() -&gt; { task(temp); }); } executorService.shutdown(); System.out.println(&#34;ExecutorService is shutdown&#34;); } private static void task(int temp) { try { TimeUnit.SECONDS.sleep(1L); System.out.println(&#34;Task &#34; + temp + &#34; completed&#34;); } catch (InterruptedException e) { throw new RuntimeException(e); } } If you do not prefer Anonymous classes (like me), you can always extend ThreadPoolExecutor yourself to create a custom one.\npublic static void main(String[] args) { ExecutorService executorService = getThreadPoolExecutor(); for (int i = 0; i &lt; 5; i++) { int temp = i; executorService.submit(() -&gt; { task(temp); }); } executorService.shutdown(); System.out.println(&#34;ExecutorService is shutdown&#34;); } private static ThreadPoolExecutor getThreadPoolExecutor() { return new CustomThreadPoolExecutor(5, 5, 0L, TimeUnit.MILLISECONDS, new LinkedBlockingQueue&lt;&gt;()); } static class CustomThreadPoolExecutor extends ThreadPoolExecutor { public CustomThreadPoolExecutor(int corePoolSize, int maximumPoolSize, long keepAliveTime, TimeUnit unit, BlockingQueue&lt;Runnable&gt; workQueue) { super(corePoolSize, maximumPoolSize, keepAliveTime, unit, workQueue); } @Override protected void terminated() { super.terminated(); System.out.println(&#34;ExecutorService is terminated&#34;); } } private static void task(int temp) { try { TimeUnit.SECONDS.sleep(1L); System.out.println(&#34;Task &#34; + temp + &#34; completed&#34;); } catch (InterruptedException e) { throw new RuntimeException(e); } } Here&rsquo;s the output to verify if it works as per our expectations.\nExecutorService is shutdown Task 0 completed Task 3 completed Task 2 completed Task 4 completed Task 1 completed ExecutorService is terminated What are some other relatively unknown snippets you use? Let me know in the comments!\n","permalink":"https:\/\/darshit.dev\/posts\/tracking-threadpool-termination\/","summary":"<p>Let&rsquo;s say you want to execute some tasks. Since executing it through a single thread might take you quite some time to get the result, you decide to use the ever dependable <code>ExecutorService<\/code> to process it through multiple threads.<\/p>","title":"Mastering ExecutorService Shutdown: Tracking ThreadPool Termination"},{"content":"I went into reading this book with high expectations, and I was&hellip; disappointed? But that&rsquo;s probably on me.\nI wanted something which inspires me to explore the rich Indian culture that I know only sparsely about, at the same time holding my hand over the things I don&rsquo;t know. It does do the former very well, but the latter, not so much. A lot of questions are answered, but it raises even more questions the more you read.\nMy biggest gripe with this book is, it doesn&rsquo;t explain things sufficiently well (to me). The author assumes that the reader would already probably know of it because they&rsquo;re clearly clever enough to pick up this book to read. But even as a person already knowing the general concepts - a lot of it was assumed to be already known by the reader. This leads me to probably miss a lot of context and the references that I should be seeing, but in the author&rsquo;s defence, there&rsquo;s just too many references in Indian literature. However, I still would have wanted to have things slow, and in a bit of an ELI5 form. Web links would also have worked. But I&rsquo;m not 5, nor am I a millennial (or am I? I always forget where the line lies. Google answers - yes, I&rsquo;m a millennial).\nAnyway, if you&rsquo;re a millennial like me, you&rsquo;re probably not understanding a lot of it in this book. Perhaps you have an exceptional family who know and already follow the scriptures, but for someone like me whose family is moderately religious, and only follows certain traditional rituals, you&rsquo;ll be scratching your heads, just like I did. Not your fault, though. Honestly, I probably disappointed Bibek Debroy ji, and I really admire him as an author and as a person who is probably the one who lit the fire in me for Indian culture.\nTo Bibek ji&rsquo;s credit, he admits that the book is more of something that inspires exploration, and deliberately misses answering the questions that might arise in our minds. As a person of an honest scientific temperament, he refuses to opine on things in this book, and strictly sticks to facts and literal translations, as like his other books. He does open us up to a world unknown, the shlokas from Vedas, the Devi Bhagvata Purana, shlokas from Adi Shankaracharya, the numerous and always changing Shaktipeethas, the ways of worship, the forms of Devi, the descriptions of Devi, the characteristics, and how it ties into the worship of the Brahman. And it&rsquo;s beautiful. To think that people wrote all of this, in praise of the divine femininity, is an eye-opener to the rich culture and thinking that India has had. And this text is not even touching the surface!\nWhen I started to read the book, I decided that I&rsquo;d probably read each Sanskrit shloka mentioned by myself. However, my skill as a reader of Sanskrit\/Devanagari was questioned, and admittedly, I didn&rsquo;t satisfy that very well, so much so that I questioned if I even knew it in the first place! If I did try to read all the shlokas, I would have been much more likely to mess it up with a different meaning altogether. Not to mention the additional 3-5 months it would take me to complete this book, by the time I probably would have abandoned it. With this respect, it is good to know what Shloka&rsquo;s are just words. Shlokas aren&rsquo;t magical words, which, if spoken, will grant you your desires. Well, they will, but not if you don&rsquo;t understand what you&rsquo;re speaking\/reading. Remember the power of manifestation? Or quotes like &ldquo;You are as you think&rdquo;. It&rsquo;s true. And it always has been. And we&rsquo;ve lost touch with enough Sanskrit to just repeat the shlokas verbatim without thought. I thought it&rsquo;d be a better idea, practically, and for easier comprehension to just read the English meaning of the shlokas.\nWould I recommend this book to be read by everyone? No, not really. Casual readers would just zone out. Non readers would probably keep it as a show-piece. Should you read it, though? Yes, at least once. It will probably ignite the fire that you had always been dreaming of, or at least let you know that you have to still learn a lot.\nTo put it in Bibek ji&rsquo;s words:\n[Devi] is the one who made me write it. She is the one who will make you read it or ignore it. Ya Devi sarvagrantheshu! Nothing more needs to be said.\nJust after I wrote the review, I found this tweet by Nassim Nicholas Taleb: https:\/\/twitter.com\/nntaleb\/status\/1871573854717636636\nA convincing argument of the role of language is the existence of surviving holy languages, uncorrupted by the no-nonsense tests of daily use. Semitic religions, that is Judaism, Islam, and original Christianity understood the point; keep a language away from the rationalization of daily use and avoid the corruption of the vernacular. Four decades ago, the Catholic church translated the services and liturgies from Latin to the local vernaculars; it can be argued that this caused a drop in religious beliefs. Suddenly religion subjected itself to being judged by intellectual and scientific, without the aesthetic, standards.\nHow relevant do you think would this be for Sanskrit?\n","permalink":"https:\/\/darshit.dev\/posts\/review-devi-for-millennials\/","summary":"<p>I went into reading this book with high expectations, and I was&hellip; disappointed? But that&rsquo;s probably on me.<\/p>\n<p>I wanted something which inspires me to explore the rich Indian culture that I know only sparsely about, at the same time holding my hand over the things I don&rsquo;t know. It does do the former very well, but the latter, not so much. A lot of questions are answered, but it raises even more questions the more you read.<\/p>","title":"Devi for Millennials, by Bibek Debroy - A Review"},{"content":"You heave a sigh of relief, as the QA has approved a long-awaited feature for deployment on Prod. However, as a part of the process, it is first deployed on the UAT env, where there are test accounts that can be used to certify the feature works outside of the local developer and QA testing systems.\nBut&hellip; running the test suite results in a lot of failures!\nReply with the always relevant &ldquo;But it works on my machine!&rdquo;\nWhat do you do? You&rsquo;re sure that the code works. Defintely sure. Maybe the problem is with the UAT environment then? But what could be the problem with the environment? Maybe the test accounts which are newly created, are configured incorrectly? Probably yes, you think. You have access to the logs for the environment, but the scenario which it is failing for, has limited to no logs to identify the problem. You internally curse your ancestral developers.\nAnother option? Remote debugging! While this is a good idea, it is seldom practical for environments where the apps are under constant use. If your code is in the &ldquo;hot path&rdquo;, good luck figuring out what requests are yours. Also it may slow down the app significantly.\nEssentially, what you want is to debug the application, as if it was deployed on your local machine, but the database of the UAT server. But since UAT server is not directly accessible to your local application, you&rsquo;re out of luck.\nOr are you? Fret not, because an SSH Tunnel is here to your rescue.\nSSH Tunnel What is an SSH Tunnel? And how do I use it?\nShort answer:\nSSH Tunneling will allow your application to behave as if it is deployed on a remote system, through which the UAT database is accessible.\nLong answer:\nThe Linux ssh command provides a functionality to &ldquo;port forward&rdquo;. Admittedly, the term &ldquo;port forward&rdquo; is pretty non-descriptive. Hence, I&rsquo;ll let StackOverflow provide to you a detailed, and a far easier explanation of SSH Tunneling than what I can here. You can read it here: https:\/\/unix.stackexchange.com\/a\/115906. I recommend you to read the answer because it has diagrams that are far easy to understand than the text based answers.\nHowever, I&rsquo;ll still copy the relevant sections here.\nssh -L 123:farawayhost:456 remotehost local: -L Specifies that the given port on the local (client) host is to be forwarded to the given host and port on the remote side. ssh -L sourcePort:forwardToHost:onPort connectToHost means: connect with ssh to connectToHost, and forward all connection attempts to the local sourcePort to port onPort on the machine called forwardToHost, which can be reached from the connectToHost machine.\nExample For our use case, our sample command will be:\nssh -L &lt;Local Port&gt;:&lt;UAT Database IP&gt;:&lt;UAT Database Port&gt; &lt;JumpHost IP&gt; Note, here the JumpHost is a system which can connect to &lt;UAT Database IP&gt; with the port &lt;UAT Database Port&gt;.\nOnce we have this figured out, everything else is a cakewalk!\nYou can simply run the command, and you&rsquo;ll be able to access the UAT Database on your localhost:&lt;Local Port&gt;. Almost feels like magic!\nIf you need to connect to multiple databases, you will need to run this command multiple times. Or you can write a bash script which can dynamically read a config file to open multiple SSH Tunnels.\nI, being a Java programmer, would rather deal with statically compiled Java code, than worry about a dynamically typed language like bash. So, I utilized the jsch library to whip up an extensible project, which creates and maintains multiple SSH Tunnels. You can check it out here: https:\/\/github.com\/darshitpp\/java-ssh-tunnel\nStructure java-ssh-tunnel \u2514\u2500\u2500 src \u2514\u2500\u2500 main \u251c\u2500\u2500 java \u2502 \u2514\u2500\u2500 dev \u2502 \u2514\u2500\u2500 darshit \u2502 \u2514\u2500\u2500 java_ssh_tunnel \u2502 \u251c\u2500\u2500 Main.java \u2502 \u251c\u2500\u2500 MultiTunneler.java \u2502 \u251c\u2500\u2500 Tunneler.java \u2502 \u2514\u2500\u2500 ssh \u2502 \u251c\u2500\u2500 TunnelDetails.java \u2502 \u2514\u2500\u2500 UserDetails.java \u2514\u2500\u2500 resources Usage Download the project Load up in your IDE Run mvn clean install Change Main.java with required details like SSH username, SSH password, JumpHost sshHost (Optional) Maybe load up localPort, remoteHost, and remotePort details from a file Run Main.java If all things go well, you&rsquo;ll see the following output on your stdout\nStarting tunneling... &lt;remoteHost&gt;:&lt;remotePort&gt; is available on localhost:&lt;localPort&gt; Press Enter to terminate the tunnels... Caveats While the above is very convenient, DO NOT USE IT TO CONNECT TO PROD. Yes, that had to be written in bold with emphasis. Shall I print the message to stderr too? Comment below.\n","permalink":"https:\/\/darshit.dev\/posts\/java-ssh-tunnel\/","summary":"<p>You heave a sigh of relief, as the QA has approved a long-awaited feature for deployment on Prod. However, as a part of the process, it is first deployed on the UAT env, where there are test accounts that can be used to certify the feature works outside of the local developer and QA testing systems.<\/p>","title":"SSH Tunnelling with Java"},{"content":" Running specific commands with sudo using Ansible It seems a trivial use case, but it&rsquo;s not. Consider a situation when you&rsquo;re not the user allowed a full sudo access on the remote machine. However, you are only allowed the sudo access on certain commands, which, of course, requires a password. For example, starting or stopping a service.\nAnsible allows privilege escalation, but that will not solve your problem because:\nElevated access is changed to the user root by default Elevated access requires a password, i.e. password for the root user You obviously don&rsquo;t have access to the root user.\nThere are a couple of other directives you can use, which the ansible doc makes it hard to understand even though it tries to be simple in language. You can try to use the ansible_become_user to change to another user while escalating the privilege besides root. However, if you are already the user who has the sudo command access, this will not help.\nIf you have access to change (or get changed) the \/etc\/sudoers file, you can change the sudo command to be run through NOPASSWD.\nIf you are here, it is likely that you do not have the permissions to change the sudoers file either.\nResolution I saw a couple of workarounds mentioned across Github1, StackOverflow2, and Reddit34, but they were outdated, and didn&rsquo;t work for me.\nOne of the solution5 suggests to use sudo with -S and echo the password from the terminal. This will, however, probably leak your password on the shell, and we don&rsquo;t want this, do we?\nHowever, is there a way Ansible can input the password to sudo? Yes! Perhaps we can use something like the -y flag that is often used to skip prompts of yes\/no on the terminal. Thankfully, Ansible is built over Python, and most Python modules are available within Ansible. &ldquo;How does that help?&rdquo;, you ask. Python has a very helpful module called pexpect. Similarly, Ansible has expect.\n- name: Stop service ansible.builtin.expect: command: &#34;sudo systemctl stop service&#34; responses: (?i)password: &#34;{{ pass }}&#34; no_log: true This solves our problem! We can load this password through Ansible vault, and pass it in without being logged anywhere! We also do not have to rely on having access or permissions through the \/etc\/sudoers file, saving a lot of headache of trying to get approvals.\nProblem: Can&rsquo;t use sudo command-limiting in Ansible&#160;&#x21a9;&#xfe0e;\nSpecify sudo password for Ansible&#160;&#x21a9;&#xfe0e;\nHow do I run sudo commands with another user&#160;&#x21a9;&#xfe0e;\nBecome sudo with limited sudo privileges&#160;&#x21a9;&#xfe0e;\nHack using Ansible raw&#160;&#x21a9;&#xfe0e;\n","permalink":"https:\/\/darshit.dev\/posts\/partial-sudo-ansible\/","summary":"<hr>\n<h3 id=\"running-specific-commands-with-sudo-using-ansible\">Running specific commands with sudo using Ansible<\/h3>\n<p>It seems a trivial use case, but it&rsquo;s not. Consider a situation when you&rsquo;re not the user allowed a full sudo access on the remote machine. However, you are only allowed the sudo access on certain commands, which, of course, requires a password. For example, starting or stopping a service.<\/p>","title":"Handling limited sudo access through Ansible"},{"content":"We know about companies using Dark Patterns (more on this post by TechCrunch: WTF is dark pattern design?), and how they affect users. But can there be something like a &ldquo;Stupid Pattern&rdquo;? A thing that most companies do, and they don&rsquo;t even realize it&rsquo;s stupid? This blog post is a part real-life case study, and a major rant about one such pattern that is almost definitely, very stupid.\nIt&rsquo;s mostly a rant, though I encourage you to read how it came to be that way.\nGazon Communications\/Razorpay My first experience of a &ldquo;stupid pattern&rdquo; was with Gazon Communications and RazorPay. Gazon is an internet provider, and RazorPay is a payments processor. In May 2019, I received the following email:\nGazon Welcome Email\nThe plaintext password notwithstanding, the email surprised me because I definitely did not sign up for it. I received an additional email with an invoice for the payment. Gazon Payment Invoice\nYes, the email provided in the invoice is mine, but the name and the address do not match (obviously)! I assumed it to be just another typo by the user during the registration\/signing up. I thought it would be best to ignore it. These typos happen, and assumed that when the user realized their mistake, they would promptly go correct it.\nI was wrong. The user never realized the &ldquo;mistake&rdquo;. I received more such emails in the following months.\nFed up, I contacted the phone number mentioned in the original invoice.\nWhatsApp chat with my alter ego\nThe person was clueless. I reached out to him in January 2020, but routinely received emails till May 2020.\nI never received any further emails because the user probably never recharged his internet subscription.\nThis wasn&rsquo;t even a spam email!\nBigbasket Bigbasket is one of the major Indian e-commerce companies, catering to delivering fresh vegetables, and other edibles. I did have an account with them, but did not buy anything when I created the account. All of a sudden, 3 years later, I start receiving emails with OTPs, and even a recharge receipt!\nThank you Bigbasket for free credits!\nSomeone just used my email on their account, and Bigbasket didn&rsquo;t even care to verify if the email indeed belonged to them! I also received their phone number in one of the emails. This time, I decided to not contact the person, and instead directly reached out to Bigbasket to close\/delete the account. It took 15 emails to even try to explain them the problem. They did not understand, and the issue, to this date, remains unresolved. My account still exists on the platform, and is not deleted yet, despite repeated requests.\nWish.com To be honest, I did not even know about this site until I received the email of me &ldquo;Signing up&rdquo; on their website. Moreover, the email looked like obvious spam.\nNikl (probably a Nickelback fan)\nIt was ridiculous! Even the name did not match this time! I reset the password of the Wish.com account (did not click any link in the email), and noticed that the person had ordered a couple of items. I immediately cancelled the order. The good thing is, they also have an option of deleting the account, and I did so. I was genuinely puzzled now. Was my email so common and prone to typos? It didn&rsquo;t seem likely because it&rsquo;s not even the usual format of firstName.lastName. Weird!!\nPantaloons It&rsquo;s now going too far. Pantaloons is a major garment retailer in India, and I had apparently shopped at one of their stores in Ahmedabad.\nMy Alter Ego on a Shopping spree\nThis time I decided to click on the link in the email. The email wasn&rsquo;t a spam one, and to my surprise, it opened up with details of the order!\ndarshit kanshara buying trousers on Pantaloons\nThe page also had a link for &ldquo;Completing my profile&rdquo;. I clicked on the link, and see what I find:\ndarshit kanshara&rsquo;s profile\nI now had his name, phone number, and date of birth! If I was enterprising and a &ldquo;hacker&rdquo; enough, I could even find a way to scam him out of some money. This was a one off invoice payment, and there was no &ldquo;Unsubscribe&rdquo; button, so I couldn&rsquo;t even &ldquo;report&rdquo; it to someone. I decided to not bother poor Darshit Kanshara with my email troubles.\nJio Jio is a mobile carrier, credited with disrupting the market with very cheap internet plans. I am already a customer, and so I was very surprised when I received another email linking my email to another phone number (not mine).\nEmails from Jio\nI was livid now. How can multiple people make mistakes in their email, especially when my name itself is not very common?! Do notice the last email in the above screenshot, dated 02\/07\/2018. It says my email has been verified, but it&rsquo;s been verified with a different phone number that&rsquo;s actually mine. Jio probably already thought my email is verified, and linked it to another number without any verification!\nI deactivated the SIM card. The person re-activated it. There was also no other way to change email except an OTP to the linked number!\nRBL Bank\/Bajaj-Finserv Bank The above emails were pretty random. Imagine my surprise when I received an email from a Credit Card company\/Bank!\nRBL Bank being large hearted and sharing Credit Card PINs\nThe above emails have Credit Card application forms, and PINs. Though, the PDFs are in an encrypted format. How is the encryption, you ask?\nI&rsquo;ll let one of the emails answer you.\nHow complicated can it be?\nAll it takes to access the password protected form is a 10 character password. But is it really a 10 character password? I already know the characters of my name. How hard is it to get the date of birth? It&rsquo;s a simple 30 line python script. How had the person missed noticing no email statements or PIN for the Credit Card?\nI decided to &ldquo;crack&rdquo;\/&ldquo;hack&rdquo; the PDF, and contact the person. It took me just 15 mins to decrypt the PDF. I reached out to the guy, and he, like others earlier, had no clue about the wrong email!\nspeechless&hellip;\nThis was bonkers! Some person actually mistyped his whole email (and both of ours don&rsquo;t have a similarity except the first name). If I wanted, I could actually decrypt the document with the PIN, and hack all accounts of the said person. Decrypting merely the application form gave me the address, phone number, and other personal information. In the hands of a malicious agent, the said person could be looking at a potential ruin to their whole life savings, and identity theft.\nAnd most companies don&rsquo;t even care to validate the &ldquo;KYC&rdquo;.\nIf you thought this was enough confusion, I received another email yesterday&hellip;\nBooking.com Some good samaritan booked a room with King sized bed for me in Hyatt Regency Toronto, for 15 days in March 2022!\n#Lucky\nAgain, the actual name is not mine (except the first name). He booked it for 15 days with it amounting to more than $3K CAD. How lucky (or unlucky) I am! #Blessed\nI actually again contacted Booking.com through their helpline number. I already had the confirmation number and the PIN associated with the booking. The customer support instead asked me to confirm my name, which I replied to. They said that the name matches, and then asked me if I wanted to cancel the booking if I want. What!? They continued that as I had the confirmation number and the PIN, and even the name matched (only the first name, mind you), I would be able to cancel a booking worth more than $3K CAD.\nI questioned about how they sent me an email without confirming it was indeed me booking the hotel, they replied that it&rsquo;s the concern of the person booking the hotel\/room! &ldquo;No company provides the email verification service&rdquo;, they said, and if I had so much of a problem with the emails, I could just unsubscribe. That&rsquo;s obviously not the point I&rsquo;m trying to make!\nImagine the whole internet running on an element of &ldquo;trust&rdquo;, and no verification! This is what I call a &ldquo;Stupid Pattern&rdquo;. It&rsquo;s not a Dark Pattern, but the chink in the armour will make internet users fail all around. All the point of digital security fails when someone mistypes their email, or someone else does. Why hasn&rsquo;t someone not even thought of this? Product Managers? All the people stressing on UI\/UX?\nA solution would be mandatory verification of emails, and as described above, not many companies do that. Even verification of emails has its problems. A typo to the email, may lead to a malicious actor &ldquo;confirming&rdquo;\/&ldquo;verifying&rdquo; the email, and there goes your bank account. Now think about how many people use the internet, and don&rsquo;t know about basic online safety measures like a strong password, or ad-blockers, encountering something like this? And potentially on the wrong side of things!\nI have thought about what is it about my email that leads to me getting legitimate emails like the above. I&rsquo;m sure you&rsquo;re now thinking about it too. But I&rsquo;ve never found a satisfactory answer, because an email is not inherently &ldquo;secret&rdquo; like a password is. There is no problems with emails &ldquo;leaking&rdquo; out, unlike passwords. And I can only hope someone is not getting my emails. I don&rsquo;t even want to think of the problems that would lead me to.\nThese aren&rsquo;t spam emails, and Gmail is pretty good at flagging them.\nMy email cannot be deliberately mistyped. The person whose bank emails I received has 6 more characters than my personal email.\nIs it a deliberate attempt\/consipiracy by some group of people or hackers?\nI&rsquo;m not sure.\nIf you&rsquo;re a computer\/cyber security expert reading this, can you suggest any steps I could take to prevent this &ldquo;spam&rdquo;?\nShall I use a new email service with a custom domain? Any cheap ones that you might want to recommend?\nIf you&rsquo;re a normal person reading this &ndash; you might want to check if the bank (and other) services you use have the correct email configured.\nWe, as internet citizens, must also ask for laws redressing these types of lapses by the companies. Non-EU people who do not have the luxury of GDPR must demand similar laws of their governments. Services that you use must have the provision of deleting your account at the very least.\nFollow more of this discussion on HackerNews.\n","permalink":"https:\/\/darshit.dev\/posts\/stupid-patterns\/","summary":"<p>We know about companies using <a href=\"https:\/\/www.shopify.com\/partners\/blog\/dark-patterns\">Dark Patterns<\/a> (more on this post by TechCrunch: <a href=\"https:\/\/techcrunch.com\/2018\/07\/01\/wtf-is-dark-pattern-design\/\">WTF is dark pattern design?<\/a>), and how they affect users. But can there be something like a &ldquo;Stupid Pattern&rdquo;? A thing that most companies do, and they don&rsquo;t even realize it&rsquo;s stupid? This blog post is a part real-life case study, and a major rant about one such pattern that is almost definitely, very stupid.<\/p>","title":"Stupid Patterns"},{"content":"I currently work as a Tech Lead with Gupshup.\nI am involved in the computing community by volunteering at ACM. I have been an editor with ACM XRDS, and also been member of the ACM Future of Computing Academy (FCA). I was also a contributing member to ACM Selects. ACM Selects are a series of guides to a broad range of topics in computer science. Check out some of the guides I compiled: Getting Started with Microservices, and Spotlight on Computing in India.\nMy professional work and interests include working with Java, Spring Boot and related ecosystems, and learning about designing Scalable Software Architectures and Systems.\nMy favourite IDE is IntelliJ IDEA!\nYou can reach out to me on Twitter @darshitpp and LinkedIn, and you can find my Resume\/CV here.\nYou can find a text based resume below.\nExperience Tech Lead - Gupshup Technology, May 2020 - Present, Fully Remote Previously: Senior Software Engineer 2, Senior Software Engineer, Software Engineer\nReduced application shutdown time by 140x (from 7 minutes to 3 seconds) by optimizing and implementing a safe thread stopping strategy. Boosted matching times for high-volume internal services from minutes to seconds, significantly improving response times and user experience. Utilized Multi-threading and concurrent techniques to improve performance for message processing and delivery by 50-90%. Eliminated deployment of production instances from 100s to 0 by enabling dynamic data updates, significantly enhancing system uptime and release efficiency. Integrated streaming architecture to improve throughput by 2x and enable virtually unlimited horizontal scaling for high-volume services. Introduced Token-based authentication for APIs and implemented security measures for MongoDB connections to prevent unauthorized access. Implemented a mechanism with Redis Cluster and Lua scripts to enable robust rate limiting on messages sent as per client configuration. Achieved a 10x reduction in deployment time (from 10 minutes to 1 minute) by eliminating human intervention and automating the entire process, coupled with automated notifications for visibility. Automated setup of new environments, reducing manual effort from weeks (&gt;400 hours) to hours (&lt;15 hours), greatly accelerating development and testing cycles. Spearheaded the migration to, and automation of Redis Cluster, transforming potential hours of manual scale-up\/scale-down operations into minutes, enabling critical horizontal scalability for data handling, and achieving 1000s of dollars in cost savings. Championed code quality and maintainability by actively conducting code reviews for critical features and infrastructure components, and integrating SonarQube into GitLab pipelines. Mentored 2-3 junior engineers, providing technical guidance and fostering a culture of engineering excellence and continuous learning. Led and collaborated for design and architecture decisions for the system. Guided the team in adopting maintainable coding practices and leveraging new technologies like AI to accelerate development velocity. Software Engineer (Spring Boot), LogiNext Solutions, December 2018 - May 2020, Mumbai Secured sensitive application secrets like credentials and passwords by utilizing server side encryption with the help of AWS Key Management Service and AWS S3 storage. Reduced costs by implementing a caching mechanism for Google Places and Geocoding API, OneMap, and Open Street Maps calls. Implemented a Redis based debounce to eliminate duplicate transactions in the system. Reduced Redis usage by 50% by optimizing storage strategies. Contribued to migration of the application from Spring Boot v1.5 to v2.1.4 Software Engineer (Spring Boot), KPIT Technologies, July 2016 - November 2018, Mumbai With CRISIL: Quantix Mutual Funds Screener, and Wealth Tracker\nImplemented a REST micro-service which enables a user to shortlist Mutual Funds based on a criteria. Introduced Annotation based development to the team that reduced development time by 40+ man hours per week. Implemented a system which generates user portfolio reports based on their investments profiles and existing portfolios. Project Intern, Persistent Systems, June 2015 \u2013 May 2016 Developed a smart system called Dactylock, to secure information using Biometrics and Secret Sharing Techniques as a part of Final Year Bachelors\u2019 Project. Languages and Technologies Languages: Java, Python, Lua, Bash Frameworks &amp; other tech: Spring Boot, Java Servlets, Docker, Kubernetes, Pulum Databases\/Caching: MySQL, MongoDB, Redis Cloud Platforms: AWS, GCP, Oracle Cloud CI\/CD &amp; Tools: GitLab, GitHub Actions, IntelliJ IDEA, Cursor, Git, SVN, Ansible Side Projects Google Maps Java SDK. Implemented a feature to ensure consistence between the Java and JS SDK. Enabled parsing of API Responses in the Google Maps Java SDK. Technologies: Java\nJava URL Shortner. Created a self-hosted production ready URL shortener webapp and CLI. Deployed on Oracle Cloud. Technologies: Spring Boot, Docker, Java, PicoCli, GraalVM, Oracle Cloud\nSDKMAN! is a tool for managing parallel versions of multiple SDKs on any Unix based system. Improved error suggestions for the user. Technologies: Java, Cucumber\nStock Price Bot. A bot which shows the most recent Equity and Cryptocurrency prices. Technologies: Python\nAchievements &amp; Awards ACM Future of Computing Academy: Selected as a member of ACM Future of Computing Academy which aims to shape the future of the computing profession. See: Bookmarking and Beyond: Building the Pointer to Quality Knowledge.\nACM Selects: ACM Selects are a series of guides to a broad range of topics in computer science. Check out some of the guides I compiled: Getting Started with Microservices, and Spotlight on Computing in India.\nFeatured in Java Annotated Monthly: My article on Using IntelliJ IDEA Live Templates was featured in the &ldquo;Java Tutorials &amp; Tips&rdquo; section in the March 2020 issue of Java Annotated Monthly by Trisha Gee.\nFeatured in The Awesome Java Weekly: My blog on Dynamic Enums was featured in Awesome Java Weekly Newsletter #268.\nACM Crossroads: Special Projects Editor, and Departments Editor for Conferences section of the Magazine. More info: https:\/\/xrds.acm.org\/aboutus.cfm#darshit\nPerformance: Multiple awards for performance at Gupshup.\nDelighted Customer: Received great ratings from our client CRISIL twice for being a fast learner and contribution to the projects.\nNASSCOM India@75 Hackathon Winner: Developed an Android marketplace for blue-collar jobs in the unorganized sector.\nHonourable Mention at ACM ICPC Amritapuri Regionals, 2015.\n","permalink":"https:\/\/darshit.dev\/about\/","summary":"<p>I currently work as a Tech Lead with <a href=\"https:\/\/gupshup.io\">Gupshup<\/a>.<\/p>\n<p>I am involved in the computing community by volunteering at ACM. I have been an editor with ACM <a href=\"https:\/\/xrds.acm.org\/\"><strong>XRDS<\/strong><\/a>, and also been member of the ACM <a href=\"https:\/\/www.acm.org\/fca\/\"><strong>Future of Computing Academy (FCA)<\/strong><\/a>. I was also a contributing member to <em><strong>ACM Selects<\/strong><\/em>. ACM Selects are a series of guides to a broad range of topics in computer science. Check out some of the guides I compiled: <a href=\"https:\/\/selects.acm.org\/selections\/getting-started-with-microservices\">Getting Started with Microservices<\/a>, and <a href=\"https:\/\/selects.acm.org\/selections\/spotlight-on-computing-in-india\">Spotlight on Computing in India<\/a>.<\/p>","title":"About"},{"content":"But can one even make Enums dynamic? Enums, by definition, are static. They are used to &ldquo;predefine&rdquo; constants. I&rsquo;ll let the official Oracle Java Tutorial on Enums to help explain the definition.\nAn enum type is a special data type that enables for a variable to be a set of predefined constants. The variable must be equal to one of the values that have been predefined for it. Common examples include compass directions (values of NORTH, SOUTH, EAST, and WEST) and the days of the week.\npublic enum Day { SUNDAY, MONDAY, TUESDAY, WEDNESDAY, THURSDAY, FRIDAY, SATURDAY } The values of an enum are known to the compiler at compile time, are not supposed to change. Imagine if someone tried to introduce a new day of the week. This is pretty unlikely, and thus, for all intents and purposes, the days of the week remain the same.\nHowever, you are now working on an application which has a legacy codebase. This legacy code has an enum named Colour (the British spelling, because I&rsquo;m not in the US). The actual enum might be something different and complicated, but the example of Colour works for the purposes of this article.\nColour has three colours defined inside it &ndash; RED, GREEN, and BLUE.\npublic enum Colour { RED(255, 0, 0), GREEN(0, 255, 0), BLUE(0, 0, 255); int r, g, b; Colour(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } \/\/ getters and toString() } The Colour enum is being used across lots of applications as a dependency. First, you wonder why someone needed to put the Colours as an Enum datatype. But unable to do anything about it, you just accept it and work with whatever is in your fate.\nThe problem with the above enum is, every time some app needs a new colour, you need to add the new colour to your codebase. After adding a new colour, you now need to test, and then re-deploy all your applications. This has to be done every time a new colour is requested. You see the problem &ndash; the colours are supposed to be dynamic, but someone took a decision an eternity ago, and now you are the one in soup.\nYou now want to change enums to make them dynamic, so that any new colour added, is picked up from a database, with minimal code changes across your stack. How do you proceed?\nEnums are also classes Yes! Enums are also classes. We know that enums are static, and classes are not. Technically, you could replace Enum with a class. If you replace an Enum with a Class, you would not even need to change imports in other classes. No part of your code base would even realize it! This will be the basis of our solution &ndash; turn Enum into a Class.\nBut wait! It&rsquo;s not so straightforward. Enums can also be referred directly, like Colour.RED. We do not want to meddle with existing usages of Colour.RED in our code.\nStep 1: Change enum to class When you change the enum to class, your IDE should instantly throw up an error. This is because Enums are compile time constructs which are being referred in other parts of you application. But not to worry!\nStep 2: Create constants of existing Colours To keep the usages of Colour.RED same, we would need to create constants for all the colours defined in the enum (now class).\npublic final class Colour { public static final Colour RED = new Colour(255, 0, 0); public static final Colour GREEN = new Colour(0, 255, 0); public static final Colour BLUE = new Colour(0, 0, 255); private final int r, g, b; private Colour(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } \/\/ getters and toString() } We also do not want the objects of Colour to be created outside the class. If we do not do this, we are essentially allowing anyone to create Colour objects, and defeats the purpose of mimicing the enum. Thus, we would mark the constructor as private.\nCongrats! The IDE should stop raising an error now (inside the Colour class atleast). The above refactoring makes sure that you can still refer to Colour.RED as earlier. Also, now that we made the variables of r, g, and b as private final as we do not want them to change after object creation.\nStep 3: Implement other Enum methods like values() and valueOf() We know that methods like values() and valueOf() are used quite often with enums. To ensure that these usages do not break, we would need to &ldquo;mimic&rdquo; these methods. How can we do that?\nNote the return types of values() and valueOf().\nvalueOf(String) returns in instance of Colour defined by the name provided as a parameter. values() returns an array of Colour, i.e. Colour[] Let us start with the valueOf() method, and it will lead us to the solution of values()\nAs we know, the valueOf() accepts a String as an argument, and returns an instance of Colour. What can we use to preserve the mapping between a String and Colour? A Map!! We can use a HashMap or ConcurrentHashMap for this.\nUpdate 17-07-2021: DO NOT USE HashMap or ConcurrentHashMap, instead use LinkedHashMap, for reasons that will be explained later in the article.\nNote that we currently have no way of knowing what colour an instance is. Of course, we have a constant declared as\npublic static final Colour RED = new Colour(255, 0, 0); but even if we load it into a map, how would we know if the object is for Colour.RED or Colour.GREEN? Is there a way we can get the &ldquo;text&rdquo;\/&ldquo;name&rdquo; of the variable as a String? Not directly, no.\nEnter: Java Reflection\nIt allows an executing Java program to examine or &ldquo;introspect&rdquo; upon itself, and manipulate internal properties of the program. For example, it&rsquo;s possible for a Java class to obtain the names of all its members and display them.\nWe can use this! Let us first define a Map of type Map&lt;String, Colour&gt; as a HashMap or ConcurrentHashMap. We will then use Java Reflection to load up the values inside the Map through a static block.\npublic final class Colour { public static final Colour RED = new Colour(255, 0, 0); public static final Colour GREEN = new Colour(0, 255, 0); public static final Colour BLUE = new Colour(0, 0, 255); private static final Map&lt;String, Colour&gt; map = new LinkedHashMap&lt;&gt;(); static { loadClassData(); } private static void loadClassData() { Arrays.stream(Colour.class.getDeclaredFields()) .filter(declaredField -&gt; declaredField.getType() == Colour.class) .forEach(Colour::putInMap); } private static void putInMap(Field declaredField) { try { map.putIfAbsent(declaredField.getName(), (Colour) declaredField.get(null)); } catch (IllegalAccessException e) { System.err.println(&#34;Could not initialize Colour Map value: &#34; + declaredField.getName() + &#34; &#34; + e); } } private final int r, g, b; private Colour(int r, int g, int b) { this.r = r; this.g = g; this.b = b; } \/\/ getters and toString() } The above codeblock uses Java Streams to load up the map. Let us go through what it does.\nThe Colour.class.getDeclaredFields() fetches all the fields declared inside the Colour class. For each of the field returned, we only want the fields of type Colour. (The previous statement would also return Map&lt;String, Colour&gt;) For each of the fields of Colour, we would call the putInMap() method. The putInMap() takes a parameter of type Field, and loads the data in the map. The variable name is obtained by declaredField.getName(), and the actual object is returned by declaredField.get(null) If you do not understand the above Stream based code, or you&rsquo;re just working with Java 7 and lower, you can use the following:\nprivate static void loadClassData() { for (Field declaredField : Colour.class.getDeclaredFields()) { if (declaredField.getType() == Colour.class) { putInMap(declaredField); } } } We have the data in the map! We can now just implement the valueOf() method as follows:\npublic static Colour valueOf(String name) { Colour colour = map.get(name); if (colour == null) { throw new IllegalArgumentException(&#34;No Colour by the name &#34; + name + &#34; found&#34;); } return colour; } Note that in Enums, the valueOf() returns an IllegalArgumentException if no value is found within the enum. Similarly, we will ensure that our implementation also returns the same exception.\nThe usage of Map enables us to easily implement the values() method. We can implement it by using the map.values() method.\npublic static Colour[] values() { return map.values().toArray(Colour[]::new).clone(); } Update 14-07-2021: The map does not have ordered values, so we need to sort it! The tests have been updated in the later sections.\nUpdate 17-07-2021: Since the values() method produces an array in the order in which the Enum values are defined, we need to preserve the order in the Map as well. This is why we need to use a LinkedHashMap, rather than another Map implementation.\nEvery time the values() is called, it returns the clone of the array values in the map.\nStep 4: Load data from the Database However, the purpose of having a dynamic Enum is still not achieved. We want the values of the colour to be loaded up from a database. The problem now seems trivial. Similar to the way we loaded up the class data inside the map, we must also fetch the data from the database and load it. This needs to take place in the static block as well.\nHowever, in this case we cannot use Java Reflection to get the variable name, simply because there isn&rsquo;t any static variable we can refer to.\nThus, we must add another field into the class named colourName.\npublic final class Colour { public static final Colour RED = new Colour(&#34;RED&#34;, 255, 0, 0); public static final Colour GREEN = new Colour(&#34;GREEN&#34;, 0, 255, 0); public static final Colour BLUE = new Colour(&#34;BLUE&#34;, 0, 0, 255); private static final Map&lt;String, Colour&gt; map = new LinkedHashMap&lt;&gt;(); \/\/ other implemented methods \/\/ new field private final String colourName; private final int r, g, b; private Colour(String colourName, int r, int g, int b) { this.colourName = colourName; this.r = r; this.g = g; this.b = b; } \/\/ getters and toString() } Thus, when we load up the data from the database, we would know what key to use for the Map.\nOur static block would now have\nstatic { loadClassData(); loadDataFromDb(); } private static void loadDataFromDb() { List&lt;ColourDB.ColourData&gt; colourData = new ColourDB().getColours(); for (ColourDB.ColourData colourDatum : colourData) { map.putIfAbsent(colourDatum.getColourName(), new Colour(colourDatum)); } } Our ColourDB contains the static class ColourData, which is exactly the same as the Colour POJO. As we cannot create Colour objects, we need another type to put the data in, and get the data from.\nThe ColourDB is like the following:\npublic class ColourDB { public List&lt;ColourData&gt; getColours() { \/\/ data from DB } static class ColourData { String colourName; int r; int g; int b; public ColourData(String colourName, int r, int g, int b) { this.colourName = colourName; this.r = r; this.g = g; this.b = b; } \/\/ getters } } We can now add another private constructor within Colour that accepts ColourData.\nprivate Colour(ColourDB.ColourData colourDatum) { this.colourName = colourDatum.getColourName(); this.r = colourDatum.getR(); this.g = colourDatum.getG(); this.b = colourDatum.getB(); } Notice that using this method allows you to make Colours dynamic, but prevents you from creating static objects like Colour.RED. If we add the data for the colour &ldquo;BLACK&rdquo; in the DB, we cannot refer to it as Colour.BLACK after this change. We would need to refer to it as Colour.valueOf(&quot;BLACK&quot;), and get the value. This is a trade off required to make it dynamic. However, this allows us to ensure that the existing code is not impacted.\nIf you have a implemented a getter method for colourName, refactor it from getColourName() to name().\nSimilarly, if you use ordinal() method of the enum, ensure that you introduce the ordinal field in the Colour class as well. You would need to store the ordinal field in the DB too.\nYou can also implement the equals() method and change it to compare using == as is done in Enums. One would also need to implement the Comparable interface with the compareTo() method.\nWe will also implement the Serializable interface to enable us to serialize objects. This will ensure we conform to the Enum functionality. Also, Enums cannot be cloned. Hence, we will also implement the clone method and throw CloneNotSupportedException.\nThe updated code would look like the following:\npublic final class Colour implements Comparable&lt;Colour&gt;, Serializable { public static final Colour RED = new Colour(&#34;RED&#34;, 255, 0, 0, 0); public static final Colour GREEN = new Colour(&#34;GREEN&#34;, 0, 255, 0, 1); public static final Colour BLUE = new Colour(&#34;BLUE&#34;, 0, 0, 255, 2); private static final Map&lt;String, Colour&gt; map = new LinkedHashMap&lt;&gt;(); static { loadClassData(); loadDataFromDb(); } private static void loadClassData() { Arrays.stream(Colour.class.getDeclaredFields()) .filter(declaredField -&gt; declaredField.getType() == Colour.class) .forEach(Colour::putInMap); } private static void loadDataFromDb() { List&lt;ColourDB.ColourData&gt; colourData = new ColourDB().getColours(); for (ColourDB.ColourData colourDatum : colourData) { map.putIfAbsent(colourDatum.getColourName(), new Colour(colourDatum)); } } public static Colour[] values() { return map.values().toArray(Colour[]::new).clone(); } public static Colour valueOf(String name) { Colour colour = map.get(name); if (colour == null) { throw new IllegalArgumentException(&#34;No Colour by the name &#34; + name + &#34; found&#34;); } return colour; } private final String colourName; private final int r, g, b; private final int ordinal; private Colour(String colourName, int r, int g, int b, int ordinal) { this.colourName = colourName; this.r = r; this.g = g; this.b = b; this.ordinal = ordinal; } private Colour(ColourDB.ColourData colourData) { this.colourName = colourData.getColourName(); this.r = colourData.getR(); this.g = colourData.getG(); this.b = colourData.getB(); this.ordinal = colourData.getOrdinal(); } private static void putInMap(Field declaredField) { try { map.putIfAbsent(declaredField.getName(), (Colour) declaredField.get(null)); } catch (IllegalAccessException e) { System.err.println(&#34;Could not initialize Colour Map value: &#34; + declaredField.getName() + &#34; &#34; + e); } } public String name() { return colourName; } public int ordinal() { return ordinal; } \/\/ getters \/\/ .. \/\/ .. @Override public boolean equals(Object o) { return this == o; } @Override public int hashCode() { return Objects.hash(colourName, r, g, b, ordinal); } @Override public final int compareTo(Colour o) { Colour self = this; return self.ordinal - o.ordinal; } @Override protected Object clone() throws CloneNotSupportedException { throw new CloneNotSupportedException(); } @Override public String toString() { return &#34;Colour{&#34; + &#34;colourName=&#39;&#34; + colourName + &#39;\\&#39;&#39; + &#34;, r=&#34; + r + &#34;, g=&#34; + g + &#34;, b=&#34; + b + &#34;, ordinal=&#34; + ordinal + &#39;}&#39;; } } and ColourDB as\npublic class ColourDB { public List&lt;ColourData&gt; getColours() { \/\/ data from DB } static class ColourData { String colourName; int r; int g; int b; int ordinal; public ColourData(String colourName, int r, int g, int b, int ordinal) { this.colourName = colourName; this.r = r; this.g = g; this.b = b; this.ordinal = ordinal; } \/\/ getters } } Step 5: Test Ordinarily, this would work. Unless, of course, you actually want to write unit tests for the class.\nHowever, how can we test it? Notice that testing it is almost impossible, unless you have an actual DB. This is because of the following piece of code.\nprivate static void loadDataFromDb() { List&lt;ColourDB.ColourData&gt; colourData = new ColourDB().getColours(); for (ColourDB.ColourData colourDatum : colourData) { map.putIfAbsent(colourDatum.getColourName(), new Colour(colourDatum)); } } Here, the dependency for the Database new ColourDB() is hard-coded inside the class. Testing would require an actual Database connection. We would want to Mock it during testing. If we were using a DI framework like Spring, we could have injected it. However, using pure Java code would require some more refactoring.\nFirst, we need to extract ColourDB into an interface and include the actual implementation as ColourDbImpl.\npublic interface ColourDB { List&lt;ColourData&gt; getColours(); class ColourData { \/\/ existing } } public class ColourDBImpl implements ColourDB { @Override public List&lt;ColourData&gt; getColours() { \/\/ get from DB } } We will now create a class named DB:\npublic class DB { private static ColourDB COLOUR_DB; public DB(ColourDB colourDB) { COLOUR_DB = colourDB; } public static ColourDB getColourDb() { if (COLOUR_DB == null) { COLOUR_DB = new ColourDBImpl(); } return COLOUR_DB; } public static void setColourDb(ColourDB colourDb) { COLOUR_DB = colourDb; } } We can now replace ColourDB in loadDataFromDb with DB.getColourDb(). The code now looks like\nprivate static void loadDataFromDb() { List&lt;ColourDB.ColourData&gt; colourData = DB.getColourDb().getColours(); for (ColourDB.ColourData colourDatum : colourData) { map.putIfAbsent(colourDatum.getColourName(), new Colour(colourDatum)); } } Now that we have refactored it, we can Mock it successfully.\nYou can see the test class ColourTest as follows\n@TestInstance(TestInstance.Lifecycle.PER_CLASS) class ColourTest { public static final String BLACK = &#34;BLACK&#34;; public static final String WHITE = &#34;WHITE&#34;; public static final String YELLOW = &#34;YELLOW&#34;; public static final String RED = &#34;RED&#34;; @Mock ColourDBImpl colourDB; @InjectMocks DB db; @BeforeAll void setUp() { MockitoAnnotations.openMocks(this); ColourDB.ColourData black = new ColourDB.ColourData(BLACK, 255, 255, 255, 3); ColourDB.ColourData white = new ColourDB.ColourData(WHITE, 0, 0, 0, 4); ColourDB.ColourData yellow = new ColourDB.ColourData(YELLOW, 255, 255, 0, 5); Mockito.when(colourDB.getColours()).thenReturn(List.of(black, white, yellow)); } @Test void test_values() { Colour[] values = Colour.values(); assertEquals(Colour.RED.name(), values[0].name()); assertEquals(Colour.valueOf(YELLOW).name(), values[values.length - 1].name()); assertTrue(Arrays.stream(values).anyMatch(colour -&gt; colour.name().equals(Colour.RED.name()))); assertTrue(Arrays.stream(values).anyMatch(colour -&gt; colour.name().equals(Colour.valueOf(WHITE).name()))); assertEquals(6, values.length); } @Test void test_if_instances_are_same() { assertSame(Colour.RED, Colour.valueOf(RED)); assertSame(Colour.valueOf(RED), Colour.valueOf(RED)); assertEquals(Colour.valueOf(RED), Colour.valueOf(RED)); assertSame(Colour.valueOf(WHITE), Colour.valueOf(WHITE)); assertEquals(Colour.valueOf(WHITE), Colour.valueOf(WHITE)); } @Test void test_ordinal() { assertEquals(0, Colour.RED.ordinal()); \/\/ static assertEquals(5, Colour.valueOf(YELLOW).ordinal()); \/\/ dynamic } @Test void test_invalid_colour() { String magenta = &#34;MAGENTA&#34;; IllegalArgumentException exception = assertThrows(IllegalArgumentException.class, () -&gt; Colour.valueOf(magenta)); assertEquals(&#34;No Colour by the name &#34; + magenta + &#34; found&#34;, exception.getMessage()); } @Test void test_compareTo() { int red = Colour.RED.compareTo(Colour.valueOf(&#34;WHITE&#34;)); assertTrue(red &lt; 0); int yellow = Colour.valueOf(&#34;YELLOW&#34;).compareTo(Colour.RED); assertTrue(yellow &gt; 0); } @Test void test_name() { assertEquals(&#34;RED&#34;, Colour.RED.name()); assertEquals(&#34;YELLOW&#34;, Colour.valueOf(&#34;YELLOW&#34;).name()); } } You will need to use @BeforeAll with @TestInstance(TestInstance.Lifecycle.PER_CLASS) as the static block is only executed once. Else Mockito will throw an UnnecessaryStubbingException because the Mock would not execute every test.\nStep 6: Serialization! We did not consider what would happen if we serialize the Colour class. Enum constants are serialized differently than ordinary serializable or externalizable objects. Only the name of the field is serialized, and deserialization uses valueOf() method to get the Enum constant back.\nEnums are effectively singletons. However, the singleton property of our class can be broken during deserialization. Thus, we need to ensure that we preserve the singleton property of Colour as well. We can do that by implementing the readResolve1 method. This will ensure that we only receive an instance of the same class as the one that we have already created. We already store the colour name. So when a new object is created, it will still return the already existing objects that we expect.\npublic final class Colour implements Comparable&lt;Colour&gt;, Serializable { \/\/ Existing code \/\/ \/\/ private Object readResolve() { return Colour.valueOf(colourName); } } We can add a test and verify if this will work.\n@Test void test_serialization_deserialization() throws IOException, ClassNotFoundException { serialize(Colour.valueOf(BLACK)); Colour black = deserialize(); assertNotNull(black); assertEquals(Colour.valueOf(BLACK), black); assertSame(Colour.valueOf(BLACK), black); serialize(Colour.RED); Colour red = deserialize(); assertNotNull(red); assertEquals(Colour.valueOf(RED), red); assertSame(Colour.valueOf(RED), red); assertEquals(Colour.RED, red); assertSame(Colour.RED, red); } void serialize(Colour colour) throws IOException { try (FileOutputStream fos = new FileOutputStream(&#34;data.obj&#34;); ObjectOutputStream oos = new ObjectOutputStream(fos)) { oos.writeObject(colour); } } Colour deserialize() throws IOException, ClassNotFoundException { try (FileInputStream fis = new FileInputStream(&#34;data.obj&#34;); ObjectInputStream ois = new ObjectInputStream(fis)) { return (Colour) ois.readObject(); } } It does! :)\nLimitations As you know, this has a limitation that you cannot statically infer Enum constants, except the ones defined inside Colour. The values in DB must be referred through Colour.valueOf(). Moreover, you would need to change any switch-case statements to use the value of the the Constant, instead of static enum types supported by switch-case. An example:\nswitch (Colour.RED.name()) { case &#34;RED&#34; : System.out.println(&#34;RED&#34;); break; default: } I discovered that this is also known as a type-safe enum, which was used before Enum as types were introduced in Java 5. Granted, this a step lower than Enums, but&hellip; you know.\nThe above is a hack though. In an ideal world, you would never have to try and implement these hacks. However, if you find yourself in such a spot, you know what to do. Please, try to refactor and remove this code though.\nYou can find the code for the project on my Github repository: dynamic-enums.\nDone! We have now created a &ldquo;Dynamic Enum&rdquo;! &#x1f60e;\nYou can now rest in peace, and wish\/hope that the next developer touching this piece of code does not try to contact you.\nReferences and Reading material:\nJava Magazine tutorial on Enums How to use typesafe enums in Java Beware of Java typesafe enumerations More on typesafe enums Enum Tricks: Dynamic Enums Introduction to Java Serialization Java Serialization Docs&#160;&#x21a9;&#xfe0e;\n","permalink":"https:\/\/darshit.dev\/posts\/dynamic-enums\/","summary":"<h3 id=\"but-can-one-even-make-enums-dynamic\">But can one even make Enums dynamic?<\/h3>\n<p>Enums, by definition, are static. They are used to &ldquo;predefine&rdquo; constants. I&rsquo;ll let the official <a href=\"https:\/\/docs.oracle.com\/javase\/tutorial\/java\/javaOO\/enum.html\">Oracle Java Tutorial on Enums<\/a> to help explain the definition.<\/p>","title":"Dynamic Enums"},{"content":"How do you define and use constants in Java?\nMost advice on Internet has the following opinions:\nDeclare public static final for constants in a class Do not use Interfaces for constants The most common way to define a constant is in a class and using public static final. One can then use the constant in another class using ClassName.CONSTANT_NAME. Constants are usually defined in upper cases as a rule, atleast in Java.\nSo if I were to define a constant for the value of Pi(\u03c0), it would be something like:\npublic final class Constants { public static final double PI = 3.14; } This can then be used as Constants.PI whenever we want to reference the value of Pi.\nAnother way one can define constants is by the use of interfaces.\npublic interface Constants { double PI = 3.14; } However, this is not recommended by most sources on the internet. Why? Because it is an anti-pattern.\nBut is it really an Anti-pattern? Let&rsquo;s examine the difference by using both the methods.\nCreating a Constants class: package constants; public final class MathConstantsClass { public static final double PI = 3.14; } Creating an interface: package constants; public interface MathConstantsInterface { double PI = 3.14; } Let us define another interface which will help us test both the above methods.\npackage operations; public interface CircleArea { double calculate(double radius); } The above interface would help us define a contract to calculate the area of a circle. As we know, the area of a circle is dependent only on its radius, and thus is reflected in the above interface.\nThe following class provides the implementation of calculating the area of a circle.\nimport constants.MathConstantsClass; import operations.CircleArea; public class MathConstantsClassImplementation implements CircleArea { public double calculate(double radius) { return MathConstantsClass.PI * radius * radius; } } To test the the above code, let us write a Test class using JUnit.\nimport operations.CircleArea; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MathConstantsClassImplementationTest { @Test void calculate() { CircleArea area = new MathConstantsClassImplementation(); double circleArea = area.calculate(1.0); assertEquals(3.14, circleArea); } } If you run the above piece of test code, the test would pass.\nFor testing how we can use the constants with Interface, let&rsquo;s write another class called MathConstantsInterfaceImplementation.\nimport constants.MathConstantsInterface; import operations.CircleArea; public class MathConstantsInterfaceImplementation implements MathConstantsInterface, CircleArea { public double calculate(double radius) { return PI * radius * radius; } } Similarly a test for the above class is as follows:\nimport operations.CircleArea; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MathConstantsInterfaceImplementationTest { @Test void calculate() { CircleArea area = new MathConstantsInterfaceImplementation(); double circleArea = area.calculate(1.0); assertEquals(3.14, circleArea); } } The above Test would pass. However, the argument against the implementation is that it is not a good practice as there could be field shadowing, and that will override the original value of the constant within the class.\nIt can be better understood with the following example:\nimport constants.MathConstantsInterface; import operations.CircleArea; public class MathConstantsWithInterfaceImplementationAndConstantShadowing implements MathConstantsInterface, CircleArea { private static final double PI = 200; public double calculate(double radius) { return PI * radius * radius; } } If, by chance, someone overrode the value of PI inside the class, it would lead to an incorrect output. It can be easily verified by the following test.\nimport operations.CircleArea; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MathConstantsWithInterfaceImplementationAndConstantShadowingTest { @Test void calculate() { CircleArea area = new MathConstantsWithInterfaceImplementationAndConstantShadowing(); double circleArea = area.calculate(1.0); assertEquals(3.14, circleArea); } } The above test fails. The answer returned by calculate() is 200.0 instead of the expected 3.14. Another argument is, using the interface would pollute the namespace and also lead to the value propagated across the subclasses.\nThe above arguments are valid, and hold true.\nHowever, what no one mentions is that you can still directly use the constants from the interface without implementing the interface. Just like the first example where we use MathConstantsClass.PI, we can also use MathConstantsInterface.PI without affecting the namespace and inheritance and shadowing issues.\nThis can also be easily verified:\nimport constants.MathConstantsInterface; import operations.CircleArea; public class MathConstantsInterfaceWithoutImplementation implements CircleArea { public double calculate(double radius) { return MathConstantsInterface.PI * radius * radius; } } Test class:\nimport operations.CircleArea; import org.junit.jupiter.api.Test; import static org.junit.jupiter.api.Assertions.*; class MathConstantsInterfaceWithoutImplementationTest { @Test void calculate() { CircleArea area = new MathConstantsInterfaceWithoutImplementation(); double circleArea = area.calculate(1.0); assertEquals(3.14, circleArea); } } It would make no difference to our way of implementation. Even the number of imports remain same. Moreover, you do not need additional boilerplate of public static final as members in an interface are public static final by default.\npublic static final double PI = 3.14; vs\ndouble PI = 3.14; What would you prefer? Cleaner code, anyone?\nI have seen most constants almost grouped together if they are used throughout the application. You could also suggest that interface should only be used for contracts, and in most cases they are. However, keeping an interface for solely storing constants doesn&rsquo;t seem to be wrong to me either!\nUnless, of course, some developer tries to implement a class which solely contains constants &ndash; which would beget the question &ndash; WHY?\nYou can check out the code at my Github: https:\/\/github.com\/darshitpp\/JavaConstants\nReferences:\nConstants in Java: Patterns and Anti-Patterns ","permalink":"https:\/\/darshit.dev\/posts\/java-constants-interface\/","summary":"<p>How do you define and use constants in Java?<\/p>\n<p>Most advice on Internet has the following opinions:<\/p>\n<ol>\n<li>Declare <code>public static final<\/code> for constants in a class<\/li>\n<li>Do not use Interfaces for constants<\/li>\n<\/ol>\n<p>The most common way to define a constant is in a class and using <code>public static final<\/code>. One can then use the constant in another class using <code>ClassName.CONSTANT_NAME<\/code>. Constants are usually defined in upper cases as a rule, atleast in Java.<\/p>","title":"The Java Constants Interface Anti-Pattern"},{"content":"I wrote this earlier on a Github gist, but putting it here for a consolidated reference.\nWant to change Java Version\/JAVA_HOME for Ant builds? Open ~\/.antrc file by running vim ~\/.antrc Add JAVACMD=&lt;NEW_JAVA_HOME&gt;\/bin\/java and save The Ant wrapper script for Unix will source (read and evaluate) the file ~\/.antrc before it does anything. On Windows, the Ant wrapper batch-file invokes %HOME%\\antrc_pre.bat at the start and %HOME%\\antrc_post.bat at the end. You can use these files, for example, to set\/unset environment variables that should only be visible during the execution of Ant.\nThe wrapper scripts use the following environment variables (if set):\nJAVACMD\u2014full path of the Java executable. Use this to invoke a different JVM than JAVA_HOME\/bin\/java(.exe). ANT_OPTS\u2014command-line arguments that should be passed to the JVM. For example, you can define system properties or set the maximum Java heap size here. ANT_ARGS\u2014Ant command-line arguments. For example, set ANT_ARGS to point to a different logger, include a listener, and to include the -find flag. Note: If you include -find in ANT_ARGS, you should include the name of the build file to find, even if the file is called build.xml. Source: https:\/\/ant.apache.org\/manual\/running.html\n","permalink":"https:\/\/darshit.dev\/posts\/change-java-version-ant\/","summary":"<p>I wrote this earlier on a <a href=\"https:\/\/gist.github.com\/darshitpp\/f8017cdb61f4056c100edbf0182a6be0\">Github gist<\/a>, but putting it here for a consolidated reference.<\/p>\n<h2 id=\"want-to-change-java-versionjava_home-for-ant-builds\">Want to change Java Version\/JAVA_HOME for Ant builds?<\/h2>\n<ol>\n<li>Open <code>~\/.antrc<\/code> file by running <code>vim ~\/.antrc<\/code><\/li>\n<li>Add <code>JAVACMD=&lt;NEW_JAVA_HOME&gt;\/bin\/java<\/code> and save<\/li>\n<\/ol>\n<blockquote>\n<p>The Ant wrapper script for Unix will source (read and evaluate) the file ~\/.antrc before it does anything.\nOn Windows, the Ant wrapper batch-file invokes %HOME%\\antrc_pre.bat at the start and %HOME%\\antrc_post.bat at the end.\nYou can use these files, for example, to set\/unset environment variables that should only be visible during the execution of Ant.<\/p>","title":"How to change Java Version\/JAVA_HOME for Ant?"},{"content":"A couple of weeks ago, I was tasked with figuring out a way to enable two way SSL. I am a programmer, and have had only a limited experience with networking concepts like SSL\/TLS in my short career. So I turned up blank on how I could make it possible. Moreover, the terminology you&rsquo;d find online is not uniform. From a programming point of view, the term &ldquo;Two way SSL&rdquo; led me to limited results, and I soon realized that other communities have different terminology. For example the &ldquo;Two way SSL&rdquo; is also known as &ldquo;Mutual TLS&rdquo; or &ldquo;mTLS&rdquo; or &ldquo;Client Certificate Authentication&rdquo; in Cloud\/DevOps communitites. This makes finding the right resources online more difficult.\nOur services have SSL enabled, but only the usual one &ndash; similar to the one you&rsquo;d find while visiting this website, but this was a unique thing for me as I didn&rsquo;t even know two way SSL existed. I figured out how it works. However, there were more problems with trying to understand how to implement this. Most guides that I found on the internet were very incomplete, and straight away skipped many parts for someone who&rsquo;d be new to this. This is my attempt at explaining what I have learned, and documenting the same for future reference. It will not explain how two way SSL works, but how to make it work. If you need a quick refresher however, I would direct you to this easy to understand article by Cloudflare explaining where and how mTLS is used.\nThis guide is only for Unix like systems like macOS or Linux. Though I tried this on Windows, but could not make it work.\nPrerequisites Nginx sudo privileges on your system Installing and Configuring Nginx Install Install1 nginx using apt command on your Linux system.\nsudo apt update sudo apt install nginx This will install all of Nginx on the path \/opt\/nginx. All the configuration files we will be editing for two-way SSL would be found within this directory.\nConfigure Nginx to start Before starting up Nginx for use, we need to enable some ports on the firewall that our Nginx can listen incoming connections from.\nsudo ufw app list Output:\nAvailable applications: Nginx Full Nginx HTTP Nginx HTTPS OpenSSH The utility ufw can be used to manage our firewall. Though a knowledge of ufw is not necessary for us, more information can be found here.\nYou can see in the above output that the utility responds us with four profiles. When we installed Nginx, it registered itself with the ufw utility with three profiles.\nNginx HTTP allows Nginx to listen through port 80, for normal HTTP traffic. Nginx HTTPS allows Nginx to listen through port 443, for HTTPS traffic. Nginx Full is a combination of the above both, enabling port 80 and 443 both. We will enable Nginx Full as we have to use our server for SSL, but using normal HTTP connections is not an uncommon use-case either. To enable it, run:\nsudo ufw allow &#39;Nginx Full&#39; You should see the activated profile if you run the below command\nsudo ufw status Output:\nStatus: active To Action From -- ------ ---- OpenSSH ALLOW Anywhere Nginx Full ALLOW Anywhere OpenSSH (v6) ALLOW Anywhere (v6) Nginx Full (v6) ALLOW Anywhere (v6) The Nginx service should already be up and running now. You can check by executing\nsystemctl status nginx Output:\n\u25cf nginx.service - A high performance web server and a reverse proxy server Loaded: loaded (\/lib\/systemd\/system\/nginx.service; enabled; vendor preset: enabled) Active: active (running) since Fri 2018-04-20 16:08:19 UTC; 3 days ago Docs: man:nginx(8) Main PID: 2369 (nginx) Tasks: 2 (limit: 1153) CGroup: \/system.slice\/nginx.service \u251c\u25002369 nginx: master process \/usr\/sbin\/nginx -g daemon on; master_process on; \u2514\u25002380 nginx: worker process Creating Certificates Terminology Certificate Authority (CA): This is an Organization which provides you a Certificate (the .crt file). In reality, anyone (including yourself) can be the CA which issues certificates Certificate Signing Request (CSR .csr): An &ldquo;input form&rdquo; with details (like Name, Organization, Address, etc.) filled by the requester of the certificate which is submitted to the CA Private Key (.key): The private key file used by the CA in conjunction with CSR to sign and generate the certificates Certificate (.crt): The certificate generated by the CA Self Signed Certificate: Consider yourself as a Certificate Authority (CA) and generate the .crt files. Now that we know the terminology, it would be easier to proceed with generating the certificates. The following part of the tutorial requires root\/superuser privileges, so switch to the super user using the sudo su command.\nCreate a directory called certs under the root of the file-system which will hold all the certificates and related files.\n# Create directory mkdir \/certs # Change directory to \/certs cd \/certs # Verify the present working directory pwd Output:\n\/certs In this tutorial, we would be designating ourselves as a Certificate Authority, and then self-sign and generate the certificates.\nGenerate Certificate Authority (CA) files We would be first generating a CA key, which would be the basis for all further certificate generation.\nopenssl genrsa -des3 -out ca.key 4096 Output:\nGenerating RSA private key, 4096 bit long modulus (2 primes) .............................................................++++ ....................................................................................................................................................................................++++ e is 65537 (0x010001) Enter pass phrase for ca.key:&lt;passphrase&gt; Verifying - Enter pass phrase for ca.key:&lt;passphrase&gt; Command options:\ngenrsa: generate RSA private key -des3: encrypts the output key using des3 encryption -out: specifying the output key file 4096: size of private key in bits This generates a file named ca.key in the current directory. You would have to provide a password\/passphrase for the key. For the purposes of this tutorial, I&rsquo;ll be using the same passphrase whenever required.\n&lt;passphrase&gt; = root\nThe next step is the generation of ca.crt\nopenssl req -new -x509 -days 3650 -key ca.key -out ca.crt Output:\nEnter pass phrase for ca.key:&lt;passphrase&gt; Command options:\nreq: used for creating certificate requests -new: generates new certificate request -x509: outputs a new self-signed certificate instead of a certificate request -days 3650: validity of certificate (in this case, 10 years\/3650 days) -key: RSA key to be used for generating the certificate -out: output file for the certificate Once you enter the passphrase (which is the same as we put in the previous step), it&rsquo;ll ask you to provide more information for the self-signed certificate.\nYou are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter &#39;.&#39;, the field will be left blank. ----- Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]:CertAuth Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []: Note the Organization Name parameter is named as CertAuth for this example. This is because we are a CA and CAs should ideally be independent to enable other parties to trust other parties and establish a chain of trust.\nA PEM file certificate would also be needed. This file is way of encoding the certificates.2 To create a PEM file, simply do the following:\ncat ca.key &gt; ca.pem cat ca.key &gt;&gt; ca.pem The ca.key would be something like\n-----BEGIN RSA PRIVATE KEY----- Proc-Type: 4,ENCRYPTED DEK-Info: DES-EDE3-CBC,0E2D38C130456B75 3+0Em2EKRkmCCu79bR7E2uFy\/G1huIGEGsItwDf0C70Hf2bmUUDYazK\/CPZxZCut PDximngoGaLSdLQ2HWGjjCe59pJxxZknxHu9QVy3mIWLixAZWevDUnoK1q+Wqy0M -----END RSA PRIVATE KEY----- -----BEGIN CERTIFICATE----- MIIFSzCCAzOgAwIBAgIUeawaQJUIAPKOKhrIJDjMVCYVx4MwDQYJKoZIhvcNAQEL BQAwNTELMAkGA1UEBhMCQVUxEzARBgNVBAgMClNvbWUtU3RhdGUxETAPBgNVBAoM -----END CERTIFICATE----- Generating Client\/User Certificates At this point, we have three files in the certs directory.\nca.key ca.crt ca.pem We now would be generating client\/user certificates. The command to generate the user.key is similar to the one used to create the ca.key\nopenssl genrsa -des3 -out user.key 4096 Output:\nGenerating RSA private key, 4096 bit long modulus (2 primes) .....................................................................................................................................................++++ .......................++++ e is 65537 (0x010001) Enter pass phrase for user.key: Verifying - Enter pass phrase for user.key: As mentioned earlier, the passphrase to be used for user.key is still the same.\nThe client\/user certificate aren&rsquo;t supposed to be self-signed, and we would need to generate a CSR. It means the signing is to be done by a CA(even though in this case, we own the CA!). The way to do this is\nopenssl req -new -key user.key -out user.csr Output:\nEnter pass phrase for user.key:&lt;passphrase&gt; You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter &#39;.&#39;, the field will be left blank. ----- Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]:User Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []: Email Address []: Please enter the following &#39;extra&#39; attributes to be sent with your certificate request A challenge password []: An optional company name []: The Organization Name would be User as this certificate is for a Client\/User. DO NOT keep it the same as the one for CA.\nThe next step would be to create a User Certificate from the User CSR.\nopenssl x509 -req -days 365 -in user.csr -CA ca.crt -CAkey ca.key -set_serial 01 -out user.crt Output:\nSignature ok subject=C = AU, ST = Some-State, O = User Getting CA Private Key Enter pass phrase for ca.key:&lt;passphrase&gt; Command options:\nx509: standard format for public key certificates -CA: the CA certificate -CAkey: the key to generate the certificate from -set_serial 01: the serial version of the certificate to be generated. The user certificate can be regenerated by incrementing the serial number from the same user.csr after 365 days when it expires. You can see that it displays data from the CSR, and then uses the CA key to generate user.crt.\nTo enable us to use the certificate from a web browser, we would need to create the certificate in the PFX file format.\nopenssl pkcs12 -export -out user.pfx -inkey user.key -in user.crt -certfile ca.crt Output:\nEnter pass phrase for user.key:&lt;passphrase&gt; Enter Export Password:&lt;passphrase&gt; Verifying - Enter Export Password:&lt;passphrase&gt; You can verify if the generated certificate can be decrypted using the CA certificate by the following command\nopenssl verify -verbose -CAfile ca.crt user.crt Output:\nuser.crt: OK The files that we currently have in the directory are\nca.key ca.crt ca.pem user.key user.csr user.crt user.pfx Generating Server Certificates This is similar to generating the User certificates, with the following commands\nGenerate the Server key. For server certificates, the standard naming convention seems to be &lt;website-domain-name&gt;.&lt;key&gt;\nopenssl genrsa -out nginx.mssl.com.key 4096 Output:\nGenerating RSA private key, 4096 bit long modulus (2 primes) .....................................++++ .........................++++ e is 65537 (0x010001) Use the above generated key to generate a CSR.\nopenssl req -new -key nginx.mssl.com.key -out nginx.mssl.com.csr Output:\nYou are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter &#39;.&#39;, the field will be left blank. ----- Country Name (2 letter code) [AU]: State or Province Name (full name) [Some-State]: Locality Name (eg, city) []: Organization Name (eg, company) [Internet Widgits Pty Ltd]:Server Organizational Unit Name (eg, section) []: Common Name (e.g. server FQDN or YOUR name) []:nginx.mssl.com Email Address []: Please enter the following &#39;extra&#39; attributes to be sent with your certificate request A challenge password []: An optional company name []: Make sure to put the Organization Name as Server and Common Name (which is the website name) as nginx.mssl.com\nWe can now use the CSR along with the CA files to generate the CRT for our server.\nopenssl x509 -req -days 365 -sha256 -in nginx.mssl.com.csr -CA ca.crt -CAkey ca.key -set_serial 1 -out nginx.mssl.com.crt Output:\nSignature ok subject=C = AU, ST = Some-State, O = Server, CN = nginx.mssl.com Getting CA Private Key Enter pass phrase for ca.key:&lt;passphrase&gt; All the certificates are now ready for our use!\nca.key ca.crt ca.pem user.key user.csr user.crt user.pfx nginx.mssl.com.key nginx.mssl.com.csr nginx.mssl.com.crt Setting up our &ldquo;Website&rdquo; with Nginx Of course, we aren&rsquo;t setting up a real website. But we do want to make our SSL authentication work on the domain nginx.mssl.com. We can do this by a little &ldquo;hack&rdquo; by changing our \/etc\/hosts file.\nFire up a new shell, and use\nsudo vim \/etc\/hosts Add the following line to the file and save.\n127.0.0.1 nginx.mssl.com This will enable your local machine to resolve the domain nginx.mssl.com to your locahost.\nThe website will not work at the moment &ndash; you&rsquo;d have to specify the sources\/web pages it needs to serve when requested.\nCreate a file index.html on the directory path \/usr\/share\/nginx\/mssl with the contents:\n&lt;html&gt; &lt;body&gt; &lt;h1&gt;Welcome to nginx!-mutual ssl test&lt;\/h1&gt; &lt;\/body&gt; &lt;\/html&gt; If the TLS handshake is successful, the web server should serve the file created above.\nConfiguring the Nginx server to enable two way SSL All our certificates are at root in \/certs directory. For simplicity, we would be copying the certificates to \/etc\/nginx\/certs directory.\ncp -r \/certs \/etc\/nginx\/certs Also ensure that the certificates can be used by nginx service by providing them the access\nchmod 777 -R certs\/ We would not be fiddling with the default nginx configuration which is present in the nginx.conf file. Instead, we would be creating a new file called proxy.conf using in the \/etc\/nginx\/sites-available directory.\nCreate the file proxy.conf using the command\ncd \/etc\/nginx\/sites-available touch proxy.conf Enter the contents as the following (Notice the comments have more explanation):\nserver { # Listen on port 443 for HTTPS connections listen 443; # Turn SSL on ssl on; # Name of the server\/website server_name nginx.mssl.com; # See https:\/\/nginx.org\/en\/docs\/http\/ngx_http_proxy_module.html#proxy_ssl_server_name proxy_ssl_server_name on; # This is the server SSL certificate ssl_certificate \/etc\/nginx\/certs\/nginx.mssl.com.crt; # This is the server certificate key ssl_certificate_key \/etc\/nginx\/certs\/nginx.mssl.com.key; # Important: # This is the CA cert against which the client\/user will be validated # In our case since the Server and the Client certificate is # generated from the same CA, we use the ca.crt # But in actual production, the Client certificate might be # created from a different CA ssl_client_certificate \/etc\/nginx\/certs\/ca.crt; # Enables mutual TLS\/two way SSL to verify the client ssl_verify_client on; # Number of intermediate certificates to verify. Good explanation of # certificate chaining can be found at # https:\/\/cheapsslsecurity.com\/p\/what-is-ssl-certificate-chain\/ ssl_verify_depth 2; # Any error during the connection can be found on the following path error_log \/var\/log\/nginx\/error.log debug; ssl_prefer_server_ciphers on; ssl_protocols TLSv1.1 TLSv1.2; ssl_ciphers &#39;ECDHE-RSA-AES128-GCM-SHA256:ECDHE-ECDSA-AES128-GCM-SHA256:ECDHE-RSA-AES256-GCM-SHA384:ECDHE-ECDSA-AES256-GCM-SHA384:kEDH+AESGCM:ECDHE-RSA-AES128-SHA256:ECDHE-ECDSA-AES128-SHA256:ECDHE-RSA-AES128-SHA:ECDHE-ECDSA-AES128-SHA:ECDHE-RSA-AES256-SHA384:ECDHE-ECDSA-AES256-SHA384:ECDHE-RSA-AES256-SHA:ECDHE-ECDSA-AES256-SHA:DHE-RSA-AES128-SHA256:DHE-RSA-AES128-SHA:DHE-RSA-AES256-SHA256:DHE-DSS-AES256-SHA:AES128-GCM-SHA256:AES256-GCM-SHA384:ECDHE-RSA-RC4-SHA:ECDHE-ECDSA-RC4-SHA:RC4-SHA:HIGH:!aNULL:!eNULL:!EXPORT:!DES:!3DES:!MD5:!PSK&#39;; keepalive_timeout 10; ssl_session_timeout 5m; # Matches the &#34;root&#34; of the website # If TLS handshake is successful, the request is routed to this block location \/ { # path from which the website is served from root \/usr\/share\/nginx\/mssl; # index file name index index.html index.htm; } } Nginx has a good Beginner&rsquo;s Guide to Nginx.\nTo enable Nginx to use the above configuration, we also have to link the same in the \/etc\/nginx\/sites-enabled directory.\nTo accomplish this, use\nln -s \/etc\/nginx\/sites-available\/proxy.conf \/etc\/nginx\/sites-enabled\/proxy.conf This creates a symbolic link into \/etc\/nginx\/sites-enabled\/proxy.conf from \/etc\/nginx\/sites-available\/proxy.conf. Consider it as you having many server configurations in the sites-available, but only what you chose to &ldquo;enable&rdquo; in the sites-enabled will be active.\nWe now just have to restart the Nginx for the configuration to be active!\nsystemctl restart nginx I&rsquo;ll be using Postman to test our changes. However, you&rsquo;ll need to configure Postman to send the Client Certificates with the request3.\nTo configure the Certificates, navigate to Settings -&gt; Certificates Tab.\nThere will be a section to add the CA Certificate named CA Certificates, and this certificate should be a PEM file. Select the ca.pem from \/etc\/nginx\/certs. A mistake would be to select the file from the root directory \/certs but this will not work as Postman wouldn&rsquo;t be able to access the file.\nThere would be another section below for Client Certificates. Click on Add Certificate, and put the details as the following:\nHost: nginx.mssl.com CRT File: \/etc\/nginx\/certs\/user.crt KEY File: \/etc\/nginx\/certs\/user.key PFX File: \/etc\/nginx\/certs\/user.pfx Passphrase: &lt;passphrase&gt; Now try to fire a GET request to the domain https:\/\/nginx.mssl.com. If everything was configured successfully, you&rsquo;ll get the following response:\n&lt;html&gt; &lt;body&gt; &lt;h1&gt;Welcome to nginx!-mutual ssl test&lt;\/h1&gt; &lt;\/body&gt; &lt;\/html&gt; If there&rsquo;s an error in the configuration, you&rsquo;ll get the following error response:\n&lt;html&gt; &lt;head&gt; &lt;title&gt;400 No required SSL certificate was sent&lt;\/title&gt; &lt;\/head&gt; &lt;body bgcolor=&#34;white&#34;&gt; &lt;center&gt; &lt;h1&gt;400 Bad Request&lt;\/h1&gt; &lt;\/center&gt; &lt;center&gt;No required SSL certificate was sent&lt;\/center&gt; &lt;hr&gt; &lt;center&gt;nginx\/1.14.0 (Ubuntu)&lt;\/center&gt; &lt;\/body&gt; &lt;\/html&gt; Hope this post was of some help!!\nReference:\nThis article is good for the demo part. The post Client Certificate Auth With Nginx was instrumental in explaining the ssl_client_certificate directive and how to use it. This post is as close to perfection as it gets regarding the steps for generating Certificates, but I couldn&rsquo;t manage to make it work fully with Nginx. (Especially because it skips the demo part + it could be a little more descriptive with generation of the certificates) This article is good, but still unclear for someone starting out. I used this article to actually learn about generating the certificates especially because it provides easy commands and decent explanation. The main resource for installing Nginx is this tutorial by DigitalOcean. All the relevant steps have been described in my article.&#160;&#x21a9;&#xfe0e;\nMore info here&#160;&#x21a9;&#xfe0e;\nClient Certificates: Postman Learning Center&#160;&#x21a9;&#xfe0e;\n","permalink":"https:\/\/darshit.dev\/posts\/two-way-ssl-nginx\/","summary":"<p>A couple of weeks ago, I was tasked with figuring out a way to enable two way SSL. I am a programmer, and have had only a limited experience with networking concepts like SSL\/TLS in my short career. So I turned up blank on how I could make it possible. Moreover, the terminology you&rsquo;d find online is not uniform. From a programming point of view, the term &ldquo;Two way SSL&rdquo; led me to limited  results, and I soon realized that other communities have different terminology. For example the &ldquo;Two way SSL&rdquo; is also known as &ldquo;Mutual TLS&rdquo; or &ldquo;mTLS&rdquo; or &ldquo;Client Certificate Authentication&rdquo; in Cloud\/DevOps communitites. This makes finding the right resources online more difficult.<\/p>","title":"How To Implement Two Way SSL With Nginx"},{"content":"Yes, you read that right.\nTo give you some context, some time ago, our (my org&rsquo;s) Redis usage was un-tracked &ndash; meaning we didn&rsquo;t know why our Redis memory was being occupied as much as it was. Our 2.5GB of Redis ElastiCache was almost close to being full, and if it somehow reached its limit, our system would start to fail. Though there were fallbacks in place, Redis could turn out to be a bottle-neck.\nIn this post, I would try to explain how we reduced the storage occupied by the data by more than 50%. This would also kind of be a step by step guide from the basics, so if you&rsquo;re just interested in how Redis is being used, just skip the and go to the Optimization section.\nBasic Setup I would be using the latest version of Spring Boot from https:\/\/start.spring.io. Firstly, select our two of our main dependencies - Spring Boot Web and Spring Data Reactive Redis.\nYou would find these in the pom.xml file when you download the starter project.\nThe Spring Boot Web is for building basic web applications with Spring Boot, whereas Spring Data Reactive Redis would be used for connecting and using Redis inside the application. At its core, the Redis dependency by default uses the Lettuce Redis client, and is supported by the latest versions of Spring Boot.\nNote that I&rsquo;m going to skip the installation of Redis, as there are other guides available for every operating system. You do need the Redis Server to be started for our application to work successfully.\nAfter downloading the basic application, you&rsquo;ll need to extract and open it in your favourite IDE (my favourite one is IntelliJ IDEA).\nIn my case the project name is redis-util, and you&rsquo;ll find my &ldquo;base packages&rdquo; to be named com.darshitpp.redis.redisutil. This base package would have a class called RedisUtilApplication, which in my case has the following configuration.\n@SpringBootApplication @ComponentScan(basePackages = {&#34;com.darshitpp.redis.redisutil&#34;}) public class RedisUtilApplication { public static void main(String[] args) { SpringApplication.run(RedisUtilApplication.class, args); } } I have manually added the @ComponentScan annotation to specify a top-level package name under where Spring should look for defined Beans\/Configurations.\nTo connect to Redis, I create a configuration class called LettuceRedisConfiguration, under a new package named configuration(note that this should be under the basePackages path defined above.\nYou could define the configuration in the RedisUtilApplication class itself, but I want this to be as &ldquo;production-ready&rdquo; as possible. Thus, it&rsquo;s a good practice to separate out your different parts of application.\nMy configuration class is\n@Configuration public class LettuceRedisConfiguration { @Bean public LettuceConnectionFactory redisConnectionFactory() { return new LettuceConnectionFactory(new RedisStandaloneConfiguration(&#34;localhost&#34;, 6379)); } } It is a very simple class, which has the configuration of which URL to connect to for Redis. In my case, it is localhost, but in most production apps, it would be an external Redis server. Port 6379 is the default port on which the Redis server starts. This Bean would return us a &ldquo;factory&rdquo; of Redis connections. Think of this as something which would allow you to connect to Redis when required.\nAt this point, my package structure looks like:\n-&gt;src -&gt;main -&gt;java -&gt;com.darshitpp.redis.redisutil -&gt;configuration Now that we know how to connect to a Redis server, we need to figure out what data we need to store in Redis. In our case, we would be storing User data. This is the &ldquo;domain model&rdquo; of our application (domain model could be translated to a table in a Database, but we don&rsquo;t have a table in our scenario). This User is stored in a package called domain.\nThe User would have three fields, namely, firstName, lastName, and birthday.\nBefore storing the objects in Redis, it is a good idea to identify how you will store the data so that it&rsquo;s efficient to fetch it back. What that means is Redis being a simple Key-Value store, you would need to identify the Key you would be storing the Value with. In our case, I am choosing firstName as the key. The data would be stored in a hash, so the hashKey that we select would be the lastName and the value mapped to the hashKey is the User object.\nThis is because Hashes in Redis have the following structure:\nkey1 --- hashKey1 === value1 --- hashKey2 === value2 --- hashKey3 === value3 key2 --- hashKey4 === value4 --- hashKey5 === value5 . . . You could also imagine it as a tree with the top level nodes being the Keys, the immediate next level to be hashKeys, and the leaf nodes to be the values. To access value2, you would need to have key1 and hashKey2.\nOur example is a bit incorrect, as a User could have same key=firstName and hashKey=lastName as another user, and Redis will overwrite value. However, for brevity, we will assume there are unique Users using our application.\nWe would now be creating a controller class called NormalController which would act as an entry point for our API. We have named it NormalController for reasons that will be clear further in this article.\n@RestController @RequestMapping(&#34;\/normal&#34;) public class NormalController { private final NormalService normalService; @Autowired public NormalController(NormalService normalService) { this.normalService = normalService; } @GetMapping(&#34;\/get&#34;) public User get(@RequestParam(&#34;firstName&#34;) String firstName, @RequestParam(&#34;lastName&#34;) String lastName) { return normalService.get(firstName, lastName); } @PostMapping(&#34;\/insert&#34;) public void insert(@RequestBody User user) { normalService.put(user); } @PostMapping(&#34;\/delete&#34;) public void delete(@RequestParam(&#34;firstName&#34;) String firstName) { normalService.delete(firstName); } } NormalController also has a service named NormalService which is Autowired. The class should be defined in a new packaged named controller after which the package structure would look like\n-&gt;src -&gt;main -&gt;java -&gt;com.darshitpp.redis.redisutil -&gt;configuration -&gt;domain -&gt;controller Our basic operations would be simple CRUD like operations which NormalService implements using a custom Operations interface.\npublic interface Operations { User get(String firstName, String lastName); void put(User user); void delete(String firstName); } To use Lettuce in our application, we need to do a couple of more things though. Just like to access JDBC, there&rsquo;s a provision for a JdbcTemplate, you must similarly use a RedisTemplate to operate on Redis. We must also define in what format will Redis store the data inside it. By default, it stores data as a String. However, know that you&rsquo;ll be storing User in Redis, and in order to facilitate the storage and fetch from Redis, you would need a way through which Redis will be able to identify and convert it back to the appropriate type of data you want.\nThink of this as talking with someone who doesn&rsquo;t know the same language as you do. If you want to communicate with someone who only speaks Spanish, you would need to find a translator who would convert English into Spanish for you. This process of conversion and recovery is known as Serialization and Deserialization.\nEnglish to Spanish = Serialization Spanish to English = Deserialization\nThus, we need a translator or a Serializer in our case too. We would be using Jackson for this process. Jackson is a nifty library which Spring Boot supports out-of-the-box to handle Json.\nWe would need to create a Serializer which implements RedisSerializer for our purposes. In our case, I have created a class JsonRedisSerializer inside a new package called serializer.\nclass JsonRedisSerializer&lt;T&gt; implements RedisSerializer&lt;T&gt; { public static final Charset DEFAULT_CHARSET; private final JavaType javaType; private ObjectMapper objectMapper = new ObjectMapper() .registerModules(new Jdk8Module(), new JavaTimeModule(), new ParameterNamesModule(JsonCreator.Mode.PROPERTIES)) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .setSerializationInclusion(JsonInclude.Include.NON_NULL); public JsonRedisSerializer(Class&lt;T&gt; type) { this.javaType = JavaTypeHandler.getJavaType(type); } public T deserialize(@Nullable byte[] bytes) throws SerializationException { if (bytes == null || bytes.length == 0) { return null; } else { try { return this.objectMapper.readValue(bytes, 0, bytes.length, this.javaType); } catch (Exception ex) { throw new SerializationException(&#34;Could not read JSON: &#34; + ex.getMessage(), ex); } } } public byte[] serialize(@Nullable Object value) throws SerializationException { if (value == null) { return new byte[0]; } else { try { return this.objectMapper.writeValueAsBytes(value); } catch (Exception ex) { throw new SerializationException(&#34;Could not write JSON: &#34; + ex.getMessage(), ex); } } } static { DEFAULT_CHARSET = StandardCharsets.UTF_8; } } As you can see, it has two methods called serialize and deserialize. Each of these methods use the Jackson&rsquo;s ObjectMapper for conversion.\nThere is also a class named JavaTypeHandler which helps you get the Type of the object you&rsquo;re trying to serialize.\nfinal class JavaTypeHandler { static &lt;T&gt; JavaType getJavaType(Class&lt;T&gt; clazz) { return TypeFactory.defaultInstance().constructType(clazz); } } Consequently, we would also need a class which returns us a RedisTemplate which utilizes this serializer. I would name this class RedisSerializationBuilder.\npublic final class RedisSerializationBuilder { public static &lt;T&gt; RedisTemplate&lt;String, T&gt; getNormalRedisTemplate(final LettuceConnectionFactory factory, final Class&lt;T&gt; clazz) { JsonRedisSerializer&lt;T&gt; jsonRedisSerializer = new JsonRedisSerializer&lt;&gt;(clazz); RedisTemplate&lt;String, T&gt; redisTemplate = new RedisTemplate&lt;&gt;(); redisTemplate.setConnectionFactory(factory); redisTemplate.setDefaultSerializer(RedisSerializer.json()); redisTemplate.setKeySerializer(RedisSerializer.string()); redisTemplate.setValueSerializer(RedisSerializer.string()); redisTemplate.setHashKeySerializer(RedisSerializer.string()); redisTemplate.setHashValueSerializer(jsonRedisSerializer); redisTemplate.afterPropertiesSet(); return redisTemplate; } } Notice that the above method will return you a template specific to a particular domain model(in our case, the User) using Generics. It also specifies what connection factory is to be used, what should be the default key\/value\/hashKey\/hashValue serializers.\nConsequently, the NormalService looks like\n@Service public class NormalService implements Operations{ private final RedisTemplate&lt;String, User&gt; redisTemplate; private final HashOperations&lt;String, String, User&gt; hashOperations; public NormalService(LettuceConnectionFactory redisConnectionFactory) { this.redisTemplate = RedisSerializationBuilder.getNormalRedisTemplate(redisConnectionFactory, User.class); this.hashOperations = this.redisTemplate.opsForHash(); } @Override public User get(String firstName, String lastName) { return hashOperations.get(firstName, lastName); } @Override public void put(User user) { hashOperations.put(user.getFirstName(), user.getLastName(), user); } @Override public void delete(String firstName) { hashOperations.delete(firstName); } } I then inserted a User, using the POST method, and URL: localhost:8080\/normalService\/insert Request Body:\n{ &#34;firstName&#34;: &#34;Priscilla&#34;, &#34;lastName&#34;: &#34;Haymes&#34;, &#34;birthday&#34;: &#34;2020-04-12T11:15:00Z&#34; } If I then run this application for 100 Users, I find the following stats for the memory usage in Redis (I used the memory stats command using the redis-cli)\n21) &#34;keys.count&#34; 22) (integer) 100 23) &#34;keys.bytes-per-key&#34; 24) (integer) 1044 25) &#34;dataset.bytes&#34; 26) (integer) 32840 Using the hgetall command for a key gives me\n127.0.0.1:6379&gt;hgetall &#34;Priscilla&#34; 1) &#34;Haymes&#34; 2) &#34;{\\&#34;firstName\\&#34;:\\&#34;Priscilla\\&#34;,\\&#34;lastName\\&#34;:\\&#34;Haymes\\&#34;,\\&#34;birthday\\&#34;:1586690100000}&#34; Notice that 2) gives us the actual type of data stored in Redis -&gt; Json!\nOur basic structure for further optimizations is in place! Yay!\nOptimization MessagePack is here to the rescue! As I said, you&rsquo;d need a &ldquo;transalation&rdquo; mechanism. What if the translator is an expert, and converts your English into Spanish in as few words as possible? MessagePack is the same!\nYou would need to add two more dependencies in your pom.xml file.\n&lt;dependency&gt; &lt;groupId&gt;org.msgpack&lt;\/groupId&gt; &lt;artifactId&gt;msgpack-core&lt;\/artifactId&gt; &lt;version&gt;0.8.20&lt;\/version&gt; &lt;\/dependency&gt; &lt;dependency&gt; &lt;groupId&gt;org.msgpack&lt;\/groupId&gt; &lt;artifactId&gt;jackson-dataformat-msgpack&lt;\/artifactId&gt; &lt;version&gt;0.8.20&lt;\/version&gt; &lt;\/dependency&gt; We create a controller called MsgPackController and a service called MsgPackService almost similar to NormalController and NormalService. We would create a MsgPackSerializer to serialize using MessagePack.\nclass MsgPackRedisSerializer&lt;T&gt; implements RedisSerializer&lt;T&gt; { public static final Charset DEFAULT_CHARSET; private final JavaType javaType; private ObjectMapper objectMapper = new ObjectMapper(new MessagePackFactory()) .registerModules(new Jdk8Module(), new JavaTimeModule()) .configure(SerializationFeature.WRITE_DATES_AS_TIMESTAMPS, true) .configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false) .configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false) .setSerializationInclusion(JsonInclude.Include.NON_NULL); public MsgPackRedisSerializer(Class&lt;T&gt; type) { this.javaType = JavaTypeHandler.getJavaType(type); } public T deserialize(@Nullable byte[] bytes) throws SerializationException { if (bytes == null || bytes.length == 0) { return null; } else { try { return this.objectMapper.readValue(bytes, 0, bytes.length, this.javaType); } catch (Exception ex) { throw new SerializationException(&#34;Could not read MsgPack JSON: &#34; + ex.getMessage(), ex); } } } public byte[] serialize(@Nullable Object value) throws SerializationException { if (value == null) { return new byte[0]; } else { try { return this.objectMapper.writeValueAsBytes(value); } catch (Exception ex) { throw new SerializationException(&#34;Could not write MsgPack JSON: &#34; + ex.getMessage(), ex); } } } static { DEFAULT_CHARSET = StandardCharsets.UTF_8; } } The only major noticeable change is an instance of MessagePackFactory being passed into the ObjectMapper. This would act as a bridge between binary and String formats of data between Redis and our Spring Boot application.\nTesting our changes (after clearing the previously utilized storage from redis gives us the following:\n127.0.0.1:6379&gt; hgetall &#34;Priscilla&#34; 1) &#34;Haymes&#34; 2) &#34;\\x83\\xa9firstName\\xa9Priscilla\\xa8lastName\\xa6Haymes\\xa8birthday\\xcf\\x00\\x00\\x01qn\\x19\\x8b &#34; 127.0.0.1:6379&gt; memory stats . . . 21) &#34;keys.count&#34; 22) (integer) 100 23) &#34;keys.bytes-per-key&#34; 24) (integer) 876 25) &#34;dataset.bytes&#34; 26) (integer) 15976 Compare the dataset.bytes from the current memory to the previously recorded one. 15976 bytes vs 32840 bytes, nearly 50% reduction already!\nBut wait, we can reduce it further. How, you ask. Compression! What if we compress the data and then store it? In our case it would work! This time, Snappy to the rescue!\nYour first question after this would be: compression and decompression takes time. Wouldn&rsquo;t it be detrimental on production? Snappy has the answer to this too.\nIt does not aim for maximum compression, or compatibility with any other compression library; instead, it aims for very high speeds and reasonable compression.\nUsing Snappy is also as simple as adding the dependency in pom.xml, and a couple of lines of code changes. Just add Snappy.compress while serialization and Snappy.decompress while deserialization.\n&lt;dependency&gt; &lt;groupId&gt;org.xerial.snappy&lt;\/groupId&gt; &lt;artifactId&gt;snappy-java&lt;\/artifactId&gt; &lt;version&gt;1.1.7.3&lt;\/version&gt; &lt;\/dependency&gt; Testing it again with the same inputs returns the following\n127.0.0.1:6379&gt; hgetall &#34;Priscilla&#34; 1) &#34;Haymes&#34; 2) &#34;7\\\\\\x83\\xa9firstName\\xa9Priscilla\\xa8la\\t\\x13`\\xa6Haymes\\xa8birthday\\xcf\\x00\\x00\\x01qn\\x19\\x8b &#34; 127.0.0.1:6379&gt; memory stats . . . 21) &#34;keys.count&#34; 22) (integer) 100 23) &#34;keys.bytes-per-key&#34; 24) (integer) 873 25) &#34;dataset.bytes&#34; 26) (integer) 15720 You can see that the size of the data set is smaller, 15720 bytes vs 15976 bytes, a marginal difference, but with larger amounts of data, this difference increases.\nIn my case, cleaning and restructuring the data, and utilizing the above techniques, we brought down the memory usage from 2GB to less than 500MB.\nThe full code can be found on my Github for redis-util.\nSpecial mention to Rahul Chopda (@_RahulChopda) for his guidance! You have been a best mentor anyone could ask for!\n","permalink":"https:\/\/darshit.dev\/posts\/reduce-redis-memory-usage\/","summary":"<p>Yes, you read that right.<\/p>\n<p>To give you some context, some time ago, our (my org&rsquo;s) Redis usage was un-tracked &ndash; meaning we didn&rsquo;t know why our Redis memory was being occupied as much as it was. Our 2.5GB of Redis ElastiCache was almost close to being full, and if it somehow reached its limit, our system would start to fail. Though there were fallbacks in place, Redis could turn out to be a bottle-neck.<\/p>","title":"How to achieve a 50% reduction in Redis memory usage"},{"content":"IntelliJ IDEA is an awesome IDE, and a lesser known and used feature is Live Templates.\nLive Templates enable you to use code snippets with just a few keystrokes. A lot of great ones are provided out-of-the-box by IntelliJ. You can view them using the shortcut press Double Shift and then typing Live Templates. The shortcut works regardless of the OS you&rsquo;re currently using (and I am too lazy to specify OS specific menus).\nSome of the examples of Live Templates are:\nTyping psvm replaces it with\npublic static void main(String[] args){ } Typing psfs magically turns it into\npublic static final String I was recently refactoring a lot of classes and I had to replace a lot of legacy logging initialization statements to using slf4j logging library like the following:\nimport org.slf4j.Logger; import org.slf4j.LoggerFactory; public class LoggerTest { public static final Logger logger = LoggerFactory.getLogger(LoggerTest.class); } I had more than 30 different classes to refactor as the above, and I certainly didn&rsquo;t want to painstakingly write everything by hand again (confirms that I&rsquo;m lazy).\nFortunately, IntelliJ Live Templates came to my rescue! I fired up the Live Templates menu using the shortcut mentioned above, and clicked on the + button at the top right.\nI then clicked on Live Template button. The UI now points to the bottom which asks you to put an abbreviation.\nLet&rsquo;s input the abbreviation as psfl which stands for public static final Logger, which can be also put in the description.\nWrite the following code in the Template text box:\npublic static final Logger logger = LoggerFactory.getLogger(); But hang on, the IDE gives us a warning to define a context where it would be used at. We want the template to be only used in Java, so we click on the Define button, and select Java.\nYou may now notice the IDE now applies syntax highlighting on the template.\nWait, we are still not there yet. I certainly don&rsquo;t want to manually write every class name inside the getLogger function! At this point, I was not sure how I could achieve that. Cue in a bit of googling, stackoverflow again came to the rescue.\nI found the following answer: https:\/\/stackoverflow.com\/a\/8552882\/4840501\npublic static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger($CLASS_NAME$); $END$ So I copy-pasted the code in my template screen(what did you expect? :P)\nYou&rsquo;d then need to define what $CLASS_NAME$ means. To do that, click on the Edit Variables button and select className() in the Expression box.\nThe $END$ variable means where you want your cursor at, after the template is applied.\nClick on Apply and Ok.\nWe&rsquo;re done!\nFire up your classes and refactor with 10x speed!\nRelevant link: https:\/\/www.jetbrains.com\/help\/idea\/creating-and-editing-live-templates.html\n","permalink":"https:\/\/darshit.dev\/posts\/using-intellij-idea-live-templates\/","summary":"<p>IntelliJ IDEA is an awesome IDE, and a lesser known and used feature is Live Templates.<\/p>\n<p>Live Templates enable you to use code snippets with just a few keystrokes. A lot of great ones are provided out-of-the-box by IntelliJ. You can view them using the shortcut press <code>Double Shift<\/code> and then typing <code>Live Templates<\/code>. The shortcut works regardless of the OS you&rsquo;re currently using (and I am too lazy to specify OS specific menus).<\/p>","title":"Using IntelliJ IDEA Live Templates"},{"content":"For people who are unaware of the case, the Sabarimala Temple is an annual pilgrimage site to a lot of Indians which traditionally has the practice of not allowing entry to the women pilgrims of the ages between 10-50 years inside the temple premises.\nConsequently, a PIL was filed in the Supreme Court of India, stating that this practice was discriminatory to women.\nRecently, the Supreme Court ruled that this indeed was discriminatory, and abolished the practice.\nBefore putting forth my views on the subject, I&rsquo;d like to say that I&rsquo;m not an expert in law and my comprehension of the arguments presented in the Supreme Court may probably be incorrect. This is my attempt at questioning my own arguments and views regarding the case.\nAt the outset, it looks like a regressive practice - of that banning women to a temple which is supposed to be a public property. Obviously, I welcomed the judgment of the SC. However, a thing which kind of irked me was that the only woman on the 5 judge bench, Justice Indu Malhotra opposed the view of the other judges. Of course, I was irked, like many others. Why the hell should a woman be the one to be a hindrance the rights of other women? After all, in this age of equality, this was a retarded judgement on her part.\nI saw numerous news articles\/comments shitting on the judge for arguably a valid reason. Let me quote what she said in her judgement.\nIndu Malhotra said the right to equality conflicted with the right to worship of devotees of Lord Ayyappa &ndash; the deity of the Sabarimala temple &ndash; and that the equality doctrine can&rsquo;t override the fundamental right to worship under Article 25 of the Constitution. She said notions of rationality can&rsquo;t be brought into matters of religion.\nCourtesy: India Today\nI considered this a stupid argument. After all, the fundamental right to equality cannot override the right to religion. What bullshit argument was this by the judge? I even questioned her credentials (such excited was I).\n&ldquo;Notions of rationality cannot be invoked in matters of religion,&rdquo; Justice Indu Malhotra said. &ldquo;What constitutes essential religious practice is for the religious community to decide, not for the court. India is a diverse country. Constitutional morality would allow all to practise their beliefs. The court should not interfere unless if there is any aggrieved person from that section or religion.&rdquo;\nCourtesy: Indian Express\nAgain, I interpreted this to be a confirmation that religion was, at its core, irrational, and a moral system could be applied to a religion which is again a stupid argument to make.\nOther judges, on the other hand, had saner opinions.\nThe CJI says patriarchal rules have to change, and that patriarchy in religion cannot be allowed to trump right to pray and practise religion. He adds that any rule based on biological characteristics cannot pass muster of constitutional test.\nThe Kerala Hindu Places of Public Worship (Authorisation of Entry) Rules, 1965, violate the right of Hindu women to practice religion, says CJI. The practice of age restrictions on women entry to Sabarimala temple cannot be treated as essential practice, he adds. CJI has written the judgment on behalf of himself and Justice Khanwilkar.\nJustice Rohinton Nariman concurred with CJI Dipak Misra.\n&ldquo;Religion cannot be cover to deny women right to worship. To treat women as children of lesser God is to blink at Constitutional morality,&rdquo; Justice Chandrachud said in the observation.\nJustice Chandrachud also said that not allowing the woman to enter because they are of procreating age is &ldquo;derogatory&rdquo; to them. &ldquo;To exclude women of the age group 10-50 from the temple is to deny dignity to women. To suggest that women cannot undertake the 41-day vratham is to stereotype them,&rdquo; he said.\nI agreed. The supreme court had my full support. I even got into a couple of heated arguments on an online forum.\nWhat sort of god is Ayappa if he thinks that interacting with women will spoil his eternal vow of being a brahmacharya? Is he some kind of Marvel&rsquo;s Daredevil type guy who knows which woman is going through her menses and who is not? And, if he was really a god, he could have easily made the judgement in his favour if he wanted to. Which he does not.\nI supported the judgement because it paved the way to remove illogical laws in religions. It might also be a road to the UCC which I believe, should be implemented in the modern nation states. I assumed that the other side was wrong before knowing the specifics of the case, and just went with it, passing my own judgements on the case.\nI did know some arguments made, however. Some people argued that there exist some women-only temples in India too. Well OK. Just because there are some women-only temples, it shouldn&rsquo;t be a case that the Sabarimala should be a men-only temple too. Which is my justification for the SC judgement, but I think now which is very flawed.\nIn another of an unrelated online thread, a Sikh user remarked that he had visited the Padmanabhaswamy Temple in Kerala which banned turbans inside the temple. This led me to question my earlier assumptions about equality in the context of Indian religions.\nConsider that I visit the Sai Baba temple in Shirdi. Considering that the temple should not discriminate against any person of religion, caste, or gender, would it be alright if I could wear my footwear inside the temple premises. Not allowing this would amount to this being discrimination to someone who believes that it&rsquo;d be ok to worship a deity with their footwear on. Similar would be the case if I wanted to go to a Shani temple with leather goods. Would doing this be a violation of my religious freedom?\nAnother user in a thread asked what about women being denied an entry into the inner sanctum Masjids(not to be confused with Dargahs). My retort to the user was did any women actually want to enter the Masjid? The answer might be no, but I later realised that the question was a valid point. Where is the line drawn between religious freedom and constitutional democratic values?\nWhat complicates this matter is the concept of religious denomination. What a denomination means is a subgroup within the religion. The guys against the petition argued that the Sabarimala devotees form a religious denomination, which was rejected by the court. It doesn&rsquo;t make sense to group everyone is a Hindu, but not from a denomination considering there&rsquo;s nothing such as organized religion of Hinduism itself. Moreover, this judgement by SC is compulsive on the people, and not really generated out of internal dialogues\/discussions between the devotees themselves. This is like mandating there can be a female Pope in the church. That would be something I&rsquo;d agree with but isn&rsquo;t the best approach when considering religion. Mandation of such a decision would lead to outright rejection of it from the people.\nA better argument is made in the following podcast by NewsLaundry:\nReporters Without Orders Ep 39: #Aadhaar, farmer\u2019s protest, PTI sackings and more\nListen after the 35:00 min mark.\nAlso listen to the following video, which answers a lot of novice points that a layman like me did not consider.\nThis brings us again to the original decision of the SC. I went through Justice Indu Malhotra&rsquo;s judgement again.\nIn her judgement, she said, &ldquo;In a pluralistic society comprising of people with diverse faiths, beliefs and traditions, to entertain PILs challenging religious practices followed by any group, sect or denomination, could cause serious damage to the constitutional and secular fabric of this country.&rdquo;\nThe article 14, right to equality, Justice Malhotra said that it cannot be the only touchstone to test religious customs and practises. She said, &ldquo;Article 25 (freedom of religion) specifically provides the equal entitlement of every individual to freely practise their religion. Equal treatment under Article 25 is conditioned by the essential beliefs and practises of any religion. Equality in matters of religion must be viewed in the context of the worshippers of the same faith.&rdquo;\nJustice Malhotra observed that there are 1000 temples of Lord Ayyappa where women are not denied entry. She said,&quot; The right to gender equality to offer worship to Lord Ayyappa is protected by permitting women of all ages, to visit temples where he has not manifested himself in the form of a \u2018Naishtik Brahmachari\u2019, and there is no similar restriction in those temples. It is pertinent to mention that the Respondents, in this context, have submitted that there are over 1000 temples of Lord Ayyappa, where he has manifested in other forms, and this restriction does not apply.\nJustice Malhotra, observing petitioners&rsquo; argument based on women being treated as untouchables, thus drawing a parallel between the rights of dalits under Article 17 which abolishes untouchability, said that the analogy is &ldquo;misconceived&rdquo;. She said,&quot; The right asserted by dalits was in pursuance of right against systematic social exclusion and for social acceptance per se. In the case of temple entry, social reform preceded the statutory reform, and not the other way about.&quot; Justice Malhotra concluded that the Article 17 referred to the practice of untouchability as committed in the Hindu community against harijans or people from depressed classes, and not women, as contended by the Petitioners.\nCourtesy: Times Of India\nIf you have listened to the NewsLaundry podcast linked above, you would notice that they also talk about PILs now being abused by the people who have no stake in the matter. They also say that not one petitioner came up to the SC alleging discrimination by the Sabarimala temple authority. This says a lot about our(me included) armchair gender rights activism.\nIs the verdict correct, or not? Let me know in the comments.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/the-sabarimala-verdict-right-or-wrong\/","summary":"<p>For people who are unaware of the case, the Sabarimala Temple is an annual pilgrimage site to a lot of Indians which traditionally has the practice of not allowing entry to the women pilgrims of the ages between 10-50 years inside the temple premises.<\/p>","title":"The Sabarimala Verdict: Right, or Wrong?"},{"content":"I was listening to a podcast episode yesterday from the awesome philosophy series History Of Philosophy In India titled Grand Illusion: Dharma and Deception in the Mahabharata, and it had a pretty interesting moral dilemma which I put forth here in my words:\nSuppose you are minding your own business, in peace, and suddenly a group of men come running down your alleyway. Panting, they explain that a group of robbers are in their pursuit, and if you could please divert them in the opposite direction. Without waiting for a reply, they run off. Some minutes later, another group of men comes, and asks you where the people went.\nDo you say the truth and tell them the real location of the people? Or do you refuse to divulge anything (which could, in turn, make the robbers probably torture the truth out from you)? Or do you plainly lie?\nBonus: Also what if you aren&rsquo;t sure who the real robbers\/good guys are?\nI found the premise incredibly fascinating when I first heard it. However, I was unsatisfied with what I remembered about it. I had to find the original source for it. BTW, the Bonus question was my addition (agreed, I&rsquo;m a noob in Philosophy).\nHence, I am posting the excerpt from aforementioned book by B. K. Matilal, which I feel is incredibly interesting in knowing that the Indian Epics and Texts are also more of philosophical text than purely religious ones unlike Abrahamic religions where almost all text only contain religious discourses.\nThe Mah\u00e4bh\u00e4rata is a unique creation of India, one of its kind which has no equal in world literature. Thanks to the laudable efforts of Peter Brooks, the story, the underlying unique human drama, has been staged in cities like Paris, New York and Glasgow in recent years with great success. Its popularity is no longer restricted to the geographical boundaries of India. It represents a corpus of some 200,000 lines, eight times the size of the IIliad and the Odyssey put together, that has influenced and captivated the minds of almost all Indians for about two millennia.\nWHAT IS A MORAL DILEMMA? Moral dilemmas are, very common in everyday life. Stories inclassical and contemporary literature are full of such cases. Most moral dilemmas seem to remain unresolved in such stories. Very roughly, such dilemmas arise when the agent is committed to two or more moral obligations, but circumstances are such that an obligation to do x cannot be fulfilled without violating an obligation to do y.\nA typical case of moral dilemma is presented by Arjuna&rsquo;s question at the beginning of the Bhagavad Git\u00e4. Was Arjuna faced with a genuine moral dilemma? I shall come back to the question later on. Let us take another clear case of moral dilemma in an episode in the Karnaparvan.\nArjuna was faced with a choice between two irreconcilable obligations: promise keeping and avoidance of fratricide. The incident that led to this is the following. On the very day of final encounter between Kama and Arjuna, Yudhisthira fled the battlefield after being painfully humiliated by Krsna in an armed engagement. When Arjuna came to the camp to pay a visit to him and asked what really had happened, Yudhisthira flared up in anger and told Arjuna that all his boastfulness about being the finest archer in the world was a lot of nonsense, because the war was dragging on. He reminded Arjuna that he had claimed to be capable of conquering everybody and thus end the war within a few days. In a rage, he not only insulted Arjuna but also slighted the G\u00e4ndiva bow, the most precious possession of this valiant warrior. The bow was a gift to Arjuna from Agni, the fire-god. He held it so dear to his heart that he had promised to kill anyone who would ever speak ill of it. Hence Yudhisthira&rsquo;s words put Arjuna in a very difficult situation: either he would have to kill his venerated elder brother or break his promise. When his Ksatriya duty (dharma) made him choose the first alternative, Krsna (his alter ego) appeared. On being asked Arjuna explained: he was obliged to commit fratricide in order to fulfil his obligation to keep his promise. Arjuna had full knowledge of the gravity of the crime he was about to commit but like a mistimed Kantian he had already taken a conflict-free decision to meet the Ksatriya obligation of promise-keeping. A quotation from Kant&rsquo;s Introduction to the Metaphysics of Morals (1797) may be relevant here:\n&ldquo;Because . . . duty and obligation are in general concepts that express the objective practical necessity of certain actions and because two mutually opposing rules cannot be necessary at the same time, then if it is a duty to act according to one of them, it is not only not a duty but contrary to duty to act according to the other.&rdquo;\nFor Kant it seems that the objective rules should form a harmonious whole, a system characterized by consistency, much like a system of true beliefs. The moral conflict, which no doubt arises in the minds of moral agents, cannot, therefore, be genuine. It would be at best a confusion, at worst an illusion. It conflates, according to Kant, a genuine duty with a ground of that duty. Hence, in a so-called dilemma, one horn is a genuine duty, and the other is merely a ground of duty. There may be conflict between grounds but not between duties. Hence, in Kantian ethics, no agent can be forced to violate his duty. This is at least one of the interpretations of Kantian thought. Hence Arjuna might be said to be anticipating the Kantian model.\nKrsna, however, was not Kant. When he intercepted and started a discourse with Arjuna, he obviously turned an apparently moral conflict into a genuine moral dilemma. Promise-keeping is, indeed, a strong obligation. Plato is supposed to have described a typical case of dilemma, in which the return of a cache of arms has been promised to a man who, intent on starting mayhem, comes to claim them. Conflict was generated here by two opposing principles, that of promise-keeping and that of benevolence. In fact, promise-keeping is regarded as equivalent to truth-telling. In Sanskrit, promise-keeping is sometimes classed as &lsquo;protecting the truth&rsquo; (satya-raks\u00e4). Hence, both in India and the West, the two obligations are invariably connected. There is no cultural relativism here. In Kantian ethics, truth-telling gets the highest priority. Krsna, however, continued to argue that promise-keeping or even truth-telling cannot be an unconditional obligation when it is in conflict with the avoidance of grossly unjust and criminal acts such as patricide or fratricide. Saving an innocent life is also a strong obligation, saving the life of an elder brother would naturally be an equally strong obligation, if not stronger. Hence, in fact, according to Krsna, two almost equally strong obligation or duties are in conflict here.\nKRSNA&rsquo;S STORY TO SUPPORT HIS ARGUMENT Krsna related a story to illustrate his point. A hermit, Kausika by name, once took a vow of telling the truth throughout his life. One day he faced the following dilemma. Some bandits were chasing several travellers with the intention of killing them. Kausika was sitting nearby at the crossroad. The travellers passed by, and requested him not to show the miscreants which way they had fled. Kausika did not answer. Soon the bandits arrived, and, knowing that the hermit would not lie, asked him about the travellers; and Kausika told the truth. As a result, the travellers were caught and killed. Krsna added that Kausika did not reach heaven after his death (his much-coveted reward) just because of this act of cruelty. Although he abided by his principle of truth-telling throughout his life, it came to no effect. The major point was that, under situational constraints, there might be stronger grounds for rejecting truth-telling as a duty and accepting the stronger duty of saving an innocent life. This encapsulates a very strong moral insight, although it is not Kantian.\nFor Krsna, dharma is at least sometimes dictated by the constraints or the contingency of the situation (\u00c4vasthika, Mah\u00e4bh\u00e4rata, xii, 36.2). But this is no defence of opportunism. Truth-telling has been extolled as one of the highest virtues in the tradition. We should not have any illusion, despite frequent criticisms to the contrary, that the tradition of the dharmas\u00e4stras or the religious texts of India underplayed the importance of truth-telling as a virtue and a value. \u00c4pastambha says plainly that every perjurer goes to hell. Thus, there does not seem to be any religious, textual or dharmas\u00e4stric support for sweeping comments such as &lsquo;all Hindoos are compulsive liars&rsquo; (Lord Curzon). But it must be admitted that excusable untruths were permitted by such writers of dharmas\u00e4strasas Gautama and Manu. Thus, perjury to save life was permitted as adharma. Hence Krsna&rsquo;s story is compatible with the general dictum ofdharmas\u00e4stras (dharma-ethics).\nThere are several intricate issues of moral philosophy that can be discussed here in connection with this epic story. There are those philosophers who admit the factuality of moral dilemmas and insist that our commitment to consistency would require us to modify the system by reordering priorities or by discarding certain principles. For example, R.M. Flare believes that our moral precept, &lsquo;do not lie&rsquo;, can be reformulated in light of wartime experience as &lsquo;do not lie except to the enemy in time of war&rsquo;, which will be the more adequate principle and make the system consistent by resolving a conflict situation.\nJean-Paul Sartre gives a striking example of practical conflict where a young man must choose between his patriotic duty to join the French Resistance and his filial obligation to care for his aging mother.\nSartre, like Hare, acknowledges the reality of this conflict, but uses such hard cases as evidence to draw the conclusion that it is useless for a moral agent to form an ordered system of ethical principles and to try to live by it. The agent, according to Sartre, is condemned to be free. Sartre takes man to be condemned, because &lsquo;he did not create himself; yet he is free, because &lsquo;from the moment that he is thrown into this world he is responsible for everything he does&rsquo;. He, therefore, should use his radical liberty, and improvise his choice according to the situation without regret or remorse. In the Mah\u00e4bh\u00e4rata episode, we again see a resonance of the Sartrean advice in Krsna&rsquo;s advice to Arjuna. Krsna said to Arjuna, after relating the story of Kausika, that Arjuna, unlike Kausika, must not regret this failure to keep the promise when the concrete situation would otherwise require him to commit fratricide.\nAgain, in the Glt\u00e4, a Sartrean reading of Krsna is possible, but perhaps we should avoid the temptation. The situation is comparable in respect of the recommendation of the unregretted choice to be reached (m\u00e4sucah) but not so, as far as the complete rejection of the search for a consistent ethical system is concerned. Krsna also would not say that humans are condemned to be free.\nLet us discuss some details of the Mah\u00e4bh\u00e4rata episode. Krsna emphasized the fact that it is very difficult but not impossible to understand the extremely subtle ways of dharma or duty (dharm\u00e4n\u00e4m gatim, s\u00fcksmamduranvayam). He also said that even Bhisma or Vidura or Kunti wouldhave been able to resolve the dilemma for Arjuna. To sum up Krsna&rsquo;s argument:\nIt is true that truth-telling is the highest virtue but there are mitigating circumstances such as destruction of innocent lives and loss of all possessions under which to tell a he may be a duty (&lsquo;where telling a lie may be as good as &ldquo;truth&rdquo; and truth-telling may be as good as lying&rsquo;).\nBefore telling the story of Kausika, Krsna told another story about an innocent hunter called Bal\u00e4ka. Bal\u00e4ka used to hunt animals to feed his blind parents. He was innocent and simple-hearted. But he had a rare skill. He could hunt an animal even when it was outside the range of his sight, simply by listening to the noise made by the animal drinking water from a river. One day, by chance, he hunted in this manner a ferocious creature called Andha. But as soon as Andha was killed, gods showered flowers from heaven, and the celestial chariot came to fetch Bal\u00e4ka to heaven. Why? For Bal\u00e4ka unknowingly did a great service to the lord&rsquo;s creation, because this Andha had grown up to be a terrible creature who was almost unkillable. Having received a boon from Lord Brahma, he went on killing all the creatures. He was in a way out to destroy all creatures. Although Bal\u00e4ka was unaware of this fact, he was somehow able to kill this evil creature, and thereby obtained his just reward. This story sounds like the case of &lsquo;moral luck&rsquo;. The goodness of a good human life is not always dependent on the things that the moral agent can control. There is &rsquo;external contingency&rsquo; or luck coming to the agent from the word which is not under his control. But this contingency cannot be totally eliminated. Sometimes such contingencies would generate moral dilemmas, for the agent. Bal\u00e4ka was a good person in his own modest way, but external contingencies made his moral reward far greater than what he had dreamt of. By contrast Kausika had a project for life which included the covetable moral reward, heaven, but external contingencies intervened and Kausika was faced with a situation in which he was forced to act. But, according to Krsna&rsquo;s ethical system, he acted stupidly, and chose the alternative that ruined his dream totally. Krsna said that although Kausika wanted to do his duty (dharmak\u00e4mah), he was unwise (apandita) and a fool (m\u00fcdha, Mah\u00e4bh\u00e4rata, 8.49.32).\nThis was a small excerpt, and it shows that Indian texts are no less than their western counterparts in discussing philosophical concepts, and it has, for sure, made me very interested in reading and learning about them.\nArchived Comments 1. Bhavana (Blogger) \u2014 2018-10-08\nBeautiful piece of work!\ud83d\ude4c\n2. Anonymous (Blogger) \u2014 2018-10-02\nYou have grown up to be a very fine writer, Darshit! I feel proud to be a part of this expeditious journey of yours.\n3. Darshit Patel (Blogger) \u2014 2018-10-07\nThanks a lot Sumit! Readers such as you inspire me to keep writing!\n4. Darshit Patel (Blogger) \u2014 2018-10-02\nThank you! :)\n5. Anonymous (Blogger) \u2014 2018-10-02\nAn impressive content you have put up. Yes we all face moral dilemmas, however we do not emphasize much, which you have beautifully! Kudos to you.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/moral-dilemmas-insights-from-indian-epics-by-b-k-matilal-excerpt\/","summary":"<p>I was listening to a podcast episode yesterday from the awesome philosophy series <a href=\"https:\/\/historyofphilosophy.net\/india\"><em>History Of Philosophy In India<\/em><\/a> titled <em><a href=\"https:\/\/historyofphilosophy.net\/mahabharata\">Grand Illusion: Dharma and Deception in the Mahabharata<\/a>,<\/em> and it had a pretty interesting moral dilemma which I put forth here in my words:<\/p>","title":"Moral Dilemmas: Insights from Indian Epics, by B. K. Matilal [Excerpt]"},{"content":"Hello guys, I&rsquo;ve been listening to a history podcast once again, and I hope to summarise what I have learned, at the same time providing you with a narrative so you need not scourge a lot of Wikipedia pages if you are interested in learning more about it.\nColosseum Episode 1: In the Beginning Welcome to The History of Rome, a weekly series tracing the rise and fall of the Roman Empire. Today we will hear the mythical origin story of Rome and compare it with modern historical and archaeological evidence. How much truth is wrapped up in the legend? We end this week with the death of Remus and the founding of Rome.\nAt the start of the episode, Mike provides a disclaimer: Most of the records about the origin of Roman empire has been lost in a massive fire in Rome in the year 359 B.C (IIRC), so a lot of the accounts are conflicting, and most of the story is constructed from archaeological discoveries.\nThe story starts with the arrival of Aneas, in Italy who was most probably a Greek. Aneas was the great, great, great, great, great, great, great, great, great, great, great, great, great grandfather of the founder of Rome. (Really, no jesting here).\nThe city of Rome was founded by Romulus, a king whose story is no short of a biblical one. As the story goes, near about the site of Rome(which was not founded yet) was an existing kingdom ruled by 2 brothers - Numitor and Amuluis. The younger brother Amulius, after his father died, banished the older brother from the kingdom for the throne. He also ordered Numitor&rsquo;s daughter to be a virgin for the whole life.\nWhat could go wrong, right?\nAs it goes, the daughter of Numitor was raped by someone, and when Amulius confronted her, she said she was impregnated by the god, Mars and that she was still a virgin. LOLOLOL.\nShe gave birth to twin boys as a consequence. In classic &ldquo;Roman&rdquo; style, he ordered the girl and her two children to be executed, the girl by beheading her, and the boys by drowning them in a nearby river.\nThe girl was now dead, and the order to execute the infants was being carried out. The nearby river was flooded because of the monsoons, and instead of going to the centre of the river, the soldiers responsible decided to leave them on the banks. These boys, unsurprisingly, didn&rsquo;t die, and were found by a passerby shepherd who found a &ldquo;she-wolf&rdquo; breastfeeding them milk. The she-wolf was most probably a personification of the shepherd&rsquo;s wife, who was a whore. (Not kidding, this was in the podcast. TOPKEK! ).\nThe boys then grow into fine and brave young lads, and they defeat some bandits who come to loot their village. The bandits ka sardaar is their grandfather Numitor, and upon learning of the story of the boys who were found by the shepherd, he was convinced that they were his grandchildren.\nHe then asks them to claim their rightful right of the throne. The boys then defeat Amulius, and decide to establish their new kingdom on the site of the river where they were found. (Apparently, that&rsquo;s good a reason as any).\nBut, only one king can rule a throne. So long story short, Romulus kills Remus, and founds the then tiny city of Rome.\nEpisode 2: Youthful Indiscretions Last time we discussed the events that lead to the birth of Rome, covering the arrival of Aeneas in Italy and the story of the twins Romulus and Remus. Today we will cover the remainder of Romulus&rsquo;s life, his questionable morality and ultimate disappearance from the world of men.\nRomulus has a host of problems - the city is tiny, and has almost no inhabitants to survive and grow into a larger city. Romulus then decides to open his city gates to everyone who wants to enter, including the slaves, rapists, murderers etc. Most of the city is now inhabited by the criminals themselves.\nThe problems still not go away. Unless Romulus finds a way for the inhabitants to have progeny, the future of Rome will be wiped out in a single generation. This is because the men vastly outnumber the women in the city. Romulus then asks the nearby city of Sabine for intermarriage with their women. The Sabines knowing that most of Rome were of thugs, refuse. Romulus was not disheartened. He plans to organise a festival, and invites the people of nearby cities like Sabine to the festival. The Sabine arrive in droves!\nDuring the festival, Romulus signals the city&rsquo;s populace(surprise surprise!), and the people promptly abduct the Sabine girls, and their parents are driven out of the city. The girls are then raped. (Roman logic: Can&rsquo;t have children? Just rape women. Simple AF)\nThe Romans then blame the Sabine parents for not allowing inter-marriage which lead to this &ldquo;event&rdquo;, as a reasoning to the girls\/women.\nInteresting Fact: Use of the word &ldquo;rape&rdquo; comes from the conventional translation of the Latin word used in the ancient accounts of the incident: raptio.\nThis rape of Sabine women led to a lot of wars in the aftermath. Unsurprisingly, the Romans win almost all the wars because they were thugs. Paraphrasing some content from Wikipedia, which was not mentioned in the podcast.\nOutraged at the occurrence, the king of the Caeninenses entered upon Roman territory with his army. Romulus and the Romans met the Caeninenses in battle, killed their king, and routed their army. Romulus later attacked Caenina and took it upon the first assault. Returning to Rome, he dedicated a temple to Jupiter.\nAt the same time, the army of the Antemnates invaded Roman territory. The Romans retaliated, and the Antemnates were defeated in battle and their town captured.\nThe Crustumini also started a war, but they too were defeated and their town captured.\nRoman colonists subsequently were sent to Antemnae and Crustumerium by Romulus, and many citizens of those towns also migrated to Rome (particularly the families of the captured women).\nThe Sabines then declare a war under their king, Titus Taitus and almost defeat the Romans. (Again, lifting massive blocks of text from Wikipedia, because for the one time, Wikipedia has a narrative of the story there.)\nThe Sabines themselves finally declared war, led into battle by their king, Titus Tatius. Tatius almost succeeded in capturing Rome, thanks to the treason of Tarpeia, daughter of Spurius Tarpeius, Roman governor of the citadel on the Capitoline Hill. She opened the city gates for the Sabines in return for &ldquo;what they bore on their arms&rdquo;, thinking she would receive their golden bracelets. Instead, the Sabines crushed her to death with their shields, and her body was thrown from a rock known ever since by her name, the Tarpeian Rock. (Seems the Romans were&rsquo;nt the only evil guys here)\nThe Romans attacked the Sabines, who now held the citadel.\nAfter a point, the women who had been kidnapped and raped intervened themselves to stop the war, with a quote going:\n[They], from the outrage on whom the war originated, with hair dishevelled and garments rent, the timidity of their sex being overcome by such dreadful scenes, had the courage to throw themselves amid the flying weapons, and making a rush across, to part the incensed armies, and assuage their fury; imploring their fathers on the one side, their husbands on the other,\n&ldquo;that as fathers-in-law and sons-in-law they would not contaminate each other with impious blood, nor stain their offspring with parricide, the one their grandchildren, the other their children. If you are dissatisfied with the affinity between you, if with our marriages, turn your resentment against us; we are the cause of war, we of wounds and of bloodshed to our husbands and parents. It were better that we perish than live widowed or fatherless without one or other of you.&rdquo;\nThe battle came to an end, and the Sabines agreed to unite in one nation with the Romans. Titus Tatius jointly ruled with Romulus until Tatius&rsquo;s death five years later.\nRomulus ruled for 36 years. Even the &ldquo;death&rdquo; of Romulus is a mystery. As accounts go, the throne of Rome was engulfed in a storm, and Romulus &ldquo;disappeared&rdquo; most probably ascended to heaven, as a god. A more probable thing, however, was that he was murdered by the nobility, who were out of favour with Romulus, but was loved by the people.\nDoesn&rsquo;t this sound like a story from the Bible, with immaculate conception and related stories?\nEpisode 3A: The Seven Kings of Rome This week we cover the first three of Romulus&rsquo;s successors to the throne: Numa Pompulius, Tullus Hostilius and Ancus Marcius, who they were and what affect they had on the evolution Roman law and culture.\nThere were seven kings of the Monarchical Roman Empire, before it turned into an elective government.\nThe first was of course Romulus. As Romulus died, there was a period of around 1 year when no single king ruled Rome. The Romans wanted a Roman king, whereas the Sabines wanted a Sabine king. A truce was difficult. Thus, 10 men from the Senate were chosen to rule Rome periodically.\nA solution was found after a year - The King would be a Sabine, but the Romans would decide who would it be. They decided on a man called Numa Pompulius. Numa was the son-in-law of Tatius, the Sabine king, but was known for his religiousness and justice. He refused to be the king of Rome, but was persuaded to accept the post later. He didn&rsquo;t even live in Rome when he was elected to be a King. lel.\nHis reign was to be the most peaceful time in the entire history of Rome.\nHe constructed a new temple to Janus and, after establishing peace with Rome&rsquo;s neighbours, closed the doors of the temple to indicate a state of peace. They remained closed for the rest of his reign.\nThe doors would be the last time in the history of Rome to be closed during the reign of a king. By infusing religion in his people, he nullified the negative energies of his armies which usually happens in peace time. He was the most influential king which lead to Rome being religious for the rest of world history. He also established the office of Pontifex Maximus, which was the highest priest of the State religion. This position was elected independently without the influence of King\/Senate, thus separating the religion from the state.\nInteresting Fact: Numa reformed the Roman calendar by adjusting it for the solar and lunar year, as well as by adding the months of January and February to bring the total number of months to twelve.\nNuma died of old age.\nThe successor of Numa was a guy called Tullus Hostilius, who was the opposite of his predecessor. He believed that Numa was unusually lenient with his armies. He wanted to wage wars with his neighbours, and thus he started with the neighbouring Alba Longa. Roman was so peaceful during Numa&rsquo;s reign that all the other neighbouring kingdoms believed that Rome was incapable of attacking any country first because it was very priestly and religious. Tullus even made everyone believe that Rome was being dragged into a war by the Albans!\nThe Alban king Mettius , thinking it would be a waste to wage a war with the entire army, as the neighbouring Etruscans were waiting for a suitable chance to attack both their kingdoms, and would be better if they could fight one-on-one, and decide the winner. Triplet brothers were chosen from both the sides, and made to fight.(Movie style!)\nThe Romans win the fight, and the Albans become a vassal state of Rome. (I&rsquo;d like to thank you for reading this far, it means a lot to me!) A war with Etruscans breaks out soon, and the Albans are called to fight. Mettius orders the Albans to abandon the Romans, and Tullus with his quick thinking rallies the Roman troops by telling them that the Albans were flanking the enemy from the other side. The Romans, pumped up now, win against the Etruscans! Tullus then executes Mettius for perfidy, and orders his soldiers to destroy Alba Longa. Only the temples were unharmed. The population of Alba Longa was assimilated to Rome.\nTullus&rsquo; death is mysterious too.\nAccording to Livy, Tullus neglected the worship of the gods until, towards the end of his reign, he fell ill and became superstitious. However, when Tullus called upon Jupiter and begged assistance, Jupiter responded with a bolt of lightning that burned the king and his house to ashes.\nHe ruled for 31 years.\nAfter Tullius, the Romans elected Ancus Marcius, who was a grandson of Numa. He mostly followed in his grandfather&rsquo;s footsteps, being a religious and peaceful guy, but he had to fight wars to defend his kingdom. Mostly diplomatic, he brought in a lot of neighbouring Latin people into Rome, known as Plebians.(Yes, you read that right - Plebs were the lower class of Rome)\nEpisode 3B: The Seven Kings of Rome The last days of the Roman Kingdom were ruled over by the three members of the so-called Tarquin Dynasty: Tarquinius Priscus, Servius Tullius and Tarquinius Superbus. The last proved to be such a tyrant that he was overthrown and monarchy was forever outlawed by the Romans.\nPriscus was an Etruscan, and had emigrated to Rome with his vast wealth because he couldn&rsquo;t get any public office position in Etruria. As he had a lot of wealth, he started donating to the King, and was quickly inducted into the Senate. Ancus even made him a godfather to his sons.\nAfter the death of Ancus, Priscus persuaded the Senate to hold a vote for the king at the time which he had conveniently arranged for the princes to be absent from the Senate in the guise of a hunting expedition. Priscus also increased the number of Senate seats to 200 by adding 100 men from leading minor families of Rome. By adding these 100 people ensured that almost none of his policies would be opposed by the other Senate members since the 100 were indebted to him.\nHe ordered the construction of Circus Maximus - the largest chariot racing stadium in the History of Rome, which remained an unachievable feat by any other Roman king.\nAgain, the death of Priscus is very interesting. Letting Wikipedia describe the story better -\nTarquin is said to have reigned for thirty-eight years. According to legend, the sons of his predecessor, Ancus Marcius, believed that the throne should have been theirs. They arranged the king&rsquo;s assassination, disguised as a riot, during which Tarquin received a fatal blow to the head. However, the queen, Tanaquil, gave out that the king was merely wounded, and took advantage of the confusion to establish Servius Tullius as regent; when the death of Tarquin was confirmed, Tullius became king, in place of Marcius&rsquo; sons, or those of Tarquin.\nTarquin&rsquo;s death was hidden from the public for a lot of years, and by the time he was officially declared dead, Tullius was coming home from a war, and declared himself a king, with almost no opposition.\nThis University of Dallas page describes Tullius&rsquo; story better. (Partly because I&rsquo;m getting a little tired to type it out)\nServius&rsquo; greatest act as king was the creation of a class structure. He organized the classes upon the armor each man could afford. The poor were relieved of their military burden, placing the onus upon the wealthy. In return, Servius gave the wealthy more political power. If a vote was needed, only the wealthy class would vote at first. If a majority could not be reached, then the next class would vote. The effect of this was that rarely would the poorer classes of men have a say in their government.\nDespite all of his success, Servius was still the son of a slave. Now old enough to rule, the two true sons of Tarquinius Priscus had at least some right to make a claim for the throne. Forseeing this problem, early on in his reign he had married his two daughters to the two sons Tarquinius Priscus.\nThe younger son, Arruns, was a man of little ambition. His wife Tullia, the younger daughter of Servius, had a great deal. The older son Tarquin loathed Servius, since he he felt that he should have been the heir to his father&rsquo;s throne. His wife, the older Tullia, loved her father very much.\nThe younger Tullia and the older Tarquin began to conspire together. Before they could act against the king, Tullia decided that they must get rid of their partners. After the deaths of Arruns and the older Tullia, Tarquin and Tullia got married, and the two began to plot against the king.\nServius was by this time an old man, unable to defend himself. Tullia constantly goaded her husband to act now and not wait until the old man died. At last, Tarquin could take no more of his wife&rsquo;s nagging. Surrounded by armed guards, Tarquin went into the senate and sat down upon the king&rsquo;s throne. He then summoned all the senators to convene the senate. Even those who did not support him did as they were told, since they knew that the old king Servius was doomed.\nTarquin began to speak to the senators, reminding them of how Servius, a mere slave, had not been elected, but had merely usurped his father&rsquo;s throne. While he was speaking, Servius appeared at the back of the senate. The two factions began to argue. Unable to turn back now, Tarquin picked up the old man, carried him out of the senate, and threw him down the steps and into the street.\nStunned, Servius picked himself up and tried to flee, but he was soon killed by two of Tarquin&rsquo;s men. Then, Tullia arrived in a carriage. Pulling up before the senate, she declared her husband as the new king. Apparently worried for her safety, Tarquin told her to go home. On the way, she came across the dead body of her father. Cruelly, she ran over the corpse, splattering blood upon her clothes.\nCan make a masale-daar movie on this story. Ask Vishal Bhardwaj.\nBut the Tarquin was a tyrant. He was remarked as &ldquo;Superbus&rdquo;, meaning Proud. He ruled almost like a dictator, and suppressed any opposition with ruthlessness. Any nobles who opposed him were dealt with swiftly, so much so that they didn&rsquo;t even publicly condemn him.\nAt a meeting with the Latin leaders, a Turnus Herdonius warned the people against Superbus&rsquo; arrogance and asked not to trust the king. Superbus, in turn, paid some slaves to hide swords in Turnus&rsquo; entourage, and apprehended him with those swords, accusing him of coming to the peace meeting to kill him. He da real MVP. Read more of his atrocities in his wikipedia page.\nShit finally hit the fan when his son, Sextus, raped a prominent noblewoman. The nobles had organised a dinner to their house. Sextus, true to his partial English meaning, lusted after Lucretia, and raped her after the dinner, and ran away. Lucretia couldn&rsquo;t bear this dishonour, and after narrating this even to her relatives, took her own life with a knife.\nThe nobles were now enraged.\nFour men, led by Lucius Junius Brutus, and including Lucius Tarquinius Collatinus, Publius Valerius Poplicola, and Spurius Lucretius Tricipitinus incited a revolution that deposed and expelled Tarquinius and his family from Rome in 509 BC.\nThus ended the reign of the Seven Kings of Rome.\nOne can observe that though not all accounts of the history are true, the Romans were mostly war hungry people who accepted religion, and not the contrary. The succession of kings who believed in War, Religion, War, Religion+War proves this face.\nEpisode 4: The Public Thing The monarchy had been overthrown and the Roman Republic was now established. Despite the appearance of a free democratic republic, the Romans were beset with economic and political divisions that threatened the unity of the young State.\nBrutus and Collatinus were made the first consuls of the Roman Republic. However, being a Tarquin in the name, Collatinus was forced to resign, and his FIL, Publius Valerius Publicola was made the consul. The office of consuls was of a one year term, the idea being that all power was not in the hands of a single person now, as the other consul could veto him.\nBrutus forced the Romans to swear before Jupiter to denounce monarchy once and for all. This again shows how religion was a part of the Roman lives.\nMeanwhile, Superbus made numerous attempts to capture the throne. In one such attempt, he sent a &ldquo;peace party&rdquo; to Rome in order to retrieve his personal possessions, but the thing was discovered a coup. The conspirators included two of Brutus&rsquo; brothers-in-law, and his two sons Titus and Tiberius. The conspiracy was discovered, and the conspirators executed.\nTarquin again sought to retake the throne soon after at the Battle of Silva Arsia, leading Etruscan and his own forces against Rome. Brutus went into the battle in charge of the cavalry, and faced his cousin, Arruns Tarquinius, the king&rsquo;s son. Both charged at each other and met their death at each other&rsquo;s spears.\nA 4-year mourning was declared in Rome in the honour of Brutus. After the war, Publius started the construction of his home at the top of a hill. This led to widespread rumours about him setting up the monarchy again by building a fort there. Hearing of this, he ordered a swift destruction of his house in the night, and instead called out the people that he&rsquo;d build the house at the bottom of the hill if they wanted, effectively shaming everyone who accused him of power.\nThe then Roman empire was like just any another empire. The social classes were two - the higher class Patricians, and the lower class Plebians. Much like the zamindari system of India, almost all of the land was owned by the Patricians and, and the workers were Plebians. Women had almost no rights in the Roman Empire. Even the lowest of the Plebian men would be shocked at the mention of rights of Women. The Patricians being the wealthy class usually dominated the politics in Rome. Due to the class system, the military power was skewed in the favour of Patricians, who contributed more money in war efforts. There was, of course, a deep discontent even amongst the wealthy Plebians for the Patricians as the military was mostly controlled by Patricians which would safeguard Patrician interests rather than Plebians'.\nThis was a very short origin story about Rome, and there are a lot of Episodes of the podcast remaining, which I hope to complete sometime. I will post updates\/summaries of any further episodes I listen to. Sorry for the grammatical mistakes, I wrote this in a single sitting, and now I&rsquo;m too tired to edit.\nThanks for reading! :)\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/summary-the-history-of-rome-by-mike-duncan-episode-1-4\/","summary":"<p>Hello guys, I&rsquo;ve been listening to a history podcast once again, and I hope to summarise what I have learned, at the same time providing you with a narrative so you need not scourge a lot of Wikipedia pages if you are interested in learning more about it.<\/p>","title":"Summary: The History of Rome by Mike Duncan: Episode 1-4"},{"content":"Hey guys, I&rsquo;m here with a review about a podcast I listened to recently! This one is a great show called Hardcore History.\nWhat happens if human beings can\u2019t handle the power of their own weaponry? This show examines the dangerous early years of the Nuclear Age and humankind\u2019s efforts to avoid self-destruction at the hands of its own creation.\nThe above description is not enough for this massive podcast episode. This single one tallied at almost 6 hours to hear, and it contains *a lot* of information.\nIt contains info from the start of Nuclear Bomb tests in America, their eventual &ldquo;deployment&rdquo; in Japan, all the way leading to post WWII tensions between the US and USSR, also referred to as a Cold War. It is very interesting to go through what dilemmas and fear the US presidents felt regarding the Nuclear war breaking out as WWIII soon after WWII ended. Makes us appreciate more about the leaders who lead their countries.\nIt also sheds light on the personalities of US presidents of that time, namely, Truman, Eisenhower, and Kennedy, and also the USSR ones like Stalin and Khrushchev (albeit not much about USSR ones).\nOpinions of personalities like Oppenheimer, Bertrand Russell, and also the media transcripts are narrated to show the mood at the time.\nOppenheimer famously says\nI remembered the line from the Hindu scripture, the Bhagavad-Gita; Vishnu is trying to persuade the Prince that he should do his duty and, to impress him, takes on his multi-armed form and says, &ldquo;Now I am become Death, the destroyer of worlds.&rdquo; I suppose we all thought that, one way or another.\nafter the nuclear bomb tests. A good read about Oppenheimer and Bhagavad Gita is here, which I read a long time ago.\nIt also puts forth a lot of philosophical questions to ponder upon. It&rsquo;s great!\nHowever, the only beef I have about this show, or episode, should I say, is that Dan Carlin is inherently biased towards the US. (Probably because of his upbringing in the US). I could not find a transcript of this podcast because it&rsquo;s unusually long, or I could have pointed to his specific quotes. He tries to portray the USSR as the ultimate evil entity in the first half of the episode, though he mellows out in the second half. He also conveniently ignores some important info about what the Americans did that led to the cold war. A couple of examples if I may. An instance is when he &ldquo;forgets&rdquo; about the US putting Missiles close to USSR, in Turkey, but has to refer to it when the USSR puts similar missiles in Cuba. Tensions obviously will rise after this stupidness, but he tries to dress it up as the sole fault of the USSR.\nOne can also observe that Americans(not the general public, obviously) have a thing for invading other countries on the pretext of &ldquo;helping&rdquo; them. The US did that in the Korean War, with going insofar as invading China after defeating North Korea. Next, they tried to do that same shit in Cuba, which failed horrendously, which one way or the other led to the Cuban missile crisis. Another example of American arrogance is after the US detonated both the Atom bombs over Japan, and the UN was formed, the US was pressurised to propose a nuclear pact wherein they proposed that all the development of Nuclear weapons be stopped by other countries(even the USSR didn&rsquo;t have the nuclear bomb at this time), and only after that was signed would the US dispose of their Nukes. The USSR conveniently asks the US to dispose of the Nukes first(since they were the only one who had them).\nI&rsquo;m sure I&rsquo;m missing a lot of things here, but the US was not the sole and only saviour as the history books tell us to be.\nThat said, this episode was a great listen. Do try it if you have the time.\nhttp:\/\/www.dancarlin.com\/hardcore-history-59-the-destroyer-of-worlds\/\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/review-hardcore-history-the-destroyer-of-worlds-by-dan-carlin\/","summary":"<p>Hey guys, I&rsquo;m here with a review about a podcast I listened to recently! This one is a great show called Hardcore History.<\/p>\n<blockquote>\n<p>What happens if human beings can\u2019t handle the power of their own weaponry? This show  examines the dangerous early years of the Nuclear Age and humankind\u2019s efforts to avoid self-destruction at the hands of its own creation.<\/p>","title":"Review: Hardcore History - The Destroyer of Worlds by Dan Carlin"},{"content":"This is my last year of my Engineering studies. You probably might be expecting a teary-eyed farewell blog post (which I could definitely write, but not now). This academic year wasn&rsquo;t like the one I was hoping for. Partly because it&rsquo;s the placement season in all the colleges, and partly because my life was messed up by my university.\nI was pretty happy this time the last year. The exams were going on okay, and I was enjoying my engineering life. I am a reasonably good student, and I don&rsquo;t worry much about the examination results. Even my final year started, but I wasn&rsquo;t bothered much about them.\nHow terribly wrong I was.\nI should have bothered.\nThe day dawned. Technically, there&rsquo;s no result day in my university. They just select a random day, and spring up a surprise for us, every time. Though I say I don&rsquo;t bother about my result, I had my palms sweaty the time when I was searching for my number in the PDF they release online.\nAs I typed my number in the search box and pressed enter, my heart definitely skipped a few beats in that second.\nApparently, I had failed in a subject.\nOK, so there&rsquo;s got to be a typographical error there somewhere. How could I end up in the &ldquo;Fail\/A.T.K.T&rdquo; section!? I stared at the screen in disbelief. For those who think that there are no errors in the University results, please let me correct you.\nA similar incident happened to me when I was in Second Year. The result that University released had a major proofreading error, that being, I was graded as &ldquo;Failed&rdquo; in a subject that I actually had passed in the previous semester. Yes. Could give someone a heart attack.\nSo, still hopeful of the same mistake, I decided to wait it out until I got the official mark list from the University. The next day, when I receive the mark sheet from the University, it proved me wrong. I had definitely failed the exam. The subject in question went by the acronym DSPA (Digital Signal Processing &amp; Applications). Usually, I consider myself a person who even if had not studied a thing, would still get passing marks. Sounds like I just had a twisted superiority complex.\nI still couldn&rsquo;t believe it. I still couldn&rsquo;t come to terms with the idea that I had terribly fucked up in a serious university exam.\nBut I had to let it sink in. And then I started receiving sombre condolences from people who acted as if someone had just died. I received tremendous support from my friends. When the feeling did sink in, they were the ones who were there for me. I had just accepted that I had definitely done wrong in the exam. My mind reasoned that maybe I had failed because I didn&rsquo;t study. That I was daydreaming during the exams, and what not (my mind is very weird, I get it). Teachers were in a relative shock because I was one of the most unexpected students to flunk an exam. Inspite of all this, I managed through. I applied for revaluation because I was partly in denial (and partly accepted my fuck up).\nThe revaluation process here isn&rsquo;t the best. A candidate has to\nApply for a photocopy of the answer sheet in question. If the student feels the answers are wrongly evaluated, one can request for a re-evaluation. The University charges Rs. 250 for a single answer sheet, and Rs. 330 for the subsequent re-evaluation.\n(I don&rsquo;t know how they evaluate these charges. It&rsquo;s not as if they need to send that measly paged answer book to the U.S.)\nI was eligible to be allowed to keep term (A.T.K.T), so I could give my re-exams in the next phase of exams, i.e. current semester.\nAll my friends who had cleared the exams had to pay Rs. 810 as the examination fee. This includes 5 subjects. I, however, had to pay Rs. 1410, a whole of Rs. 600 more as a mere consequence of attempting a failed exam once again!! (Do they even Math?).\nNever mind though, I thought.\nI received the photocopy, and it didn&rsquo;t come as a surprise that the answers were incorrectly evaluated. I got the answer copy checked by our internal examiner and she evaluated that my marks should be double that what I had been &ldquo;awarded&rdquo;.\nReasonably satisfied now, I could put an end to my insecurities. As our examiner predicted, I was awarded double the marks in the re-evaluation phase, and the point to be noted is that I paid Rs. 330 for that again.\nIrresponsibly checking the answers and subsequently failing them can put a great amount of unrest in their relatively peaceful lives! Everyone knows the number of Indian engineers graduating every year. And on the top of it, there&rsquo;s a fiercely competitive world out there. It&rsquo;s equal to playing with and jeopardising the students&rsquo; lives! The case of suicides by students needn&rsquo;t be explained here.\nThis incident made me lose a whole lot of good job opportunities, because the eligibility criteria of most good companies have a clause of having no failed subjects in any semester. Not to mention the massive harassment one suffers, always afraid if you are good enough to do anything. All the doubting faces of your parents and teachers who always thought I was a good kid but now probably fell into bad ways. It&rsquo;s too much.\nThere were about 7 of my classmates who failed in the same subject, and who upon the re-checking, passed with a decent number of marks. The question arises that what sort of examiners does the university employ to check the answer papers? Are they even qualified for marking them?\nConsider this scenario: There are a lot of engineering colleges in the jurisdiction of the University of Pune. Also consider that a college operates three engineering branches of 120 students in each year. So there are about 360 students in a single year. Engineering typically has courses of 4 years, so there are about (360x4) 1440 students appearing for examinations. Considering 20% (this is fairly conservative if I consider the demographic in my class) of these students fail in a single subject amounts to 288 students.\nIf these 288 students apply for a photocopy and subsequent re-evaluations, it would amount to (Rs. 250 + Rs. 330 + Rs. 600) Rs. 1180 per student. 288 students equate to Rs. 3,39,840. And this is just considering if all fail in only one subject. Some fail in two, some in three.\nMoreover, most colleges have atleast 3 (some even 6) branches of engineering inside their campuses. And there are a lot of colleges even beside engineering institutes who are under UoP control. (Too lazy to count. If interested to see the college list, here it is).\nWhat better way to raise\/earn money than failing unsuspecting students and overcharging them for examination fees? This many not entirely true however. It may also be the case that the examiner was a retard, which still means that the university employs some retards with a professional degree. (I know where to look for my job now)\nI consider this as legal scamming. How else could you justify just demanding this obscene amount of money from innocent students, whereas on the other side you provide drought benefits to the people from an affected region? What difference does it make when you&rsquo;re going to extract money either way?\nPeople who know me consider me a very adamant, and a persistent guy. The hell I was going to let my parent&rsquo;s hard earned money to waste. Even if one considers the fees of re-evaluation fees of a total of Rs. 580 be reasonable, the other Rs. 600 was an unreasonable rip-off! This is because upon clearing the re-checking process, I didn&rsquo;t have the need to sit for the exam. So, I should be getting my extra Rs. 600 for the exam forms back, right?\nI, thus, contacted all the authorities who could have helped me get my Rs. 600 back. I started with the contact details mentioned on the official UoP examinations page: http:\/\/exam.unipune.ac.in\/Pages\/Contact.html\nHowever, no one even cared to reply me back with an acknowledgement. I was not deterred, though.\nI went to the college authorities. I paid the exmaination fees to the college, and I was hopeful they could help me get it back. I approached the best person I could - our class teacher.\nHe advised me to go to our College Registrar. The meet didn&rsquo;t go as expected because no one had yet approached with an unusual request of recovering money from the university. He asked me to write an application to the Principal, and come back later.\nI wrote the letter, and when I went again, he pointed me to an office clerk who would help me. This was a classic Indian bureaucratic process which had no end except perhaps that the 3rd person I approached after the registrar, replied that they just gave the money to the university and it would be a very tedious process to get it back. He was basically implying that no one gave a shit about my money, neither the college, nor the university.\nI waited until so many days because I was hopeful of some solution. I&rsquo;m now desolate because I know, nothing will happen. This massive clusterfuck of the Indian education system will work as it always did - or did not.\nAfter I appeared for all the remaining exams, I waited for the result again. I passed, but guess what? It was my friend who failed this time&hellip;\n\/rant.\nArchived Comments 1. Darshit Patel (Blogger) \u2014 2016-05-22\nIt was needed that I do it. Many people know this, but it&rsquo;s just buried.\n2. Anonymous (Blogger) \u2014 2016-05-21\nYeah, I was that friend. And I passed too after the revaluation.. xD\n3. Anonymous (Blogger) \u2014 2016-05-21\nReally a bad situation. N darshit well done for making ppl aware..\n4. Tanvi \u2014 2016-05-21\nSo true! So many students suffer this every year! And this is really pathetic. Anyway, well written Darshit! People need to know about it.\n5. Anonymous (Blogger) \u2014 2016-05-21\n6. Anonymous (Blogger) \u2014 2016-05-21\nHaha.. And you didn&rsquo;t mention that you re-prepared for the exam just to know that you passed.. A day before re-exam! Lol!\n7. Anonymous (Blogger) \u2014 2016-05-21\nYou should write to our education minister. He might help.\n8. Anonymous (Blogger) \u2014 2016-05-21\nSo true.! Every student suffers through this in our university.\n9. Darshit Patel (Blogger) \u2014 2016-05-22\nThanks! You could spread the word by sharing!\n10. baba refrigeration (Blogger) \u2014 2016-05-21\nVery well written dear, just correct f *words, It doesn&rsquo;t suit your personality either. Don&rsquo;t worry about bad situations you might have been through this makes you strong individual and there&rsquo;s always silverlining in dark cloud. Try not to fall prey to fight with Administration as it will take you nowhere and you will end up wasting your precious time. Please don&rsquo;t get frustrated of bad times it gives you more strength and good time follows after. Be happy.\n11. Anonymous (Blogger) \u2014 2016-05-21\nReally a bad situation. N darshit well done for making ppl aware..\n12. baba refrigeration (Blogger) \u2014 2016-05-21\n13. Darshit Patel (Blogger) \u2014 2016-05-22\nVerified.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/its-probably-all-about-money-honey\/","summary":"<p>This is my last year of my Engineering studies. You probably might be expecting a teary-eyed farewell blog post (which I could definitely write, but not now). This academic year wasn&rsquo;t like the one I was hoping for. Partly because it&rsquo;s the placement season in all the colleges, and partly because my life was messed up by my university.<\/p>","title":"It's (probably) all about money, Honey."},{"content":"A couple of months ago, a friend of mine mentioned making an App for the discovery of Podcasts. I knew the concept of podcasts, but I argued that these weren&rsquo;t for the Indian audiences, the foremost reason being people would need to specially allocate time for listening to the podcasts. Who&rsquo;s got the time?\nNevertheless, I wanted to try it out for once. So, I proceeded with downloading a Podcast app for my phone.\nSo, what are Podcasts? Podcasts are like radio programmes, though not live. There are many different Podcasts, each with a different area if focuses on - arts, technology, comedy, entertainment, etc. Each time a new episode of a Podcast releases, the app on your phone will (automatically) download it, depending on what setting you choose.\nConsequently, I dove into the stream of Podcasts. I subscribed to a large number of Podcasts, many of which I didn&rsquo;t like on listening to them. I am not really built for listening to a random man, musing about the latest android phones, where instead I could do a google search and find the same. Gradually, I came across a Podcast called Serial. At the outset, it looked like a news podcast, with a twist about a murder mystery. Boy, was I ill prepared about what I would encounter. Mixed with great sound editing, and some awesome background music, it hooked me to the core. This podcast is hailed as a grail in the Podcast community.\nNext came the TED Radio Hour, with some of it&rsquo;s episodes being Disruptive Leadership, and Simply Happy. These are awesome podcasts, but if you&rsquo;ve visited the embedded links, you&rsquo;d know they&rsquo;re almost an hour long. Who&rsquo;s got the time? You would only listen to them if you&rsquo;ve got an hour long commute to your workplace.\nI, being a reader, would always like some dose of drama into whatever I listen to. Who would want to watch an audio documentary, right?\nI was looking for a quick fix for satisfying my &ldquo;needs&rdquo;. I stumbled upon an awesome podcast which could do just that.\nI found The Truth.\nThe Truth is a storytelling podcast, with some great voice acting, sound mixing and editing.\nThis podcast releases an episode every two weeks. I can&rsquo;t possibly try to describe these in words, which I would recommend be heard by your own years before judging it. Each podcast shows up with a new story made for you to think.\nMy favourites (till date) are\nLiving the Dream Enjoy the Suffering I&rsquo;d be giving away too much if I described these both episodes. Also, as you can see, they&rsquo;re just 15 minutes long. So I recommend you snuggle up in a soft blanket, put on your earphones (highly recommended), and be prepared to enjoy to the fullest. I recommend listening to both of the episodes.\nTell me what you think of both!\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/my-newfound-love-for-podcasts\/","summary":"<p>A couple of months ago, a friend of mine mentioned making an App for the discovery of Podcasts. I knew the concept of podcasts, but I argued that these weren&rsquo;t for the Indian audiences, the foremost reason being people would need to specially allocate time for listening to the podcasts. Who&rsquo;s got the time?<\/p>","title":"My Newfound Love for Podcasts"},{"content":"The society is a weird entity. Sometimes a man needs a society for his well being, and the other times he needs the society for something to blame for.\nThe weirdest of the weird parts of the society are your relatives. Some are really good &ndash; keeping to their own, while some others, not quite much so. It&rsquo;s the latter which are more &ldquo;concerned&rdquo; about us and our well-being - &ldquo;Oh, aage kya karne waala hai aapka beta - padhai ya job?&rdquo;, &ldquo;Kitne marks aaye?&rdquo;, &ldquo;Itne kam kyu? Wo chintu ne to top kiya&rdquo;. Sometimes it feels that they are more worried about our future than we ourselves. The only thing remaining now is giving my exam on behalf of me. (BTW, if someone volunteers for it, please let me know)\nSome relatives are too smart and quick thinking for their own good. It&rsquo;s almost a year since the following incident happened.\nAfter doing some high octane submission stuff, I went for a thoroughly deserved Diwali holiday at my home in Bhiwandi. Unfortunately for my submission relief, a middle aged relative dadaji had to drop by my house in a couple of days. His mission - to deliver an invititation for his daughters&rsquo; wedding. I didn&rsquo;t know what his name was, but I just knew him by sight (not that I cared about it really). So as he turned up, my parents invited him with the customary feet touch for his blessings. As he settled comfortably in our living room sofa, my parents chat him up by asking the well being of all in his family. After he delivered the invite he had come for, he was presented with a variety of Diwali homemade snacks which we Gujaratis&rsquo; are famous for. Gradually, I couldn&rsquo;t help but ignore the ominous feeling I was getting listening to them converse.\nNaturally after sometime, the conversation turned to us - the kiddos.\nHe: Beta, kya padh rahe ho abhi? (Son, what are you studying?)\nMe: Computer Engineering Dadaji.\nHe: What Engineering&hellip;Com&hellip;.?\nMe: Computer Engineering. About Computers?!\nI sheepishly added a typing action accompanying that.\nAt the time, I was convinced he didn&rsquo;t know shit I was talking about. The only word he understood was Engineering.\nHe: Kaunse year me ho? (What year are you in?)\nMe: Third year ji.\nHe: So&hellip;ye Computer mein karte kya hai??\nMe: Software banate hai&hellip;and we also learn how it works&hellip;\nHe: Oh, matlab computer kholke thik karna?? Hmmm&hellip; (Oh, you mean you repair computers?)\nMe: ????? :|\nDad(trying not to offend him): Haan, aisa hi hai kuch to&hellip;(Yeah, it&rsquo;s somewhat like this)\nI looked sharply at my Dad. He was sniggering secretly. He motioned me to take it cool.\nHe: Beta, tum koi course bhi kyu nahi karte fir saath me? (Why don&rsquo;t you do some extra course simultaneously?)\nI felt this conversation was really going somewhere now. Many talk about courses in Engineering\nI nodded.\nHe: Haan, aajkal Tally bahut demand me hai&hellip; (Tally is in demand nowadays)\nI lost my marbles here.\nMe: :| :| :| :| :&rsquo;( :&rsquo;( :&rsquo;( :&rsquo;(\nI didn&rsquo;t reply anything (obviously)\nMeanwhile Dad was having fits of laughter getting increasingly difficult to control.\nHe: Haan beta, kar lo ye&hellip;Future me bahut achcha rahega. (Do this course, it would be good for the future)\nI was blank, and remained the same for the rest of the conversation. My mind blacked out.\nSeriously, why don&rsquo;t these relatives keep their quick thinking abilities to themselves? I have no problem with getting to know someone, but I&rsquo;d rather keep my well intentioned advice to myself.\nIt was only when he started to leave that I regained my senses.\nAt the door, my parents did an authentic &ldquo;Aavjo&rdquo;(Come back sometime again) with the whole family.\nNeedless to say, I had only one prayer in my heart.\nArchived Comments 1. Anonymous \u2014 2015-10-27\nlol&hellip;:p\n2. baba refrigeration (Blogger) \u2014 2016-05-21\nLol&hellip;. &amp; Lol.. Ha ha ha..\n3. Anonymous \u2014 2015-10-27\nNice one!\n4. Anonymous \u2014 2015-10-29\nGood one! ;)\n5. Anonymous (Blogger) \u2014 2015-10-27\nhaha&hellip;Relatives! I can understand well.. BTW well written.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/when-relatives-come-calling-you-go-bawling\/","summary":"<p>The society is a weird entity. Sometimes a man needs a society for his well being, and the other times he needs the society for something to blame for.<\/p>\n<p>The weirdest of the weird parts of the society are your relatives. Some are really good &ndash; keeping to their own, while some others, not quite much so. It&rsquo;s the latter which are more &ldquo;concerned&rdquo; about us and our well-being - &ldquo;Oh, aage kya karne waala hai aapka beta - padhai ya job?&rdquo;, &ldquo;Kitne marks aaye?&rdquo;, &ldquo;Itne kam kyu? Wo chintu ne to top kiya&rdquo;. Sometimes it feels that they are more worried about our future than we ourselves. The only thing remaining now is giving my exam on behalf of me. (BTW, if someone volunteers for it, please let me know)<\/p>","title":"When relatives come calling, you go bawling"},{"content":"This guest post was written by Amrita Nair.\nWhat an awesome year it was! A year full of responsibilities, new learning experiences and a welcome change. ACM is the best thing that ever happened to me. A great platform, for which I will always have immense love and respect.\nACM brought about a beautiful change in me and my life. I may sound as if I&rsquo;m exaggerating, but it&rsquo;s true&hellip; A journey from a quiet, reserved and introvert girl to a bold, strong and confident individual. Every moment of this journey was a moment to be cherished.\nI still remember those intimidating moments of the interviews and those questions which were bombarded one after the other. It was my first interview ever and a memorable one indeed! After the results were announced, I was simply flabbergasted! It took me days for the feeling to actually sink in, and to believe that \u201cI\u201d was the \u201cChairman\u201d. Well, that feeling was something I can&rsquo;t express in words.\nRight from the induction day, we began handling different things which we never thought we could. I am still reminiscent of those sleepless nights I have had, thinking about the daunting tasks I had to take up the next day. Planning for the events right from scratch with my team, assigning duties, seeing if everything was done right and then finally executing it - this was my daily agenda! I had a kind of tape recorder playing in my head saying \u201cI have to do this now, then this\u201d right from the time I woke up until midnight. We conducted back to back events, i.e. one event every week or maybe even two. Yes, it was tiring, but at the end of the day I felt satisfied that we had achieved our goals. Honestly speaking, managing academics and other activities wasn&rsquo;t that easy, it was a challenge that I had to face every day. But as they say, \u201cGreater the challenge, sweeter the victory\u201d. Every task pushed us to the end of our abilities. We had exams (many many exams) as well as events going on throughout the year and they kept us on our toes. But we sailed through these difficult times safely. Especially, when you have such an awesome team to support you, nothing is impossible! Keeping yourself motivated and being down to earth throughout the entire process is the key to achieve that balance. Leadership skills and team work is something I learned from the entire experience. Appreciation gave us the confidence to go forward whereas criticism made us stay grounded in this journey of ours. But slowly, it taught us to accept bouquets and brickbats in the same spirit and grace and carried us through a year that was full of hard work and fun, discouragement and resolve, defeat and victory.\nYes, I had to sacrifice and compromise many things. But, it was worth the experience. I got innumerable opportunities to show my abilities. I learned things I would never know otherwise. I discovered my hidden talents, I discovered a new me. Every day reflected my strengths and weaknesses. It helped me be a decision-maker, a good one&hellip; I learned to be calm when the going gets tough and all odds are against me. I realized who will be the people who&rsquo;ll actually stand by me during thick and thin and those who won\u2019t (Yes, there were some). I learned to accept success and failure as it comes.\nIt was a mighty task, to prove everyone and most importantly to ourselves, that we were worthy of the post given to us.\nWell, the best part is, today I am confident enough to speak in front of a crowd (which I was quite terrified of earlier). And I swear, I haven&rsquo;t spoken to so many people in my entire life. Signing on all the certificates felt great, as though I&rsquo;m giving away my autograph!\nI have a lot more to say and even more to share. Heartfelt thanks to all of you who have been a part of this journey, all you volunteers who have worked very hard, all the participants, seniors who were ever-ready to guide us and my juniors as well. And of course my ever supportive team!\nAnd, as they say, \u201cIt\u2019s not the destination, but the journey that matters.\u201d Though this fascinating journey has come to an end, the amazing experiences I have had, will always remain fresh in my memory for ever, that&rsquo;s for sure!!!\nArchived Comments 1. baba refrigeration (Blogger) \u2014 2016-05-21\nNice. That shows your confidence.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/acm-an-unforgettable-experience\/","summary":"<p><em>This guest post was written by <a href=\"https:\/\/plus.google.com\/106189964189640394425\/posts\">Amrita Nair<\/a>.<\/em><\/p>\n<p>What an awesome year it was! A year full of responsibilities, new learning experiences and a welcome change. ACM is the best thing that ever happened to me. A great platform, for which I will always have immense love and respect.<\/p>","title":"ACM - An Unforgettable Experience"},{"content":"Phew! My last blog post was a year ago, on 4th March, 2014. Which shows it&rsquo;s been a hell of an year for me. These past months, I&rsquo;ve been thoroughly (and happily) busy with the ACM Student Chapter.\nAssociation for Computing Machinery, or ACM, as it is popularly known is\n&ldquo;..the world&rsquo;s largest scientific and educational computing society.&rdquo;\nAnd unlike the IEEE, ACM is solely dedicated to computing.\nI knew ACM Student Chapter accepted chapter representatives solely from the Third Year students of our college, and was looking forward to be a part of the &rsquo;lucky&rsquo; few.\nI still remember my trembling body when I went for the interviews with the previous representatives, and then with the HOD, and other faculties. My hands were like waves of water in the middle of a deep sea because of the anticipation of what lay ahead, those being the very first interviews of mine.\nI shouldn&rsquo;t say much about my interview though! ;)\nI was very pleasantly excited when I found out I got selected as a Secretary, coming after the Chariman Chairman, Ms. Amrita Nair, and Vice chair, Ms. Nikita Merani. I was on cloud nine!\nMay I also introduce the other members:\nMs. Aishwarya Kulkarni, Treasurer Ms. Sayali Haral, Co-Treasurer Ms. Dhanashree Nemade, Wall Magazine Secretary Ms. Ruchira Rokade, Co-Wall Magazine Secretary The first program we organised was the Induction ceremony. We were honoured to take over charge from the previous office bearers. Thus began my whirlwind ride!\nWe organised many events and programmes over the course of the semester - such as TED Talks, Coding Workshops, Alumni Meet, Teachers&rsquo; Day programme, Anantya - Engineer&rsquo;s Day, Coding Contest - CodiGami, to name a few. We organised these, in addition to the already time consuming academic programmes that the college takes us through, throughout the year.\nThe year was not without its lows, however. The posts of the Student Chapter almost made deep cracks in the social relationships of all associated with the chapter. This showed me an ugly facade of human behaviour. It would never be the same, that&rsquo;s for sure. We can now only hope to give Time, time. The less talked about it, the better.\nAs an introvert, I never really interact much with anyone. You do your work, I do mine. But, as with great power comes great responsibility, my social interaction jumped nearly 10x.\nRidiculous Graph, made with MS Paint. Pardon the size. Talking to girls has always been awkward to me. And as you can see above, with the skewed sex ratio in the Core committee made me come out of my Adamantium shell. I haven&rsquo;t been fully out yet, but I&rsquo;m inching closer everyday nevertheless. I was Bond, and they were the Bond girls.\nI look quite like him, don&rsquo;t I? ACM made us workhorses, which sometimes continued right from seven in the morning, till twelve at night. It provided an adrenaline rush(to some of us atleast), working to do something better for the students in the department. And with an awesome team to back you, nothing was impossible. This journey made me better in every aspect. We were learning all throughout the road.\nIn the second semester, we organised the Farewell for our seniors, Android Development Workshop, and the mega one- Techlligent, made an eMag for the department called The Rivista. I also started a class blog -The Rivista which inspired the magazine. The cherry on the cake was that we also started a Readers&rsquo; Club for the department! What could be better!\nAll through the year, our Chairman, Amrita spearheaded the team with great skill. All credit goes to her. Our Vice Chair, Nikita, with unparalleled communication skills brought out numerous participating entries for the events. Our treasurer, Aishwarya, and co-treasurer, Sayali, with their tabs on each paisa spent for the different events. And our Wall Magazine secretaries, Dhanashree, and Ruchira, for doing an exceptional job on all things designing. Who can forget our esteemed- Atul Pawar Sir! Thanks for giving us these exceptional opportunities.\nIt will be a great shame if I didn&rsquo;t include you, the reader, in the list of people I am thankful for. As students, you participated. As classmates, you supported us. As friends, beared with us. As parents, motivated us.\nI could writea lot more on this, the memories and everything. It was nice working together. But all good things must end.\nAnd the end has come. Sob. :'(\nArchived Comments 1. Anonymous (Blogger) \u2014 2015-04-05\nNce one bro\ud83d\udc4d\n2. Anonymous (Blogger) \u2014 2015-04-05\nGood summarization&hellip; Nice work with the image&rsquo;s.. Hat&rsquo;s off..\n3. Anonymous (Blogger) \u2014 2015-04-09\nThe social interaction graph was somewhat analogous to electron&rsquo;s energy orbitals. Keep going bro&hellip;!\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/the-year-of-the-acm-student-chapter\/","summary":"<p>Phew! My last blog post was a year ago, on 4th March, 2014. Which shows it&rsquo;s been a hell of an year for me. These past months, I&rsquo;ve been thoroughly (and happily) busy with the ACM Student Chapter.<br>\nAssociation for Computing Machinery, or ACM, as it is popularly known is<\/p>","title":"The year of the ACM Student Chapter"},{"content":"Last weekend, I had the fortune of visiting my parents at home. Usually this involves unmeasurable happiness on our parts. A couple of holidays every month doing no study; I\u2019d bet you\u2019re game for it. It\u2019s like the movie Gravity - weightlessness and a little bit of pampering on their part.\nRemember the time when we used to watch pokemon, everyday, 5 p.m? Glued to the TV screen, I was. I usually watched Discovery Channel and Nat Geo after my father locked those cartoon channels when I was in 8th grade. Thank you, DTH! However, these last couple of years have squeezed out my hunger for TV. Nothing but Arnab Goswami\u2019s ear splitting shout can make me watch TV nowadays. Even the India-Sri Lanka Asia Cup match didn\u2019t excite me enough.\nThe next day, I was unfortunate enough to sit staring at the Television.\nIt was Sunday eve. To my lousy luck there was no show worth watching during prime time.\nClick. Zanjeer(the new one) on Zee Cinema.\nClick. Some Tollywood movie on Set Max.\nClick. No Arnab Goswami! Tough luck.\nClick. DID li\u2019l Masters.\nAs soon as my family heard that familiar soundtrack, they all \u2018requested\u2019 me to not change the channel. I should have expected that because the moment I tuned to Times Now, a murmur had begun to start.\nI couldn\u2019t retort; my family here consists of 8 members, mind you, and I sure was not going to stand against 7 of them. I had to give in.\nHere goes.\nDelhi Auditions.\nA girl, she\u2019s only twelve, is picturised mouthing like a ruffian and acting all grown up.\nA boy, 8 probably, dances arguably good.\nThe three judges of the show sat there - their face coated with layers of make-up. Talk about putting Metamorphic rocks to shame! They then start the audition of the children. A couple of participants come and go. The curtain closes and then again starts the documentary like clips of the participants.\nThis one is a boy\u2019s.\nThe boy, 8, acting all cheesy comes up to the stage, dances and then starts the pulling of the leg part by the show\u2019s judges.\nA judge asks his name. He tells them. No matter.\nSomehow, as if the conversation were rehearsed, they ask him what else can he do. He tells him he can recite dialogues of any actor. Any actor, mind you.\nThey tell him to recite Sunny Deol. Out comes a barrage of Sunny Deol\u2019s dialogues which you can\u2019t even catch hold because the film it is from, was released some 20 years back. Wait 20 years back, you say? Hell yeah!\nSo the question arises, how could an 8 year old mouth it as if it had been his? Passion for films? Maybe. But how could he claim to speak dialogues of \u2018any\u2019 actor. Seems too good to be true!\nThe next scenes all show him mouthing some tongue in cheek dialogues, with the judges and the audience, all laughing hysterically. The mechanical, recorded laughter which tries to make us believe that it really is the audience laughing.\nNext they tell him to recite a shayari!. He retorts with an explicit shayari with so strong a sexual innuendo that could bring an adult to shame! Only if he could have recited that poem in the English oral! The only shocking thing remaining was they didn\u2019t announce him as the leader of their tribe. The thing about the episode was that it was so fake that I question how could the audience consume all this nonsense?\nSmiles. All fake.\nLaughter. All fake.\nAudience. All fake.\nAnd this was suposed to be reality TV.\nI\u2019m not saying that everything on such shows is scripted.\nThen where does it harm the audience?\nI\u2019m the right person to ask. The people who watch these shows are usually the people with kids. After a good performance, they all expect their kids to be like the ones on the TV show. Some people even put them up in the classes which the kids aren\u2019t interested in and which they don\u2019t care about. Unrealistic expectations of the parents on their kids increase. They are asked to look up to them.\nWhat about the kids on the other side of television?\nIt\u2019s good that they get their fame at such a young age. But expecting them to renounce their childhood days to daily shoots seems a bad idea. What good memories would they have when they grow up? Not like mine, surely.\nCommercialization of children is taking its toll.\nThe day couldn\u2019t be more far when there\u2019s a show measuring a 6 year old on how good an IIT\u2019ian can he be.\nArchived Comments 1. Divya (Blogger) \u2014 2026-01-16\nClick. Click. Click. I. Loved. It. Hehe. :)\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/what-reality-tv-usually-is\/","summary":"<p>Last weekend, I had the fortune of visiting my parents at home.\nUsually this involves unmeasurable happiness on our parts. A couple of\nholidays every month doing no study; I\u2019d bet you\u2019re game for it. It\u2019s\nlike the movie Gravity - weightlessness and a little bit of pampering on\ntheir part.<\/p>","title":"What Reality TV usually is."},{"content":"Lets face it, we\u2019ve all been there before. Going through the pile of rubbish that your \u2019friends\u2019 shared whom you don\u2019t even care about. Photographs asking you to like them or you are doomed. Filtering through all of the shit, just because you could see the photo of your crush who doesn\u2019t even know you. That embarrassing picture you posted online; when you were out of your mind and regret it now. This list goes on and on.\nBut what have we learned from it? Why are we so addicted to Social media\u200a\u2014\u200awhich gives us nothing but those 50 seconds of fame, and tries to give us mild, temporary satisfaction among our peers.\nI had read an answer on Quora about this what could you do after overcoming this addiction of ours.\nNever believed it.\nTill now.\nLuckily, I was fortunate enough to go through this process a week ago.\nAfter 1 month of pathetically slow, agonizing speeds of my 3G internet ISP, the Internet package that I had subscribed to, finally came to an end.\nI didn\u2019t think I\u2019d survive another day without Facebook; half a day without IM. But I stood ground.\nI very much wanted to so many other things\u200a\u2014\u200acatching up on my reading habits, my homework and assignments and what not.\nThe next week began as an intense detoxifying exercise.\nMy Agenda?\nHTML\nLearning HTML I\u2019ve always wanted to make things. And Notepad++ was the perfect place to make it come true. I went over to The New Boston site and downloaded the videos for xHTML and CSS. (From the Internet service provided by my college, which has Facebook blocked, mind you) Those videos are awesome. A must watch for those who want to learn computer science and stuff.\nCredits\u200a\u2014\u200ahttp:\/\/twcdc.com\/andycox\/art-and-technology\/412_student_posts\/ashlee\/assignment-3-computer-keyboard\/\nImprove my Typing accuracy &amp; speed Poor typing speed can be the worst embarrassment for a computer engineer. For one who writes hundreds of lines of code everyday, looking through all the keys to type a simgle word is too hard on the eyes. Months after installing a typing program in my computer, I had made little headway in improving my speed. This improved after I had much of the extra time and attention which would have distracted if I was online looking through Grumpy Cat pictures. (Still taking too long to type this post out. And I\u2019d rather not show you my speed)\nMore time thinking things out Everyone thinks that they have so little time in a day, and they postpone that important thing to the next. The advantage is that you won\u2019t think that you\u2019ve got less time and would face up to your problems. You have to face up.\nI\u2019m writing this post in MarkDown.\nMarkDown Logo\nMarkDown Syntax. Check. I\u2019ve learned that the only things you miss after this detox procedure are those \u2018intimate\u2019 moments of your so called \u2018friends\u2019.\nHell, you shouldn\u2019t even be reading this. Go back, you procastinator! Just kidding. It\u2019s good to read. But not every site and article you find on the web.\nHappy Detoxing!\nP.S - I am an amateur at writing. Please pardon me for any dumb errors; or rather help me correct them.\nI write at Nothing of Consequence.\nThis post originally appeared on Medium.\nArchived Comments 1. I am my Father&rsquo;s Daughter (Blogger) \u2014 2016-06-12\nGood one Darshit,\nWell written, way to go. Need a language polish.\nRegards Avighna Menon\n2. Darshit Patel (Blogger) \u2014 2017-06-25\nThanks a lot, I&rsquo;m working on it. Sorry for the late reply, I don&rsquo;t update my blog as much as I&rsquo;d like to.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/why-you-should-stop-using-facebook-whatsapp-and-other-crap\/","summary":"<p><strong>Lets face it, we\u2019ve all been there before. Going through the pile of rubbish that your <em>\u2019friends\u2019<\/em> shared whom you don\u2019t even care about. Photographs asking you to like them or you are doomed. Filtering through all of the shit, just because you could see the photo of your crush who doesn\u2019t even know you. That embarrassing picture you posted online; when you were out of your mind and regret it now. This list goes on and on.<\/strong><\/p>","title":"Why You should stop using Facebook, WhatsApp and other crap."},{"content":"Delhi: The Winter session of the Parliament commenced this Thursday. We media channels, were expecting the usual non-functioning and house disruptions in the assembly.\nBut we were in for a shock because after the promised Telangana Bill was tabled and debated, the government somehow passed a Privileged Motion recognizing Customer Care Executives as a separate Race. The other bills such as the Lokpal Bill and The Women&rsquo;s Reservation Bill were put on hold.\nThe Government spokesperson after the session said,\u201dWe wanted to pass this motion for many years but did not get a chance. Sensing the opportunity today, a member decided to table it and got it passed with an overwhelming majority and surprising support from the opposition.\u201d\nSources inside the government, however said that the move came as a result of non-refunded and unreasonable deduction of Rs.20 from the talk time of a senior ministry official.\n\u201cThe deduction was absolutely unreasonable. When I complained about it to the customer service, he responded saying I had surfed an adult website which according to him, is chargeable. I had surfed the site many times earlier but didn\u2019t get charged! He didn\u2019t even get afraid when I told him I was the Telecom minister, but retorted back saying he was Salman Khan. Gosh, I shouldn\u2019t have let the 2G scam happen,\u201d the source added on the condition on anonymity.\nThe passing of this motion gave in to massive support by the citizens all over the country. \u201cOnce, they deducted almost Rs.200 from my balance citing the same reason. Complaining was too of no help as the retarded customer care agent tried sheepishly to explain me the http full form. I told him to shut his dumb mouth up and cough up my refund,\u201d said Raju Rastogi, a Computer Engineer from Pune who is the customer of some \u2018Bye-Bye Mocodo\u2019 telecom provider.\n\u201cThey even charged me for speaking to some Munni on the mobile phone. You tell me, I can\u2019t even talk to a fake girl; then how could I chat with Munni for 1\/2 hour,\u201d his friend Farhaan added, who is from the Mech. Engg. Department of the same college.\nAAM Party, which is new on the national stage, termed this resolution as a vote-bank politics by the government and the opposition. \u201cThe Government and the Opposition are hand in gloves, I tell you. How can you term the customer care agents as Race when they don\u2019t have any brains! The Government must instead provide free Mental check-ups and hope that they don\u2019t ever meet a normal man because this may lead to a Stupidity outbreak which may engulf the whole world,\u201d said the head of the party.\nThe US president Barack Obama too supported the idea saying that they themselves were considering invading India in a secret operation and make the Customer Care Executives sterile as most of the US companies have outsourced their customer support to India.\nThe NCW said that this resolution is Sexist because the Women\u2019s Reservation Bill was not tabled. Anna Hazare was upset on not passing of the Lokpal Bill.\nMeanwhile, citizens all over the country are planning to party tonight to remember this historic moment.\nI wrote this article for Faking News. Check it out here -\nParliament passes resolution recognizing customer care executives as a separate Race\nArchived Comments 1. baba refrigeration (Blogger) \u2014 2016-05-21\nGood one. \ud83d\udc4d\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/parliament-passes-resolution-recognizing-customer-care-executives-as-a-separate-race\/","summary":"<p><strong>Delhi<\/strong>: The Winter session of the Parliament commenced this Thursday. We media channels, were expecting the usual non-functioning and house disruptions in the assembly.<\/p>\n<p>But we were in for a shock because after the promised Telangana Bill was tabled and debated, the government somehow passed a <a href=\"http:\/\/en.wikipedia.org\/wiki\/Privileged_motion\" title=\"Privileged Motion\">Privileged Motion<\/a> recognizing Customer Care Executives as a separate Race. The other bills such as the Lokpal Bill and The Women&rsquo;s Reservation Bill were put on hold.<\/p>","title":"Parliament passes resolution recognizing customer care executives as a separate Race"},{"content":"I don&rsquo;t usually read poems but I came across this gem by Sam Keen. Here it goes.\nStart with an empty canvas\nSketch in broad outline the forms of\nmen, women, and children.\nDip into the unconsciousness well of your own\ndisowned darkness\nwith a wide brush and\nstrain the strangers with the sinister hue\nof the shadow.\nTrace onto the face of the enemy the greed,\nhatred, carelessness you dare not claim as\nyour own.\nObscure the sweet individuality of each face.\nErase all hints of the myriad loves, hopes,\nfears that play through the kaleidoscope of\nevery infinite heart.\nTwist the smile until it forms the downward\narc of cruelty.\nStrip flesh from bone until only the\nabstract skeleton of death remains.\nExaggerate each feature until man is\nmetamorphasized into beast, vermin, insect.\nFill in the background with malignant\nfigures from ancient nightmares \u2013 devils,\ndemons, myrmidons of evil.\nWhen your icon of the enemy is complete\nyou will be able to kill without guilt,\nslaughter without shame.\nThe thing you destroy will have become\nmerely an enemy of God, an impediment\nto the sacred dialectic of history.\n- Sam Keen, Faces of the Enemy.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/how-to-create-an-enemy-by-sam-keen\/","summary":"<p>I don&rsquo;t usually read poems but I came across this gem by Sam Keen. Here it goes.<\/p>\n<blockquote>\n<p>Start with an empty canvas<br>\nSketch in broad outline the forms of<br>\nmen, women, and children.<\/p>","title":"How to Create an Enemy - By Sam Keen"},{"content":"India is a country with 22 official languages, 1652 languages and dialects in total with over 216 languages with more than 10,000 native speakers. Of them, Hindi is the most spoken in India.\nOne of these languages is Gujarati, my mother tongue. Gujarati has almost 46 million speakers in the world, most of them being in India. However, every man whose mother tongue is Gujarati knows that Gujaratis are found almost everywhere on the Earth (and a lady in the space too!). So don\u2019t be surprised if you stumbled into one in an almost undiscovered place on earth.\nI was in the 12th Grade and preparing for IIT - JEE at a good 22 km away from my home town. Travelling these 44 kilometres everyday was a very tiring task, particularly when you travel in a S.T bus. People who travel on these buses know that these buses are nothing short of a roller coaster ride. You could get the same thrill riding a roller coaster in Essel World for Rs.600 except that in a bus, it was 30 times cheaper.\nMy class was just over and I was waiting for the bus. It was raining like hell and I was firmly concentrating on getting a seat on the bus. It felt like me winning a lottery had far greater odds than getting that seat. Luckily I found a friend waiting for the same bus. My odds had increased.\nThe bus came. It was a stampede. Everyone dashed towards the door. Judging by the number of people going in at a time, I was surprised that the door did not tear apart.\nFinally, we got the seats. That awesome feeling\u2026.!\nMy friend and I had a talk for a while till the bus filled to over its capacity. After approximately a quarter of my ride, I realized that two girls - probably sisters, of 20 years of age, were standing next to my seat. I couldn\u2019t help but overhear what they were talking about \u2014 Me, in Gujarati. Sadly, they had overlooked the fact that they almost certainly knew - that we gujjus are everywhere! They were going on about how my oversized watch (according to them), looked on my rather thin hand, how my green shirt looked on me and how I had absolutely no dressing sense.\nI glanced their way and couldn\u2019t help but notice that they themselves were ugly enough to make even Shehnaz Hussain lose her job. I sat there calmly and speculated to fake a phone call to my mother and be just so loud enough that they know that I, too, was a Gujarati. But I didn\u2019t want to throw them off their comfortable balance. I sat there with a poker face and half a smile thinking what more sweet things could these strangers want to tell me. I was still far from home\u2026\u2026\nSo, the next time that you think to criticize someone in your mother tongue, think twice.\nArchived Comments 1. Anonymous (Blogger) \u2014 2013-12-03\nGr8 Darshit&hellip;.AWESOME!!!!! :) :)\n2. baba refrigeration (Blogger) \u2014 2014-03-05\noh dear, never knew you are amazing writer. i saw your post today only. keep it up.\n3. Darshit Patel (Blogger) \u2014 2013-12-06\nThank You! :)\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/mind-your-language\/","summary":"<p>India is a country with 22 official languages, 1652 languages and dialects in total with over 216 languages with more than 10,000 native speakers. Of them, Hindi is the most spoken in India.<\/p>","title":"Mind your language!"},{"content":"This is my 3rd foray into the world of blogging. My first two blogs were as good as non-existent. So I was searching once again for a topic to write on. Luckily I happened to watch this movie,YJHD,and being the natural critic that I am,I jumped on it.\nI didn&rsquo;t want to watch this movie,primarily because I think mainstream commercial Bollywood is too over the top and secondarily that I like only movies with a credible story.\nAfter the usual ritual of coming late to the show,and disturbing the audience in the way with the murmurs of \u2018scuse me,we settled down for the treat.\nThe Movie was not quite what I had expected. I had expected a full on full love story with crying damsels here and tanhah aashiqs there. But there was none here,at least for the first half. Ranbir Kapoor was the same happy-go-lucky character as Anushka Sharma plays in most of her films. Deepika is a nerdy girl,stark contrast to RK (Need I say anything more?). The first half is the fun half with quite some good dose of humour. It is not devoid of clich\u00e9s,however. I could never forgive the director for including the miss-crying-princess like character. This half is where the fun ends.\nThe latter half is about 8 years later. The feel-good love story now starts. The same romantic moments which about every film has,fall into the place.Then the usual roona-dhoona. However I couldn\u2019t help but notice that RK uses the same bag for nine straight years(!?),even after touring nearly all around the world!\nThat being said, it is a paisa-vasool feel-good film,which falters in the second half. Only Deepika\u2019s beauty and RK\u2019s acting makes you watch it.Even if you miss the film,it\u2019s nothing of consequence.\nP.S - It seems that all the characters have nothing to do except drink day and night.\n","permalink":"https:\/\/darshit.dev\/nothing-of-consequence\/yeh-jawaani-hai-deewani-review\/","summary":"<p>This is my 3rd foray into the world of blogging. My first two blogs were as good as non-existent. So I was searching once again for a topic to write on. Luckily I happened to watch this movie,YJHD,and being the natural critic that I am,I jumped on it.<\/p>","title":"Yeh Jawaani Hai Deewani: Review?"}]