• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

display issue

 
Alexandra Zhang
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hey, for who is still here, I need help.

I got a URLBird assignment. And I finished all the individual function and requirement, but after integrated parts together, many things went wrong. One thing I really tried, but have no clue how to fix it. My GUI displays customer id. But after booking the value can not correctly displayed, it shows like "©ä«". what could be wrong?

Not sure, whether I may past my code here. I used RandomAccessFile and readShort(), and writeShort().

 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alexandra,

First of all, congratulations! You asked the 1st question after the deadline of the mandatory course requirement has elapsed.

So you display the customer id and when you update the value, it shows something unreadible. You use readShort() and writeShort() to handle the customer id? Why did you decide to use these xxxShort-methods? Because a Short has a maximum value of 32767 and your customer id has to be an 8-digit number. I would think that's causing the problem.

Good luck!
Kind regards,
Roel
 
Anayonkar Shivalkar
Bartender
Posts: 1557
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Alexandra,

The best way to handle this is : consider customer id as String of length 8 (just check if this is not breaking any requirements).

I internally used a record number (for locking/unlocking record) which was an 'int' (meaning my code will not support data file with more than 32767 records, and I did mention this in choices.txt), but my requirement said that owner id must be 8 digit long (but did not explicitly mention any data-type).

Just think about it : why do you want to treat customer id as 'number'? Are you doing any 'numerical' operations on it? I don't think so. All you'll be doing is - add a new record, delete a record and so on.

So, I would strongly recommend to treat customer id as String, and make very sure to add a validation at UI level that user can enter only numerical data there (and that too, max 8 characters long).

Hope this helps.

All the best!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic