Monday, February 10, 2014

Gift a Martian pet this Valentine : Guaranteed delivery on today's order

Goal : Practice writing good headlines. 


Notes taken while listening to the Copyblogger podcast.

Ps of writing great Copy
  • Promise : You deliver the promise by a great headline
      The 4 U's of writing a great promise
  1. Ultra specific
  2. Unique
  3. Urgent
  4. Useful
  • Paint the picture
  • Proof
  • Push


How to test it

  • Write a persuasive headline about something completely fictional so everybody understands it's not true, yet they are compelled to read the blog
  • Write down the various blog headlines as I work through them
  • Write down how & why each was rejected or improved upon


O.K. Lets get down to work now

What is the promise ? Let's write the 4 U's :
  1. Ultraspecific : 4 facts or something like that
  2. Unique : Alien bugs - like from Mars ?
  3. Useful : hmm... buying ? How to buy martian pets ? That's useful, not often on the shopping list ?
  4. Urgent : Not all martian pets are safe to buy over the internet, some have Vulcan friends..need to warn fellow earthlings before they get one home !


All right, lets write some headlines. Here we go..
  • 4 facts about Alien pets you should know before Christmas 2014 (Buying is implied. Not bad for a first try ?)
  • 4 facts about Alien pets you should know before 2014 Christmas (2014 should come as early in the conversation as possible.. I guess..)
  • 4 facts about Alien pets you should hide before 2014 Christmas (Is knowing more urgent or hiding it ?)
  • 4 facts about Alien pets you should know before 2014 Christmas  (naah.. knowing is better)
  • 4 facts about Martian pets you should know before 2014 Christmas  (I think "Martian" is more specific. You don't want a pet from Jupiter. Jupiter has 2.53 times the gravity on earth. That means the muscles on that pet are wayy.. powerful. Plus the pet would feel it is high all the time, bouncing on the earth with lower gravity that is.. STOP. Getting back to the blog.)
  • Martian pets : A buying guide of 2014 Christmas - 4 facts to know (Is a guide better)
  • 4 facts to check before buying a Martian pets this Christmas
  • Do Martian pets beat your fluffy cats in cuteness ? (interesting.. you lost "useful" & "urgent" though.. dag gone..)
  • Is gifting a Martian pet better than a cute cat ? (o.k... "urgent" ?)
  • Is gifting a Martian pet this Valentine's day better than a cute cat ? (order of words ? & feels too long. Like the Valentine day idea, much closer.)
  • Pet from Mars or a cute cat : what to get her this Valentine ? (Mars vs. "Martian" seems lot cleaner.. anything to take out of this sentence ?)
  • Gift her a cute pet from Mars this Valentine : next day delivery ( :) getting somewhere )
  • Gift her a cute pet from Mars this Valentine : Guaranteed delivery if order placed in the next 2 hours ( nice.. but too long )
  • Gift a cute pet from Mars this Valentine : Guaranteed delivery on today's order ( this looks good. No word left to remove. Hits all the points. )
  • Gift a Martian pet this Valentine : Guaranteed delivery on today's order ( this looks good too.. torn.. flip a coin.. )

Whatcha think ? Let me know :

  • Which of the above would you choose if not the last one ?
  • Do you have your own twist on this ! a better one !
  • What could I have done better ?

P.S : Now now.. don't you get all teary eyed on me for the cute fluffy martian buggers. They are out of stock for the rest of century.

:)




Monday, December 23, 2013

You Know

First You Know
then you think
then you struggle
then you slow down
you      then     think      carefully
then You Know.....   again
this knowledge invites happiness
then you quote
then you struggle


you      then     think      carefully
then You Know.....   again

Saturday, December 14, 2013

On the fallacy of "acting like a grown up"

There are two types of people around us.
One, who act like a grown up.
The other, who don't act.

People who act like a grown-up are confused about the notion.
They think something happens when they pass a certain number of times around the sun.
As if every time you go around the sun, the smile on your face should slowly dissolve into a serious expression.
The spring in the step, should slow down to a measured draw.

