• Steve (unregistered) in reply to Cbuttius

    "We can modify the database procedure more easily than the code."

    That right there is a WTF.

  • History Teacher (unregistered)

    Doing this is not TRWTF. Releasing a framework, where this is actually necessary, even "the best practice" (as it seems to be in this case) is TRWTF, and so is such a framework having non-insignificant market share.

    Now excuse me while I go to vulputate.

  • (cs) in reply to Cbuttius
    Cbuttius:
    The real WTF is getting your kids a talking doll in the first place.
    Yes, but we're all too busy trolling today, so you were the first to notice.
  • (cs)

    ok, all the smart people here:

    http://stackoverflow.com/questions/951021/what-do-i-do-if-i-want-a-javascript-version-of-sleep

    I dare someone to submit the solution here as an answer and risk all the downvotes it might get...

  • (cs)

    Another solution;

    http://stackoverflow.com/questions/758688/sleep-in-javascript

    Incidentally I have adopted the "timeout" way of sleeping in C++ too in the past of waiting for an event you don't expect to happen, for a process that is intended to "heartbeat". The point is that most of the time your event will time-out so you have essentially "slept". However the event does sometimes get signalled - an event to terminate. Thus your heart-beat thread goes on forever, performing its action exactly when it should, and terminating when you want it no more, just by setting its event...

  • petemoloy (unregistered) in reply to asdf
    asdf:
    "select now()" - the thing is, users can change time on their machine. Even while application is running. By using "select now()" we have always correct, server time.

    Isn't that Access database engine syntax i.e. not a client/server architecture, so are you sure you are getting "server time"?

  • Pedantic Jerk (unregistered) in reply to Cbuttius

    Close. That's part of the reason MANHOLE covers are round (You can also roll them out of the way.)

    However, square peg/round hole does make sense from the days of wooden post/beam construction.

    A) it's easy to DRILL a round hole. Much harder to drill a square one. B) square pegs are easier to make than round pegs and waste less wood.

    But C) the kicker is, a round peg in a round hole, will quickly force the peg out as the wood expands/contracts due to humidity (since the force is equal all the way around).

    A SQUARE peg in a round hole will stay since the corners (where all the pressure is) will simply deform as the pressure changes and not work their way out.)

    Therefore... since the above is true... and this code is being compared to the above, it is clear that this is simply the ideal solution given the materials.

    Or something like that.

    Captcha; nulla - what one should do with this post

  • atroon (unregistered) in reply to R

    It's surprisingly easy. You turn the Phillips driver on its side and use one of the 'vanes' to engage the slot of the screw.

    source: lots of times lacking proper tool for the job

  • YourAnIdiot (unregistered) in reply to Ben Jammin

    You don't do this much do you? That is a "slot screwdriver" or a "flat-blade screwdriver"

    the reason being, flat-top refers to a type of screw, in addition to the potential name for this tool. I hope for your sake you never have to work on anything remotely mechanical, because you will never be able to describe the replacement screws you need to purchase.

    Or, you could look up the wikipedia article on List_Of_Screw_Drives ....

  • nisl (unregistered)

    There should never be a reason to pause code-execution for a fixed period of time. If it needs to wait for some disconnected process to reach a certain stage, a routine/process [the one currently "sleeping"] should exit and use some callback/event mechanism to continue its thing.

    Timeout-driven waits do not qualify for this rule, as they do not relate to fixed duration (they relate to waiting "up to" some time period).

    When I see sleep in the code, I know it's written [by then] amateur and that it can be refactored somehow.

  • nisl (unregistered) in reply to Cbuttius
    Cbuttius:
    Did you know, by the way, that holes are round because a round lid cannot fall in, whereas a square lid could fall through into the square hole if you align the edge with the diagonal (unless it is very thick, which is unlikely).

    You're ignoring a factor of size. Small round-lid can be pushed through a large round-hole, just like a slightly larger square-lid can be pushed through a slightly smaller square-hole (diagonally).

  • (cs)

    Doing sleep in SQL is definitely a WTF... Should've used SQL to execute a DLL with a sleep function.

  • (cs) in reply to petemoloy
    petemoloy:
    asdf:
    "select now()" - the thing is, users can change time on their machine. Even while application is running. By using "select now()" we have always correct, server time.

    Isn't that Access database engine syntax i.e. not a client/server architecture, so are you sure you are getting "server time"?

    It is also Sybase syntax.

  • cpw (unregistered) in reply to asdf

    Getting the current time of the server I can understand (we do the same thing for the same reasons you mention). But doing a 'pause' using server-side code? I find it unlikely the user is going to do something on the PC while the program is paused that would affect the length of the pause (especially since we already know that code only works for delays less than 1 minute!)

    Of course the server could be much closer or further away from a strong gravitional influence, such as a black hole. In which case 59 seconds for the server would of course be very different from 59 seconds on the local PC...

  • Tasty (unregistered)

    WAITFOR the SQL backend to change, and the whole thing fails on non-standard SQL.

  • Tasty (unregistered) in reply to cpw
    cpw:
    But doing a 'pause' using server-side code? I find it unlikely the user is going to do something on the PC while the program is paused that would affect the length of the pause...

    You're forgetting relativistic time dilation. What about the SQL server that's on a rocket ship at 1/3c?

  • (cs) in reply to some jerk
    some jerk:
    pfft. Amateurs.
        Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "PING 1.1.1.1 -n 1 -w " & (nSeconds * 10000) & " >NUL"
            Set WshShell = Nothing
        End Function
    

    favouritism again. If I had posted this it would not have been featured.

  • Aargle (unregistered) in reply to R
    1. Sell the Phillip's Head screwedriver for a penny.
    2. Unscrew the object with the penny.

    There's always a simple solution. :-)

  • haero (unregistered) in reply to some jerk
    some jerk:
    pfft. Amateurs.
        Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "PING 1.1.1.1 -n 1 -w " & (nSeconds * 10000) & " >NUL"
            Set WshShell = Nothing
        End Function
    

    MsBuild commandline version:

    Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "echo using System; class SleepyTime { static void Main(string[] args){System.Threading.Thread.Sleep(int.Parse(args[0]) * 1000 );}} > SleepyTime.cs"
            WshShell.Run "C:\Windows\Microsoft.Net\Framework\v3.5\csc SleepyTime.cs"
            WshShell.Run "SleepyTime " & nSeconds
            WshShell.Run "DEL SleepyTime.cs"
            WshShell.Run "DEL SleepyTime.exe"
            Set WshShell = Nothing
        End Function
    
  • (cs) in reply to nisl
    nisl:
    Cbuttius:
    Did you know, by the way, that holes are round because a round lid cannot fall in, whereas a square lid could fall through into the square hole if you align the edge with the diagonal (unless it is very thick, which is unlikely).

    You're ignoring a factor of size. Small round-lid can be pushed through a large round-hole, just like a slightly larger square-lid can be pushed through a slightly smaller square-hole (diagonally).

    You can drop a lid of a smaller size through a manhole cover but you can't drop the properly sized manhole cover through the hole. However if they were square, it would be possible to drop the actual manhole cover through across a diagonal, which is of course sqrt(2) times as long as the edge and therefore even bringing in the thickness factor which will make it slightly narrower than that, it is still most likely big enough.

  • Ralph (unregistered) in reply to Cbuttius
    Cbuttius:
    what-do-i-do-if-i-want-a-javascript-version-of-sleep
    Easy. Kill yourself. You already failed when you assumed I'd let you control my browser. Now you want to waste my time?
  • (cs) in reply to some jerk
    some jerk:
    pfft. Amateurs.
        Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "PING 1.1.1.1 -n 1 -w " & (nSeconds * 10000) & " >NUL"
            Set WshShell = Nothing
        End Function
    

    this is an "unregistered" some jerk comment. How do you know it wasn't me posting it?

    I may try that out sometime...

  • Luis (unregistered) in reply to some jerk

    All these are classic examples of software developers over engineering. Here's the solution:

    Function DelayProcess(nSeconds) { MsgBox "Please click OK after " & nSeconds & " seconds. Thank You." }

  • (cs)

    There's one thing in this story that just completely boggles my mind. What idiot decided that there should be a "WAITFOR" statement in SQL?

    Given some of the problems with doing expressions in SQL, and then this, all I can say is: I really wish they would get people for SQL product designers and for the standards committee who are not BASIC programmers!

  • Bobby (unregistered) in reply to Coyne
    Coyne:
    There's one thing in this story that just completely boggles my mind. What idiot decided that there should be a "WAITFOR" statement in SQL?
    Because without it, blind SQL injection would be so much harder.
  • (cs) in reply to Cbuttius
    Cbuttius:
    some jerk:
    ...

    [/code]

    favouritism again. If I had posted this it would not have been featured.

    False. I don't care *who* posts comments - if I like it, I will feature it. For the record, I featured this comment of yours yesterday.
  • Lerch98 (unregistered) in reply to Ben Jammin
    Ben Jammin:
    Swedish tard:
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    Given that I am not a native english speaker I went about and checked what a flathead screw is, and apparently, flathead only refers to the shape of the head of a screw, not the tool needed to interact with said screw, so a fladhead screw can be of the phillips variety, so I'd have no issue what so ever with that...

    • = flat head
    • = phillips

    This is why you don't let soft-heads work on hardware.

    • = slotted screw
    • = phillips screw

    \ / | | | | Flat head counter sunk



    || || || Pan head screw (flat head)

    and who ever heard of a 'fladhead' screw? And quit being so cheap, You can buy a 10 piece screwdriver set for 10 bucks, it has phillips and stotted screwdrivers.

    (Software) Engineers are so cheap and such a bunch of hacks.

  • Buffoon (unregistered) in reply to Ben Jammin
    Ben Jammin:
    Swedish tard:
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    Given that I am not a native english speaker I went about and checked what a flathead screw is, and apparently, flathead only refers to the shape of the head of a screw, not the tool needed to interact with said screw, so a fladhead screw can be of the phillips variety, so I'd have no issue what so ever with that...

    • = flat head
    • = phillips

    That is incorrect according to wikipedia: http://en.wikipedia.org/wiki/Screw#Screw_head_shapes Fladhead is a screw head type, not a driver type. What you rever to as flathead seems to be a slot drive. http://en.wikipedia.org/wiki/List_of_screw_drives#Slot

    So, I still think I would be able to use a philips drive for a flat head screw. ;) And I'd also be capable of using a philips drive for a slot screw. :D Either you use a hammer and pound the drive into the head of the screw or you do it the way previously mentioned.

  • (cs) in reply to some jerk
    some jerk:
    pfft. Amateurs.
        Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "PING 1.1.1.1 -n 1 -w " & (nSeconds * 10000) & " >NUL"
            Set WshShell = Nothing
        End Function
    

    Reminds me of the story about when the netblock containing 1.1.1.1 and 1.2.3.4 was finally assigned. If I recall correctly, they had to announce separate BGP routes for the two /16 nets that contained these two addresses because the traffic to them (mostly http and sip and ping) was overwhelmingly high... (I'm sure Google could find that story again if I was motivated enough to search it).

  • N (unregistered) in reply to R
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    I've done that. The trick is to put the screwdriver sideways, so one of the four "points" of the Philips head goes in the slot, then spin it around. It's not pretty, but it works.

  • (cs) in reply to Cbuttius
    Cbuttius:
    The real WTF is getting your kids a talking doll in the first place.

    To infinity and beyond!

  • Dude.... (unregistered) in reply to mihi
    mihi:
    some jerk:
    pfft. Amateurs.
        Function DelayProcess(nSeconds)
            Dim WshShell
            Set WshShell = WScript.CreateObject("WScript.Shell")
            WshShell.Run "PING 1.1.1.1 -n 1 -w " & (nSeconds * 10000) & " >NUL"
            Set WshShell = Nothing
        End Function
    

    Reminds me of the story about when the netblock containing 1.1.1.1 and 1.2.3.4 was finally assigned. If I recall correctly, they had to announce separate BGP routes for the two /16 nets that contained these two addresses because the traffic to them (mostly http and sip and ping) was overwhelmingly high... (I'm sure Google could find that story again if I was motivated enough to search it).

    I was motivated.... http://packetlife.net/blog/2010/feb/5/ripe-plays-with-1-0-0-0-network-apnic-allocation/

  • Aero (unregistered) in reply to R
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    Fully possible, BTDT. You need to hold the screwdriver in a perfect angle to slip one of the four "wings" of the phillips heads to the slot of the screw.

    I don't want to do it again.

  • iToad (unregistered)

    Using SQL to perform system functions. What could possibly go wrong?

  • (cs) in reply to Lerch98
    Lerch98:
    Ben Jammin:
    Swedish tard:
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    Given that I am not a native english speaker I went about and checked what a flathead screw is, and apparently, flathead only refers to the shape of the head of a screw, not the tool needed to interact with said screw, so a fladhead screw can be of the phillips variety, so I'd have no issue what so ever with that...

    • = flat head
    • = phillips

    This is why you don't let soft-heads work on hardware.

    • = slotted screw
    • = phillips screw

    \ / | | | | Flat head counter sunk



    || || || Pan head screw (flat head)

    and who ever heard of a 'fladhead' screw? And quit being so cheap, You can buy a 10 piece screwdriver set for 10 bucks, it has phillips and stotted screwdrivers.

    (Software) Engineers are so cheap and such a bunch of hacks.

    Harbor freight has a 10 pack of phillips and slotted drill bits for 2.49 a piece. A battery drill and a phillips bit is the only way to travel. Never dick with the slotted bits, with a screwgun they are just too much of a pain in the ass. In fact, I go out of my way to purchase screws that are either phillips or square.

  • (cs)

    Is this initially an ideal solution? No. But it is abstracted behind a method, so it could be easily changed to something better without much risk to the rest of the system.

    Orthogonality is your friend.

  • (cs) in reply to Scrummy
    Scrummy:
    Orthogonality is your friend.
    Not when you're redesigning the wheel.
  • Chris (unregistered) in reply to Simon

    You're exactly right. The Response.Write calls give it away.

    Classic ASP has no analog to Sleep in VB. None of the options in the "tools" link in the post are viable in classic ASP. I encountered the same problem 4 years ago working on our legacy CRM. Needed the web page to wait until a backend process had finished, and display the log to the user. I found this same answer after an hour of Googling (I was determined to find a less... ridiculous approach). Classic ASP just doesn't have this functionality. Gotta outsource. =p

  • Harrow (unregistered) in reply to nisl
    nisl:
    Cbuttius:
    Did you know, by the way, that holes are round because a round lid cannot fall in, whereas a square lid could fall through into the square hole if you align the edge with the diagonal (unless it is very thick, which is unlikely).

    You're ignoring a factor of size. Small round-lid can be pushed through a large round-hole, just like a slightly larger square-lid can be pushed through a slightly smaller square-hole (diagonally).

    Congratulations! You have discovered why manhole covers are not only round, but all identical in size -- if a work crew is moving a manhole cover by rolling it, and they let it get away, and it rolls down a hill and crashes into another open manhole, it can't fall in.

    -Harrow.

  • Joe Shmobinsky (unregistered) in reply to toon

    Yep...had a gig where several boxes had serious clock drift, to the point that NTP would just commit suicide. Reset the clock through cron (or whatnot) every 30 minutes, by the time the cronjob logged "perceived" time versus "real" time an half an hour later, the damned thing was already days off.

    HP, I'm looking at you (of course, it could've been Compaq....)

  • Write Only Memory (unregistered) in reply to Nagesh
    Nagesh:
    Jest petal to storing. In India, you are be getting them for less than 1200 rupees.

    Pricy. In India the maximum fine for blowing up a nuclear plant is only 500 rupees (9 US$).

    http://timesofindia.indiatimes.com/india/Now-CAG-focuses-on-lax-nuclear-safety/articleshow/15608239.cms

    But still TRWTF is Akismet.

  • asdg (unregistered) in reply to toon
    toon:
    Well, don't underestimate the ingeniousness of your sysadmins either. What if your application runs on the sort of server where a minute can last several hours? I'm not kidding: (there was a URL here but it didn't get past spam control)
    it might be what you meant in the missing link, but I believe a lot of servers resolve Daylight Savings issues like this. When we need to lose an hour, we just slow down the System clock until we are an hour earlier. When we need to gain an hour, we speed up the clock. I think the reason for this (which is actually quite logical) is so that you don't miss or repeat any scheduled jobs, thus the server ALWAYS has 24 hours in a day, just on the cusps of Daylight Savings you have longer/shorter hours....

    Not sure what Einstein would have to say about the whole thing, though....

  • Ido Samuelson (unregistered)

    Seriously guys? No one heard about a win32 api called Sleep:

    Private Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)

  • (cs) in reply to Cbuttius
    Cbuttius:
    However if they were square, it would be possible to drop the actual manhole cover through across a diagonal, which is of course sqrt(2) times as long as the edge and therefore even bringing in the thickness factor which will make it slightly narrower than that, it is still most likely big enough.
    Even a round cover can't be dropped through its hole, because the outer portion of the cover is a flange. (Think of the cover as two stacked, concentric discs with unequal diameters.) The hole's diameter equals the diameter of the lower portion of the cover, which is several cm less than the flange diameter. Square covers could be made the same way and would be equally incapable of falling into their square holes, whose diagonals would not be long enough to accommodate the flange length.
  • Rick (unregistered) in reply to Joe Shmobinsky
    Joe Shmobinsky:
    Yep...had a gig where several boxes had *serious* clock drift, to the point that NTP would just commit suicide. Reset the clock through cron (or whatnot) every 30 minutes, by the time the cronjob logged "perceived" time versus "real" time an half an hour later, the damned thing was already *days* off.

    HP, I'm looking at you (of course, it could've been Compaq....)

    I bought an HP, installed Linux, and found that its clock advanced exactly 2 seconds for every 1 second of real time. Cue a lot of googling. Eventually I learned that it was a known bug in the chipset, and the "fix" was a software patch that would cut the system's clock speed in half -- essentially throwing away half your CPU power. This lovely feature was already handled by Windows -- it would automatically apply the patch when it detected the issue -- but the vendor had never released a "CPU driver" for Linux, thus the problem's visibility.

    Shuddering to think of all the Windows customers who bought a spec, only received half of it, and never knew the difference, I returned the box. Store wanted me to exchange it for another. Sorry, not interested. Every computer with the same chipset will have the same problem.

    And that, kids, is you never buy a computer you can't return if it proves to be crap.

    Also, why you never buy an HP. But I repeat myself.

  • Michael (unregistered) in reply to Cbuttius
    Cbuttius:
    nisl:
    Cbuttius:
    Did you know, by the way, that holes are round because a round lid cannot fall in, whereas a square lid could fall through into the square hole if you align the edge with the diagonal (unless it is very thick, which is unlikely).

    You're ignoring a factor of size. Small round-lid can be pushed through a large round-hole, just like a slightly larger square-lid can be pushed through a slightly smaller square-hole (diagonally).

    You can drop a lid of a smaller size through a manhole cover but you can't drop the properly sized manhole cover through the hole. However if they were square, it would be possible to drop the actual manhole cover through across a diagonal, which is of course sqrt(2) times as long as the edge and therefore even bringing in the thickness factor which will make it slightly narrower than that, it is still most likely big enough.

    Why circles? Why not an equilateral Triangle?

    The "Can't drop it in the hole" is only one (small) factor....others include:

    1. Ability to move the lid by rolling (previously mentioned)
    2. A smaller round hole is needed to fit a body than a square hole (less materials too)
    3. Round holes are easier to dig/drill
    4. Easier to dislodge a stuck circular lid (by turning it) than a square one (which can only be rattled a bit)
    5. No Sharp corners = less injury risks
    6. Nobody likes a Square anyway
  • Dude (unregistered) in reply to Mark Bowytz
    Mark Bowytz:
    Cbuttius:
    some jerk:
    ...

    [/code]

    favouritism again. If I had posted this it would not have been featured.

    False. I don't care *who* posts comments - if I like it, I will feature it. For the record, I featured this comment of yours yesterday.
    Why? it wasn't very funny. Now you're doing the ooposite and pandering to the Whinger!!
  • jsaoe (unregistered) in reply to Aero
    Aero:
    R:
    Unscrewing a Philips screw with a flathead screwdriver is no problem.

    Trying to unscrew a flathead screw with a Philips screwdriver - now I'd like to so somebody do THAT.

    Fully possible, BTDT. You need to hold the screwdriver in a perfect angle to slip one of the four "wings" of the phillips heads to the slot of the screw.

    I don't want to do it again.

    I'm sick of seeing this solution....

    You don't need to use a philips head in a slotted screw - this is why God invented butter knives. Why damage a Philips head screwdriver when chances are you've got plenty of old butter knives in need of damaging?

  • Sandeep (unregistered) in reply to Write Only Memory
    Write Only Memory:
    Nagesh:
    Jest petal to storing. In India, you are be getting them for less than 1200 rupees.

    Pricy. In India the maximum fine for blowing up a nuclear plant is only 500 rupees (9 US$).

    http://timesofindia.indiatimes.com/india/Now-CAG-focuses-on-lax-nuclear-safety/articleshow/15608239.cms

    But still TRWTF is Akismet.

    It's all relative....That's a month's worth of wages for a 1000-employee plant. In Amerika, this would be millions, No?

  • (cs) in reply to Rick
    Rick:
    And that, kids, is you never buy a computer you can't return if it proves to be crap.

    Also, why you never buy a PC. Just get the parts and build it yourself. It always comes out better that way.

    FTFY.

Leave a comment on “Square Peg Meets Round Hole”

Log In or post as a guest

Replying to comment #:

« Return to Article