Feeds:
Posts
Comments
South Indian Fish Curry

South Indian Fish Curry

Fish: 1 kg
Coconut: 1 grated
Tomatoes: 2
Green chillies: 4-5
Ginger: small piece (1 inch)
Garlic: 2-3 cloves
Tamarind: medium lemon size
Turmeric powder: 3/4 teaspoon
Chili powder: 1 teaspoon
Coriander powder: 3 teaspoons
Shallots: 2
Curry leaves: 2 stems
Oil: 1.5 teaspoons
Red dried chilli: 1

Cut fish into 1 inch steaks. Fish like mullet and jack mackeral are great for curry but you can use any fish, even shrimp for this recipe.

Soak the tamarind in 1 cup of water. Squeeze the tamarind to extract the juice. Keep this aside.

Make coconut milk from grated coconut: For this you need to put the grated coconut in the blender and add about 1 cup of water. Blend and squeeze the milk out of the blended coconut. Once you are done, you can put the fiber back into the blender, put half a cup of water and blend again, and squeeze out as much juice as you can. So now you have fresh coconut milk.

Take half of the coconut milk and blend with ginger, garlic, turmeric, coriander powder and chilli powder in your blender.

Now add this mixture to the remaining coconut milk. Add the tamarind juice. Cut tomatoes into small pieces. Split the green chillies. Add the tomatoes and green chilies to the coconut milk mixture.

Boil this till the curry thickens. Add fish pieces and let it cook for 5-7 minutes. If you are cooking shrimp, cook for about 2-3 mins only

For Tempering the curry:
Cut shallots into small pieces.
Heat the oil in a pan. Add shallots and dried red chilies. Saute till the shallots turn brown. Add curry leaves.
Add this to the fish curry.

Ready to  eat! Say thanks to my wife, Shajina and consume.

There are times when you have a list of some user defined java beans that you need to be sorted with respect to a certain property of the javabean. This tutorial explains how the Comparator interface can be used to sort the List.

First lets create a Java bean:

public class ScheduleBean { public String date; public String openTime; public String closeTime; /** * @return the closeTime */ public String getCloseTime() { return closeTime; } /** * @param closeTime the closeTime to set */ public void setCloseTime(String closeTime) { this.closeTime = closeTime; } /** * @return the date */ public String getDate() { return date; } /** * @param date the date to set */ public void setDate(String date) { this.date = date; } /** * @return the openTime */ public String getOpenTime() { return openTime; } /** * @param openTime the openTime to set */ public void setOpenTime(String openTime) { this.openTime = openTime; } }

The above code creates a ScheduleBean class with Date, OpenTime and closeTime. Now if we had a List of ScheduleBean, and we wanted to compare the beans stored in the List and maybe sort them based on the Date, we would need a custom class that implements the Comparator interface. The Comparator interface has two methods that can be implemented. They are:

int compare(Object o1, Object o2)
boolean equals(Object obj)

The following is our MyComparator class:


import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Comparator;
import java.util.Date;

public class MyComparator implements Comparator {    

    public int compare(Object arg0, Object arg1) {
        ScheduleBean s1 = (ScheduleBean)arg0;
        ScheduleBean s2 = (ScheduleBean)arg1;
        System.out.println("Comparing " + s1.getDate() + " " + s2.getDate());
        if(compareDate(s1.getDate(),s2.getDate())) {
            return 1;
        } else {
            return -1;
        }
    }

    private boolean compareDate(String date1Str, String date2Str) {
        SimpleDateFormat sdfDate = new SimpleDateFormat("yyyy-MM-dd");
        boolean difference = false;
        Date date1, date2;
        try {
            date1 = sdfDate.parse(date1Str);
            date2 = sdfDate.parse(date2Str);
            if(date1.after(date2)){
                difference = true;
            }

        } catch (ParseException e) {
            e.printStackTrace();
        }

        return difference;
    }
}

In the above code, we implement the compare method. In the compare method, we take 2 arguments and typecast them to the beans we will be comparing and then we use the compareDate method that we have written to return a positive 1 or a negative 1. Notice that the compare method should return a negative integer, zero, or a positive integer if the first argument is less than, equal to, or greater than the second.

Now we use the MyComparator class to sort the List of ScheduleBean


Comparator myComparator = new MyComparator();
Collections.sort(ScheduleList,myComparator);

Complete code here:


public class Tutorial {

	/**
	 * @param args
	 */
    public static void main(String[] args) {
        Tutorial tutorial = new Tutorial();
        List scheduleList = new ArrayList();
        ScheduleBean ssb = new ScheduleBean();
        ssb.setDate("2009-03-30");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-03");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-08");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-04");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-05");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-04");
        ssb.setOpenTime("12:00");
        ssb.setCloseTime("00:00");
        scheduleList.add(ssb);

        ssb = new ScheduleBean();
        ssb.setDate("2009-04-06");
        ssb.setOpenTime("00:00");
        ssb.setCloseTime("01:00");
        scheduleList.add(ssb);

        System.out.println("Before Sorting");
        Iterator scheduleItr = scheduleList.iterator();

        while(scheduleItr.hasNext()) {
            ScheduleBean storeSchedule = (ScheduleBean) scheduleItr.next();
            System.out.println(storeSchedule.getDate() + " " +
							storeSchedule.getOpenTime() + " " +
							storeSchedule.getCloseTime());
        }

        System.out.println("======= NOW SORTING =======");
        Comparator myComparator = new MyComparator();
        Collections.sort(scheduleList,myComparator);

        System.out.println("======= SORTED =======");
        scheduleItr = scheduleList.iterator();

        while(scheduleItr.hasNext()) {
        	ScheduleBean storeSchedule = (ScheduleBean) scheduleItr.next();
            System.out.println(storeSchedule.getDate() + " " +
							storeSchedule.getOpenTime() + " " +
							storeSchedule.getCloseTime());
        }
    }
}

And, the result would be as shown below

Before Sorting
2009-03-30 00:00 00:00
2009-04-03 00:00 00:00
2009-04-08 00:00 00:00
2009-04-04 00:00 00:00
2009-04-05 00:00 00:00
2009-04-04 12:00 00:00
2009-04-06 00:00 01:00
======= NOW SORTING =======
Comparing 2009-03-30 2009-04-03
Comparing 2009-04-03 2009-04-08
Comparing 2009-04-04 2009-04-05
Comparing 2009-04-05 2009-04-04
Comparing 2009-04-04 2009-04-04
Comparing 2009-04-05 2009-04-06
Comparing 2009-04-08 2009-04-04
Comparing 2009-03-30 2009-04-04
Comparing 2009-04-03 2009-04-04
Comparing 2009-04-08 2009-04-04
Comparing 2009-04-08 2009-04-04
Comparing 2009-04-08 2009-04-05
Comparing 2009-04-08 2009-04-06
======= SORTED =======
2009-03-30 00:00 00:00
2009-04-03 00:00 00:00
2009-04-04 00:00 00:00
2009-04-04 12:00 00:00
2009-04-05 00:00 00:00
2009-04-06 00:00 01:00
2009-04-08 00:00 00:00

Firefox 3 is coming..

This is just fantastic news! Firefox 3 is coming. I got to test drive their beta version and believe me its nice. Loads of features. This should keep me busy for sometime.

Looks like they are also trying to set a world record for the maximum number of downloads for a software in a day. Here is the link people. Download firefox and support open source.

Download Day 2008

Older Posts »