Skip to main content


Showing posts from August, 2018

Cryptography - Science of secret messages

source: IEEE Do you love sending secret messages? Do you love how Harvard professor Robert Langdon  solves the puzzles and reveals the truth? or, do you love how Nazis created the Enigma Machine  and caused problems to the Allied powers during the WW2? If answers to the above questions are yes, then I am sure you'd love cryptography. In this introductory post, we will discuss the basics of Cryptography (mostly in the context of computer science) and in the later posts in this series, we will look into various algorithms in cryptography. So, without any much delay, let's jump into the fascinating world of secret/secured communications, ciphers, codes and many more. Cryptography Let's say Alice wants to send some message to Bob but she fears that someone might intercept it. She doesn't want that. NO ONE wants that! (remember the Cambridge Analytica fiasco by Facebook?). To achieve the secrecy, Alice encrypts the message and replaces alphabets with numbers

Retrofit to query Gerrit

In this tutorial, we are going to look into the use of the Retrofit library to handle the JSON response of changes in the code after querying Gerrit . It is a free, web-based team code collaboration tool. Software developers in a team can review each other's modifications on their source code using a browser and approve or reject those changes. It is built on top of the Git version control system. Code in Action Hence, without further ado, let's get our hands dirty with some code. Create a maven project with the appropriate archetype. Add the following dependencies in the parent pom.xml file. Create the model class for our JSON response Now, we need to create the REST API exposed via an interface. To call the API and handle the response, we need to create a controller. Finally, create the main class to run the application Thus, when we run the application, parsed JSON output will be shown in the console. Conclusion In this post, we looked into the HTTP c

Parsing XML using Retrofit

Developing our own type-safe HTTP library to interface with a REST API can be a real pain as we have to handle many aspects - making connections caching retrying failed requests threading response parsing error handling, and more.  Retrofit, on the other hand, is a well-planned, documented and tested library that will save you a lot of precious time and headaches. In this tutorial, we are going to discuss how we can parse the XML response returned from  using the Retrofit library. To work with Retrofit, we need three classes -  Model class to map the JSON data Interfaces which defines the possible HTTP operations Retrofit.Builder class - Instance which uses the interface and the Builder API which allows defining the URL endpoint for the HTTP operation. Every method of the above interface represents on possible API call. The request type is specified by using appropriate annotations (GET, POST). The respon