In Java, when you do
int b;
b = b + 1.0;
You get a possible loss of precision error. But why is it that if you do
int b;
b += 1.0;
There isn't any error?
Now that i have learned the theory of OOPS in good number of books , and practised a little.
Still i am not comfortable when i look into OOPS being applied in some of the Open Source projs.
Can someone suggest any problem / solution kind of book , or any resources , that covers OOPS end - end. (C# , Java preferably)
the java doc describe that the constructor Date(long date) constructs a Date object using the given milliseconds time value since January 1, 1970, 00:00:00 GMT
actulely when i did new Date(0), the date is Jan 01 01:00:00 CET 1970
I don't know why it begin with 01h
Hello, I want to host a web application on a private JVM they offer 32, 64, 128, 256 MB plans.
My web application uses Spring. And I store some objects for every logged in user session.
My question is: How can I profile my web app to see how much heap size it needs so I can choose a plan?, How can I simulate hundreds of users logged in at the same time?
I'm developing the application using Netbeans 6.7 Java 1.6 Tomcat 6.0.18
Thank you.
Hello
Please suggest me a good open source web crawler written in C++,JAVA or PHP.
i just need to crawl/index some specific websites for specific contents(images,text,videos).
i know that their are already a lot of question & answers about this topic on this website
but i am a little confused after reading all of them.
So i am sorry if i am repeating the same question again.
-Thanks in advance
Hello All,
I have made a program which is fetching data from server to and game to server. I want to keep these record in my file. But my problem is this is not in good format that i can read easily. I am reading all data as "Byte" (from java). Can anybody explain header or data info of packet. so I can read it in human manner Huh
thanks.
I have a Java-application that loads data from a legacy file format into an SQLite-Database using JDBC. If the database file specified does not exist, it is supposed to create a new one. Currently the schema for the database is hardcoded in the application. I would much rather have it in a separate file as an SQL-Script, but apparently there is now easy way to execute an SQL-Script though JDBC. Is there any other way or a pattern to achieve something like this?
So I have a java hashmap like below:
hMap.put("1", "One");
hMap.put("2", "Two");
hMap.put("3", "Two");
I would like to remove ALL items where the value is "Two"
If I do something like:
hmap.values().remove("Two");
Only the first one is deleted, I want to remove them all, how can this be done?
While studying the Collection API, we find that some methods (add, remove,...) may throw a java.lang.UnsupportedOperationException if the current implementation of the Collection does not support those functionalities.
Is there,actually, in the JDK, a concrete Collection that does not support those methods ?
Thanks a lot for your answers.
Is it safe to do connection.createStatement().executeQuery(String query);, or should each java.sql.Statement object be created and closed by "hand" on every use, even if the connection is closed in a finally block?
If multiple queries are executed in one method by one connection it would use much less code if instantiating and closing each statement wasn't strictly necessary.
This is a quesiton taken from a java exam,
How many objects are eligible for gabage collection at #1 ?
public class Main {
Integer x = 32768;
public static void main(String[] args)
{
Main m = new Main();
m = null;
// #1
}
}
I thought it just collect Integer x, does GC even collect the Main object m?
In Java, when you do
int b;
b = b + 1.0;
You get a possible loss of precision error. But why is it that if you do
int b;
b += 1.0;
There isn't any error?
I have a vector of float arrays i.e. Vector . I want to convert this to one float array i.e. move every element in every float[] within the vector to a new float[]. Am a bit puzzled on using the Java built in method vector.toArray() to do this. Any ideas pls?
I'm a little bit confused about the difference between the two. An example of the Calendar API is supposedly located here: http://samples.google-api-java-client.googlecode.com/hg/calendar-android-sample/instructions.html, but the author himself suggests using the Calendar Provider API, details about which are here: http://developer.android.com/guide/topics/providers/calendar-provider.html.
Can someone explain to me the difference between the two, and which would be better for me to use for a simple calendar app?
If I want to properly exit a documentum java job (if params are invalid for example), should I use a system.exit() or is there another way to do it.
As far as I know system.exit closes the virtual machine, does it have an effect on other jobs running?
i have used html in my java class and in one case i have used username.Username is a variable which gets values dynamically. in one case its value is 'rg@bg' but here instead of d name i m getting d url which it is directed to in my jsp. how do i ensure tht d value of username comes on d display page as it is.
i have tried "@"+username. didnt work
I'm trying to create a REST based web service with data encapsulated using JSON. My problem is when I pass the string version of JSON in the URI it turns to something like this: %7B%22coal%22:100,%22ele%22:1500.1%7D.
I'm wondering if there are any functions Java for converting between the escaped and unescaped versions so I can parse the string.
I'm working my way through the NotePad tutorial, and that's all fine - I'm not a Java programmer but it's close enough to C# (or vice versa) to make it easy to pick up. I'm surprised that there aren't any RAD tools for Android apart from Mobiforms. Is there anyone out there with experience of Mobiforms ?
We have a standalone java swing app, in which the user can print something that he drew, on a printer by giving its IP.
Now the requirement is that the app needs to remember the ip that was given the last time by this user.
What I could think of till now is (a brute one though) - keep a log file kind of storage on the client machine, and that everytime the app comes up it reads the last submitted one.
Any suggestions would be helpful.
Thanks in advance.
Is anyone attempting to implement C# for the JVM? As a Java developer, I've been eyeing C# with envy, but am unwilling to give up the portability and maturity of the JVM, not to mention the diverse range of tools for it.
I know there are some important differences between the JVM and CLR but is there anything that is a showstopper?
I want to build a sip client based on SIP Communicator - the Java VoIP and Instant Messaging client. Basically I need to plug in some how and redirect VoIP to and from my application. Where is a good place to start?
If this seems a bit vague, I do apologize.
according to http://java.sun.com/javase/6/webnotes/trouble/TSG-VM/html/clopts.html it should be possible to enable -XX:+HeapDumpOnOutOfMemoryError using JConsole in runtime. How?
I assume its somewhere under MBeans tab and the com.sun.management - HotSpotDiagnostic - Operations - setVMOptions ?
What is the recommended way of setting GET query parameters on a Restlet Request object?
I think I can see how to get them out of the request using getQueryAsForm(), but how do they get set in the first place?
At the moment, I am adding them manually to the URL using a StringBuilder and java.net.URLEncoder, but it seems like there should be a better way.
In my Java application I use a DateFormat instance to parse date inputs.
DateFormat fmt;
fmt = DateFormat.getDateInstance(DateFormat.DEFAULT) // dd.MM.yyyy for de_DE
The problem is that the user insists to enter dates in the form 31.12.11.
Unfortunately this is parsed to 31.12.11. (0011-12-31 in ISO format) Instead I want the parsed date to become 31.12.2011 (2011-12-31 in ISO format).
Can I modify the date format to somehow parse inputs that way?