java

Sort Map<String, Object> by keys with IgnoreCase?

Well, I tested TreeMap but it doesn't take in account IgnoreCase on string comparision. I need to order lexicographically and ignoring case. Is there any other way? Thanks, that works (TreeMap (Comparator c)). However, I have another question: public final Comparator<Object> STR_IGN_CASE_COMP = new Comparator<Object>() { public in...

EJB-QL Query List inside Object

I'm attempting to write what should be a simple (I hope) EJB-QL query. Here are my objects: public class Room { private String name; private List<RoomConfiguration> configs; } public class RoomConfiguration { private Integer capacity; private String name; } How can I search for rooms with a minimum capacity? A r...

table like java data structure

hi. I need to implement some kind table-like data structure that stores info like this in Java: +--------+-------+-----+ | sij | i | j | +--------+-------+-----+ | 45 | 5 | 7 | +--------+-------+-----+ | 33 | 1 | 6 | +--------+-------+-----+ | 31 | 0 | 9 | +--------+-------+-----+ | 12 | 8...

Using the right numeric data type

After becoming more engaged with training new engineers as well as reading Jon Skeet's DevDays presentation I have begun to recognize many engineers aren't clear when to use which numeric datatypes when. I appreciate the role a formal computer science degree plays in helping with this, but I see a lot of new engineers showing uncertainty...

Java count of items in an array (similar to a SQL aggregate function)

I am connecting to a sockets API that is very inflexible. It will return rows such as: NAME, CITY, STATE, JOB, MONTH But will have duplicates because it does not do any aggregation. I need to count the duplicate rows (which would be very easy in SQL, but not, as far as I know, in Java). Example source data: NAME, CITY, STATE, ...

Help I don't know how to handle this error (java.lang.RuntimeException: EMBEDDED Broker start failure:code = 1)

I follow this tutorial (http://www.netbeans.org/kb/docs/websvc/rest-mysql.html) and it's success, but when i try with my database, it become error. I already follow step by step , but still error, anyone know how to handle this error? or it's bug too? MQJMSRA_RA4001: start:Aborting:Exception starting EMBEDDED broker=EMBEDDED Brok...

Which knowledge base/rule-based inference engine to choose for real time Runway incursion prevention system

Hello, we are designing a project that would listen to dialog between airport controllers and pilots to prevent runway incursions (eg. one airplane is taking off while other is crossing the runway). Our professor wants us to use Jena for knowledge base (or anything else but it should be some sort of rule-based engine). Inference is not t...

Cannot load an SQLite JDBC Driver, Any Ideas ?

So i need to write a program that accesses and modifies an SQLite DB for a school program and am looking at the basics firstly. Now, I am looking at this to get me started: link text. The problem is that when i compile Test.java (The example code on the website) and then run the command: java -cp .:sqlitejdbc-v056.jar Test like it tel...

Is it possible to catch out of memory exception in java?

I'm developing a program that would require huge amount of memory, and I want to catch when out-of-memory exception happens. I had heard this is not possible to do, but curious if there is any development on this end. ...

Delete an entity by key without fetching it first in app engine (using JDO)

Is there a way to delete an entity without having to fetch it from the datastore first? I am assuming I already have the key or id for the entity. I'm thinking of something like deleteObjectById that would be an analogue to getObjectById on PersistenceManager. The closest I can think of is using Query.deletePersistentAll() (as seen her...

Crystal reports view error

I'm developing a crystal reports on java. I can now view my report, but it is still limited to one .jsp I don't know what will I tweak. my error looks like this. The viewer was unable to find the resources required to render the report. Please check the following to resolve the issue. Verify that ../crystal...

Java Algo to Find smallest and second smallest Number in List

Hi, I need to find smallest and second smallest number in a list. Can I do this using single loop? Also, we need to consider the case of two multiple occurences of a number. Ex: 1. from list [20,30,90,50] output 20 ,30 2. from list [30,30,90,50] output 30 ,30 plz help ...

Blog Search API in Java

Hi, Can anyone point out a blog search API in Java ? Looked at the Bloglines search API but could not find a Java-based API there. ...

Mobile Java Applet?

Is there any mobile platform that allows me to run Java Applets? In absence of browser integration, at least Java SE capabilities. I've heard of a mobile device capable of running Windows XP - that would probably include support for Java SE and applets; does any one have any hands-on experience with such a device? How well does it perfor...

How to create a JButton with a menu ?

I want to create a Toolbar for my application. If you click a button on that toolbar , it will pop-up a menu , just like the toolbar of eclipse. I don't know how to do it in Swing. Can someone help me please ? I've try google but found nothing. ...

comparing objects

I have two student objects. class Student{ int physics; int english; int chemistry; } I need to compare Student A marks in each subject with Student B's marks in all the subjects. A marks in physics needs to be compared with B's marks in physics, english, chemistry. Similarly A's english with all the three of B. if there is atleast ...

Algorithm to sort

Hi, I have a list of numbers ex: list=[10,50,90,60] I have this list to be sorted on the sum of any two elements. along with combination. for ex: output list should contain 10+50,10+90,10+60,50+90,50+60,90+60 sorted in ascending. i.e outputlist=[[60,10,50],[70,10,60].... [similar to shake hand problems in permutations and combinatio...

Can't Set Tomcat As Server For a Project

I've downloaded the latest Netbeans, 6.8 to be precise, then I got the download thats packaged with Tomcat and created a blank Java web application. Right Clicked > Properties > Run, but I can't see any servers in the Server drop down list. Tomcat is running, I can verify that by seeing the tomcat manager on http://localhost:8080. I hav...

What is the difference between ~ and ! operator?

Please let me know the difference between ~ and ! operator in java. ...

What is the difference between identity and equality in OOP?

What is the difference between identity and equality in OOP? ...