How to become a better programmer by James Long

The original post is here.

I might have stumbled upon this via hackernews and this topic is of perennial interest to me. The general advice given were helpful. I liked the specific, measurable suggestions too. These were:

  • Learn C - I know C. I have written C. I will need to get back to writing in C.

  • Write a compiler - Not yet.

  • Learn macros - Not yet.

  • SICP - Not yet.

  • Understand continuations - Not yet.

  • If anything, just try a new language - I try this every now and then. The emphasis on his post were learning functional languages which, I think, I will be starting this year.

Introduction to Siddhartha Gautama Buddha and Buddhism

I listened to "Introduction to Siddhartha Gautama Buddha and Buddhism" at Khan Academy. It was consistent with what I had known about "Siddhartha". This 9 minute lesson dwells into core-idea and philosophy shared by Siddhartha pretty quickly and explains it succinctly.

Andrew Carnegie, an immigrant and child laborer.

We know of the Andrew Carnegie as the famous philanthropist who donated huge portions of his wealth for setting up public libraries across united states. What I was not aware was, he as an immigrant and a child laborer who got benefited from his reading, when one of his boss opened up his library on Saturdays for his workers.

Got to know this from a very tangential post titled Keep the Internet Open

From Alan Kay:

Yes -- in fact, the original notion about all this was to be in the same spirit as the 1936 Electrical and Telephone Federal Act which was specifically aimed at rural areas that the utilities didn't want to spend money to reach, so the fed mandated "power and phone" as a kind of universal right. This has also been a theme of the EFF. The basic impulse was also one of the drivers behind Carnegie's huge support of the free library system in the US (the whole story there is interesting, including some of the high minded stipulations in the Carnegie bequests, which I've on occasion tried to get the Internet communities to buy off on).

Every Carnegie library had to have two special rooms -- one just for children, and the other where people could be taught to read. Part of the Carnegie money for the libraries supported the reading teachers and sessions. Carnegie was an immigrant and child laborer who could read a little. One of his earliest bosses would open his home library to his workers on Saturdays. Carnegie used this to raise himself up, and never forgot how it happened. (He was also one of the few truly rich people ever who said he was going to give it all away to benefit the civilization around him, and actually did it.)

Analyzing the Smoky US Travel Ban imposed on refugees on March 6, 2017

I tried to determine the motivation behind a Travel Ban issued in US on March 6, 2017 against certain nations. I tried to read the document directly instead of being influenced by numerous news articles.

My reading of the document, whose entire text is available here, leads me to believe that this move is a vindictive, politically motivated, irrational and causes harm to everyone living in US (not just the citizens).

Let's try to analyze this rationally and ask questions.

Defend the poor and fatherless: do justice to the afflicted and needy

No matter what your identity is, as a human, you are taught to protect the weak, stand-up against cruelty. If you protect the weak when you are strong, rationally someone else will keep you safe when you come become in your old age.

Who are refugees and what is their process to come to the US?

Refugee a person who has been forced to leave their country to escape war, persecution, or natural disaster.

If you are a Tamil speaking person, you can identify the refugees as Sri Lankan Tamil's who fled to TamilNadu due to oppression based on race and language.

Safe and Sound nations welcome refugees as part of their commitment towards peace of the world.

  • India, after vetting, keeping in line with it's broad mindedness, welcomes refugees.

  • US follows a 2-year of vetting, and so far with it's broadmindedness has welcomed refugees too.

  • Britain, vets and welcomes them.

  • Australia, vets and welcomes them.

  • Germany, vets and welcomes them.

What happens when you block refugees from certain countries for a short period of time?

Nothing changes in practice. In theory, you create an opinion and give a signal to other countries and your territory is not a safe place. If that is not the situation, you are just oppressing the weak. This is happening with the United States banning people from certain nations.

  • It is politically motivated by a coward at the top of the government who signed this.

  • It is vindictive and reactionary to the defeat received from the judicial system trying to hold up humanities for the country.

  • It is creating divisive identity-politics, harboring people who side with racism and are phobic towards Islam religion in America.

  • It is giving way to hate crimes by racist-terrorists in America. Indians in first week of March 2017, were subjected to this with 2 deaths and 1 person wound with injuries due to racially induced gun-violence.

Now, to the text of this travel-ban:

https://www.whitehouse.gov/the-press-office/2017/03/06/executive-order-protecting-nation-foreign-terrorist-entry-united-states

The title says "Foreign Terrorists". In fact, US has 2 years to vet any applicant and determine if the person is a terrorist or not. This ban for 90 days is undermining the 2-years of vetting period.

The claim is:

It is therefore the policy of the United States to improve the screening and vetting
protocols and procedures associated with the visa-issuance process and the USRAP
  • What can a 90-day ban achieve, which could not be done for more than 730 days? The document fails to answer that.

Iran, Iraq, Libya, Somalia, Sudan, Syria, and Yemen.  These are countries that had already been
identified as presenting heightened concerns about terrorism and travel to the United States.
  • Where is the proof?

Additionally, Members of Congress have expressed concerns about screening and
vetting procedures following recent terrorist attacks in this country and in Europe.
  • What concern have they expressed and where is the proof? The terrorist attacks from the people of the above nation in US is 0. Why have not the members of congress raised concerns for racially induced gun-violence?

Nationals from the countries previously identified under section 217(a)(12) of the INA warrant additional scrutiny
in connection with our immigration policies because the conditions in these countries present heightened threats.
  • Where is the proof?

The following are brief descriptions, taken in part from the Department of State's Country Reports on Terrorism 2015 (June 2016), of some of the conditions in six of the previously designated countries that demonstrate why their nationals continue to present heightened risks to the security of the United States:

It then, provides snippets on the crimes committed by the Individuals from the countries.

We can look at the entire list, which is claimed as an authoritative reference: https://www.state.gov/j/ct/rls/crt/2015/

  • Why is it citing the reports from 2015 for a 90 day action in 2017?

  • There are other nations in the list, why pick up only 7?

  • What has changed in 1 months that a travel-ban on Iraq is no longer included and suddenly that is considered safe?

This is answered here.

In addition, since Executive Order 13769 was issued, the Iraqi government has expressly undertaken
steps to enhance travel documentation, information sharing, and the return of Iraqi nationals subject
to final orders of removal.  Decisions about issuance of visas or granting admission to Iraqi nationals
should be subjected to additional scrutiny to determine if applicants have connections with ISIS or
other terrorist organizations, or otherwise pose a risk to either national security or public safety.
  • If this is the case, just call the requirement that provide "travel documentation".

  • This still does not justify the prejudice displayed with countries as a whole.

The ban, tries to support itself by giving some examples like this.

Recent history shows that some of those who have entered the United States
through our immigration system have proved to be threats to our national security.

The incident is this one: https://en.wikipedia.org/wiki/2010_Portland_car_bomb_plot

  • The person involved did not have a ground from Somalia. What makes the claim that the entire country is at fault?

  • Why is the 2010 incident being referenced for this Ban? Where are the incidents for other countries?

These are the glaring holes in the document.This was signed by someone who did not take effort to read the document. It was prepared by the salespeople for money.

As new challenges crop up, this bad-act will be forgotten soon. Keeping quiet does not seem to be right thing to do. Let us be aware, spread correct information and help to bring bad-actors down.

Spirituality without Religion

Read a brian pickings article titled Neuroscientist Sam Harris on Happiness, Spirituality Without Religion, and How to Cultivate the Art of Presence

The essence of this was discovering that feeling in that a person feels extremely comfortable and happy with the self. That feeling is described using a loaded word called "spirituality" and associated with religion. For folks who have experienced it, it is not related to religion at all.

It is outside of it. It is an innate existential feeling that one can get, when a person is honest with his thoughts, feelings and happy for the present moment.

CPython moved to Github

CPython project moved it's source code hosting from self-hosted mercurial repository, at hg.python.org to Git version control system hosted at Github. The new location of python project is http://www.github.com/python/cpython

This is second big version control migration that is happening since I got involved. The first one was when we moved from svn to mercurial. Branches were sub-optimal in svn and we used svn-merge.py to merge across branches. Mercurial helped there and everyone got used to a distributed version control written in python, mercurial. It was interesting for me personally to compare mercurial with the other popular DVCS, git.

Over the years, Github has become popular place for developers to host their projects. They have constantly improved their service offering. Many python developers, got used to git version control system and found it's utility value too.

Two years ago, it was decided that Python will move to Git and Github. The effort was led by Bret Cannon assisted by number of other developers and the migration happened on Feb 10, 2017.

I helped with the migration too and helped with providing tool around converting the hg to git, using the facilities available from hg-git mercurial plugin.

We made use hg-git, and wrote some conversions scripts that could get us to the converted repo as we wanted.

  1. https://github.com/orsenthil/cpython-hg-to-git

  2. https://bitbucket.org/orsenthil/hg-git

Now that the migration is done, we are getting ourselves familiar to the new workflow.

Yashwant Kanetkar - Let Us C

I came across an article on Yashwant Kanetkar, and it rekindled many of my fond memories.

Let Us C is not merely a book, but a bible for millions of programmers in India.

That is true for me. I had read it during years 2000-2002, and I kept a count of it. I read, solved all the problems in that book for more than 100 times.

It has helped me a lot and I am indebted to that book.

The article on Yashwant Kanetkar was published in a Indian magazine, I made a copy of it, because, as you can imagine, I will cherish it.

I also watched a short talk by Yaashwant Kanetkar in which he explores his journey, and has some words of advice for programmers from India.

Who slides Wins

Few years ago, I wrote this n-puzzle using pygame for fun. It was inspired from the sliding block puzzle game that I had played as a kid, which had numerals in the front and a picture of taj mahal in the back. The idea was to slide and fit the photo together.

https://github.com/orsenthil/who-slides-wins

How to play

  1. Human plays first. Use Arrow Keys to Move and Fit the Picture.

  2. Press Enter when Done.

  3. Computer Plays and tries to beat you with less moves that you took.

It uses A* with Manhattan Distances to Solve the puzzle.

If you want to try it on your computer.

  1. Install python2.7

  2. Create a virtualenv.

  3. pip install pygame

  4. clone the git repo.

  5. python run_game.py

Deep Learner Playing Breakout

Let's first watch this video

In this video, I just gave the program a game and it learned to play by itself. No, I did not code the player, that would have been so traditional. Here the player, the computer, the program, actually learns to play by itself by just playing the game! It does not need me.

I recorded this video for experiencing how a Deep learning algorithm actually works. And as you can notice, it works amazingly! Deep learning is subset Artificial Intelligence that tries to show "intelligent behavior" by using something similar to (neural networks) human brains wiring. It uses mathematics, that we think, human brains internally use to exhibit rational thinking.

The results of these have been amazing. From beating go games (Thanks For Ruining Another Game Forever, Computers) , to making self-driving cars a possibility. The above video should give some idea that self-driving cars can learn about hurdles and try to navigate by itself.

How to setup your system for Deep Learning Experiment ?

I wish, you will be excited to replicate this experiment. If you are interested, here is how I setup.

1. Rent a GPU Instance from AWS or Azure. Right now, we need GPUS. They are very costly, but the deep learning frameworks are not optimized for CPUs. I spent multiple weeks of uptime on CPU without any results. Go for GPU. AWS Has it.

  1. Setup Ubuntu 14.04 with proper NVIDIA drivers.

  2. Install X11 and Window Manager. It wont be fun otherwise.

sudo apt-get install xubuntu-desktop xfce

4. Setup viewing your powerful "Cloud Desktop" using nomachine. Apparently, that's the best way I could setup remote graphic viewing.

  1. Clone the DeepMind-Atari-Deep-Q-Learner code.

  2. Install the dependencies.

./install_dependencies.sh
  1. And, as my son will say. Here you go!

./run_gpu breakout

You can exit nomachine with the program running, and constantly come back to monitor your computer trying to learn to play a game by itself.