Wednesday, 20 November 2013

The Ghost Blogging Platform - A Review

A few days ago I came across this new blogging platform called Ghost. It had a very successful funding campaign over at kickstarter. It was funded 8 times above the goal!!

So to find out what all this fuss was about I decided to try it out! Go ahead and watch the demo video over at their website. It gives a good overview of the thing. I was intrigued by their approach. Unlike most of the blogging platforms that exist today, it uses markdown to format the blogposts. Both blogger and wordpress use a WYSIWYG editor. I was skeptical about this approach. At first glance the markdown looked intimidating. I was unsure if it would be a good idea to replace simple WYSIWYG editors with markdown.

Setting it up

Once I signed up for the thing I found out that they hadn't released a hosted version of their site yet. My dashboard said that I had to download the source code to try it out.  The setup looked pretty simple. So I decided to go ahead with it.

First I installed node.js and npm with a simple sudo apt-get install and followed the instructions over at this page. There was a minor hiccup here. The thing didn't seem to have installed properly. Then I discovered that this was because apt-get installs an older version of the node.js libraries. So I followed the instructions over here and installed the latest version from the PPA.

After that I ran `sudo rm -rf ` node modules to delete traces of the previous installation attempt and then ran npm install --production again and it worked fine.


Impressions

So here it is, up and running!



Then I created a test post to test out the syntax of the markdown and I was blown away! It was much better than it looked in the video! The markdown is surprisingly intuitive once you start typing. A lot of the syntax is very similar to the Org mode in emacs and the syntax for adding links and images is exactly the same as on reddit. I found myself formatting it quite naturally without needing to refer to the syntax guide.



Although the idea of using markdown didn't sound so inviting when I saw the video I liked it once I actually started typing. Although there were a few small hiccups(like the list formatting not working if I didn't leave an empty line before it. I think this one's my fault though XD) I really liked the overall idea. It's definitely convenient to not have to interrupt my typing for using the WYSIWYG editor buttons.

One other big advantage that I see is the ease with which I can import and export posts with all the formatting preserved. Since all the formatting information is contained in plain text, I just have do a simple copy paste! I think I'll migrate all my personal blogs to my local version of Ghost.

Final Verdict

I think it's an awesome idea! Although the platform is  a bit short on features now I think that's mostly because it's under active development. I think it's really good idea and that it has the potential to become something really big. This could turn out to be the future of blogging. Also, they say on their website that the company will be registering as a non profit company and that the platform itself is open source! I think Ghost is to blogging what GNOME is to user interfaces.

Wednesday, 4 September 2013

Even More Conformal Maps with OpenCV

That little program I wrote when I first started learning OpenCV just keeps getting better and better. A few days ago, I got the idea of putting the code for doing the complex transforms in a while loop and changing the transform by a small increment each time. It yielded some spectacular results!


Thursday, 15 August 2013

Hands Free Mouse Pointer Control with OpenCV

So I've been busy with a lot of things lately and one of the things I've been working on is a program that tracks a coloured marker (I use a lime green ball) using my laptop's webcam and controls the movement of the my mouse pointer.

I posted the code on github. Note that I did this on Ubuntu with xdotool installed. So this code won't compile and run unless you have Linux with xdotool installed.

Here's a video demonstration of the program working:



What I'm really impressed with is extremely low latency I can achieve with this program. Since I was using real time image processing I expected there to be a significant lag in the movement of the mouse when compared to the movement of the ball. But as it turns out, the latency is almost unnoticeable. Hopefully I can develop this into a full blown hands free interface for my laptop. 

Wednesday, 22 May 2013

More Conformal Maps With OpenCV


So I finally got the conformal maps code to work with some of the  other functions and the results are quite interesting and strange. Not really what I expected to get. The transformed images vaugely resemble the ones in my math textbook but don't match them exactly.

So again, here's the original image for reference:


I then applied the transformation $w = z^3$ to the image.

The results are quite satisfactory. No surprises there.











$w = z^3$ transformation
Next I tried $w = z + \frac{1}{z}$. I didn't really get what I expected ...

$w = z + \frac{1}{z}$
$w = log(z)$ looks like someone flattened the thing along the third dimension.

