java

Querying Terracotta

Is there any way to Query against the objects stored by a Terracotta instance? I am looking for SQL-Like Queries or any way to filter objects based on fields. ...

Would this be the correct place to use the java keyword "interface" ?

I'm rather new to Java. After just reading some info on path finding, I read about using an empty class as an "interface", for an unknown object type. I'm developing a game in Java based on hospital theme. So far, the user can build a reception desk and a GP's office. They are two different types of object, one is a Building and one is ...

Construct a SOAP Request to a WebService using Axis2 Library in Java?

Hello, I need to be able to construct a SOAP request using Apache Axis2 and provide the IP address and user agent in the SOAP header to the webservice. Is there a code sample that describes how to do that? Thanks in advance for the help! Best wishes Ruchi Kaur. ...

Can Hibernate Validator be used as component outside Hibernate?

I am trying to add validation for message payload (which are json). I am using Jackson Json processor for data binding, which works quite well for me, using bean methods and occasional annotation or two. But beyond data binding, I would like to declaratively validate actual values: and specifically I prefer annotations over any externa...

Can a Spring form command be a Map?

Can a Spring form command be a Map? I made my command a Map by extending HashMap and referenced the properties using the ['property'] notation but it didn't work. Command: public class MyCommand extends HashMap<String, Object> { } HTML form: Name: <form:input path="['name']" /> Results in the error: org.springframework.beans.NotR...

strange problem with java.net.URL and java.net.URLConnection

I'm trying to download an image from a url. The process I wrote works for everyone except for ONE content provider that we're dealing with. When I access their JPGs via Firefox, everything looks kosher (happy Passover, btw). However, when I use my process I either: A) get a 404 or B) in the debugger when I set a break point at the URL...

What is the best way to convert a java object to xml with open source apis

Hi, I was wondering what the best or most widely used apis are to convert a java object to xml. I'm fairly new on the subject. Is there some sort of api call you can make to pass in an object and return xml? Or is it much more tedious where as you need to construct the document manually by pulling out object values? I have been readi...

When are two columns that look the same not the same in oracle?

I am work on a project in oracle 9i. I was having a problem with toplink 10.1.3 loading a particular row in a table. It turns out the jdbc driver that toplink is relying on is acting very funny. Perhaps someone here can help... I have a table named: crazytable. It has a column: "ver_num number(19) not null default 0". This column w...

Binary search in a sorted (memory-mapped ?) file in Java

I am struggling to port a Perl program to Java, and learning Java as I go. A central component of the original program is a Perl module that does string prefix lookups in a +500 GB sorted text file using binary search (essentially, "seek" to a byte offset in the middle of the file, backtrack to nearest newline, compare line prefix with ...

Querying Java Data Structures

Is there any way to perform SQL Like Queries or Filtering on Java Data Structures? I want to filter objects in an ArrayList and a HashMap by fields of the objects contained within. ...

Does the super class not call the overridden method?

I have the following classes: class foo { public void a() { print("a"); } public void b() { a(); } } class bar extends foo { public void a() { print("overwritten a"); } } When I now call bar.b() I want it call the overwritten method a() in foo. It does, however, print "a". ...

Are Windows Logo (TM) Certified applications harder to write in Java?

Third party vendors using our software as a component view Windows Logo Certification as an important selection criteria. 90% of the requirements are easy to adhere to given the flexibility in deploying Java programs. Some immediate difficulties present themselves: Tagging jar files with resource strings for versioning information. ...

daemon threads in an app container

I read in a post to the Smack forum recently that Starting daemon threads in a Java EE server is a big no no Basically Smack's XMPPConnection starts one daemon thread to monitor incoming data & another to send outgoing data from/to the jabber server respectively. Is it reasonable to use daemon threads to listen for write/reads in ...

Java's Scanner vs String.split() vs StringTokenizer; which should I use?

I am currently using split() to scan through a file where each line has number of strings delimited by '~'. I read somewhere that Scanner could do a better job with a long file, performance-wise, so I thought about checking it out. My question is: Would I have to create two instances of Scanner? That is, one to read a line and another ...

How do I find the smallest item in an array?

I have an array, and need to find the index of the smallest item. a = [2, 2, 2, 3, 3, 4, 3] This should return 0. Please note that the content and ordering of the array must not be modified. I am looking for a solution in either C or Java. ...

One listener for all packets vs separate listeners to handle specific types

Smack's XMPPConnection implements an event-driven manner of receiving XMPP responses from a jabber server. The method [addPacketListener][1] allows you specify your own custom listener. I'm maintaining code in which one PacketListener handles all types of incoming messages. In the interest of improving the design, (with a nod to the Sing...

2 bytes to short java

Hi i'm reading 133 length packet from serialport,last 2 bytes contain CRC values,2 bytes value i've make single(short i think) using java. this what i have done, short high=(-48 & 0x00ff); short low=80; short c=(short) ((high<<8)+low); but i'm not getting correct result,is it problem because signed valued? how can i solve this proble...

struts2 tiles integreated example required

I want a link of simple struts2 with tiles integrated example. Can anyone provide it to me?? Thanks in advance... ...

How to determine if a file will be logically moved or physically moved.

The facts: When a file is moved, there's two possibilities: The source and destination file are on the same partition and only the file system index is updated The source and destination are on two different file system and the file need to be moved byte per byte. (aka copy on move) The question: How can I determine if a file will ...

xmlbeans - set content of a complex type

My xsd file contains: <xs:sequence> <xs:element name="Book"> <xs:complexType> <xs:attribute name="author" type="xs:string" /> <xs:attribute name="title" type="xs:string" /> </xs:complexType> ...