Skip to main content

Posts

Showing posts from November, 2016

Solution for the Error : An internal error occured during: "reload maven project"

You might have faced this issue after changing the project name or may be changing project name in pom.xml. When you restart your eclipse it may not launch due to project metadata file is corrupted due to your .project name changes and Maven can not laod your project properly and will displays this error shown above and eclipse console will not be opened. To get rid off this issue follow the solution given below

DOM Parser Vs. SAX Parser

Many developers sometimes confuse which is better to parse the XML document. Ofcourse myself also got doubt which parser I can use for this situation.  Since I have read about DOM and SAX very long back. Just refreshing it again DOM (Document Object Model) Parser: Tree model parser(Object based) (Tree of nodes). DOM loads the file into the memory and then parse the file. Has memory constraints since it loads the whole XML file before parsing. DOM is read and write (can insert or delete the node). If the XML content is small then prefer DOM parser. Backward and forward search is possible for searching the tags and evaluation of the information inside the tags. So this gives the ease of navigation. Slower at run time.

How Java Garbage Collector Works?

The Java runtime environment deletes objects when it determines that they are no longer being used. This process is known as garbage collection. The Java runtime environment supports a garbage collector that periodically frees the memory used by objects that are no longer needed. The Java garbage collector is a mark-sweep garbage collector that scans Java's dynamic memory areas for objects, marking those that are referenced. After all possible paths to objects are investigated, those objects that are not marked (i.e. are not referenced) are known to be garbage and are collected. (A more complete description of our garbage collection algorithm might be "A compacting, mark-sweep collector with some conservative scanning".) The garbage collector runs synchronously when the system runs out of memory, or in response to a request from a Java program. Your Java program can ask the garbage collector to run at any time by calling System.gc(). The garbage collector requires abou

HTTP + REST Vs. AMQP + RPC

REST, RPC - architecture patterns, AMQP - wire-level and HTTP - application protocol which run on top of TCP/IP AMQP is a specific protocol when HTTP - general-purpose protocol, thus, HTTP has damn high overhead comparing to AMQP AMQP nature is asynchronous where HTTP nature is synchronous Both REST and RPC use data serialization, which format is up to you and it depends of infrastructure. If you are using python everywhere I think you can use python native serialization -   pickle   which should be faster than JSON or any other formats. Both HTTP+REST and AMQP+RPC can run in heterogeneous and/or distributed environment So if you are choosing what to use:  HTTP+REST or AMQP+RPC, the answer is really subject of infrastructure complexity and resource usage. Without any specific requirements both solution will work fine, but i would rather make some abstraction to be able switch between them transparently.

How To Decompile Android APK file(.apk) and Get Source Code

Sometimes you may be amazed to see beautiful android apps with great design and simplicity. You may want to look into the source code of that app and to design the same way they have done. Usually APK file is not readable because its in dex format (Dalvik excutable file) which can be read by dalvik compiler. So there is a trick I found on stackoverflow to decompile any apk file. Just follow the below steps to get source code of any android app, if you have got .apk file Step 1: Create a new folder in your pc and copy over the .apk file that you want to decode. Now rename the extension of this .apk file to .zip (e.g. rename from filename.apk to filename.zip) and save it.  Now you can access the classes.dex files, etc. At this stage you are able to see drawables but not xml and java files, so continue. Step 2: Now extract this .zip file in the same folder (or NEW FOLDER). Download dex2jar and extract it to the same folder (or NEW FOLDER). Move the classes.dex file

Asynchronous Vs. Synchronous Communications

Synchronous (One thread):   1 thread -> |<---A---->||<----B---------->||<------C----->| Synchronous (multi-threaded):   thread A -> |<---A---->| \ thread B ------------> ->|<----B---------->| \ thread C ----------------------------------> ->|<------C----->|