2006 and we still can't solve the sleep problem...



  • http://www.devhardware.com/forums/programming-82/dos-sleep-command-86596.html

     

    Ok so this guy's 2006 solution to SLEEP is the following:

    PSUEDO CODE!

    Sleep for X seconds:

    1) Calculate exit time

    2) check if current time is our exit time, and we go granular to the milliseconds...

    3) goto step 2 if not match

     

    Wow and here I thought we could solve world hunger, apparently we still can't figure out how to sleep!

    I didn't know there were any idiots left doing thist... I guess i was wrong, insomniacly(new word) wrong!

     



  • Sleep for X seconds:

    ping -n X -w 1000 ADDRESS_THAT_IS_ROUTABLE_BUT_WILL_NOT_RESPOND_TO_ICMP > NUL



  • Wow.. the batch file version of what most VB programmers do.



  • In Win32 API terms if no sleep is available.

    WaitForSingleObject(hObject, xMilliseconds);

    or

     if(GetTickCount() - lastTickCount > xMilliseconds)  // make thread loop



  • @morbiuswilters said:

    Sleep for X seconds:

    ping -n X -w 1000 ADDRESS_THAT_IS_ROUTABLE_BUT_WILL_NOT_RESPOND_TO_ICMP > NUL

     

    Yes I found that... Unfortunately a BIG WTF is that windows has no sleep in command line... WHO THE HECK CAME UP WITH THAT STANDARD??? Anything thats remotely useful in windows costs at least... 5 dollars! But the ping trick works for me :)

     

    Whats better is that someone was SO happy with this, that he decided to endorse it, and even sugested that he compiles it into a binary.



  •  @dlikhten said:

    Yes I found that... Unfortunately a BIG WTF is that windows has no sleep in command line... WHO THE HECK CAME UP WITH THAT STANDARD??? Anything thats remotely useful in windows costs at least... 5 dollars! But the ping trick works for me :)

    Actually...

    All you need is the resource kit... And it is free. A simple google search would have told you this.

    Stop being stupid.

    http://www.google.com/search?q=windows+xp+sleep&btnG=Search



  • @MasterPlanSoftware said:

    Stop being stupid.

    Oh my god, god forbid you pick up one southpark joke vs taking everything like an invasion into your manliness!

    In any case, ip trick makes me happier without having to install extra packages. And there are no necessary instructions for anyone using my script who does not have this package from ms... speaking of which... WHY is sleep not part of the default command line utilities? I would think that useful scripts might need a sleep, specially if polling resources... Reminds me of the similar workaroudn i saw in pl/sql since oracle only provides a SYS package for doing wait...




  • @dlikhten said:

    WHY is sleep not part of the default command line utilities? I would think that useful scripts might need a sleep, specially if polling resources...
     

    Why don't you stop and consider the users Windows is meant for.

    I cannot think of any reason a DESKTOP USER would need a sleep command. Perhaps you should share and educate us all.



  • @MasterPlanSoftware said:

    I cannot think of any reason a DESKTOP USER would need a sleep command. Perhaps you should share and educate us all.
    I thought they tried to make a server and workstation OS too. Generally the people who run server boxes make scripts to automate stuff. But thanks for the link (below) anyways.



  • @Lingerance said:

    @MasterPlanSoftware said:
    I cannot think of any reason a DESKTOP USER would need a sleep command. Perhaps you should share and educate us all.
    I thought they tried to make a server and workstation OS too. Generally the people who run server boxes make scripts to automate stuff. But thanks for the link (below) anyways.
     

    And the RK is for those server users. What is your point?



  • TRWTF is the comment on that page from Nilpo that this batch file should be compiled into an executable:

    @Nilpo said:

    No nasty insults. Very nice. Try using bat2exe to create a compiled executable from your batch file.

     




  • @MasterPlanSoftware said:

    And the RK is for those server users. What is your point?
    You argued against a point that wasn't made (why the desktop OS doesn't have sleep).



  • @Lingerance said:

    @MasterPlanSoftware said:
    And the RK is for those server users. What is your point?
    You argued against a point that wasn't made (why the desktop OS doesn't have sleep).
     

    Riiiiight... The server OS has the command in question, and the desktop does not. It can be downloaded for free though.

    But me arguing that dlikhten saying it doesn't exist/ would cost money if it did is wrong.

     

    I see....



  • @MasterPlanSoftware said:

    Riiiiight... The server OS has the command in question, and the desktop does not. It can be downloaded for free though.
    Probably a misunderstanding on my part then; as I don't have immediate access to a Server 2003 box I can't confirm or deny whether or not sleep exists out of box.



  • @Lingerance said:

    I don't have immediate access to a Server 2003 box I can't confirm or deny whether or not sleep exists out of box.

    I don't think it does. That is the reason for the resource kit. 

    That is why it is called: Windows Server 2003 Resource Kit Tools.

     



  • @MasterPlanSoftware said:

    I don't think it does. That is the reason for the resource kit. 
    Which again begs the question why it isn't included, or at least easily accessible (why not add it to the "Windows Components" thingy?) Their website is not exactly what I'd call friendly, to install Monad I recall having to go through and download the installer (which wasn't hard to find as I had a direct link from Wikipedia), but it refused to let me download it as for some reason it needed active X, so I switched to IE which was crashing every ten seconds (kid you not) at the time, so I windows updated to IE 7 and after ~four attempts to get it installed it finally installed itself. So I go on with IE 7, complains about an add on not-working but it doesn't crash, possibly the add-on was at fault, so back to the Monad download page, it again won't let me install because I need .NET 2.0 which wouldn't come though Window Update and they didn't provide a link so I actually had to search for it, which wasn't fun as I recall encountering several pages that seemed to be .NET 2.0 download but were not. At that point I gave up as I already spend three hours on it. Although I did try it again at school on Sever 2003, took me about 10 minutes as I knew exactly where to go for .NET 2.0.


    </off-topic>


    At least most distros (Everyone I've tried) their Package Manager will get anything that is on their site, which IMO is a much saner alternative to having a website that doesn't let you install until the dependencies are met. I also like how Exchange requires the user to do all this crazy stuff (manually, when a wizard will do just fine) just install it, some of which require you to remove the Exchange CD and put in the Windows Server 2003 disk (unless you remember what is required before install).



  • @Lingerance said:

    @MasterPlanSoftware said:
    I don't think it does. That is the reason for the resource kit. 
    dlikhten "I can't use Windows" style whining
     

    I would rather they don't install tons of more crap in my server OS. Keep it simple. I hardly call a quick google search and a 11mb download complex. I would rather have the option of installing my tools where I want them, rather than having them installed by default in every install I do. Ubuntu server didn't come with everything I needed (or that even Windows Server comes by default with) but you don't hear me whining. I googled what I needed and installed it. Apt-get is cool, but if you don't know exactly what you need, it doesn't help you anymore than anything in Windows. As always, google is your friend.

    Really, stop whining there is nothing complex here.



  • I don't know about the Server versions, but XP still comes with some pretty obscure command line tools like edit and ftp. I wouldn't consider a sleep command to be bloat.

    I agree that it sounds like Lingerance is having some serious computer problems, though. I would definitely reinstall if IE was crashing and Windows Update was failing.



  • @Cap'n Steve said:

    I wouldn't consider a sleep command to be bloat.
     

    I doesn't change my argument that it is easily added to the system. Windows != Linux and that is what Lingerance and dlikhten are comparing it against. 

    Decent points though, I definitely agree with her computer issues. Both Lingerance and dlikhten seem to have trouble with trivial computer tasks. But they just blame it on MS or whoever else is easily blamed.



  • @MasterPlanSoftware said:

    I doesn't
     

    *It doesn't 

     

     

    Bahhhhh



  • @MasterPlanSoftware said:

    Both Lingerance and dlikhten seem to have trouble with trivial computer tasks. But they just blame it on MS or whoever else is easily blamed.
    <!--Flame?--> IE craping itself on install due to a glitch in a add-on which causes the previous version to crash == (somehow) "trouble with trivial computer tasks"? My case was: to install Monad I had to jump through hoops that I needn't have to (worsened by an exploding internet explorer); which re-enforced my previous bias against getting software from windows.com.
    Anyways, I went to www.windows.com and found the Windows Server 2003 Resource kit quickly, so I will concede my point about getting software from microsoft.com being painful.

    <!-- Also, IMO, I find many of the GUI ways of doing it in windows are needlessly tedious, compare Vista's Display Properties to XP's Display Properties. In that case Vista was a step backwards, they display a web-page-like interface which pops up a single-tab tabbed options dialog, whereas XP had all the display properties in the same tabbed dialog that was actually multi-tabbed. They did this on every Control Panel applet that I noticed, and this new way seems to trigger UAC more than the old way would, as UAC tends to get triggered when the dialogs are closed. -->


  • I've seen programs where in the sleep sub, it proceeds to busy the CPU to 100% for the time it requires to "wait", especially on these "Are we done now" loops.



  • @MasterPlanSoftware said:

    Both Lingerance and dlikhten seem to have trouble with trivial computer tasks. But they just blame it on MS or whoever else is easily blamed.

    You're acting like you're surprised that people actually complain about their problems. Expecting something to meet ... uh, expectations, and then venting when it doesn't is hardly "having trouble with trivial computer tasks". Sure, it's easily solved, but that wasn't the point in the first place.

    But if you're trolling for negative comments, then you're obviously on the right track...



  • @Lingerance said:

    IE craping itself on install due to a glitch in a add-on which causes the previous version to crash == (somehow) "trouble with trivial computer tasks"?
     

    Yes. It warned you about the add-on. The add-on is your responsibility, not Microsoft's.

    @Lingerance said:

    Anyways, I went to www.windows.com and found the Windows Server 2003 Resource kit quickly

    Really? I typed in 'dos sleep' in google and it was the first hit... Why would you bother looking around any further?

     



  • @magetoo said:

    expectations, and then venting when it doesn't is hardly "having trouble with trivial computer tasks". Sure, it's easily solved, but that wasn't the point in the first place.
     

    Venting is one thing, this is a continued history of dlikhten and Lingerance constantly whining, crying, and bashing anything MS related. And just about everytime they are pressed for details it ends up being something like PEBKAC, lack of understanding, or a third party problem.

    So no, I am not 'trolling for negative comments'.But your addition to this discussion seems to be.



  • @MasterPlanSoftware said:

    Yes. It warned you about the add-on. The add-on is your responsibility, not Microsoft's.
     

    Yep.  Even the great and exalted Firefox (which, in all seriousness, I use almost exclusively) will crash and/or hang occasionally if you install the wrong extension (Tabbrowser Extensions, anyone?).



  • @MasterPlanSoftware said:

    Yes. It warned you about the add-on. The add-on is your responsibility, not Microsoft's.
    Only after it finally installed. The "warning" was merely a "This plug in uses out-dated calls that we no longer support so we're disabling it"
    @MasterPlanSoftware said:
    Really? I typed in 'dos sleep' in google and it was the first hit... Why would you bother looking around any further?
    My normal argument about any of MS' sites are that they are natually unnavigable, every so often I retry something that I previously found irritating as in rare cases the problem has been solved by the force responsible (like notepad upgrade in XP from 98). As the bulk of my arguments stem from discomfort of using the software in question, it would stand to reason I should make sure my arguments are at least valid and not warped by memories that have come to be from secondary sources (eg, other users complaints or previous memories that warp themselves).


    In short: because I have had past problems with talking out of my ass unknowningly, I may as well make sure my bias is justified.



  • ...



  • Sleep is part of kernel32.dll under Windows Vista, Windows XP, or Windows 2000 Professional. The Platform SDK is needed to get the function prototype, you could declare it yourself too without the SDK.

    There are a million reasons why Sleep is bad. Most people use it to 'estimate' when some action or operation will be done and continue the rest of their script.



  • @Lingerance said:

    Which again begs the question why it isn't included, or at least easily
    accessible (why not add it to the "Windows Components" thingy?)

    Because the process isn't just "code what you want and stuff it into Windows". Apparently the Windows team decided that the RK tools aren't worthy enough to afford satisfying all the [url=http://blogs.msdn.com/larryosterman/archive/2006/09/29/777022.aspx]*bilities[/url]. Indeed, as I can see, those tools are not localized, and as such are not eligible for inclusion in Windows.



  • @MasterPlanSoftware said:

    Really? I typed in 'dos sleep' in google and it was the first hit... Why would you bother looking around any further?

    I think that is the problem, you have to use a search engine to A) find the solution, B) navigate to a package, C) manually download and install that package.

    To A) sleep should be a primitive on the system. Someone has already pointed out that there is a function for it, but this isn't the same as the function being represented for scripting use. In this case there needs to be a command, or the interpreter interprets sleep as a command.

    To B) You have to use a third party search engine, to make sense of the Microsoft website. This isn't really a diss against Microsoft, it is simply a statement.

    Finally to C) Microsoft has automatic update facilities. It really isn't a lot of hassle to extend this utility to allow for customisation of installations and neither is it so difficult to add these extras as optional downloads, include their dependancies and allow for saving the updates to disk. The Mac has some of this functionality, Unix and Linux "User" machines do, why can't microsoft get similarly capable tools available?



  • @Kain0_0 said:

    To A) sleep should be a primitive on the system. Someone has already pointed out that there is a function for it, but this isn't the same as the function being represented for scripting use. In this case there needs to be a command, or the interpreter interprets sleep as a command.

    VBscript has a sleep command. Batch files do not without a small, free, easily found download. I see no real problem with that.

    @Kain0_0 said:

    To B) You have to use a third party search engine, to make sense of the Microsoft website. This isn't really a diss against Microsoft, it is simply a statement.

    I don't know of any major site like microsoft.com with that level of content that I could find something quicker using navigation than google.

    @Kain0_0 said:

    Finally to C) Microsoft has automatic update facilities. It really isn't a lot of hassle to extend this utility to allow for customisation of installations and neither is it so difficult to add these extras as optional downloads, include their dependancies and allow for saving the updates to disk. The Mac has some of this functionality, Unix and Linux "User" machines do, why can't microsoft get similarly capable tools available?

    This has nothing to do with the argument.

     



  •  @Morbii said:

    ...

    Feel free to stay out of the discussion. You never have anything to contribute. 



  • @MasterPlanSoftware said:

    @Kain0_0 said:
    Finally to C) Microsoft has automatic update facilities. It really isn't a lot of hassle to extend this utility to allow for customisation of installations and neither is it so difficult to add these extras as optional downloads, include their dependancies and allow for saving the updates to disk. The Mac has some of this functionality, Unix and Linux "User" machines do, why can't microsoft get similarly capable tools available?
    This has nothing to do with the argument.
    Relevence to the current topic notwithstanding, wouldn't you say this kind of thing would be nice to have? Some repository of "developer" packages and other things that can be navigated, accessed and queued from the Windows Update application, perhaps even automatically. Seems like a good idea to me.



  • @Kain0_0 said:

    I think that is the problem, you have to use a search engine to A) find the solution, B) navigate to a package, C) manually download and install that package.
     

    You might want to try SpectateSwamp Desktop Search - it does it all (+ random video and pics!).

    Sorry, I couldn't resist. Somehow I miss that thread... 



  • @MasterPlanSoftware said:

    @Lingerance said:

    @MasterPlanSoftware said:
    And the RK is for those server users. What is your point?
    You argued against a point that wasn't made (why the desktop OS doesn't have sleep).
     

    Riiiiight... The server OS has the command in question, and the desktop does not. It can be downloaded for free though.

    But me arguing that dlikhten saying it doesn't exist/ would cost money if it did is wrong.

     

    I see....

     

    Sorry chief, running xp pro... NOT XP HOME! And no it does not cost any money to download it.

    I shouldav known, any post I make costs at least... 5 annoyances from asshat!



  • @tdittmar said:

    @Kain0_0 said:

    I think that is the problem, you have to use a search engine to A) find the solution, B) navigate to a package, C) manually download and install that package.
     

    You might want to try SpectateSwamp Desktop Search - it does it all (+ random video and pics!).

    Sorry, I couldn't resist. Somehow I miss that thread... 

    Somehow as long as asshat keeps at it, i think it iwll never trully go away!



  • @MasterPlanSoftware said:

    So no, I am not 'trolling for negative comments'.

    Well, it looks that way. Calling people idiots isn't going to lead to them taking you seriously. Has it worked so far? All I see are heaps of ruined threads, tag cloud sniping, and general hostility.

    But your addition to this discussion seems to be.
    See, this is what I mean. How do you expect to get a positive, or even a polite response, out of that?


  •  @Welbog said:

    @MasterPlanSoftware said:
    @Kain0_0 said:
    Finally to C) Microsoft has automatic update facilities. It really isn't a lot of hassle to extend this utility to allow for customisation of installations and neither is it so difficult to add these extras as optional downloads, include their dependancies and allow for saving the updates to disk. The Mac has some of this functionality, Unix and Linux "User" machines do, why can't microsoft get similarly capable tools available?
    This has nothing to do with the argument.
    Relevence to the current topic notwithstanding, wouldn't you say this kind of thing would be nice to have? Some repository of "developer" packages and other things that can be navigated, accessed and queued from the Windows Update application, perhaps even automatically. Seems like a good idea to me.

    I defintely agree. I just don't think it is a problem to not have it.



  • @magetoo said:

    See, this is what I mean. How do you expect to get a positive, or even a polite response, out of that?

     I could ask the same thing about your comment.Go play somewhere else. You obviously have nothing to add to this discussion.



  • @MasterPlanSoftware said:

    I defintely agree. I just don't think it is a problem to not have it.
    Fair enough.



  • @dlikhten said:

    Sorry chief, running xp pro... NOT XP HOME!
     

    This doesn't change anything. 

    Why don't you show us this highly important batch file that cannot be written without a sleep and HAS to be in a batch file?

    @dlikhten said:

    I shouldav known, any post I make costs at least... 5 annoyances from asshat!
     

    Yes you should have. Anytime you are going to dangle flamebait with no sense behind it, you are going to get an argument.

    Especially when you continue to write like you are in the 4th grade.

     



  • @Welbog said:

    @MasterPlanSoftware said:

    I defintely agree. I just don't think it is a problem to not have it.
    Fair enough.

     

    I am sorry, can you rephrase that into something hostile? I am not quite used to someone being reasonable.



  • @MasterPlanSoftware said:

    I could ask the same thing about your comment.Go play somewhere else. You obviously have nothing to add to this discussion.

    Well, there's a difference between "I think you're doing this wrong" and "Go away". But fine, this isn't going anywhere.



  •  @MasterPlanSoftware said:

    This doesn't change anything. 

    Why don't you show us this highly important batch file that cannot be written without a sleep and HAS to be in a batch file?

     

    Ok, log the cpu usage of a process by PID. Sure I got my friendly perfmon, but god forbid i got 20 java processes running, try picking the right one: is it java? or java_1? or maybe java_15? Using process exporer i can use the tree view to find the right process by looking at the parent.

     @MasterAsshatSoftware said:

    Especially when you continue to write like you are in the 4th grade. 

    I write butiful papers with flowers and colors! Yay happy times!

     

    In any case, i think this thread has reached it's limit, moving on. Asshat, make one more clever, super amazing attack at me and we can consider this post over, you can even have the last word!



  • Jesus Christ this has become retarded.  Windows doesn't include a sleep command by default because there are better scripting alternatives to DOS for the platform.  Linux includes one because UNIX has a stronger legacy of command-line scripting.  Still, it's like complaining because bash lacks support for OOP.  Seriously, if your bash script is longer than 5 lines you should probably be doing it in perl anyway.  Also, as another post pointed out, sleeping in bash scripts is often wrong because you should be waiting for a particular condition to arise instead of just assuming it will complete after so many seconds.

     

    As MPS pointed out and any Google search will reveal, there is a free version you can download with the RK.  Hell, I wouldn't even bother with the download, just take the two minutes to code up a quick-and-dirty version in C.

     

     The ping trick was a joke.  Please tell me you aren't using it in anything important, dlikhten.  It will break at the drop of the hat if the IP you use starts responding to pings one day.

     

    I'm a Linux developer exclusively, by the way.  I've admined very large server farms and only use desktop Windows for testing browser compatibility.  I know some general Win2k3, AD and Exchange admin stuff, but it's not something I get to work with very much.  I get sick of Linux/Mac users with nothing better to do than whine about Microsoft, though.  They are usually noobs on some distro like Ubuntu.



  • @morbiuswilters said:

     The ping trick was a joke.  Please tell me you aren't using it in anything important, dlikhten.  It will break at the drop of the hat if the IP you use starts responding to pings one day.

     

     

    The ip i use is 127.0.0.1 and it does respond. :)

    Also its not for anything critical just call a program every second to report something, think I write production-level code using ping tricks and windows batch scripts? The most a batch script is good for is starting an app usually. Hell it does not evne have If statements, just goto and labels (yes you make ifs that way).

     @morbiuswilters said:

    I'm a Linux developer exclusively, by the way.

    I would be also if I had a choise at this job.

     @morbiuswilters said:

    As MPS pointed out and any Google search will reveal, there is a free
    version you can download with the RK.  Hell, I wouldn't even bother
    with the download, just take the two minutes to code up a
    quick-and-dirty version in C.

    Sorry no C compiler on this comp, would take me longer to get one and set it up then to just write that batch script.

     

    In any case, fine I was being overly bitchy about complaining that I had to install windows server 2003 utils. Sorry. O and my script is 7 lines (doh i went overboard) Would be nice if we can just select to download "developer utils" during a windows update or setup or w/e. I mean it is from Microsoft. Could be an "optional" download.



  • @dlikhten said:

    Sorry no C compiler on this comp, would take me longer to get one and set it up then to just write that batch script.

     

    In any case, fine I was being overly bitchy about complaining that I had to install windows server 2003 utils. Sorry. O and my script is 7 lines (doh i went overboard) Would be nice if we can just select to download "developer utils" during a windows update or setup or w/e. I mean it is from Microsoft. Could be an "optional" download.

     

    The point is not to use C, but to use one of the other tools at your disposal. VBscript has much better support for all of this. As does any .NET langauge. VBscript could have been written in notepad and excecuted with cscript.exe or wscript.exe. .NET could have been compiled on the command line with nothing more on your machine other than the framework. So your bitching and complaining goes a long way towards being a WTF. 

    Any of us could do what you describe without crying and whining about Windows and the lack of a command line sleep. But you just cannot let it go...



  • @MasterPlanSoftware said:

    @dlikhten said:

    Sorry no C compiler on this comp, would take me longer to get one and set it up then to just write that batch script.

     

    In any case, fine I was being overly bitchy about complaining that I had to install windows server 2003 utils. Sorry. O and my script is 7 lines (doh i went overboard) Would be nice if we can just select to download "developer utils" during a windows update or setup or w/e. I mean it is from Microsoft. Could be an "optional" download.

     

    The point is not to use C, but to use one of the other tools at your disposal. VBscript has much better support for all of this. As does any .NET langauge. VBscript could have been written in notepad and excecuted with cscript.exe or wscript.exe. .NET could have been compiled on the command line with nothing more on your machine other than the framework. So your bitching and complaining goes a long way towards being a WTF. 

    Any of us could do what you describe without crying and whining about Windows and the lack of a command line sleep. But you just cannot let it go...

     

    Just FYI, you assume I have .NET compilers installed on my machine. I don't deal with .NET and don't very much care to learn it right now just to write a process cpu usage monitoring tool, which I happen to need to use a few times at most.



  • @dlikhten said:

    Just FYI, you assume I have .NET compilers installed on my machine. I don't deal with .NET and don't very much care to learn it right now just to write a process cpu usage monitoring tool, which I happen to need to use a few times at most.
     

    I would highly doubt that you don't have ANY version of the .NET framework on your machine. If you don't have it, you really should think about visiting Windows Update sometime.

    I notice you ignored the concept of VBScript, or for that matter Powershell. The point is that there are plenty of tools in windows to do what you are trying to do. And you are complaining about one of those tools lacking a command (which is not even true). 

    A quick google search would have solved your problem, but you continue to act like using Windows is holding you back from something. PEBKAC.


Log in to reply
 

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