• faoileag (unregistered) in reply to chubertdev
    chubertdev:
    faoileag:
    dkf:
    faoileag:
    Actually, aren't you braking their EULA by posting it on TDWTF's website?
    I didn't know the EULA was equipped with brakes in the first place. What's the mean airspeed of an unladen EULA?
    The missing "e" must have been posted to a different forum by my homegrown keystroke balancer...
    Move your coffee cup.
    THIS IS WHERE IT GOES! Why can't you fix my keyboard?!
  • faoileag (unregistered) in reply to Norman Diamond
    Norman Diamond:
    faoileag:
    JW:
    The real WTF is in this sentence: "...what I consider a rather unique approach..."

    "Unique" is an absolute. Being "rather unique" is like a boolean being "rather false".

    What's wrong with "rather false"?

    According to "Advanced Techniques in Knowledge Discovery and Data Mining" by Nikhil Pal (p. 187), "rather false" is one of seven states of truth, starting with "very true" and ending with "very false".

    That sounds like a rather unique book. Maybe only 1.3 copies exist, and you have 1 of them.
    No, I did not invent the bokk. It is about neural networks, and you can find it via google books.

  • (cs)

    Despite the abysmal interface, Super(c) as it likes to be known, is a pretty decent piece of software.

    It does what it claims to do: transcode pretty much any music/video format into any other music/video format.

    I've often used it in the past, I've never had any spyware or whatever. The EULA warnings are weird, but they refer to the inclusion of 3rd party software - almost all open-source, eg ffmpeg - over which the author of Super(c) has no control.

    The usability of both the site and the software is something worth nuking from space, but the core function of the product is excellent.

  • anonymous (unregistered)

    RTF? Fucking hell. I'd just assume you print-to-PDF and post that instead - PDF.js renders those fairly quickly and faithfully enough that I don't usually need to jack around with Adobe unless I want to print one.

  • Walky_one (unregistered) in reply to scudsucker
    scudsucker:
    The usability of both the site and the software is something worth nuking from space, but the core function of the product is excellent.

    With other words: The stuff the have written themselves (The GUI and the installer) sucks. The stuff they have copied from other people (The core) runs fine.

  • foo AKA fooo (unregistered) in reply to Walky_one
    Walky_one:
    scudsucker:
    The usability of both the site and the software is something worth nuking from space, but the core function of the product is excellent.

    With other words: The stuff the have written themselves (The GUI and the installer) sucks. The stuff they have copied from other people (The core) runs fine.

    3. Profit!

  • v (unregistered) in reply to emaN ruoY
    emaN ruoY:
    Oh, come on people. We know the best way to solve this is with a math formula
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    Granted, we lose the "randomness" achieved by alternating the order of the servers between the three line sections. But, really, that's just "overkill." If we want random, I suppose this may work:

    rslt1=Math.ceil(Math.random()*rslt1);
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}
    Funny, you fell in the trap. It is actually 4 options that are repeating completely regularly, no randomness. Just with a WTF visual grouping.
  • Anon (unregistered) in reply to Olo
    Olo:
    Did you notice that "3" that you use for the modulo operation is actually the count of items?

    You could just put all URLs in an array and use "modulo arrayLenth" to index into that array:

    balancedUrls = ['http://www.erightsoft.info', 'http://www.erightsoft.biz', 'http://www.erightsoft.org'];
    
    domain1 = balancedUrls[rslt1 % balancedUrls.length];
    

    The bonus is that you can add more items to the array and it all works magically, you don't have to change anything else in the code.

    I like that your code is much more elegant, yet still exactly as bad. A+

  • TenshiNo (unregistered) in reply to Mark Bowytz

    Wow. I feel like I need to run a malware scan just from reading that EULA.

  • Ol' Bob (unregistered) in reply to Mark Bowytz
    Mark Bowytz:
    Now, *I* don't encourage you to do as I did and download the installer just to read the EULA, but I do suggest that you check out the section marked "Privacy" to see why.

    SA-WEET!!!!

    It's a pity though - this is so wordy - they could just shorten it to "All your computer are belong to us".

    :-)

  • Mark (unregistered) in reply to emaN ruoY

    re-read the posted code. There are 4 different domains separated into groups of 3. The order doesn't change, it just looks like it does because of the crazy groupings.

  • Gechurch (unregistered) in reply to anonymous
    anonymous:
    Gechurch:
    Although your code is much cleaner, it does defeat the purpose as it will send all requests to one server for a 20 second period, which the other servers sit idle.
    Considering that the clock being used is the users', which will vary widely even for side-to-side computers, it wouldn't make much difference.

    But as long as it is implemented in JS, it IS a WTF!

    Good point!

  • Charles (unregistered) in reply to emaN ruoY
    emaN ruoY:
    If we want random, I suppose this may work:
    rslt1=Math.ceil(Math.random()*rslt1);
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    But this removes the WTF, because then the load balancer works. (The best feature of the original, IMO, is that if your clients' clocks are synchronized the same server gets hit all throughout the second, then gets two seconds of dead time.) Although at least you didn't hoist the % operator...

  • anonymous (unregistered) in reply to Charles
    Charles:
    emaN ruoY:
    If we want random, I suppose this may work:
    rslt1=Math.ceil(Math.random()*rslt1);
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    But this removes the WTF, because then the load balancer works. (The best feature of the original, IMO, is that if your clients' clocks are synchronized the same server gets hit all throughout the second, then gets two seconds of dead time.) Although at least you didn't hoist the % operator...

    Assuming the networking gear can keep up, each server does at least get 3 seconds to process all the requests that arrived in the 1 second when it's the target server.

  • (cs)

    Regarding the EULA, just WOW.

    "If you install our software, a number of third party applications, whose names we don't even know, will also be installed and we can't help you remove them."

    Pure evil.

  • v (unregistered) in reply to anonymous
    anonymous:
    Charles:
    emaN ruoY:
    If we want random, I suppose this may work:
    rslt1=Math.ceil(Math.random()*rslt1);
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    But this removes the WTF, because then the load balancer works. (The best feature of the original, IMO, is that if your clients' clocks are synchronized the same server gets hit all throughout the second, then gets two seconds of dead time.) Although at least you didn't hoist the % operator...

    Assuming the networking gear can keep up, each server does at least get 3 seconds to process all the requests that arrived in the 1 second when it's the target server.

    Why so many people suddenly can't count... it is 4 servers and a 4 seconds pattern, duh

  • messy (unregistered) in reply to emaN ruoY

    Jesus what a mess ... and you've forgot a domain ...

    var domainz = ['http://www.erightsoft.info', 'http://www.erightsoft.biz', 'http://www.erightsoft.org', 'http://erightsoft.podzone.net']; domain1 = domainz[rslt1%domains.length];

    for those of you who want to have easy maintainability

  • Neil (unregistered)

    What I don't get is all the people trying to improve the JavaScript load distribution code without suggesting using something like DNS round-robin for load distribution instead.

    Captcha: the consequat of using DNS round-robin is that you still don't have load balancing.

  • anonymous (unregistered) in reply to clively
    clively:
    Regarding the EULA, just WOW.

    "If you install our software, a number of third party applications, whose names we don't even know, will also be installed and we can't help you remove them."

    Pure evil.

    How is that any different from any other application? The only difference I see is that they're at least honest about it.

  • (cs) in reply to Neil
    Neil:
    What I don't get is all the people trying to improve the JavaScript load distribution code without suggesting using something like DNS round-robin for load distribution instead.

    Captcha: the consequat of using DNS round-robin is that you still don't have load balancing.

    To show off how well the code can be changed while still preserving the original WTF. It's a bit of an exercise.

  • JamesB193 (unregistered) in reply to emaN ruoY

    There is only a 'randomness' between the three lines because the spacing is wrong the same group of four repeats 15 times. my solution follows and is not very good. It fails to implement proper pseudo-random distribution, properly account for leap seconds etc. etc. it should however be O(1) rather than O(n) after trading off cargo cult code for an arbitrary sized array.

    var hAServers=[ "http://www.erightsoft.info" ,"http://www.erightsoft.biz" ,"http://www.erightsoft.org" ,"http://erightsoft.podzone.net" ]; var Digital=new Date(), sec=Digital.getSeconds(), rslt1= (sec%hAServers.length); document.write("<iframe width='88%' height='400' noresize scrolling='no' frameborder='0' marginheight='0' marginwidth='0' SRC='"); document.write(hAServers[Digital.getSeconds()]); document.write("/S6Kg2.php'> </iframe>");

  • Robert (unregistered)

    Why not getMilliseconds()?

  • Kevtronic (unregistered) in reply to emaN ruoY
    emaN ruoY:
    Oh, come on people. We know the best way to solve this is with a math formula
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    Granted, we lose the "randomness" achieved by alternating the order of the servers between the three line sections. But, really, that's just "overkill." If we want random, I suppose this may work:

    rslt1=Math.ceil(Math.random()*rslt1);
    if (rslt1%3== 0) {domain1 = 'http://www.erightsoft.info';} else
    if (rslt1%3== 1) {domain1 = 'http://www.erightsoft.biz';} else
    if (rslt1%3== 2) {domain1 = 'http://www.erightsoft.org';}

    There is still a little performance waiting to be squeezed out:

    switch(rslt1%4) {
    case 0: domain1 = 'http://www.erightsoft.info'; break;
    case 1: domain1 = 'http://www.erightsoft.biz'; break;
    case 2: domain1 = 'http://www.erightsoft.org'; break;
    case 3: domain1 = 'http://www.erightsoft.net';
    }
    

    Oh and by the way you forgot .net

  • Jay Port (unregistered) in reply to emaN ruoY

    I wish there was a like button for this comment

  • Steven (unregistered)

    Crafted together a smarter version because i can: 'http://www.erightsoft.' + ['info', 'biz', 'org'][Math.ceil(Math.random()*new Date().getSeconds()) % 3]

  • Hannes (unregistered)

    Coming back to this in 2017, they DID improve their js even further. Now all the lines read

       if (rslt1== 0)   {domain1 = 'http://downloadcare.gotdns.com';}    else
       if (rslt1== 1)   {domain1 = 'http://downloado.gotdns.com';}    else
       if (rslt1== 2)   {domain1 = 'http://downloadcare.gotdns.com';}    else
    

    If only the product wasn't so great... I have downloaded and installed SUPER and I use it quite often. :(

Leave a comment on “Split Second Load Balancing”

Log In or post as a guest

Replying to comment #:

« Return to Article