Faking progress



  • I found this today. It has been in production for years. Pseudo code to protect the innocent.

    SaveChanges();

    For(int x=0; x<10; x++)

    {

       ProgressBar.Position += 10;

       Sleep(50);

    }



  • @noitcif said:

    I found this today [b]in CS's source code[b]. It has been in production for years. Pseudo code to protect the innocent.

    SaveChanges();

    For(int x=0; x

     

    CSisTRWTF'd-TFY



  • Ahahahaa, and now that we've all had fun with CS, a reply. You realize you could be a hero with a single line, and a single cut'n'paste?

    @noitcif said:

    For(int x=0; x<10; x++)

    {

       ProgressBar.Position += 10;

       if (x == 5)
            SaveChanges();

       Sleep(50);

    }

     



  • No, no, just change Sleep(50) to Sleep(30) and take credit for speeding up the save process by 40%. Then you have room for additional improvements later.

    Though if you are going to go with Lorne's suggestion, at least put the Sleep() in an else clause.



  • Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.



  •  @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    Surely there's a way to poll the state of such a drive?

     



  • Sure you could find the device associated witha storage location and poll its state. Then run into tons of problems when other operations are running on the device, etc.

    This looks like a simple 5-minute-fix for a PEBKAC problem.



  • @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.




  • I once worked on a project which had to do some work and there was no way to tell the progress. It would just "do it", and be finished at some point. But managers complained about the lack of any sign of progress (mainly because you couldn't tell if it was still processing or was just hanging). So I put in one of those progress bars which do not have a progress (basically like a spinner). They still didn't like it. Even though I told them there was no way to detect the progress of the process, they wanted me to put in an actual progress bar. So I made something similar to that.

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%). Management approved, because they had a funny graphic to look at while the process ran.



  • @pbean said:

      Management approved, because they had a funny graphic to look at while the process ran.

     

    Managers like pictures (think gantt and pie charts). They're even more impressed if the images move. It doesn't have to actually mean anything, as long as it's there.



  • @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
     

    On the one hand, that's clever, I like it. On the other, do you work for microsoft?

     



  • @noitcif said:

    @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.

    Sometimes I like to unplug the flash drive that has the production Oracle database on it.



  • @db2 said:

    @noitcif said:
    @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.

    Sometimes I like to unplug the flash drive that has the production Oracle database on it.

     

    PROTIP: ask the manager to buy two usb flash drive, one for a test db, the other for prod db

     


  • Winner of the 2016 Presidential Election

    @noitcif said:

    The back end is an Oracle database.



  • @noitcif said:

    I found this today. It has been in production for years. Pseudo code to protect the innocent.

    SaveChanges();

    For(int x=0; x<10; x++)

    {

       ProgressBar.Position += 10;

       Sleep(50);

    }

    You just found Jeremy H's masterpiece.



  • @db2 said:

    @noitcif said:
    @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.

    Sometimes I like to unplug the flash drive that has the production Oracle database on it.

    It would be insane and almost criminal to put a production Oracle database on a single flash drive. There is just no excuses - especially since nowadays with cheap usb hubs it's easy to setup a 4-nodes RAID-10.



  • @thistooshallpass said:

    @db2 said:
    @noitcif said:
    @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.

    Sometimes I like to unplug the flash drive that has the production Oracle database on it.

    It would be insane and almost criminal to put a production Oracle database on a single flash drive. There is just no excuses - especially since nowadays with cheap usb hubs it's easy to setup a 4-nodes RAID-10.

    Don't forget to virtualize the OS and distribute it so you can plug each flash drive in a different physical machine. Just in case one catches fire, you know.



  •  [quote user="Renan "C#" Sousa"]You just found Jeremy H's masterpiece.[/quote]

     

    Maybe.  I just checked the VSS (yes, TRWTF) history and the code has been in place since at least 2005.  Changes before 2005 are archived so I can't look back further.



  • @dhromed said:

     @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    Surely there's a way to poll the state of such a drive?

     


    Possibly, but it's likely to be easier to use a synchronous call to "assert(WriteFile(...))" so that the user can tell at a glance whether the data has been saved, is being saved or couldn't be saved because someone pulled the flash drive out too early.



  • @snoofle said:

    @pbean said:

      Management approved, because they had a funny graphic to look at while the process ran.

     

    Managers like pictures (think gantt and pie charts). They're even more impressed if the images move. It doesn't have to actually mean anything, as long as it's there.

     

    In the next upgrade, I would replace the the progress bar with a random failblog.org video converted to antimated GIF format on the fly.

     



  • @__moz said:

    Possibly, but it's likely to be easier to use a synchronous call to "assert(WriteFile(...))" so that the user can tell at a glance whether the data has been saved, is being saved or couldn't be saved because someone pulled the flash drive out too early.

    Well, better too early than pulling it out too late.



  • @boomzilla said:

    Well, better too early than pulling it out too late.
     

    Man, if I had a nickel.



  • @__moz said:

    @dhromed said:

     @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    Surely there's a way to poll the state of such a drive?

     


    Possibly, but it's likely to be easier to use a synchronous call to "assert(WriteFile(...))" so that the user can tell at a glance whether the data has been saved, is being saved or couldn't be saved because someone pulled the flash drive out too early.

    Synchronously calling WriteFile doesn't guarantee that the OS' disk cache has been flushed to disk, or indeed that the disk's own internal cache has completed the write.  In general it's a difficult problem to know whether something has really gone out to the disk or not.



  • @Helix said:

    @db2 said:

    @noitcif said:
    @geocities said:

    Maybe there has to be a delay after saving. For example, maybe sometimes saving happens onto a flash drive and users tended to remove the drive right after pressing save. The progress dialog would encourage them to wait a bit.

    The back end is an Oracle database.

    Sometimes I like to unplug the flash drive that has the production Oracle database on it.

     

    PROTIP: ask the manager to buy two usb flash drive, one for a test db, the other for prod db

     

     

    [b]Me:[/b] Hey, Sysadmin, can you promote my code from test to prod?

    [b]SysAdmin[/b]: Sure. [i]Unplugs the flash drive from Test Server, plugs it into Prod Server[/i]. Done.



  • @operagost said:

    @snoofle said:

    @pbean said:

      Management approved, because they had a funny graphic to look at while the process ran.

     

    Managers like pictures (think gantt and pie charts). They're even more impressed if the images move. It doesn't have to actually mean anything, as long as it's there.

     

    In the next upgrade, I would replace the the progress bar with a random failblog.org video converted to antimated GIF format on the fly.

     

     

     I once implemented this picture in a test version of our software, but they wanted me to change it with a progress bar too. :(

    [img]http://www.myspacefx.net/import/graphics/Funny_Graphics_and_Pics/lol-cats_file-cat-is-searching-please-wait.jpg[/img]

     



  • @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.



  • @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Computer industry male chauvinism in full effect!  Everyone ignored token_woman when she said that but now a male engineer comes out with it everyone's going to listen and give him the credit for the idea!

     



  • @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...



  • Someone has a case of the Mondays!!



  • @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...


  • @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...



  • @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    That progress bar sucks and one can not rely on it to guess the total time, but at least it shows progress. Sadly instead of fixing it, they changed it, and now in many dialogs it's just loops (either "cylon eye" or spinny).



    Maybe Microsoft is guilty for taking the easy way out, but I, personally, blame each and every individual who ever made a joke about that file copy progress bar and therefore forced their hand. Because of you, ungrateful whiners, it becomes more and more difficult to know at what point I should cancel a long-running operation, and when I do cancel, I'm left with that awful feeling that maybe it was about to be completed. Shame on you.



  • @thistooshallpass said:

    it becomes more and more difficult to know at what point I should cancel a long-running operation, and when I do cancel, I'm left with that awful feeling that maybe it was about to be completed.

    So... just like before?

    False completion has nothing to do with real completion



  • @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh




  • @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh


     ----------------------------wooosh

    Read the tags, from time to time



  • @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh


     ----------------------------wooosh

    Read the tags, from time to time

    ----------------------------wooosh

    You forgot to tag your first post! 

     



  • @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh


     ----------------------------wooosh

    Read the tags, from time to time

    ----------------------------wooosh

    You forgot to tag your first post! 

     

    ----------------------------wooosh

    But, but... I though it would be obvious...... and I forgot as well



  • @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh


     ----------------------------wooosh

    Read the tags, from time to time

    ----------------------------wooosh

    You forgot to tag your first post! 

     

    ----------------------------wooosh

    But, but... I though it would be obvious...... and I forgot as well

    ----------------------------wooosh

    +      o     +              o   
        +             o     +       +
    o          +
        o  +           +        +
    +        o     o       +        o
    -_-_-_-_-_-_-_,------,      o
    _-_-_-_-_-_-_-|   /\_/\ 
    -_-_-_-_-_-_-~|__( ^ .^)  +     + 
    _-_-_-_-_-_-_-""  ""     
    +      o         o   +       o
        +         +
    o        o         o      o     +
        o           +
    +      +     o        o      +   
     

     NYAN CAT PROGRESS 100%!

    (4294967295 secs. remaining)

     



  • @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @DaveK said:

    @serguey123 said:

    @El_Heffe said:

    @pbean said:

    When the processing started, a progress bar was shown. It would update its progress with random amounts, with smaller increments every time, never really reaching 100%. And when the process was finished, it would just jump to 100% (some times from 50% to 100%, some times it got close, like 90%, before jumping to 100%).
    Just like Windows file copy.

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    Amazing, what a witty post and novel too, I'm further impressed by your manhood, nobody in this thread has yet to make a remark like yours...

    ----------------------------wooosh


     ----------------------------wooosh

    Read the tags, from time to time

    ----------------------------wooosh

    You forgot to tag your first post! 

     

    ----------------------------wooosh

    But, but... I though it would be obvious...... and I forgot as well

    ----------------------------wooosh

    +      o     +              o   
        +             o     +       +
    o          +
        o  +           +        +
    +        o     o       +        o
    -_-_-_-_-_-_-_,------,      o
    _-_-_-_-_-_-_-|   /\_/\ 
    -_-_-_-_-_-_-~|__( ^ .^)  +     + 
    _-_-_-_-_-_-_-""  ""     
    +      o         o   +       o
        +         +
    o        o         o      o     +
        o           +
    +      +     o        o      +   
     

     NYAN CAT PROGRESS 100%!

    (4294967295 secs. remaining)

     

    Speaking of which... Nyan Cat progress bar for Windows.

    Makes waiting for a file to be copied so much more interesting.



  • @DaveK said:

    but now a male engineer comes out with it everyone's going to listen and give him the credit for the idea!
    I am not an engineer.



  • @El_Heffe said:

    @DaveK said:
    but now a male engineer comes out with it everyone's going to listen and give him the credit for the idea!
    I am not an engineer.

    Hey everybody!  We have an infiltrator here!  Gettim!

     



  • @DaveK said:

    Computer industry male chauvinism in full effect!  Everyone ignored token_woman when she said that but now a male engineer comes out with it everyone's going to listen and give him the credit for the idea!
     

    Yeah, damn that type-supremacy. Tokens never get a look in


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.