Jekyll2021-01-01T19:25:15+00:00https://jainkuniya.github.io/feed.xmlVishwesh JainkuniyaMy personal cornerWho Will Cry When you Die?2021-01-01T23:28:00+00:002021-01-01T23:28:00+00:00https://jainkuniya.github.io/summary-Who-Will-Cry-When-you-Die<p><strong>Who will cry when you die?</strong> My learnings goes here đ</p>
<hr />
<p>1/n</p>
<ul>
<li>live by choice rather than by chance, by design not by default.</li>
<li>if you donât act on life, life has a habit of acting on you.</li>
<li>bring more of yourself, find your calling and do stuff you are best at.</li>
<li>#create postive #impact in surrounding</li>
</ul>
<hr />
<p>2/n</p>
<ul>
<li>when asked on deathbed, many said, âI wished I would have been kind to othersâ. #BeKind #spreadsmilesthisdiwali</li>
<li>try for positive perspective in negative situations, are your problems really big(est) than others?</li>
</ul>
<hr />
<p>3/n</p>
<ul>
<li>
<p>The quality of life ultimately is shaped by the quality of your choice and decisions. Take control on your life by picking up the right ones instead of easiest ones.</p>
</li>
<li>
<p>Give time to yourself, do 1-1 with yourself to find out what you really want & evaluate periodically</p>
</li>
</ul>
<hr />
<p>4/n</p>
<ul>
<li>
<p>you donât keep your words => lose credibility;
fix: be a person of your words, and stop making false promises which deep inside you too have doubt.</p>
</li>
<li>
<p>you become what you think about all day long, no sense to worry about past. Use this to fuel your future not ruin.</p>
</li>
</ul>
<hr />
<p>5/n</p>
<ul>
<li>
<p>the way you begin your day determines the way you will live your day, first 30 mins.</p>
</li>
<li>
<p>if you donât have priorities, you will end up saying yes to all, rather focus on your best and follow your passion. Else your plan will get filled with other peopleâs priorities.</p>
</li>
</ul>
<hr />
<p>6/n</p>
<ul>
<li>weekends are to charge up our batteries, donât ruin them with laziness and take them for granted.</li>
<li>stress is not bad thing, it help us to give our best.</li>
<li>keep faith in you, be confident and talk to yourself #alliswell, you thoughts are responsible for your rise or fall.</li>
</ul>
<hr />
<p>7/n</p>
<p>We have many problems in life</p>
<ul>
<li>
<p>but just think, is it worth to worry about all? Some are minor, some are big. If you are on worry side, life will get filled with worry. Define your own boundaries, when to and when not to.</p>
</li>
<li>
<p>give time to appreciate your achievements as well</p>
</li>
</ul>
<hr />
<p>8/n</p>
<ul>
<li>inspiration & dedication are key ingredients fir success</li>
<li>in a sound body rests a sound mind Regular exercise is best for body and mind.</li>
<li>Harvard study says, 1hr exercise will give you 3 extra hrs.</li>
</ul>
<p>Ex: try to find a solution after workout, you will feel better.</p>
<hr />
<p>9/n</p>
<ul>
<li>Experiencing solitude, for even a few minutes a day, will keep you centred on your highest priorities. #learnToBeSilent</li>
<li>Think of best people according to you and qualities they have, try to foster same in you life.</li>
<li>Control your day, rather than day controlling you.</li>
</ul>
<hr />
<p>10/n</p>
<ul>
<li>Challenges are best way to learn and gain experience.</li>
<li>âWe donât laugh because we are happy. We are happy because we laughâ - William James</li>
<li>Life for the moment rather than merely a human doing.</li>
</ul>
<hr />
<p>11/n</p>
<ul>
<li>Donât regret afterwards, do it now.</li>
<li>Stop judging events as good/bad, accept them and live life.</li>
<li>There are no real failures, no tragedies & no problems, they are results, lessons & opportunities.</li>
<li>Learn from surrounding, living is a gift we must make the best of it.
âNothing great was achieved without enthusiasmâ - Ralph Waldo</li>
</ul>
<hr />
<p>12/n</p>
<ul>
<li>The hand that gives is the hand that gathers. You donât just pay for the services, you thank them.</li>
<li>The person who chases two rabbits catches neither; use your time accordingly and focus on worthy.</li>
<li>Appreciating others at time is must for any sort of relationship.</li>
</ul>
<hr />
<p>13/n</p>
<ul>
<li>No source of knowledge is as good as books, which contain compressed summary of thousands of years.
âSo long as you live, keep learning how to liveâ - Seneca</li>
<li>The little things are the big things. âWithout a rich heart, wealth is a ugly beggarâ - Emerson</li>
</ul>
<hr />
<p>14/n</p>
<ul>
<li>Understand otherâs point of view before moving forward, make sure other person is getting you before you proceed in conversation.</li>
<li>âA problem well started is a problem half solvedâ - Charles Kettering</li>
<li>Paths are made by walking, not by waiting.
The smallest of actions is always better than the boldest of intentions.</li>
</ul>
<hr />
<p>15/n</p>
<ul>
<li>If you donât act on life, life has a habit of acting on you.</li>
<li>Enjoy the path, not just the reward. The reward for a thing well done, is to have done it - Ralph</li>
<li>To eliminate negative habit/weakness, first identify them & pay attention, solution will come automatically</li>
</ul>
<hr />
<p>16/n</p>
<ul>
<li>Once you learn how to die, you learn how to live.</li>
<li>Time is lifeâs great leveler.</li>
<li>Problem with losing tempor on daily basis is that it becomes a habit. And habits becomes second nature someday.</li>
</ul>
<hr />
<p>17/n</p>
<ul>
<li>Companies have board of directors for discussing problems, who you have?</li>
<li>âReal generosity towards the future consists in giving all of what is todayâ - Albert Camus</li>
<li>Too many distractions, distributes power of mind</li>
<li>The more you ask, the more you get
âEvery arrow that hits the bullâs eye is the result of one hundred missesâ - Buddhist sages
âItâs a funny thing about life; if you refuse to accept anything but the best, you very often get itâ - Somerset Maughan</li>
</ul>
<hr />
<p>18/n</p>
<ul>
<li>If you are able to find meaning in your work, you are gonna enjoy it. Find it right now.</li>
<li>Reading, learning is not only limited to exams. Ongoing life is also an exam which requires learning at every turn.</li>
<li>Focus of developing strengths rather than weaknesses.
âThe tragedy of life is not death, but what we let die inside of us while we live.â - Norman Cousins</li>
</ul>
<hr />
<p>19/n</p>
<ul>
<li>Communing with nature is an excellent way to unlock creativity & generate new ideas</li>
<li>Utilise commute time instead of reaching office tired</li>
<li>Read with a purpose rather than as an excuse to help you passtime</li>
<li>Setting clearly defined goals => framework for smarter choices
âGoals and plans take the worry out of living.â - Glenn Bland</li>
</ul>
<hr />
<p>20/n</p>
<p>Habits are everything, and it takes 21 days to develop. Initial days are hard like đ requires more fuel to just uplift than travel millions of miles afterwards.
Same as, new shoes feel uncomfortable initially but after few days we love them.</p>
<hr />
<p>21/n</p>
<ul>
<li>Forgiving someone is actually a selfish act rather than a selfless one</li>
<li>The food we eat describes our mood (work, & productivity)</li>
<li>Our thoughts form our world</li>
<li>First class surrounding is an investment, not an expense. Our surroundings shape our moods, thoughts, dreams</li>
</ul>
<hr />
<p>22/n</p>
<ul>
<li>You will never go wrong by spending time enjoying nature #walkinthewoods</li>
<li>Coach helps in connecting dots of the life and succeed</li>
<li>Vacations are necessary, at least try mini vacation every week</li>
</ul>
<hr />
<p>23/n</p>
<ul>
<li>It is very easy to magnify our problems, donât weep because we donât have shoes, someone doesnât have feet #beavolunteer to help needy & thanks what all we have</li>
<li>We attract into our life that which we focus on. Letâs create list of focus</li>
<li>Music can lift mood, put smile</li>
</ul>
<hr />
<p>24/n</p>
<ul>
<li>Greatness comes from beginning something that does not end with u</li>
<li>Time to start building legacy is today, not ten years from today when you say âhave more time,â because time will never arrive</li>
<li>Cultivating great friendships is one of the surest way of happiness & joy</li>
</ul>
<hr />
<p>25/n</p>
<ul>
<li>All of us are creative artist/beings.</li>
<li>Without the ability to concentrate, a full and complete life is impossible. Meditate and give some rest to ears.</li>
<li>Time slips like grains of sand, live everyday as last day.</li>
<li>Stop complaining and start living.</li>
</ul>
<hr />
<p>26/n</p>
<ul>
<li>To be paid more money, add more value to the world.</li>
<li>To get more from life, add more to the life.</li>
<li>The way you raise your children is the way you raise your future generations.</li>
<li>If you follow the crowd, the place you will most likely end up at is the exit.</li>
</ul>
<hr />
<p>27/n</p>
<ul>
<li>The person who tries to do everything ultimately accomplishes nothing. Create a goal card</li>
<li>We are not our thoughts, we are not our moods, we are the creator of the moods we experience, which we can change in a single instant</li>
<li>At the end one has memories not possession</li>
</ul>
<hr />
<p>28/n</p>
<ul>
<li>Instead of criticizing someone, we should help him and ourself</li>
<li>As we live our days, so we will live our life</li>
<li>A master mind alliance will not only cut learning curve in the game of Life, it will help have much more fun playing it</li>
<li>Live with own terms instead with flow</li>
</ul>
<hr />
<p>29/n</p>
<ul>
<li>To improve our life, we must first improve our thinking. We see the world, not as it is but as we are.</li>
<li>Either we can make excuses or we can make progress, but we cannot do both.</li>
<li>The tree that has the most fruit is the tree that bends to the ground.</li>
</ul>
<hr />
<p>30/n</p>
<ul>
<li>The more we are as a person, the less we need to prove ourself to others.</li>
<li>Some books are to be tasted, others to be swallowed, chewed & digested, some read only in parts, others to be read, but not curiously while some with whole attention. Donât waste time in all books</li>
</ul>
<hr />
<p>31/n</p>
<ul>
<li>Staying quiet for even short periods of time builds willpower and self control.</li>
<li>The telephone is there for your convenience, not for the convenience of your callers. Donât rush to attend all.</li>
<li>Recreation is important and it must serve to recreate you.</li>
</ul>
<hr />
<p>32/n</p>
<ul>
<li>Set higher and higher goals to maintain a healthy level of optimism and passion for life, else depression will kill you.</li>
<li>Sleep is like a drug. Quantity doesnât matter, quality and richness of the sleep matters.</li>
<li>Have a family meantime and create memories everyday.</li>
</ul>
<hr />
<p>33/n</p>
<ul>
<li>âacting as ifâ technique helps in becoming the person we plan to be.</li>
<li>Take a public speaking course.</li>
<li>âNature your mind with great thoughts, for you will never go any higher than you think.â - Benjamin Disraeli</li>
<li>Most people donât fall, they simply give up trying.</li>
</ul>
<hr />
<p>34/n</p>
<ul>
<li>âIt is not because things are difficult that we do not dare, it is because we do not dare that they are difficult.â - Seneca</li>
<li>Donât worry about things you canât change.</li>
</ul>
<hr />
<p>35/n</p>
<ul>
<li>Never take your worries with you on the walk, pay attention and enjoy the moment.</li>
<li>Wonderful thing about time is, we canât waste it in advance. No matter what had happened in past, future is spotless. It is never too late to become the person we always wanted to be.</li>
</ul>
<hr />
<p>36/n</p>
<ul>
<li>Plant a tree, as it grows we will be able to mark our personal pages and growth as a human being.</li>
<li>Find a place of peace.</li>
<li>We are as old as our doubt, fear, despair. The way to keep young is keep faith, self confidence, hope young. - L.F Phelan</li>
</ul>
<hr />
<p>37/n</p>
<ul>
<li>Every life is worth living and recording. Capture memories, a picture truly is worth a thousand words.</li>
<li>Be a adventurer, and reinvent the way to live.</li>
<li>Decompress, renew, recharge yourself before going back home (from office).</li>
<li>Respect your instincts.</li>
</ul>
<hr />
<p>38/n</p>
<ul>
<li>A great quote contains wealth and wisdom in a single line. Collect quotes that inspire you</li>
<li>Timeless secret to a long, happy life is to love our work</li>
<li>âThere is no higher religion than human service. To work for the common good is the greatest creedâ - Albert Schweitzer</li>
</ul>
<hr />
<p>39/39</p>
<p>We live in an age where we have conquered the highest of mountains but have yet to master our selves.</p>
<p>Happiness is not a place to reach, it is state to create.</p>
<p>The purpose of life is a life of purpose.</p>
<p>Live fully so you can die happy</p>
<hr />vishweshWho will cry when you die? My learnings goes here đThe Power of Your Subconscious Mind2020-11-22T14:28:00+00:002020-11-22T14:28:00+00:00https://jainkuniya.github.io/summary-the-power-of-your-subconcious-mind<p><strong>The power of your subconscious mind.</strong> My learnings goes here đ</p>
<p>1/n</p>
<ul>
<li>Itâs all about what you think.</li>
<li>If you think itâs boring, then most interesting work will also be boring for you. If you think tiring, then even without doing any work you will feel tired.</li>
</ul>
<hr />
<p>2/n</p>
<ul>
<li>Think good, good follows. Think bad, bad follows.</li>
<li>Concious mind is kinda sync flow, actions are instant on any sense.</li>
<li>Subconscious mind is kinda async flow, build gradually from what concious mind accepts.</li>
<li>Be away from negative advice and thoughts.</li>
</ul>
<hr />
<p>3/n</p>
<ul>
<li>âMan is what he thinks all day longâ</li>
<li>One expresses whatever he has in his subconscious mind: dedication, jealousy, happiness, sadness etc.</li>
<li>Subconscious mind have constructed our body. If required it can heal/recreate as well.</li>
</ul>
<hr />
<p>4/n</p>
<ul>
<li>Subconscious mind is always open for suggestion.</li>
<li>Plant a good idea in mind, subconscious mind will give you fruits later.</li>
<li>Cause of disease is in mind <=> healing can also come from the same.</li>
<li>Only 1 process of healing => faith</li>
<li>Only 1 healing power => subconscious mind</li>
</ul>
<hr />
<p>5/n</p>
<p>âThe doctor dresses the wound, but God heals itâ</p>
<ul>
<li>Itâs the power of blind faith & prayer therapy, where one keep aside all the negativity and thinks good. Which triggers subconscious mind to release healing.</li>
<li>People were even cured in time when there was no operation theatre.</li>
</ul>
<hr />
<p>6/n</p>
<p>A mental picture is worth a thousand words. Your subconscious mind act as an architect, who brings the sketch in reality which was built by your thoughts.</p>
<hr />
<p>7/n</p>
<ul>
<li>Scientists says: we build a new body every 11 months.</li>
<li>A lot can change in 11 months, affirm the good, and bad will vanish in the next cycle.</li>
<li>Get rid of darkness => light, cold => hot, overcome negative thoughts => substitute with good one.</li>
</ul>
<hr />
<p>8/n</p>
<p>Dreams comes from your subconscious mind. Imagine the fulfillment of your desire over and over again. One day, all your dreams will come true.</p>
<hr />
<p>9/n</p>
<p>Subconscious only accepts what you feel really to be true. It is a bank, multiple and magnifies what you deposit: fear/negative or positive thoughts, wealthy or poverty.</p>
<hr />
<p>10/n</p>
<p>A person is rich or poor from his thoughts in his mind, subconscious mind.</p>
<hr />
<p>11/n</p>
<ul>
<li>Subconscious mind is the storehouse of memories, deposit good and get good ones in return.</li>
<li>Success doesnât come one way. You become successful by helping someone in succeeding.</li>
<li>Prepare your subconscious mind for the desire, and you will get pushed to it.</li>
</ul>
<hr />
<p>12/n</p>
<ul>
<li>The action is your thought, reaction is the response from your subconscious mind.</li>
<li>Many times, after trying so hard, we arenât able to solve a problem. And suddenly it clicks up in our mind when we are not thinking of it.</li>
<li>Itâs subconscious mind, which is working for us.</li>
</ul>
<hr />
<p>13/n</p>
<ul>
<li>Sometime you dream of whatâs gonna happen next.</li>
<li>Many times you got a solution while you are asleep.</li>
<li>Itâs all because of your subconscious mind. It never sleep.</li>
<li>There is nothing too hard for your subconscious mind. Give it a chance.</li>
<li>Sleep in peace and Wake in Joy</li>
</ul>
<hr />
<p>14/n</p>
<p>Role of subconscious mind in marital relationship. No experience, canât summarise đđťââď¸
But ya in any relationship, belittling or condemning your partner in the eyes of others doesnât make any sense. Eventually your mind will get filled with negatively and will lead to â prob</p>
<hr />
<p>15/n</p>
<p>The kingdom of happiness is in your thoughts and feelings.
Happiness is a habit, and you must desire for it. Nobody can actually take it away from you.
Some are happy despite having nothing, while others are unhappy even after having all.
Itâs your choice to be happy.</p>
<hr />
<p>16/n on Human relations</p>
<ul>
<li>Ur subconscious mind is a recording machine which reproduces your habitual thinking. Think good of the other, and u r actually thinking good about yourself.</li>
<li>U r the only Thinker in ur universe, ur thoughts r creative. So what u think is what u feel.</li>
</ul>
<hr />
<p>17/n</p>
<ul>
<li>Learn to forgive yourself. Donât live with a guilt, learn from mistakes and move on.</li>
<li>Keeping the guilt, will block subconscious mind to think for positive future.</li>
<li>If you believe in your thoughts, nobody can criticize you. Even if they do, correct your faults and move on.</li>
</ul>
<hr />
<p>18/n</p>
<ul>
<li>Solution lies within the problem, believe in yourself, have faith on infinite intelligence of your subconscious mind to solve it for you.</li>
<li>Habits are byproduct of your subconscious mind.</li>
<li>Positive thinking will result in good habits, while negatively will develop bad habits.</li>
</ul>
<hr />
<p>19/n</p>
<ul>
<li>Subconscious mind takes your fears as a request, proceeds to manifest them, and brings them into your experience.</li>
<li>Do the thing you fear for, keep confidence and face it, make you mind several times that you can do it to get rid of fear.</li>
</ul>
<hr />
<p>20/20</p>
<ul>
<li>Subconscious mind never gets old.</li>
<li>Your thoughts defines your age.</li>
<li>One is as strong as he thinks, and as valuable as he thinks.</li>
<li>Some are old at 30, while others are young at 80.</li>
</ul>
<hr />vishweshThe power of your subconscious mind. My learnings goes here đLoser is not the one who loses, but the one who gives up2020-04-30T02:04:00+00:002020-04-30T02:04:00+00:00https://jainkuniya.github.io/loser-is-not-the-one-who-loses-but-the-one-who-gives-up<p>This blog is targeted for all those who feel that they are losers, believe me, you are not and you will also feel the same after reading this.</p>
<p>I am from an engineering background, so mostly this blog will revolve around engineering entrance exams, engineering colleges, and the life of an engineer đ .</p>
<p>In India, the Indian Institute of Technology (<a href="https://en.wikipedia.org/wiki/Indian_Institutes_of_Technology">IITs</a>) are considered as one of the best engineering colleges. At the time of writing this, there are 23 IITs which take around 11,279 students every year.</p>
<p><strong>But do you know how many students give entrance exam to get into IIT?</strong></p>
<p>More than <a href="https://www.careers360.com/question-how-many-students-appeared-for-jee-main-and-jee-advanced-this-year">10,00,000 students</a> appear in this race of getting admission in IITs. Nearly 1.12% of students are passed. Around <a href="https://en.wikipedia.org/wiki/Suicide_in_India">2,000 students</a> do suicide due to failure in examination. They feel that they are useless, and are frightened of what others will think.</p>
<p>So here I want to say that if you didnât manage to get admission in IIT, then you are not a loser. But if you just give up and stop doing hard work, then you are. Letâs take a simple example here:</p>
<p>I guess all have played <a href="https://play.google.com/store/apps/details?id=com.kiloo.subwaysurf&hl=en_IN">SUBWAY SURFERS</a> game, if not they try it out now</p>
<p><img style="height:400px; display:block; margin:auto;" src="../assets/images/loser/headstart.png" /></p>
<p>It has something called <strong>HEADSTART</strong>, which provides you some initial lead with points and coins while running.</p>
<p><em>Mind it, using this headstart does not ensure you a top score or high score in that game. You have to keep moving and work hard to gain that.</em></p>
<p>IITs are also similar to that headstart. Being the elite institutions of the country, will give you a safe side and provide headstart in your life. <em>But to be successful, you need to keep doing hard labor and good deeds.</em></p>
<p>So it is not the end of life if you canât get into IITs. Keep working and the whole world will come to know about your work.</p>
<blockquote>
<h4 id="its-not-iit-which-makes-people-successful-it-is-their-talents">Itâs not IIT which makes people successful, it is their talents.!!!</h4>
</blockquote>
<p>Few examples:
<a href="https://en.wikipedia.org/wiki/Satya_Nadella">Satya Nadella</a> (<strong>CEO of Microsoft</strong>), <a href="https://en.wikipedia.org/wiki/Shantanu_Narayen">Shantanu Narayan</a> (<strong>CEO of Adobe Systems</strong>) and many many more (to know more, please follow <a href="https://www.quora.com/Are-there-any-famous-non-IITian-engineers-from-India">this thread</a>)</p>
<p>Failures are not only in exams, but they are also spread all over the life span.</p>
<p>I would like to share one more story, which inspires me a lot. This is a story of <a href="https://en.wikipedia.org/wiki/Harrdy_Sandhu">Harrdy Sandhu</a>, he is one of the most popular singers of Punjabi songs. He started his career in cricket and played for 10 years. <a href="https://m.dailyhunt.in/news/india/english/laughingcolours+english-epaper-laughcole/birthday+special+hardy+sandhu+started+his+career+as+a+cricketer+and+is+now+a+top+punjabi+singer-newsid-96313921">He also played in under-19 team</a>. But in 2006, he had an elbow injury. He was a fast bowler and his injury was on my right arm. He tried to get treatment, but nothing happened.</p>
<p>Now, he had two options: either he can curse his injury & give up or he can move on. He had chosen the later one. He started his new career in singing and did hard work. Now, all know that he is the â1 singer in Punjabi Industry.</p>
<p><a href="https://en.wikipedia.org/wiki/Alexander_Graham_Bell">Alexander Graham Bell</a> (inventor of telephone), says</p>
<blockquote>
<h4 id="when-one-door-closes-another-door-opens-but-we-so-often-look-so-long-and-so-regretfully-upon-the-closed-door-that-we-do-not-see-the-ones-which-open-for-us">When one door closes, another door opens, but we so often look so long and so regretfully upon the closed door, that we do not see the ones which open for us.</h4>
</blockquote>
<p>IITs door is not the only door for you, and if it closed for you other doors are open for you.</p>
<p>Follow your passion, because doing something which you donât like wonât keep you motivated, and it will be hard for you to give your best in it.</p>
<p>Just keep working hard until it is done, and never think about giving up.</p>
<p><strong>A little about me</strong>: I also prepared for IIT, but was not lucky enough to get into the top 1.2%. I did my engineering from <a href="https://lnmiit.ac.in">LNM-IIT</a>. I was disappointed by the result, but I promised myself that I will not think anymore about the result. I just focussed on what to do next, instead of looking back. When I was in the first year of my graduation, I faced some issues in my college, which I realized can be solved by mobile apps. And this was the turning point, I started coding, learned Android app development, did my <a href="https://summerofcode.withgoogle.com/">Google summer of Code</a>, contributed to many open-source libraries including <a href="https://github.com/facebook/react-native">react-native by Facebook</a> and so on.</p>
<p>Recently I watched <a href="https://en.wikipedia.org/wiki/Chhichhore">Chhichhore</a> movie and got the inspiration to write this.</p>
<p>The message sought by this movie is <strong>âYou are not a Loser if you try your Best.â</strong></p>
<p>Thanks</p>vishweshThis blog is targeted for all those who feel that they are losers, believe me, you are not and you will also feel the same after reading this.Hands on with PostgreSQL transactions2020-03-12T01:07:00+00:002020-03-12T01:07:00+00:00https://jainkuniya.github.io/hands-on-with-postgresql-transactions<p><strong>Life would have been a lot easier without concurrency or parallelism</strong>.</p>
<p>Everything working sequentially. Cars moving one by one on a single lane road, no overtaking, no accidents. Sounds simple and straightforward.</p>
<p>But it is a tradeoff, because:</p>
<ul>
<li>all cars need to run at a constant speed.</li>
<li>if one stops in between, the road is chocked.</li>
<li>a limited number of cars can pass in/out at any given point of time.</li>
</ul>
<p>This is not feasible at present with current requirement where target is to increase the number of cars passing in/out (high throughput) and decrease travel time (low latency). This can be easily solved with the help of lanes.</p>
<p>Similarly in technical terms, letâs say your API takes 1s, then in 24hrs, you can only serve 86,400 (24 * 60 * 60) requests. Thus serving in sequential fasion is not an option when you are building for current generation, <a href="https://ourworldindata.org/internet">with 640,000 daily active internet users</a>.</p>
<p>So you need to handle requests concurrently/parallelly. At the server level, this can be easily achieved with the help of threads (or equivalent). But how will you handle this at the database layer?</p>
<p>This boils down to a simple money transaction problem. Which is, two API calls are initiated simultaneously, to transfer 50 bucks from A to B. Both the calls are running parallelly in different threads, both read the balance of A as 60 bucks and validates the checks and performs transaction. Eventually leading to undesired output.</p>
<p>One simple way to solve this is to queue requests and execute one by one. This will drastically impact your throughput. On a second thought, why you want to block another person from transferring money when A and B are transacting, at this same point C can transfer to D or vice versa without causing any problem.</p>
<p>So you want to execute requests concurrently/parallelly but those requests should not belong to the same person.</p>
<p>Here comes the database transactions in the picture.</p>
<p><em>Note: The scope of this blog is only limited to PostgreSQL transactions.</em></p>
<h3 id="postgresql-transactions">Postgresql transactions</h3>
<p>Basically, there can be 4 situations: <strong>dirty read</strong>, <strong>nonrepeatable read</strong>, <strong>phantom read</strong> and <strong>serialization anomaly</strong>, which can lead to data corruption:</p>
<p><img src="../assets/postgresql/transactions/transactions.png" /></p>
<p>And to handle all these 4 scenarios, there can be four types of isolation level.</p>
<p>Thanks to PostgreSQL, that it automatically takes care of <strong>Dirty Read</strong>, i.e you wonât be able to read any uncommitted change by another concurrent transaction.</p>
<p>Letâs go through each isolation level one by one.</p>
<p><strong>Note: In this whole blog, I will be taking example with the help of relation whose schema looks like this:</strong>
<br />
<img style="height:200px; display:block; margin:auto;" src="../assets/postgresql/transactions/sample_example_table_describe.png" /></p>
<h3 id="serializable-transaction">Serializable transaction</h3>
<p>This is one of the simplest isolation level. Exactly similar to what we have discussed above, cars running in a single lane.</p>
<p>Or in other words, one transaction is allowed at a time.</p>
<p><img src="../assets/postgresql/transactions/serializable_postgresql_transaction.png" /></p>
<p>As you can see, the later (right side) transaction is waiting for the first (left side) transaction to either <strong>commit</strong> or <strong>rollback</strong>.</p>
<ul>
<li>Letâs see what happens if we commit left-hand side transaction, then right-hand one failed with the error:</li>
</ul>
<blockquote>
<p>ERROR: could not serialize access due to concurrent update</p>
</blockquote>
<p><img src="../assets/postgresql/transactions/serializable_postgresql_commit_transaction.png" /></p>
<ul>
<li>But if we <strong>rollback</strong> left-hand side transaction, then the right one is able to commit.</li>
</ul>
<p><img src="../assets/postgresql/transactions/serializable_postgresql_rollback_transaction.png" /></p>
<p>In the above two cases, we were trying to update the same tuple. Now letâs try to update different tuples in different <strong>Serializable transactions</strong>.</p>
<p><img src="../assets/postgresql/transactions/serializable_postgresql_different_tuples_transaction.png" /></p>
<p>Although we were able to update different tuples in two different transactions but were not able to commit both the transactions.</p>
<p><strong>Conclusion: as the name implies, only one transaction at a time. The parallel transaction will not be able to commit</strong>.</p>
<h3 id="read-committed-transaction">Read committed transaction</h3>
<p><strong>Read Committed</strong> is a default isolation level in PostgreSQL. This gives assurance that you will never read any uncommitted change from another transaction.</p>
<p>Letâs take an example</p>
<!-- <img src="../assets/postgresql/transactions/read_committed_postgresql_transaction.png" />
In this case, changes done in the first transaction is not visible to other transaction. Thus no chance of **dirty read**. -->
<p><img src="../assets/postgresql/transactions/read_committed_postgresql_transaction.png" />
<img src="../assets/postgresql/transactions/read_committed_postgresql_transaction.png" /></p>
<p>In both the above cases, changes made in a transaction are only visible within the transaction until they are committed. Thus no chance of <strong>dirty read</strong>.</p>
<p>Now letâs try to update the same tuple in two different transactions.</p>
<p><img src="../assets/postgresql/transactions/read_committed_postgresql_update_same_tuple_transaction.png" /></p>
<p>Have you observed that all the later updates are waiting for the first one to complete, either <strong>commit</strong> or <strong>rollback</strong>.</p>
<ul>
<li>Letâs say we commit the first transaction:</li>
</ul>
<p><img src="../assets/postgresql/transactions/read_committed_postgresql_update_same_tuple_transaction_committed.png" /></p>
<p>The second transaction failed with an error:</p>
<blockquote>
<p>ERROR: could not serialize access due to concurrent update</p>
</blockquote>
<p>but the updated value id <strong>3033</strong> that means query without any transaction got excecuted and had overridden the first transaction update.</p>
<p>In such cases using delta update will help, just tweak your query to:</p>
<blockquote>
<p>update test set count = count + 3033 where id = 4;</p>
</blockquote>
<p>So that, changes are not overridden.</p>
<ul>
<li>Now letâs see what will happens if we rollback the first transaction:</li>
</ul>
<p><img src="../assets/postgresql/transactions/read_committed_postgresql_update_same_tuple_transaction_rollback.png" /></p>
<p>After rolling back the first transaction, the next one i.e second one got executed. Still, the 3rd one is pending. As it is without any transaction, after completion (either <strong>commit</strong> or <strong>rollback</strong>) of the second transaction it will anyhow execute.</p>
<p><strong>Note: Here quires are executed in first-in, first-out (FIFO) fashion</strong></p>
<p>Not letâs try to update different tuples in different transactions.</p>
<p><img src="../assets/postgresql/transactions/read_committed_postgresql_update_different_tuple_transaction.png" /></p>
<p>Oh, all updates are successful.</p>
<p><strong>Conclusion:</strong></p>
<ul>
<li><strong>It takes a lock on a tuple, so that no other transaction will be able to update on it.</strong></li>
<li><strong>Changes done in a transaction are only visible within the transaction until committed.</strong></li>
</ul>
<h3 id="repeatable-read-transaction">Repeatable read transaction</h3>
<p>It is more strict then <strong>Read committed</strong>. In addition to all that <strong>Read committed</strong> offers, <strong>Repeatable read</strong> also offers you guarantee what, whatever you have read will not change for that transaction.</p>
<p><img src="../assets/postgresql/transactions/repeatable_read_postgresql_transaction.png" /></p>
<p>As you can see in the above example, the output of <code class="language-plaintext highlighter-rouge">select</code> quires are constant even after data is changed.</p>
<p>But when you try to update on outdated data, then it throws an error</p>
<blockquote>
<p>ERROR: could not serialize access due to concurrent update</p>
</blockquote>
<p><img src="../assets/postgresql/transactions/repeatable_read_update_postgresql_transaction.png" /></p>
<p><strong>Conclusion:</strong></p>
<ul>
<li><strong>Whatever is read, will always be same within the transaction scope.</strong></li>
<li><strong>But update operations will not work if changes are made on top of it.</strong></li>
</ul>
<hr />
<p>This was all about <strong>handling transactions in postgresql</strong>. Thanks for reading. Hoping to write more blogs on <strong>Hands on</strong> series.</p>
<p><em>Note: In this blog concurrency and parallelism are used interchangeably, though both are different. The aim is just to differentiate it from sequential.</em></p>
<p>Huge thanks to <a href="https://twitter.com/ronakjc">@ronakjc</a> for pairing with me on this!</p>vishweshLife would have been a lot easier without concurrency or parallelism.Prepare for Mount Batur trek, Bali2020-01-19T02:04:00+00:002020-01-19T02:04:00+00:00https://jainkuniya.github.io/prepare-for-mount-batur-trek-bali<p>On my last trip to Bali, I went to <strong>Mount Batur Sunrise Trek</strong>. In this blog post, I am going to tell you all the details you need to know for the trek.</p>
<p><strong>Mount batur</strong> is situated in the North-East part of Bali, in <a href="https://www.google.com/maps/place/Kintamani,+Bangli+Regency,+Bali,+Indonesia/@-8.2499984,115.2749539,12z/data=!3m1!4b1!4m5!3m4!1s0x2dd1f46fa4effc21:0x4030bfbca7d2c20!8m2!3d-8.2573896!4d115.3548713">Kintamani</a> village. There are multiple points to start the trek. The most famous one is the sunrise trek. It is around ~81KM from <a href="https://www.google.com/maps/dir/Ngurah+Rai+International+Airport+(DPS),+Jalan+Raya+Gusti+Ngurah+Rai,+Tuban,+Badung+Regency,+Bali,+Indonesia/Mount+Batur+Sunrise+Trekking+Starting+Point,+Jl.+Bukit+Mekar+Sari,+Songan+A,+Kintamani,+Bangli+Regency,+Bali+80652,+Indonesia/@-8.4937193,115.142884,11z/data=!3m1!4b1!4m13!4m12!1m5!1m1!1s0x2dd2441650216933:0xdf71da6ddd7bcc1f!2m2!1d115.166787!2d-8.7467172!1m5!1m1!1s0x2dd24733aef83e13:0x1d61e0b3949f653d!2m2!1d115.3944304!2d-8.2408772">Ngurah Rai International Airport (Bali airport)</a>.</p>
<p>There are many tour packages which offer this trek, they will pick you up from your hotels at around 2-3 AM, followed by trek, breakfast at the top and again back to the hotel in the afternoon. They also provide a guide that will take care of you on the way.</p>
<p><strong>What did we do?</strong> We landed at <a href="https://www.google.com/maps/place/Ngurah+Rai+International+Airport/@-8.7467172,115.1645983,17z/data=!3m1!4b1!4m5!3m4!1s0x2dd2441650216933:0xdf71da6ddd7bcc1f!8m2!3d-8.7467172!4d115.166787">Bali airport</a> at 02:10 AM, then took the cab to the <a href="https://www.google.com/maps/place/Mount+Batur+Sunrise+Trekking+Starting+Point/@-8.2408772,115.3922417,17z/data=!3m1!4b1!4m5!3m4!1s0x2dd24733aef83e13:0x1d61e0b3949f653d!8m2!3d-8.2408772!4d115.3944304">starting point</a>. It was a ~2 hr drive. You can easily get <a href="https://www.gojek.com/">GoJek</a> or <a href="https://www.grab.com/sg/">Grab</a> or local Taxi. I would suggest you to either take GoJek or Grab because local Taxi will ask for more money ad being foreigner, and you will have to negotiate. Also, you will not be familiar with the local language. GoJek/Grab will charge you around ~450.000 IDR.</p>
<p>On the way, there was some guy who was collecting 30,000 IDR per person on the way to the starting point. This was a few kilometers away from the point. Nobody checked this ticket, you can avoid this.</p>
<p>After reaching the point, we asked Cab driver to talk to a local residence for a guide. He asked for 700.000 IDR. This was the way to high and might contain his commission as well. So we refused and found a girl who agreed in 250.000 IDR.</p>
<p>It was around 3:40 AM, and we started the trek. It was full moon night so the path was visible. The torch was provided by the guide, which helped a lot on the way. The way is almost straight, only a few divergences.</p>
<p>There are few shops on the way, for water bottles/cold drinks. But the price is more than 2x (around ~70.000 IDR), it gets on the increase as you move forward.</p>
<p>We took some Apples, and eat it while trekking. I advise you to take some fruit with you.</p>
<p>We keep on moving forward, there were people from all over the world trekking with us. I meet some people from Korea, Mauritius.</p>
<p>The point where the car drops you, at the starting point of the trek is already at some height. There is a village down. So after a few minutes of trek, you can get some views like</p>
<p><img src="../assets/mount-batur/mount-batur-start.jpg" /></p>
<p>The way was not so steep, it is easy to moderate level. There is also a bike service which takes around 1000.000IDR to 2000.000IDR, totally depends on your negotiation. If you are taking a bike service, please make sure to hold your hands tight with the rider. If you fell, you will get hurt hardly.</p>
<p>It was around 05:30 AM, and the sun started rising. The view was like this</p>
<p><img src="../assets/mount-batur/mount-batur-on-the-way.jpg" /></p>
<p>On following the path with fellow trekkers, you will finally reach a point where the bike services stop. From this point, the way is steep, full of rocks.</p>
<p><img style="height:600px; display:block; margin:auto;" src="../assets/mount-batur/mount-batur-rocks.jpg" /></p>
<p>It will take around 15-20 mins from this point to reach the top of Mount Batur.</p>
<p>We were fortunate we reach at the top by the time sunrise. The winds were mind-blowing. And the view was superb â¤ď¸.</p>
<p><img src="../assets/mount-batur/mount-batur-sunrise.jpg" /></p>
<p>There are few more hilltops nearby if you wish you can take some more time and visit them as well.</p>
<p><img src="../assets/mount-batur/mount-batur-near-by-hills.jpg" /></p>
<p>This is the village I was talking about, whose light looks fabulous while going up.</p>
<p><img src="../assets/mount-batur/mount-batur-view-from-top.jpg" /></p>
<p>It was around 07:00 AM we started to go down back. It was easy to run, as you just need to maintain body balance.</p>
<p>Now the interesting part kicks in, as we are close to reaching bottom base. Our guide asked for her fee which was 250.000IDR. We gave it.</p>
<p>We were late while coming back, the sun was all most top at 09:00 AM.</p>
<p>After reaching base camp, there was nobody except a few local guys. And no cabs/transport service to catch the highway. There was a person and a car, whose tire was broken. This person kept on saying wait for a few minutes, the car driver is coming. As while starting the trek, we told our GoJek driver not to wait so he went. Now we were left with no option.</p>
<p>For a few minutes, we waited for the driver, then found some suspicious activity from this guy. He kept on calling a number on his phone. So we decided to walk with the help of directions in Google Maps. First, this guy was not allowing us to leave. But we kept on insisting that we will manage. And then this started asking for the trek fee around 700.000IDR by showing fake tickets. We refused it. Also at this point, our lady guide was not accepting that she has received money from us. They were having some conversation in the local language.</p>
<p>We decided to walk, there were no proper roads. I remembered the way while coming, so it was easy but the problem was you need to walk in an unknown place. Most people there donât know English. While walking we got one farmer, who can only understand âhighway, he took us to the main road. Then we saw a board of the cab service. While talking to the cab driver, one man came and started asking for money. This was the same man to whom we have refused for a guide while going up. As we have taken the cab, so the cab driver helped us from this guy and saved our money. Otherwise, we would have paid additional money.</p>
<p>This main road also had a way to start the trek, so you donât need to go interior in the village as we did.</p>
<p><strong>If you are planning to go there, be cautious. Donât give money without proper investigation, if someone asks for some fee or something else.</strong></p>
<p>The overall experience was very good. If you love trekking, then this trek is for you. It is of moderate difficulty, I would suggest it for beginners as well.</p>
<p><img src="../assets/mount-batur/mount-batur-top-view.jpg" /></p>
<p>Then we went to a few more places, like <a href="https://www.google.com/search?sxsrf=ACYBGNR70ODK3wr5_fV0bcwwCsmp3ElvFg%3A1580583817263&ei=ics1XsHmD_qe4-EP87WjsAQ&q=handara+gate+bali&oq=handara+gate+bali&gs_l=psy-ab.3..0j0i7i30l3j0j0i7i30j0l4.4802.5722..5956...0.3..0.150.973.0j7......0....1..gws-wiz.......0i71j0i7i10i30.1tnOzEtQthg&ved=0ahUKEwiBz9zHhbHnAhV6zzgGHfPaCEYQ4dUDCAs&uact=5#">Bali Handara Gate</a>. I will write another blog post in this series to share my first Bali trip.</p>
<p>Till then have a good time.</p>
<hr />
<p><strong>Disclaimer:</strong></p>
<ul>
<li>All photos captured from <a href="https://www.oneplus.in/6">One Plus six</a> and <a href="https://gopro.com/en/in/shop/cameras/hero8-black/CHDHX-801-master.html">GoPro 8</a></li>
</ul>vishweshOn my last trip to Bali, I went to Mount Batur Sunrise Trek. In this blog post, I am going to tell you all the details you need to know for the trek.git bisect - the saviour2019-04-15T02:04:00+00:002019-04-15T02:04:00+00:00https://jainkuniya.github.io/git-bisect-the-saviour-<p>Hey! today I am going to talk about one of my favorite git command i.e <code class="language-plaintext highlighter-rouge">git bisect</code>.</p>
<p><em>At present, <a href="https://git-scm.com/">Git</a> is the most widely used distributed version control system. With the help of <code class="language-plaintext highlighter-rouge">git</code>, one can easily collaborate his work easily with others. Read more about <code class="language-plaintext highlighter-rouge">git</code> in my <a href="https://jainkuniya.github.io/i-introduction-to-git/">another post</a></em></p>
<p>So letâs start with the problem:</p>
<p>Letâs say you are working in a large code base with tons of people working on the same project, lots of commits per day. Imagine you went for a week long vacations. After coming back, you find that the product has some issues which was working totally fine when you left. Itâs a huge codebase and you arenât aware of which module is responsible for this wrong behavior. What will you do in that case??</p>
<ul>
<li>
<p><strong>Option - 1</strong>
Call a meeting of all the contributors and ask who introduced this?
There can be cases where this behavior is caused by two changes of multiple commits from different people (whose individually change was working fine).
Also calling out a meeting is time-consuming and might waste the time of whole team.</p>
</li>
<li>
<p><strong>Option - 2</strong>
You already are managing commit history, then why donât you check each and every commit and find the root cause.
But what if there are hundreds of commits in between, checking each and every commit will be really hard, boring and again time-consuming.</p>
</li>
<li>
<p><strong>Option - 3</strong>
Use the binary search on commits <em>(Yup! the same searching algorithm which you studied at high school đ )</em>
Here <code class="language-plaintext highlighter-rouge">git bisect</code> comes into the picture. Yes! it can help you to find a specific commit which introduced this behavior by iterating commits in binary search manner. So now you only have to check only <code class="language-plaintext highlighter-rouge">Log(N)</code> commits instead of <code class="language-plaintext highlighter-rouge">N</code> commits (as described in option - 2).</p>
</li>
</ul>
<p>So your next question will be how to use it:</p>
<ul>
<li>Keep ready the commit <code class="language-plaintext highlighter-rouge">SHA</code> on which
<ul>
<li>it was fine, letâs call it <code class="language-plaintext highlighter-rouge">good</code></li>
<li>it is not behaving correctly, letâs call it as <code class="language-plaintext highlighter-rouge">bad</code>
(in the worst case they can be <code class="language-plaintext highlighter-rouge">start</code> and <code class="language-plaintext highlighter-rouge">end</code> commits of the whole project, respectively)</li>
</ul>
</li>
</ul>
<p>Just remember 3 things:</p>
<ul>
<li><code class="language-plaintext highlighter-rouge">git bisect start GOOD BAD</code>, where <code class="language-plaintext highlighter-rouge">GOOD</code>, <code class="language-plaintext highlighter-rouge">BAD</code> are the reference to the <code class="language-plaintext highlighter-rouge">good</code> and <code class="language-plaintext highlighter-rouge">bad</code> commit respectively (or just <code class="language-plaintext highlighter-rouge">git bisect</code>)</li>
<li>Check behavior, if it is <code class="language-plaintext highlighter-rouge">good</code>
<ul>
<li>Enter <code class="language-plaintext highlighter-rouge">git bisect good</code></li>
<li>else, Enter <code class="language-plaintext highlighter-rouge">git bisect bad</code></li>
</ul>
<p>repeat the above command till you find <code class="language-plaintext highlighter-rouge">SHA</code> of first <code class="language-plaintext highlighter-rouge">bad</code> commit in the terminal like this</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>< ... sha ... > is the first bad commit
</code></pre></div> </div>
</li>
<li>Use <code class="language-plaintext highlighter-rouge">git bisect reset</code> to reset and get back to the original state from where you started via <code class="language-plaintext highlighter-rouge">git bisect start</code>.</li>
</ul>
<p>In the meantime, you can also get the logs of the binary search you are performing with the help of:</p>
<div class="language-plaintext highlighter-rouge"><div class="highlight"><pre class="highlight"><code>git bisect log
</code></pre></div></div>
<p>And yay! without making many efforts you have found out the commit which caused this behavior. It can also be used to find an issue of the bug or to find the fix of bug.</p>
<p>Read more it at https://git-scm.com/docs/git-bisect</p>
<p>I love fixing the bugs and found <code class="language-plaintext highlighter-rouge">git bisect</code> really helpful to find the commit which introduced the bug.</p>
<p>Hoping you will also like it đ</p>
<p>Thanks</p>
<p><em>Keep Building & Debugging</em></p>vishweshHey! today I am going to talk about one of my favorite git command i.e git bisect.How to generate PDF resume from latex on github page?2019-02-16T22:50:00+00:002019-02-16T22:50:00+00:00https://jainkuniya.github.io/how-to-generate-pdf-resume-from-latex-on-github-page<p><em>Everyone learn new stuff daily, achieve something new every day, builds new innovative projects now and then and definitely wants to mention them in their resume.</em></p>
<p>But with current tools, the process of updating resume is too time-consuming and most of us avoid until we are looking for a new job đ. And this experience is even worse for those who maintain resume in latex.
Either setup tex environment locally (<a href="http://www.tug.org/mactex/">3gb MacTex for Mac</a>) or use third party online sites.</p>
<p>I am also the one who prefers latex resume. So for every single small change, I have to either rely on online sites like <a href="https://www.sharelatex.com/">Sharelatex</a>. Update <code class="language-plaintext highlighter-rouge">Tex</code> file there, download code and generated pdf and then upload back to <a href="https://jainkuniya.github.io">my GitHub page repo</a>. Another option for me was to set up <a href="http://www.tug.org/mactex/">MacTex</a> locally. But having 128GB Mac, I canât manage to devote 3gb to this.</p>
<p>So to make this process seamless, I have developed <a href="https://botlatexx.github.io/">BotLatexx</a>.
With this no extra work needs to be done in order to maintain an updated copy of your resume on GitHub pages, just make changes on <code class="language-plaintext highlighter-rouge">Tex</code> file locally and push it to GitHub repo. <a href="https://botlatexx.github.io/">BotLatexx</a> will take care of everything for you.</p>
<p><em>Watch the demo on Youtube, how I updated app downloads count to <code class="language-plaintext highlighter-rouge">40k+</code> in my resume which is hosted on GitHub pages in less than a minute:</em>
https://www.youtube.com/watch?v=P_5-_v2ttiU</p>
<p><strong>How it works</strong></p>
<p>In simple words, it builds your latex project on the cloud and returns your generated PDF.</p>
<p>Here is the user flow:</p>
<ul>
<li>You edit your <code class="language-plaintext highlighter-rouge">Tex</code> file locally.</li>
<li>Push your code to GitHub repo.</li>
<li>Check your resume URL, it will consist of your changes. Itâs MAGIC, itâs MAGIC</li>
</ul>
<p><img border="0" align="center" src="/assets/images/its-magic-its-magic.gif" /></p>
<p><strong>Behind the scenes</strong></p>
<p>Here is what <a href="https://botlatexx.github.io/">BotLatexx</a> will do for you:</p>
<ul>
<li>As soon as you push code to GitHub, <a href="https://botlatexx.github.io/">BotLatexx</a> will clone it.</li>
<li>Configure your fonts and <code class="language-plaintext highlighter-rouge">.cls</code> files to the build system.</li>
<li>Build your <code class="language-plaintext highlighter-rouge">Latex</code> project.</li>
<li>Push back generated <code class="language-plaintext highlighter-rouge">PDF</code> file to your repo.</li>
</ul>
<p><strong>Learnings</strong></p>
<ul>
<li>How to handle GitHub webhooks</li>
<li>Ignore bogus call to the handler from fake webhooks</li>
<li>Schedule task on the server</li>
<li>Run tasks in parallel</li>
<li>Write scripts to perform <code class="language-plaintext highlighter-rouge">git</code> commands</li>
<li>Auto retry on failure</li>
<li>etc etc</li>
</ul>
<p><em>Watch the demo on Youtube, how I updated app download count to <code class="language-plaintext highlighter-rouge">40k+</code> in my resume which is hosted on GitHub pages in less than a minute:</em>
https://www.youtube.com/watch?v=P_5-_v2ttiU</p>
<p><strong>Conclusion</strong></p>
<p><em>âPerforming same steps again and again, is the work of bots, letâs not snact work from them đ.â</em></p>vishweshEveryone learn new stuff daily, achieve something new every day, builds new innovative projects now and then and definitely wants to mention them in their resume.How College Plus backend got automated?2019-02-08T23:44:00+00:002019-02-08T23:44:00+00:00https://jainkuniya.github.io/how-college-plus-backend-got-automated<p><em>Everyone of us remember our firsts, the first success, first failure, first medal, first trek. I know where are you going now, hold on! Today Iâm going to talk about my first project in my development journey.</em> <a href="/project-college-plus/">College Plus</a>. đ I learned Android development while working on it.</p>
<p><em>Watch the demo on Youtube:</em>
https://www.youtube.com/watch?v=SlszrEz5KJg</p>
<p>College Plus Android app provides information about mess menu, lecture schedule, bus time table etc to college students.</p>
<p>Here is the link if you want to explore or use it:</p>
<p><a href="http://bit.ly/college-plus" target="_blank">
<img width="180" height="70" border="0" align="center" src="/assets/images/play-store.png" />
</a></p>
<p>Following were the challenges I faced while developing College Plus:</p>
<p><strong>Challenge 1</strong></p>
<p>I knew that mess menu, lecture schedule will change from time to time. And it will become too hard to maintain an app with updated on play store. So keeping this in mind, a dedicated server was deployed which is called by app n order to fetch the latest data. And ya it worked. I was very happy to see that the app which I developed in my first year got adopted by the majority of the college đ.</p>
<p><strong>Challenge 2</strong></p>
<p>After a few days, I realized that it is taking a long time to manually update data from PDF (which are shared by college authorities) to an externally hosted database. Mess menu usually get changed every two months, the lecture schedule gets changed every semester i.e 4 months. Sometimes it was taking ~12 hrs to manually update hundreds of entries in the database. Data entry is one of the most boring work and nobody was volunteering to do it.</p>
<p>I talked to a few people to solve this, all suggested to create a portal for admin and ask college authorities to directly update in the database. But this was again a lot of coding work and most importantly coordinate with appropriate authorities.</p>
<p>One fine day, a thought came to my mind why shouldnât we automate this process.
I mean letâs write a script which converts PDF to <code class="language-plaintext highlighter-rouge">JSON</code> and then pushes it to the database.</p>
<p>And the next day of this, College Plus was again back to work đ .</p>
<p><strong>Here is how the whole process got executed</strong></p>
<ul>
<li>Migrated old PHP server to Python, Django.</li>
<li>Created a sample HTML page to upload PDF files.</li>
</ul>
<p>The main challenge for me was to convert PDF to <code class="language-plaintext highlighter-rouge">JSON</code> which is a memory consuming task on a free server resource available to me đ.</p>
<p>So</p>
<ul>
<li>HTML page sends an upload file request to the server.</li>
<li>Server saves file.</li>
<li>Create a new task to process each file and add it to the queue.</li>
<li>Return response to the upload request.</li>
</ul>
<p>And now the real work:</p>
<ul>
<li>For each task server does pre-process of each file i.e
<ul>
<li>Split PDF into multiple files each having 1 or 2 pages each.</li>
<li>Remove unwanted stuff, so that size reduces.</li>
</ul>
</li>
<li>Get <code class="language-plaintext highlighter-rouge">JSON</code> data from the PDF file.</li>
<li>Clean up data.</li>
<li>Push this data to the database.</li>
<li>Notify app users.</li>
</ul>
<p><strong>System Design</strong></p>
<p><a href="https://www.youtube.com/watch?v=SlszrEz5KJg" target="_blank">
<img border="0" align="center" src="/assets/images/college-plus-backend-system-design.png" />
</a></p>
<p>Files are uploaded via a web portal. The system verifies that files are uploaded by authenticated users. Then preprocess file by splitting the file into multiple files for fast parallel processing and add the task into the queue. Now the different thread which is running in background founds that there is a new task to execute, it picks up and gets <code class="language-plaintext highlighter-rouge">JSON</code> from PDF. Now the system removes the noises from the <code class="language-plaintext highlighter-rouge">JSON</code> data and pushes to the database.</p>
<p>Now to scale this system, background worker instances are increased to handle multiple requests.</p>
<p><em>Watch the demo on Youtube:</em>
https://www.youtube.com/watch?v=SlszrEz5KJg</p>
<p><strong>Learnings</strong></p>
<ul>
<li>Initiate the background process.</li>
<li>Manage multiple threads.</li>
<li>Handle queue data structure.</li>
<li>Handle PDF -> <code class="language-plaintext highlighter-rouge">JSON</code> conversion gracefully and retry on failure.</li>
<li>etc etc</li>
</ul>
<p><strong>Conclusion</strong></p>
<p><em>âNever think that it is of no use, everything has its own importance, just wait for right time.â</em></p>vishweshEveryone of us remember our firsts, the first success, first failure, first medal, first trek. I know where are you going now, hold on! Today Iâm going to talk about my first project in my development journey. College Plus. đ I learned Android development while working on it.My Interview Exprience with Go-Jek2018-08-20T13:51:00+00:002018-08-20T13:51:00+00:00https://jainkuniya.github.io/my-interview-exprience-with-go-jek<p>Letâs start the journey from the beginning đ .</p>
<p>I was in Bangalore, doing my summer intern with <a href="https://goibibo.com">Goibibo</a>, working on some really exciting <a href="https://github.com/facebook/react-native">facebook/react-native</a> projects. Eventually, summers ended, which also ended the internship which Iâm going to remember always, and I was again back to college. But who knew that another surprise was waiting for me. After reaching to college, I came to know that <a href="https://www.go-jek.com/">Go-Jek</a> was coming to our college, <a href="https://lnmiit.ac.in">LNMIIT</a> for hiring FTE (Full Time Employees). And here we go with my interview experience.</p>
<p><strong>Note:</strong> This opportunity was only open for those, who have made at least a single contribution to any of the open source project.
So first round was resume shortlisting. After going through tons of resume, Go-Jek has shortlisted 9 students for next round (for FTE role).</p>
<p>The placement drive was conducted in two days.</p>
<p>On the first day, we had a pre-placement talk, where we came to know about the company, itâs culture, itâs technology, products and much more. They also explained, how the hiring process will be going to take place. First, we were going to have a code pairing round and then face to face technicals interviews. We were asked to bring our own laptops with any preferred IDE installed in it and make sure that the <code class="language-plaintext highlighter-rouge">hello world</code> program is compiling & running properly.</p>
<p>This talk helped us to gain the momentum of the drive.</p>
<p><strong>Tips:</strong></p>
<ul>
<li>Go through the companyâs blog and site before attending such pre-placements talks.</li>
<li>Freely ask your doubts, but donât ask silly questions just for the sake of asking.</li>
</ul>
<p>Now letâs move further.</p>
<h3 id="code-pairing-round">Code pairing round</h3>
<p>It was a 2 hour long online round, in which each of us was given the same program and was asked to program it in the language of our choice. We were paired with mentors (persons that had come for the drive). So in case, we have any doubt we can ask them, we can also share our approach with them and get feedback.</p>
<p><strong>About the problem:</strong> We were asked to implement a card game (similar to <a href="https://en.wikipedia.org/wiki/Blackjack">Blackjack</a>). All the instructions for the game were clearly mentioned in the question. We need to play the game between a player and the dealer with taking input from the user (from the command line) for playerâs turn.</p>
<p><strong>My solution:</strong> I have implemented this in JAVA. I have created 4 classes, one for Person, one for Card, one for Deck and one main class. <a href="http://bit.ly/lnmgjhc">Here</a> is my solution.</p>
<p>After 1 hour we had a small evaluation and a final evaluation took placed at the end, i.e after 2 hours.</p>
<p><strong>Tips:</strong></p>
<ul>
<li>Write testable, maintainable and modular code.</li>
<li>Itâs better to follow Object Oriented Principles.</li>
<li>Write tests.<br />
If you get time, itâs always better to write unit tests for such problems. But ya, I would suggest you to first complete the implementation and then jump to tests.
But in case if you are quite confident about your approach and time, then write tests parallelly. Or even start writing tests as soon as you are ready with partial implementation, so that you can tackle all edge cases.</li>
</ul>
<p><em>Just after the final evaluation, Go-Jek T-shirts were distributed to all the participants.</em>đ</p>
<p>About half an hour later results of the online round were mailed to us. Only 2 students were selected for further rounds. And guess what, I was one of them â.</p>
<h3 id="face-to-face-interview">Face to face Interview</h3>
<p>Now I have to appear for F2F (Face to Face) interview in next 10 mins đ . I rushed to the stationary shop to take print out of my GSoC certificate. I was getting late so I asked my friend to collect it and bring it to the guest house (the place where the drive was taking place) and I rushed back to the guest house.</p>
<p>My interview was scheduled first, I was quite nervous. This was my first F2F interview.</p>
<p>I entered the interview room, there were 2 interviewers in the panel. The interview started with my introduction. I am mostly from JS background and have done projects on React and React-Native. Interview started with React and React-Native. How do things work in React and React-Native? How does the JS code execute on the mobile phone (Android & iOS)? And then we moved to <code class="language-plaintext highlighter-rouge">PureComponents</code> & <code class="language-plaintext highlighter-rouge">Pure Functions</code>.</p>
<p>As I had implemented the problem of the online round in JAVA, I was asked how JAVA works, how the code compiles. Role and advantages of JVM and then we had some discussion on JAVA and JVM.</p>
<p>Next, I was asked to implement few features of StackOverflow from backend/restful API perspective. Feature like:</p>
<ul>
<li>posting a question.</li>
<li>listing a question and getting question info & displaying it.</li>
</ul>
<p>Basically how the backend server will be designed to implement this features.</p>
<p>Also in the middle, I was asked to tell my biggest achievement. <strong>I answered:</strong> My biggest achievement was when my code in <a href="https://github.com/facebook/react-native">facebook/react-native</a> got merged đ .
Another question was, for what I felt really happy that I have done some really great work. <strong>I answered:</strong> When, I along with my mentor, found <a href="https://github.com/zulip/zulip-mobile/commit/0d16b604bb1caf39a74797349138cd0ff6bbece9">this</a> hack. I explained what was our requirement and philosophy behind this along with the hack.</p>
<p>Then interview continued with some general questions, how I learn new technologies. I explained by taking an example of how I learned Android Development (because I wanted to develop <a href="https://jainkuniya.github.io/project-college-plus/">College Plus</a>) and Chrome Extension (because I wanted to develop <a href="https://jainkuniya.github.io/tafy-find-best-time-to-leave/">Tafy</a>).</p>
<p>I was asked my favorite subject, I said <code class="language-plaintext highlighter-rouge">OS</code>, operating systems. Then they asked me questions on the process, thread, multiprocessing, concurrency, parallelism, deadlock etc. I answered most of them đ .</p>
<p>And then we had a DSA round, in which I was asked questions like <strong>Maximum distance between two occurrences of the same element in array</strong>. I solved this problem using HashMap in O(n) time complexity.</p>
<p>Then we talked a bit about work culture @ Go-Jek.</p>
<p>And then the interview ended.</p>
<p>I was hungry from the morning, so I rushed to hostel room and then to mess, and again back to guest house. When I reached back, the interview of the second person was still going on. After some time he came out.</p>
<p>And then after some time HR called me out and told the good news đ.</p>
<p>And yay! I got selected â.</p>
<p>They have also come for hiring summer interns and got selected 2 from my junior batch. The process of selecting intern was also structured similarly.</p>
<p>It was a great experience participating in such an interactive and practical based hiring process :heart:.</p>
<p><strong>Some tips:</strong></p>
<ul>
<li>Donât do things just for the sake of doing. Have a good knowledge of what you are doing.</li>
<li>Never compare yourself with others and feel nervous/demotivated, they might be good in fields in which they are getting success. And you might be perfect in another field. Just you need to find your domain of interest and rest all will come automatically.</li>
<li>Every interview is different. So donât get nervous, if you donât know the answers to questions asked to your fellow companion.</li>
<li>Have confidence in you. And for some questions if you donât know the answer, just be honest and tell sorry sir, I am not aware of it. Instead of telling some unrelated stuff.</li>
<li>Donât get nervous, even if your interview is scheduled first. Think it as an opportunity of creating the first impression and setting up the baseline in the panelâs mind.</li>
<li><del>Try</del> <strong>Do</strong> your best.</li>
</ul>
<p>Thanks for coming here and good luck for your interview. đ</p>
<p>Bye Bye!! đ</p>vishweshLetâs start the journey from the beginning đ .Tafy - Find best time to leave.2018-06-16T16:40:00+00:002018-06-16T16:40:00+00:00https://jainkuniya.github.io/project-tafy<p><a href="http://bit.ly/tafy"><strong>Tafy</strong></a> - Magical chrome extension which helps in finding best time to leave for the destination.</p>
<hr />
<p><a href="http://bit.ly/tafy" target="_blank" align="center">
<img style="display: block; margin-left: auto; margin-right: auto;" width="122.5" height="84" border="0" src="/assets/images/chromewebstore.png" />
</a></p>
<hr />
<h2 id="key-features">Key Features</h2>
<h3 id="v70">v7.0</h3>
<ul>
<li>Easy to setup.</li>
<li>Fully customizable.</li>
<li>Get notified when travel time drops to your required time.</li>
<li>Set your own custom text to be voiced in the notification.</li>
<li>Add as many routes you want.</li>
<li>Get travel time via all possible routes.</li>
<li>Easy on/off buttons.</li>
<li>Set your travel mode.</li>
<li>Adjustable Refresh rate.</li>
</ul>
<hr />
<h2 id="developers-note">Developerâs note</h2>
<p>Recently I moved to Banglore for my summer internship at Goibibo, where I witnessed the world famous traffic and people investing average half an hour on a daily basis by refreshing maps to find out best time to leave for their destination hence I decided to develop this chrome extension which eases this for you.</p>
<p>For more info find my blog on <a href="https://jainkuniya.github.io/tafy-find-best-time-to-leave/">Tafy</a>;</p>
<hr />vishweshTafy - Magical chrome extension which helps in finding best time to leave for the destination.