non-networked and network mode It is said I must finish non-networked and network mode in the the assignment. Does it means if the users select non-networked, he should browse fold in his computer and select the right data-file by a "open file Dialog" and if the users select network, in a textfield, he should input IP address which belong the remote computer?? Is it right??
How the program know if the selected db-file's format is the right one? Should a verify be needed? and how? [ December 26, 2003: Message edited by: hgf hgf ] [ December 26, 2003: Message edited by: hgf hgf ]
Hi Hgf Welcome to JavaRanch. We don't have many rules here, but one we do have is the JavaRanch policy on displayed names. We require you to use a real name as your displayed name (both a first and last name), which should preferably be your real name. Could you please change your displayed name to meet this policy? You may change it here. There are a number of simple tests you can do to verify that the data file is indeed a data file. For a start, you can check that the magic cookie at the start of the file is the same as the magic cookie you have right now. You can also check the size of the file: you have
one or more fields at the start of the file
the meta data (names and sizes of fields)
The size of the file, less the size of the meta data and the initial fields, must be an even multiple of the size of a record. Regards, Andrew
A magic cookie, in this assignment, means the identifier (here is the number) that used to recongize a file that is the correct/required database file. i.e. for example, if the magic cookie of your database file is 123, when I intentionally give you my database file (with magic cookie 456), your program should be able to identify that my database file is not the one that your application can understand, and prompts an error to the user (or me), asking him to provide the *correct* database file for your system to operate. Nick.
sounds like you need to review the spec. the magic cookie is not really a cookie (nor is it really magic, but let's not go there). It is an identifier for your database. It doesn't do anything at your end, but I suspect Sun use it to track the subtle variations in the assignments they give out. I think all you need to do is read the first n digits of your file, and that will be your magic cookie.