Anand's Space :: My Studio of Thoughts!

Quick Note on IPy Notebook

alt text

Lost my mind when I first learned it.

I was that lost in this (I)Python world! That much for my awe about IPython! Get a chance to learn IPython Notebook, instant excitement guaranteed!

##It’s magic.

Try these steps! For fun but motivational.

Go to this link. http://nbviewer.ipython.org/

It looks like a google search engine. In the search box, paste this link now, https://gist.github.com/asmind/8667c570b20ecae8f50d

And … Voila!

See what it is? That’s my new IPython Notebook I created while learning. It is such a magic. You know what all I needed to do?

First launch an IPython Notebook session from terminal using ipython notebook --pylab from the directory of my choice.

The --pylab imports a python library called PyLab and keeps ready for you almost all the packages sufficient for some serious scientific computing, including matplotlib. Learn what matplotlib is on this wiki page.

The command above launches a web browser where the new IPython Notebook appears, whose address bar is a local address. Click on the NEW button on the right, it creates a new notebook.

Do whatever you want to do in it including writing python code, writing markdown docs, executing normal terminal commands, etc and it is autosaved. Give a title on top (click on UNTITLED on top). Autosaved again!

Close it!

Go to the folder where it saved this file as Ex: IPy Intro.ipynb

Double click and it opens in gedit. This is actually a JSON file (I am yet to learn this part though, that doesn’t stop me from writing). Paste the entire content of this file in http://gist.github.com

Now Create a Public or Private Gist (see the options below the box where you pasted your text). This creates a Git Gist link which is what I shared above. This JSON file when you open it in the way I showed above (before Voila), opens like an IPython Notebook. This way, any number of people can collaborate on this work. Isn’t this magic?

IPython, my latest love!

This is it for now. I am losing my mind…..

##__To be Continued …. !!!

Some things cool about IPython

alt text

I am a novice in the land of Programming. I am truly enjoying it.

This and the future posts on this kind of subject are only for novices like me. Pros, geeks and wizards, please stay away. You will only end up laughing. ;-)

IPython is powerful. Who am I say this, when there giants using it for gigantic projects!

I am learning it and one of the first best learning resources I found really interesting is the 2012 SciPy Conf, “Intro to NumPy and MatplotLib by Eric Jones”. Really compelling way of presenting such a technical topic! I made a note of some important usage of IPython beyond the anticipated. I am jotting them down here for my own reference, more than boasting of teaching others.

Launch IPython

Obviously the beginning is to launch the environment or whatever you call it. I don’t even know if I am right calling it an environment, but I thought of the word instantly after watching this lecture for sometime.

Before we launch, let me share a couple more points here. Most generally, programming task expects you to have 3 things ready:

  • your favorite text editor (I personally like nano if I am just playing on the shell).
  • a terminal sort of shell that enables files/directories navigation.
  • and an IDE that interacts with compilers instantly whichever is the language (PyCharm for Python, RStudi for R, etc.).

All these along with a vast number of other utilities such as libraries, add-ons etc. are packaged now, especially for python. Two of the most known among those bundles are Anaconda Python Distribution and Enthought Canopy.

These come as one tarball when you download and with one install command, they create a whole new workspace (or environment) for you to play with almost anything that is possible with python. But it doesn’t matter if you don’t have them. You can still have the required stuff manually one by one downloaded and installed from your terminal.

Just install SciPy from their website here, it comes along with scipy, numpy, matplotlib, the coolest IPython and a huge number of other features.

Back to launching ipython for some math, sci-fi stuff like plotting and visualization tasks.

First, if you are on Linux, go to terminal and type ipython --pylab.

Or if you are on windows, type ipython -pylab.

What this command does is to load your IPython session power-packed. That means it automatically makes ready the essential stuff like, numpy, matplotlib, etc. already loaded. If you just typed ipython and hit enter, you would end up having to type import numpy, import matplotlib, etc. everytime you needed their functionalities in your coding. So the first powerful feature of IPython is the command ipython --pylab. So much about launching an app!

Some Small BIG things you can do with IPython

1. WHOS & RESET Commands

The next cool thing about IPython is the command whos.

This gives you the list of variables you created so far in the current session. There already are many other IDEs or shells that may have this sort of feature, but I still like it when IPython does it.

The output of whos, it reminds me of how MySQL responds in a similar situation. I don’t know how MySQL understands things, but you ask for its version currently installed on the machine, the current time or date, or anything for that matter (any Query technically speaking), it always shows you all of its output in a data table format.

The whos command output looks pretty much the same. The opposite of whos is reset which deletes all the variables created so far. Nice!

We will continue more on this in another post!

Just Learned VIM in 10 min

alt text

On the offset, I wrote this post in VIM. Thanks to Henrik Huttunen for this new skill of mine.

As part of making-myself process, one of the most brilliant things I have ever come across in my life is this VIM Tutorial. I truly feel enlightened to think that there are so many people out there who just create things not just for the heck of doing it, but rather to help a bunch of unknown friends in this world. Their outreach is so overarching that I wonder what gives them this kind of problem-solving attitude and a heart of contributing to the world voluntarily, with no expectations whatsoever. Is this is a phenomenon hardwired in their minds, a DNA transmitted from generations or their experiences that drive them to ideas like this.

One of the lessons in this tutorial talks about two shortcut keys in VIM editor:

  • 'o' which inserts a line and puts you in --INSERT-- mode enabling you to write the content.
  • 'O' which does the same thing but inserting a line before your current position.

And the lesson ends with a line that says,

I bet you feel like O_ _ _o

And I truly felt that.

Other truly interactive lessons include:

1. VIM - 3 Incarnations:

  • VIM’s Normal mode: Lets you use all the VIM commands/shortcuts.
  • VIM’s --INSERT-- mode: Lets you write and edit content.
  • VIM’s --VISUAL-- mode: Lets you select text and manipulate.

2. Write (edit), Conquer (save) & Go (quit):

  • Type :w to save the work.
  • Type :q to quit VIM after saving.
  • Type :q! to quit without saving.
  • Type :wq to save and quit.
  • Add ! to force these commands.

3. Plucking out the arrow keys on your keyboard:

  • Moving your cursor in normal mode:
    • h for moving left
    • l for moving right
    • j for moving down
    • k for moving up

4. Letters speak louder than Words:

  • Moving within your words in normal mode:
    • w for the first letter of the next Word
    • b for the beginning of the word
    • e for the end of the word

5. A Shocking Movement: w/ Numbers & Symbols

  • Numbers in VIM’s normal mode have additional meanings:
    • Typing 9w is pressing w nine times.
    • 6l is pressing l six times.
    • 5iAnand inserts my name Anand five times.
    • % takes you to parenthesis.
    • 0 and $ take you to the beginning and the end of a line, respectively.
    • gg takes you to the beginning of the file.
    • G takes you to the end of the file.
    • And 7G takes you to the line-7 in the file.

And a lot more like this. I think with this much, I am on the go!

For the entire power of VIM, here is an entire VIM Cheat Sheet.

I am not sure if I am going lost in an unfamiliar world of this kind of people full of activity, ideas and innovation. Or I perhaps have the weakness of despairing so much about myself when I encounter new knowledge that I get into this emotional roller-coaster.

But the fact is, these people remind me of how late I am and how much time I irrevocably left unused and unnoticed in my life. Despite the fact that these feelings are harder and deeper in my mind than the thoughts that would motivate me to just kick-restart my life all over again, I keep telling myself, Better late than never!

I strongly recommend all those school students who never had the privilege of playing with computers to go to this OpenVIM site and play around a bit with Writing content and editing it on just one window. Why, just do your homework in VIM and “dumbstrike” your teachers ;-).

I am sure this will take you to spaces and times where you will surely thank this guy and think of writing some code for scientific computing and hi-fi simulation tasks. Not only that, visiting this kind of websites nurture and nourish your minds and lead you to the ideas never imagines and thoughts of living in this beautiful wonderland of truly Open Source World.

Mind Chaos

I’ve never been so frustrated.

I sat in a meeting for over 2 hours today where my juniors, juniors by more than 8-10 years, have talked things that sounded like Latin to me. They were talking about product development, cloud deployment, architectural features, storage and browser optimization, testing tools, version control systems, saas and pass conventions, code review processes, … computers and coding and software and IT. Giant dispair.

Not that I never sat in a meeting like this before. But I’ve never been so frustrated before.

Sometime ago, I wrote a similar scribble and published for public view. It was about not letting the system and concept of education touch me. My life has become worse from bad after coming out of university system. Nothing to blame the system, I suppose. Because the same system is still producing a lot of other potential employees for today’s globalized world (whether we like it or not) and today’s corporate world (whether I like it or not). There is something wrong with me at the subconscious level.

But I’ve never been so frustrated, ever, with myself. Especially because I proved myself hundredth time that I have never made an effort to learn a thing that gives me a conventional identity. For this topic at least, the conventional identity I am talking about is a computer programmer’s identity.


I had over 12 years very much in my hands after I realized that the world needed programmers, software developers, data analysts. Of course with a scientific bent and scientific educational background, preferably with technical degree. Unlike mine! I didn’t ever bother to use a minute of that frustratingly long time span.

I had a minimum of 8 years still in my own hands after I directly witnessed my friends and peers choosing the world of technology, while I preferred basic sciences to anything that had to do with the two letters - IT. It was almost 8 years ago, I should have thought, there could be a reason why the whole young world moved towards a thing which I couldn’t smoothly come in terms with.

I had at least 5 years in the same hands after I found out that my mathematical skills would take me nowhere. Being a traditional programmer is far too unspeakable, but I utterly flunked at planning my own life, including monthly budget. Something was gradually making incapable of simplest things, rather periodically. Never afforded learning math, never attempted being logical in life.

