: my technical perspective! is an online  biometric Attendance System launched by the Indian Government to  have a transparent view on the work ethics of Government employees. This is one of the projects undertaken by the prime minister of India Shri Narendra Modi.

The website looks fabulous compared to earlier government websites. Its responsive and provides a good amount of data for the public to view. But, there are claims to this website leading to hanging of the computer or sometimes the browser and  the coding of the website being of inferior quality. So, I  spent time going through the website , to find evidence of either a bad execution  or a bad user experience.

So, during my  entire  session viewing the website, neither the website nor the system hanged. It was working completely normal and it didn’t provide any lag of signs of hanging when i tried multitasking with this website opened on 2 different browsers.  The website is programmed to fetch data from the server every 8 seconds so that, the data displayed is updated to almost real time. But I found that  on an average, the data was being refreshed every 2 to 20 seconds and the changes in the numbers were reflected on the graph accordingly.

Websites use AJAX to create asynchronous websites. The concept behind an asynchronous websites is that, the website shows changes dynamically when the server system changes its state and the change is reflected in the users browser without the need for the user to have some kind of an interaction with the website.  Now there is code in this website where ajax is used but its effect is nullified by using async: false (screenshot below)  , So this beats the whole point of using ajax.

ink to this source code : here

There  is also evidence that, some of the charts used in the website  has data hard coded using JS. And yes, its true (screenshot below).


link to source code: here

So with this, the question arises,  will the data be manually updated every time?or is it just dummy data?
I think, its not dummy data because, this data has changed since the last time, indicating that this data is manually updated. Now, there might be a better way to update data that relatively stays same for a long period of time but i don’t know of any.

I don’t think its fair to say that, we haven’t used the best programmers available to carry out a much better job of getting this site up and running. I mean, project under the Obama administration, clearly had the best of the people building it but failed miserably the first time but it recovered. So, I think we are at a better state than that and can always strive to achieve better.

To conclude, being an ambitious project there might be certain areas, where it lacks to be a website built with high standards. But as a layman, it provides me with a way to have more transparency with the working of government and beginning of an era of online information sharing in India, and that is why I am extremely exited about this.

Socket Programming using TCP/IP

Socket programs are used to communicate between various processes usually running on different systems. It is mostly used to create a client-server environment. This post  provides the various functions used to create the server and client program and an example program. In the example, the client program sends a file name to the server and the server sends the contents of the file back to the client.

Functions used in server program:

  • socket() –    This call creates an unnamed socket and returns a file descriptor to the calling process.
    usage :   int socket(int domain, int type, int protocol)
    Eg:  sockfd=socket(AF_INET,SOCK_STREAM,0);
    here AF_INET means the the communication is over the internet domain.SOCL_STREAM indicates its a stream type of communication and 0 indicates the protocol used is TCP/IP.
  • bzero()–    this call is used set all the values of the buffer to zero.
    usage: bzero(pointer_to_buffer,size_of_buffer)
    eg:  bzero((char *)&serv_addr,sizeof(serv_addr));
    here serv_addr is of the struct type sockaddr_in which has members used to describe the complete address of a system.
  • serv_addr.sin_family=AF_INET;
    As stated earlier the serv_addr has severaal members and the first of it is sin_family and it contains the code for the address family  and is always AF_INET, indicating the internet domain.
  • serv_addr.sin_addr.s_addr=INADDR_ANY;
    here sin_addr has one member s_addr which is used to hold the IP address of the machine its running in, and this IP ddress is got from the INADDR_ANY constant.
  • serv_addr.sin_port=htons(portno);
    here we hav to store port number into he sin_port member and this takes on the network bute order. So, htons() converts the host byte order representation of the port number to network byte order representation.
  • bind() – It is a system call that binds a socket to an address. Here, the address would be the IP address of the current machine and the port number.
    usage : bind(socket_fd, pointer_of_address_its_bound_to, size_of_address);
    Eg:  bind(sockfd, (struct sockaddr *)&serv_addr,sizeof(Serv_addr)_);
    On failure, it returns a value less than zero.
  • listen() –  This call allows a process to listen on socket for communication.
    usage: listen(socket_fd, no_of_waiting_connections);
    so it takes in a socket file descriptor and  the no. of connections waiting while the process is handling a particular connection. so they wait in a blocking queue.
    Eg : listen(sock_fd,5);
    so 5 connections can wait at the max.
  • accept() –  is a system call that causes the process to block until the client connects to the server.
    it returns a new descriptor and all communication should be carried out using the new file descriptor.
    usage: int accept(sockfd,pointer_to_address_of client, addr_storing_size_of_client_address);
    Eg:  newsockfd= accept(sockfd, (struct sockaddr *)&cli_addr,&clilen);
    here cli_len=sizeof(cli_addr); so the newsockfd has the new socket address which will be used for communication.
    So, this command blocks  until the read() of data is complete that is till the client has finished its write().
  • bzero(buffer,4096);
    this initializes the buffer to zero and then reads the content from the socket (using the newsockfd) into the buffer. Her since the client sends the file name first, the buffer now contains the filename whose contents has to be sent back. The read(), will also block the process till there is something remaining to read from the socket.
  • fd=open(buffer,O_RDONLY) opens the file requested by the client in the read only mode.
  • read(fd,buffer,4096);
    this reads the contents of the file into the buffer. In socket programming, all communications happens using the buffer both at client and server side. With the completion of this read , the contents of the file is residing in the buffer and is ready to be sent to the client.
  • write(newsockfd,buffer,4096);
    this is the final command ehich writes the contents of the buffer( which has the file content) into the socket using the newsockfd which finally delivers it to the client process.

Functions used in client program:

  • connect() –  is a function used by the client to establish a connetion to the server. It takes 3 arguements:
    usage: connect(sockfd, host_to_which_itconnects, sizeof_addr);
    Eg: connect(sockfd,(struct sockaddr*)&serv_addr,sizeof(Serv_addr))<0);
  • The client too like the server uses the write() to send the file name to server and uses read() to read the content of the file into the buffer. It finally uses write(1,buffer,4096) to print the content on file onto standard output.

The full source code and usage for the client and server can be found here.

wxPython: GUI interface toolkit

WxPython is a GUI toolkit based on python programming language.It allows programmers to build a robust, high functionality UI very easily. It is cross-platform, which means it can run on multiple platforms without having to change the code.To make it cross-platform, it uses the wxWidget cross-platform GUI library written in c++.
This is an open source project and anyone interested to contribute to the project or if you would like to download the entire code for this software you can do so here. As of now it has support for 32-bit microsoft windows, most unix and linux systems and also MAC OSx.

tutorials for wxPython can be found here.

download can be found here.

all of wxWidget and wxPython sourcecode can be downloaded from here.
Here is a sample edtor created using wxPytohn. It has all the basic fuctions that an editor should have, but has a lot of scope for improvement, so do try to modify it to make it better.
this program can be found on github here.

#!/usr/bin/env python
import wx, os





class MainWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self,parent,wx.ID_ANY, title, size = (800,600))

# variables
self.modify = False

self.text = wx.TextCtrl(self, ID_TEXT, style=wx.TE_MULTILINE)
self.text.Bind(wx.EVT_TEXT, self.OnTextChanged, id=ID_TEXT)
self.text.Bind(wx.EVT_KEY_DOWN, self.OnKeyDown)
self.Bind(wx.EVT_CLOSE, self.OnQuit)
self.backuptext = self.text.GetValue()
self.statusbar = self.CreateStatusBar() #Create the statusbar

# Setting up the “File” menu
filemenu= wx.Menu()
tempitem=wx.MenuItem(filemenu, ID_NEW, “&New”,” Create a new document”)
tempitem=wx.MenuItem(filemenu, ID_OPEN, “&Open”,” Open a file”)
tempitem=wx.MenuItem(filemenu, ID_SAVE, “&Save”,” Save the current file”)
tempitem=wx.MenuItem(filemenu, ID_SAVEAS, “Save &As…”,” Save the current file with a different name”)


tempitem=wx.MenuItem(filemenu, ID_QUIT,”&Quit”,” Quit the program”)

#Creating the “Edit” menu
tempitem=wx.MenuItem(editmenu, ID_UNDO,”&Undo”,”Undo the last action”)

tempitem=wx.MenuItem(editmenu, ID_REDO,”&Redo”,”Redo the last undone action”)


tempitem=wx.MenuItem(editmenu, ID_CUT,”Cu&t”,”Cut the selection”)

tempitem=wx.MenuItem(editmenu, ID_COPY,”&Copy”,”Copy the selection”)

tempitem=wx.MenuItem(editmenu, ID_PASTE,”&Paste”,”Paste the clipboard”)

