When do you call super() in Java?
I see it in some constructors of the derived class, but isn't the constructors for each of the parent class called automatically? Why would you need to use super?
What is the easiest way to do a GAE/J datastore backup?
It looks like there is python bulkloader.py tool to do backup for Python apps, but what should I do to backup Java app? Is there any way to use python tool?
Well, I'm pretty much trying to figure out how to pull information from a webpage, and bring it into my program(in Java). For example, if I know the exact page I want info from, for the sake of simplicity a Best Buy item page, how would I get the appropriate info I need off of that page? Like the title, price, description? What would this process even be called? I have no idea were to even began researching this :'(
Hi,
I have a Cocoon 2.2 based application which uses blocks for different tasks and one block for shared pipeline fragments. All blocks are mounted within an Cocoon webapp.
Now I would like to have an block which generates an overview of all other mounted blocks. I probably will have to use Java code - which is fine - but I am kinda lost where to start.
Can anyone point me the right direction?
I'm trying to use flexjson to convert the following json string into a java object:
{"inboundDataNotification": {
"callbackData": "12345",
"inboundData": {
"message": "Hello World",
"messageId": "mes1234"
}
}}
Using the following method:
import flexjson.JSONDeserializer;
@RooJavaBean @RooToString @RooJson(fromJsonArrayMethod="", toJsonArrayMethod="", toJsonMethod="") public class InboundData {
private String messageId;
private String message;
public static InboundSMSMessage fromJsonToInboundSMSMessage(String json) {
return new JSONDeserializer<InboundSMSMessage>().use(null, InboundSMSMessage.class).deserialize(json);
} }
All fields are null after this method is invoked. Any ideas what to change here?
I am trying to create an app which uses a combination of jQuery templates and Backbone.js
I have very little experience in both of them (though I know jQuery)
Could you please provide some good examples where jQuery templates and Backbone.js are used effectively.
Also I am loooking at using JSON for the model/data and trying to persist the data (I use Java at the backend)..So looking for ideas on how that can be integrated?
Thank you.
How in Java can I get list of all characters appearing in string, with number of their appearances ? Let's say we have a string "I am really busy right now" so I should get :
i-2, a-2, r-2, m-1 and so on.
Say I have the following code:
public class ClassToTest
{
AnotherClass anotherClass;
public void methodToTest( int x, int y )
{
int z = x + y
anotherClass.receiveSomething( z );
}
}
public class AnotherClass
{
public void receiveSomething( int z ) {.. do something.. }
}
I want to make assertion on the value of the variable z. How do I do this? Variables x, y, and z could be some other Java class types, and I just used "int" for simplicity.
I'm getting a strange NullPointerException, evidently thrown by the following line of code:
Iterator<Note> it = notes.iterator();
I've checked, and at the time the java.util.TreeSet notes is always non-null (with 15 elements). The TreeSet API says nothing about iterator() throwing NullPointerExceptions. What else could be going here?
Is there any reason behind using date(January 1st, 1970) as standard for time manipulation? I have seen this standard in Java as well as in Python. These two languages I am aware of. Is other popular languages also follows the same standard?
Please describe.
I am a Java developer but up to now have not had any hands on experience using the Spring framework.
Does anyone know of anyone good online tutorials that explain the basics and offer good examples and sample code.
I'm interested in programming languages well suited for embedded programming.
In particular:
Is it possible to program embedded systems in C++?
Or is it better to use pure C?
Or is C++ OK only if some features of the language (e.g. RTTI, exceptions and templates) are excluded?
What about Java in this domain?
Thanks.
According to the java API, the constructor Date(year, month, day) is depreciated. I know that I can replace it with the following code:
Calendar myCal = Calendar.getInstance();
myCal.set(Calendar.YEAR, theYear);
myCal.set(Calendar.MONTH, theMonth);
myCal.set(Calendar.DAY_OF_MONTH, theDay);
Date theDate = myCal.getTime();
However, I would like something shorter to replace it with (ideally one-two lines).
Any suggestions?
Has anyone expirience this error before: this happens when I hit CTRL + space , here is the error :
For those who has tinyurl blocked: This compilation unit is not on the build path of the java project.
This is a maven project, mvn eclipse:eclipse doesn't help I mean it compiles and runs just fine just something is wrong and I can't figure out what. I checkouted this project from SVN, it wasn't developed on my PC.
DI creates an extra layer of abstraction so that if your implementation class ever changes you can simply plug in a different class with the same interface.
But why not simply refactor when you want to use a different implementation class? Other languages like Python and Ruby work fine this way. Why not Java?
Hi,
Could you please help in the following? Is there an acceptable design guideline to implement WS Notification Messaging in java? My scenario is the following: a web service client makes a web service call to a web service.
After that, the web service should be able to send asynchronous notifications to the web client (as a result of the first web method call). What approach should be used?
Thank you,
Regards
I would like to have a button in my window such that if I click it (button) the window is closed.
I found out that I can close a window in the following way:
referenceToTheFrame.hide(); //hides the frame from view
refToTheFrame.dispose(); //disposes the frame from memory
But if I do this way, compiler complains:
Note: myProgram.java uses or overrides a deprecated API
Note: Recompile with -Xlint:deprication for details.
Do I do something unsafe?
I'm quite confused about the basic concepts of a Hash table. If I were to code a hash how would I even begin? What is the difference between a Hash table and just a normal array?
Basically if someone answered this question I think all my questions would be answered:
If I had 100 randomly generated numbers (as keys), how would I implement a hash table and why would that be advantageous over an array?
Psuedo-code or Java would be appreciated as a learning tool...
I have some Domain classes such as Student, User etc which are used on server and client (gwt) sides.
Can I exclude this domain classes to separate maven-module, so I can add this module as dependency to other maven-modules (i.e. add this module as dependency to maven-module which contains gwt related stuff, so this domain classes will be generated to JavaScript, and add this module as dependency to "normal" (not gwt) Java maven-modules, so this domain classes won’t be generated to JavaScript)?
I need to write a software, which launches DRM jobs in a customer environment and monitors those jobs status.
It should work with various customer environments and DRMs - like LSF, Sun Grid and others.
Can you recommend some 3rd party library, which hides DRM differences from me and has API like "launch job", "get list of jobs", "get job status" etc. ?
Both Java and native libraries are good for me.
I am trying to create a Response class in Java which has a method
void setResponse(String response);
Different response subclasses will have different requirements for the response. The string that is passed to the function is received from the user.
What is the correct way of handling a wrong response?
Should the function throw an exception like IllegalResponseException
Should the function be declared like
boolean setResponse(String response, String errorMsg)
and return false if the response is wrong and set the error message to the appropriate value
I have a ByteInputStream, created from a Socket in Java. The connection is to a simple web server that uses chunked transfer encoding. The web server does in fact work in normal browser. But in my program, I am attempting to read, I read the first first bytes (some 5kb of data). But each read after that returns 0 bytes read. Isn't it supposed to block until it can read?
In Eclipse, the Java Method Override Indicator is the little upwards arrow next to a method in the Type Hierarchy view.
A solid arrow means a method overrides an existing method lower in the hierarchy.
What does the hollow arrow mean?
Do annotations effect either arrow?
I have application that uses IPV4 addresses (it stores them as long), so it only understands IPV4 addresses. Is it possible to convert IPV6 address to IPV4 with Java?