Had my passport expired and wanted to renew it. Thought of writing it here so that it will help some people who are yet to renew their passport.
http://passport.gov.in/ is the website where we shall get all related details.
1. We can download the application form from the above site and get appointment to visit the passport office.
2. To renew we need two solid address proof. Old passport can be considered as one address proof when there is no address change. Otherwise bank passbook can be used. Ration card is not accepted as address proof. List of documents can be found in the below link.
http://passport.gov.in/cpv/checklist.htm
3. When I entered Madurai passport office, there is a long queue for certification verification. They rejected my application just because I wrote one reference address in pen. I went to ex-servicemen and filled-in a new application which had some other date of appointment. Very frustrated and left that office.
4. Second time I went there and since I had ration card as address proof they rejected my application.
5. My native is in Aruppukottai which falls in Virudhunagar district. So I went to Virudhunagar collectorate and gave 200 to get D.D and filled-in application form. This time my application entered into the system.
6. I got police verification in two weeks and they asked me to come to the police station. I went to Aruppukottai police station and waited for 3 hours to see superindent of police. He asked me two or three questions and its over.
7. I got a letter from madurai passport office saying that I need to submit the damage sworn affidavit. In fact my old passport is not at all damaged and I went there and submitted. Passport office asked me some basic questions.
8. Finally in three weeks I got the passport.
Here comes the interesting part, following are the differences in 10 years.
1. Process is very fast. In one week you can get a tatkal passport and in three weeks you can get normal passport if you have all the documents.
2. Some passport officers are very kind in nature and they are really helping the needy people.
3. Having ex-serviceman booth in passport office is really a good idea.
4. Still some passport officers are not people friendly. This is not changed even in the last 10 years.
Friday, April 22, 2011
Thursday, April 21, 2011
My UDP based JMS Solution
Just wondered and searched udp based JMS solutions for high performance need. Could not find any and hence decided to write one through java. Till now able to create Queues and made them communicate each other. My design has,
1. A communication provider maintains a list of Queues and Topics. Mainly list of Queue Initiators and on subscription it will have Queue Clients too. It will have a list of Topic subscribers too.
2. A Queue initiator that communicates with ConnectionProvider to register the queue name and its ip/port details.
3. A Queue client that subscribes with ConnectionProvider and get the details of Queue initiator.
4. Queue initiator and Queue client can communicate each other with high performance. On closure, commuincation provider can be updated.
5. Communication Provider , Queue initiator , Queue clients are distributed. They can run in three different jvm.
6. Currently all objects are extending Thread object. But it can be enhanced by having one thread per jvm that receives all packets and then notifies clients.
Have made a working version that supports create, delete, subscribe and unsubscribe. On a i3 CPU 64 bit, 3 GB, 2.27 GHz, 2.26 GHz machine, it is able to send/receive 6700 udp packets per second. Recently have made it to support topic also.
1. A communication provider maintains a list of Queues and Topics. Mainly list of Queue Initiators and on subscription it will have Queue Clients too. It will have a list of Topic subscribers too.
2. A Queue initiator that communicates with ConnectionProvider to register the queue name and its ip/port details.
3. A Queue client that subscribes with ConnectionProvider and get the details of Queue initiator.
4. Queue initiator and Queue client can communicate each other with high performance. On closure, commuincation provider can be updated.
5. Communication Provider , Queue initiator , Queue clients are distributed. They can run in three different jvm.
6. Currently all objects are extending Thread object. But it can be enhanced by having one thread per jvm that receives all packets and then notifies clients.
Have made a working version that supports create, delete, subscribe and unsubscribe. On a i3 CPU 64 bit, 3 GB, 2.27 GHz, 2.26 GHz machine, it is able to send/receive 6700 udp packets per second. Recently have made it to support topic also.
Thursday, March 31, 2011
Setting up logging for Hibernate
In fact it took me a while to find out that I am actually missing a jar in the classpath while doing the same. Had the below jars in the application classpath,
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar and had log4j.properties in the classpath. Make sure you have your log4j.properties preceeding over other files (if at all others exist).
My log4j.properties are copied from hibernate's example properties
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info,stdout,R
log4j.logger.org.hibernate=debug
log4j.logger.org.hibernate.test=info
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator=warn
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=hibernate.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
slf4j-api-1.6.1.jar
slf4j-log4j12-1.6.1.jar
log4j-1.2.16.jar and had log4j.properties in the classpath. Make sure you have your log4j.properties preceeding over other files (if at all others exist).
My log4j.properties are copied from hibernate's example properties
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n
log4j.rootLogger=info,stdout,R
log4j.logger.org.hibernate=debug
log4j.logger.org.hibernate.test=info
log4j.logger.org.hibernate.tool.hbm2ddl=debug
log4j.logger.org.hibernate.sql.ordering.antlr.OrderByFragmentTranslator=warn
log4j.appender.R=org.apache.log4j.RollingFileAppender
log4j.appender.R.File=hibernate.log
log4j.appender.R.MaxFileSize=100KB
# Keep one backup file
log4j.appender.R.MaxBackupIndex=1
log4j.appender.R.layout=org.apache.log4j.PatternLayout
log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n
Monday, March 28, 2011
Regex - difference between reluctant, greedy and possessive quantifiers
This one , I keep on forgetting so I thought of putting a post so that I shall not forget this again and it benefits others who had a hard time in understanding java's regex tutorial.
There are three types of regex quantifiers in regex possessive (a + character identifies this), greedy ( default so no character to identify this), reluctant ( a - character identifies this).
For example \w means any word character. Let take a word "blackdogishere". Regex "\w*dog" matches "blackdogishere". First lets examine what "\w*dog" represents, "*" means zero or more character. "\w*" means zero or more word character. "\w*dog" means, zero or more word charactesr followed by "dog". Note that dog also represents a word character. By default the quantifier is greedy so when "\w*dog" matches against "blackdogishere", \w* matches the entire string "blackdogishere" but then as the regex character moves on, it backtracks and hence "\w*dog" matches "blackdogishere".
Now if we consider reluctant quantifier which is identified by ? charcter. "\w*?dog" also matches "blackdogishere" but in some different way. Reluctant quantifier eats the character one by one. So "\w*?" matches "black" and then "\w*?dog" matches "blackdog".
Possessive quantifiers (identified by + character) eats the character in a full stretch and never back tracks. "\w*+" eats all characters in "blackdogishere" which never returns back and hence "\w*+dog" does not match the string "blackdogishere".
Believe I have explained the three types of quantifiers in a simple way.
There are three types of regex quantifiers in regex possessive (a + character identifies this), greedy ( default so no character to identify this), reluctant ( a - character identifies this).
For example \w means any word character. Let take a word "blackdogishere". Regex "\w*dog" matches "blackdogishere". First lets examine what "\w*dog" represents, "*" means zero or more character. "\w*" means zero or more word character. "\w*dog" means, zero or more word charactesr followed by "dog". Note that dog also represents a word character. By default the quantifier is greedy so when "\w*dog" matches against "blackdogishere", \w* matches the entire string "blackdogishere" but then as the regex character moves on, it backtracks and hence "\w*dog" matches "blackdogishere".
Now if we consider reluctant quantifier which is identified by ? charcter. "\w*?dog" also matches "blackdogishere" but in some different way. Reluctant quantifier eats the character one by one. So "\w*?" matches "black" and then "\w*?dog" matches "blackdog".
Possessive quantifiers (identified by + character) eats the character in a full stretch and never back tracks. "\w*+" eats all characters in "blackdogishere" which never returns back and hence "\w*+dog" does not match the string "blackdogishere".
Believe I have explained the three types of quantifiers in a simple way.
Tuesday, March 22, 2011
Java an In - Memory Indexing Technique
Scenerio Given to me:
You have a set of XML documents that have data related to Bank. i.e name, place, account name, country etc. Users would like to search based on some important fields. For example a Bank data could have 10 columns and users would like to search based on 2-3 columns. Search has to be as fast as possible.
My Solution:
1. Create an ArrayList that holds the list of BankData object. Each XML bank data corresponds to Java BankData object.
2. Create an Index object for each column that needs to be searched. Index object is a wrapper over java's TreeMap object where TreeMap's key is the column value and TreeMap's value is the index at which corresponding BankData exist in the ArrayList.
3. While reading each XML data construct a BankData object and put it in an ArrayList. Note the index at which BankData has been added in the ArrayList.
4. For each searchable columns, get the corresponding Index object and put column value and Arraylist index the TreeMap.
5. On search give the user input to the corresponding Index Object. It searches the TreeMap and identifies the ArrayList index and gets the real BankData from the ArrayList.
You have a set of XML documents that have data related to Bank. i.e name, place, account name, country etc. Users would like to search based on some important fields. For example a Bank data could have 10 columns and users would like to search based on 2-3 columns. Search has to be as fast as possible.
My Solution:
1. Create an ArrayList that holds the list of BankData object. Each XML bank data corresponds to Java BankData object.
2. Create an Index object for each column that needs to be searched. Index object is a wrapper over java's TreeMap object where TreeMap's key is the column value and TreeMap's value is the index at which corresponding BankData exist in the ArrayList.
3. While reading each XML data construct a BankData object and put it in an ArrayList. Note the index at which BankData has been added in the ArrayList.
4. For each searchable columns, get the corresponding Index object and put column value and Arraylist index the TreeMap.
5. On search give the user input to the corresponding Index Object. It searches the TreeMap and identifies the ArrayList index and gets the real BankData from the ArrayList.
Monday, March 7, 2011
England Vs South Africa My First world cup - on stadium experience
It was on 6th March 2011. I bought ticket for this match for Rs 1000.
Tried hard to get a ticket for India match but could not get it
and got ticket for the above match believing that it will be a good
entertainer. I am not disappointed and it was a nail bitting finish.
Match starts at 9.30 am and I started from my room at 8 am as it will take 1 hour to reach
Chepauk from pallikaranai where I am staying. In the train able to see lot of
enthuthiastic fans chatting about cricket. It was at 9.20 am when I reached the stadium.
People started running as soon as train stopped there since there was a music
and loud cheer coming from the stadium.
Felt excited when entering as the atmosphere is very cheerful and staff are giving
plastic boards with runs printed on it. Also flags were given and some one gave me an England
flag. My neighboure in the queue asked for both the flags hoping that its a t-shirt. Found that
there are lot of freshers for that match just like me. While I entered saw de-villiers standing
near deep square leg ropes.
There are two jiant screens in which replays are shown immediately and in fact players are also referring
the jiant screen. Main difference between watching the match in the TV and the stadium is the elecrifying
atmosphere and the athletics shown by the players. International player standard is far far better than
league players. South Afrians fielders are true athletics in the field. Able to see the wonderful sight
of seeing Steyn bowling bouncers to england batsmen. Just wondering about the atmosphere when India is playing against pakistan. Its a game of spirit and its a game of emotions.
I spent 7.30 hours in the stadium and it was not at all boring as we get bored between 16 to 34 overs while watching it in the tv. It was all South Africa for almost all 90 overs. In the last 10 overs england got vital wickets and won the match. Eager to see more such matches and willing to spend for IPL matches too.
Tried hard to get a ticket for India match but could not get it
and got ticket for the above match believing that it will be a good
entertainer. I am not disappointed and it was a nail bitting finish.
Match starts at 9.30 am and I started from my room at 8 am as it will take 1 hour to reach
Chepauk from pallikaranai where I am staying. In the train able to see lot of
enthuthiastic fans chatting about cricket. It was at 9.20 am when I reached the stadium.
People started running as soon as train stopped there since there was a music
and loud cheer coming from the stadium.
Felt excited when entering as the atmosphere is very cheerful and staff are giving
plastic boards with runs printed on it. Also flags were given and some one gave me an England
flag. My neighboure in the queue asked for both the flags hoping that its a t-shirt. Found that
there are lot of freshers for that match just like me. While I entered saw de-villiers standing
near deep square leg ropes.
There are two jiant screens in which replays are shown immediately and in fact players are also referring
the jiant screen. Main difference between watching the match in the TV and the stadium is the elecrifying
atmosphere and the athletics shown by the players. International player standard is far far better than
league players. South Afrians fielders are true athletics in the field. Able to see the wonderful sight
of seeing Steyn bowling bouncers to england batsmen. Just wondering about the atmosphere when India is playing against pakistan. Its a game of spirit and its a game of emotions.
I spent 7.30 hours in the stadium and it was not at all boring as we get bored between 16 to 34 overs while watching it in the tv. It was all South Africa for almost all 90 overs. In the last 10 overs england got vital wickets and won the match. Eager to see more such matches and willing to spend for IPL matches too.
Saturday, March 5, 2011
Java garbage collection algorithms
There are two major types namely reference counting and tracing.
Reference Counting:
Each object has a referenceCount that measures the number of reference objects that are pointing to it. i.e in other words if you create one more reference to that object, that count should increase by one. On garbage collection cycle, objects that have referenceCount as zero, will be removed from heap.
Tracing :
Starting from the root object, trace each object that are having references from the root object. Remove the objects that are not referenced from the root.
Tracing is achived through various techniques like Mark and Sweep, Copying, Mark and Compact.
Mark and Sweep:
It has two steps. On first step live objects are marked through tracing. On second step all objects are visited and unmarked objects are removed from heap. Marked objects are unmarked for next tracing cycle.
Disadvantage of this approach is it has two steps and it could create holes in the heap. Garbage collection is done after stopping all the threads in the jvm.
Copying Collector:
Herealso all threads are stopped before staring the garbage collection. Heap is divided into active and inactive part. Once the active part is full, threads are stopped and tracing is started. During tracing, live objects are moved to the inactive part. While doing so, fragmentation is automatically done i.e objects are compacted in the other part. Once copying is completed active part is made as inactive part and vice versa. After copying inactive part is garbage collected. Garbage is collected through single pass, but twice the memory is needed as copying is performed from active part to inactive part.
Mark and Compact Collector:
It combines the advantages of both mark & sweep and copying collector. It has two phases as mark and compact phase. During mark phase, objects are marked. In mark and sweep collection, boolean marked is stored in the object itself. Whereas here, it is stored in the handle. Handle is an object which has reference to the Class.object that it refers to and the pointer to the original object created in the heap. During mark phase, marked boolean is added here and not in the object. So when an object is changed, it is enough to update the handle and not reference objects that are pointing to it. During compact phase ALL objects in the heap are examined. Objects that are marked are slided to the lower portion of the heap. First I took some time to understand this as I had questions like what will happen to the existing object? Then I realized that memory allocation is contigeous. Root element is starting with zero and then subsequent elements are sequentially stored in the heap.
Reference Counting:
Each object has a referenceCount that measures the number of reference objects that are pointing to it. i.e in other words if you create one more reference to that object, that count should increase by one. On garbage collection cycle, objects that have referenceCount as zero, will be removed from heap.
Tracing :
Starting from the root object, trace each object that are having references from the root object. Remove the objects that are not referenced from the root.
Tracing is achived through various techniques like Mark and Sweep, Copying, Mark and Compact.
Mark and Sweep:
It has two steps. On first step live objects are marked through tracing. On second step all objects are visited and unmarked objects are removed from heap. Marked objects are unmarked for next tracing cycle.
Disadvantage of this approach is it has two steps and it could create holes in the heap. Garbage collection is done after stopping all the threads in the jvm.
Copying Collector:
Herealso all threads are stopped before staring the garbage collection. Heap is divided into active and inactive part. Once the active part is full, threads are stopped and tracing is started. During tracing, live objects are moved to the inactive part. While doing so, fragmentation is automatically done i.e objects are compacted in the other part. Once copying is completed active part is made as inactive part and vice versa. After copying inactive part is garbage collected. Garbage is collected through single pass, but twice the memory is needed as copying is performed from active part to inactive part.
Mark and Compact Collector:
It combines the advantages of both mark & sweep and copying collector. It has two phases as mark and compact phase. During mark phase, objects are marked. In mark and sweep collection, boolean marked is stored in the object itself. Whereas here, it is stored in the handle. Handle is an object which has reference to the Class.object that it refers to and the pointer to the original object created in the heap. During mark phase, marked boolean is added here and not in the object. So when an object is changed, it is enough to update the handle and not reference objects that are pointing to it. During compact phase ALL objects in the heap are examined. Objects that are marked are slided to the lower portion of the heap. First I took some time to understand this as I had questions like what will happen to the existing object? Then I realized that memory allocation is contigeous. Root element is starting with zero and then subsequent elements are sequentially stored in the heap.
Subscribe to:
Posts (Atom)