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

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.