java

Same numbers that appear in Textbox's dynamical output to Button value=""

I want to take the same number that I get in a text box and have it say the same in the Value="" field on a button. ...

How to copy text from Java app to wordpad

How do I click a JButton in a Swing app so that some text in a TextField can be copied (instead of highlight the text and press ctrl+C), then in a Wordpad I can click the paste button in it to paste the copied text from the Java app ? ...

Getting input in iPhone J2ME in console (Scanner doesn't work)

I am making a java application for the iPhone. Using the Scanner class doesn't work. Is there a way to get input from the console on the iPhone/iPod Touch? The iPod is jailbroken(ofcourse). ...

Shift Reduce Conflict

import java_cup.runtime.*; import java.io.*; import java.util.*; /* Preliminaries to set up and use the scanner. */ parser code {: SMPLLexer lexer; public SMPLParser (SMPLLexer lex) { super(lex); lexer = lex; } public void report_error(String message, Object info) { System.err.println(messag...

How to "echo off" the serial port in java

Hi , I am using java comm library for serial port communication in my application. When I put some data on output stream, after sometime the same command is displayed on input stream of serial port. Do anybody has any idea how to echo off the serial port? ...

java socket and Proxy authentication

I need a Java Socket client class that supports authenticated socks proxy, java.net.Proxy only supports one set of credentials for the whole JVM. I have multiple proxies each with different logins. here's what java's proxy Authenticator does, only one login for the whole JVM. how do I have multiple? Authenticator.setDefault(new Authe...

news posts: put them in a .tag file or database

I'm thinking about making a simple web application to practice custom tags, EL, ... Now I'm thinking about how to make a simple front page. I want to have a front page where I'll show a short description of a post and then the user can click it to see the full article. Further down the line I'd like to attach a poster to it, and even fu...

How to set my java programs locale to ccjk?

I'm reading an XML file inside a product to collects its inventory information i.e. various components it contains and when they are installed. I know from the product properties file that locale of the product is "ccjk". It stands for simplified Chinese for Japanese and Korean I guess. I want to set the locale of the shell before I run ...

Creation of generic type using Spring Config

How can I instantiate a bean with generic type using spring config public class GenericService<T> { ... } Note that T is not the concrete type of a bean property. It is really just the type for one of the methods of the service. In other words.. Can I instantiate new GenericService of type String() or new GenericService of type ...

JSF - correct way to build forms

Ok, i wish to know the correct way to build forms in JSF. I have multidatabase app(user can switch databases during runtime, all databases are build on the same scheme) and now i want to build forms for data input. I tried build functionalities in NetBeans, where i can generate entity classes from database, but, as far as i understood, ...

hibernate SELECT..WHERE.. IN (value1, val2...)

when using createCriteria, how to specify SELECT..WHERE.. IN (value1, val2...) ? ...

GWT classes: an annotation to prevent serialization of a field?

In GWT 1.7 I have a class used to construct object on the server side which are then used on the client (browser) side. On the client side I want to cache a service (in this case NumberFormat). This will be initialized lazily in a client-only method, and stored as a field object. The problem is the Java (1.6) build tools interpret this...

Problem while executing ajax

I am trying to do a simple application using Ajax and servlet. But when i was trying to execute the application, it is not working. Please go through the code and let me know what would be the problem? function createRequest() { alert("hai createRequest()"); try { req=new XMLHttpRequest(); } catch(trymicrosoft) { tr...

Java out of memory Exception

Hi, I am running a Java Web Application in Tomcat. The application uses Quartz framework to schedule the cron job at regular intervals. This cron job involves parsing a 4+ MB xml file, which I am doing using JDOM API. The xml file contains around 3600 nodes to be parsed and consequently data to be updated in DB which I am doing it sequ...

Convert a String to an Enum ?

Hi I'm having trouble trying to generalize a function I've written for an specific enum: public static enum InstrumentType { SPOT { public String toString() { return "MKP"; } }, VOLATILITY { public String toString() { return "VOL"; } }; public static Instrumen...

Virus scanning in build process

I would like to incorporate scanning for viruses into a Java/Maven/Hudson build process. Unfortunately, i could not find any resources on dedicated tools for this kind of build step. My build environment is Linux-based. My question is: How can antivirus scanning be incorporated into a Maven and Hudson based build process? What are the ...

Java foreach loop: for (Integer i : list) { ... }

when i use jdk5 like below ArrayList<Integer> list = new ArrayList<Integer>(); for (Integer i : list) { //cannot check if already reached last item } on the other hand if i just use iterator ArrayList<Integer> list = new ArrayList<Integer>(); for (Iterator i = list.iterator(); i.hasNext();) { //i can ...

When i import from a file, click the next and previous buttons it is exporting data to my file? is there something wrong with my action listeners?

public AddressBookApp(){ frame = new JFrame("Address Book"); frame.setSize(500, 400); frame.setDefaultCloseOperation(frame.EXIT_ON_CLOSE); panel = new JPanel(); panel.setBackground(Color.gray); panel.setLayout(null); frame.add(panel); frame.setVisible(true); JMenuBar menubar = new JMenuBar(); frame.setJMenuBar(menubar); JM...

Request java heap dump (core dump) from within application

I need a way to request a heap dump from within the application. Rationale: When I encounter a specific error condition, I'd like to dump heap, so that I can see what is holding on to the memory. But I would like to automate this (For example, when I detect that some specific condition has occurred. Or when a watchdog doesn't gets its ...

How to undo TextEdit in eclipse JDT in a single step

I implemented an eclipse quick fix to change a block of code. I'm using something like this to save my changes: TextEdit edits = rewrite.rewriteAST(); UndoEdit undo = edits.apply(document); But when i undo my changes (CTRL+Z), i have to step through all the TextEdit actions one by one. Is there a way to group them so the quick fix ...