• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

local mode

 
Gerenne Vives
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello ,

I have two question about UrlyBird:

1-When I conect in local mode , is necessary start the server??.

2-I thing that when I read a one line of the file (is the same that a record ) , the byte that indicate if the record is delete , is to the end of this line , ex:
Palace smallvile .... ... ClientCustomer [byte]
the same with the second line:
Castle smallvile .... ... ClientCustomer [byte]

is correct???

thanks in advance
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
1) No. In local (standalone) mode you must not start the server. In fact, the local code is not allowed to use ANY of the networking functionality, not even loopback calls. If you do it will result in an automatic failure. The following exerpt is from my instructions:
The program must be able to work in a non-networked mode. In this mode, the database and GUI must run in the same VM and must perform no networking, must not use loopback networking, and must not involve the serialization of any objects when communicating between the GUI and database elements.

2) I am not sure if I understand your question, but I belive that you are asking about the format of the data in the db file. In your example, you have the deleted flag at the end of the record. In my version, the deleted flag comes first. This may be a difference in assignment version however. Below is the data format section from my instructions. If yours is the same, i think you may be incorrect as far as the delete byte.
Data section.
Repeat to end of file:
1 byte flag. 00 implies valid record, 0xFF implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
 
Gerenne Vives
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello , in my assignament the instruction is the following:
/***************************************************************************
Data section.
Repeat to end of file:
1 byte flag. 1 implies valid record, 0 implies deleted record
Record containing fields in order specified in schema section, no separators between fields, each field fixed length at maximum specified in schema information
/****************************************************************

and when I read the database file , I don,t find to the end of the records this insrtruction my assignament is the UrlyBird , but I don,t know the version .
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Irene,

I think I understand...

each field fixed length at maximum specified in schema information
You don't need to search for any delimiter to mark the end of a record. You already have the record length (it was provided in the schema). So just seek to the start of the file, and then read in a byte array of "recordLength" size. You can then parse the record into Strings. Here is part of my code for readRecord - Note: I removed a lot of it that was not pertinent to this discussion, like checks for deleted records, so this is NOT the complete code...
 
Gerenne Vives
Ranch Hand
Posts: 60
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok , this part already I Knew , I read the record byte to byte , with the specification of the schema , but my problem is that when I arrive to the end of the record , in this byte who is for the mark , is in blank , and I don,t know if the assignament is refer that I have write this byte if I deleted the recors , but in my case this action is descarted , excuse me If you don,t understand me , but my english is very bad.

Thanks in advance
 
Paul Bourdeaux
Ranch Hand
Posts: 783
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Irene,

I will do my best to answer your question. If I am still misunderstanding you, please send me a private message in Spanish (I am assuming you speak Spanish based on your name). I have several colleagues from Mexico who I can have translate for me.

Your question seems to center on the delete flag, so I will explain all that I know about it. The delete flag is a way to identify a record as deleted, without having to actually remove the record. According to the instructions you quoted, the deleted flag is first, followed by the rest of the record. This pattern is repeated for each record in the file.

For Example:

1 Palace smallville .... ... ClientCustomer
1 Castle smallville .... ... ClientCustomer
...
1 Palace bigville .... ... ClientCustomer

shows three valid record. If you then were to delete the second record ("Castle"), the only thing you would have to do is overwrite the byte at the beginning of the record.

1 Palace smallville .... ... ClientCustomer
0 Castle smallville .... ... ClientCustomer <-- deleted record
...
1 Palace bigville .... ... ClientCustomer

Now if you were to create a new record, you can reuse this space in the file.
1 Palace smallville .... ... ClientCustomer
1 Hotel bigville .... ... ClientCustomer <-- We overwrote the old record with a new one!
...
1 Palace bigville .... ... ClientCustomer

I hope this clears up any confusion. If not, please forgive my inability to understand you, and PM me in your native language.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic