Search:

Type: Posts; User: sci4me

Page 1 of 4 1 2 3 4

Search: Search took 0.36 seconds.

  1. Replies
    8
    Views
    206

    Re: Peer-to-peer ID assignment algorithm?

    Just to follow up:

    I have the master node thing working. So far it seems to work surprisingly well...

    Cornix, that is one other thing that I tried... it sort of worked but it was... well......
  2. Replies
    8
    Views
    206

    Re: Peer-to-peer ID assignment algorithm?

    Well DHCP uses a server; if I could use a server for this, I would have the code done by now :P

    What do you mean by use MAC address? I mean... I need an incrementing id starting at 0...
    And...
  3. Replies
    8
    Views
    206

    Re: Peer-to-peer ID assignment algorithm?

    I thought of this once but I never really fully implemented it and tried it out.

    I suppose I'll give it a shot...
  4. Replies
    8
    Views
    206

    Re: Peer-to-peer ID assignment algorithm?

    So far I haven't found anything useful... still searching.

    But yeah, I have tried lots of different ideas on how to negotiate things... and... no luck. It's quite easy for any single peer to...
  5. Replies
    8
    Views
    206

    Peer-to-peer ID assignment algorithm?

    Hey guys.

    I am currently trying to create a very simple peer-to-peer system. Basically, a peer needs to be able to join the network and when it does, it needs to be assigned a UNIQUE id. This id...
  6. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    Okay well the point is that it IS faster. Maybe not in O notation but in actual speed, it is a LOT faster. That's the important part.
  7. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    Yes that is correct. :P We're on the same page.

    The whole point of this was to improve the performance... I would say O(n) is a LOT better than O(4^n).
  8. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    When I print the result of each function using the same inputs, it prints the same output... They produce the same result...

    Yes, I understand that... however if we look at the iterative version...
  9. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    I'm not sure if I understand...

    The code I posted above runs FAST while the other code takes FOREVER to run... (with the same input)
    (they produce the EXACT same results...)

    They must not be...
  10. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    Indeed...

    Can it be written in a way that is NOT horrendous? I mean, is there a formula that will get the same answer in O(1) time?

    By the way, the whole point of this is to calculate this...
  11. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    That's basically my question: I want to find a formula for this... if possible...

    What I've shown is the "measuring device". I took the code for the algorithm and replaced it with the part that...
  12. Replies
    15
    Views
    312

    Re: "Simple" algorithm that needs to be fast

    I am using it to calculate the number of steps an algorithm will take to run. I basically just replicated the algorithm and changed it to count the number of steps. The reason it is so slow is...
  13. Replies
    15
    Views
    312

    "Simple" algorithm that needs to be fast

    I have this method:



    private static long steps(final int chainLength)
    {
    int steps = 0;

    final LinkedList<Integer> toDo = new LinkedList<Integer>();
    toDo.add(0);
  14. Replies
    1
    Views
    722

    Mutex implementation

    Hey guys! So first of all, yes: I know about ReentrantLock as well as how to use Objects as "mutexes"... that is not the point. So anyway, I have implemented a mutex and it seems to work, but I'm...
  15. Thread: Get JVM Flags?

    by sci4me
    Replies
    2
    Views
    265

    [SOLVED] Re: Get JVM Flags?

    I did get this:


    ManagementFactory.getRuntimeMXBean()

    I got that after posting this however.

    You can consider my question answered.
  16. Thread: Get JVM Flags?

    by sci4me
    Replies
    2
    Views
    265

    [SOLVED] Get JVM Flags?

    Is there any way to get all the command-line flags for the JVM in my code? I.e. the -XX: flags as well as -server/-client ?
    If so, how?
  17. Replies
    2
    Views
    302

    VM Instruction Pipelining

    I apologize if this is not a great place to post this.

    So, I am doing a bit of learning about Virtual Machines. I am wondering about Instruction Pipelining in the context of a Virtual Machine.
    ...
  18. Replies
    1
    Views
    361

    Simple Bitwise Encoding and Reversing

    Sorry if wrong section / crap name.

    I have an index that is encoded as such:


    int idx = x << 11 | z << 7 | y;


    my question is: can i go from idx back to x, z, y?
    If so, how?
  19. Replies
    1
    Views
    221

    Replace unless inside quotes?

    Hey guys, sorry if this isn't the correct area for this.

    Basically, I am trying to write a method that will take a string, a target, and a replacement (a replacement function like...
  20. Replies
    1
    Views
    343

    Password hashing & Salts

    Hey guys! So, after a longer time than it should have taken, something clicked in my tiny little brain and I understood salts. Now, my question: are LARGE salts a bad idea? I don't see much...
  21. Replies
    18
    Views
    242

    Re: Numbers & Binary

    Oh I see... then.. how do you know which two bits are on... I mean, yes the 6 tells that but.. eh..
  22. Replies
    18
    Views
    242

    Re: Numbers & Binary

    This is what I have:


    boolean[] array = new boolean[3];
    for(int i=0; i<3; i++)
    {
    array[i] = (a & (1 << i)) != 0;
    }

    works beautifully. I figured this out by printing the result of the...
  23. Replies
    18
    Views
    242

    Re: Numbers & Binary

    This is what it's giving me now:



    0 [false, false, false]
    1 [true, false, false]
    2 [false, false, false]
    3 [true, false, false]
    4 [false, false, false]
    5 [true, false, false]
  24. Replies
    18
    Views
    242

    Re: Numbers & Binary

    Oh, derp. So, loop 3 times... right? That's giving me the same results.
  25. Replies
    18
    Views
    242

    Re: Numbers & Binary

    I think something just clicked in my brain :P
    I was forgetting that the pattern I need is binary... so .. essentially I just create a int to binary (in the form of a boolean array, only 3 bits)...
Results 1 to 25 of 92
Page 1 of 4 1 2 3 4