java

java read file from network device

can someone help me to find a tutorial or sample java code for reading file from a any machine which is same network ...

clear screen option in java

Is there any option to clear the screen in java as clrscr() in C. ...

Either WSDL or wsimport and wsdl (mono) are horribly broken

EDIT I started off with the example given below, but I have now: Tried the example from the W3C spec. After fixing another error (binding was called StockQuoteSoapBinding in one place, StockQuoteBinding in another), it gives the same issue. Tried the mono generator wsdl to see if wsimport was to blame. It gives an equivalent error. S...

Why is the Spring/Flex/BlazeDS Messaging service-adapter not called?

I have attached a service-adapter to a spring message-destination as follows: <flex:message-destination id="secured-chat" send-security-constraint="trusted" subtopic-separator="." service-adapter="secured-chatAdapter" allow-subtopics="true" /> The init methods are called during the bean's initialization, and I...

Do any Java libraries provide a random access Queue implementation?

I'm implementing a sliding window over a stream of events, in Java. So I want a data structure which allows me to do the following: add to the end of the data structure when new events occur; remove from the start of the data structure when old events are processed; get standard random access (size(), get(i)) to the elements of the dat...

Substitute (override) class implementation at Runtime (Java)

Is there any way of substituting (overriding) a Java class implementation, which is already loaded by the System class loader by another implementation (available as an array of bytes)? To illustrate my doubt, follows this code: public class Main { public static void main(String ... args) { Foo foo = new Foo(); foo....

How can I improve this Comparator?

I've got a few Comparators -- one for Dates, one for decimals, one for percentages, etc. At first my decimal comparator looked like this: class NumericComparator implements Comparator<String> { @Override public int compare(String s1, String s2) { final Double i1 = Double.parseDouble(s1); final Double i2 = Double.parseDoubl...

Omitting the standalone attribute in xml declaration when using Java DOM + Transformer.

Hey guys, is there any way to tell the Transformer (when serializing an xml document using DOM), to omit the standalone attribute? Preferably without using a hack , i.e. ommitting the whole xml declaration and then prepending it manually. Thanks -Vic My current code: Transformer transformer = TransformerFactory.newInstance().newTran...

Comparing ASP.NET MVC and Grails for a new project.

Greetings, everyone. I consider myself to be an intermediate developer, but, to be candid, probably closer to novice than expert. In any case, I have more experience with C# and the .NET platform, but my current job has me working almost exclusively with Java. This in itself is sort of a problem, but I'm dealing with it fine and I'm not...

File Delete detection

Is there a good way to detect deletes in Java? I know I can loop through the contents of a folder and compare the previous results, but is there a better event driven way? ...

How to vary Constants based on deployment instance

I've been building a GWT 1.7 + GAE application using the eclipse plugin. The system constants are loaded into a MyConstants.properties file that is loaded by the singleton MyConstants class extending the ...gwt.i18n.client.Constants class. I would like for MyConstants to load one of several files containing settings like MyConstants-l...

[Java] How to make an animation with Swing ?

Hi, I am making a JApplet and got stuck with a animation problem. Here is my code : this.sprite.setBounds(0,0,20,17); this.sprite.setIcon(this.rangerDown); for(int i = 0; i< 16;i++) { this.sprite.repaint(); this.sprite.setLocation(this.sprite.getX(), this.sprite.getY()+10); try{ Thread.currentThread().sleep(100); ...

JInternalFrame and Keybinding

How do I bind a function key say(F11 etc) to a JInternalFrame, so it can activate a particular action. I tried with the following this.getInputMap().put(KeyStroke.getKeyStroke("F11"), new AbstractAction() { public void actionPerformed(ActionEvent e) { System.out.println("Called"); } }); but it never gets calle...

Java - Power Set construction, ordered by set size, lazy

I need to construct the power sets of a set, lazily, by smallest size first. I have a working class+algorithm (see below), but I feel like perhaps it's crazy, because it seems waaaay too elaborate. I am looking for alternatives; any suggestions? If some of the collections look unfamiliar, they are from the Google Collections library, ...

Can I embed a Silverlight applet in my JSP (java server page)?

I suspect the answer is yes, you can embed a Silverlight applet in a JSP, but I'm having a very difficult time finding any examples of this. Seems to me that I can just use the HTML that would go in a strict HTML file... <object width="300" height="300" data="data:application/x-silverlight-2," type="application/x-silverlight-2...

"JDI thread evaluations" error when debugging java in Eclipse

When I'm debugging my Android applications in Eclipse, I frequently get a "JDI thread evaluations" error when I try to display the value of particular expressions using the Display view. Similarly, it also seems to happen when I set conditions on breakpoints. I'm not 100% sure about this, but the problem seems to occur when I evaluate ...

Functional Data Structures in Java

Does the Java standard library have any functional data structures, like immutable Sets, Lists, etc., with functional update? ...

Trouble deciphering java class not visible from class loader error.

I am trying to write some java code that will code the will get the Cocoa IKPictureTaker widget to load using Rococoa. I feel like I am getting closer now but I am getting an error and I am not quite sure why it is occurring. The error that I am getting is this: Exception in thread "main" java.lang.ExceptionInInitializerError at IKPic...

Skipping ahead to a specific JDBC Record Number

What is the best way to skip ahead to a specific record number in a Java JDBC resultset? ...

Remove even numbers from an ArrayList

I have to create a method which has an ArrayList; I need to remove even numbers from this ArrayList. I have written code for that but there is a logical error which I couldn't identify. Here is my code: static void sortList(){ List <Integer> number=new ArrayList <Integer>(); number.add(11); number.add(45); number.add(12);...