• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

display issue

 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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().

 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Bartender
Posts: 1558
5
Eclipse IDE Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic