Monday, August 18, 2014

Learned about OWIN and KATANA

I have been a long time user of Microsoft's ASP/ programming model for the web. ASP made web programming accessible for Visual Basic and Windows Desktop users. When was unveiled with .NET CLR, they chose an architecture based on Managed code. To bridge the primary user base of desktop developers to stateless web architecture, Microsoft created a Facade called Web Forms. Web-forms present a state-full event model on top of Stateless HTTP.

To implement custom programming models, they created Module pipeline and Handler infrastructure. Microsoft became the primary beneficiary  of Handlers by implementing all of their technology offerings  like  Aspx (PageHandlerFactory), asmx,svc, Ajax , mvc,WebApi etc,on Handlers  People implemented cross cutting concerns like SSL/Security,File uploads,Authentication etc,using Modules.

The IIS specificity is visible like a seam in these interfaces. Microsoft created OWIN as a mechanism to make application processing on the server more modular..Project KATANA is a set of open source tools meant for modular server architecture confirming to OWIN specification.

Katana contains

  • Application Frameworks (MVC,WebForms,WebAPI)
  • OWIN middleware 
  • Server Adapters (Adapters for IIS)
  • Servers (IIS,Cassini)
  • Hosts (Windows/Linux)

Why WebCast Slides are verbose?

A fortnight back, I happen to take a session in my company about JavaScript. The session titled, "JavaScript - Why it is the way it is?" talked about the rationale of JavaScript in way suitable for cognition. Or in a nutshell, session was all about the method behind the madness of JavaScript like Closures, Functions as Values, Prototype, Dynamic/Duck typing etc.

For the first time, I had to present before an audience present in the room and people who have logged through WebEx. Normally, I am an animated Kind of speaker who walks across the stage to delivery my presentation. I use gestures a lot while presenting. Foreseeing some challenges, I had to redo my presentation by making each bullet-ed points verbose. Number of Slides jumped from ten to thirty five. I had to write more sample programs to communicate the ideas across the wire.

The challenges for me were

  • I was forced to sit at a place and deliver the content ( I am not used to it)
  • I normally ask people questions and I could not do that
  • I was forced to speak slow 
  • I had to look at the screen and present it ( Only Occasional eye contact with my audience)
  • It was physical discomfort
A friend who has seen me live on stages made a remark that slides were verbose,this time. It was not the usual "me" was the core message. Yesterday, my friend who is supposed to take a follow up presentation did confide to me that he had to revamp his slides by putting verbiage for his wired audience. He feels that he also faces the same challenge which I faced. 

In a live presentation, Slides are meant to be a guide to your content. In a Webcast, it is supposed to contain some verbose content to make sense for the remote audience who do not have the  luxury of seeing you. Any thoughts?

Why I prefer Top Down Learning,Of late?

It is better to learn Science in a bottom up manner. Let's take the case of Physics. You start from basic stuff like Mass,Gravity,Weight, Force, Torque, Projectiles, Vectors, Optics,Electro Magenetic spectrum,Relativity, Quantum phenomena , Statistical techniques at the Sub atomic level, Electrical principles etc. to the area of your choice. The problem with this kind of approach is time consumption. It takes ages to reach some point of competence.

To be a scientist in natural sciences, u require comprehensiveness and deep idea about what is happening. Most college curriculum are meant to teach in a bottom up manner and their aim is to produce Physicists. 

Engineering is more of an applied science. We need to see the activities from a functional way. We are leveraging scientific principles to arrive at some kind of applications. With the help of tools and components, you can go a long way in achieving your objective. Trying to start at the  bottom and rolling it up is  a waste of time and not much progress can be achieved.

Of late, every body around me is enrolling themselves for Machine learning course delivered by Andrew Ng. Most of them drop out and those who finished are not able to leverage their knowledge in practical situations. The class is full of mathematical formalism and what really happening is, people are enjoying the formalism more than the application of machine learning in practical context. 

From Last November, I began to explore Machine learning by consulting some books which are meant for Programmers. "Programming Collective Intelligence" and "Machine Learning in Action"  primarily comes to my mind. These books focus on an algorithmic approach (as opposed to Mathematical approach) towards Machine learning. They do delve into mathematical details, only when it is absolutely necessary. With this top down approach, I could gain good confidence and learned even the Mathematical details behind by drilling down at a later stage, at my own pace. 

Similar approach of starting by doing in case of Electronics has also produced dividends for me. The Success of Arduino and Rasberry Pi is a testament for the success of top down approach. Why should we consider struggle to learn something as competence?!

