java

Web Anonymizer in Java

Hi everyone, I'm trying to implement a Web Anonymizer (like ktunnel) in java, but I really could not get the idea, I need some information about how a web anonymizer works. I really do not need the source or a sample application, just the idea or a tutorial explaining the anonymizer idea. Thanks. ...

Making a pluggable Android messaging app

I'm making a messaging app and I want to be able to extend it by using plugins. The plugin might, for example, replace :) with a smiley image. I've written some test code which uses intent filters to find the plugins, but I can't find a way to create an instance of the that plugin class. Is it possible to do this, and if not, what would ...

Struts 2 REST and validation

I'm using Struts 2 and the REST plugin. Validation in Struts 2 is ClassName-actionAlias-validation.xml. However, using the REST plugin the action alias is always /. For example OrdersController -> /orders -> OrdersController-orders-validation.xml. How can I get different validations depending on the REST method? Mainly, I want one type o...

How to enforce an integer limit in an argument hint in Java

I'm new to Java after working for a few years in PHP and I'm trying to get an idea of some of the best practices and norms when working with Java. I'm wondering if it makes sense to make a whole class to act as a custom type just to enforce a limit on the range of an integer argument? For example: class Person() { private int age; ...

How can I measure time in Java not susceptible to System clock changes?

I would like to measure elapsed time in a Java. However differences in System.currentTimeMillis() and (I believe) System.nanoTime() can be changed by external changes eg someone (or the system) altering the system clock. Using network calls is not an option as it's possible very frequent and fast returns are required. Is there a common...

can we determine at runtime whether a file is deleted from hard disk or not using java

I am creating my project in which I am indexing all files of my PC in a database. Now I want to know at run-time whether a file is deleted, moved or renamed so that I can update the database without doing indexing again. ...

Java: Saving StreamResult to a file.

Hi, I am doing some data conversion(like csv) to xml with SAX then using transformer in Java. The result is in StreamResult, and I am trying to save this result to a file.xml but I can't find way to save StreamResult into file. am I doing this all wrong? ...

Spring 3.0: Unable to locate Spring NamespaceHandler for XML schema namespace

My setup is fairly simple: I have a web front-end, back-end is spring-wired. I am using AOP to add a layer of security on my rpc services. It's all good, except for the fact that the web app aborts on launch: [java] SEVERE: Context initialization failed [java] org.springframework.beans.factory.parsing.BeanDefinitionParsingExce...

Selecting an entry in a grid view table using java/javascript

Hi all, I am automating a an application written in C#. i dont have its code. in application there is a grid view table containing list of templates. i want to select a particular template by its name and not its row index. for example: consider the grid view table consisting list of months. Now i want to select "May" month in the li...

having trouble generating xml attribute with java sax

Hi, I am using SAX api in java to convert csv to xml. I can generate simple xml file without attribute like <item> <item_id>1500</item_id> <item_quantity>4</item_quantity> </item> but I can't find way to set id and quanity as attribute to item element, like <item id=1500 quantity=4/> All SAX aip seem to offer is startElement, c...

I need to open a file based on its mime type

I have the code to get the mime type. It seems to work. When I put mimeType in an if statement, I don't get the desired effect. Here are the snippets. GET the mime type-- MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap(); String mimeType = mimeTypesMap.getContentType(file); Now I want to only open a file if the mime type...

Java: SingleThreadScheduledExecutor & java.util.concurrent.RejectedExecutionException

Hello. I am having this problem, I have private ScheduledExecutorService executor = Executors.newSingleThreadScheduledExecutor(); and task which is created every 50 millliseconds: executor.scheduleAtFixedRate(myTask, 0, 50, TimeUnit.MILLISECONDS); myTask sometimes take a while to complete (like 2-3 seconds or so), but new...

Can't set serviceName and endpointName on an EndpointReference

I need to add ServiceName and PortName information on a W3CEndpointReference, but even if I add those to the W3CEndpointReferenceBuilder, this information won't show on the resulting EPR. This is preventing me from successfully creating a proxy to consume the service, getting the following error when I call epr.getPort(InterfaceClass.cl...

Formatting a period of time

In Java I have a long integer representing a period of time in milliseconds. The time period could be anything from a couple of seconds to a number of weeks. I would like to output this time period as a String with the appropriate unit. For example 3,000 should be output as "3 seconds", 61,200,000 should be output as "17 hours" and 1,81...

Java Applets vs Back Button

I noticed that if you're playing a song at http://listen.grooveshark.com/ and you hit the back button Flash is smart enough to keep on playing the music while navigating "back" inside the Flash application. Is it possible to implement this sort of thing using Java Applets, or do Applets alway shut down when you navigate away from the pa...

how do to initialize array in java?

i am initializing an array data like: public class Array { int data[] = new int[10]; /** Creates a new instance of Array */ public Array() { data[10] = {10,20,30,40,50,60,71,80,90,91}; } } NB points an error at the line data[10] = {10,20,30,40,50,60,71,80,90,91}; i cudn't get wat it is? any suggestions. ...

How to layout widgets using DockLayoutPanel and UiBinder in GWT 2.0?

I'm trying to get a simple layout working under GWT 2.0 using UiBinder. The layout I'm trying to get is one that mimic Java's BorderLayout in where you can specify different panels in the north, south, east, west and center directions; for that I'm using DockLayoutPanel. I would like to get a header and footer, both with fixed width. The...

CXF + SSL + WebLogic 9.10

Hi I im developing a web application, its a servlet which basically acts as a front end for a web service, im using CXF for the web service client, the application is running on a WebLogic 9.10 server, every thing was working ok until the project owner decided to add ssl supprt, no big problem, since im using cxf whitout spring, i mana...

Are there are any Java libraries to talk to a PS3 controller?

I received a Mindstorms NXT set for Christmas. The first thing I did was install lejos on it so I can program the thing in Java. I built my first robot which basically drives until it gets close to something then swings its arm in a stabbing motion. I thought, what better than create some libraries so I can control this thing with a P...

how to integrate jquery calendar with jsp

hello everyone.. i have a problem to load the event data from mysql to jquery fullcalendar..the example given is in php and i dont know how to do it java.. this is the sample code: $year = date('Y'); $month = date('m'); echo json_encode(array( array( 'id' => 111, 'title' => "Event1", 'start' => "$...