They emulate someone else they saw while they were young.
That someone else at that time seemed all-in-control and "grown up".
A lack of introspection lead them to believe that acting like being in control, is in fact the real thing.

We see these people all the time around us.
They will stand on the side, afraid to make mistakes.
Afraid to loose a game they have never played.
Asking themselves the same question "What will the grown-ups think ?"
"Would the grown-ups do this ?"

And then there are those who do introspect.
They know "grown-ups" is a mythical creature.
That our emotional maturity doesn't depend on what someone else thinks.
Because "someone else" hasn't got the time to look at them.
That "someone else", is too busy looking at themselves.
Or worst, looking at themselves in someone else's eyes.

So to all standing on the sidelines - you are grown up.
No one needs to assert it other than yourself.

Loose yourself a little.
Join the crowd if you enjoy the dance.
If you don't enjoy it, that's fine too, you will find something else for the child inside you.

Friday, December 6, 2013

Body guards in heaven

Went to heaven one night
but it was light all right
and knocked on the door
to find they were closed

So I stood outside,
While the sun silently snored,
And stars blinked sleepishly
for my fortunately soul

I peeped'n through the opening,
and saw the whole roll,
fat lawyers and skinny singers
and their body-guards with holes

I said to myself
"buddy, you're dreamin' a lot"
You ain't sinned enough yet
to earn ticket to this hall

So I came down to mother earth
and slept on its grass
it was one of those nights
but it was light all right..

Wednesday, December 4, 2013

On Doubt and Faith

Doubt.
It isn't useful in itself, unless faith stems from it.

Imagine two mountains and you are on one of them.
To get to the other side, you want to build a bridge.
You can start on the side you are.

Doubt is like a bridge.

It appears in the form of a seed.
Then it grows into a brick that can break your previous ideas, conceptions, patterns, etc.
Then it starts growing.. taking the shape of a bridge.

The more you think the more rapidly the bridge grows.
It starts out slowly and then it catches speed.
Faster and faster.
Then it starts to slow down, as if the concrete in this bridge has started solidifying.
Then it comes to a point where it just stops.

When you stand at the edge of this bridge, the other mountain seems closer.
You can see some trees as well, make out their branches as well.
But you can't jump, this bridge is still too short.
If you stop now, then all your synthesis & analysis would go waste.

I think that's what happens in most of the cases.

But sometimes, we don't abandon the bridge.
Those times, we pick one of the few possibilities and start following them.
Imagine these possibilities as extensions of the bridge.
You can't see if they do end up on the other mountain but they certainly take you farther than your doubts.
There is one difference though.
These extensions are not permanent, you can stand/walk on them just as long as you keep moving forward; or keep actively exploring the doubt.
As soon as you stop, you are back on the bridge.

Eventually one of the extensions leads to the other side and the bridge of Doubts becomes a 4 lane highway; solid and stable.

Doubt in it self would never lead us to the other side.
Doubt plus these extensions will.
These extensions are, as I understand them, faith.

Doubt alone is akin to surrender.

Doubt is a journey.
It should always be.
It should never be a destination.
Else we'll never be able to get to the other side.
Else, we'll all be sitting at the edge of a half finished bridge.. looking at a mountain we'll never be able to explore..

Monday, December 2, 2013

What people should we surround ourselves with

Average time on this planet : ~28,000 days (see foot notes)
Leave out the first 15 years : ~22,500 days
Leave out the 1/3 time we'll spend sleeping : 15,000 days

In these 15,000 days we have a choice everyday.
A choice, about what people we want to engage most ?
This decision will influence our goals, our peace of mind, and most importantly our happiness.

Always being surrounded by good people helps us :

  • Lead a genuine & conscious life
  • Create long lasting friendships
  • Connect deeply with others
  • Each meeting with them is fulfilling and filled with experiences to remember

Below is what I've learned and continue to learn.

I follow the basic rule of "remove the bad & increase the good".

Eliminations - Reduce the time you spend with these

1. Run away from pretentiousness and pretentious people.

