| « Prev | Page 1 | Page 2 | Next » |
Substituting one small hassle for a very large hassle is, unfortunately, something some managers excel at. Usually it means the small hassle is off their plate and the very large hassle is on someone else. |
Well, if a vaginal birth is not possible, I guess...Oh, you meant something else. Sorry. |
I was commenting on the apparent tendency of UNIX commands to be obscure for the sake of obscurity. To each their own, though... |
So you believe all statically typed languages are insane? If you do 5/2 in C, Java or pretty much any statically typed language it's going to give you 2. You've gotta explicitly cast those ints to floats if you want a float as a result. |
Re: Time Flies
2012-12-12 13:45
•
by
Steve HoldowaySteve
(unregistered)
|
It would have to be fortran 77 as that's when block ifs were introduced |
Re: Time Flies
2012-12-12 15:05
•
by
Broke my fingers on a teletype
(unregistered)
|
I take it you have never typed a significant amount of text on the teletype machines that Unix originally ran on. Slow, clumsy keyboards with giant mechanical keys that (slightly exaggerated) you had to mash with your fist to use. 5 minutes with one of those and you will quickly realize that those commands are not "obscure for the sake of obscurity" but rather "shortened for your fingers' sake". |
So explain to me how the "biff" command got named when something else with 4 characters would have been much better. |
Not "pretty much any statically typed language." Just the C family, which is insane for many reasons, including this one. In Pascal, on the other hand, (which is also statically typed,) "5/2" returns 2.5; if you want a result of 2, you use the integer division operator: "5 div 2". Which is the right way to do it: division behaves as actual division, and if you want something that's not quite real division but is similar, you use a different operator. |
It doesn't matter. They aren't actually counting milliseconds, anyway. |
No, thankfully. But, surely not needed now? I guess it's a matter of not changing anything you don't have to... |
8/10. Would cheerfully flame (actually, someone already did). |
|
So TRWTF is nobody has noticed for 6 years, that this clock was skewed by around 30% to 50% because 15ms is not equal 1cs?
|
|
Errr...The issue with the 0 ain't got nought to do with speed of a computer....
There's a bug in the code that means 0 will ALWAYS appear to be missed. But noone else noticed that, right? |
|
Am I the only one who starts with a timestamp and then just polls the difference for intervals? If you have to roll your own then thats probably the most reliable way I can see to do it.
|
Re: Time Flies
2012-12-12 17:17
•
by
Broke my fingers on a teletype
(unregistered)
|
That and several decade's worth of legacy programs, scripts, and software... Of course you can customize the shell's commands with the alias command if you feel that the defaults are too cryptic Original ls Shorter alias l='ls -lart' Windows Flavour alias dir='ls' Politely Verbose alias Please_list_all_the_files_in_this_folder='ls' Whimsical alias hunt='ls && [ $[$RANDOM % 12] == 0 ] && echo "I smell a Wumpus"' |
Hmmm...but it seems two is not the right answer either - that is, unless you lay off anyone who doesn't fit in an office. |
why is 5/2 any different to "5 div 2"? Both / and div are arbitrary symbols....why should 1 be more correct than the other? |
Re: Time Flies
2012-12-12 17:23
•
by
PseudoBovine
(unregistered)
|
So you're giving it a zero?
If you have 5 people and 2 offices, and you put 5/2 (integer valued) in each office, you're *still* not going to be getting the correct answer. ("Well, Tom, the good news is we're not going to cut you in half. The bad news is that you've been truncated out of an office.") |
As well as saving fingers, I thought some of the idea was saving sapce. Back in the day when we didn't have massive hard disk, 1 character was a lot, so wasting characters having a command like "copy" when you could call it "cp" seemed a silly thing to do. |
Why inappropriate? I can just see the Mythbusters doing their experiments (except they'd need to find something to blow up in the end). |
|
Time wounds all heels.
|
How do you feel about being closer to an implementation of ELIZA? |
The program 'biff' was named after a dog that would bark at the postman. No other explanation necessary! p.s. Programming on an ASR33 will humble many a young programmer quite quickly! |
|
Please forgive my ignorance here - years ago I was forced at gunpoint to modify a large Java program and swore to never touch it again - but, is there seriously no way to get the local time in seconds since the epoch (or other reference point), in JavaScript?
|
Is there a way?
Is there a way that the original developer knew about? Maybe not. He also doesn't seem to know about setInterval() in place of setTimeout(). Worse, using a 1ms timeout instead of a 1s timeout when the lowest resolution your timer needs is at the second level shows not just a lack of knowledge, but a lack of understanding. |
It's not that one symbol is more correct than the other. The point is that they are different symbols for different operators. Use whatever symbol you want. I really like this change in Python 3. Rather than inheriting the approach of C like Python 2, they now treat "/" as floating point division and "//" as integer division. This makes code more reusable because the operation is the same all the time; the type of the arguments doesn't matter. Sure you could cast to get the same effect. But it's nice that you don't have to. |
|
"If your database is having deadlock problems, the solution is to give users 40 minutes (your mileage may vary) to submit the form?
First of all, deadlocks arise from two (ignorantly written) updates occurring at roughly the same time. Not 40 minutes apart. " Deadlocks can easily come from 2 different events far from each other in time. A deadlock is not always a race condition. I guess that in this case, the system locked some entries in the database, from the user started his action, and until he finished his work. In that case, forcing the user to work faster would decrease the risk of deadlock, because the time the user held the problematic locks could be decreased. Or maybe the developer is just an idiot. |
The idea of having different symbols for different operations (division-giving-long-double versus division-giving-integers) is good. Deliberately choosing several other languages' rest-of-line comment introducer, not so much. Oh, and does it coerce floats to integers before or after the // division? (i.e. does 0.41 // 0.1 give 4 or a div-by-zero trap?) |
|
That piece of crap is not even beginners code, author could've used google to search for a working version...
|
FTFY. |
Don't need no Steeenking block ifs: C Assume some code above that sets I,B,C,D IF (I) 100,200,300 100 CONTINUE A = B GOTO 400 200 CONTINUE A = C GOTO 400 300 CONTINUE A = D GOTO 400 400 CONTINUE C ..and more code below. The extra GOTO allows us to C insert code between it and 400 that we can C 'spaghetti into' if we want to be really perverse. |
That was mildly funny, but don't quit your day job. |
>>> 0.41 // 0.1 4.0 Sure "//" isn't going to fly in languages that use it for comments, but since Python uses "#" for that, who cares? |
|
I guess sometimes the fix can be worse than the bug.
|
|
Well, I think there's more to this code when examined carefully - there are a 1,000 milliseconds in a second, not a 100 !
|
I always read it as "measure the timing (indirectly ascertaining their speed) of the flies with the alacrity of the flight of an arrow through the air" - that is, "I want you to time those flies - get a move on!" |
Gecko (or Netscape 6.x, as you would have known it back then) could do it. However the feature was discontinued and Firefox 17 is no longer capable of reformatting the source. |
Did you mean setInterval (or some sort of fake interval created by setting a timeout in the timeout handler)? By the way, Firefox has a preference for the minimum interval, so you can make survey time pass more slowly. (Or just switch tabs, as the default for background tabs is higher.) The preference also applies to self-resetting timeouts, although obviously the first one is unaffected. Before that preference existed, there was a 10ms minimum on timeouts and intervals. |
Assuming your boss couldn't learn how to type "-b", the right solution was to check in some helper tool written in Python or Haskell or some other language where indentation is significant. Once someone needed to, e.g., add a conditional somewhere in that tool, your boss would be unmasked as a 1960s robot as he shouted "does not compute" until his head exploded. |
Complaining that "5/2 == 2" is wrong because that's not how the division operator works in grade-school math is like complaining that "for (i =0; i != 10; ++i) {}; i == 10;" is wrong because that's not what the word "each" means in English. There is no mathematical division operator there. Have you ever seen "5 divided by 2" spelled as "5/2" in any context except programming? That's not how division is written. (Of course it is how you write a fraction in some contexts, but in that case, it's the fraction "5/2", not an expression to be evaluated as 2, or 2.5, or anything else.) Since "5/2 == 2" is clearly a programming expression, not a mathematical expression, it only makes sense if you understand what language it's written in. In most C-family languages, it's true. In, say, Python 3, it's false. Neither one of those is "right" outside of context. The right answer, of course, is to use Applescript (or Hypercard), where you write "5 ÷ 2", just as you did in grade school, and by the time you've figured out how to type the "÷" on a keyboard with no such symbol, you no longer care what the answer was. |
Given that Java and JavaScript are completely different and unrelated languages, it looks like Netscape's marketing ploy 17 years ago paid off by making sure people like you never learned their language. After all, who wants programmers who understand, admit, and ask for forgiveness of ignorance while asking simple questions, when you can attract programmers who are absolutely sure that the one tool they know how to use must be the right one? |
That's how pretty much everyone wrote division that I'm aware of in high school and university. a la e/m = c² or e - = c² m Why would you ever use the basic division symbol when it takes up more room and takes longer to write out? Especially since it's just a pictograph for the slash version anyway, with the dots representing the numerator/denominator. |
|
Lets make time fly even faster:
|
| « Prev | Page 1 | Page 2 | Next » |