Monthly Archives: December 2013

On clutter and clarity.

As I mentioned in my last post, I now have an extra laptop. And when it came time to put, well, stuff on it, I was pleasantly surprised by what I went with.

Xcode. Python. Inform. Pixen. LaTeX. Emacs. J. Keynote.

In other words, stuff for working on.

It is very liberating. No vlc. No flash. No torrents. No Word. No movies. No songs. (Not no iTunes though).

I don’t claim that I won’t procrastinate as a result of this. I merely bask in the utter simplicity of it all.

I should have done this a while ago.

This was #17.


On my adventures in the key of DIY

I am not a DIY person. (That’s Do-It-Yourself, if you didn’t already know). I have never actually done any work with any tools for anything ever. The only time I used screwdrivers and/or wrenches was putting one of those remote controlled Lego things together.

I can tell you precisely why I’m not a DIY person. Because I lack the confidence that I wouldn’t make a bigger mess than already present. Case in point: putting a screen protector on my phone. Horrible task. I put it on and everything was fine. Except for one teensy air bubble near the top. I tried ignoring it for four minutes. Then I went mad and let’s just say two hours later the screen protector was in no shape to be doing any screen protecting.

Which is why I surprised myself when I upgraded the RAM of an old laptop we had lying around. I ordered the memory (2 x 2 gb) from flipkart. When it arrived, I opened the bottom of the laptop (unscrewing three screws!), ejected the old RAM, vacuumed the dust out, pushed the new ones in, re-screwed everything back together, and did not brick the laptop in any way whatsoever.

I also have never installed a new operating system before. Because I always procrastinate too much about organising and then backing up all the shit I have. This was different. Old laptop. Nobody cares. I’ll do a fresh install. I downloaded the latest OS the thing could run (OS X Lion), made a bootable pen drive of it, and installed it in the newly erased old drive.

I have plans of eventually getting a tiny (60 gb) SSD to round up the speed boost. Why so little? Because of the reason why I went though all this. Xcode.

Xcode requires Lion. Lion requires 4 gb. (Well, 2, but 4 is better). That’s honestly the only reason I did any of this.

It’s a relatively banal moral. If I want something badly enough, I will do the shit it takes to get it. Now. I’m surprised that this is a surprise to me. I am also surprised that what I just described seems to be being referred to as some sort of Herculean task here. Lots of surprises.

Not Herculean in the sense of effort, of course. Herculean in the sense of it testing my confidence.

I don’t really have a point.

Good night.


On overheard conversations.

I like chess. I entered exactly one contest, in Vizag, and played (and won) three games before being kicked out of the proceedings. I have played chess on and off, never really seriously, for years now. I don’t know any “tricks” or “strategies”. I haven’t read any books on chess. I used to play on my phone for a bit last year, but eventually stopped after I reached the stage where a lower difficulty on the computer was something I could always beat and a higher one I would always lose.

Then I came across an app called Pure Chess. It’s multi-platform, so you can probably check it out. It looks gorgeous. And the music that plays in the background is simply beautiful. I played a couple of games with the computer on the lowest difficulty. I liked the app. I then did what I usually do in cases like this: go read the reviews. And on one particular review, I found the following conversation in the comments:

20131227-120716.jpg

It’s a nice self-contained narrative. (If you skipped all that, please go back and read just the last two messages). That thread could be a short story, or the inspiration for a novella. Nice as the thread was, I am more interested in how I came upon it.

I like that I “overheard” them talking. And I like that I can show you what I heard.

The name of my blog is Ephemera for a reason. These are things I know I will forget, or come to care less about, as time goes by. These moments are ephemeral, and I’m perversely reversing that innate quality by writing about them here. People always say you should be thankful for the little things. Or that you should notice the little things. Or whatever other suitably impractical things that they themselves have done maybe once or twice. Well, this is me doing that.

This was #16.


On learning by tinkering

Aka “diving in and doing stuff”.

I realise I am no authority on the subject, but the last few days have had me engulfed in a project where I started out knowing almost nothing, and now it’s in a half-decent on-it’s-way-to-completion state. And I got to this point completely by googling the hell out of every roadblock I came up against and using as many readily available open source thingies as possible.

Yes, I’ve been coding. A game, to be particular. A game some nice Japanese people made (play store link). Why? I have no idea. It just seemed like a cool thing to do. I’ve always wanted to make a game. I’ve tinkered with another one before (I’ll talk about this later) but I’ve never built one before. And now I have a game idea to build upon!

The last time I did something like this, in the summer, I recorded progress on my app on my Facebook. In an album full of screenshots and annotations. Now I have a blog so a blog post it shall be. Ever-updating, of course.

