KR Campbell

Ranch Hand
+ Follow
since Mar 26, 2004
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by KR Campbell

toolkit.open("c:\\Temp\\test.sdf", SdfOpenFlags.sdfCreateAlways | SdfOpenFlags.sdfOpenUpdate, true);



might have a better chance.
18 years ago
There are a number of free and commercial code obfuscators around. However, even the best of them won't completely protect your code; they are based on the principle that the effort required to follow the obfuscated code is greater than the value derived from doing so.

I tried out four or five of them last year and was best impressed by Dash-O, but it is expensive.

Regards,
Ken
18 years ago
Apologies if I have not properly picked up the gist of your problem, but, have you considered binding your xml using either JAXB or XmlBeans? You'll need to learn to write an XML Schema for your source xml file but then you would be able to generate classes and use an XmlCursor or similar to parse out your data using XPath expressions.

I've also used XSLT for this in conjunction with the javax.xml.transform package and then passed the result through a pipe (this approach is relatively slow with large documents).

Regards,
Ken
18 years ago
Hi,

I'm getting myself a bit tied up with enums. I have an enum with an int value and a String description which uses symbols:



However, what I want to do is find a clean way to return the value for a given descriptor. I can do it by wrapping the enum in a class with :



but now my nice clean type got all messy. Is there a cleaner approach?

Thanks.

Ken
18 years ago
Hi,

I've tried reading Gilad Bracha's generics tutorial, but I wondered if anyone can recommend something a bit more basic for people like me who are not so bright.

At the minute I'm struggling with the implementing compareTo(T o).
I have a FileModel class in which I wish to implement Comparable. If I declare it as
<CODE>
class FileModel implements Comparable<FileModel>
</CODE>
is it correct to write the method signature as:
<CODE>
public int compareTo(FileModel obj)
</CODE>

Regards,
Ken
19 years ago
Sorry; this may be a stupid question, but:

I have been given a java application spread across a number of jars to look at. It is essentially a client front-end that talks to a database on a back end server. Is it possible without entirely re-writing the application to write a JSP front end that runs the business logic part of the application as middleware on Tomcat? It's all written as java classes with no servlets or beans etc. that I am aware of at present. I'm not so worried about actually producing the jsp front end at the minute as trying to figure out whether the application can be re-tasked as middleware. Does it need to be re-written as servlets or something?

I appreciate I'll have to do some proper research, but I wondered if anyone could tell me whether it is basically feasible or not. If it is, what subject areas do I need to tackle?

Thanks for any guidance you may be able to offer.
19 years ago
JSP
...sorry; I have to stop doing this post and then correct thing..

19 years ago

Originally posted by Ilja Preuss:


An ArrayList would be better - it also gives you O(1) indexed access, without requiring you to manage the keys. In fact it is likely to be faster than a HashMap in absolute terms.



..Even better then ; but do you need to manage keys with the HashMap given that we are talking about integers? Can't you just wrap them in an Integer given that ?
19 years ago
... that is, it hides it within the scope of the method.
19 years ago
Your problem is that you have two variables with the same name but different scope. You have instantiated the local version in createUserInterface() but not the instance variable. Thus, the local one hides the other one. Try:

instead of:

Regards
Kenny
19 years ago
... although thinking about it a bit more; it depends on whether it is acceptable to mimic a primitive data structure using an Object structure. I don't know. Obviously, you have to use method calls rather than assignment.

Also, it would be better to use a LinkedHashMap instead of a LinkedList as one of the key abilities of an array would seem to be its O(1) access time. This would give both relatively fast iterative and random access.
19 years ago
If the structure of your arrays is truly important to you, perhaps the solution lies with linked lists? You could either have a LinkedList of LinkedList where each link in the list consists of another list or more simply an array of LinkedList. Then you can make it as 'ragged' as you like!
19 years ago
I haven't been playing with XML for too long but:

1: Yes, you can alter the stream as you read it and then pass it on somewhere else. However, if you wish to navigate your XML in any way other than forward then you would be better off moving to DOM.

2: Don't really understand what you mean - the DTD is just XML and can be read with the same parser.

I can recommend the J2EE Tutorial chapter on SAX if you want to work through these concepts.

Regards,

Kenny
The 'look and feel' takes care of how list items are rendered. Probably, the solution would be to write a new ListCellRenderer to over-ride the default behaviour and then <code> setCellRenderer(myCellRenderer)</code>
19 years ago

Originally posted by Pat Hays:
Call jList1.setListData(array) again.



..perhaps writing a ListDataListener would be a slightly more elegant approach!
19 years ago