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

Search:

Type: Posts; User: Filobel

Page 1 of 2 1 2

Search: Search took 0.04 seconds.

  1. Replies
    8
    Views
    1,710

    Re: Question about function

    Note that in your case, although the IDs ARE all unique, there is nothing that actually assures you it will always be that way. I don't know if this is an assignment or what, but depending on what...
  2. Replies
    8
    Views
    1,710

    Re: Question about function

    It really depends on what you are using that method for and when you consider two "person" to be the same. For instance, if you know for a fact that the ID will ALWAYS be unique to each person, then...
  3. Replies
    3
    Views
    1,493

    Re: Program not accepting input?

    First, doing:
    Type String strChoice, strTryString, strTryInt, strTryDouble;
    Is fine. They do need to be initialised before being used, but they don't NEED to be initialised the moment they are...
  4. Re: programme to find real roots of quadratic equation

    Well, by cin, I didn't mean just writting
    cin;

    I ment putting something like:
    cin >> a;

    And by "at the end of your program", I ment right after the closing bracket of your "else".
    So...
  5. Re: programme to find real roots of quadratic equation

    This is pretty typical if you are using visual studio (I wish I knew why it didn't leave the console open). There are many tricks to stop this, but the one I typically use is to add a cin right...
  6. Thread: Recursive Code

    by Filobel
    Replies
    1
    Views
    888

    Re: Recursive Code

    Ok, let me see if I get this straight. Lets say page 1 has n links on it, to page 1.1, 1.2... 1.n. (1.1 being the first link on the page). Then 1.1 has m links, 1.1.1, 1.1.2, ..., 1.1.m and so on....
  7. Replies
    5
    Views
    2,848

    Debugging deadlocks

    So, I'm fairly sure I have a deadlock, but I cannot for the life of me understand why. I'm using "lock" to make sure a thread doesn't try to access a collection while another one is modifying it. ...
  8. Replies
    3
    Views
    2,200

    Re: Can polling ever be efficient/clean?

    Thank you for the tips, I'll keep those in mind while developing, tweaking the polling process.
  9. Replies
    4
    Views
    2,481

    Re: Integer Manipulation

    Not sure if it's the best way to do it, but you could do something like


    public class MyClass
    {
    TreeSet<Integer> two_numbers;
    TreeSet<Integer> three_numbers;

    MyClass(){
    ...
  10. Replies
    3
    Views
    2,200

    Can polling ever be efficient/clean?

    I hate polling as much as the next guy (possibly more), unfortunatly, I'm stuck with a library I didn't develop and for which I do not have the source code (nor would I have time to modify it). ...
  11. Re: template to choose function implementation on compilation

    Well, I haven't changed anything to that part of the code and for some reason, it doesn't crash anymore. No idea what the problem was... hopefully it won't come back to bite me in the rear later on!...
  12. Re: template to choose function implementation on compilation

    Actually, if the code got to that part, then you know for a fact that sizeof(long) != sizeof(jint). That was the whole point of the templating stuff. If sizeof(long) == sizeof(jint), this means...
  13. Re: template to choose function implementation on compilation

    Ah! Sorry, I missread his question, he was talking about the body of the function, not the actual templating. Wow, I'm out of it today.

    In that case, yeah, as I said before, the whole point of...
  14. Re: template to choose function implementation on compilation

    The reason I said that is because, as I said, if I have the body of the template implementation for 4 byte long in a "regular" method and remove the template methods, the code works perfectly fine. ...
  15. [RESOLVED] template to choose function implementation on compilation

    Note before I start: This question contains JNI stuff, but the question is NOT actually about JNI and could most likely be answered by someone who knows nothing about JNI.

    A little while ago I...
  16. Replies
    13
    Views
    14,596

    Re: Lottery simulation

    Sorry it took me so long to reply.
    I wrote that code out of thin air directly on here, so it is quite likely that there are some mistakes. I just wrote the general idea, assuming you would be able...
  17. Replies
    13
    Views
    14,596

    Re: Lottery simulation

    Let me see if I get this correctly. There are 500 tickets, two of which are winning tickets with different prizes. You want the user to be able to specify a number of tickets he wants to "buy" and...
  18. Replies
    7
    Views
    1,103

    Re: size of long discrepancy

    Perfect. So although I'm gonna use your bit of code to support 8 bytes long, I'll assume that more often then not, it'll be 4 bytes long and will use jints.

    Thanks, I'll mark this as resolved...
  19. Replies
    7
    Views
    1,103

    Re: size of long discrepancy

    I heard you could use templates to do some stuff on compilation, but never actually used it. That's pretty cool, thanks!

    Another follow up question. What's more typical? 4 bytes or 8 bytes for...
  20. Replies
    7
    Views
    1,103

    Re: size of long discrepancy

    Follow up question revealing my newbiness in C++.

    So, obviously, copying the values from the long array to the jlong array through a for loop adds an overhead and is unnecessary if the long is 8...
  21. Replies
    7
    Views
    1,103

    Re: size of long discrepancy

    Bah, I was hoping there was a way to force to compiler to use one or the other, but didn't think there was. Oh well...
  22. Replies
    7
    Views
    1,103

    [RESOLVED] size of long discrepancy

    So, from what I understand, in C++ a long can be 4 bytes or 8 bytes. Not sure if it depends on the system or the compiler or whatever. Here's where I have a problem. I'm using JNI and I need to...
  23. Replies
    9
    Views
    7,836

    Re: JNI and arrays

    Ok, found how to fix it (sorry for the double post, but I felt the solution should probably be in a different post for the sake of clarity in case someone has the same problem). I'm not quite sure...
  24. Replies
    9
    Views
    7,836

    Re: JNI and arrays

    I just checked and I get junk in the constructor, so copying the values won't help.

    -=edit=-
    I really don't get it. I added this piece of code to the native side to see if the problem was in...
  25. Replies
    9
    Views
    7,836

    Re: JNI and arrays

    So you're saying in the constructor, you'd have something like:


    for(int i = 0; i < 6; i++)
    this.anArray[i] = anArray[i];

    That could be a solution if I realise the data passed to the...
Results 1 to 25 of 50
Page 1 of 2 1 2





Click Here to Expand Forum to Full Width

Featured