java

Getting suggestions on how to get the best code coverage in java

Several tools exists that allow to calculate path coverage for a set of tests, but is there a tool (or an algorithm) that could suggest values to get the best path coverage with the smallest number of tests possible? For example with the following classes: public class User { private boolean isAdmin = false; private String nam...

J2ME, InputStream hangs up after receving 40K of data over Bluetooth

On sending data over bluetooth from PC to my mobile(N73), the Input Stream seems to hang up. InputStream is derived from StreamConnection. PC software is built in VB.net. Mobile in Java ME. Does the InputStream have an internal buffer that needs to be emptied while reading large chunks of data? Data is being received in chunks of 10Kb ...

JSP page without HTML code for exporting data to Excel Sheet

Hi friends, I am facing a problem in exporting my data to excel sheet, this is because of some code which other developers in my team made. So the main problem is to export the data to Excel or .cvs using JSP page but without using any HTML code. Any suggestion would also help me to explore in my developing arena. Thanks for your efforts...

Overriding log4j settings at deploy time

For an application which is deployed on a large number of machines I took the decision to deploy a standard log4j.xml file with the application package, just to make sure that have the same settings are present everywhere : appenders, categories, levels. This does have the downside that when modifying the levels locally we risk losing t...

Java Servlet Pooling

Servlets 101, under Tomcat 6: Could someone kindly point me to a good explanation of the best way to eg. create a Collection of expensive Foo objects at servlet startup time and stash them somewhere where I can access them while processing each request? Near as I can tell there are at least three ways to do this and I am a bit fuzzy on...

How to restrict program resources + rights in JVM/OSGi?

I want to create a website where people can solve programming tasks and eventually upload their solution (in any JVM-language) in order to verify it and share it with others. I figured OSGi (learning it right now) might be a good tool to handle this task (is it?). But obviously I'm a little anxious about letting other people executing t...

How do I use the DES Algorithm in .NET?

How do I use DES in .NET? Here's how I'd do it in Java: public static String decrypt(byte[] pin, byte [] desKeyData ) throws Exception { //if (ISOConstantsLibrary.DEBUG) System.out.println("original: " + pin + " key: " + ISOUtil.bcd2str(desKeyData, 0, 2 * desKeyData.length, false) ); String out = ""; try { ...

CPU and profiling not supported for remote jvisualvm session

When monitoring a remote app (using jstatd) I can neither profile nor monitor cpu consumption. Heap monitoring (provided I do not use G1) works. jvisualvm provides the message "Not supported for this JVM." in the CPU graph window. Is there anything missing in my setup? The google showed up next to no results. The local environment (Mac...

Getting cannot convert object to ArrayList error when retrieving ArrayList from HttpSession

I have saved an ArrayList to the session object. I am trying to retrieve it using sriList = session.getAttribute("scannedMatches"); I am getting the compile time error "Cannot convert from Object to ArrayList". How can I get my ArrayList back from the session object. ...

Is there any form designer available for Google Android.

Hi, I am a new comer in Android development, I have downloaded and installed the Android SDK, but not find any GUI or Form designer, can any one know about some Form designer in for Android, Thanks in advance. ...

Call function periodically in Java

we need run one function periodically in Java web application . How to call function of some class periodically ? Is there any way that call function when some event occured like high load in server and so on . what is crontab ? Is that work periodically ? ...

.net 3.5:how to implement calculate crc32 for data using dot net 3.5 api?

how to implement calculate crc32 for data using dot net 3.5 api.I have done the same in java with following code. public static String getMAC (byte [] value) { java.util.zip.CRC32 crc32 = new java.util.zip.CRC32 (); crc32.update(value); long newCRC = crc32.getValue(); String crcString = Long.toHexString(newCRC); ...

VisualVM breaks jetty

Hi, I'm trying to profile application that is run by "mvn jetty:run", when I connect VisualVM to it and click on Profile jetty crashes with: Profiler Agent: Waiting for connection on port 5140 (Protocol version: 8) Profiler Agent: Established local connection with the tool # # A fatal error has been detected by the Java Runtime Environm...

Problem with exceptions and arrays

Can't really understand what's going wrong here? It's just a simple exception with an array out of bounds. public class Days { public static void main (String args[]) { String[] dayArray = new String [4]; { dayArray [0] = "monday"; dayArray [1] = "tuesday"; dayArray [2] = "wed...

Require some help with Java..

Use of if to simulate modulus operator Rewrite this increment() method from the NumberDisplay() class without using the % modulus operator. /** Increment the display value by one * rolling over to zero if the limit is reached */ public void increment() { if(value > limit); else value = (value + 1); value = 0; } well,...

jBoss Profile - how?

Hi there, I want to profile my jBoss Apps on a remote server. I've tried the Eclipse TPTP project but with an invoked agent my jBoss Portal doesn't start and it ends in unlimited lines of exceptions. jProfiler doesn't work either, portal doesn't boot. Netbeans IDE Profiling seems only to work on local machines or did I missed somethin...

Base 64 encoding, Java or JavaScript?

Hi guys, i've a particular js function that encrypts some form inputs into base64, but I need to run it in my Java app. So my question is, how can i call that function inside a java class? Otherwise I'll have to translate it but I think will be more complicated. Here's some of js code: function encode64(input) { //alert(input); ...

Retrieve Barcode Images one by one from PDF

Hello, I have created one pdf in which there is list of barcode images.I have to select one by one barcode image from it and have to send it to printer.So that I can take print out of each barcode image and use it as a sticker.How should I do that? ...

Really quick and dirty solution for embedding webkit in a Swing UI?

Hi, I am looking for a really quick and dirty solution for embedding webkit in a Swing application. What I am looking for is a way to implement a panel that contains a webkit browser running some JavaScript that will be able to do one or more of the following: Call a Java function of the containing application Send JSON objects to the...

CDC finger-friendly

Hello, I've been working in a Java mobile project using j9 as a virtual machine. So far the project has been developed for an stylus interaction using AWT components. We want to create a new version of the application more finger-friendly the internal logic is working OK so we wanna keep it, it is just the interface that we want to upd...