Create something functional to speak the lingo of the trade. Tinker and explore. At a certain stage, drill down to understand the fundamental principles. You become a true Engineer. 

Return of the Common Gateway Interface?

The World Wide Web was conceived as a mechanism to exchange scientific content stored as documents encoded in the HTML format. It had provision to refer to other documents and images. Thus, it was static. The Common Gateway Interface (CGI)  was a mechanism which adds provision for dynamic content.

 In CGI, an agent (executable) for processing the content of the page can be placed on the server (cgi/bin directory)  and can be referred in the page as the processor (handler) for a form. When a form is submitted, the executable will be invoked by the Web Server with data about the Page passed as Environment variable. The output of the executable are captured by the server using I/O redirection and the content will be spit to the client by writing to the Socket  meant to transfer information to the Client.

Spawning process is an expensive proposition when RAM size was low and processors were having single core architecture. This led to the emergence of in-memory threaded architecture. NSAPI (NetScape),ISAPI,Mod-CGI (Apache) etc expected server agents to be packaged as DLL. This gave better performance compared to the CGI. But, data exchange was more or less similar. Instead of Environment variables, people began to use data structures ( key/value pairs) to exchange data between server and handler. The trend continued in the case of, Servlets/JSP.

Microsoft chose to bring back an executable in the whole puzzle to separate Web server and handler logic. They created worker process to isolate user driven  page processing logic  from the server address space. They further created AppDomains to give physical isolation between two web applications running inside the same worker process. Java could not provide physical isolation and instead used Class Loaders to provide logical isolation for web applications running under same JVM instance.

Now, we have got multi-processor and multi-core systems with lots of RAM. The emergence of Node.js like technologies brought focus on  single threaded architecture. They are good for I/O driven apps. We are expected to use a reverse proxy like NginX, Apache or IIS redirector etc to handle the high volume traffic and spawn Node.js interpeted handlers depending upon the load. This will help to leverage the multiple processors available on the server. I see Reverse Proxy coupled with Node.js executable spawning strategy as computationally very much similar to the CGI architecture. 

Thursday, August 14, 2014

Independence day - Not Just Another day!

Independence day means Republic of India survived one more year (67 years) as a political entity. It is celebrated by Political class and middle class, all across India. Some do pay tribute to the leaders of India's Independence movement.

India is a crowded country and population mass is high compared to other parts of the world. The Socio-economic progress made by the country has not percolated to all sections of Society. This gives rise to different kind of feelings among people about the day. Some sections feel that they have not got freedom to express themselves as a group and yet another feels that economic freedom is still far  away.

Individual freedom in India is one of the great asset which Independence has provided us. Because of the diverse nature of people, collective freedom is not great compared to Individual freedom. There are different ethnicity, communities, castes and religions in India. If people are given freedom to assemble along these entities, it can spell trouble. So, the political leaders take actions against such movements. In a democracy, numbers matter. So, rulers of the country are forced to take a partisan action depending upon the political demography, in the case of conflict between groups.

Freedom to express yourself is a difficult matter. Political class or the constitution does guarantee you that. Because of the conflict of interests between groups, to avoid violence, state has to intervene. By left to it's own, Indian system has performed well. But, Political class are vary about alienating their respective constituencies and disturbing electoral numbers. They are compelled to give instructions to favor one group over the other. Then, polarization of opinion happens on the issue. As a result of that, even people who enjoy Individual freedom complain that the state has breached their individual rights.

I celebrate Independence day because it has given me Individual freedom. When I mean Individual freedom, it is freedom to pursue anything I want. The problem can come when I try to spread or impose my likings to people around me. Understand that there is  freedom to pursue things at your own comfort. Stay within the limits of Individual freedom, you are good for foreseeable future.

Jai Hind!

Have Fun Today, Tomorrow You Might Die

Human beings are political by nature and it manifests in our thoughts and actions. Some people are so political that their whole day is spend on criticizing others or thinking of ways to criticize others. They are either people who were born with silver spoon or people who made it big by sheer chance of coincidence. The former behaves the way they are because of ignorance about most people's problem and the latter sees the former as perpetrator of the misery for others. Both find solace by proving a point or two against people whom they dislike.

People who are critical of others find critical analysis of others as the only source of fun. They honestly believe that they are changing the world through their actions. On the contrary, they are making their object of criticism stronger by influencing neutrals. Due to their constant harping, people find ways to see the object of criticism in a better light.