First. Some preliminaries. I used XCode for this project partly because I was familiar with it and mostly because when I started it, I had nothing else with me. The mac stays at home though, so I’ll need to transfer the code to something like HTML5 if I want to be able to work on it in college. Or use one of the XCode windows ports for the computer in my hostel room. Whatever. Now that that’s out of the way, what I did:

One aspect of “game programming” that’s always daunting for me is the simple act of getting a window up that then displays an image. This is like Everest for me. It is such a steep mental block that I have given up countless roguelike game ideas because I could never get a window up in Python. I know PyGame and stuff exist but I was too “purist” a few years ago. I wanted to write everything myself. Now I know better.

Now I know, for instance, that being a purist is simply not feasible, at least for me. There are people out there who have done all the work for me. I just need to find those people and use their work. This is not exactly trivial. For instance, I use Cocos2D to do all the graphicy stuff. (I say “do” rather loosely). It is ridiculously simple to set up and use. But it took me the better part of a couple of hours to find it, or indeed that it was what I was looking for. I know this might not seem like much time, but it is when you take into consideration that I want to do this for fun. Not much fun if I can’t get started.

So. I was lucky to find Cocos2D. I had a thing that could put stuff on the screen. Yay.

What will I put up, exactly? Well.

Oh dammit. I haven’t explained the game to you yet.

Sigh. Hold on.

20131226-095708.jpg

Okay. This is a screenshot from the game so far. (Thank you!)

See those little white or black squares here and there? And see those shapes that the lines form, boxy little things? I call those shapes regions and those squares crossings. A white crossing is off, a black one is on. If you tap a region, all the crossings along its boundary are toggled. Your goal is to turn every crossing on.

Got it?

Good.

Now, if you notice, that picture might seem complicated to make. If you think about it for a second, though, you’ll see that it’s actually composed of little tiles, of which you only need 9. These 9, to be precise:

20131226-100613.jpg

Cool, right? So all I have to do is figure out a way to put those tiles together in order to make whatever knot I want. How do I put them together? Well. There’s a thing called the arc presentation of a knot, which is an array of coordinates from which you can generate these images. I won’t bore you with the details but I will point you to the website that will: Knot Atlas.

Next problem. How do I get these arrays? That same website (a sort of Wikipedia for knots) also has these arrays for the first 250 prime knots. Aaand they have a database you can download of all the info they have. Perfect? Not quite. That database doesn’t include these arrays (because they’re not unique.) So I need some other way to get what I need.

Every mac comes with a brilliant little program called Automator that you can use to automate little everyday things. For instance, you can make an app whose sole purpose is, when clicked, to close all other apps. Or you can stitch together loads of images into a PDF. Or you can mass rename things. Or. Or. You can do this:

20131226-102051.jpg

Too perfect. The first bit spits out a list of all the links on the page given to it. The page I sent it to was this one. It has links to all the knots I need plus some extraneous things. I cut out the stuff I didn’t need and fed that into the second bit that, in ten minutes, dumped a biiig text file containing aaaaaall the text from those webpages.

Now. I need to locate the arrays. And convert them into this thing called a .plist file which is what XCode understands very easily. Easy enough, Python! I wrote a Python script that sifts through the text, finds the array, yanks it out, and dumps all them into a neat plist.

20131226-103810.jpg

(I like screenshots.)

Anyway. Now I have a bunch of arrays that I can make knots from. Oh, and by the way. This isn’t in strict chronological order. There’s no way I would go through all this without first having a working piece of code.

And that code was by turns easy and frustrating to write. What I basically had to do was follow the rules of the arc presentation to go from the array of the website to the array of image files I needed to call in order to draw the damn knot. Not difficult. The difficult bits were then recognising which region you tapped in. And once you’ve recognised it, how the hell do you then associate the crossings of that region to the region itself? I had no idea.

For a few hours anyway. Then I broke the problem down. Like this:

Well. I’ll worry about how I get the regions and crossings and all later. First, given the vertices of a polygon, how do I detect when I’ve tapped inside it?

Easy enough. Googleable. Found a website that I want to link to but I can’t seem to find it now. Ah well. After that, I needed a way to actually get those vertices from the array.

I don’t quite know how I arrived at the Jordan Curve Theorem but I did. What the theorem states is basically this: if you have a closed simple curve and you attach a direction to it, travelling along the curve in that direction, the “inside” of that curve will always be to one side of you. Obvious enough no? But this was the catalyst I needed, the guarantee to continue, essentially.

Basically, if you start at one of the corners or a crossing, and follow the path defined by the above rules, you’ll always get back to your original point and you’ll have described a region in the process. You can pick up any crossings along the way and make them “belong” to the region. Done!

