Lina Mahl

Greenhorn
+ Follow
since Jul 02, 2002
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Lina Mahl

I have suddenly realised that I dont understand how I am suposed to do the following
"Additionally, the program must be able to work in a non-networked mode. In this mode, the database and user interface run in the same VM and no networking is performed, and no sockets should be created. The user must be able to select the operating mode, although it is acceptable that the program stay in one mode once it has started up.
"
I have been working on making two jar files, one client and one server but that wont work for me in a "no network mode". How should I think?
/Lina
Ha! It worked :-) Thank you :-)
/Lina
I am using RMI and I can start my server in my �jar file. But my client wont find my server ether with my �jar file ore when I use class files. Everything work�s fine if I use just class files.
My server says :
java �jar FlyByNightServer.jar 127.0.0.1 db.db
Server started OK!
But my client says :
java �jar FlyByNight-jar 127.0.0.1
FlyByNight : java.rmi.UnmarshalException: error unmarshalling return; nested exception is: java.lang.ClassNotFoundException: suncertyfiy.bussiness.FlightManager_stub
Where should I look fore the problem? Everything works with just class files.
Thanks for the tips about the methods.
Yes I know that it is not a god way of naming variables..... I am working on it.
What about my lock question. Why is it importent to know WHO locked the record and not just that it IS locked?
Hello
I have a JFrame with a button and a ScrollPane with my JTable (built with a TableModel) on. When I press my button I get the right information all the way up to my TableModel but I can�t get my GUI to update by it self. The right information is shown when I resize the frame for example.
I have tried to write this.pack() where I get the new information to my JFrame and I have an i_bookingPanel.pack() in the code where the action from the button is listened to but no....
Here is some of my code :
Here I listen to the button :
i_bookingPanel.addListenerToSearchButton(new ActionListener() {
public void actionPerformed(ActionEvent e) {
String t_from = i_bookingPanel.getSelectedOrigin();
String t_to = i_bookingPanel.getSelectedDestination();
getFlightsFromTo(t_from, t_to);
i_bookingPanel.pack();
//i_bookingPanel.updateUI();
}
});
Here I get the information to the JFrame BookingPanel:
public void updateBookingPanel(HashSet a_flights) {
FlightTableModel t_flightModel = (FlightTableModel) i_flightTable.getModel();
t_flightModel.updateModel(a_flights);
//t_tablePane.updateUI();

//this.pack();
}

I build my BookingPanel in the constructor like this :
public BookingPanel(HashSet a_origin, HashSet a_dest, String[] a_columnNames) {
i_origin = a_origin;
i_dest = a_dest;
i_flightTable = makeJTable(a_columnNames);
this.getContentPane().add(makePanel());
this.pack();
this.setVisible(true);
this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
}
where makePanel() is a method that just sets al my components in place with GridLayout()
---
JScrollPane t_tablePane = new JScrollPane(i_flightTable);
---
t_mainPanel.add(t_tablePane, c);
And then I wonder about lock(int record)
Do you really need to know who locked the record? Is it not enough to know that it is locked?
I have a static hashtable and the key and the value is the record number.
Maybe it is obvious that the key should be who put a value in the hashtable.... but why?
Hello
What happens if I send in my code and do the exam and then find out that I my code is all wrong?
I mean. It was my company that paid for the certification and now I am out of work so I don�t want to risk having to pay anything again. And I am almost finished with the code and I am trying to reed every bit of information in the instructions.html... and I am getting nervous that I have missed something.
But it says that it is better to have code that is clear and easy to reed rather that being the most efficient (or something like that)....
What�s the worst thing that can happen ?
No It won�t work. I have a recipe with one igredient in a LinkedList and I add an ingredient and send it to the server but the changed LinkedList dosen�t make it. And I�m not doing anything in between.
So I give upp. No editing of recipes in my cookbook. Make them or delete them and be happy.
If someone is interested the code is here
http://atlas.dsv.su.se/~x02-klj/10/TheApplication

