Tuesday, October 8, 2013

Mother of destruction!

I just recently saw White House Down. Strikingly reminiscent of Die Hard (so much similarities; think about it), I still found it quite entertaining in spite of all the fallacies and idiocies that usually form the core of a Roland Emmerich film. But again, that's the case with most of his films - they're purely for entertainment without brains.

Monday, August 26, 2013

Minecraft - Noob Venture: The Leaning Tower of Pisa

I admit it's probably a bit late to say "Hey, I'm playing Minecraft!". The game has been around for almost two years. Being a mid-core gamer, I have known about it for quite some time. Yet, I didn't start playing it until recently. It happened to be one of those things that you know will be pretty good, but you keep putting it off because you still haven't felt like playing it. But after coming across various images of Minecraft constructions, some good ones like this:

and some awesome ones like this:
Cornbass / Reddit
Wow.
I finally started playing Minecraft. And by that, I mean playing in Creative Mode, not Survival Mode. I usually enjoy a game for its story, gameplay, graphics and art, and not so much for the competitiveness, so needless to say, the moment I entered Creative Mode I was hooked.
As a test run, to find out about all the blocks, the first thing I tried constructing was this house:

I actually wanted to do something creative. I even felt like I was doing something impressive all through the construction, but it ended up like this:

But then, I ventured on my first actual project. I wanted to work on something not too big, as it was going to be entirely handcrafted. But I still wanted to do something iconic. After doing some research on some famous buildings, I finally decided upon The Leaning Tower of Pisa.
The tower was a tricky one from the start. For one, it was too small to be properly detailed in Minecraft. After all, Minecraft blocks are a cubic meter in size and the tower was just 58 m high. And an even bigger problem was the slant. The blocks were too big to achieve an accurate 4 degree slant. So, the solution? Construct the whole structure at 2X. While it still didn't give the exact accuracy, it was better than the 1X construction.
The material used, after numerous trials and substitutions, was quartz. There should have been no speculation, but I have never before seen the Tower in person and rather got confused by the lighting in various photos.
After clicking away my mouse for five days, much to the annoyance of my housemates (how would you like to listen to a constant click-click sound all day, all night long?), I finally was able to complete it:


Truth be told, I don't think it's much accurate. I didn't know of WorldEdit when I was building this and I had to entirely hand-craft it. That too, twice - as I realized near completion that I had made a major scaling mistake and had to build the whole thing again. It was so exhausting that I probably made some errors. But still, I would say it is a pretty good construction for a hand-crafted structure? No?
From another angle
From the balcony of that house

Tuesday, January 8, 2013

Distributed Encounters of the Scala Kind

"Parallel programming".
I never got to learn it in my undergrad. Sure, I studied multithreaded programming, but I never liked it much. There was something unappealing about it and to this day, I never even cared to find out what it was. But the first semester of my grad studies, when I was required to take at least three out of five core courses, I chose this course. Not really because I wanted to, but I had already chosen two courses which I was very much interested in, and of the remaining three courses, this was the most appealing. So, I chose to do Distributed Operating Systems Principles. I obviously never expected to take a liking for this course, but two weeks into the course, boy was I wrong!

We got introduced to the actor model and as someone new to distributed programming, I soon felt that this was one of the most practical and the most anthropomorphic design models that I have ever worked with. And it fit almost perfectly in distributed programming. Basically, it involves a set of entities called actors which can each receive messages. And when they receive a message, they can do one of these: send messages to other actors; create other actors; change their own way of responding to messages.
There are a bunch of programming languages out there which support actor model (http://en.wikipedia.org/wiki/Actor_model#Programming_with_Actors). But our course instructor introduced us to a relatively new programming language called Scala.
Having been built using JVM as a base, Scala is vey similar to Java. Actually not just similar, it can even inherit and use Java libraries. The level of abstraction in Scala is high and by high, I mean, huge. If you write a Java program of 100 lines of code, in the berst case, you can probably write the same program in maybe even 20 lines of code in Scala. That's the kind of abstraction I'm talking about.
Of course, there is a limit to how much abstraction you can introduce in a programming language and sometimes it can get too far. Check out http://metamatix.org/~ocaml/price-of-abstraction.html. This was a study done to determine the effects of abstraction on efficiency. And Scala seems to perform quite poorly in comparison to C++ due to its level of abstraction. But as they themselves say on the webpage, it is only in the most pessimistic situations that Scala performs this bad.
But having worked with Scala for the past six months, I have personally come to think it's probably the next big programming language out there. And here is why I think so:
  • For one thing, it is pretty easy to transition to Scala if you are a fairly good Java programmer. It reminds me of the way Java was influenced by C/C++.
  • It implements object oriented programming.
  • The high level of abstraction enables you to write compact and easy-to-understand codes.
  • This I think is the most important reason. With the importance of parallel programming on the rise, the easy-to-use features of Scala may convince many people to start using it. The grand trade-off between OOP and FP in Scala seems severely appealing.
This Is Sparta Meme - This is Scala!!!
But again, these are my personal opinions. Things might take a different turn in the future.
As for distributed programming, I have taken a big liking for it ever since I started working with Scala. It's easy to use and more importantly, it lets me implement my ideas the way I want them to be implemented.
It is no wonder that Twitter started using actor model through Scala. Probably the most comfortable factor for Twitter to use Scala is the fact that it limits tweets to 140 characters. And each time I run a distributed program on Scala and find actors passing messages between one another, it feels like they're tweeting, hehe.