Let me illustrate:

20131226-110028.jpg

The 10s are top-left corners, (the “aa” image from the second screenshot). The 3s are crossings. Fill in the rest yourselves. What I mean is, start at every 10 or 3 (nothing else; I’ll explain why in a bit) and then keep following the curve until you hit another corner or crossing, whereupon you then turn in the manner indicated. If you do this, you will have mapped out all the regions on the knot, except for the outside region. Some duplicates exist. The reason I say don’t start at 11s or anything else is because they are always duplicates (think about it). Or, with 11s in particular, they usually map the outside region. Why? Because starting at the bottom most 11, if you go right, you are mapping “down” as a region. And “down” points to the outside. You will traverse all the vertices on the outermost fold of the knot. Cool no?

Anyway. I have all the info I need. (I’m skipping over a bug from repeated regions in the interest of now laughable brevity.) I wrote it all down and boom. I can draw any of 249 knots. I can tap away at any region and all the correct crossings toggle instantly. I’ve even included the outside region. Some knots are ridiculously easy to solve because the crossings are all off to begin with. So I made it so that each time a knot is drawn a random number of crossings are already on. This makes it not as straightforward for easy knots and quite fiendishly hard on the normal knots. Yay.

DONE.

Ish. I still need a menu and buttons and a counter for how many moves you’ve made and a display that tells you the minimum number you actually need and sits and mocks you when you exceed it. All in good time.

Further thoughts I shall add later. When I’m optimising the thing because right now it leaks memory like crazy.

Thanks for reading! (If you survived this far, that is!) Do comment. Or if you code yourself, feel free to tell me better ways to do stuff, especially a non-mac way to yank text from webpages.


On Mohali

One lazy winter evening, Priya happened to mention to me that she was going to attend a program on knot theory in IISER Mohali. She said the organisers were really nice people so I could probably still apply even though it was way past the deadline.

In a singularly uncharacteristic turn of events, I applied, and eventually was told with much gusto that I could attend. At this point I didn’t really think of the whole thing as “real”. I had booked a train ticket (now I know what all the class codes mean!) for Chandigarh but I never thought I’d use it. I had picked out the clothes but never thought I’d pack them. And so on.

But December the 9th came along. And my suitcase was packed (thanks to mother). Final farewells exchanged. Got on the metro to the station, found the train and sat in it. Five hours later, I’m in Chandigarh. A half hour (and one seriously overpriced auto ride) later, I’m in IISER Mohali. Everything is so different. I’m in the guest house. My name isn’t on the list. Priya’s phone is not reachable. I sit and wait for someone to come along and say I can go up. People come and go. And then Priya shows up. And then the guy I’d been emailing shows up. He says to the receptionist to put me in room 501. Priya tells me she’s next door. Happiness!

We go up to my room. Fancy. Big. We go to her room. We meet her roommate, Asha. It takes me a day to memorise her name. She’s from NIT Calicut. She’s very nice. She studied under Rama Mishra during the summer. Knot quandles. Fascinating stuff. Rama Mishra is one of the organisers. Priya had mentioned a bunch of times that she was awesome. We met her and I concurred immediately.

I don’t quite remember what we did that first day. I remember the restaurant. Zozen. What a funny name. What absolutely scrumptious food. (I later found out the food budget for this thing was 4.5 lakhs). For the first week or so, not one dish was repeated. There was always paneer in some new and exciting form. Ditto chicken, or fish, or mutton. Eight kinds of dal. A bunch of state-specific cuisines. Pickled carrots I enjoyed surprisingly a lot. And a different sweet everyday. Heaven. I don’t eat this regularly at home only.

Anyway. On to the program itself. The first day had a little introductory bit by Rama Mishra. She laid down a bunch of terminology and definitions and then introduced the next speaker, Louis Kauffman. He walked up to the board and starting talking in a booming American accent that I could follow without a glitch. After another introductory bit he started writing down some polynomials used in knot theory. The last thing he wrote down in a progression of these polynomials was something called the Kauffman Bracket.

It took a while for that to sink in. He’s teaching us about something named after him. Something that he invented. He’s, like, famous! And he was talking so gleefully about his Bracket polynomial. Talking us through very naturally about what he was thinking while he was developing this idea. I was amazed.

There were many speakers. Slavik Jablan, from Serbia (crystal clear accent), Jozef Pryztycky, from Poland (a bit unclear but understandable), V Bardakov, from Russia (with stereotypical Russian accent), Benjamin Audoux, from France (with stereotypical French accent) and loooooots of Japanese people with varying degrees of clarity in their English.