2. People with bad habits making no attempt on improving them.

3. Impatient people - usually accompanied with curse words :) 
Their is a prayer in Aitreya Upanishad with the first line as "Vang mA Manasi Pratishthitā" - meaning let my speech be established in my mind. (See full prayer in the foot notes)

I think it's very important to use good words because unconsciously all our words do affect our mind & body.

Our biggest achievement has been to know that our mind can alter our body and our body can alter our minds.

Speak as if every sentence you utter is a wish that will be fulfilled..


5. People who are late all the time; repeat - "all the time". It's understandable that people are late some times.

But if they are late all the time then it usually means that they don't value your time and probably theirs either.

6. People who gossip or discuss a lot about other people
If they talk down or controversial about their friends or family. And won't say it to their face.

This usually shows a lack of character.


Discuss ideas or at the most news, discussing people is a waste of time, unless you are actively trying to help the person.


Additions - Spend more time with them

1. People who express original thoughts.

Not to confuse with those who throw facts around. Facts can be read freely EVERYWHERE !

Original thoughts come when facts are sought after, understood, thought out and distilled internally.

2. People who are genuinely helpful. They usually form deep relationships.

If they are pretentious or associate with pretentious people all the time then I try to avoid them.

Since mostly their helpfulness is not sincere and just a facade.

3. People who are continuously improving themselves.

Either professionally (trainings, certifications, etc..)
Or personally : reading books outside their work circle, exploring things they haven't done earlier.

These people love gathering new experiences rather than "things".
They are usually open minded and accepting of opposing thoughts and views.


As always, feel free to poke holes.
Always eager for thoughtful criticism :)





Foot notes
Mantra from Rig Veda (Aitreya Upanishad)

ॐ वाङ् मे मनसि प्रतिष्ठिता ।
मनो मे वाचि प्रतिष्ठितम् ।
आविराविर्म एधि । 
वेदस्य म आणीस्थः ।
श्रुतं मे मा प्रहासीः 
अनेनाधीतेनाहोरात्रान्सन्दधामि ।

Meaning:
1: Om, Let My Speech be Established in My Mind,
2: Let My Mind be Established in My Speech,
3: Let the Knowledge of the Self-Manifest Atman Grow in Me,
4: Let My Mind and Speech be the Support to Experience the Knowledge of the Vedas,
5: Let what is Heard by Me (from the Vedas) be Not a mere Appearance ...
6: ... but what is Gained by Studying Day and Night be Retained.




Time on planet earth
These are rough calculations.
Average life expectancy of Males in US = 76 years
Number of days = 76 * 365 = 27,740 = ~28,000
If you are a women, you're lucky :) you get ~1800 more days !


Wednesday, November 20, 2013

Evolution in a single lifetime

First.... You Are
Then you are curious
Then you love
Then you love & hate
Interspersed with indifference
Then you Love Strongly & Hate Strongly
Then you know
Then you Love Strongly & hate in moderation
Then you know more
Then you only Love Strongly
Then you Really Know
Then.... You Are

Monday, November 18, 2013

Breaking boundaries by adding constraints

After a while it's no fun to start painting on a clean canvas or a clean page.
You make an existing painting or photo your canvas and start creating on it.
Your now bound.
You've created a constraint and have to create within those confines.
You've given your creativity a new challenge.
Forcing your brain to stretch its hand, but not with enough space..
I can see it sitting in a box and trying to stretch it's hand.
Getting closer to one end so the hand can extend fully in the other corner.

Adding a constraint has made me break boundaries.
My boundary was to capture the world exactly as it is on the film..
The constraint is to only capture the most vital bold stroke and not put time capturing every small detail.

The broad strokes capture 20%
The rest 80% on post processing.


This is the image I captured for the shadows and how they play on the buildings




This is how I drew the shadows out to show their importance 

Wednesday, July 3, 2013

Emails Anonymous : Taming the monster within


For the last couple of years I've gotten over my addiction to reading emails every now & then and more importantly keeping the number of emails in my inbox in control.