tempitem=wx.MenuItem(editmenu, ID_DELETE,”&Delete”,”Delete the selected text”)


tempitem=wx.MenuItem(editmenu, ID_SELECT_ALL,”Select &All”,”Select the entire document”)

# Setting up the “View” menu
self.statusbaritem=wx.MenuItem(viewmenu, ID_VIEW_STATUSBAR,”&Statusbar”,”Show or hide the statusbar in the current window”)


# Setting up the “Help” menu
tempitem=wx.MenuItem(helpmenu, ID_ABOUT, “&About”,” About this application”)
# Creating the menubar.
menuBar = wx.MenuBar()
menuBar.Append(filemenu, “&File”) # Adding the “filemenu” to the MenuBar
menuBar.Append(editmenu, “&Edit”) # Adding the “editmenu” to the MenuBar
menuBar.Append(viewmenu, “&View”) # Adding the “viewmenu” to the MenuBar
menuBar.Append(helpmenu, “&Help”) # Adding the “helpmenu” to the MenuBar
self.SetMenuBar(menuBar) # Adding the MenuBar to the Frame content.
wx.EVT_MENU(self, ID_NEW, self.OnNew)
wx.EVT_MENU(self, ID_OPEN, self.OnOpen)
wx.EVT_MENU(self, ID_SAVE, self.OnSave)
wx.EVT_MENU(self, ID_SAVEAS, self.OnSaveAs)
wx.EVT_MENU(self, ID_QUIT, self.OnQuit)

wx.EVT_MENU(self, ID_UNDO, self.OnUndo)
wx.EVT_MENU(self, ID_REDO, self.OnRedo)
wx.EVT_MENU(self, ID_CUT, self.OnCut)
wx.EVT_MENU(self, ID_COPY, self.OnCopy)
wx.EVT_MENU(self, ID_PASTE, self.OnPaste)
wx.EVT_MENU(self, ID_DELETE, self.OnDelete)
wx.EVT_MENU(self, ID_SELECT_ALL, self.OnSelectAll)

wx.EVT_MENU(self, ID_VIEW_STATUSBAR, self.ToggleStatusBar)

wx.EVT_MENU(self, ID_ABOUT, self.OnAbout)

