• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Tim Cooke
  • Devaka Cooray
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Rob Spoor
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
Bartenders:
  • Carey Brown
  • Roland Mueller

[URLyBird] What are the persistent properties

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Guys,

My instructions states :

Application does not conform to instructions provided in the assignment.
The Instructions state:
All configuration must be done via a GUI, and must be persistent between
runs of the program. Such configuration information must be stored in a
file called suncertify.properties which must be located in the current
working directory.



I assumed these configuration info are
- Last db file location when running in local mode
- Last server address and port for the remote mode
- Default values for all 3 properties

Is this all or am i missing some ? I do not provide any GUI to the user to modify these. I only change them upon successful login and read them when the application starts.

This scares me a bit because when testing on a linux machine, I have to modify manually the /etc/hosts to bind the server name with its local IP, otherwise the client is not resolving the address. I 've detailed this in my choices.txt and user guide but I am wondering if I won't be marked down for this.
I am close to find a solution to that problem but it doesn't work quite yet and I need to submit my work very soon



Thanks

Sandrew
 
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The properties that you are persisting sounds about right, but will depend on how you have coded your app. You state that you have not provided a GUI to modify these settings. If there is no GUI how are they changed?

It should not be necessary to have to modify your /etc/hosts to get the application to work correctly. Most people only seem to test all the components running on one machine - i.e. localhost. I doubt many people try to get the app to work correctly across a LAN. It is up to you to decide if running across a LAN is part of the requirements.

I would be very wary about putting in the User Guide and choices.txt that the user needs to modify the external environment. The design of the assignment, no command-line params other those specified, no configuration except via a GUI, is designed to make life easy for the examiners.

If you do choose to make the app run across a LAN, then there is a RMI solution to the issue that avoids the need to change /etc/hosts.


 
Ranch Hand
Posts: 54
Eclipse IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Can you use the IP, loopback IP or localhost name? Can you ping the local name without the hosts modification? If the first lot work but not by PC name then it just sounds like a network/PC setup problem and not your software. You can't be responsible for the user's incorrect setup.

I think you really should have some kind of GUI for setting these things up. One of the main requirements of the application is to work as a client/server so the client are going to need to select the sever address and port. What happens if the user moves the server to a new IP address or the existing default port is already in use?

I had a default port but blank server IP/name and database location. When the application starts you get a properties window in which you can choose the above settings and once you click ok it will start the main application as well as save the settings as defaults for the next launch. It still shows the properties window every time it starts though. Obviously each of the three modes requires slightly different settings.
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Database location, server address and port number are the properties you need to persist between different runs of your application. You don't need a seperate GUI to change these properties (directly in the file), but you need of course some GUI to let the user change the configuration settings before starting the application.

You are not the 1st one with the Linux machine issue. Using the search engine you'll find a few other threads describing the same issue (e.g. here)
 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"... All configuration must be done via a GUI, and must be persistent between runs of the program."

Roel wrote : Database location, server address and port number are the properties you need to persist between different runs of your application ... you need of course some GUI to let the user change the configuration settings before starting the application.


Roel, if i correctly understand your last reply on this topic, the whole process of managing of persistent data (data from file "suncertify.properties") must be :

1) suppose i have a file "suncertify.properties" with the following content :
server_ip = 10.10.10.10
server_port_number = 12345
database_location = C:/Temp/SCJD/

2) therefore, when client starts the application, the program access "suncertify.properties" and show to client via GUI the following default content :
server_ip = 10.10.10.10
server_port_number = 12345
database_location = C:/Temp/SCJD/

3) client changes, for example, server_ip to 11.11.11.11 and works with application, then client stops the application.

The question is : When the next time client starts the application will GUI of step "2)" has the content "10.10.10.10" (old) or "11.11.11.11" (new) (must i update my "suncertify.properties" at step "2)" or "suncertify.properties" has always the same content ?) ?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You need to persist the properties between different runs. So 1st time you show some default. When user enters other settings (and these are valid) you save the new settings to the file. So on the next attempt the latest valid settings are shown by default.

To answer your question: 11.11.11.11 should be shown.
 
Dmitri Cherkas
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you Roel for your reply !..

Another question : from my assignment instructions : "...configuration information must be stored in a file called suncertify.properties which must be located in the current working directory."

To explore where is the current working directory i used the following block in my ApplicationRunner class situated in the "gui"-folder ("...\Implementation_of_the_Assignment\Implementation\code\suncertify\gui") of certification project :

and the output is : "...\Implementation_of_the_Assignment\Implementation\bin".
The question is : Is the "...\Implementation_of_the_Assignment\Implementation\bin" current working directory and suncertify.properties must be situated there ?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used System.getProperty("user.dir"); to get the current working directory. I believe the location depends of the directory where the runme.jar is executed from.
 
Dmitri Cherkas
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ou, yes, you are right... Now i can conclude that suncertify.properties must be in the same directory of the runme.jar, isn't it ?

Therefore the JAR file that i'll send to SUN will have the following layout and contents in its root :
...
code --> folder
docs --> folder
runme.jar --> file
suncertify.properties --> file
...

Am i right ?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are not supposed to include suncertify.properties with your submission. If the file does not exist (at 1st run) it's intended to be created (and show some sensible defaults to the user)
 
Dmitri Cherkas
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This approach is logical... and explains and simplifies many thinks... Thank you Roel.
 
Ranch Hand
Posts: 45
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

(and show some sensible defaults to the user)



I do not quite agree with this... I dont think there is a sensible setting for port, datafile locatione etc... If the file doesnt exist, leave it blank, and persist the properties for the next run. I dont think it is necessary to guess where the db file should be stored.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As sensible default I used blank for database location and server address; for the port number I used the default RMI port number. So I didn't guess at all, because that's indeed impossible to do.
 
Dmitri Cherkas
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"... the program must allow the user to specify the location of the database..."

Is "location of the database" mean that the user provides :
1) location as folder (f.e. "C:\SCJD\") and database file name is final static variable in the program with the value "db-1x1.db" or
2) location as folder and file name (f.e. "C:\SCJD\someFileName.anyExtension") ?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I used folder and file name as the location of the database
 
Dmitri Cherkas
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And file name can be any name, f.e. :
1) database.txt;
2) db_1111.custom;
3) ecc.

the only control with file is "... magic cookie value. Identifies this as a data file", right ?
 
Chris Zaremba
Ranch Hand
Posts: 54
Eclipse IDE Spring Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I set the default file filter to *.db but allowed *.* to be selected too.
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Chris Zaremba wrote:I set the default file filter to *.db but allowed *.* to be selected too.


That's what I did too
 
Think of how stupid the average person is. And how half of them are stupider than that. But who reads this tiny ad?
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic