My experience with Java, Groovy, Grails, Python and more.
  • Home
Ravi Hasija

Ravi Hasija

53 posts •
Elasticsearch

Why ELK stack

Problem statement: You have different applications feeding into each other. Debugging an issue requires logging into each individual box to look at the logs. With small number of apps/boxes it's not an

  • Ravi Hasija
    Ravi Hasija
1 min read

Mac + ITerm2 + slight modifications = Guake experience

Okay, so I just got a new Imac. Which means I am pretty fresh off the boat as far as Mac is concerned. I am a heavy Ubuntu user and use guake terminal

  • Ravi Hasija
    Ravi Hasija
1 min read
Python

PIP install module from custom PyPi server

Once you have your packages installed to your custom pypi server, you can have your pip refer to it like so: a. If you use requirements.txt to install your module: Sample requirements.

  • Ravi Hasija
    Ravi Hasija
1 min read
Python deployment

Setting up a custom PyPi server

Problem statement: You have created a proprietary Python module that you would like to release only to folks within your group/company. If you release it to Python PyPi server it will be

  • Ravi Hasija
    Ravi Hasija
1 min read
Supervisord

Installing and setting up Supervisord

If you do not know much about supervisord, then you are missing something awesome. Let me make your world a little better ;-) In simple words, supervisord allows you to control your services.

  • Ravi Hasija
    Ravi Hasija
1 min read
ubuntu

Fix for Ubuntu Indicator Plugin crash(es)

Problem: I have Ubuntu 14.04 with Xubuntu desktop and my Indicator plugin kept crashing. Here's how I fixed it! Solution: a. Add Indicator plugin to your panel. b. Once Indicator Plugin is

  • Ravi Hasija
    Ravi Hasija
1 min read
nginx

Nginx rewrite to redirect URL within domain

When I moved over to Ghost blogging platform, I chose Dated Permalinks, an option that allows for including dates in blog post URL. Realizing that the blog post URL is unique even without

  • Ravi Hasija
    Ravi Hasija
1 min read
spring

Retry with Spring II - Timeout

In my previous post about Retry with Spring I - Number of Retries I covered how we can retry an operation n number of times in case the operation causes an exception. In

  • Ravi Hasija
    Ravi Hasija
1 min read
groovy

Retry with Spring - I

Spring batch provides an excellent paradigm to retry an operation in case the operation might succeed eventually. It offers couple retry strategies: a. Retry a certain number of times. (Covered below) b. Retry

  • Ravi Hasija
    Ravi Hasija
3 min read
groovy

Throw dynamic exceptions in Spock tests from where block

It's pretty straightforward due to Groovy awesomeness! Without any further ado: import spock.lang.Specification /** * Created by ravi on 11/14/14. */ class SpockDynamicExceptionTest extends Specification { def "test 1234"() { given: def

  • Ravi Hasija
    Ravi Hasija
1 min read
Python

Bottle after_request hook does not provide correct status_code

Issue: I have a Bottle application where I raise HTTPResponse in case of an error. Simplified version of the code provided below: Now, when I hit the URL: http://localhost:8080/error I

  • Ravi Hasija
    Ravi Hasija
1 min read
Ghost

Migrating from Blogger to Ghost powered blog (part I)

Moving from Blogger to Ghost I like Blogspot / Blogger but it does not support Markdown and I love Markdown. I mean I friggin love it. So simple, pure, and aesthetically beautiful. Furthermore with

  • Ravi Hasija
    Ravi Hasija
1 min read
Python

How to display thread id in python logs

You can automatically add thread ids to your log statements using Python's logging module with LogRecord. LogRecord provides 2 attributes for thread related information: threadName and thread. %(thread)d : Thread ID (if available)

  • Ravi Hasija
    Ravi Hasija
1 min read
Deployment

Email notifications via supervisor on abrupt termination of process

supervisor has some awesome plugins. One among them is superlance. It allows you to notify via email in case of certain event occurrence. For ex: you can send an email to the ops

  • Ravi Hasija
    Ravi Hasija
1 min read
groovy

Groovy vs Java file I/O comparison, and how to improve it using withWriter.

I learnt by making a mistake and hope to help someone with this post. This weekend I tried to compare Java file I/O with Groovy on two fronts: a. Code bevity. b.

  • Ravi Hasija
    Ravi Hasija
1 min read
groovy

NFJS Experience - What I gained from it (Part I)

I had the opportunity to be at NFJS from Jul 22-24 sponsored by Griffin Solutions Group. It was my first experience and an experience that is difficult to describe in words. There were

  • Ravi Hasija
    Ravi Hasija
2 min read
maven

Maven and Hibernate hell.

I am a Maven newbie and wanted to setup an example Maven + Spring + Hibernate + Mockito project. I have been fairly successful at that but not without my struggles with Maven. Here is my

  • Ravi Hasija
    Ravi Hasija
3 min read
maven

Maven: Add Mockito Dependency.

Adding Mockito dependency to your project is pretty simple. Simply add the dependencies below to your pom.xml. NOTE: You will need JUnit version 4.4 or earlier. I couldn't get Mockito to

  • Ravi Hasija
    Ravi Hasija
1 min read
maven

Maven: Add Spring dependencies and Spring MVC your project

To enable Spring and Spring MVC modules in your maven project, follow the steps below 1: Add Spring related dependencies. The dependencies below will get all the rest of the transitive dependencies. <

  • Ravi Hasija
    Ravi Hasija
2 min read
maven

Maven and Spring Enterprise Bundle Repository (in settings.xml)

There is this very informative article about Maven and adding Spring dependencies to your project here. But I was not able to add the repositories below to my pom.xml and be able

  • Ravi Hasija
    Ravi Hasija
1 min read
hibernate

Add hibernate related dependencies to pom.xml

To be able to use Hibernate in your project you need reference to Hibernate jars. Once you have set up your Maven to access JBoss repository for Hibernate artifacts, you can add the

  • Ravi Hasija
    Ravi Hasija
1 min read
maven

Maven: Add JBoss Maven repository as your alternate remote repository.

Hibernate publishes its artifacts to the JBoss Maven Repository under the org.hibernate groupId/namespace. To setup Maven to access JBoss Maven Repository follow the steps here. This will add the JBoss Maven

  • Ravi Hasija
    Ravi Hasija
1 min read
maven

Maven: Make project IntelliJ Idea/Eclipse ready

With Maven it is pretty simple to make a project importable into IntelliJ Idea/Eclipse/Netbeans IDE. In this post I will cover IntelliJ Idea and Eclipse only. For IntelliJ Idea: The easiest

  • Ravi Hasija
    Ravi Hasija
2 min read
git

GitHub: Add an existing project to GitHub

I have started using Git for personal projects and GitHub is a great source code repository for projects where Git is used as the SCS system. In this installment I will cover adding

  • Ravi Hasija
    Ravi Hasija
1 min read
maven

Maven, Spring MVC, Hibernate and Mockito

In this 8 part series, I will cover how to create a simple Maven Web project, and then add Hibernate, Spring MVC and Mockito dependencies. I am assuming you have Maven installed. If

  • Ravi Hasija
    Ravi Hasija
1 min read
My experience with Java, Groovy, Grails, Python and more. © 2025
Latest Posts Ghost