Skip to main content

Posts

The first half of 2017 in review

Hi people, Half the year is over and i think its good to list out things, so that i have an idea as to how i am doing with my studies ( and pretty much everything else ). It's been a wonderful and fulfilling half year, to be honest. I did a lot of things I always wanted to do.  I started experimenting with hydroponics - haven't really progressed much, but I am sure I will do something substantial in the other half of the year. Benefits are a lot over traditional way, and the joy of watching your plants grow are invaluable, at the least. I read a few books on history. I have always wanted to do this , but I always had an excuse or 2 to avoid it. I finally started, and it's brought me a sense of childlike wonder, something I sorely missed. I cleaned my home! That's 20 years of procrastination right there! It was insane but I got it done. Whew! And wow!  At the beginning of the year, i finished my re-study of the CS subjects. Post February, i opened th...

Markov chain in JavaScript

I made a small Markov Chain joke generator during my coffee break sometime last week. This is in continuation to the last post, where we did a similar thing. I did this specifically to see how well it could be extended in a language which I have typically not used before for ML/NLP. Let me run you guys through it. First of all, the Markhov Chains need a bunch of data to tell it how exactly you want your sentences constructed. str_arr=[sentence1, sentence2,...] Next, we create a dictionary of all trigrams present across the sentences. To do this, we use all bigrams as keys, and the succeeding word as the corresponding values. The key-value pairs thus form a trigram. As an example, consider the sentence : “The man had a dog.” The dictionary for this sentence will have : [ {[The, man] : [had]}, {[man, had] : [a]}, {[had, a] : [dog]} ] Next up, using the dictionary that we just made to create sentences. Here we provide the first two words, and let the function work...

Yo mama so geeky : generating jokes using Markov Chains

A few days back, I saw this article “ How to fake a sophisticated knowledge of Wine with Markov Chains ” on the programming subreddit. To my utter delight, the article referenced the code, along with a very detailed explanation, so I spent an hour getting it all to work. The hour taken was no fault of the original authors, it was taken because I wanted to get a good hang of XPath, which will be the topic of a later post. The program auto-generates wine reviews, by using Markov Chains to come up with a sequence of most probable trigrams. It was great fun spouting my expert-level sommelier reviews, especially considering that I can count on one hand the number of times I have actually tasted wine! The reviews were just the right amount of ambiguous with a hint of snobbishness (which, according to me, just made the whole thing perfectly more believable). While I was showing off my new-found expertise in wines, my partner in crime,  Rupsa , told me it could probably be used for ot...

Year 2016 in review and goals for 2017

Hello people, It's my 34th birthday today and I wanted to put the past year in review and where I wanted my life to go in the next year. Achievements of this year: Machine learning course by Andrew Ng ( completed ) Calculus I by Robert Ghrist ( completed ) Calculus II by Robert Ghrist ( completed ) Probability and Statistics ( 2 weeks left ) Data science - pandas ( 1 week done )  My first linear regression program Built a neural network from scratch  My first Regex. From scratch. No references. With tests. Algorithms I by Robert Sedgwick ( only audit ) Algorithms II by Robert Sedgwick ( only audit ) Also did the BE subjects for CS, all the stuff I had learned over the years. I am super happy to know that MOOCS help a lot in career advancement . Self-help books that really helped: How to win friends and influence people - Dale Carnegie   A mind for Numbers - Barbara Oakley   Altogether, a pretty good year, where le...

When you say........

......you don't believe in god, you admit there is a god to believe in This is the meme post that started this train of thought in my mind.   I have heard one of my classmates say a long time ago, if women truly believed that they were equal to men, then they would not fight for it. While I never accepted it, i didn't know how to speak against it either. but it was there, somewhere in my mind. I think i made some sense out of it, at last. This is stupidity. This is like saying 'If we Indians seriously believed that freedom was ours, we would never have had to fight for it'. The fight for independance was a fight to make the other party understand and/or accept your viewpoint. The first resonable method might be to consider the other person's viewpoint. And using that as a base point,then work, with suitable proof and arguments, raise, alter, or reconstruct their viewpoint to match ours. This method follows the logic that people can and will be fair in an...

Scared of looking in the mirror.

I just got back from lunch with a friend. she had got a post remove from a board. she stood up for someone. I, deep down, mocked her for it. what's wrong with me? why can i not applaud someone who is obviously better than me. when did i become thus, to mock greatness? she is my friend. i should applaud her, and i mock. Is this what i have become? worse than a common person, spineless, spiteful? definitely not what i want to be. I hated such people, and i have become, at last, one myself. I have begun hating greatness. I hate myself for being this way. I would not have stood up for anyone in this scenario, but loath someone who has. whatever happened to having an open mind? what happened to looking at things from other's perspective? I have taken a long time to learn that lesson, that people are right about whatever they do, from their perspective. What happened to that, understanding people's perspectives without being told explicitly? I'm in sorro...