Some people believe that they live for ages and does not understand their waste of energy and time. I feel, we should not treat life too serious and focus on having fun, most often, within the limits of law. If you do not, you are not living life in the full.

Paradoxically, Failure makes good people!

We are trained to succeed and seems to have taken it seriously. Society rewards people who come first and it has been a winner takes it all kind of situation. Most success are not well worth the effort and sometimes it is even dangerous.

IMHO,"Success takes you to uncharted territories and Failure helps you to take stock of things around. In the case of Failure, you are parachuted to a territory which you are already familiar. Failure helps you to contemplate things. Success keeps you in some kind of worry about loosing it."

For people who are used to tasting success in their endeavors, one failure can cause severe distress. They take time to bounce back. The funny fact is, In modern times, you can fail more often than not, yet be a winner in life.

It is not the fame which matters in Social life. It is the degree of influence which you can have on number of lives around you matters. The most important thing in life is equilibrium of our body and soul. If our body is in a state where soul can be contemplative, it is the sweet spot you can be in.

A Mix of failure and success is really good for the soul and the body. That is why, average people are really happy about life than the extra ordinary souls.

Monday, August 11, 2014

Ohms law explained in Simple terms

Take any Electronics textbook, you will see the following three formulas
  • V = I x R
  • I =  V/R
  • R = V/I
V stands for potential difference between two points, I stands for current passed through two points and R stands for Resistance. There are units for V (Volts) , I (Ampere) and R (Ohms).

For Water to flow through a piper, the source end of the pipe should be at a height above the sink end. This is called Potential difference. The maximum permissible flow in seconds (without Resistance) is the Current. Resistance reduces the flow of the current. 

Ampere measures flow of Electricity ( Water through a tunnel ) in seconds. R measures Resistance to the flow of Electricity ( Resistance to the water flow ) and I measures potential for the flow of Electricity, If there is no Resistance (Filter or a Throttler for flow)

"Arduino/Rasberry Pi" - " Ruby On Rails" as a metaphor

Embedded software/hardware/firmware industry offers lot of options and opportunities for entry level professionals. There is a popular misconception that only people with Electronics or Computer Science education can do well in the industry. If  I am a Mechanical Engineering professional or Civil Engineer or person with education in Humanities, how can I get a  foothold in the Industry is a common question which I have come across.

Earlier, Electronics were studied in a bottom manner. You get a circuit diagram, buy components, assemble the circuit, solder it (or use a bread board) and test it etc are the steps which you have to take. Another option is buy some kit and assemble the Circuit. Seasoned Electronics enthusiast do feel that this is the only way to break into the Industry. But, this DIY approach is not very productive way to spend time.

Thanks to Arduino and Rasberry PI, you can take a top down approach to Electronics. You start from the Software side of it. Write your Logic and burn it into a Microcontroller/Microprocessor through a Programmer. These boards do have on the board Programmer ( Burner to the Flash memory). You can gain insight to the Command and Control aspects of Embedded development. You can get lot of insights into Electronics circuitry  in this process. If you want, you can drill down or come bottom up, after gaining some confidence.

In the 90s, learning C/C++ Programming was the best way to make it good in the IT industry. People used to learn assembler as well. An army of programmers (myself included!) used to think that this approach is the only way to learn programming. It was a bottom up approach. It is like buying micro-controller, auxiliary components, peripheral controller  to create a board first and then interface it with your development machine to learn Software/Firmware

Modern programmers start with Ruby on Rails and be productive by developing something tangible. Even-though lot of magic happens behind the scenes, you can produce usable software. This will give confidence to casual programmers. If they want, they can drill down.

Arduino and Raberry Pi are the "Ruby On Rails" of the embedded world. 

Friday, August 08, 2014

Outcome is more important than the intent

Most human beings do things for some kind of call from within in the context of gaining foot hold in scheme of affairs around them. The people around them perceive some kind of deliberate motives for every action of a person. The fact of the matter is most actions are dictated by the subconscious mind which has sensed some kind of exigency,threat or need etc

We are critical of most actions of others, especially, If we are acquainted to them.I have seen some actions which are simple has got remarkable effect on the lives of communities.

I have been proven wrong time and again about the significance of  certain actions and it's consequences. Too often,the acts which requires sophistication never reaches where it is meant to. Where as seemingly unimportant and simple acts produce outcomes which are having great Social significance.

