CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com

Search:

Type: Posts; User: tpgettys

Page 1 of 3 1 2 3

Search: Search took 0.04 seconds.

  1. Replies
    4
    Views
    3,070

    Re: Closing a DataInputStream

    The practice I have seen used creates the DataInputStream within the try block, and so it is out of scope by the time either the catch or finally clause executes, meaning a comipler error will result...
  2. Replies
    4
    Views
    3,070

    Closing a DataInputStream

    When reading from a DataInputSteam, it is common practice to read until an EOFException is thrown.

    Apparently the DataInputSteam object is lost after the try block is exited and the catch clause...
  3. Replies
    0
    Views
    421

    Physical device control

    I would very much like to know how to get low-level control of a physical device, such as the CDROM drive. For example, how can I open and close the tray under program control?
  4. Replies
    8
    Views
    846

    Thanks for your reply cjard. Please, where is...

    Thanks for your reply cjard. Please, where is your tutorial located?

    I was hoping that there was some tool that would "build" an EXE by compiling and linking together just the code needed from...
  5. Replies
    8
    Views
    846

    So, are you saying that there is some...

    So, are you saying that there is some command-line switch that will cause java.exe to take java class files as input and generate a stand-alone .EXE file as its output?
  6. Thread: Poker program

    by tpgettys
    Replies
    5
    Views
    3,239

    cjard, I think your countPairs() method double...

    cjard, I think your countPairs() method double counts some pairs (which is fine if that is what you want!).

    For example, if a hand has three 5's in it, there will be at least 3 pairs reported...
  7. Replies
    8
    Views
    846

    native compiler

    Does Sun (or someone else) provide a Java compiler that generates an executable (.EXE) for a PC? If so, where can it be found?

    I can see that it may make a difference if there are GUI components...
  8. Replies
    1
    Views
    580

    Read/Write a file in the same "breath"

    I opened a disk file as both an object input stream and an object output stream, wrote to it, then immediately read from it, and it seems to work(!), which is not what I expected.

    For starters, I...
  9. Replies
    3
    Views
    546

    Thanks for you reply cjard. However, I am aware...

    Thanks for you reply cjard. However, I am aware of the issues you brought up.

    Since I wasn't able to provoke the lose of data phenomena by not closing my file, I got to wondering if Java...
  10. Replies
    3
    Views
    546

    closing streams

    In other languages I have learned that it is imperative that open files must be closed, or risk losing data written to them.

    I have tried a few experiments in Java, writing a bit of data but not...
  11. Thread: using double

    by tpgettys
    Replies
    2
    Views
    469

    Hi tszhim. The problem is that computers use...

    Hi tszhim.

    The problem is that computers use binary but we use decimal. There are many fractions that have a nice, terminating representation in decimal that can only be respresented in binary...
  12. Replies
    3
    Views
    508

    Thanks khp! I have done some further...

    Thanks khp!

    I have done some further investigation and apparently the 4 bytes after the header are a serial number. My understanding is that a serial number is written with every object written...
  13. Replies
    3
    Views
    508

    Binary file format

    I created a binary data file using the following sequence:



    ObjectOutputStream outStream = new ObjectOutputStream(
    new...
  14. Replies
    4
    Views
    555

    Yep, you are right magus. So, it has to be that...

    Yep, you are right magus. So, it has to be that only String literals are checked for equality, so that only one copy is made. I wonder what that is called; maybe something like "String literal...
  15. Replies
    4
    Views
    555

    String literal storage

    The following program compares two different string objects using the == operator and yet it outputs "true":



    public class StringEquals
    {
    String composer = "Telemann";

    public...
  16. Thread: JGrasp

    by tpgettys
    Replies
    2
    Views
    1,448

    hi OSR, I use jGRASP and do like it, but can't...

    hi OSR,
    I use jGRASP and do like it, but can't offer any comparison to other Java IDE's. FWIW, the author's are responsive to questions and comments, which is always a big plus! New releases have...
  17. Replies
    4
    Views
    564

    Polymorphism question

    I have a class Employee with a method named getSalary().

    I also have a class Manager that extends Employee with a getSalary() method that overrides the one in Employee.

    When I say:


    ...
  18. Replies
    7
    Views
    843

    Uggg - Good catch on the reference Barancle. ...

    Uggg - Good catch on the reference Barancle.

    However, I really don't like saying that private members are not inherited. As delorde suggests, it muddys the discussion (the variable totalMoves...
  19. Replies
    7
    Views
    843

    Inheritance & private modifier

    This is essentially a question about vocabulary.

    I have a Java textbook that states that "the visibility modifiers determine whether a variable or method is inherited into a subclass".
    ...
  20. Replies
    11
    Views
    1,192

    Thanks very much for the link Barancle! Yes, I...

    Thanks very much for the link Barancle! Yes, I am very much interested in the math underlying computing. As it turns out, I have a degree in Mathematics, and teach math, including Statistics and...
  21. Replies
    11
    Views
    1,192

    It turns out that the proof that Knuth's...

    It turns out that the proof that Knuth's algorithm will generate each of the 52! permutations with equal probability isn't too hard. The algorithm is:



    for (i = 52; i > 1; i--)
    {
    c =...
  22. Replies
    11
    Views
    1,192

    Banancle, you offer a very nice treatment! Thank...

    Banancle, you offer a very nice treatment! Thank you very much for your efforts here.

    I did a simulaton of the 2 algorithms and obtained the same results, but of course your analysis is much more...
  23. Replies
    11
    Views
    1,192

    dlorde, I really wasn't intending to challenge...

    dlorde, I really wasn't intending to challenge Knuth, sorry. I really am only searching for understanding, doing the best I can.

    Part of the motivation for my query is that I actually did work up...
  24. Replies
    11
    Views
    1,192

    Shuffling algorithm

    I have an array of Card objects, and want to "shuffle" it. Knuth (volume 2) suggests something like:


    for (i = 51; i > 0; i--)
    {
    j = i*Math.random(); // select index at random

    // swap...
  25. Replies
    4
    Views
    552

    Thank you for your reply cjard; thoughtful,...

    Thank you for your reply cjard; thoughtful, candid and helpful as always. However, I have to take exception to your comment that



    On my planet simply commanding coders not to write buggy...
Results 1 to 25 of 51
Page 1 of 3 1 2 3





Click Here to Expand Forum to Full Width

Featured