java

creating sybase stored procedure that returns jdbc statement.getWarning

I am creating a sybase stored prodedure that is being called through JDBC. Under certain error conditions i want my stored procedure to return a warning to the JDBC caller. What do i need to add to the stored procedure so Statement.getWarnings() returns a SqlWarning that contains an error message of my choice? ...

How to make JOptionPane.showConfirmDialog have No selected by default?

I implemented a Save As dialog in Java that prompts the user if the file already exists, and I want the No option to be selected by default. How do I do this? Here is my current code: JFileChooser chooser = new JFileChooser() { public void approveSelection() { File selectedFile = getSelectedFile(); if (selectedF...

Parsing a .sis (symbian) file using java

Im looking to read a .sis file (symbian content) using java, and hopefully try to derive as much meta related information from the binary as possible, such as application name, version, platform support and target languages. I think this can be done from looking at the symbian spec, and I seem to remember another application that did thi...

JavaWebStart app randomly fails

Hi I have a JAR signed with a self-signed certificate and deployed by JWS. It usually runs ok (most of the times) but sometimes fails which is quite annoying, It shows the splashscreen but nothing else. These are the last log lines: <record> <date>2009-09-08T16:55:33</date> <millis>1252421733468</millis> <sequence>173</sequence> <logg...

CheckboxCellEditor shows text and not a check box

I'm using the following org.eclipse.jface.viewers.CheckboxCellEditor.CheckboxCellEditor(Composite parent) I'm creating a table viewer with cellEditors and doing the following CellEditor[] editors = new CellEditor[columnNames.length]; editors[7] = new CheckboxCellEditor(table); I have a CellModifier that has the following public Ob...

XML Based Validation Frameworks Cross Language

Hi All, I'm about to embark on a new project within which we require the ability to re-use validations based on (preferably XML) on both the client and server. We would setup a service to provide the XML validation configuration data to the client side. The following is not meant to be inflammatory in any way. The Enterprise library...

How to initialize a ByteBuffer if you don't know how many bytes to allocate beforehand?

Is this: ByteBuffer buf = ByteBuffer.allocate(1000); ...the only way to initialize a ByteBuffer? What if I have no idea how many bytes I need to allocate..? Edit: More details: I'm converting one image file format to a TIFF file. The problem is the starting file format can be any size, but I need to write the data in the TIFF to li...

What are the java platform defaults?

Many parts of the Java API work differently depending on platform defaults, for example, creating a Sax parser from a SAXParserFactory uses a different Factory implementation based on the system property "javax.xml.parsers.SAXParserFactory". However, if that property is not defined, then the "platform default" is used. I've had very li...

simple example to use Xerces XNI?

Is there a simple example somewhere of using Xerces XNI? I'm looking at the sample code and can't make heads or tails of what it's doing, and don't want to just cut & paste into my application. For example, I can't figure out how to create an instance of org.apache.xerces.xni.parser.XMLDocumentSource. ...

error in combobox using SEAM 2.1.2 and JBOSS 4.2.3GA

Hi, I'm trying to create a combobox on a sean project and the sean tags are not recognizing my session bean method, but if i display the list in a simple table everything is ok. My session bean PaisSB.java: package br.com.logical.prepark.session; import java.util.List; import javax.persistence.EntityManager; import org.jboss.seam.S...

refactoring and removing case statements when circling over an enum structure

Hello, An enum structure declared in its own class is a member variable to the business logic class. That enum basically represents the state of that other class. Although I have revisited the issue several times, replacing, or getting rid of those case statements proves quite frustrating to me. Several business logic methods simple i...

How can I start JRuby on Rails from Java?

I need to start a copy of a Rails app from within Java. I would favor a lightweight HTTP server, as our installations will have a very small userbase (1-10, 10 being a huge installation). My design I am aiming for is for a single process, with the web interface written in Rails - running on JRuby in a background thread of the main serv...

What does the "|" in "int style = SWT.APPLICATION_MODAL | SWT.OK;" do (and how to Google it)?

I can't search for | in Google. If you had found it in a software source code that you are trying to interpret, you didn't know what it does and you couldn't ask other people for help, how would you find out what it does? ...

Where does System.err.println output go in Jboss?

Hi, I have a class in a WAR that I know prints some System.err.println output - where will this output end up? Any help appreciated, thanks. ...

Change AD Password with Java

I have a good connection to AD. I can authenticate and check error messages from failed auths. The issue I'm having comes from trying to change the password. I have an LDAPContext established at this point (yes it is an SSL connection). The issue comes from not knowing what value to use in the "username" parameter. I've tried all varia...

I am a java beginner. help me out with this simple code pls

import java.awt.Color; import java.awt.Graphics; import javax.swing.JButton; import javax.swing.JFrame; import javax.swing.JPanel; public class MyDrawPanel extends JPanel{ public void paintComponents(Graphics g){ g.setColor(Color.orange); g.fillRect(20,50,100,100); } public static void main(String[] args){ ...

Passing command line arguments to javaws (Java WebStart) executable.

Hi. Summary for those who might not want to read that much: How do I do this: ? If we could pass ad-hoc command-line args to javaws, then javaws apps could be more like "1st class citizen" "ordinary application". E.g. we could pass filenames of files to be opened. I would like to know if there is a way to pass "ad-hoc" command line arg...

Getting runtime class information from the web? Something like javap but at runtime on class loaded in memory

I am working with Websphere and complicated classloading issues. I want to be able to download or print information that would normally get printed by javap (the methods, etc). I may also need to get the raw binary class data, to perform a binary diff. How would you do this? ...

Stacks in Java with exceptions

Question : b) A Stack is a last-in first-out (LIFO) data structure. Write a Java class Stacklnt that stores a stack of integers using an alray as its private data structure. A Stacklnt has: A maximum size, which is set when a Stacklnt object is created. An exception should be thrown if the size is outside the range 10 to . 1000 A met...

How to get web application path outside of a JSP page?

Hi, I am new to JSP and JEE. So maybe there is something very obvious that I missed. I have a web filter class that needs to redirect the web request back to the root of the current web application. But since our application is not deployed in the root, I need to know the path the the current web application. e.g. http://www.mydomai...