/Lina
That�s just it. On the server I just look at the Object read from the input stream. And it is not the same object that I sent.
Here is some of my code. But I am just on my way to test the system in an other way. Maybe it wont work when the client and the server is on the same computer (local 127.0.0.1)
Server side :
/**
* ServerContactManager is the one class that communicates with the presentation package.
* It opens a server socket and creates a new CookbookManager object for every client that
* connect.
*/
public class ServerContactManager {

while (true) {
iSocket = iServerSocket.accept();
CookbookManager tListener = new CookbookManager(iSocket, this);

}
class CookbookManager implements Runnable {
..
public CookbookManager(Socket aSocket, ServerContactManager aServer) {
iSocket = aSocket;
iServer = aServer;
iKeepRunning = true;
try {
iFromClient = new ObjectInputStream(iSocket.getInputStream());
iToClient = new ObjectOutputStream(iSocket.getOutputStream());

public void run() {
while(iKeepRunning) {
lookAtInputStream();
}
}
..
public synchronized void lookAtInputStream() {
System.out.println("Looking at input");
try {
Object tObject = iFromClient.readObject();

if (tObject instanceof Envelope) {
Envelope tEnvelope = (Envelope) tObject;
String tWhatToDo = tEnvelope.getWhatToDo();

if (tWhatToDo.equals(tEnvelope.ADD_RECIPE)) {

addRecipe((Recipe) tEnvelope.getObject());
// Here the recipe isn�t the same even thou I haven done anything with it.
// Maybe because the client and server is on the same computer in reality
}

public void addRecipe(Recipe aRecipe) {
CookbookXMLWriter tXMLWriter = new CookbookXMLWriter();
tXMLWriter.addRecipe(aRecipe);
..
}
Hello
I have a very big problem. Data is getting lost between my client and my server.
I have an Object (a RecipeObject with a LinkedList with IngredientObjects) and when I put it in another Object (Envelope) and send it to the server the first time. Everything is god.
But if I add something to my LinkedList and send the whole thing again the LinkedList doesn�t change on the server side.
iToServer = new ObjectOutputStream(iSocket.getOutputStream());
...
Envelope tEnvelope = new Envelope();
tEnvelope.setWhatToDoStrin(tEnvelope.ADD_RECIPE);
tEnvelope.setObject(aRecipe);
...
iToServer.writeObject(aEnvelope);
When I print the hashCode for The Envelope the Recipe and the LinkedList on both the client side and the server side. I can se that the hash code has changed for every object but the LinkedList on the server side.
What is the problem? I have been given the tip to write my own hashCode for the IngerdientObject that is in the LinkedList. But how do I do that? I have tried but nothing seems to happen.
Okay...
I have read about lock/unlock and most I understand. But now my brother-in-law is making me confused!
if I have a method �lock� and in that method I place a value in a (static) HashMap
And if that method is synchronized, just one thread at a time can come in and place a value in the HashMap.
So if one thread comes along and place the value �5� in the HashMap all other threads must wait until that thread is finished even if they don�t want to lock the record �5�
Is that the case? and if so is that good?
I am getting confused because I am suddenly wandering over why I am using wait() and notifyAll() ?
Am I making myself clear?
What should I say to my (c-programming) brother-in-law?
/Lina

Originally posted by yang hao:
Thank you,Ying Ren.
But I still don't understand about the Data.class.
In this clas,there is a lock and unlock method.Do you add code there?Or you create another class to do and leave it blank?


I am realy interested in those two methodes to. I began adding code in the Data class. But I would like to change both method into synchronized methods. Is it wrong to add modifiers? I am using Hashtables.
/Lina
[ July 23, 2002: Message edited by: Lina Mahl ]
Am I the only one that is irritated that you are supposed to use recordnumber and not flightnumber as a unique identifier for the Flights?
I mean that flightnumber are unique. Recordnumber are just a number in a database.
I can live with it but I would have made the flightnumber the key value in my database.
regards
/Lina
My JTable is not showing my JRadioButtons?
I am using a TableModel and there i do have a method called "public Class getColumnClass(int c)"
What am I doing wrong?