I’m not exaggerating when I say loooots. There were at least 10 of them. Our runaway favourite was the awesome Akio Kawauchi (河内 明夫, whose name means “a good husband in the middle of a big river”). He sat next to Priya one fine dinner and started philosophising at her about life and knots and how people’s lives are like knots and meeting other people is like performing a crossing change on those knots and so on and so forth. I joined them in a bit. He was a very nice old man. His English was clipped, but he still managed to express himself rather well. After a while he took out his phone and showed us this game called Region Select (search for it on the Google Play Store). He said it had to do with knots and that it was a fun and challenging game. Then he let us play it! Some ten minutes or so was then spent trying to figure out the rules by trial and error (the rules in the game were in Japanese). After a while, it dawned on us that he was one of the co-creators of the game! He must have mentioned it at the start but we didn’t understand. This was so cool! He said one of the others was also here, and she would give a presentation about the game and how it came about. So cool!

Angad. How did I get this far without mentioning him? Angad is Rama ma’am’s son. He’s 11. And much smarter than any other 11 year old I’ve seen before. He is a non stop talking machine. He must have spoken to everyone at the conference. He walked up to all the speakers and asked them something like the following:

Pick a number between 1 and 10. Multiply by 10. Add 5. Multiply by 20. Add 10. Your number is X!

He likes riddles. And tongue twisters. And Harry Potter. He’s in the school choir. He knows a lot of cool songs I didn’t think it was possible for an 11 year old to know. He is also utterly fascinated with gadgets and app stores. He went apeshit when he saw my phone. And Priya’s kindle. He kept telling me to download random apps and games. He didn’t know about angry birds for some reason so I showed it to him. He looooved it. Then he mentioned he liked Prince of Persia and I happened to have that, so we played that as well! He kept dying to the guys you have to sword-fight with though. Kept panicking and mashing all the buttons at once. Anyway.

He’s loads of fun. He’s on google+. You should add him.

His mother must have been so relieved that he took to us so well. Instant babysitters! He was with us a bunch of times and each time was very fun. He says the most surprising things sometimes. He really is quite clever. He also has a “temper” which is very cute and funny. And he knows karate (or at least can fake knowing it very well). I must have missed something or other. I shall update this whenever I remember more.

Class again. Kauffman was talking about rational knots. Very fascinating stuff. At the end of the talk, I went up to him and asked him why they were called “rational”. He had a sudden twinkle in his eye and he asked for a paper and pen. I took my book out and he then proceeded to explain in exquisite detail precisely why they’re called that. Not only that, he also then went on to talk about cool properties these things had. And then he ended it with one particular cool property that he himself discovered. So. Awesome. In the end he had written in about six or seven pages of my notebook. This is worth WAY more than an autograph would ever be, to me. (I later looked up some papers of his on rational knots, and was delighted to notice that all the stuff he explained to us in my notebook constituted 19 pages of a 40ish page paper he wrote).

There is so much more I can tell you. Slavik Jablan is the author (I think, or maybe founder) of LinKnot, a Mathematica package that does knot theory stuff on your computer so you don’t have to yourself. He mentioned it in his talks a lot, and I wanted to know more about it. So one day I asked him if he would demonstrate it to us students, so we would have a vague idea about it. He was so nice about it! He agreed immediately and he showed us the program the next morning, on a Sunday, before breakfast, right before an outing to Chandigarh for the day. His enthusiasm is positively contagious.

Even though I understood way less than even a quarter of what was talked about, I enjoyed the experience immensely. I shall more seriously read about things I don’t yet know but will need (topology!).

Oh! Sujoy! Last story, I promise. From the beginning:
Someone asked Kauffman something about Möbius strips. I was doodling away but Priya wanted to know what the question was. She went and stood near where Kauffman was telling the other guy something. Sujoy was also standing near there. After a few minutes they came back with this nugget: if you have a thrice-twisted Möbius strip that you cut in half, you get a trefoil knot. So to test this out she made the strip, stapled the ends together and cut it in half. Whaddaya know, trefoil knot! The stapler was Sujoy’s so we started talking a liiiitle bit after this.

The day before he left for home, he asked us if we would like to go out and walk around in Chandigarh. Maybe have dinner. We were like yeah, sure! At 7 we set out for sector 35. It was soooo much fun. He took us to a dollar store where we bought little presents for home. Then this bakery which smelled so perfectly of chocolate, where he ordered this sizzling brownie ice cream thing that was scalding and delicious. We walked around. Got some KFC chicken popcorn. Cotton candy. Walked in and out of a Burger Girl. Then eventually went to some punjabi restaurant and spent the rest of the time talking about raaandom things. Was so much fun.

