Win a copy of Rust Web Development this week in the Other Languages forum!

Ronnie Ho

Ranch Hand
+ Follow
since Aug 10, 2005
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 Ronnie Ho

Originally posted by Brian Cole:


Why does sorting need to be done on the GUI thread? You may determine the sort order in a another thread, then set the order in the GUI thread.



Thanks for the reply. How do you "set the order" in the GUI thread ? Maybe I'm missing something here. Do you mean changing the reference ?
13 years ago
Dear all,

I have a JTable that contains a large set of data (like 200000 rows). Since the sorting needs to be done on the GUI thread, it often freezes the GUI for seconds when the user tries to sort the table by a column, does anyone ever face this kind of problem before? Any suggestions ?

Thanks,
Ronnie
14 years ago
Thanks. I guess my question is since the following is OK

why is this illegal ?
14 years ago
Hi all, what's wrong with the following method:

public Map<String, List<? extends Object>> test(String... ticketIDs)
{
return new HashMap<String, List<Integer>>();
}
14 years ago
Hi all,

I am wondering how do I work with the database file db-1x3.db? I am able to view it on microsoft word with a lot of garbage characters showing up. Is there another program that I can open the .db file with? Also, to access the file (read/write), do I just do normal file io to that file? I've read the spec and am a little bit confused. Thanks.

Ronnie
Tony,

A singleton is only ever used to replicate the behaviour of global data, which always has a better approach (typically, a callback as a more appropriate abstraction).



Do you have "link" for more info about the "callback" that you mentioned above? I've read something on the internet, but am not sure how that would be a replacement for singleton. Thanks.
16 years ago
Are many instances of this class being created? If yes, then the solution will not work because the synchronized writeLog() is trying to get the lock of an instance and there can be many instances of this class, so many instances can write to the "log" file at the same time. A simple solution can be

which gets the lock of the static variable that all instances of this class share.
16 years ago
Ken, thanks for your post. I did intend to make the HashMap private and I carelessly left it out (I just edited the post just now). My question is if I synchronized the add() method, but not the getAll() method, is it going to cost problem? If one thread is putting a new Entry into the map, while another trying to create an ArrayList object with the map.values(), is it going to corrupt the newly created ArrayList object ? Thanks.
Hi all,

In a multithreading environment, does the following shared object generate concurrency problem or do I need to synchronized the method? Thanks.



[ October 25, 2005: Message edited by: Ronnie Ho ]
[ October 25, 2005: Message edited by: Ronnie Ho ]
Hi,

What is the major difference between a hashtable and hashmap? Thanks.
16 years ago
Thanks. I'll just take the short answer. The link contains too much details.
16 years ago
Hi all,

Why does

gives 0.5800000000000001 ? where does the .0000...001 come from ? Thanks.
[ October 17, 2005: Message edited by: Ronnie Ho ]
16 years ago
16 years ago
You can use wrapper class to convert.


Although x = y itself would compile too. You don't need explicit cast for that.
16 years ago