$w = log(z)$
Another version of $w = log(z)$ with the image in a different position.
The results for $w = sin(z)$ and $w = e^{z}$ were just plain weird.

$w = sin(z)$
$w = e^z$
But my favourite one was the transform $w = tan(z)$

$w = tan(z)$
$w = tan(z)$ with the image in a different starting position
A perfect example of mathematics creating art. They're not as good as fractals but they're still pretty good.

Saturday, 6 April 2013

Thoughts on Free Will and Determinism

The most important problem that comes up when talking about free will is the difficulty in defining the concept. How exactly do we define free will? There are many definitions with different levels of rigorousness. One way to define free will is in terms of the absolute laws of physics. We can define free will as "the ability of a conscious entity to make choices that are not affected in any way by the events that happened to the conscious entity in the past." This is the definition most often used by the group of people who are classified as incompatibilists. Another way to define it is in terms of other living things. We can define free will as "the freedom to chose which action to take in a particular situation without being hindered by other humans or conscious living beings." My opinion on whether free will exists or not is highly dependent on actual definition being used. I think it is extremely unlikely (and even impossible on principle) to have the kind of free will that is independent of influence from physical law. However if the definition on free will does not mention independence from past events and only concerns itself with restrictions on choices we make by other people, then I am willing to accept the possibility of free will existing.

In the second kind of definition, we are merely stating that when faced with a choice such as "Which profession to go into?" or "Which course do I take in college?" we have the freedom to go against the advice of our parents/teachers and do whatever we feel like at the time (not everyone has this freedom ;) ). This kind of freedom in principle exists. Although there are parents that force their children to make certain choices when it comes to college courses, the student can in principle choose not to accept that decision by ignoring or being prepared to accept the - sometimes unpleasant - consequences of their choice. That kind of free will exists and that is the picture of free will that comes to most people's minds when they hear about freedom. In fact, this free will or "social freedom" is the kind of freedom most people expect from modern society. It is what they refer to when they talk about "Freedom of speech" or "Freedom of expression".

However if your definition of free will that tries to say that human decisions are completely independent of the events that took place in your past, I disagree that such a kind of freedom exists. This kind of freedom is impossible to define without generating a contradiction. The human brain is a huge neural network that stores in the neurons different weights that are a result of our past experiences. These are the same neurons that make "conscious" decisions or "choices." I think that it is impossible for a human to make a decision or a choice whose sole originator is the human in question.

Recent results in neuroscience suggest that our conscious "mind" is not really the originator of our actions see: http://www.ncbi.nlm.nih.gov/pubmed/15925808?dopt=Abstract and http://www.ncbi.nlm.nih.gov/pubmed/12191935?dopt=Abstract
The results of these experiments seem to suggest that our "choices" are determined by the brain before our conscious mind becomes aware of the fact that we have made a choice. Results like these reduce the likelihood that the decisions we make are completely independent of past events. It may even be true that the only thing consciousness does is rationalize the involuntary actions of our sub conscious. The very idea that we have "Made a decision" may be an illusion in many situations.

I also disagree with people who simply wave their hands vaguely and say free will exists because Quantum Mechanics. While it is true that quantum mechanics is a probabilistic theory,  it doesn't help to "gift" free will to consciousness. Firstly it is highly dubious whether quantum mechanics is directly involved in human cognition and consciousness. Secondly even if quantum mechanics made our choices probabilistic it still doesn't mean that the decisions are free decisions. Decisions can only be classified as "free" if a people have the same probability of making a particular decision when faced with a particular choice independent of the experiences these people have had in the past. A coin that lands on heads half the time does not have "free will".

I think a lot of the confusion surrounding the debate about free will and determinism is because of the wide variety of ways in which people define "Free will". It's got so many definitions that it is impossible to say what people mean when they say "I believe in Free will". If someone ever says that the very first thing I will do is to ask them how they define free will. The debate should be pretty straightforward from that point on.

Tuesday, 12 March 2013

Playing around with OpenCV and Complex Functions

Last week my college hosted a technical fest. It was pretty cool. There was some really cool tech on display at for the exhibitions, some awesome guest lectures, robotics competitions and a lot of workshops. It was quite a busy and interesting week. I attended this really interesting workshop that introduced us to image processing using Matlab. We managed to get matlab to track a ball in the field of view of my laptop's webcam and use this motion to control windows media player and the movement of wheeled bots. Recently, I've become really interested in the field of Artificial Intelligence so this simple computer vision exercise got me excited. I came back to my room that evening and started exploring my options.