But that’s not the end yet. After we got back to the campus, we walked to his hostel and got some tea and coffee. We were just sitting there and talking about random things again. I don’t quite remember how but we eventually started talking about maths. And studying. And stuff. I cannot summarise the discussion for you but let me tell you it was amazing. He was, for lack of better words and perspective, so wise! I knew someone like him back in Roorkee, but he would talk about physics like this. It was so nice to see someone talk about maths this way. So. Awesome.

Okay. That’s all for now! This is much less than a tenth of all the stuff that happened. I shall probably keep updating this as I remember more and more.

Thanks for reading! And for another point of view, check out Priya’s blog!


On melodium and the internet.

Let me do this in the key of #4.

First: how I know of melodium aka Laurent Girard.

Roman Mars, of 99% invisible, tweeted that we should listen to him and buy all of his music on bandcamp. I know of 99% invisible only because I happened to come across his kickstarter video. I was on kickstarter mostly because I backed Zach Braff’s movie, Wish I Was Here. (I had heard of it before, from random tech websites in the past. I read those websites as a part of my daily routine. I have that routine because I’m bored otherwise. Root.) I had heard of the movie’s kickstarter because Zach tweeted it. (I’m on twitter partially because I thought I needed an account just to have an account, but mostly because I follow mathematicians and other people who usually tweet nice links to stuff to read. Because bored. Root.) I follow Zach because of Scrubs. I know of Scrubs because I randomly came across season 8 (?) of it on Star World, at home, in Hyderabad, class 11. TV. Root? Let’s call it a root. TV because TV because bored.

Now.

Melodium is one man. The aforementioned Laurent Girard. He lives in Anger, a small town in France. He is a civil engineer. He is married. He makes music.

He makes beautiful music. You should listen to it.

I fell in love with his music. Recently, I’ve been on an “indie” kick. Indie games. Indie music. And a rethinking of my pirating policy. I’ll talk about this in depth later, but suffice it to say for now that I wanted very badly to pay for his music. To support him. Because he deserves it.

I refused to download anything of his illegally. Of the 21 (!) albums of his on bandcamp, one was free/pay what you want. I downloaded it for free. Each of the other albums was €6, or about ₹500. 9 of his albums were on iTunes at ₹120 each. I told myself I’d buy these eventually.

Today, he sends out a newsletter announcing a sale. 10 of his albums are free/pay what you want till Christmas. I cannot believe this. I wouldn’t have known if not for downloading that one free album and getting on the mailing list.

I tell mother about him. And sister. I sit them down, and talk about him. Play some of his music. And the other indie music I’ve been listening to lately. We have a lovely conversation about music and people. I keep squealing over how awesome it is that this guy, halfway across the earth, in France, makes music in his room because he likes to, and I get to listen to it. Here. Sitting in my room. The world feels so small. So warm. And cozy.

I say I would like to pay for one of his albums. She says okay. I didn’t technically need her permission. But I have a tendency to overthink and guilt-trip on purchasing decisions so I let her make them for me. I decided to pay €7.14 (about ₹600). Because it was over the €6 that it would normally be, and it felt like I was robbing him for not paying for the other (now free!) ones.

This post will overlap a lot with the piracy policy one.

This felt bad because I felt like it was dealing with another person. Like if I torrented his stuff, it would be equivalent to breaking into his house and stealing it. I would never feel that way about, say, an Eminem album.

So I did. I bought Lullabies for Adults (2009). And it is beautiful. I’m listening to it right now, in fact. You should, too.

While paying for it, there was an option to send him a message. Oh dear. What could I say? I ended up with:

Your music is beautiful, and I just wanted to let you know that you have fans in India 🙂 My mother and sister enjoy your music as well! I hope you keep making music for a long time to come.

And that was that. I didn’t really expect a reply. But, a few hours later:

thanks for your purchase
it’s really incredible for me, to discover people can listen to my music in INDIA
thanks for liking my music
i’ll try to go on making music as long as i can and i enjoy it
best
laurent

I was indescribably happy. I rushed over to mother and sister to tell them of this.

The world felt ever so smaller. Ever more cozy.

I love the internet.

This was #15.


On cadence.

(A note on the title: I knew the word I wanted began with a “c”. I also vaguely knew it had to do with Intel and it’s tick-tock chip cycle. Google the lot and I eventually came to “cadence”. I love the internet.)

A two day cadence seems to fit nicely. I’ll stick to this, I think. Unless something happens that is so exciting that I break the cadence. That alone should signify how important that post is. Yes. That’ll work.

Update: no. I’m putting up stuff whenever I feel like.