java

Is there any thing similar to HttpURLConnection in Perl?

I want to create an HTTPURLConnection to a PHP script and get the HTTP response returned by the script. Is there a way to do this in Perl? In short i want Perl equivalent to following: java.net.URL url = new java.net.URL(urlPath); java.net.HttpURLConnection conn = (java.net.HttpURLConnection) url.openConnection(...

How would you handle making an array or list that would have more entries than the standard implementation would allow you to access

I am trying to create an array or list that could handle in theory, given adequate hardware and such, as many as 100^100 BigInteger entries. The problem with using an array or standard list is that they can only hold Integer.MAX_VALUE number of entries. How would you work around this limitations? A whole new class/interface? A wrapper...

Finding a coordinate in a circle

I am doing a mashup using Google Maps under Grails where users can create geofences by selecting a point on the map and a radius. This get stored on my database and the application receives constantly a set of coordinates from a GPS device. I would like to compare the received coordinates with the area stored in the circles. If the poin...

Bundling JDK/JRE

Hello: I am inquiring into the licensing pertaining to distributing the jdk/jre from sun. The reason I ask is that I would like to provide a client with an ISO disk image that includes my application plus the jdk or jre dependency. Any help is greatly appreciated. Cheers, Christiaan ...

What is the case against F#?

Straightforward C#/Java code is extremely difficult to parallelize, multi-thread, etc. As a result, straightforward C#/Java code will use less and less of the total processing power on a box (because everything is now going to be multi-core). Solving this problem in C# and Java is not simple. Mutability and side effects are key to get...

Monitor folder

Hello, I need to build a Java application that monitors changes performed to a folder and to the files residing in it; these can be created, edited or even deleted and the application must be able to detect it regardless of the operating system in use. Is there any free library that may be of use? If not, which methods may prove useful...

Java IO inputstream blocks while reading standard output & standard error of an external C program

Hello, I've posted the same question here a few days ago(http://stackoverflow.com/questions/1088941/java-reading-standard-output-from-an-external-program-using-inputstream), and I found some excellent advices in dealing with a block in while reading ( while(is.read()) != -1)), but I still cannot resolve the problem. After reading the a...

Tools for regression testing / test automation of database centric java application?

I'm looking for a good, preferably free tool for automating tests of a java (EJB3) application without any kind of GUI. Tool should be capable of at least: Inserting / updating / deleting data on database Querying and comparing data on database Reading and writing to FTP server Initializing test environment, launching EJB3 bean, clean...

Working with data and a JTable?

I have a JTable that I want to use to display some data (a String and a Boolean in each row). The data is maintained by my own class. Is there some way to bind the data model to the JTable, so that when I add to the model, the JTable is dynamically updated and when I remove something from the model, the row is removed from the JTable? I...

Hibernate Save strange behaviour

I have a user object that has a one-to-many relationship with String types. I believe they are simple mappings. The types table hold the associated user_id and variable type names, with a primary key 'id' that is basically a counter. <class name="Users" table="users"> <id column="id" name="id" /> ... <set name="types" table=...

Creating a self-contained source release with Maven

Up until now we used Ant in my company. Whenever we wanted to send the application to the client we run a special Ant script that packaged all our source code with all jar libraries and Ant itself along with a simple batch file. Then the client could put the files on a computer with no network access at all (and not even Ant) and run th...

Which Java library/libraries for CouchDB?

Which libraries are people using for CouchDB? I just finished getting couchdb4j running successfully, it seems to have some clunkiness. I was going to try jcouchdb, but this effort is starting to irritate me enough, and the CouchDB API is simple enough, that I'm tempted to just use httpclient and a JSON library. Edit: grrrrr... neither ...

Should I use Java or .NET for web development?

Which of these two platforms/ecosystems are better for writing web applications/websites? I am not interested in language features, but rather in the available tools like: Monorail, MVC.NET, NHibernate, etc. These kinds of tools are usually used to build modern, data-driven, AJAX enabled websites. Assume the choice of platform is up to...

I need to sign a binary stream with a certificate

I basically need to create a self signed certificate and then sign a binary stream with it to create a signature. I tried searching Google but i can't seem to get the right keywords for related results. Any help is appreciated. ...

Run user's Java method on network message

I can do this in C++ and Python, but I haven't quite figured it out on java. My class has a 'MessageReceived' function that my network loop executes when a message comes in. I want the user to be able to write a method in their own class that they want to have run by MessageReceived, but I can't figure out how to pass and execute a meth...

How to use classes from another project?

I have got two Java projects inside Eclipse. Now I want to use classes from project A in project B. I added project A to the build path of project B. But the classes are not available in project B. What could be the reason for that problem? Did I do something wrong? What and how should I do? Thanks in advance. Update: The problem was ...

clone() vs copy constructor vs factory method??

I did a quick google on implementing clone() in Java and found: http://www.javapractices.com/topic/TopicAction.do?Id=71 It has the following comment: copy constructors and static factory methods provide an alternative to clone, and are much easier to implement. All I want to do is make a deep copy. Implementing clone() seems to m...

Spring: replace SqlMapClientTemplate for all clients?

I have a number of DAO classes that extend SqlMapClientDaoSupport, and call getSqlMapClientTemplate() to run iBatis queries. For a particular test, I wish to replace the object returned when each DAO calls getSqlMapClientTemplate(), with my own custom class. How can I do this? I know that there is a setSqlMapClientTemplate( org.sprin...

How to make a button deep in a nested Swing panel get the "keyboard focus"?

I have a swing frame that contains embedded panels that contain other panels, etc. Deep down, there is a button. I want the button to get focus so that pressing the "enter" key would generate an actionPerformed event. However, if I do myButton.requestFocus() or myButton.requestFocusInWindow() the whole window gets the focus, but nothin...

SocketChannel in Java sends data, but it doesn't get to destination application

Hi Everybody, I'm suffering a lot to create a simple ChatServer in Java, using the NIO libraries. Wonder if someone could help me. I am doing that by using SocketChannel and Selector to handle multiple clients in a single thread. The problem is: I am able to accept new connections and get it's data, but when I try to send data back, the...