That evening I discovered an excellent Open Source alternative for doing image processing called OpenCV. I decided to abandon Matlab and do image processing in OpenCV instead (Because it's freeeeeeee!). That very evening I got OpenCV compiled and set up on my Ubuntu partition and started learning image processing.

I had a bit of difficulty starting out because I'd never really learnt C++ 'officially'. So I had to use my basic knowledge of C and a lot of googling to understand the basics of setting things up. The biggest hurdle was understanding how classes and objects worked. It took a few hours to smooth those concepts out. As soon as I had a rudimentary grasp of what they meant I could start writing my first image processing program.

So fooled around with flipping and adding noise to images for the last week. Then I got a brilliant idea. I was having a bit of trouble visualizing what I was learning in math class. We were doing conformal maps. So I thought that it might be a good idea to use OpenCV to visualize conformal maps. So I set out trying to apply conformal maps to Lenna,  one of the most famous test images used in image processing.

It took me a couple of days to make the code completely bug free. There were some really annoying bugs. The fact that images were stored in matrices whose indices followed a left handed coordinate system added to the difficulty of implementation. I had to apply multiple transformations in series to get the code to work. But in end everything came together and this was the result!

The result of applying the transformation $w = z^{2}$.
Right now, the only transformation that works perfectly is $w = z^{2}$. Other functions give really weird outputs. I'll figure them out eventually.

And I've decided to open source the code I used for this! It's very messy because it's not the final version of the code and it's full of commented code and random cout statements.  But maybe somebody will find it useful.

The code can be found here: http://pastebin.com/kBBP2ASe

Monday, 11 March 2013

Anthropocene


When you see all of humanity's achievements (and environmental mistakes) summed up like that it really gives you a sense of wonder. We've come so far in terms of technology.

I suddenly understand what Arthur C Clarke meant when he said: "Any sufficiently advanced technology is indistinguishable from magic." The full force and meaning of that statement is mind blowing and frisson inducing. The kind of things we're doing with technology today really is magical. It's a testament to the power of science. We've managed to understand nature so well that we can bend unimaginably tiny clusters of atoms to our will. It really is amazing.

This is the same Youtuber who gave us the wonderful Symphony of Science series. He makes some really awesome stuff.

Saturday, 9 March 2013

Team Fortress 2 on Ubuntu!

Something happened a few months ago that got me really excited. Valve announced that they were releasing Steam for Linux.  At that point I had already installed Ubuntu on my laptop and the only reason I still used windows was that all my awesome games were in my Windows partition. But steam for Linux changed everything. So one of the first games to be ported to Linux was my favorite War Themed Hat Simulator (aka FPS ) Team Fortress 2. There were some initial problems though. It turned out that to actually get steam running on Linux I needed to install some new Nvidia drivers. But these drivers did not have support for laptops that had the Intel Optimus technology which turned off the graphics card when it was not being used to save power. In Ubuntu, the way to get around this is to use a software called Bumblebee which acts as a substitute for Optimus. The new Nvidia drivers didn't work with Bumblebee initially. So I had to wait.

Now I've finally managed to get everything to work together. TF2 finally works on Linux!!! Only my sleeping roommates prevented my from screaming "IT'S ALIVE!!!!" to the rest of the universe.



The game runs beautifully and I think it runs even smoother than it does on windows! It's amazing. The fps stats showed hardly any stutter at all! 

There are still a few problems that need to be resolved before I can run use Ubuntu as my main TF2 playing OS. The temperature is a lot higher in Ubuntu. It skyrockets to 75 degrees and stays there. Also, my hard drive seems to be heating up unnaturally when I play TF2. I think this might have something to do with that message on partition manager about my sectors being misaligned. Maybe that is causing the hard disk to work too hard to transfer the same amount of data. I'm not really sure how exactly to solve that issue. But I think it should be fine after a few more driver updates from Nvidia. 

And I also got this adorable in game item!!


Friday, 18 January 2013

Does Good Content Pay for Itself?

I've recently begun to see a trend on reddit that in my opinion is weak evidence for the theory that piracy is a result of sub standard content. Good content really seems to pay for itself. On reddit there is a feature called reddit gold. If someone thinks a particular comment is really good they have the option of buying the commenter "reddit gold" which gives the user who receives gold access to a lot of beta features on reddit. The money goes towards maintaining and developing the website. Over the past few months I've seen a definite increase in the amount of reddit gold given away for really good comments. This ranges from excellent in depth explanations of difficult to understand concepts on /r/askscience to hilarious jokes on /r/AskReddit. This little comment I saw on AskReddit today was what inspired this blogpost.
The author of the comment with the gold star beside it was gifted reddit gold by some random dude on the internet.
And the truth is, it really was funny. I think that was the hardest I'd laughed in months! And someone thought it was literally worth money and gave the user reddit gold for content that was really free anyway.

But maybe I'm wrong. Maybe this actually indicates that the rate of piracy will stay the same but that more people will be willing to pay for the content. If more than one person gave that user reddit gold then there would be number beside the comment indicating the number of times he was awarded with gold. Thousands and thousands of people read AskReddit everyday (I think the actual number should be about half a million. /r/AskReddit has over two million subscribers. Half a millions feels like a good estimate of the active users.). So out of all these people only on person gifted this guy reddit gold. Of course, there are a lot of other factors at work including the fact that most people will see it as a waste to buy reddit gold to random dudes in a reddit thread. The whole point of supporting content generators by actually buying their content is so that they get an income and are able to generate more good content. In most reddit threads comments like these are a one off incident, a stroke of luck. The comments are usually not made by professional comedians. So it really doesn't make sense to fund the commenter. But the actual funds are not going to the commenter. The funds end up with reddit. So I guess reddit gold is way for users to help fund a website where they get so much information and entertainment.

Now that I think about it reddit really has some awesome content ( if you look in the right subreddits). It's a really awesome place to hang out on the internet. And millions of people visit the site every day. And the voting system in place ensures that the best content generated on the site always floats to the top. So it really is providing many of its users with a service. Geniuses in their own fields generate good content by being awesome at what they do. Sites like reddit generate good content by collecting and concentrating all the best stuff generated (very often due to chance) by its users using the collective intelligence voting power of the site's millions of visitors. It's an arena where ideas and thoughts (a lot of them bad, some of them good) fight to the death and the best ideas rise to the top by a process of "natural selection". And the structure of the website enables this to happen. So in a way good content really is paying for itself on this site. The site provides a service which allows the collective intelligence of the website to generate amazing content and people voluntarily pay for it using reddit gold!
I wonder how much of reddit's income is generated by reddit gold ...

Tuesday, 15 January 2013

Sometimes the Graders Don't Notice the Seam.

And sometimes they get annoyed and cross the whole thing off.

From xkcd (Did I mention I was addicted?)
ALT TEXT: Handy exam trick: when you know the answer but not the correct derivation, derive blindly forward from the givens and backward from the answer, and join the chains once the equations start looking similar. Sometimes the graders don't notice the seam.

Sunday, 13 January 2013

Aaron Swartz

When I opened up reddit today right at the top was an article about Aaron Swartz, a co-founder (or co-owner if you really want to get technical) of reddit who took his own life on January 11. I'll be honest, I really did not know about the guy until today morning but it did leave me a bit depressed when I learnt that he was just 26 years old. From what I have read the reason for his suicide was the prospect of facing 35 -50 years in prison for downloading journals from JSTOR, a lot of which they were planning to make publicly available anyway. Also, in this statement JSTOR says that it really wasn't interested in pursuing legal action after all the data was retrieved.
So the fact that he was given such a harsh sentence is really quite a surprise.

While I think taking your own life is never a solution I can sort of understand why he did it. If I realized at the age of 26 that I had put all the grand plans I had for my future till the age of 76 I would be devastated, not to mention depressed.

Anyway, I really don't know enough about the issue to write a long, in depth article about this. We need more geniuses in the world and the loss of this one was sad. In the not too distant future there will be a day things like this will stop happening. Hopefully.

Thanks for making the internet a better place, Aaron. You will be missed.

Sunday, 6 January 2013

Anime Theme: Time Travel



So I've watched two anime about time travel so far and both were brilliant. Steins;Gate was particularly mind blowing. It was like this perfect combination of plot, animation and complexity. One day people are going to look back and use it as an example of how anime should be made. Some anime try to make their plot way too complicated. Personally I'm a big fan of complicated plots that really make me think but it takes a lot of skill to pull of really complicated plots convincingly. Sometimes it just results in the creators running out of good ideas and ending the story in a way that makes most fans cringe. Steins;Gate has a perfect level of complexity. The time travel itself was handled brilliantly. Another thing that stood out was the emotional impact. Steins;Gate really shines in this. By the end of the last episode you'll find yourself mentally exhausted from all the tension that was built up over the course of 23 episodes. I'm glad that I started watching it long after all the episodes were released. I can't imagine waiting as long as a week for the next episode. I think Steins;Gate is the animated equivalent of The Chaos Walking Series in terms of how well written it was. It was also really well researched. I was quite surprised to find out that a lot of the "conspiracy theories" in the anime was inspired by some real life events. Especially the story of John Titor. It was a bit creepy to find a Wikipedia entry on John Titor right after watching through the series.

The other one was a film. The Girl Who Leapt Through Time. Although it a less convoluted plot and less emotional impact than Steins;Gate it was brilliant all the same. Again, the concept of time travel was handled brilliantly.  

Game of Life Simulated Inside Itself

I found this amazing video on YouTube of someone who managed to simulate Conway's Game of Life inside the game itself. The level of complexity in this simulation is mind blowing. Suddenly I'm a lot less sure if we're living inside the matrix.


Wednesday, 2 January 2013

Do People "Look" Like Their Names?

I've had this thought many times but was recently reminded of it when I watched this video by the PBS IdeaChannel (go check this channel out! It's awesome!) where YouTube commenters were talking about the presenter in the video looking like someone named Mike.

