|
Hint look at the problem Horizontally,
index 0 1 2 3 4 5 6 7 8 9
original array 0 1 2 3 4 5 6 7 8 9
Result on index 5
index 0 1 2 3 4 5 6 7 8 9
new array 5 4 3 2 1 0 6 7 8 9
7 6 0 1 2 3 4 5 8 9
6 7 0 1 2 3 4 5 8 9
0 6 7 1 2 3 4 5 8 9
1 0 6 7 2 3 4 5 8 9
0 1 6 7 2 3 4 5 8 9
.
.
.
.
etc
What do you conclude?
|
|
|
|
|
Please how do i configure pulsar to work properly with JAVA in JME.
|
|
|
|
|
|
When we use interfaces?
when we use abstract classes?
when we use singleton class
explain with senarios exactlly
|
|
|
|
|
First, the word is PLEASE, use vowels and people won't be hostile. It would be nice to have a title that describes the question as well.
Now, interfaces, abstract classes and the singleton pattern are NOT java ideas, they are Object Orientation concepts. I will try to explain them in one[ish] sentence each.
An interface is a definition of methods that must be supported but the implementation is left to the classes that use it. If you had an interface Move to be used by Animal classes, the way that each Animal moves is not important just that they must be able to move.
Abstract classes are classes that do not support instances but are concrete ideas in themselves. Think of the class Animal , it is abstract, every Animal is actually a more specialised thing - Dog , Cat , VB Programmer , Slug – they are all a type of Animal and can be addressed as an Animal , you just can not create an Animal .
The Singlton Pattern is a well established concept with a known implimentation. We want to ensure there is one and only one instance of a particular class; thing Highlander in code. To do this, the class will have a static instance of itself that is created the first time it is called.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Nagy Vilmos wrote: Dog, Cat, VB Programmer, Slug
Nah. VB Programmer is not only oxymoronish, it also isn't a valid identifier, so it can't be a class name.
|
|
|
|
|
Nagy Vilmos wrote: use vowels
Vowels are letters; in English, a,e,i,o,u, and sometimes y. I think you meant verbs.
|
|
|
|
|
LunaticFringe wrote: Vowels are letters
and
Nagy Vilmos wrote: First, the word is PLEASE, use vowels [...]
I don't think I was talking about verbs. The word 'please' with its vowels removed is 'pls' which is somewhat like 'plz'. I may be 42 but I do understand these things.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Nagy Vilmos wrote: I may be 42 but I do understand these things.
Nonsense, you're far too young.
|
|
|
|
|
Ah. I figured you were talking about the lack of verbs -- 'When we use interfaces' as opposed to 'Whend DO we use...'.
It seems there was something in the OP's message to irritate everyone.
|
|
|
|
|
hi , i want to develop an application in Java where one person will share screen with several people joining the conference , just need some help for start up. please share some links or help code to begin with.
I have no idea which technology i can use,how it's work flow.
Please anybody knows about that please help me.
|
|
|
|
|
Have a read of the forums.
We will not do your work for you, but will happily help. Try, get stuck and THEN ask a question.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
You would need to look into the java.awt.Robot class to capture the screen. Just search for this class and you will get several tutorials explaining how to use it. But remember, this class just captures images of your desktop.
You would then have to send those images over the network to other computers using an implementation of either Datagram (UDP-based) or TCP-based Sockets or RMI.
Plus, also look into Serialization. These are the only pointers I can give you. People do not write tutorials about such stuff. I hope this helps you find a suitable direction to move forward in. The beginning of knowledge is the fear of God
|
|
|
|
|
Is there any possible to create https page using GWT?
|
|
|
|
|
sangeethanarayan wrote: Is there any possible [way] to create https page using GWT?
Yes.
[Simple question gets a simple answer]
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
I am new for GWT.Now i have application with http.but i want move the pages to https(ssl).how to implement this? Please explain that?
|
|
|
|
|
Your original question wasn't at all clear. This is starting to move it out of the fog and into a light mist.
Let's start with the simple things:
0. What have you tried? [code example would be ggod]
1. Have you done a search? [bing.com is your friend here]
I am not an expert of intarweb stuff, but I'm pretty hot [well warm] on me java. My working knowledge would lead me to think that there will be an https class to do the hard work for you. Others may choose to do the search for you, I won't.
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
Hello,
I am making a SWT application.
It consists of main-,tab-,table- and storage-classes with it's respective instances.
I got first "cannot make a static reference to a non-static method"-errors and then "No enclosing instance of the type XXX is accessible in scope"-errors.
At first my tab- and table-classes where with static methods an properties (first error messages appeared).
Trying to put the instances in public and/or static (global) variables brought the same errors.
Then I put everything into instances (second error messages appeared).
Actually I am runnnig the code from the main method through the instances:
...
GoalTrackerStorage GoalTrackerStorage = new GoalTrackerStorage();
GoalTrackerTabFolder GoalTrackerTabFolder = new GoalTrackerTabFolder();
GoalTrackerTable GoalTrackerTable = new GoalTrackerTable();
...
GoalTrackerTabFolder.createGoalTabFolder(display, shell);
GoalTrackerTable.createGoalTrackerTable(display, shell);
...
I tryed to load data from the storage instance into variables of the tab instance and got both type of errors, in the end only the second ones stayed.
I want to keep the storage-data within the storage-instance hence I want to manipulate the data within an object-array at runtime and multiple dimensional arrays can be defined extendable.
The storage class looks like this (just to give an idea, what I tried so far):
public class GoalTrackerStorage {
public Object[][][][][][][][] dataObject;
GoalTrackerStorage () {
dataObject = new Object [1][1][1][1][1][1][][];
}
}
So all this leads to my questions:
Is there a way to reach an instance from another instance?
Since I am no pro, what's the best way to store data of different types in a way one can add/remove or expand them at runtime in one place/object?
I am working since two weeks on the problem (nothing usable from google, the whole internet or books) and the project should complete next week!
Thanks for help,
Rainer
modified on Friday, December 11, 2009 12:53 PM modified on Wednesday, February 10, 2010 4:55 AM
|
|
|
|
|
Your question is really vague but ir really looks like you are a bit confused about how to use classes properly.
TheRainer wrote: Is there a way to reach an instance from another instance?
Yes, as long as the first object has access to the object it wants to use.
As far as I understood, you have a GoalTrackerStorage class which contains your data, and then you have other "GUI" classes that have to display the content of this class. Am I right ?
Well, the easy solution is to simply pass the instance of GoalTrackerStorage to your different classes that need to show it.
TheRainer wrote: GoalTrackerStorage GoalTrackerStorage = new GoalTrackerStorage();
GoalTrackerTabFolder GoalTrackerTabFolder = new GoalTrackerTabFolder();
GoalTrackerTable GoalTrackerTable = new GoalTrackerTable();
By the way, this is wrong: you cannot have a class instance with the same name as a class. I suggest you use the standard notation in java: all the variables starts with a lowercase letter. So, you would write this instead:
GoalTrackerStorage goalTrackerStorage = new GoalTrackerStorage();
GoalTrackerTabFolder goalTrackerTabFolder = new GoalTrackerTabFolder();
GoalTrackerTable goalTrackerTable = new GoalTrackerTable();
So, in this case, the solution to your problem is to simply pass the goalTrackerStorage instance to the constructors of the different classes:
GoalTrackerStorage goalTrackerStorage = new GoalTrackerStorage();
GoalTrackerTabFolder goalTrackerTabFolder = new GoalTrackerTabFolder(goalTrackerStorage );
GoalTrackerTable goalTrackerTable = new GoalTrackerTable(goalTrackerStorage )
(Of course, you will need to supply a corresponding constructor to those classes).
|
|
|
|
|
|
I think you should really start learning the basics. This is really really basic java programming. You pass the variable in the constructor but you only store it in a local variable in your constructor. Which means that it is not visible outside that method. You have to make it a member variable of your class in order for it to be accessible in other methods.
Please use the code block tag when posting code, because it is very difficult to read otherwise.
|
|
|
|
|
Thanks Cedric, that brought the final solution for me.
And yes, my basics seem to be thin.
I only wonder why I don't get such points when I read my books about java:
- Go To Java 2, 2. Auflage . Handbuch der Java-Programmierung von Guido Krüger von Addison-Wesley
- JAVA als erste Programmiersprache. - vom Einsteiger zum Profi von Joachim Goll, Cornelia Weiß, und Frank Müller von B.G. Teubner Verlag
Finding a usefull book is not such easy.
|
|
|
|
|
Hi! I created a page that has a "Back Button", it opens up as a pop up window. The Back Button doesn't work IE but id does in FireFox Mozilla.
I have tried with window.history.go and window.history.back but non of them is working. Any Suggestion please ?
|
|
|
|
|
Wrong forum. This is not a Java question. You will have more luck with this if you post it in the Web Development forum.
|
|
|
|
|
The fact thats it an AVL tree probably doesn't matter. I have a printTree method in my tree class and I'm trying to print the nodes in the form of the tree. I've successfully printed the nodes the correct way but now I'm trying to label the nodes by their relative height (i.e. equalheight, right hi, left hi).
The problem is my root, which is right hi, won't change to that. Everything else is working for every node except the root, but the counter I made that determines the label is the right number. I can't for the life of me figure out why it is staying at equal height.
The first thing is the label, then the node, and the end number is the count.
EDIT: I know you can't tell because the tabs got taken out but alstoto01 is the root, thus the first node to go through the methods.
This is what I'm outputting right now (the Wrong way):
EQUALHT:aaronha01: 0
EQUALHT:agganha01: 0
EQUALHT:alliega01: 0
EQUALHT:alstoto01: -1
EQUALHT:bollifr01: 0
EQUALHT:cronera01: 0
EQUALHT:grammal01: 0
EQUALHT:henlega01: 0
RIGHTHI:herrito01: -1
EQUALHT:jacobsp01: 0
The Correct output should be:
EQUALHT:aaronha01: 0
EQUALHT:agganha01: 0
EQUALHT:alliega01: 0
RIGHTHI:alstoto01: -1
EQUALHT:bollifr01: 0
EQUALHT:cronera01: 0
EQUALHT:grammal01: 0
EQUALHT:henlega01: 0
RIGHTHI:herrito01: -1
EQUALHT:jacobsp01: 0
Here is the code for the printTree method:
private ArrayList<AnyType> printTree( AvlNode<AnyType> t, String buffer )
{
if( t != null )
{
int count = counter(t);
if(count == 0)
freq = "EQUALHT:";
if(count < 0)
freq = "RIGHTHI:";
else if(count > 0)
freq = "LEFTHI:";
printTree( t.left, buffer + " ");
pTree.add((AnyType) (buffer + freq + t.element + ":") );
System.out.println(buffer + freq + t.element + ":" + count);
printTree( t.right, buffer + " ");
return pTree;
}
return null;
}
Here is the code for my counter method:
private int counter(AvlNode<AnyType> t){
int count = 0, left = 0, right = 0;
AvlNode<AnyType> temp = t;
while(temp != null){
temp = temp.right;
right++;
}
while(t != null){
t = t.left;
left++;
}
count = left - right;
return count;
}
It's probably a simple fix but I just can't see it. Any help would be appreciated since this is a really stupid problem to have in the grand scheme of things.
|
|
|
|
|