ganesh roti

Greenhorn
+ Follow
since May 16, 2010
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by ganesh roti

I am still not convinced
Because for me, whenever you talk about the word "index", it means hashing by default because you can create index only by hashing . Sounds complicated.
11 years ago
But that is reality i have seen. Try using Vector<int, objects> and HashMap<Integer, Objects>. For me vector gave a significant performance.
11 years ago
I m sorry yesterday i was telling Vector as combination of ArrayList and LinkedList. I guess it was a type mistake. But that is wrong. Actually i want to say it is a mbination feature of ArrayList and HashMap. Why? Because in vector you can add values based on positions and as well as based on keys. And dont mind if i add as i have seen sometimes vectors run fast than Hashmap if you are using Vector as a key value like we do in Hashmap
11 years ago
I am not getting why you are insiting that ArrayList is also not hash based. If it is not hash based then why ArrayList is faster than LinkedList in case of retrival? To make its object postion based, ArrayList has to create something like a map inside to keep the pointers for the positions. So isn't that similar to hashing(Key, value)?
11 years ago
I guess you are misleading others. If Vector is not hasing based on its key then it would have not provided Vector.get(int index)? From where does this index came from then if it is not key-hashing based. I never said it is full of features but to identify the key difference that you can remove or get the element directly on the index in case of Vector while this is not true in case of arraylist.
11 years ago
i guess you need to take the validation logic out of stored procedures so that it can be then deal by the threads seperately and concurrently. But if you are not touching the SPs then i guess since your SP is heavy only 2 threads are sufficient.
11 years ago
it depends on how are you using your vectors/arraylist..Note that ArrayList is position based while vector is both position and hash based. So you can conside Vectoris made up of both the features of a LinkedList and ArrayList.
11 years ago
But if you want to make generic solution by passing two collections to a set and expecting the comoon elements then your code is the most optimistic in that case ..
12 years ago

It depends what exactly you want to do and how you are filtering out. The same code i restructured as below and gave a major performance benfit. Try your luck..

public class ListUtilTest
{

private final Collection<String> multipleOf2 = new ArrayList<String>();
private final Collection<String> multipleOf3 = new ArrayList<String>();

private final Map<Long, String> multipleOf2_Map = new HashMap<Long, String>();
private final Map<Long, String> multipleOf3_Map = new HashMap<Long, String>();
private final Collection<String> commonCol = new ArrayList<String>();

public ListUtilTest()
{
initCollections();
}

private void initCollections()
{
for (long j = 1; j < 100000; j++)
{
if (j % 2 == 0)
{
//multipleOf2.add("" + j);
multipleOf2_Map.put(j, (""+j));
}
if (j % 3 == 0)
{
//multipleOf3.add("" + j);
multipleOf3_Map.put(j, (""+j));
if (multipleOf2_Map.containsKey(j))
{
commonCol.add("" + j);
}
}

}
}

public void testGetCommonMultipleOf2_3()
{
final ListUtil<String> listUtil = new ListUtil<String>();
//final Collection<String> commonElements = listUtil.getCommonElements(multipleOf2, multipleOf3);
System.out.println(commonCol.size());
}

public static void main(String[] args)
{
final long msSecConvFactor = 1000;
final long startTime = System.currentTimeMillis();


final ListUtilTest lUTest = new ListUtilTest();
lUTest.testGetCommonMultipleOf2_3();

final long endTime = System.currentTimeMillis();

final long diffSec = ((endTime - startTime) );
System.out.println("Time required: "+diffSec+" milliSec");


}
12 years ago
See what happens when you login to your gmail and then click backbutton? Is that the behaviour you are looking for? IF yes then setting any header on response does not work..
12 years ago
Following code created for to parse date and now it is creating questions ahead for me regarding java api’s parse method as you can see from the red line in log. It has changed the year to 53 while the given year is 2010. J







private static final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyyMMddHH:mm");// 20100125 09:30:00.548





String input = sDay.trim() + tokens[1].trim();

Date dt = dateFormat.parse(input); // DateFormat creating a problem in high traffic

m_logger.debug(fileName+" line NO "+lineNum+" parsed date is "+ dt +" Date passed to parse is "+ input);









LOGS:



2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55540 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:31.130

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55545 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:32.418

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55550 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:33.523

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55553 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:33.559

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55554 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:33.758

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-4] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55571 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:35.626

2010-03-30 16:03:23,588 DEBUG [pool-2-thread-2] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55262 parsed date is Sat Feb 24 15:54:00 EST 53 Date passed to parse is 2010022415:54:47.392

2010-03-30 16:03:23,598 DEBUG [pool-2-thread-2] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55572 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:35.847

2010-03-30 16:03:23,598 DEBUG [pool-2-thread-2] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55581 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:37.252

2010-03-30 16:03:23,598 DEBUG [pool-2-thread-2] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55602 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:41.157

2010-03-30 16:03:23,598 DEBUG [pool-2-thread-2] (CurveLineThread.java:69) - TEG_20100224_tick.txt.gz line NO 55619 parsed date is Wed Feb 24 15:56:00 EST 2010 Date passed to parse is 2010022415:56:50.866

try to use ReferenceQueue when one file is written on the stream..i didn't got the corrrect context in your problem. But definitely if you use this approach before jvm throws any OutOfMemory it releases all the object that you have enqued in the ReferenceQueue and thus you can avoid this outOfmemory
12 years ago
Well as an alternative way can we then format the code itself in the CVS side before it checks in or commit? IS it possible?
Thanks. So instead of hooking into net it is better to write own formatter then.
Meanwhile just to update i tried to isntall the Jalopy Netbeans plugin but it does not work correctly in case of NetBeans.