It made me think, do people really look like their names or is it just that the we associate the names with the faces? When we ask someone what their name is and they say "Ariadne" and we think "Hmm.... she really looks like an Ariadne(I wrote this post right after reading the latest Percy Jackson book and reading up on Greek mythology. That's the reason for the unusual choice for a name.)  Is it because she really does look like an Ariadne or is it just because we make the association the other way round?

I think my question really boils down to this: Do names given to people have any intrinsic ability to describe the way they look? It's very unlikely. Most parents give their children names based on a factor completely independent form their appearance. It's impossible to do that anyway since most babies look the same as soon as they are born. It reminds me of a talk Michael Shermer gave about the believing brain and how humans always tend to notice meaningful patterns in noise even if they're there by pure chance or sometimes even if they aren't there. If someone points out that that girl named Ariadne looks like an Ariadne then people will automatically start thinking that "yes she does look like an Ariadne". When I was young I really did think this way. When someone was introduced to me by name I would start thinking about how he or she 'looked' like their name.

An interesting experiment would be to take two large groups of people; one control group and one test group. The memebers of the group are not told which group they belong to of course.

Then each member of the group is shown a face and a name. The control group gets the right name for every face and the test group displays a fake name for every photo. We then compare the groups and see if the group given the false name had a higher proportion of faces labelled "does not look like name" than the control group.

To make the experiment simpler, we could just get one large group and give them a huge list of faces and names and then ask them to say whether the faces look like the names or not. False names and true names are randomly mixed into the list. Then we can compare the true names to the false names and see if the faces of the people in the falsely named photographs were more likely to be marked as not matching the name.

The interesting thing is, that this applies to everything else as well. There is nothing inherently 'tabley' about a table and there is nothing inherently 'birdy' about a bird. It's just a random sequence of sounds that we make with our mouths. At some point people got together and agreed that this particular sequence of sounds would represent animals that fly. So all languages arbitrary. It's just an abstraction that helps us to let each other know what what's going on in our minds.

I guess this is a thought Christopher Paolini had when he was making up languages for Eragon universe. In The Ancient Language names of an object are supposed to be true names that describe the inherent nature of the object. It does look like he gave the matter of words in languages being completely arbitrary quite a bit of thought. In the real world mathematics comes closest to this ideal of representing the true nature of reality.