java

Dynamic array declaration in java

hello, can anyone tell me the error in this java declaration String[][] t=new String[15][15]; this works fine and if i use String[][] t=new String[][]; because i need to declare the variable t as dynamic as i am not sure how much values i am going to store in t. ...

How to get CUSIP-Description data using Bloomberg API?

I had a look at Asynchronous data through Bloomberg's new data API (COM v3) with Python? before posting which has some pretty awesome info, but what I need is a way to create a CUSIP-Description table in a database using the Bloomberg API (to save $$$ by avoiding a CUSIP subscription) Does anyone know how to populate a table with CUSIP ...

Simple message encoding and decoding

Here is the senario: The message is to be embedded in a comparatively large block of random characters. The first and last 200 characters of the block will not be used for the real message. The block of random characters (alphabetic characters only, upper or lower case) will be generated by a computer before each message is embedded. Th...

Comparator for Generic Interface Without Warnings

Given: public interface PrimaryKey<Key extends Comparable> { Key getKey(); } and public class PrimaryKeyComparator implements Comparator<PrimaryKey> { public int compare(PrimaryKey first, PrimaryKey second) { return first.getKey().compareTo(second.getKey()); } } This combination works, but gives warnings about r...

Java application code structure

My Java application is not very big, but I would like to do it the "right way". Looking for suggestions to not make a big mess... I am using Swing, the Swing Application Framework and H2 database. It is a single frame application with different tabs. Most tabs will reflect some aspects of the data in the database. Some of them will be ...

running TestNG as an ant task causes an error

While I'm trying to run TestNG from ant as a 'testng' task, i'm getting strange behaviour. TestNG does not create class instance in @BeforeSuite method and in child classes in @Test method i'm getting NullPointerException. E.g. public class TestBase { Page mainPage; @BeforeSuite public void login() { ... ma...

can any one tell me what is wrong in my java code

import java.util.Arrays; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.Set; import java.util.Stack; import java.util.StringTokenizer; public class shift { @SuppressWarnings("unchecked") public static void main(String args[]) { String speech = "Sentence:NounPhrase Verb...

Usage of @IndexColumn results in a seq_num of 0

I would like to make use @IndexColumn to set seq number of some data the user enters. I am using Spring 2.5.6, JBoss 5.1 (JPA 1.0). For my parent class @Entity @Table(name="material") public class Material implements Serializable { . . /** * List of material attributes associated with the given material */ @OneToMany...

what are the fastest java tools to generate CRUD screens from a DB schema?

I am constantly in search of better and faster java tools to prototype webapps. I generally start with a good data model on the backend, and work towards the screens. What are some good tools that I might not know about that can be used to quickly generate functioning CRUD screens. ...

Strategy to fetch a subset of a collection

I have a scenario where my application has access to a session for limited time windows, during which it must fetch data from the database into memory, and then only use the in-memory data to serve requests. The data model is a simple one-to-many association such as: <class name="com.foo.Road" table="road"> <id name="oid" column="o...

POJO to EObject EMF Bytecode Enhancement

Instead of generating code from a model, has there been any work on a bytecode enhancement process? With that, one could just write POJOs, possibly annotate them appropriately, and then they would be automatically enhanced with all EMF features. ...

Java JTable Resize Row

Is it possible by default to resize a JTable row in the same way you can resize a column by dragging the mouse at the header? If so, how can you do this? ...

Generating a PDF using a PUT operation

I have a web application that can display a generated PDF file to the user using the following Java code on the server: @Path("MyDocument.pdf/") @GET @Produces({"application/pdf"}) public StreamingOutput getPDF() throws Exception { return new StreamingOutput() { public void write(OutputStream output) throws IOException, WebA...

Advance Calendar day by x amounts

Is there any difference between the following operations? (Advance current date to 160 days) Calendar c = Calendar.getInstance(); c.add(Calendar.DAY_OF_WEEK, 160); System.out.println(c); Calendar c0 = Calendar.getInstance(); c0.add(Calendar.DAY_OF_MONTH, 160); System.out.println(c0); Calendar c1 = Calendar....

How do I make a button that, when pressed, stops an internal program from running?

(individual question from http://stackoverflow.com/questions/4002976/ide-style-program-running ) ...

How does DispatcherServlet work if we have multiple XML Configuration file ?

Questions How does DispatcherServlet work if we have multiple XML Configuration file so how does Spring Application Context loads them and acts on them ? Scenario: In my case, we have an application that is supposed to global that is application should have AP{Asia-Pacific}, EM{Europ-Middleeast}, CA{Canada} and LA{Latin America} Versi...

HFT / UHFT Programming Platform

Hi, Any body who wants to join in developing HFT platform in Java which is user friendly. Many of the platforms available are not that great. This could be released as a opensource project. Please respond if interested. Suminda ...

Why is my if statement not working?

I am trying to check if a gas pump is free for use && full of gas, and then I am trying to make that pump the pump to be used by the cars in a queue. Thread carThreads[]=new Thread[TOTAL_CARS]; try { Pump pump1 = new Pump(); pump1.setName("pump1"); pump1.setFuelAmount(2000); pump1.setState(0); Pump pump2 = new Pum...

Dynamic Memory Handling Java vs C++

I am a C++ programmer currently trying to work on Java. Working on C++ I have an habit of keeping track of dynamic memory allocations and employing various techniques like RAII to avoid memory leak. Java as we know provides a Garbage Collector(GC) to take care of memory leaks.So while programing in Java should one just let go all the who...

Creating server side cursors

com.microsoft.sqlserver.jdbc.SQLServerException: The system is out of memory. Use server side cursors for large result sets:Java heap space. Result set size:280,236,031. JVM total memory size:423,297,024. I am trying to fetch a big data set from SQL and I get following error. Let me know if anyone have seen something similar and wi...