Alexandre Baldo

Ranch Hand
+ Follow
since Aug 04, 2006
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Alexandre Baldo

Hi! I just began to study Objective-C and I am not an expert in MAC OS either.

I'm trying to use the stringByExpandingTildeInPath:

It would be expected for this method to return the String "/Users/baldo" (suppose my user is 'baldo'). But the NSLog just prints '~'.

What I am doing wrong?

Thank you!

10 years ago
#1: I'll debug the code again to see what is going on...
#2: It is working when the client and server are in the same network! So I will not worry about that...

Thank's for your reply, Roberto!
Hello, all!!

I have to questions about RMI Server:

#1: When I run the client app and it connects to the rmi server two file are created: (that's ok) and a blank xxx.db file. I don't know why it is creating the db file.

#2: When I run the client app in the same network the server is the connection with the server is ok! But if I try to run the client from a different network it connects to the server but than for any other action (search, for instance) it says that the connection was refused by the server... I've configured the port forwarding in my router but it still didn't work...

Can anyone help me??

Thank's in advance!

Thank you, Roberto!

I think I will put all the methods too.

See ya!
What's up, guys!

I´ve already implemented the DBAccess interface provided by Sun. All methods are done.
My GUI just need to book and locate (by name and location) records. So the clients doesn't need all the methods that I've implemented in DBAccess.

Does my Remote interface need to have all the methods that DBAccess has or can it have just the book and locate method?

Congratulations, Payal!
11 years ago

Ulises Pulido wrote:
... what I do is to leave let the record locking for the row as you said, but I check if the row was deleted when I try to delete or update again launching a RecordNotFoundException not during locking.
I mean I perform that validation in the update and delete methods

I did this too... but I don't think it is correct because we could hold a lock of a register that no longer exists...
I tried to re-check if the record was still valid before locking but I got a deadlock.

I don't know what to do.....
Hello, guys!

These methods are declared as:

Before calling 'deleteRecord' or 'updateRecord' I call 'lockRecord' to logically lock the record and get the cookie. I have to pass the cookie to these methods.
When 'deleteRecord' or 'updateRecord' is done I call 'unlockRecord' to release the lock.

My question is:

Why do I need to pass the cookie to deleteRecord/updateRecord ??? I don't know what I have to do with it inside these methods...


...extends the Jtextfield and create my custom textfield is out of scope for this exam?

But to do this you don't have to extend JTextField.
You could use javax.swing.text.MaskFormatter:

(The '#' means that just numbers can be inserted).

And than, use it with a JFormattedTextField.
Well, what I've decided to do is:

1) Make all methods implementations of the provided interface ( 'synchronized'; In my case, the class that implements the interface providade by Sun is called;
2) I created a service class that has an instance variable of the type DBAccess wich I called 'database'. It was marked as 'private' and 'static'; So every object of my service class will share the same reference to the DBAcess object;
3) Since all the methods in is 'synchronized' (even the methods that just reads the database) I think I will get a thread safe solution;

What do you think!? :roll:

After meditating about the subject I finally got it!

If the application is running in stand alone mode we will certainly have just one program accessing the database file (that was easy).
But my doubt was about the network mode. Now it is obvious that the only "program" that is accessing the database file is the server! And just one server runs at a time.
And just now I realized that is the server that will instantiate the class that manipulates the data ( in my case). I don't know why i thought that every client would have to do so...

Sorry for the stupid question! ops:

But thanks anyway!!!
Hi guys!

My specification says:

You may assume that at any moment, at most one program is accessing the database file; therefore your locking system only needs to be concerned with multiple concurrent clients of your server.

What' f... does it means :?:

Thank you!!
Now I got it!

Thank you for your help, Ernest!!
Hello, guys!

I was reading about Concurrency in Swing at

and I get a little confused.

This tutorial says:

In Swing programs, the initial threads don't have a lot to do. Their most essential job is to create a Runnable object that initializes the GUI and schedule that object for execution on the event dispatch thread.

Like this:

What and didn't understand was that it also say:

Tasks on the event dispatch thread must finish quickly; if they don't, unhandled events back up and the user interface becomes unresponsive.

The question is: I think that starting an application is not a simple task. The app will be running in the event dispatch thread until its closed, right?? It will not 'finish quickly'.
So, what's is the correct way to start a gui application? In wich thread? Main thread or event dispatch thread ?

Thank you in advance!!