Christiaan Lombard

+ Follow
since Nov 22, 2009
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Christiaan Lombard

Thanks Roberto. What are the pros and cons of using your getValue(byte[]) instead of the methods of DataInput?

Also, I ran into another problem regarding exceptions. The Data class implements DBAccess(the interface that came with the assignment), so you you are not allowed to change the thrown exceptions. The only exception handled by these methods is RecordNotFoundException. Now what if you have to handle problems like corrupted data or IOExceptions? What if you are reading a record but you realize that the flag is not in the correct format? In these cases, would it be appropriate to throw RuntimeExceptions?

Aaahhh. That makes it a lot simpler. Thanks a lot.
Wait... just start reading up on more advanced I/O:

Should I be using ByteBuffer, FileChannel,etc.?

I'm having some problems with writing the class that is supposed to be reading and writing, from and to the data file and would like some pointers.
The reading part I understand, but when writing I found some problems:

When you create a FileOutputStream (append = false) then the file is emptied, which deletes all your records. So I'm guessing you are supposed to append new and updated records to the end of the file...?
If this is correct, how do you go and change the 'deleted record' flags that is further back in the file?

A solution would be to read all the records beforehand, keep it in memory for making changes and then just save it in an updated file when the server closes. Is this how it is usually done? It sounds a bit risky.

You can either put each class in in a separate file or, though this is not considered good programming practice, you can put them all in one file.

When you compile the class containing the main method all other classes the main class needs will also automatically be compiled.
10 years ago
Right after the object is created and used it will be eligible for garbage collection, but only after it was used (After: System.out.println("Area is " + new Circle(5).getArea());).
10 years ago
Thanks for the links.

I would still like to hear from someone who recently took one of the exams, which books are the best, which books are outdated for the newest exam, etc.

The three books I found is:

SCEA: Mc-Graw Hill (Published in 2007. Is this book outdated?)

SCWCD: Head First Servlets & JSP

SCBCD: Head First EJB (Published in 2003?! This MUST be outdated.)

Are there any good study guides that you guys can recommend for SCWCD, SCBCD and SCEA?

If there is a book that contains material for all 3 it would be helpful.

The only book I could find from the place I usually buy was this one (for SCWCD).


Wouter Oet wrote:I'm pretty sure that this is a lot faster:

Yes I would think so too. I guess it's time to start studying bitwise operators. It sucks that they took it out of SCJP 6.

10 years ago

I want to write a program that can read the header properties of a .mp3 file. If you don't know what I'm talking about, visit: MPEG AUDIO FRAME HEADER

The problem is that FileInputStream only allows you to read byte by byte. I need to convert that byte into something like a BitSet so I can read each bit in the byte.

The solution I came up with was:
1. Read the byte
2. Convert it to String using Integer.toBinaryString(byte)
3. Pad the String with zeros so there is 8 bits that can be read from it.

I have not tested this part since I'm still hoping there is a better way to do it (and it probably won't work).

Here is what I've done so far to retrieve the header and tag parts of the file:

10 years ago
I want to code a program that can read a mp3 file and the spit out all the tag and header info. I have started reading up on how it works, and found that there are different types of tags used by the same .mp3 format.

How do you identify what tag is being used?

Does anyone have some links that describe the different properties of the different types of tags?
10 years ago
I'm from South-Africa and I am having the same problems. Sun and Oracle have not migrated in SA yet which makes things even more complicated.

I found 2 places to buy the SCJD voucher for Step 1 from. Oracle charges R1065 (South-African Rand, excl. VAT), while Sun South-Africa charges R1900. So I emailed the Sun South-Africa representative to clear this up and she replied:

Hi Christiaan

Kindly be advised that there is a delay in the processing of SCJD Step 1 (Assignment) due to the migration from SUN to Oracle systems.

Sun Certification should still be purchased from SUN in the Sub-Sahara Africa region, until Oracle & SUN SSA are legally intergrated.

The price for SCJD is as follows:
Step 1: CX-310-252A R2,166 incl Vat
Step 2: CX-310-027 R1,824 incl Vat

Payment can be in the form of a direct transfer or deposit into Sun's
Reference: EDU (Your name)

Account Name :...

Please email proof of payment to my attention.There
after I will process your ORDER request.

Upon completion of this process, your voucher number will be released to you.
You may register with Prometric to schedule your exam with just your voucher number.

I mean, wtf. She wants me to pay double than I would if I bought it through Oracle. And then she mentions registering with Prometric which isn't even possible.


Roel, do you mean to say that you don't have to register anything with Prometric for Step 1?


I'm doing the SCJP, SCJD, SCWCD, SCBCD and SCEA certifications this year and last Friday I checked off SCJP. Now starting with SCJD.

Thanks to all the ranchers for the help. Also, the K&B exam guide is the best.

Best regards
10 years ago
Polymorphism is applying: "A reference variable can refer to any object as the same type as the declared reference, or it can refer to any subtype of the declared type."
10 years ago