What is the Best Bug-as-a-Feature?
Bat Country wonders: "The workflow system, at the department I develop for, was hand-coded by my predecessor in a rather short amount of time, resulting in somewhat unreadable code with a number of interesting 'features.' When I took over maintenance of the code base, I started patching bugs and cleaning up the code in preparation for a new set of features. After I was done, I got a pile of complaints about features that had disappeared, which turned out to be caused by the bugs in the code. So, that leads me to ask: what is your favorite bug that you either can't live without or makes your life easier?"
That probably isn't a bug. Most file-systems don't lock files that you are executing, so they can be overwritten whilst mapped into memory. This can abused in lots of amusing ways.
Slashdot: where don knuth is an idiot because he cant grasp the awesome power of php
In Second Life, if you zoom your camera up to a wall, you will normally just zoom in to see closer detail of the wall. But once up against the wall, swing the camera around to the side, and you can "back your way in" through the wall. Release and click again, and the camera is now "mounted" inside the house. Its so much fun to watch people inside their homes, especially when your avatar is prevented from entering the property. Some even pay for a little orb that still tells them that no one is detected within 30m. Its fun because the clicks still work, too, like right clicking on someone and IM'ing them.. to tell them that you liked their last outfit more than this one, or the couch looked better in the other corner.. really freaks them out. That is definitely a "bug" (or feature) I couldn't live without... not in SL at least.
Intelligent Life on Earth
As a programmer, I'm amused by both.
4 and 4.0 are equal by value but not in precision. 4 has one significant digit, while 4.0 has two. This is important because multiplying it by 1200 (which has two significant digits), yields two scientifically different answers. 4*1200 yields 5000 (5 x 10^3) while 4.0*1200 yields 4800 (4.8 x 10^3).
So, in the end, it depends, just like everything else.
IMarv
Trusting software vendors is no smarter than trus
I think you're describing the Unix feature that you can replace an executable file while it is in use; the program that is using it will continue to see the deleted version of the file, and new programs will see the new version.
That's not a bug, it's a feature. It's the reason why you don't have to reboot Unix machines after a software update, as you do for Windows.
The Rockwell 6502 was a hard-wired processor; there was no "illegal instruction" check. So, any bit-patter you loaded as an instruction would try to do something. Sometimes, because of the internal open-collector busses, you'd get neat "something OR something" that wouldn't normally happen.
Here's the I'm Feeling Lucky hit on it: 6502 Opcodes.
Thing is, the results might vary from implementation to implementation. So they might not work usefully on the 6510, which was otherwise a 6502 with an I/O register at $0000-$0001.
https://addons.mozilla.org/en-US/firefox/addon/3 176
WTF?!? Which particular python version are you talking about?
Python2.4 and later:
>>> x0 = int(4)
>>> x1 = long(4)
>>> x2 = float(4)
>>> x3 = complex(4, 0)
>>> x0 == x1 and x0 == x2 and x0 == x3 and x1 == x2 and x1 == x3 and x2 == x3
True
>>>
Or, are you talking about inequalities (<, <=, > >=) which are required for list sorting?
In this case, it's not a python issue but a mathematical issue. You shouldn't be trying to use inequality operators on complex numers. Inequalities with scalars such as floats, ints, longs etc are a mapping (S1,S2)=>(Bool), where S1 and S2 each can be one of float, long, int, bool, string, but such mapping is not defined if S1 and/or S2 is the field 'complex'.
Your question is interesting though - a matter of whether a sort of a list of containing complex numbers should work if all the complex numbers have a zero imaginary part. I wouldn't think so. But if you're desperate, you could try something like:
x0 = int(4)
x1 = long(4)
x2 = float(4)
x3 = complex(4, 0)
list1 = [x0, x1, x2, x3]
list2 = [x3, x1, x2, x0]
def compare(x, y):
if isinstance(x, complex) and x.imag == 0:
x = x.real
if isinstance(y, complex) and y.imag == 0:
y = y.real
return cmp(x, y)
list1.sort(compare)
list2.sort(compare)
As for the 'problem' of list sort results depending on order of the original list, this only happens where there is computational equality between members of the original list, so what's the problem really?
-- In the beginning was the WORD, and the WORD was UNSIGNED, and the main(){} was without form and void...
One way to lessen the chance of mistakes when using "rm" is to always use "ls" in place of "rm" first, then when the list of files looks right, replace the "ls" with "rm".
I have a script "lrm" which does this: ls the files, ask for confirmation, and then delete (if confirmed).
Heh, thank you. As an engineer I was also going to make this point, I'm glad I'm not the only one who realizes that the number of 0s after a decimal carries with it some hefty implications in the manufacturing and engineering realm. Working for a bearing manufacturer I can tell you that the difference between a part with a diameter of 4.00cm and a part with a diameter of 4.00000cm is a few hundred dollars.
Collector's Edition
ug. You should always make a file named "-i" in important directories to prevent this. That way when you do something dumb, like "rm * .old" the "-i" gets seen as a command line switch to "rm" and you get asked for confirmation.
-Hal
4 * 1200 = 4800 +/- 600, since 4 could represent 3.500000000000001 or 4.4999999999999.
For that matter, 1200 could represent 1249.9999 or 1150, so
4 * 1200 = 4800 +/- 625.
We just don't know how accurate the initial measurement was, so it is completely inaccurate to say that 4 * 1200 is equal to exactly 4800.
"Trolls they were, but filled with the evil will of their master: a fell race..." -- J.R.R. Tolkien on Olog-hai
alias rm to rm -i, it asks for confirmation.
I do that as well, but there is a danger if you start working in someone else's account, where rm is not aliased as expected. It may be better to alias del='rm -i' (for example) and train yourself to type del.
Also, "rm -i" is a pain when you're deleting a large number of files at once.
I always enjoyed cars with "child-safe rear windows" which don't roll all the way down. In many cases, this is because the rear wheel well cuts into the door, reducing the space available for the window.
In any event, you should be using "$@" (with the double-quotes)instead of $*, so you can properly preserve arguments with spaces. If you try to remove a file with a space in it with your script, it will not work as expected.
I'd also suggest adding a typeset -l yesno before the read, so you force the input string to lowercase before comparing it. Heck, let's see if it starts with a y, too. That way, y, yes, YES, and even YePaRoonIe will work...
I like ls -dF, so it doesn't show the contents of directories (-F appends a slash to the end of the filename, though, so you could add a "grep '/'" and fail if directories are present - hint: put the ls -1dF output in a variable using var=$(ls -1dF "$@"), test $?, then test inside the if block to see if the variable contains any lines that end with a slash).
Finally, you could use the ls command as your conditional statement instead of having to run ls twice. PS - the two hyphens protect you from arguments which start with a hyphen...
Email cloudmaster@cloudmaster.com with questions - I don't check replies on the dot very often.