bart zagers

Ranch Hand
+ Follow
since Feb 05, 2003
Merit badge: grant badges
For More
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 bart zagers

There is no standard way of doing this in java.
I have read about winzipaes , but I have not yet used it myself.
13 years ago
What you need is called "The Lotus Domino Toolkit for Java/CORBA".
But I can't find it easily on the IBM website (I have found it before, so it should be there, but I always struggle with the IBM site).
Normally, it should also come with your version of the Lotus Domino server.
15 years ago

Originally posted by Gregg Bolinger:
Typically what I've seen is that the scanner devices utilizes a native driver on the OS and all the scanner really does is spit the bar code info out to whatever focused text component there is. This could be Notepad, Word, Excel, or your swing app. So you might check that as well.



I have the same experience with barcode scanners. We even have developed a web application. Each scan is just put to whatever focused text component there is, just as it would come from the keyboard.
We have never written anything that "gets" the data, the scanner always "pushes" it to the application.
15 years ago
If I understand the API documentation of the interfaces you mention (StubDelegate), it is not necessary to implement them. They seem to be available in case you want to override the behaviour of the "Util" and "Stub" classes.
I guess JacOrb is happy with the default implentation of those classes and they have no need to implement the interfaces.
15 years ago
Did you find this thread about this topic?
[ May 27, 2008: Message edited by: bart zagers ]
15 years ago
Did you already try a search? This is a topic that comes up from time to time.
When you search this "Java in General (beginner)" forum with "sort list".
This is the first result, which contains a recent discussion on sorting a list (although the title wrongly says "sort array").
15 years ago
Welcome to the ranch

In short, yes there can be multiple static blocks, and they are executed from top to bottom as they appear in the code.
This article seems to give a nice explanation on static blocks.
15 years ago
I guess you want '||' in your equals method instead of '&&'.

You get the NullPointerException on the line
System.out.println("Set contains --" + t.count);
You get null from the Set, so t == null, so t.count gives you the exception.
So you don't get the exception in the setting, but in the getting
The exact behavior is explained in the SimpleDateFormat documentation.
15 years ago
You are struggling with the Comparator. Don't confuse Comparator and Comparable.
It should be something like (mind you, simplified and no compiler around).


The usage of the ComposableComparator seems ok.

[Fixed bad typo that Garrett mentioned ]
[ May 22, 2008: Message edited by: bart zagers ]
15 years ago
For each of the attributes you would like to sort on (e.g. departement, degree and status), you have to write a Comparator<User> that compares the users based on this single attribute. So you end up with three Comparators.
Then you create the ComposableComparator<User> and add one or more of these Comparators you have just created. Now the ComposableComparator will order the users based on the Comparators you have added, in the order you added them.
If you want the users sorted in a different order, create another ComposableComparator and add the Comparators in a different order.




I'm sure what you want to do with this. If this means the order of the departements, this will come in the Comparator, but you will have to define an order for all possible departement values.
If you want to filter on these values, this is not done using Comparators, which is only about sorting. Filtering would be another subject.
15 years ago
The easiest way to sort an array is using the Collections.sort methods. You have a choice of two methods.
If your object has a natural order, you can consider to make it implement the Comparable interface (as Manuel suggested). In this case the list can be sorted according to this order.
Another option is to implement a Comparator an sort the list according to this, using the second sort method.

For example in this case to me the natural order for Users would be to sort by last name and then first name, so I would probably implement a Comparator to sort by first name and last name, however you might feel different (or your use case might be different).
15 years ago
I guessed that, that's why I asked some addtional questions.
It is just that the code you showed seems not very efficient and not very elegant, although it might work.
Depending on the content of the array, there are several improvements and simplifications possible.
For example take your last example and the line
arr[1][0]= 123 , arr[1][1] = int
what is now the type of arr[1][0] (you can check it for example by printing arr[1][0].getClass().getName() )?
It is most likely either a String, which case your conversion code could be simplified to

or the object already is an Integer object, in which case you don't even need the second column and the code becomes something like
15 years ago
Ok, you have an array of Objects, but the actual elements of the array will not be instances of Object, but something else.
For example if you have your array
Object[][] arr
and you do
arr[0][0] = new Long(5);
arr[0][0] will contain an object of type Long.
So again, what will be the type(s) of the elements in the array?
15 years ago
If they aren't Strings, what are they?
15 years ago