A simple routine of  How to read them has removed my daily work life free of the toxicity by emails.

Does this require discipline ? Yes, LOADS, but then what important thing in life doesn't ?

As a project manager communication-management is one of the most important things I do on a daily basis.
Email is no doubt one of the top segments of communications.

I try to utilize face-to-face, phone & chat more than the email since it is more efficient, but emails seem to be inevitable ( Perils of 20xx :) )
I'm trying to check emails roughly 6 times thoroughly during the day - 5-10 mins. each.
This is important for me since I want to make sure I'm providing everything my team needs as soon as possible.
Remember as a Project manager, majority of the work will be performed by your team and you need to be there to monitor & remove any hurdles that come their way.

Here is what I do when I check emails :
a.) Sort emails by subject
b.) Open the latest in the thread (take steps given below)
c.) Move all the rest in the thread to my personal "archive" folder.

For each email I open, I take an action and do not close it unless that is done. I don't want to just "read" an email - serious NO NO.
Remember an office email is sent to you to move some task forward towards completion.
Read the above again ! Slowly this time & let it sink it.
An email has to move the conversation ahead !

Which implies that you too should never send an email unless you want to move something ahead and want the other person to take an action. Ideally you would call out the action expected from the other person.


o.k. Coming back to the point of what to do when you open an email.

Each email falls into four categories :
1.) An action needs to be taken by you - note it in your "My tasks" list. Move it to the relevant project folder, if this isn't a project, move to archive directory
2.) You need to assign a task to someone
a.) Forward them the email.
b.) If you know the exact date by when the action needs to be completed : Add a reminder for you & the assigned person for follow-backs.
In outlook click on the follow-up --> Custom option and set the date AND time when you want to be remided about this
c.) If you don't know the exact date by when the action needs to be taken : Ask the person about the estimate. And add a reminder for yourself to check back on it after a specific time.
Again, In outlook, click on the follow-up --> Custom option and set the date AND time when you want to be remided about this
c.) Note this action item in the "Other people task list"
d.) Move to archive
3.) The email has reference information - which you can use later
a.) Move to the relevant "Reference" folder. e.g. Technical, Resource Management, Appraisal, etc.
4.) None of the aboveIf the email doesn't fall into either of the above criteria, in 99% of the cases they aren't useful - you probably know exactly what these are have quite a few in your inbox :) Yes, I just delete them. Haven't ever had an issue.
"Uhh... the happiness of deleting these emails.."
Unless you get a ton of those and have a filter for them ;)
In which case "Uhh... the happiness of emptying the TAT folder.".
        Where TAT = "Thou art Terrible" :)

I've been trying to follow just these simple 4 steps and have controlled the email monster for the last couple of years.

Is this the only way to slay the daemon ? Heck no, let me know your email-hunting war stories :)


Saturday, April 20, 2013

How to host your site for free for 2 years - including a new domain

This would help you, if : 
1.) You want to start a new site
2.) Have an existing site and either want to switch or try a new hosting solution


Background in short


I wanted to try out my new idea but didn't want to blow up a lot of money on either buying a domain or hosting it.

Reason being if it does work out, money wasn't going to be a problem but if it doesn't then I don't have to feel bad about losing the money as well.

Bottom line - wanted the domain & host it for free or as cheap as possible but with a decent hosting solution.


Breakthrough

I saw that CashBackHouse was giving $100 cash back on ipage (hosting solution). I actually got $105 back ( but that is another blog :) )

Checked the reviews for ipage and they seemed decent & fit my bill. My needs were simple this time - php/mysql, phpmyadmin, an out of the box wordpress installation & 24x7 chat support(must-have).


The numbers - hosting service

Cost/month : $3
Cost/year : $36
Cost for 2 years : $72

So after getting my cash back I would still have $28 extra ($100 - $72) !!

Domain

Next I started hunting for a domain.
With the taste of of cash back still fresh in my mind I wanted to find one which would fit in $28 & have some cash back.

Now, $28 is a lot for a domain ! plus anyways I was going to transfer it to ipage, hence didn't really worry about who I got it from ;)

Godaddy was giving the domain for $28.34 for 2 years.
And CashBackHouse was giving 27% cash back.


The numbers  - Domain

Cost for 2 years : $28.24
Cash back (27%) : $7.65
Actual cost after cash back : $20.69

:))

Bottom line : I'd still have $7.31 ($28 - $20.69) even after using the domain & hosting for 2 years !!!!

Thought this might help all in the same boat as me.
With the domains & hosting squared I was free to work on the actual site.
Now I hope it lives not just for the 2 years but well past it..

Cheers


Update 1 : Confirmed that they(CashBackHouse) are still giving the cash back. Also, it seems they have a lot more hosting solutions listed than what I had been offered. 


Update 2 : Now they have domain.com as well, and per my calculations they seem cheaper than godaddy even with 18% cash back. Cool, someone's going to save more than what I did :)

Monday, March 18, 2013

Bach and Delving deep into oneself


I think Bach is like a Poetry.. You can interpret it in your own ways..
Mozart/Beethoven are like a beautiful song, sung very well..

I think I know why I like Bach more now..

I think there are two kinds of people when it comes to listening music in the broadest categories.
One who like musical instruments all by themselves.
While the other which feel a need for the human voice to be a part of the music, however small.

They say violin comes closest to the human voice, one wonders if that is the reason it is that popular.

There is no right/wrong or inferior/superior - It's all music..

I think one knows more about themselves after delving deeper into music or poetry.
It might be Bach or Ghalib, Mir or Firaq, but one does feel the need to.

It's almost as if you have been sitting on a bench for five hours and you stand up & stretch and discover that the bench actually has a latch which you can open..
Now the fun starts, you want to open the latch and look inside..
First you need to know this latch though :)
And then you finally open it to find all these different smaller boxes you never knew existed.
And right at the bottom of all these small boxes you find a latch that leads you to a basement :)

"Kitaab-e-Maazi Ke Panne UlaT Ke deKh Zaraa,
Na Jaane Kaunsa SapHa MuDaa Hua NiKaLe.."
[Sapha - Page; Kitaab-e-Maazi : The book of memories]

Monday, June 6, 2011

Ubuntu tips & tricks : Braindump

SSH disconnecting frequently
       1.) Add the below lines to /etc/ssh/sshd_config -
                      ClientAliveInterval 600
                      ClientAliveCountMax 3

       2.) Now restart the ssh deamon on ubuntu
                     sudo /etc/init.d/ssh restart

Install dig on Ubuntu
apt-get install dnsutils


How to find the version of ubuntu
cat /etc/lsb-release : This will give you the exact version, e.g. 9.10 & the name of the release. Btw, lsb means "Linux standard base"
32bit or 64 bits : uname -m
32bit or 64 bits : getconf LONG_BIT
I bet there are lot of other ways, but this works on the most basic stripped down ubuntu

Add user : sudo useradd -d /home/testuser -m testuser
     Here "testuser" is the name of the user being created.
Create a new group : groupadd mygroup
     Here "mygroup" is the name of group being created
     You can see the group by : less /etc/group
Add existing user to a groupuseradd -a -G mygroup testuser
     You can see what groups the user is in, by doing a "id testuser"


Sunday, May 15, 2011

Setting up a GIT server on Ubuntu

I have all my code in a GIT repository on my home machine.
Everytime I wanted to deploy the code for my pet project site I used to fire up winscp and copy the code manually to the server. Well, as anyone would guess this was not only inefficient but error prone. Also reverting back to an old version just in case I ran into issues used to be a series of deletes & copies of directories.

GIT to rescue
The "divineness" (you kidding me ! this is not a word !!), anyways, let me start again. The "divineness" in me finally made me create a git server on my hosting server (slicehost). BTW, 2 words for my hosting company(its long due), I wanted to have a linux server with full root access and do whatever I wanted. Maximum flexibility and control. Plus I wanted 24x7 support. Slicehost has both, their customer service is awesome !! I always log into their chat and ask them stuff and they go above and beyond everytime.

K, no further digressions, lets get dirty

Setting up you git server on Ubuntu
The first thing you need to do is to install git on the Ubuntu server. That's a breeze:
apt-get install git-core

Now lets setup a directory where git server will run out of -
mkdir /opt/gitrepo
cd /opt/gitrepo

Initialize git :
git init --bare
The --bare flag tells git that this is a brand new directory where git will be setup

Pushing to this repository from your home machine.
For the purpose of this post, lets assume I have my git running at c:\myrepo also I'm writing this from a windows machine, so I'm in my gitbash

k, the first thing is telling your machine the server location.
git remote add origin ssh://planet@mydomainname.com/opt/gitrepo
Lets go over the command :
git remote add origin : I'm adding the origin of this repository as
ssh://planet@mydomainname.com/opt/gitrepo : 
ssh is the protocol
planet : this is the user name
@mydomainname.com : Well this is the name of your slice where you are setting the git server
/opt/gitrepo : The location of the server repo base we setup earlier

Push it to the server
Now lets push the master branch on your home machine to the server :
git push origin master
** master = This is the master branch on the home machine.
If you want to push some other branch, say "currentWorkingBranch", then type :
git push origin currentWorkingBranch

Once you run the command you'll see compression of files and pushing them off to the server, the output will end with something like :
* [new branch]      master -> master
OR
* [new branch]      currentWorkingBranch -> currentWorkingBranch

Verify on the server
On your server, go to /opt/gitrepo and type :
git branch
and you should see the branches you have pushed till now.

Remember, if you list the directories you WON'T see your code files.
Again, you WON'T see your code files.
Why ? - Because this is a server. You files are present internally and there is no working branch, hence you will get an error if you try this :
git status

Now you'll want to extract data out of this server - Read clone
So lets do that.
For testing create /temp/temprepo
in that just type :
git clone /opt/gitrepo/ /tmp/temprepo/
Now list the files and you'll see your code in /tmp/temprepo

btw, if you want to checkout a particular branch from the server, then first create a branch where you want to have the data :
e.g.
git branch branch-April2011 origin/branch-April2011
now checkout this branch :
git checkout branch-April2011
That's it you should have cloned the data only for that repository

The irc channel #git on freenode is very helpful, I'd suggest checking it out if you get stuck.
Ofcourse you can ask me about this.

Wednesday, May 11, 2011

Types of personalities in a company

Listened to a great Podcast by Bill Gross @ Stanford university
After starting about 75 companies in 15 years (likes of Picassa, CitySearch, etc..) he had some great insight into types of people.

I found his definition of personalities a lot practical than various others I've come across by others.

I'll try to convey it here for people who don't want to listen to the whole 110 mins. (I highly highly recommend it)

Every person in the company is a blend of the 4 given below, finding the right balance is crucial and any one trait taken too far is detrimental :

Types

  • Entrepreneur
  • Producer
  • Administrator
  • Integrator

Quick description
  • Entrepreneur : The innovator. Simple enough.
  • Producer : The person who actually builds things. It might be a website, a tool, whatever, but this person is the one who actually believes in hands on building stuff. Not just talk.
  • Administrator : The bureaucrat. He wants to put processes in place. Its a good thing ! This person understands  that when things really scale they can't survive if there isn't a process in place.
  • Integrator : He is a more people person ( read balanced). He knows the Producers mostly want to get things done and the Administrator is always trying to put processes in place that slow him down, and all this while the Entrepreneur is building things in air and wants it to be practically embodied. The Integrator puts everyone in a room, brings the best out of each, draws agreement and makes sure no one kills each other 8-) According to Bill this is one of the very important qualities of a CEO.

Great encouraging talk. Thanks Stanford.

Monday, February 14, 2011

Nginx vs Apache : Is it fast, if yes, why ?

I've been using Nginx for my pet projects for the last 6/7 months and got swayed towards it due to the various "Nginx is wayyyy faster than apache" claims.

