• 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Magic cookie and deleted record flag

 
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
UrlyBird(1.2.3)

1) Magic Cookie:
I am hardcoding the magic cookie value to 259 since the give data file has that value. Everytime I read the header file, I am checking that cook is 259. If the value is not 259, I throw new IOException().
Is that right?

2) 1 byte flag. 00 implies valid record, 0xFF implies deleted record.
When I read the file, that field has 0 value not 00.
what is 0xFF? Is it a hexadecimal number? Am a storing hex when the record gets deleted.
Right now, I have flag as type byte in my data object. I am not sure if I just make this field string and store "0xff" as a string value.

Thank you.
 
Ranch Hand
Posts: 759
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
For number 1, you are correct. Magic cookie is for determining that the file is the correct file.

For number 2, if you want to know the value of 0xFF, just use the System.out.println(0xFF). I tried in my calculator, the value is 255. You can try in your own calculator.

for each record n the database you can try this :




Remember, if you can read all the data in the database scheme, it means you already have a good start. Reading all the database scheme was my first step. I shared my experience in here : https://coderanch.com/t/419374/sr/certification/URLyBird-Passed

Good Luck !!!

Jeffry Kristianto Yanuar (Java Instructor)
SCJP 5.0, SCJA, SCJD (UrlyBird 1.3.2)
 
Payal Shah
Ranch Hand
Posts: 67
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you :-)
 
The only thing that kept the leeches off of me was this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic