Showing posts from May, 2016
In previous post  we discussed how to use Java instrumentation  to find size of object. In this post we will discuss how to modify Java byte codes using Transformer class (An agent implementing ClassFileTransformer interface) and jboss Javassist byte …
 
Java instrumentation  was introduced in java 5 and it gives developer flexibility to get handle of bytecode of a class loaded by JVM(classloader). Once we get hold of bytecode, it can be manipulated using library like Apache BCEl, ASM, etc. and return…
 
In python modules can be loaded by importing in some other module or executed directly as standalone program. So, how does python detect at run time that a particular module was imported  or it was executed directly as standalone application.  Simple …
 
Level order traversal in python  Input:-        5     3     7 2    4  6   8  Level order traversal of BST:  5 3 7 2 4 6 8    import  sys   class  Node :     def  __init__ ( self ,data):         self . right = self . left = None          self . data = …
 
Comprehensions are constructs that allow sequences to be built from other sequences. L ist comprehensions was introduced in  Python 2.0. The concise and clean code of list comprehension inspired to introduce dictionary and set comprehensions.   Compon…
 
Find Height if Binary search tree in Python   Input:         5     3     7 2    4  6   8  Height of tree is : 3   class  Node :     def  __init__ ( self ,data):         self . right = self . left = None          self . data =  data class  Solution :  …
 
In this post we will use Python to work with data in SQLite database files. We will create table, insert records into it, update table and finally perform SELECT based on some condition.  Problem statement : - Process this  text file and count the num…