Wanted to know what exactly is Nginx doing differently, hence started digging and hence this post was born.

Apache can run in

  • multi-process or 
  • multi-threaded mode


While Nginx can run in -

  • single-threaded-event-driven
  • multi-threaded-event-driven ( for multi-core system )


Before we go any further. Lets make some basics clear.

What is a process and what is a thread ?
This was in our x86 architecture class, but hey it was ages ago, so heres the refresher - A copy from msdn -

Process
Each process provides the resources needed to execute a program. A process has a virtual address space, executable code, open handles to system objects, a security context, a unique process identifier, environment variables, a priority class, minimum and maximum working set sizes, and at least one thread of execution. Each process is started with a single thread, often called the primary thread, but can create additional threads from any of its threads.
Thread
A thread is the entity within a process that can be scheduled for execution. All threads of a process share its virtual address space and system resources. In addition, each thread maintains exception handlers, a scheduling priority, thread local storage, a unique thread identifier, and a set of structures the system will use to save the thread context until it is scheduled. The thread context includes the thread's set of machine registers, the kernel stack, a thread environment block, and a user stack in the address space of the thread's process. Threads can also have their own security context, which can be used for impersonating clients

Apache : Should I use Multi-processed (Prefork) or Multi-Threaded (Worker) apache ?
There is no simple answer, it depends on what traffic your site takes. In theory remember, creating/removing a process is costly. Threads are lightweight, but again if you spawn a huge number of threads you will likely start running out of virtual memory. For this reason Apache has a limit to the number of threads a process can spawn (default is somewhere around 50).

I've come across multi-processed instances taking a pretty good amount of traffic without a problem.


Nginx is different

Where Nginx differs is by using a different architecture - Event driven. Mostly you will be using the single-threaded-event-driven mode.

Now lets start dissecting "single-threaded-event-driven"
Single-threaded
Single-threaded you say ? From the above definition, the thread exists inside a process, so what the hell is single threaded.
Lets clarify here, every process has "atleast" one thread of execution. Hence when we say single threaded, it actually means "a single-thread inside a process".


Event Driven
      Event driven architecture heavily relies on Non-blocking IO, hence lets look at it first. This is 


Non-blocking IO
How the data comes into user space when a file is read -
USER space                 KERNEL SPACE
D < --- BUFF  | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE
< ---  BUFF | --> BUF ----> DEVICE

As you see, the data is first fetched by the kernel into its own buffer, after it has its buffer full, then your user-space buffer is filled.
The blocking happens when the kernel is filling its own buffer from the device.
In non-blocking IO, your program registers for an event, e.g. tell me when the data is available in the kernel buffer for "foo.txt". And then it goes on to do its own work, like building an http_request header etc. When the data is ready it reads the buffer and proceeds to other work. Remember it might have to do this a number of time, for e.g. if you are reading a 50 mb file and the kernel buffer is only 1 mb, you have to read it 50 times, and in between these 50 times, you are doing your other work. Making the user think that there was no waiting(blocking) for any io.
Linux nuance - When you register for a file descriptor (fd) you can then use the poll() function (linux) to see if any kernel buffers have any data ready. There is also an dpool() function, which is for "edge triggered poll". The difference is with poll, it will return all the events for all the registered events which have data. For ePoll, it will tell you only once for the once which have data, next time you poll it won't show it to you. So unless you read more data out of the kernel buffer and another event is triggered, you are going to get nothing back.
If interested, see full talk on this (length 29:33)
Now that we understand non-blocking IO, its easy to wrap your head around event based architecture.
In E-based arch. you register for various non-blocking operations, it might include reading a file, reading from a port, etc. Once you register, you go on to process other requests. When data is available from the disk, socket, etc. you work on it. e.g. if you are reading a file which is 10 MBs the first event might fire when 100kb might be read, you get what is available and go on to process a request for another user who might be trying to access another file which is 35MB in size. Your service doesn't wait for the full 10MB to be available.

Hope this helped clear some clutter. Or did it not ? Let me know.




References