matches in a two dimensional array
how to found all matches in a two dimensional array? java ...
how to found all matches in a two dimensional array? java ...
Hi, I'm trying to analyze content of a Drupal database for collective intelligence purposes. So far I've been able to work out a simple example that tokenizes the various contents (mainly forum posts) and count tokens after removing stop words. The StandardTokenizer supplied with Lucene should be able to tokenize hostnames and emails b...
We would like to identify and display the server and port that a Java application is running on that is behind a proxy web server. This means that getServerName() and getServerPort() return the server name of the proxy and its port (80). We have two application server instances running on a single physical box and therefore have two act...
I have an Initializer class that implements the ServletContextListener interface. In its contextInitialized() method, I initialize some global classes that have to be destroyed, otherwise the servlet cannot be unloaded. However, when the servlet's init() method throws a ServletException, the contextDestroyed() method never gets called -...
I have a spring application which is not calling bean destroy methods on shutdown. I've seen references to this being due to instantiation in a beanRefFactory, and that this can be circumvented through manually calling registerShutdownHook() on an the application context.This method seems to have disappeared from spring between versions ...
I would like to have all locally bound IP addresses, basically an array of java.net.InetAddress. I know I can call InetAddress.getAllByName() with the host name, but I was wondering if there is a more direct way that doesn't involve DNS and/or knowledge of the host name. ...
I am working on a project that involves me using a HashSet of a class I made, which I will name Test. I defined the stated HashSet like so: HashSet<Test> t = new HashSet<Test>(); t.add(new Test("asdf", 1)); t.add(new Test("hello", 2)); t.add(new Test("hello", 3)); I tried using t.contains(new Test("asdf", 1)); but it returns false....
I'm working on a 3d globe application written in java using java3d for the rendering. I've got a windows installer that basically copies files from a development snapshot to the program files directory. It runs fine from the devel snapshot, but when running after an install it does this: Java 3D ERROR : OpenGL 1.2 or better is require...
A Java thread is always in one of the following ten states: NEW: Just starting up, i.e., in process of being initialized. NEW_TRANS: Corresponding transition state (not used, included for completness). IN_NATIVE: Running in native code. IN_NATIVE_TRANS: Corresponding transition state. IN_VM: Running in VM. IN_VM_TRANS: Corresponding tra...
Hi, In linux this code doesn't work: I added two lines // Added two lines. DataLine.Info info = new DataLine.Info( SourceDataLine.class, audioFormat ); SourceDataLine dataLine = (SourceDataLine) AudioSystem.getLine( info ); // Adjust the volume on the output line. if( dataLine.isControlSupported( FloatControl.Type.MASTER_GAIN)) { /...
I have some code-under-test that calls on a java logger to report its status. In the junit test code, I would like to verify that the correct log entry was made in this logger. Something along the following lines: methodUnderTest(bool x){ if(x) logger.info("x happened") } @Test tester(){ // perhaps setup a logger first...
Hello everyone, I'm new to JAVA and I'm currently trying out both Netbeans and Eclipse. I'm confused about inputting values to my JAVA application.I see the output getting displayed on the output window in Eclipse ...but,I don't know how to input values ...?? In a normal console application in .Net,we can input values through the conso...
I have a class that looks like the following. This class compiles fine on Eclipse build 20090920-1017: public class MyScheduledExecutor implements ScheduledExecutorService { ... public <T> List<Future<T>> invokeAll(Collection<Callable<T>> tasks, long timeout, TimeUnit unit) throws InterruptedException { ... } ...
I'd like to use C#, Java and PHP in an upcoming project. What potential pitfalls should I watch out for? Are there advantages to using multiple platforms for a project? The target development team is people with varying backgrounds working over the internet on this project. Edit: Please be specific and let me know what possible proble...
My company is adding some rich calendar functionality to our Swing application. We want it to work like Outlook's calendar. Here are some of our requirments: Views for day, week, and month The ability to specify calendar items down to the minute level The ability to drag and drop calendar elements into different slots Editing of cale...
Hello, i have the requirement that i have to display a tabbedpane, but the first tab has to be static. So i tried to use the jidetabbedpane, since it cares about the effect, that all the tabs are listed in a box, it is navigable, it can show the desired close operation and so on. But the only thing i am missing is the option: set first ...
Hi, I try to publish Atom feed (generated with Rome) using Java 6 SE httpserver. For correct feed discovery in FireFox I need custom headers. This is my code: Headers headers=e.getRequestHeaders(); ArrayList<String>list=new ArrayList<String>(); list.add("application/atom+xml"); headers.put("content-type", list); e.sendResponseHead...
I'm writing a Java program that parses all the words from a text file and then adds them to a HashMap. I need to count how many distinct words are contained in the file. I also need to figure out the highest counted words. The HashMap is comprised of each word mapped to an integer which represents how many times the word occurs. Is the...
I'm trying to use jMockit to stub out a call to netscape.javascript.JSObject which is unfortunately an abstract class with a few native methods in it, both of which don't play well with jMockit. Is there any way for me to stub this out, either with jMockit, or using plain java (I'd prefer not having to introduce a new library if possible...
I have a JAX-RS web service (using jersey) that accepts a JAXB object as the request entity. When we get an error, we want to log the original xml string that was sent to us. Currently, I am just re-marshalling the JAXB object, but since we have several java enums in those classes, enum values that are not spelled correctly in the origin...