Wednesday, August 12, 2015

reading and writing from standard input/output in python


Here I am sharing a couple of ways that I use to perform I/O in python.

import sys
import fileinput
# working read a line from stdin
#x=sys.stdin.readline()
#print x

#working read the input from stdin, terminated by Ctrl + D
#x=sys.stdin.read()
#print x

#raw_input take an input and move ahead
#x=raw_input()
#name=raw_input()
#print x, name

# fileinput take the input from the file from command line argument, if the argument is null
# it take input from stdin

#for line in fileinput.input():
#    print line

x=0
mylist=[None]*10
while x<10:
   mylist[x]=raw_input()
   x=x+1


for a in mylist:
   print a+"  "




Tuesday, July 14, 2015

Why E-Commerce Giants Are Shutting Websites


Got a technical post, trying to answer the question that why e-commerce giant are shutting their website....

http://www.techgig.com/tech-news/editors-pick/Why-E-Commerce-Giants-Are-Shutting-Websites-33433

Sunday, July 12, 2015

A glimpse of technologies supporting the today's industry

During my journey with Samsung Electronics. I have seen the TCP/IP stack very closely. I got an opportunity to implement a couple of protocols for IPv6 too. I learned how to implement the RFCs and many more things.

After a journey of 2 and half years I moved to the entire new domain (Cloud Telephony). A world where we build the things by using different open source technologies. Lets have a look that how we can use difference technology to solve our technology problems.

--> Interaction among different module/process - We all know the famous IPC mechanism, used for inter process communication. When the processes are seating remotely the most common used technique is socket communication. Now moving a step forward, rather than defining the protocol for IPC communication we can use different queuing system like RabbitMQ, ZMQ. These are not only fast but also offer persistent communication mechanism. They support standard encoding/decoding using JSON and XML format and give us a lot more flexibility over serialization and de-serialization features supported in legacy software.

--> Caching - In a MVC architecture the model is fetching the data from the DB. Now for an enterprise running lakhs or million of queries. The DB can be a bottleneck. To handle such problem many vendors provide a reliable caching system. The caching system could be persistent or non-persistent, is configurable. The advantage of having a caching system like (Redis) is that it gives us a key value mechanism to store/retrieve the data and yeah it is fast enough to handle million of transaction if used in distributed model.

--> NoSQL DB - The data we have is having different nature. Suppose that we have some data and they don't hold relational information or in other words we don't need to identify their relations. Like, Flipkart storing the transaction  details of every order. Here what we need is order number and details. To support such kind of queries a key value lookup database is quite sufficient. We have such DB https://en.wikipedia.org/wiki/NoSQL . Most of them are light and couple of them are available in the open source (download configure and use ;) )

Apart from all these technologies a programming language and like Python and Ruby on Rail is quite popular for their capabilities. A language like python is quite useful for various purposes for scripting, Procedural or OOP. A weapon that we can use at all daemons ;) 

Directi interview experience


I am writing this post after around 2 years.  These two years were quite important for me. Due to my continuance performance in competitive programming on codechef.com I got an interview call from Direct i. Really its a great earning from me. I went for the onsite round in their Delhi office. The interview is all about discussing problem solving approach and pair programming. It was a nice discussion.

On the basis of my interview performance I earned a chance to have my last round with Bhavin. Although I din't make through that. But I had a lot of learning and confidence.

So what I would like to share is that, to crack such an interview at experienced level we require something more than a fresher. A fresher is expected to have a sound understanding of algorithm, able to write neat programs and possess a sound understanding of CS fundamentals. Where as at experienced level we require to have vision and a path to achieve that.