reading-list


1
Oct 11

LATW Episode 10, (September 1-30, 2011)

Web Video Box Office

 

 

 

 

 

 

Image Gallery

image

Realistic Skin Rendering in WebGL

image

A rainbow cloud shimmers over Ethiopia

image

X-ray reveals hidden Goya painting

Science & Technology


1
Sep 11

How It May Work: Chat Client

Welcome to episode 1 of “How It May Work”, a web series where we try to make educated guesses on how software applications around us work. The aim of this series is to provide food for thought for budding programmers and help them get started on DIY projects. In this episode, we are going to talk about chat clients.

We’ve all used chat clients since the early days of the internet. They were the precursors of today’s social networks and have still managed to survive in their original form. So let’s put our thinking hats on and begin our study. A typical chat client:

  1. Has a concept of a “friend list”. You can add or remove people from this list given you have their “email ID”. The “friend list” is the directory of people you can interact with.
  2. Has a concept of “logging in”. When you do so, people who have you in their friend lists, see you as “online”, or “available”.
  3. And most importantly, once a person is online, you can send private text messages to him which will appear in his “chat window”. Modern day chat clients also let us send graphical emoticons and audio snippets. Nowadays it’s also possible to have a “group chat” where you can send and receive messages from a group of users.

Let’s start with #1. We need to maintain a list of friends. Let’s start simple and keep it as file on our computer. The file will be a list of email addresses.

Email Address
Table 1.0
Let’s move on to #2. We need to be able to log in to the “server”. The server should be able authenticate our credentials. So, it should probably need a database like this:
Email Address Password
Table 2.0

Note: Real databases should never store passwords. They always use a “one way hash function” to convert the password into some alphanumeric gibberish. Since this is a “one-way” process, passwords cannot be revealed even when the database is compromised.

Question 1: Why do we need to log in anyways?

Now, let’s tackle the real problem. We want to be able to send a private message to a user in our friend list. To be able to send a message to our friend’s computer over the internet, we will need his “IP Address”.  Now we have hit a roadblock. We don’t have this information anywhere. Our friend list file contains only email addresses. To solve this problem we can save the IP address of a user on the server and download it to our computer, when he is added to the friend list.

To achieve this, we will need the server to remember the IP address. So let’s update Table 2.0 to reflect this:

Email Address Password IP Address
Table 2.1

There ! Problem solved.  In order to make this work we will now need to update Table 1.

Email Address IP Address
Table 1.1

Now we can look up the IP address from this file and use that to send a private message to his computer. But what if we want to chat from another computer? Without the file, the chat client won’t know who your friends are. So definitely this approach of “statically” storing IP addresses won’t work. We need an approach that is “dynamic” where the data is updated whenever the user changes location. We need a data-store that is always online and always kept up-to-date. And the chat server is the ideal candidate for such a data store.

Let’s add another table to the server, from where we can look up the friend list given any user.

User Email Address Friend Email Address
Table 3.0

Table 3.0 has a “one-to-many” relationship between a user’s email address and his friend’s email address.  This means, if there are N users with M friends each, then the table will have N x M rows.

We now have all the pieces needed to create a robust chat network. Let’s review our algorithm.

    1. User enters his credentials in the chat client and “logs-in” to the server.
    2. The chat server authenticates the user with the credentials stored in its database and stores the current IP address using Table 2.1.
    3. The chat client looks up the user’s friend list by retrieving the list of friend email address given the user’s email address using Table 3.0
    4. For each friend’s email address, the chat client look’s up the corresponding IP address from Table 2.1.

That’s all for this episode. Until next time, I will leave you with some questions to ponder about.

  1. How do we handle “status updates”
  2. How can we introduce an “offline messaging” feature?
  3. Can we enable “group chatting” only by changing the chat client?

27
Aug 11

LATW Episode 9, (July 1-Aug 27, 2011)

Another month, another episode of Links Around the World, but this time with a twist. Enjoy LATW in an all-new magazine-app-ish format.

Click here to view


30
Jun 11

LATW Episode 8, (May 15 – June 30, 2011)

Video Box Office

Anatomy of a computer virus

 

Amazing experiment with Laminar Flow

 

Images worth a thousand words

Light bulb that’s been on since 1901

image

Data-driven enhancement of facial attractiveness

face_enhance

Sitting is killing you

image

Science & Technology

Computing


15
May 11

LATW Episode 7, (April 1 – May 15, 2011)

Images worth a thousand words

25 Futuristic Abandoned Yugoslavian Monuments

Simon Schubert creates complex scenes in paper using creases

crease

Science & Technology

Computing

Interesting Reads

Bonus


2
Apr 11

LATW Episode 6, (March 1-31, 2011)

Web Video Box Office

1. Liquefaction from the Sendai earthquake

 

2. World’s biggest wholes

 

3. Quadrocopters juggle balls cooperatively

 

4. RED Epic Footage: Rise of the Valkyries

 

5. Zdenek Kalal’s object tracking algorithm learns on the fly

 

6. How Can I Take Better Photos in Low Light?

 

7. Why Questions

 

8. Music synthesized from the Game of Life

 

 

Images worth a thousand Words

Fifty Ugliest Cars of the Past 50 Years

A Half-Century of Automotive Eyesores

Gravity satellite yields ‘Potato Earth’ view

Fractal Lab lets you create 3D WebGL fractals that you can explore

Fractal Lab

 

Science & Technology

 

Interesting Reads


25
Feb 11

LATW Episode 5, (February 1-15, 2011)

Computing

Assorted


4
Feb 11

LATW Episode 4, (January 15-31, 2011)

Computing
Assorted

15
Jan 11

LATW Episode 3, (January 1-15, 2011)

Computing
Assorted

20
Dec 10

LATW Episode 2 (December 10-20, 2010)

Computing

Assorted


  • Twitter
  • Tumblr
  • Facebook
  • LinkedIn
  • YouTube