Recently, thanks to an initiative by a group, a Police aid post was setup in the Technopark,Tri vandrum. I happen to see the news through Facebook. Couple of friends made remarks which are critical of people behind it and their motives. I was also swayed by them.

I met a key functionary of that initiative and he gave me the rationale behind this initiative. Ladies have faced harassment incidents around Technopark. Since "techies" are not united, they do not know where to report incidents to prevent future ones.

This made me believe that, "Outcome matters more than the intent". That does not mean intent is not important.

Monday, August 04, 2014

Some snaps from a Workshop on JS @ RSET,Kochi

Last Friday (August 1,2014), I was invited by IEEE student wing of Rajagiri School of Engineering and Technology to give  a workshop on JavaScript. I was representing my company,  UST Global in the event. I have taken four snaps and pasting it as a single photo here.

  • Top Left - Audience
  • Bottom Left - Praseed Pai
  • Top Right - Dr. Unnikrishnan (Principal) and Praseed Pai
  • Bottom Right - Shahim Baker (IEEE functionary) and Praseed Pai

Sunday, August 03, 2014

I want to be a Hanuman , But these people are making me a Batman/Spiderman

We are living in the world of innovations and each innovation changes life of countless people. Most innovations solve a pertinent problem and in the process,it can induce its own  set of problem for the future. Once a convenience has crept into human life, it is hard to dispose it.

Things like Google glass, Sixth sense and other wearable technologies will make us look like Spider-man, or a Batman with labyrinths of cloths with wearable devices.

Ideally speaking, I want to be a Hanuman with minimal dressing.

How Logic and Set Theory are great partners!

Logic and Set theory are dominant formalism in reasoning about  foundations of Mathematics and studying Mathematics. What might be the reason for this?

Even though, Aristotle is considered to be  the father of Logic in western science, Gotleb Frege is regarded as the father  of Modern Logic. Set theory was formalized by Georg Cantor.

Entities or Objects can be treated as members of  a set with some property. This can be used to reason about them. Thus, Set theory gives us objects to reason about.

Logic gives us science of  solid reasoning. Thus, can  be used to reason about Mathematical Objects reduced as set theoretic elements. Together, they give us  a way to approach Mathematics. Within the Logic, there is Propositional Calculus for reasoning about ground facts. Another formalism is Predicate Logic, where you can have support for Variables, Universal and Existential quantifiers and Inference.

Set Theory and First Order Predicate Logic (FOPL) are used in the study of Mathematics. The Programming Languge PROLOG is a by product  of  the notion,"Predicate Logic as a Programming Language".

Understanding vs study

Yesterday, I happen to see my Wife struggling with my Son on his Sanskrit and Mathematics lessons. My twelve year old son was constantly harping that he hate Mathematics as some of things do not make sense to him. I asked him what are those areas and he gave a long list of  theorems on  Angles and Triangles.

Then, he started crying that despite his numerous attempt to understand,things  are reaching dead end and it pains him a lot. He is a very curious boy and interested in conversations I am making with others over the phone. Amount of trivia he has accumulated over the years on movies, gadgets, automobiles etc ( I understand that it is common now a days among kids)  are impressive.

On quizzing I understood that he is not studying the subject. He tries to understand the subject. Anybody who has tried to understand the subject while in school or college have always failed to get good marks.

Academic study is all about hard work, patience, discipline and pleasing the masters. Repetition is the key to success. There is no harm or it is not bad to resort to "Mugging".

As you mug more and more, at some point of time understanding automatically comes. It is a trial and error progress.

Saturday, August 02, 2014

Competition to demonstrate who is a better Muslim is the root cause of rampant Islamic fundamentalism!

Over the phone, I was having a conversation with a friend of mine who is based out of Delhi. We were colleagues in a company and have maintained consistent relationship for more than thirteen years. He is a Muslim and we were discussing about an atheist (who was also a Muslim)  who changed remarkably after marrying from a conservative Muslim family.

The discussion spilled on to another person who decided to quit Whats-app because of  Ramzan. The reason given by him was obscene and filthy jokes against Islamic practices irritates him. After Ramzan, he did not get back to Whats-app. When probed, his reasons were,"As a practicing Muslim, I am not supposed to share jokes and enjoy jokes against others and it is sin". Then, my friend asked series of questions and he did not have much answers.

