Category Archives: web discoveries

Paribus to save your day!

One of my friends posted about Paribus a few months back, the concept of getting a refund without doing any work at all, appealed instantly to me and I signed up for the service. I linked my Gmail account and Amazon account so that it could track the purchases and apply for a refund when it notices a price drop within the refund window. They can apply for a refund on your behalf to a list of merchants mentioned on their site, which features an impressive list of popular stores one would usually go for online shopping. They charge a 25% cut on the refund amount.

Supported merchants listSince I am not an active online shopper and none of my purchases qualified for a refund, I almost forgot that I had signed up for this service until I got an email last week that said: "$2 Found - From Team Paribus". 

Paribus savings

And I was almost as wowed as Owen Wilson saying wow! 🙂


  1. Sign up once and forget about monitoring the items for a price drop.
  2. No need to worry about keeping track of different refund policies of different stores.
  3. Automated filing of claims on your behalf.


  1. Some people may have security concerns since the service requires you to authorize access to your email account and Amazon account.
  2. There is a 25% cut, which could be saved if you are willing to monitor the price daily, keep in mind the refund policy of store, ready to file a claim by visiting the store or the store website.

I think it's a really clever and effective service. I have never gone back to look for a price drop for purchases I make. So, it almost feels like getting back lost money. If you would like to try out this service, you could sign up using this link (yes, this is my referral link so that if you sign up, it can reduce Paribus's % cut in my refund 🙂 ).

Tip calculator

How often have you left a tip that you later realized wasn't what you desired to give? Well, I guess from personal experiences, it does happen, as sometimes you miss the calculations a bit. That's why these days you would see a bill (or check which is the more common word for it here in USA) often with tip amounts suggested for our convenience. One could always use the calculator app on their phone to compute the right amount but I think I am yet to come across someone who has done that. And I don't know the reason why we consider using our smartphones to take pictures of food we eat is cool but it's not cool to use it to get the tip amount right. Although, it's the latter that makes a real difference in someone's day (or earnings).

Anyways, so, I googled if there are any apps for it, and surprise! You don't need an app when you got Google 🙂


Issues with java enum hashCode()

Recently, I discovered an issue with java enum hashCode() while debugging an issue  related to a map-reduce application. With map-reduce framework, only a particular reducer should receive all the records with same key. However, I noticed that different reducers were getting records for the same key.  It meant that something was wrong with the way keys were getting hashed and distributed among the reducers. So, it meant that something is wrong with hashCode() method of this custom key class but I couldn't see anything obviously wrong by looking at the auto-generated hash method.

While discussing this issue with a colleague, I came across the fact that hashCode() for an enum class is actually the memory address of enum. Since, the memory address of enum will vary on different machines, the hashCode() generated for same key varied on different machines in Hadoop framework and that's why records with same key went to different reducers.

The custom reducer key class looked like as below:

public class Key implements WritableComparable {
 private SomeEnum e;
 private long id;

 private enum SomeEnum {

 // Auto-generated code by eclipse IDE
 public int hashCode() {
 final int prime = 31;
 int result = 1;
 result = result * prime + ( (e == null) ? 0 : e.hashCode());
 result = result * prime + (int) (id ^ (id >>> 32));
 return result;

 // other methods ...

The hashcode method in enum delegates to Object.hashCode().

I wrote a small piece of code to verify the hashCode() behavior and noticed that even on same machine, the hashCode() would differ for same enum if it's run in different JVMs.

public enum EnumTest {

 private String s;

 EnumTest(String s) {
 this.s = s;

 public static void main(String[] args) {
 System.out.println("Enum 1 hash " + EnumTest.ENUM_1.hashCode());
 System.out.println("Enum 2 hash " + EnumTest.ENUM_2.hashCode());
 System.out.println("Enum 1 ordinal " + EnumTest.ENUM_1.ordinal());
 System.out.println("Enum 2 ordinal " + EnumTest.ENUM_2.ordinal());
 System.out.println("Enum 1 string hash " + EnumTest.ENUM_1.s.hashCode());
 System.out.println("Enum 2 string hash " + EnumTest.ENUM_2.s.hashCode());
Enum 1 hash 730401895
Enum 2 hash 848123013
Enum 1 ordinal 0
Enum 2 ordinal 1
Enum 1 string hash 49
Enum 2 string hash 50

Enum 1 hash 2022437173
Enum 2 hash 730401895
Enum 1 ordinal 0
Enum 2 ordinal 1
Enum 1 string hash 49
Enum 2 string hash 50

Lessons learnt:

  • Don't use enum hashCode() especially for distributed applications.
  • Don't be shy to discuss even small issues with colleagues 🙂
  • Don't blindly trust auto-generated methods and rule them out from being buggy!