java

Java and Prolog - Interprolog help

Hello I am currently trying to set up interprolog(see http://www.declarativa.com/interprolog/) and i've followed the steps on the site, but now I'm wondering how i can use interprologs classes from my eclipse ide? Do i need to import the classes into my project so i can use interprolog?? How can i go about doing so? Thanks ...

How to display current active cell outline while using Substance L&F?

Hi Everyone, I created a JTable with the Substance LAF (SubstanceBusinessBlackSteelLookAndFeel). My problem is that it is not displaying the outline on the currently focussed cell. Is this a bug with Substance LAF or do I need to set some properties? I tried with basic Metal LAF and it is displaying the outline for the current active c...

Apache/Tomcat site nesting

Hello, I have two standalone sites in tomcat webapps folder $TOMCAT_HOME/siteA which is registered in DNS as siteA.example.com and $TOMCAT_HOME/siteB which is NOT registered in DNS Both sites are written in Java/Servlets. Is there a way to setup apache/tomcat/mod-rewrite to call siteB like so? siteA.example.com/siteB Does this l...

Java framework for text- & console-based forms?

Are there any Java-based frameworks for defining and managing text-, VT100- or console-based forms systems? ...

loading .properties in spring-context.xml and persistence.xml

Hi, is there a way to reference a .properties file in a spring-context.xml and a JPA persistence.xml? I think I've seen somewhere an example of this in spring context files, though I can't remember where that was. Maybe someone knows this? About the persistence.xml I am actually unsure if this works at all. My aim is to change some pr...

Removing a row from an Excel sheet with Apache POI HSSF

I'm using the Apache POi HSSF library to import info into my application. The problem is that the files have some extra/empty rows that need to be removed first before parsing. There's not a HSSFSheet.removeRow( int rowNum ) method. Only removeRow( HSSFRow row ). The problem with this it that empty rows can't be removed. For example: ...

Add values to arraylist use JSTL

is it possible to add values to an ArrayList instead of using a HashMap something like: <jsp:useBean id="animalList" class="java.util.ArrayList" /> <c:set target="${animalList}" value="Sylvester"/> <c:set target="${animalList}" value="Goofy"/> <c:set target="${animalList}" value="Mickey"/> <c:forEach items="${animalList}" var="anim...

Small Project to Learn Java Threads

I have been programming in java for a while (5 years), and I think that I have a good understanding of most of the aspects of the language. However, I think I haven't worked with threads as much as I would like to. What would be a good small project to learn java threads deeply? Any recommendations? Thanks ...

Use more specific datatype in overloaded method in java

I have some arraylist with different objects of the same interface type, e.g: Interface interface {} class A implements interface {} class B implements interface {} I also have an overloaded method that implements all those inherited objects of the interface: public void doSomething(A obj) {} public void doSomething(B obj) {} Th...

Java DNS cache viewer

Is there a way to view/dump DNS cached used by java.net api? ...

Byte order mark screws up file reading in Java

I'm trying to read CSV files using Java. Some of the files may have a byte order mark in the beginning, but not all. When present, the byte order gets read along with the rest of the first line, thus causing problems with string compares. Is there an easy way to skip the byte order mark when it is present? Thanks! ...

Text read and replace algorithm

Looking at this: MENU_ITEM_BACK#0="Back"; MENU_ITEM_BLOCK_CHANNEL#0="Block"; MENU_ITEM_CLOSE#0="Close"; MENU_ITEM_DETAILS#0="Details"; MENU_ITEM_DIAGNOSE#0="Diagnose"; MENU_ITEM_DOWNLOAD#0="Download"; ...and so on (over 500 lines). What would be the best way to automate copying the label name into the label itself. For example, MENU...

Java "settings object", serialization/deserialization

(Code is for Android Actually, I need code to be portable between Android and Java SE.) I want to have a "settings" class with various game settings, like public int map_size; public String server_name; etc. The data needs to be accessed fairly frequently (so members, not a key-value map), and from time to time de/serialized in some...

Java compiled with gcj using javax.comm api. Possible?

I have a java program that I'm required to compile into a Linux native program using gcj-4.3. This program requires serial port access. The javax.comm api provides serial port access but I'm not sure how to get my compiled java program to use it. The target box has Java installed, but of course my compiled program isn't running in the...

Java: Simple issue with Interfaces and Generics

I made an interface to work with JGraphT. My intended use is like Comparable, in that implementing Comparable allows objects to be used with certain data structures. Simiarly, I have a JGraphT function that I want to work with anything that is Distanceable. public interface Distanceable<E> { /** * A representation of the dista...

Natural Language Processing: Find obscenities in English?

Given a set of words tagged for part of speech, I want to find those that are obscenities in mainstream English. How might I do this? Should I just make a huge list, and check for the presence of anything in the list? Should I try to use a regex to capture a bunch of variations on a single root? If it makes it easier, I don't want to fi...

Long running webservice architecture

We use axis2 for building our webservices and a Jboss server to run the logic of all of our applications. We were asked to build a webservice that talks to a bean that could take up to 1 hour to respond (depending on the size of the request) so we would not be able to keep the connection with the consumers opened during that time. We co...

loop through HashMap Java jsp

Hello, the related Questions couldn't help me very much. How can i loop through a HashMap in jsp like this example: <% HashMap<String, String> countries = MainUtils.getCountries(l); %> <select name="ccountry" id="ccountry" > <% //HERE I NEED THE LOOP %> </select>*<br/> ...

Loading a large hprof into jhat.

I have a 6.5GB Hprof file that was dumped by a 64-bit JVM using the -XX:-HeapDumpOnOutOfMemoryError option. I have it sitting on a 16GB 64-bit machine, and am trying to get it into jhat, but it keeps running out of memory. I have tried passing in jvm args for minimum settings, but it rejects any minimum, and seems to run out of memory be...

java session management

I am working on a small webapp for fun, using just Java Servlets at the moment. I have two pages, test1 and test2. At the moment I am creating a new session in test1 like this: HttpSession session = request.getSession(true); if (session.isNew() == false) { session.invalidate(); session = request.getSession (true)...