Considering something against one's own religion as blasphemy can cause emotional and economic problem. When I was in Japan, a Japanese guy asked me the following, "You have got a god which has got trunk like an Elephant, which is displayed everywhere in India. How about his urinating device? Is it like that of an Elephant?". I laughed along with him. Even If, my religious sensibility is hurt (which did not!), Can I expect an atheist Japanese national in Japan to understand my preferences?. At least, lot of people have told me that I should have reacted sharply to such a comment. Why should I? was my observation.

Among Muslims, there are different interpretations of being a Muslim. I think, there is a belief that people who play according to the book are believed to be more closer to prophet than people who pursue hedonism. Competition among Muslims to decide who is the best Muslim (which adheres to Hadith and Koran) creates a peer pressure kind of situation, for people who are not interested. To get acceptance in social circles, others also fall in line.

When the relative merits even out, people will raise the bar by becoming more and more conservative. Once the room from within runs out,the battle goes to issues which are not of immediate consequence. Israel/Hamas war, ISIS, American humiliation of Islam, Jihad etc. Then they will grow beard,wear short pants, pray five times a day even while in the office ( it is known as religious exhibitionism in non-Muslim circles) etc.

Peer pressure which is the cause of human progress is the same reason for rampant Islamic fundamentalism. Unless a moment within Islam starts  for becoming more fun loving without causing law and order problems, others in the world will  have sleepless nights. Of course, Women liberation is the easiest way to reverse this tide of Competitive Islam.

SQL vs NoSQL is Politics, not persistence

I have seen some people arguing on American elections in India. why should we argue in India? It is good to observe the development though. When Australia and England play cricket, we need to enjoy the game. But, by taking side, we are spoiling the party. I think, it is human to take sides, even if there is no stake.

Why do human take sides on issues which are remote to them?
Humans are political animals. There is tendency to impose will on others. Fearing social isolation, humans do hide their true wish in modern times. When you cannot impose your will  or opinion on others, you resort to symbolic means of doing it. If you arch enemy support Brazil in Soccer, you will tend to be an Argentine fan. If his favorite cine star is Will smith, you might like another etc. Because of this impulse among humans, some times People with so called liberal outlooks are worse than Chauvinists.

Let me comeback to my topic!

Relational database Technology is a  proven technology which has helped mankind to progress. Take any software system which does useful things at human (socio/economic) level, a RDBMS will be at the backend to store data. People have build fortunes and lives on the technology.

To get great skills in RDBMS, you require patience and opportunity ( luck?) . It is like a wicket keeper Job (Developer DBA) and only a few are required in a Metropolis. So large majority of application developers are critical of the undue influence of DBAs in corporate circles compared to other IT functions. Infrastructure is the only thing which could give some run for the money. With data gaining more importance and Cloud, IT infrastructure cannot compete with data specialists. Only difference this time is DB guys have to pick additional skills in Data Mining, Machine Learning tools and Visualization.

The contempt for the DBA becomes the contempt for his tool. It is a case of, "Confusing messenger for the message". Some thought, Object databases will replace RDBMS when the front ends got written in OOP languages. It did not go that way.

When applications were written in OOP languages, people were forced to do lot of repetitive coding to scatter a Object ( Value Object) to relational tables and gather it back as objects,for applications. This was an active area for automation and people began to see mapping opportunities between Objects (Hierarchical) and Relational (Flat/Tabular structure) constructs. They called it Object Relational Mapping (ORM). Hibernate in the java world, was the best of the breed which gave a solution,acceptable for production usage.

Ted Neward, even called , "ORM is the vietnam of Computer Science". ORM gives you programmer productivity at the cost of performance. Database camp and Application camp had some kind of war on this and consensus was that DB optimization is still a need of the hour. Write code using an ORM, find the hotspots and write hand crafted queries which utilizes indexes available. ( ORM produces full table scans and does not use indexes well )

When CAP conjecture on distributed systems, became a theorem, alternate database models began to make appearance. These alternate models were brought forward under one umberla serendipitously as "NoSQL" (Not only SQL).

For people who are only accustomed to Relational world, it gave an opportunity to brag about their new outlook and skill. NoSQL engines are good for internet software backends as data are in loose schema. Their Read performance and horizontal scalability gives them advantages in certain situations.

But, as usual, because of the urge to quarrel some people equated it with "NO to SQL". This is just a political craving. We should be comfortable with both and choose the persistence technology based on the context. Relational databases give you a shared ontology for people to relate to each other. NoSQL is relative chaotic and business applications which requires determinism will still prefer a Relational Engine.