java

Removing lowest order bit

Given a binary number, what is the fastest way of removing the lowest order bit? 01001001010 -> 01001001000 It would be used in code to iterate over the bits of a variable. Pseudo-code follows. while(bits != 0){ index = getIndexOfLowestOrderBit(bits); doSomething(index); removeLowestOrderBit(bits); } The possible languages I'...

Duplicate C# web service proxy classes generated for Java types

My question is about integration between a Java web service and a C# .NET client. Service: CXF 2.2.3 with Aegis databinding Client: C#, .NET 3.5 SP1 For some reason Visual Studio generates two C# proxy enums for each Java enum. The generated C# classes do not compile. For example, this Java enum: public enum SqlDialect { GENERIC...

output timestamp in ant

The ant script snippet below is an attempt to simply output the time before and after each sql script is run. I cannot change the structure of the ant targets (create-tables must call run-sql-script just as it does). The problem is that the properties (time and time2) are immutable (http://ant.apache.org/manual/CoreTasks/property.html)...

How do I extend Java interface containing generic methods in Scala?

Suppose we have the following Java interface: // Java public interface Foo { <T> T bar(Class<T> c); } How should I extend it in Scala? Writing // Scala class FooString extends Foo { override def bar(c: Class[String]): String = "hello, world"; } will cause the compiler to throw "class FooString needs to be abstract, since meth...

Java: from Lucene Hits to original objects

I'd like to implement a filter/search feature in my application using Lucene. Querying Lucene index gives me a Hits instance, which is nothing more than a list of Documents matching my criteria. Since I generate the indexed Documents from my objects, which is the best way to find the original object related to a specific Lucene Doc...

How to install Java environment most easily on windows?

Last time I came into wampserver for PHP/MySQL/Apache ,which saved me a lot of time. Now I need to install java, is there any software to recommend? ...

SOLR choose index at search

I posted this in the Nabble group also, but figured may get some advice here. is there a way to get SOLR to search whatever index i tell it to during search time without using multiple cores? i dont build my indexes with SOLR, i build them with my own java class, but i do use SOLR to search them later. It would be nice to tell Solr du...

redirecting a java web start app logs to a file

We have an application that we access over Java web start internally at our office. all the logs produced by the app are displayed in Firefox's console. what I want to do is to redirect that to a file. is that possible ? and how to do that ? P.S : the application is designed as follow : a client app that accesses an EJB on a server....

suppressing applications digital certificate has been verified do you want to run this application

I'm new to java and I have a problem very similar to this.. suppress a digital certificate when prompted. I have full control over the environment. Any possible solutions? Expert Exchange question ...

Proper way to set up transactions in Spring for different data sources?

I have an application which needs to connect to multiple databases. This is an administrative application which is basically used to manage entries in different databases - we do not need to access multiple databases simultaneously nor do we need any sort of distributed transaction management. Basically one area of the application lets ...

Date vs Milliseconds | for scalablility, saving, searching and obtaining time in Java + MySQL(or other Db's)

Which is the most beneficial in Java and a DB for DateTime? (Using JodaTime as Date) (DateTime object (Java) + TIMESTAMP (DB) ) VS (Milliseconds long (Java) + BIGINT(DB) for the use of DateTime information in Java Web application backed by an underlying Database Areas of interest manipulating, processing and memory usage in Java s...

lucene larger than

Hi, Does anybody of you guys know how to search all the numbers larget than a specified one? for example: all the document number > 65 i tried like: documentNumber: [65 TO *] but i receive exception, as lucene expected to parse a number there not a *. Thanks in advance! ...

how to access memcache item created in php from java.

item is json serialized not binary so it is readable. I am getting problem while trying to get the item, with php the key is working fine but when i access the item using same key in java it fails I have only one server so server hashing should not be aproblem I have done a wireshark analysis and seems to be of no help except that: java...

getFreeDiskSpace() in Java 5

Hi all, I am looking for a nice and easy way to display the free amount of space of a specific Hard Disk inside my Java Application. I am quite surprised that this is only implemented in java 6 thanks to the method getFreeSpace() in the File class. Unfortunately, we are using java 5 and don't want to change that for the moment. Is ...

Java Creating a new Class with Generics

I'm running into a problem with my program where given an object and an attribute name I want to return the method's return type. public static Class<?> getAttributeType(Object object, String attributeName) { try { Method method = object.getClass().getMethod( "get" + StringUtils.capitalize(attributeName)); ...

how to get data between quotes in java ?

I have this lines of text the number of quotes could change like: Here just one "comillas" But I also could have more "mas" values in "comillas" and that "is" the "trick" I was thinking in a method that return "a" list of "words" that "are" between "comillas" how I obtain the data between the quotes the result should be?: www.eg....

Android Emulator not loading on netbeans

I just downloaded the android sdk from the adnroid site and followed this tutorial to set it up on netbeans. Everything to seem to have installed fine but whenever i try to run the application this window pops up: What I am assuming it asking me to choose the emulator, but it is not showing up on the list. Is there a reason why? ...

How to interact with a java servlet running on glassfish with telnet?

I have a servlet hosted in the glassfish server. i want to communicate with it using telnet to understand what is going on behind the scenes when using html form get method. What should i give in the Host field of the HTTP request? Get /WebApplication1/NServlet HTTP/1.1 Host: localhost If i want to send custom properties in the HTTP ...

Is Jakarta HttpClient sutitable for the following task?

I try to talk to a server, by telneting to it, and send the following command through telnet terminal : POST /%5bvUpJYKw4QvGRMBmhATUxRwv4JrU9aDnwNEuangVyy6OuHxi2YiY=%5dImage? HTTP/1.1 Content-Type: application/x-www-form-urlencoded Content-Length: 164 [SORT]=0,1,0,10,5,0,KL,0&[FIELD]=33,38,51,58,68,88,78,98,99,101,56,57,69,70,71,72,89,...

How to load/access a bean (@Resource) in a custom Velocity tool

I realize this is a slightly funky thing to need to do, but I'm trying to access my Spring messageSource bean from a custom Velocity tool. In most of our codebase, I'm able to just set up a member variable and load it like this: @Resource(name = "messageSource") private AbstractMessageSource _msgSource; However, in this circumstance,...