• 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

[B&S] : Sun's official reply for null-terminated strings

 
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I should make this very clear and specify that I only asked regarding my particular assignment, B&S 2.2.3.

I emailed Sun ( who2contact@sun.com ) with the following:


I have received my assignment and ask:

May I receive a clarification regarding null-terminated values?

I'm doing Bodgitt and Scarper assignment version 2.2.3, and have two lines that confuse the heck out of me.

First line is from Data File Format, Data section of the assignment:

"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."

Which strongly implies "fixed field format", which would be padded by spaces.

Second quote, last paragraph in Data File Format section:

"All text values, and all fields (which are text only), contain only 8 bit characters, null terminated if less than the maximum length for the field."

Which comes to say that strings within fields should be null-terminated if shorter than field width.

Using a hex-editor, I have seen that the data file as provided by Sun contains no such null-values, regardless of the record fields being less than the maximum length for the field.

I would request a clarification on this matter since code consistency and clarity is of the up-most importance when grading submitted assignments.


Thank you



I received the following response from Monica Green at Sun yesterday (Saturday, January 8, 2005):


> Sorry about the confusion. There's a typo in your assignment. Please
> ignore all references to null-terminated or null-padded values. Treat
> the fields as space padded.

 
Ranch Hand
Posts: 357
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Wow! That is a very clear reply that takes away all room for doubt. Thanks for posting that here!

I think Sun's excuse is a bit lame BTW. My assignment contains the same "typo" and it does not really look like a slip of the keyboard...

Frans.
 
Vincent Hernandez
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm glad to have helped Frans. It's kinda "lame" that Sun did this to us, but at least the reply was not vague. I was sort of scared at first I'd get a reply on the order of "it's a design decision you must make" or something to that order.

Though I should probably stress again I asked only for my assignment, which is B&S 2.2.3. However, as Frans just mentioned, if the wording is the same in other assignments as how I specified in my email (see original post), I'd assume the same typo carried over.
[ January 09, 2005: Message edited by: Vincent Hernandez ]
 
Ranch Hand
Posts: 124
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I got the null-ternminated thing also, if it was really a typo, why the phrase appears in so many/all project specifications. But using space padded will not make the specification professional.
 
Vincent Hernandez
Ranch Hand
Posts: 43
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator


I got the null-ternminated thing also, if it was really a typo, why the phrase appears in so many/all project specifications. But using space padded will not make the specification professional.



Probably (at least metaphorically) there were a lot of copy/paste operations.

As for being professional, most databases support the importation of fixed-field files. I know MS Access has a Import Wizard that supports it, as does Oracle with sqlldr (provided you define the field start position and field length ).
 
author and jackaroo
Posts: 12200
280
Mac IntelliJ IDE Firefox Browser Oracle C++ Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You might also like to consider an earlier response to the same question.

Regards, Andrew
 
I hired a bunch of ninjas. The fridge is empty, but I can't find them to tell them the mission.
We need your help - Coderanch server fundraiser
https://coderanch.com/wiki/782867/Coderanch-server-fundraiser
reply
    Bookmark Topic Watch Topic
  • New Topic