Skip to main content

Posts

Showing posts from 2013

Why Kejriwal is wrong

Corruption seems to be most important issue for many people. While I disagree with the notion that it is the most important problem, I have bigger issues with the kind of solutions that are proposed. This post is aimed at dispelling the common notions about how to solve corruption. Let us take a simple example. Given below is a typical problem. Problem : We all visit our neighborhood shop/store to buy groceries or other items. However, these shopkeepers never give us any bills. Since they don’t give any bill, obviously the shop is saving its taxes. But all big brands like Big Bazaar do give a bill. They are corporates, easier to track. From a customer’s point of view, they get their products much cheaper at neighborhood stores since there is no tax. How many such shops are there across the country? How much tax is being lost by the Government? How can we fix this? Now if I were to ask you to solve this problem, how would you do that? I posed the same question ...

Next Generation Automatic Memory Management

Modern object-oriented programming languages such as Java, JavaScript, Ruby, and C# are becoming ubiquitous. A primary reason for this trend is that these languages provide automatic memory management (garbage collection), which relieves programmers of the burden of explicitly freeing memory that is no longer needed. Professor Kathryn McKinley at the University of Texas at Austin has led an NSF-funded research project, in collaboration with Steve Blackburn at the Australian National University, that is exploring how to build the software infrastructure that executes managed programs, i.e., programs in languages that provide automatic memory management. Garbage collection provides a number of software engineering benefits such as preventing common programmer memory errors that are among the most difficult to diagnose and fix. However, in the past, programs in garbage collected languages tended to be slower. The garbage collector makes a classic time-space tradeoff tha...

Exception, AWT and Layout Manager in JAVA

Difference b/w exceptions and assertions. Define call stack mechanism. Is it possible to create user define exception. If yes then explain how? Write a program to print the sum of array using fine-grained exception handling. Exceptions are the mechanism used by many programming languages to describe what to do when something unexpected happens. Typically something unexpected is an error of some sort, for example when a method is invoked with unacceptable arguments, or a network connection fails, or the user asks to open a non-existent file. Assertions are a way to test certain assumptions about the logic of a program. Assertions are used to test assumptions about local program logic inside a method, and usually not to test that external exceptions are met. For example , if we believe that that at particular point the value of a variable will always be positive, then an assertion can test this. Assertions can be removed entirely from the code when it runs. This make it poss...

advanced Java

Java - Data Structures The data structures provided by the Java utility package are very powerful and perform a wide range of functions. These data structures consist of the following interface and classes: ·          Enumeration ·          BitSet ·          Vector ·          Stack ·          Dictionary ·          Hashtable ·          Properties All these classes are now legacy and Java-2 has introduced a new framework called Collections Framework, which is discussed in next tutorial: The Enumeration: The Enumeration interface isn't itself a data structure, but it is very important within the context of other data structures. The Enumeration interface defines a means to retrieve succ...