Tagged Questions
Java is an object-oriented language and runtime environment (JRE). Java programs are compiled to bytecode and run in a virtual machine (JVM).
0
votes
0answers
3 views
how to send an object with URLConnection ?
my goal is to send a object from a client application to a server using URLConnection The objet User :
Public class user {
String nom;
Integer id ;
boolean sex;
}
i don't ...
0
votes
0answers
6 views
Excluding Synthetic Classes in Emma within STS
My problem is
java.lang.IllegalStateException: Could not access method: Can not set
static final [Z field packageName.ClassName.$jacocoData to [Z
So I searched around online and I found the ...
0
votes
0answers
11 views
defining regions in bitmap (java)
I have a graphics application in JAVA, which is made up of many different shapes (lines, circles, arcs, etc, which are drawn via the Graphics.drawLine(), drawArc()... methods). I would like to create ...
0
votes
3answers
52 views
Replacing only the first space in a string
I want to replace the first space character in a string with another string listed below. The word may contain many spaces but only the first space needs to be replaced. I tried the regex below but it ...
-5
votes
0answers
33 views
Any good c++ guides for java programmers? [on hold]
Does anyone know about any good guides for learning c++ which would be good for someone who has an intermediate knowledge about java and OOP in general? It does not need to be specialized for this. ...
0
votes
0answers
5 views
JPA, EclipseLink. Get progress whe upload a Blob field?
To improve the user experience. I would like to implement a progress bar, when the user commit a query with a Blob field. Now we are using EclipseLink and JPA in a Swing Client. But i don't know how ...
-2
votes
2answers
39 views
Creating an Android App [on hold]
I don't know if this is the right place to ask this, but I'm going to go ahead and ask since you are all programmers..
I have a good idea for an Android App (I think so anyways), and I believe with a ...
-1
votes
1answer
12 views
text extraction from web pages
I'm working on a program that reads the content of this page: http://www.pogdesign.co.uk/cat/ and alerts me when one of my favourite tv series is scheduled and on which day of the month. In this ...
0
votes
0answers
3 views
Log4j2: SMTPAppender does not send mails with error or fatal level
I recognized some problems with the SMTPAppender in log4j2. Whenever log events with the level error or fatal are created without having an event with the level info before no mail is sent and the ...
0
votes
0answers
4 views
Get bit rate from mp3 file with Apache Tika
I use Apache Tika to retrieve metadata from mp3 file. However I'm not able to get the bit rate. How can I get the bit rate of mp3 file using Apache Tika?
I also tried Jaudiotagger but I have only ...
1
vote
3answers
37 views
Beginner Java - Creating multiplication table by looping
I was tasked to make a multiplication table from 1-10 but I was not satisfied with my code, it seems to be long:
for (int i = 1; i <= 10; i++)
{
System.out.println("1x" + i + " = " + ...
-3
votes
2answers
21 views
Clarification in Java Package structure
I have to add a filter in the web.xml of my web app which uses the directory structure which is in a jar file which I'll be adding to my lib directory of my web app.
<filter>
...
0
votes
0answers
12 views
Sending and Receiving with UDP
I am trying to implement data transfer between a back-end server and the android device which is a request from device to server for information and the server responds(UDP use because it is faster ...
7
votes
4answers
43 views
Why aren't fields initialized to non-default values when a method is run from super()?
I must have spent over an hour trying to figure out the reason for some unexpected behavior. I ended up realizing that a field wasn't being set as I'd expect. Before shrugging and moving on, I'd like ...
1
vote
6answers
45 views
converting one line string into individual integers
if i have this line in a file: 2 18 4 3
and i want to read it as individual integers, how could i?
i'm using bufferreader:
BufferedReader(new FileReader("mp1.data.txt"));
i have tried to use:
...
0
votes
0answers
4 views
onsingletapup from osmdroid calls multiple items
I've created an Osmdroid map with makers, but some markers are very close, so when i tap on it, there a lot of "onSingleTapUp called", it's like i'm clicking on all of them in the same time, and i ...
0
votes
0answers
9 views
Transcoding a list of protobuf's into memcached
I have a List of protobuf's that I want to store in memcached under a single key. The default serialization doesn't appear serialize/deserialize all the nested objects correctly, so I'm trying to ...
0
votes
0answers
8 views
Using SchemaExport in Play Framework
On Play Framework 1.2.5 with Jpa+Hibernate as ORM, I would like to call programmatically Hibernate tool SchemaExport.
I tried this code:
Ejb3Configuration cfg = getPlayEjb3Configuration();
...
0
votes
0answers
22 views
Android / Java adding 2 thinks together to a url
My problem is that when I want to add to java strings together to a url, logcat says that the url string is empty. So can anyone tell me how to do it correctly ?
Here some code: The first string:
...
0
votes
1answer
17 views
Is there a way to read contents of a directory from web app
I have a web application built on the JVM. In this application the users are able to upload files. I read the contents of the file and do "something" with it.
In addition to this, I would like to ...
0
votes
2answers
45 views
How to return type I explicitly passed as parameter?
I want to store a type as parameter, but when I return it and check in within a JUnit test, I get something like
Expected: an instance of Java.lang.String
but: <class java.lang.String> is a ...
0
votes
0answers
4 views
Prevent Eclipse server classpath from changing significantly on republish
In the context of Eclipse Juno + Weblogic 10.3.5, although this likely applies to other configurations.
In a webapp when classes exist in multiple locations of the classpath hierarchy, the management ...
-2
votes
1answer
17 views
Using Gson retrieving a JSON array in Java
My json object and array looks as follow -:
{"order":[{"name":"Nivea Deo","qauntity":1,"price":25},{"name":"Johnson Baby Powder","qauntity":1,"price":70}]}
I am sending this using JSP and capturing ...
0
votes
0answers
20 views
Finding a mapping which was applied to values
I have mapping A which maps some objects to one or more ordered pairs of integers (a, b). Each pair appears only once in the mapping.
Some bijective mapping F was applied to the integers used in those ...
0
votes
3answers
34 views
Is there a tree that can rank an object?
I"ve coded a Red Black binary statistic tree to get the rank of an arbitrary object that is comparable to the other objects in the Red Black tree. I wonder if there is an API class that provides the ...
0
votes
0answers
19 views
Tomcat's context hierarchy
I know tomcat can define Contexts in a few different ways. For this particular question, I have a main context defined in $CATALINA_HOME/conf/context.xml, and per module context's defined in each ...
3
votes
0answers
15 views
Powermock and Spring cause ConversionException when injecting EntityManager in test
When attempting to combine the Spring test runner and the PowerMock runner using the PowerMockRule technique, I get an exception from the Thoughtworks XStream library whenever I try to inject an ...
1
vote
1answer
11 views
Hibernate org.hibernate.MappingException for non-annotated field
This is my POJO, a simple student class.
@Proxy(lazy = false)
@Entity(name = "Students")
public class Student implements Serializable {
private static final long serialVersionUID = ...
-2
votes
1answer
31 views
How do I reference classes from another project in NetBeans?
I am using NetBeans 6.8.
I have a class ClassA situated in PackageA in JavaApplicationProject1.
I plan to use this class in ClassB situated in PackageB in JavaApplicationProject2 just by importing ...
-1
votes
2answers
25 views
Can I make these method more efficient? My app seems to be eating up a lot of my front end hours
These methods basically store data in the datastore and blobstore, and then retrieve it. The latency is 400ms+ and it seems to be taking a lot of the front end time. The high latency could be due to ...
0
votes
4answers
58 views
class member definition in java
I recently encountered this phrase:
"Class A has class member int a"
Probably obvious but this sentence just means a is an int defined in class A, right?
And another thing, for example a is ...
0
votes
0answers
16 views
Convert Map Coordinates to Coordinate System
I have a list of addresses/GPS-coordinates which I need to convert into a coordinate system, so that the distances between the points don't equal the air-line distance but the travel distance (in ...
-3
votes
0answers
33 views
Blender not running from inside java
I am trying to run blender from inside Java but for some reason i can't seem to make it happen when i am using two variables for the start and the end frame.
Here is the line of the code:
Process ...
0
votes
1answer
20 views
Android : Restore time in resume
I have question i have a chronometer in my app, when i back to my main window, and get back to Timer activity, I just want to resume a time on chronometer from CountDownTimer, how to to this ? Bundle ...
0
votes
0answers
4 views
Cache Invalidate not working in Shiro
We are using Apache Shiro for managing auth in our app. When using Permission I am using out of the box memory based caching and here is my shiro.ini.
[main]
...
2
votes
2answers
63 views
Java - modify compareTo method to sort integers from 1
I'm trying to sort an ArrayList of objects using of comparable interface:
public class Unit implements Comparable<Unit>{
// attributes
int position;
@Override
public int ...
0
votes
0answers
14 views
Evaluation Recommender with GroupLens 100K
I want to evaluate different Recommenders (SlopeOne, Item-Based) against the GroupLens 100k Dataset (File ua.base) . To create and evaluate the Recommenders I'm using the example from Mahout in ...
0
votes
2answers
39 views
Java Method with the parameter “List<Class<? extends Object>>”
I want a method that works like this, but I can't access the properties of the objects I pass in. I can only call class methods like '.getFields()', 'getSuperType()', etc. All objects that are ...
0
votes
0answers
22 views
Checking which browser is being used
I am using DefaultSelenium and want to know which browser was being used. My project is set up so that there is a base class that provides a number of convenience methods and protected variables, and ...
0
votes
3answers
16 views
Workaround for “null primitives” in JDBC PreparedStatement?
When using raw JDBC, you can parameterize a PreparedStatement like so:
PreparedStatement statement = connection.prepareStatement(someSQLString);
String someString = getSomeString();
Integer int = ...
1
vote
1answer
7 views
Catching a 404 error with Selenium
I'm using Selenium and JUnit with Java and I want to know if a 404 error occurs when opening a new popup by clicking on a link (i'm searching for a thing like assertTrue(selenium.no404error()).
How ...
0
votes
0answers
3 views
Ignore DTD element in a XOM Parser to avoid no File found exception
I need to ignore this DTD file path in the below XML to avoid file not found exception.
<?xml version='1.0' encoding="UTF-8"?>
<!DOCTYPE Document SYSTEM ...
0
votes
0answers
8 views
Does CXF integrates with CDI/Weld?
I’m currently working on a project using Tomcat 7 + CDI/Weld + Apache CXF. I would like to know if anyone around here have already integrated Apache CXF with CDI beans with success. I need to inject ...
-5
votes
1answer
42 views
do i need frame work for an application if i don't hesitate with writing code for each and every functionality [on hold]
i am here to ask a question before i am going to start developing an application(dynamic web based application)
i.e..... Do i really need a high level frame work(struts,sptings,etc..) to ...
0
votes
1answer
23 views
Spring Tx error
java.lang.IllegalStateException: Existing transaction detected in JobRepository.
Please fix this and try again (e.g. remove @Transactional annotations from client).
Please send any suggestions for ...
0
votes
0answers
7 views
Parameterize Post Request payload using Rest Assured
I have below post request in Rest Assured code :
I want to parameterize it. Please suggest.
given().contentType(JSON).with()
...
0
votes
1answer
43 views
Too big value for double
How does Java handle a situation when a Double is assigned a value bigger than Double.MAX_VALUE?
Is there a standard behavior specified?
-4
votes
7answers
66 views
Why ArrayList<Integer> Contains is not working?
I have:
ArrayList<Integer> onlyOne = new ArrayList<Integer>();
onlyOne.add(Integer.valueOf(3));
ArrayList<Integer> two = new ArrayList<Integer>();
...
1
vote
1answer
8 views
marshall object to xml and remove xmlns
I am using the following code to do unmarshalling:
@Override
public String marshal(Object document) throws JAXBException {
Class clazz = document.getClass();
JAXBContext context =
...
0
votes
1answer
36 views
java.io.File getting extra char while writing into file
Why I am getting extra char while writing into file for the following code? If I am using writeBytes(String) than the below code is working file. Then what is the problem with dos.writeChars() method?
...