Friday, March 20, 2015

Knowing a Language and ability to Code.

Recalling all the placement discussions we all had, one general question: Rate yourself in the particular language. Recalling all the college placement interviews, I was asked, "Rate yourself in C++"

So my first question was always, what do you mean by rating, is it knowing the language or the ability to code. Mostly the interviewer gave me a diplomatic answer. I was not convinced myself as well. This was one quest I was since I was in college. Thanks to my colleagues and friends, I think, I can arrive at a specific answer.

Coding is an art, the way we use language constructs to minimize the efforts we are putting in. For example:

Problem Statement:
Given an array, sort it such that even numbers are in descending order and odd are in ascending.

Assuming we are given a function sort(array.begin(), array.end()), using conventional programming methods we won't be able to use this function. So If I am coding using C++, following will be the approach:

class modifiedInt{
public:
  int element;
  bool operator < (modifiedInt) const{
    if (modifiedInt.element & 1)  //Odd
      if (modifiedInt.element < element)
         return 1;
      else 
         return 0;
     else //even
      if (modifiedInt.element > element)
         return 1;
      else 
         return 0;

//Similarly operator> operator== operator< can be defined

};

After the above definition, we can directly use sort function provided to us, Here Using language constructs, the coding is simplified.

This is a very simple example, where we are using language constructs to simplify our logic and increasing code portability, usability and scalability.

The knowledge of a language provides us a tool we can use in coding. They are the basic things which help an art become easy. Given an algorithm, its not so difficult to code. Knowing the language constructs only help in achieving our end goal.

So Next time, if we are asked how do you rate yourself in C++. Lets hope we would rate myself more comprehensibly.


Feedbacks/Comments are most welcome.

Friday, October 3, 2014

Khoj - The multi-platform search engine

Problem Statement: Most of the developer use more than one operating system. Be it different flavors of Linux or Windows or Mac. This generation is lazy, we want to finish things as soon as possible! So we use search. No need to remember location of files, just enter a string and let OS worry and fetch it for us. Here the problem arises. Suppose I have a 1 TB HDD. I insert into one OS, search for a file, let it index for 30-45 minutes then search. I lend my HDD to some friend of mine, then they do the same exercise or I plug the same to another OS of mine.

Now, searching is the most basic thing. I have a smartphone and want to know if a file is present in my PC or not, why wait to go home?

Solution: A generic framework with all device compatibility, Using a database, which can be easily ported, and provide a uniform searching experience with minimum latency across all devices. 


We already have very efficient searching tools, why another?

  1. Web based searching are quiet different from desktop searches, web based searches gives priority to "whole words" instead of sub-strings. For example, the string "example", "ample" would be treated differently in a simple web-search as there are many relevant results. As there are relatively fewer number of files in desktop, results with string "ample" will also return results with "example".
  2. Different platforms have different tools for searching, which index locally, not portable to other systems. A shared DB will not only help solve this problem but also provide homogeneous platform for all platforms.
What languages will be used to develop?
As this is being developed with "generic" in mind, currently we are restricting our back-end to python. We are yet to decide on front-end.

Github Link: Khoj