|
First of all, URL means universal resource locator. I think you are refering to the content of an URL.
Now, what have you tried? I'll give you a clue, The Java Books[^] has a whole section on URL's.
- read
- practice
- understand
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Here is a small example of how you would obtain the content
URL myURL = new URL("http://bla");
HttpURLConnection connection = (HttpURLConnection)myURL.openConnection();
connection.setRequestMethod("GET");
connection.setUseCaches(false);
StringBuffer response = new StringBuffer(connection.getContentLength());
if(connection.getResponseCode() != 200 ) {
}
else {
BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream()));
String line;
while((line = in.readLine()) != null) {
response.append(line);
}
}
in.close();
connection.disconnect();
|
|
|
|
|
Don't tell me!
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
hi.
ı will do the programme with java but my programme
must be code one to one check in row and error row's copy the new folder
|
|
|
|
|
Sorry, you are making no sense here.
0. You want to write a java program?
1. Reads in rows from a file?
2. Checks for /some condition/?
3. Writes what to new folder?
Please clarify what it is you are trying to do. State what you tried. Finally, ask for help with a specific problem. We are not in the habbit here of handing out code, so show some effort.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
hi there, i have to develop an application where have a method that modify heavily one class instance and it take a lot of resources. I think that a good idea to solve it create a new object with new data something like :
public class A extend abstractclass {
//// data .... bla bla bla
A() {
//constructor ... bla bla bla
}
public void famousmet(blablabla) {
// i would like to work anything like:
this = new A(blablabla);
}
But this don't work.
How can i do it? is it possible? thanks.
|
|
|
|
|
Can you learn to format your code, it makes it readable:
public class A extend abstractclass {
A() {
}
public void famousmet(blablabla) {
this = new A(blablabla);
}
}
You cannot assign anything to this , it represents the current instance of the class.
A similar approach would be to create a new copy of the class and return it to the caller. Would this work:
public A copyAndReturn(blahblah) {
A copy = new A();
copy.variable = this.variable;
...
return copy;
}
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hello,
in my app I am extensively using JTree and building nodes with DefaultMutableTreeNode . But I didn't found the setToolTipText method in DefaultMutableTreeNode to tooltip its content, except this[^] article to do the same.
Any shorter idea, or already similar existing object within standard packages?
Kujtim
|
|
|
|
|
I think that looks a pretty tidy and simple solution.
You have the class ToolTipTreeCellRenderer , so use it as the renderer for your trees. Decide on an interface for the tool tip text, make sure your nodes support and use it.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
How to round this 106.19999999999999 number like 106.20 by using java script?
|
|
|
|
|
udch wrote: java script
That's not Java
Anyway you could just do Math.round[^](106.19999999999999 * 100) / 100
|
|
|
|
|
Hi all,
I want to animate 2D images, specially face;
My scenario is i should draw contours of face around the image, on next key frame i should change the shapes of contour. When i animate i get the face in the image should animate accordingly.
It is something like morphing, but in morphing we have 2 images. In my scenario i have one image.
If i conclude i want some thing like this http://www.youtube.com/watch?v=ed_HAJGJfeQ[^]
I want to do it programatically, to create Talking Pictures.
I know you all guys are specialist into such kind of things. Please guide me how to full fill my scenario.
Thanks in advance.
Please do it as early as possible.
Nazar Hussain
|
|
|
|
|
Identical question on the C# forum, could the two be related?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I posted on two forums, so if any guru of Java or C# could help me.
|
|
|
|
|
Is the question Java or C#? If one or other, then in belongs in just the one.
Cross posts are very distracting, as you can see, a lot of pouple go to multiple forums and seeing the same post is just not accepted.
Please, only post a question in the one, most relevant, place. if you are not sure you are posting in the righ forum, say so up front and you will be directed, politely, to the correct forum.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Ok. Thanks for your guidance. I will never post same question on multiple forums.
Regards
Nazar
|
|
|
|
|
hi, im new to java.
regarding string array, is there a way to do string index.??
example:
String[] arr = null;
arr["name"]="myname";
arr["age"]="myage";
arr["gender"]="mygender";
The reason to my question is because im creating a class user. the variables will be private. i would need to get and set these variables, therefore creating a set of get() and set() function for each variable. If i can do the above method, i would simply need one set of get() and set() function.
hope thats not too confusing.
Thanks.
modified on Saturday, July 25, 2009 7:12 AM
|
|
|
|
|
Check this code, if convienent:
class Indexer{
static int returnIndex(String inp)
{
int ret_val=-1;
if(inp.equals("name")) ret_val=0;
if(inp.equals("age")) ret_val=1;
if(inp.equals("gender")) ret_val=2;
return ret_val;
}
public static void main(String [] args){
String[] arr = null;
arr[returnIndex("name")]="myname";
arr[returnIndex("age")]="myage";
arr[returnIndex("gender")]="mygender";
}
}
Kujtim
|
|
|
|
|
How will the keys be generic if he doesn't know the key strings to begin with?
Personaly I wold use a swicth , instead of multiple if statements, in returnIndex .
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
You will need to use Map[^]. Explanation[^].
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
Hello Pals,
I've written a program which declares an array of size 3, initializes its elements and prints the elements. The program is as follows:
package Demo;
import java.io*;
public class A{
public A(){}
public static void main(String args[])throws IOException{
int[] anArray=new int[3];
anArray[0]=10;
anArray[1]=20;
anArray[2]=30;
System.out.println("Array[0] index now contains: "+anArray[0]);
System.out.println("Array[1] index now contains: "+anArray[1]);
System.out.println("Array[2] index now contains: "+anArray[2]);
}
}
Now, suppose the array size is very long say 100! Then, will I have to keep on typing System.out.println(anArray[0]......anArray[99]);???
Wont that be huge? I C#.NET, we have the for-each loop construct to print all the elements in an array. Similarly, can I implement the for-each loop here? I did try, but I get Error as this: missing .class
Can anyone help me with an effecient way of printing elements in Java?
Help will be greatly appreciated,
Rajdeep
I calculate my days on earth..... approximately 55 years remaining for me to expire
|
|
|
|
|
I take it that you still can't use google. Help[^].
If at first you don't succeed, you're not Chuck Norris.
|
|
|
|
|
You really don't have a clue, do you?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
Is there a way to create and use a ruby object inside java code?
Thanks
|
|
|
|