Skip to main content

Posts

Counting

Letters and numbers are the two eyes of man. - Thirukkural (392) Numbers, the oldest and greatest invention by the man kind, are the base for measurements, without which no useful inventions could ever be made. The objective of this post is to think through the representation of measurements, particularly the counting, in ancient tamil culture. Ancient tamil culture : Measurements are broadly classified into 7 parts. Counting ( எண்ணல்) Weight ( நிறுத்தல்) Liter for liquid ( முகத்தல்) Volume for solid ( பெய்தல் ) Length ( நீட்டல்) Time ( தெறிப்பு) Comparison ( சார்த்தல்) Let's limit the scope only to counting for this post. Counting are generally classified into two parts Chitrilakkam - Fractions. Perilakkam - Whole Numbers. The following shows the names given for the fractions: The following shows the names given for the whole numbers: Other measurements include 100 crores is Kumbam ( கும்பம் ) 1 lakh crores is Sangam ( சங்கம் ) 1 ...

The human synergy

After nearly two and half years of inactiveness, I'm reloaded back to throw more ramblings in the open space of internet. The plan is to have a weekly journal on an idea or a product, that I understand or learnt that week. Let's get started and this week's cynosure is "reCAPTCHA" We, often, see sites that ask us to enter the content of a distorted or skewed image of letters or numbers, that is known as CAPTCHA. The widely known fact is that it enables the site to distinguish a human from any automated bots or scripts. It is so reliable, that vast number of sites are using it, and about 200 million captchas are answered by humans in a day. Roughly it takes about 10 seconds per person to answer a captcha. In summation, each day more than 150,000 hours of human effort is consumed by these Captchas, which does nothing more than confirming that the detail is entered by a human. Could this human effort be used for a higher purpose? Yes. The answer...

Coupling

A good design thrives for low coupling . The lowest form of coupling is set of disconnected objects, which couldn't form a system. (Since, objects don't interact with each other.) The highest form of coupling is Inheritance, which is one of the pillars of OOPS. The answer for this irony can be "everything is a trade-off in software development". Principles are only guidelines and not rules. An Anology: "Drive Slowly" is a common driving safety guideline. At the slowest speed (0 km/hr), the vehicle doesn't move. Also, people generally wants to buy a vehicle which gives maximum power and speed. Its a guideline to be applied pragmatically. P.S: My another post which shows the legal violation of Command Query Separation Principle .

Distributed Versioning

The version control systems are generally rated as follows based on their usability. Visual Source Safe (Low) CVS SVN Git (High) Visual Source Safe Cons: Visual Source Safe doesn't allow "Concurrent Access". Only one developer can edit a file at a time. Hence, not suitable for a large team with frequent commits. Some times gives weird error messages, making the system unstable. CVS Pro: Allows "Concurrent Access". Multiple developer can edit the file and system has the capability to merge the changes. If there is a conflict, developer is informed to resolve it. Cons: Commits are not atomic. The changes are maintained at the file level and not at the repository level. For eg: if we commit five files at once and want to revoke it, it has to be done individually for each files. SVN Pro: Commits are atomic. Committed files can be revoked together. Repository maintains the check-ins. Cons: Cannot view the history of the file, when not connected to the server. ...

Review - I

During code reviews, one of the things that is considered is the " Command Query Separation Principle " Violation. Operations should either do something and return nothing or return something and do nothing, NOT both. The common violations are Getter Methods having void as their return types and Setter methods having some return values . Getter Methods having void as their return types. For eg: void GetSalary(Employee emp) { Money salary; //Fetch Salary from some source. emp.Salary = salary; } Generally, these violations can be fixed by renaming the method name to Update. void UpdateSalary(Employee emp); Setter methods having some return values . For eg: bool SetDepartment(Employee emp); Here, it gets tricky. The programmer sets the department inside the method and wants the confirmation by the return value. There are other ways to handle this rather than sending the return value. Having a method HasDepartment() in the Employee, to check whether it has Department. Rai...

Download File from Internet using .NET

The WebClient class provides common methods for sending data to and receiving data from any local, intranet, or internet resource identified by a URI. Namespace: System.Net Assembly: System (in system.dll) The DownloadFile method of this class downloads data from a resource to a local file. Snippet: WebClient client = new WebClient() client.DownloadFile(source, destination); eg: source - http://www.whitelines.nl/html/google-page-rank.xls destination - C:\GooglePageRank.xls Note: By default, the .NET Framework supports URIs that begin with http:, https:, ftp:, and file: scheme identifiers.