java

Determining whether geographic point is within X meters of a state border (using shapefile for border data)

So I'm writing a Java app, and I've got an ESRI Shapefile which contains the borders of all the U.S. states. What I need is to be able to determine whether any given lat/lon point is within a specified distance from ANY state border line - i.e., I will not be specifying a particular border line, just need to see whether the point is clo...

Decode base64 String Java 5

Is there a straight forward way to decode a base64 string using ONLY THE JAVA 1.5 LIBRARIES? I have to use Java 1.5 due to cross platform compatibility issues between Windows and Mac OS X (only Mac 10.5 supports Java 1.6, everything lower than 10.5 has Java 1.5 as default). The object "sun.misc.Base64Decoder" exists in Java 6, but not...

Java: assign String[] array element to a String?

I'm pretty new at this, and this is probably a pretty obvious answer. In my csv script, i'm trying to figure out how to read a csv file using the CSVReader class and write to a new csv file. The error is telling me writeNext(java.lang.String[]) cannot be applied to (java.lang.String). I've tried using a direct assignment and getString...

java regex support for non-ascii values?

We have a current method which clears out chars that are not alphabetic or whitespace which is simply String clean(String input) { return input==null?"":input.replaceAll("[^a-zA-Z ]",""); } which really ought to be fixed to support non-english chars (e.g. ś,ũ, ... ). Unfortunately the java regex classes (e.g. "\W" -A non-word ...

Java Native Interface with any arbitrary C code

I have a .dll that was provided, and I need to interface with it using java. Do I have to rewrite the C to use the JNI types provided in jni.h? as seen in java sun's jni example. Otherwise, How do i declare the native function my java function to pass and receive pointers? thanks ...

FileIO from an stateless session bean

I need to read and write xml files to disk from a stateless session bean running in JBoss. What is the preferred way of doing this? Right now we are accessing the file system using the java.io classes. I found a simple file system RAR example and have got that working but it may be more buggy than just using java.io directly. ...

Tokenizing Error: java.util.regex.PatternSyntaxException, dangling metacharacter '*'

I am using split() to tokenize a String separated with * following this format: name*lastName*ID*school*age % name*lastName*ID*school*age % name*lastName*ID*school*age I'm reading this from a file named "entrada.al" using this code: static void leer() { try { String ruta="entrada.al"; File myFile = new File (ruta...

How to find a list of wireless networks (SSID's) in Java, C#, and/or C?

Is there a toolkit/package that is available that I could use to find a list of wireless networks (SSID's) that are available in either Java, C#, or C for Windows XP+? Any sample code would be appreciated. ...

setting value by clicking button in addition to using action

Hello, I have two bean Code: public class ApplContactDtl { ....... And Code: public class ApplNotifBean extends ApplNotif{ ... private List<ApplContactDtl> contactsList; ... Inside my JSPX I'm displaying the list of ApplContactDtl entries for every entry of ApplNotifBean I would like to add a delete action for these entries ...

SELECT 1 from DUAL: MySQL

In looking over my Query log, I see an odd pattern that I don't have an explanation for. After practically every query, I have "select 1 from DUAL". I have no idea where this is coming from, and I'm certainly not making the query explicitly. The log basically looks like this: 10 Query SELECT some normal query 10 Query...

Hibernate Embeddable Inheritance

I have an object with a field that can be a number of object types. This object is encoded in a single table with a discriminator column for the field's subtypes. Each of these subtypes have their fields mapped to a column in the parent objects table. I cannot seem to model this in hibernate. The code bellow will return null for getSubfi...

Remote Hibernate Criteria

I have multiple services which call on my database service, which uses Hibernate, and I would like the remote services to be able to create a query and then pass that to be processes. Ideally I would like to pass a Criteria Object but it looks like it needs a Session which they won't have access to. Is there a process similar to the Crit...

How can I play .SWF in a Java Application?

Could anyone tell me how to play a SWF file inside a Java application or does anyone know of a free plugin to do this? TIA Andrew ...

BlazeDS - AMFConnection.call giving HTTP 400 status.

I'm trying to use BlazeDS's AMFConnection class to connect to pyamf, but when I call AMFConnection.call(), I get HTTP status 400 (Bad Request - "The request body was unable to be successfully decoded."). I'm more or less following this example: (pyamf.org/wiki/ClientHowTo ... sorry, I'm a new user so I guess I can't use hyperlinks. appen...

List<? extends myType>

I have a Java question about generics. I declared a generic list: List<? extends MyType> listOfMyType; Then in some method I try instantiate and add items to that list: listOfMyType = new ArrayList<MyType>(); listOfMyType.add(myTypeInstance); Where myTypeInstance is just an object of type "MyType"; it won't compile. It says: ...

How to name a class generated by JIBX through codegen

I have an XML schema that has an element named Con, unfortunately con is an illegal file name on windows so when I use codegen to generated java classes it fails. What I'm trying to do is get JIBX's codegen to rename the class but it doesn't seem to work. This is JIBX 1.2.1 Example schema: <?xml version="1.0" encoding="UTF-8" ?> <xs:...

What is the unrenderable error known only as Beak!? (or Less Than Dot)

I used to get an error every couple days at a shop I worked at, one of the users called it "Beak" because she thought it reminded her of one: <. ...which, in the source, looks like: <P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><B><P><.</B> "Beak" can be readily reserved by bouncing JRun on the Coldfusion...

My python program executes faster than my java version of the same program. What gives?

Update: 2009-05-29 Thanks for all the suggestions and advice. I used your suggestions to make my production code execute 2.5 times faster on average than my best result a couple of days ago. In the end I was able to make the java code the fastest. Lessons: My example code below shows the insertion of primitive ints but the producti...

What's the difference between interface and @interface in java?

I haven't touched Java since using JBuilder in the late 90's while at University, so I'm a little out of touch - at any rate I've been working on a small Java project this week, and using Intellij IDEA as my IDE, for a change of pace from my regular .Net development. I notice it has support for adding interfaces and @interfaces, what is...

Axis 1.4: cannot get SOAP request to work

I'm really struggling to get my first AXIS SOAP client to work. I'm using Axis v1.4. Our WSDL contains this: .... <element name="GetParameters"> <complexType> <sequence> <element name="param1" type="codeapi:SomeParam"/> <element name="param2" type="unsignedShort" minOccurs="0"/> <element name="param3" type="stri...