I had exactly 4 years with me after I came to know another thing. The communication skills I though I possessed were awfully insufficient to be employed in roles where my communication could be applied. Never tried to be aggressive and creative enough to make a significant contribution to a company’s business communications.

I had over 3 years after I realized that if I didn’t work out on transforming myself into a tech guy with programming skills, I should at least work on getting myself certified on technical aspects of contemporary corporate world. Such as regulatory affairs, project management, science communication, technical writing, quality assurance, proposal management, etc. Never worked enough on it too.

I had a week after I sincerely thought of beginning to learn the invincible C-language. This is a growth in my thought process, I am forced to say, especially after having tried my hands at learning Maxima, Python and R. Other than installing a compiler and an IDE, besides downloading some very interesting ebooks, I haven’t done much. Never thought I could come up til here though.

I had a couple of hours after I was confirmed to be a layman in this world, who either doesn’t have a space to stand, or has all the barren land to live on. I could have forgotten this frustration within this time, like I almost always did.


For a striking whip on my back, I thought I should keep reminding myself of what I have done with so much of time in my life. This helps particularly because it is in public. Not that a lot of them come to read it here, but the sense of public view might keep me awake. I know I am taking a big risk.

I never imagined not being logical would matter so much for life. I never imagined my most cherished dearest emotions would stand against me and ruthlessly throw me in the market place as an insignificant, unusable, rugged, and rusted lifeless utensil.

More seriously, I never imagined that not learning programming and IT skills would make me feel so out of place. Philosophy was perhaps once the subject that transcending all the known topics on this planet, all that was possible within human mind. I feel it is all about computers and computing now, no more philosophizing.

In the process of deepening my frustration, scratching crazily on my wounds and intensifying my pain, which I seemed to have been quite enjoying lately, I felt one thing. Either of the facts is trues.

  • I must have chosen a domain where I don’t belong.
  • I must have never realized where I really belonged.
  • I must have spent my time in thinking too hard instead of trying hard enough to belong somewhere.

While I complete writing this, hopefully without having edit it again, I feel another thing. An epic transformation process is on the way. That said, I sound like I am still waiting for something else to happen. Giving up on emotions to build up on logical self, thereby substantiating an unshakable balance between them. This is perhaps all about enlightenment.

Anyway, let me not even utter such words from now. Focus on action, not on beautifying their essence. It doesn’t need talking. It actually shouldn’t have any talking. It is all about just doing.

And doing … and doing!

Fractals

Beauty lies in the eyes of the beholder.

I strongly believe that mathematics is nothing but intuition. One of the reasons that laid a foundation for such belief was when I encountered some qualitative knowledge of the fractal and how it came to be discovered.

Professor Benoit Mandelbrot, as Wikipedia says, was a Polish-born French and American mathematician. I heard only a part of it.

He was a mathematician.

Exaggerated, but not surprising that he used his mathematics genius to give a description of a piece of broken stone. His obsession with describing the shapes of broken pieces connected the world of complexity with simplicity (But it needs skill to see that connection, of course).

Talking about chaos in nature, messiness all around and his love for, on contrary, clear and regular-shaped objects like circles and ellipses, I read somewhere that he considered himself a mathematical scientist, not applied or any other scientist. Moreover, that was his designation at Yale University, deliberately chosen to be ambiguous. But to make it more sensible, he was a philosopher, a physicist, an economist and an artist.

Look at a tree dividing into branches, look at a branch dividing into sub-branches, look at the sub-branches dividing into smaller sub-branches, look at them dividing into tiny branches that carry the leaves, look at the leaves dividing inside into nerve-like pattern that resembled dividing branches again, so on and so forth. Nature is complex, it is messy.

But the messiness has pattern, complexity has order, a broken stone’s roughness could be well described. The bronchioli and the alveoli in lungs have this pattern. Price changes in financial markets have this pattern. Bones have patterns, microscopically viewed. Helical molecules inside cells have it. In our day-to-day philosophical contemplation too, (if anybody still does this anymore) has a pattern. Elementary particle paths after collisions have predictable shapes.

All matter has pattern. The landscapes on the earth, the galaxies in the universe have it. Maybe once photographed, blackholes might be seen having patterns. The earth as a whole has it. The waves on Jupiter have it. Music has it. Water waves have it. The surface of a broken stone has it. The broken stone is called fractus in Latin. Professor Mandelbrot picked it to name his mind-breaking universal concept of geometry. The so called fractal patterns!

I like to think that it is left to the mind that perceives things and life.

Why nobody else but a few aristocratic fellow humans could see things that not everybody could see? Therefore, can I call it intuition. Put things in perspective, put intuition in numbers and equations, and say,

Let there be mathematics!

Not everybody has such vision, such vigor. Especially in contemporary world full of 5 to 10 inch smart phones that don’t fit in pockets, we have no such leisure.