#Make the toolbar
toolbar = wx.ToolBar(self, -1, style=wx.TB_HORIZONTAL | wx.NO_BORDER)
toolbar.AddSimpleTool(ID_T_NEW, wx.Image(‘/usr/share/icons/Human/24×24/actions/document-new.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Create a new document’, ”)
toolbar.AddSimpleTool(ID_T_OPEN, wx.Image(‘/usr/share/icons/Human/24×24/actions/document-open.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Open a file’, ”)
toolbar.AddSimpleTool(ID_T_SAVE, wx.Image(‘/usr/share/icons/Human/24×24/actions/document-save.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Save the current file’, ”)
toolbar.AddSimpleTool(ID_T_UNDO, wx.Image(‘/usr/share/icons/Human/24×24/actions/edit-undo.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Undo the last action’, ”)
toolbar.AddSimpleTool(ID_T_REDO, wx.Image(‘/usr/share/icons/Human/24×24/actions/edit-redo.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Redo the last undone action’, ”)
toolbar.AddSimpleTool(ID_T_CUT, wx.Image(‘/usr/share/icons/gnome/24×24/actions/edit-cut.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Cut the selection’, ”)
toolbar.AddSimpleTool(ID_T_COPY, wx.Image(‘/usr/share/icons/gnome/24×24/actions/edit-copy.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Copy the selection’, ”)
toolbar.AddSimpleTool(ID_T_PASTE, wx.Image(‘/usr/share/icons/gnome/24×24/actions/edit-paste.png’, wx.BITMAP_TYPE_PNG).ConvertToBitmap(), ‘Paste the clipboard’, ”)
self.Bind(wx.EVT_TOOL, self.OnNew, id=ID_T_NEW)
self.Bind(wx.EVT_TOOL, self.OnOpen, id=ID_T_OPEN)
self.Bind(wx.EVT_TOOL, self.OnSave, id=ID_T_SAVE)

self.Bind(wx.EVT_TOOL, self.OnUndo, id=ID_T_UNDO)
self.Bind(wx.EVT_TOOL, self.OnRedo, id=ID_T_REDO)
self.Bind(wx.EVT_TOOL, self.OnCut, id=ID_T_CUT)
self.Bind(wx.EVT_TOOL, self.OnCopy, id=ID_T_COPY)
self.Bind(wx.EVT_TOOL, self.OnPaste, id=ID_T_PASTE)
def OnNew(self, e):
self.filename, self.dirname = ‘New File’,”
self.SetTitle(“IsMEdit – “+self.filename)
def OnOpen(self, e):
“”” Open a file”””
self.dirname = ”
dlg = wx.FileDialog(self, “Choose a file”, self.dirname, “”, “*.*”, wx.OPEN)
if dlg.ShowModal() == wx.ID_OK:
self.SetTitle(“IsMEdit – “+self.filename)
def OnSaveAs(self, e):
self.dirname = ”
dlg = wx.FileDialog(self, “Choose a file”, self.dirname, “”, “*.*”, wx.SAVE)
if dlg.ShowModal() == wx.ID_OK:
self.SetTitle(“IsMEdit – “+self.filename)
def OnSave(self, e):
except AttributeError: self.OnSaveAs(e)
def OnQuit(self, e):
if self.modify:
dlg = wx.MessageDialog(self, ‘Save before exiting?’, ”, wx.YES_NO | wx.YES_DEFAULT | wx.CANCEL | wx.ICON_QUESTION)
val = dlg.ShowModal()
if val == wx.ID_YES:
elif val == wx.ID_CANCEL:
def OnUndo(self, e):
if len(self.redos) >= 30: self.redos=self.redos[1:]
def OnRedo(self, e):
def OnCut(self, e):
def OnCopy(self, e):
def OnPaste(self, e):
def OnDelete(self, e):
frm, to = self.text.GetSelection()
self.text.Remove(frm, to)
def OnSelectAll(self, e):
def ToggleStatusBar(self, e):
if self.statusbar.IsShown():

def OnAbout(self,e):
d= wx.MessageDialog(self, “(I)an’s (M)ini (Edit)or\nA simple editor written in wxPython”,”About IsMEdit”, wx.OK) # Create a message dialog box
d.ShowModal() # Shows it
d.Destroy() # finally destroy it when finished.
def OnTextChanged(self, e):
def OnKeyDown(self, e):
keycode = e.GetKeyCode()
if len(self.undos) >= 30: self.undos=self.undos[1:]

app = wx.PySimpleApp()
frame = MainWindow(None, -1, “IsMEdit – New File”)
frame.SetIcon(wx.Icon(‘/usr/share/icons/gnome/16×16/apps/accessories-text-editor.png’, wx.BITMAP_TYPE_PNG))

BitMessage – messaging client

After the news that government is snooping on the user’s messages ,calls, etc, this was created by few developers who wanted to create a messaging client that would keep the user’s messages private. This client is written in python. It  is a P2P communications protocol used to send encrypted messages to another person or to many subscribers. It is decentralized and trustless, meaning that you need-not inherently trust any entities like root certificate authorities. It uses strong authentication which means that the sender of a message cannot be spoofed, and it aims to hide “non-content” data, like the sender and receiver of messages, from passive eavesdroppers like those running warrantless wiretapping programs.

It helps t keep your identity a secret. That is it will generate a unique key for a particular user and you can share that with others,  so  only you can know who that person is when he/she shares their key with you. It can be used for good or bad purposes but, the developers believe that when  privacy is not given to us  then we have to take such measures to maintain it ourself.
You can use this to send, receive messages without having to fear the loss of your privacy. It also has measures to help you block spams if your key is got by some unwanted people. It also allows you to have multiple identities and helps you create an addressbook (which only you can see), so that you can easily know to whom  you are sending / receiving the message from.

the best part about it is that it is completely open source, so for those who wish to tinker around with it or want to have a look at the code can download from github here.

if you want the detailed documentation  as to what it is, how it works you can read the developers whitepaper here.

download link:

click here to download for Linux.

click here to download for Windows.

click here to download for Mac


once the client is downloaded and installed first you have to click on the “your identity” tab and generate a unique key for yourself or you can give a key explicitly. Once that is done , save it and then you can share tht key with anyone you wish to. Then you can message them using the various tabs in the BitMessage  window.

you can also discretely use your email to use the services of bitmessage free of cost without using any software. Check out the link here  . all the instruction for using this client online is in that link.
Share your thought, your key(if you would like to) , and what you think about such software. in the comments below.