Letting Go

Today as i was going through Hacker News , i came by a very, very interesting article. Friends Without Benefits . Somehow, i was touched by this article.  Its written by a woman about her relationship with a man she loved since she was 22, and how, finally, she could let go of it. All of us have relationships that we need to 'let go' of. Let me talk about mine. I had a friend. My best friend. I loved him like my brother. I cared about him. It hurt me when he was hurt, physically or otherwise. He was a little peculiar, but, then again, so was I. Things went great till the end of that common phase of our life. After that, we went our separate ways. We lost touch for a brief interval. We did get back in touch again. But I was always the one reaching out. Maybe i just realised it now? Maybe it just started now? Maybe it was always that way? But maybe I was seeing something that was not there? I decided to keep an account of my interactions with him. Just so that...

A word on todo lists

I have always felt that if If I remember to do things, it must be really important. But sometime, after juggling a profession, home, hobbies and still remaining sane, I think lists are the perfect companions to the improvements in our life.  Their most important use in in saving time and having order in life. When we juggle 3-4 different things and all have almost the same priority, it becomes difficult to remember things. So how do I maintain lists? One. I list things out to do in locations. Two. I list tasks under people. Why? Because it is relevant. Contexts, relevance has been almost shot out of the sky when it comes to todo lists. So I make lists by places or people, whichever would be better for me. This works perfectly. For me. Now. Before I clearly remember that striking things off the list made me feel powerful, so I used to make lists, do all the things in them one by one, and then strike then off. This could be the use of the list. Even now, if I cannot find in...

Wicktionary Bookmarklet

A bookmarklet is defined by Wictionary as "A small piece of JavaScript code stored as a URL within a bookmark". I have been using bookmarklets to make my life easier from a long time. Some that I use regularly are [Read Now] : This makes it really easy for me to read pages which are unreadable. [Google Translate] : Translates pages [Mobilise This] : Formats the page for mobile viewing by Google. [Acronym lookup] : This helps me find the meanings for abbreviations. The links in [] brackets are bookmarklets. Just drag them to your bookmark bar. I picked these up from these two pages. There is also a whole website dedicated to them bookmarklets. As a developer, what i like about bookmarklets is that they are coded in JavaScript and i can meddle with them till my heart's content, without worrying about breaking anything. However, i wanted a bookmarklet that would allow me to look up meaning of words. Wiktionary was my open dictionary of choice. They d...

Addition of lightbox to my blogger template

