Win a copy of Head First Android this week in the Android forum!

nikil shar

Ranch Hand
+ Follow
since May 25, 2008
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
1
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 nikil shar

i have tried an arraylist as well and it doesnt seem to improve performance. i think the issue is that i have to iterate over the list multiple times trying to find packets for each service. dont think there is much which can be done to improve the performance
10 years ago
Hi Winston,
yap i mean java.util.Vector when i say 'vector'. Also the data is lumped togather after select from the database and its a lot of effort if i were to seperate the dataset. Have tried using a hashmap to store the data using key/value but it doesnt seem to speed things up any more than using a Vector.
10 years ago
thanks for the reply everyone. each of my service has a unique service_number which can be used to link packets to its service. i select all the services and packets from the database by doing a join and store them in a vector. Then i iterate over each element using the service_number to match the packets. Hopefully this makes it clearer as to what i am trying to achieve.

thanks for the link to the tutorial

10 years ago
hi all,
i am trying to implement a search algorith where i have got a list of services and packets and i need to iterate over each service and find its packets and populate some java objects. Currently my algorithm is to hold all the data in a Vector, start with the first element and run through the list finding its packets and move to the next element.

This is pretty slow, take about 10 mins to return results to GUI. Any suggestions as to what other mechanism i could use ??

thanks in advance.
10 years ago
figured out how its done, all i needed was to split the string using a RegExp . heres the code for anyone who is interested

10 years ago
hi all,
was just wondering if there is a way to detect upper case in string and substitute the next character with "_" ?? e.g i have a list of string values "getProductType", "getHouseName" etc and i wanted to convert that to get_Product_Type, get_House_Name


thanks in advance
10 years ago
oh i see what you mean sorry that's a typo, it should be task == 1
the task variable is just to read the input since there are multiple tasks which can be done by this class.
ok heres what i got so far :



for some reason i always get a "new file was created" in this, even though i have manually created the file and placed it in the assumed dir :



any suggestions what i am doing wrong ??
thanks for the reply. In the distributeTask class, is there a way to detect if the fileCreate thread returned as a result of file already existing ??
hi all,
was wondering whats the best way of stopping a thread without exiting the JVM. I have a java programme which spawns out a few threads in the jvm , each of these threads do different things and i need to stop one of the threads when file name already exists while the other threads continue to run :





thanks in advance.

Paul Clapham wrote:

nikil shar wrote:was wondering if i used the last() method call on a resultset to move the cursor to the last record so i could call getRow() method to get the size of the resultset will java load the entire records returned from the database in memory first ??

basically i dont understand how last() method call works under the hood so if someone could explain in terms of resources how expensive a last() method call can be for large dataset (in my case the number of rows being returned are over 3million)



Quite likely, yes. It will at least have to read them from the database, which isn't free, and depending on how you declared the statement, it might have to store them in memory (or on disk) in case something else changes them in the database before your code gets around to actually looking at them. None of that is free.

Which is why it's a lot better to change your query to return a single row via "Select count(*) from ... ". You aren't going to process each of those three million rows individually anyway, are you? Or if you are, why do you need to know in advance how many there are going to be?



thanks for your reply. i was wondering if there is a way to speed things up when it comes to getting records/data from the database ?? given the huge amount of data i work with it takes a few hours for my programme to get all the records and process them. is there any other structure other than preparedStatement.executeQuery() which may be faster ??
hi all,
was wondering if i used the last() method call on a resultset to move the cursor to the last record so i could call getRow() method to get the size of the resultset will java load the entire records returned from the database in memory first ??

basically i dont understand how last() method call works under the hood so if someone could explain in terms of resources how expensive a last() method call can be for large dataset (in my case the number of rows being returned are over 3million)



thanks in advance

Henry Wong wrote:

nikil shar wrote:
thanks for the reply. is there a way to confirm by looking at the error message that an upgrade would fix this issue ?? I will need a good case before anyone would let me upgrade the jvm.



How about just upgrading the test environment? Or just one of the test machines? If it works, you will have a good case to upgrade it in QA, and then (after testing) in production.

Henry




thanks for the reply. This crashing issue is very random. We have a totally seperate environment with the same jvm and the same code and i havent seen it crash in that environment . my problem is that i dont know how to interpret the error message thrown by the jvm crash. any clues as to how to go about interpreting the long error message ??

and thanks for moving this thread to an appropriate forum.
10 years ago

Ernest Friedman-Hill wrote:No, it's not your code. Whenever the JVM crashes, it's the fault of the JVM or some native code that's being linked in; by definition Java code can't make the JVM crash.

I can see from the below that you're running 1.6.0p7; the current version is 1.6.0p23 (or 24?) The first thing I'd try is simply to bring your JVM up to date; the bug that causes the crash is likely to have been fixed in a later revision.



thanks for the reply. is there a way to confirm by looking at the error message that an upgrade would fix this issue ?? I will need a good case before anyone would let me upgrade the jvm.

thanks again.
10 years ago