Since i have started regularly blogging, i have felt the need for a small subpage or popup kind of feature where i can briefly explain things that do not need a dedicated blog post and where links to external pages would be 'a bit too much'. I decided to use the lightbox effect for this. It would be the perfect solution to my problems. After a little googling, i came up with 2 amazing and simple implementations, one by Abhinay Rathore, this uses CSS and javascript, and the other is by Emanuele Feronato, which almost all css and even the minimal js is used to manipulate the css. As I am extremely lazy and also was not entirely happy with both the implementations, i decided to mix the 2 and get my own lightbox. Abhinay's solution was something i found unnecessarily complex and Emanuele's solution was not elegant enough. My own solution is midway between these two and is satisfactory for personal reasons .( Yeah, click on the link. I already found a use for my new ...

Line/Bar Graphs using Canvas in HTML5

<canvas id="tutorial1" width="350" height="200" style="border: 1px solid black;"> <script> var canvas = document.getElementById('tutorial1'); var ctx = canvas.getContext('2d'); ht = canvas.height; wt = canvas.width ; var data = {}; data.gtype = 'line'; data.title = 'hey! title goes here'; data.data = [['Q1',10],['Q2',20],['Q3',30],['Q4',40],['Q5',25]]; ctx.drawCross = function (x,y){ this.beginPath(); this.moveTo(x + 5, y + 5); this.lineTo(x - 5, y - 5); this.closePath(); this.stroke(); this.beginPath(); this.moveTo(x - 5, y + 5); this.lineTo(x + 5, y - 5); this.closePath(); this.stroke(); } ctx.fillStyle = "Red"; ctx.beginPath(); ctx.moveTo(40,10); ctx.lineTo(40,ht-40); ctx.lineTo(wt-10,ht-40); ctx.stroke(); ctx.closePath(); /* draw title*/ len = ctx.measureText (data.title); ctx.fillText(data.title, (wt -...

Array magic in JavaScript

I was trying to create a queue to collect all the element related functions to run after the elements had been created. As I was Googling, I came by this snippet . var calls = []; function executeNext(next) { if(calls.length == 0) return; var fnc = calls.pop(); fnc(); if(next) { executeNext(true); } } /*To call method chain synchronously*/ calls.push(callMe3); calls.push(callMe2); calls.push(callMe1); executeNext(true); /*To call method chain asynchronously*/ calls.push(callMe3); calls.push(function(){ callMe2(); executeNext(false); }); calls.push(function(){ callMe1(); executeNext(false); }); An array was a perfect fit with the built in push() and pop() function. I also needed something that would work the pop() till the array was empty. As Douglas Crockford says in his wonderful book ' JavaScript: the good parts ', arrays are actually (slightly disguised) objects. So one can simple add to the native methods that the array var...

Mind and Friendships

This post seems to be ( atleast in my mind ) a long one. but before i write about the topic of the blog post, i would like to describe my opinions of connected topics which will lead to the actual post. First let us look at the growth of the mind as a graph covering fixed points, each of which are a topic of knowledge. A person's mind, at the beginning of life is like a line ( connecting 2 points, hunger and mother's breast ) which comes into existence only at some points and otherwise is simply a blank. after a few months, the lines become more permanent and stressed. after some more time, as the child grows and learns and understands more things, some more points add to this. if we imagine our mind to be the space enclosed in these points, then we would have a multidimensional graph. (think a really very weirdly shaped object.). However, the " The mind, once expanded to the dimensions of larger ideas, never returns to its original size. " - Oliver Wendell...

why are friends friends?

because at a certain point people whose list of priorities intersect meet and having similar interests share everything. hence these are called friends. to break this friendship, all one has to do is introduce a priority that overshadows the others in any one of the persons involved. Sometimes more priorities need to be added. however in some rarest of rare cases, the friendship itself becomes a priority. in this case, a priority needs to be introduced which has directly strongly opposing opinions from both parties. this would cause the priority list to change dramatically, hence causing a rift between the 2 participating entities.

....wanderings of a calm mind ?

i just changed the description of my blog. i was contemplating doing so from quite some time. specifically from about the time i started my second year in MIT. There is something about this place that strangely enough, makes it home. the food is bad ( not really, but even good food tastes bad if eaten repeatedly ), the attitude of most locals is screwed up ( Most people i've met in udupi and manipal wont go the extra step to make things favorable for customers. Take it or piss off is the patented formula here ) , everything is a rip off ( the rickshaw wallahs are a bunch of cut-throat bastards ) . But still, out here i have had the most fun and done the most studying. some of my lecturers are amazing people and some of my fellow students are more so. There are people here who would gladly stay up overnight to code up something or complete something or simply get drunk. to each his own. and most of these people are committed to his/her art/craft. Even the lecturers ( and the drun...

Learnings from the failure of ka19.in

Sometimes, i like browsing sites that i made. it gives me a sense of achievement. Today i browsed over to ka19.in site to be rudely greeted by a redirection to blueline computers. Would have been nice to get a notice from the owner, but i guess he didn't find the time. Anyway, a year back when talks of redoing this site were going on, i remember clearly telling yathiraj (the owner) that the site would be a better online store than a social network. but since i'm paid for doing what i am told to do and not to shoot my mouth off, i stopped advising him and concentrated on delivering the site. after that, things turned sour due to payment issues. At that time online shopping was not such a great thing and facebook was everybody's vice. But the idea of being a warehouse and low margins at big scale without the overhead of a pricey showroom was pretty amazing. its still amazing now, but quite honestly, i have enough on my plate so as to not to dabble in this. however i usually t...

Books, Business, and Steve Jobs. A tribute.

This post is a tribute to Steve Jobs. I know that its been a long time, and i'm late and a thousand different things and so on, but I didn't want to rush things and lose the chance to say something I really felt about this man who has radically changed the way we look at things. I had been to the local stationary shop here in Manipal since my brother wanted to buy a few books. After we had done our thing, we looked around the shop to see what else was new. As we were staring at a 6-in-one book which carried a huge price, the shopkeeper came up to show us this book even as we said we were not going to buy it. This book had plastic sheets that one could attach to the spine of the book. The high price of the item was due to it allowing the lucky owner to decide on the allotment of pages per subject. As we were coming out, i started thinking of how things have changes since i was a kid. Back then we had just a handful of choices and our page size was decided by either an imaginar...