@toon said:
schemas (schemae?)
For pedantic dickweeds, the etymologically-correct plural is schemata.
@toon said:
schemas (schemae?)
For pedantic dickweeds, the etymologically-correct plural is schemata.
@morbiuswilters said:
On the other hand, disabling JS is a useful development feature--I use it all the time when developing. But I'm sure this functionality will be restored by an extension (the usual solution when Mozilla pooches something), so for web devs it's probably no big deal.
Is the behavior with JS completely turned off significantly different compared to just blacklisting (or failing to whitelist) your own site in NoScript? Because that extension already exists and has a lot less of a baby/bathwater problem.
@Ben L. said:
I'm going to link to a FAQ entry that you are sure to ignore.
Having read said FAQ entry, I can now say I know what the project's goals are. I think that choosing that group of goals as the central principles around which a language was designed was probably a terrible idea, but at least know what the goals are.
Actually, since we're in full language war mode in this thread now, how about a point-by-point deconstruction of the FAQ's rationale?
@FAQ said:Computers are enormously quicker but software development is not faster.
Brilliant insight there, don't you think? And no, software development is faster, due to better tools and more use of high-level languages.
@FAQ said:It is possible to compile a large Go program in a few seconds on a single computer.
Seriously, one of the primary goals is optimizing for compilation time? I mean, I know typical C and C++ projects take way too long to compile and link, but I would never think that a language first developed in 2007 would need to specify that as a project target.
@FAQ said:Go is fully garbage-collected and provides fundamental support for concurrent execution and communication.
If you're developing low-level systems software, you usually don't want automated GC for everything and opaque concurrency support; whereas, if you're developing application software, you'd use an actual high-level language and wouldn't be thinking about things like header files. What kind of program is best written in Go?
@FAQ said:There is a growing rebellion against cumbersome type systems like those of Java and C++, pushing people towards dynamically typed languages such as Python and JavaScript.
Actually, given that the only real complaint they have about Java is its horrendously redundant type annotations, I'm wondering if they had just never heard of Scala when they started the project.
@FAQ said:And perhaps most radically, there is no type hierarchy: types just are, they don't have to announce their relationships.
Congratulations! You've invented Haskell's type classes, only crappier. (Those were invented in 1988. They called them "concepts" before they threw them out of C++11.) Also, it's kind of sad that the notion of not having subtype polymorphism is considered a radical idea at this point.
@morbiuswilters said:
Most of the Go I've ever seen made it look ludicrous, a mish-mash of other languages thrown together for no discernible reason.
Exactly. Most programming languages have some kind of guiding principle at their core, which drives the entire direction of the language. Typically, you can sum up the entire language in a single sentence. C is like a high-level assembly language. Java is mindlessly object-oriented. Python is supposed to be really easy to read. Lisp turns everything into lists for metaprogramming purposes. Haskell is all about embedding other languages' features in a purely-functional environment. Even Perl seems to have a coherent goal of a sort: make a language that supports or can support every feature ever concieved by anyone.
What the heck is Go?
Agreed. Every bit of Go I've seen makes it out to be an unholy union of C, Python, and Erlang. I'm not learning that unless I have to for my job.
@TheCPUWizard said:
No, that is 11% (i didnt double check the exact match) of DUPLICATION and 89% unique code...
Way to miss the joke. (I haven't actually used this feature, but given that the documentation says it only matches nearly-duplicated sections of 10 or more statements, a sanely-written program should have a reported duplicate code rate of approximately zero.)
I noticed this too when I had an HP laptop, although it didn't seem to induce the level of rage you are evidently experiencing...
(I think I was just numb to HP stupidity by that point.)
The more WTFy part was the alternative to the "Windows Power On experience"—namely, HP's useless pseudo-OS thing.
In this case, I think the particular user (my mother) was not at fault; it was just a sporadic failure. And this drive was apparently actually a "backup drive", with the canonical data being on her laptop's hard disk. But that doesn't mean that what you're saying doesn't account for a significant percentage of problems in the general user base.
I just had the Micro SD card in my phone give out a couple weeks ago, albeit not so spectacularly. Based on previous behavior (random files getting corrupted) and failure mode (detecting the presence of an SD card but saying it's unformatted), I suspect it's been decaying slowly for a year or so and finally flipped one too many bits in some table somewhere—i.e. the data might still be there, I just need to find a program that can autopsy the file system.
When my mother plugged in her 2 GB USB flash drive today, she discovered that some of her files had traveled back in time to warn her of the impending failure of mathematics:
And to further slaughter the joke: the "advanced movement system" quote was supposed to be a reference to what the scan for wall jump surfaces says before you get the Screw Attack in Prime 2. (Or was it 3? Maybe it was the Spider Ball. I don't know why I even remember that line.)
Oh come on, with those clues I thought this would be easy.
@screwattack.com said:
You are not authorized to access this page.
I was actually trying to focus less on the writing style and more on this line: "In either case, the probability of loading 2 classes in the same VM with the same name and identityHashCode should be nearly impossible." Try to imagine why that sentence would be necessary in describing the internals of a class that lets you change antialiasing and font rendering settings. (If you haven't heard the term accidental complexity, this is what it means.)
...In fact, let's look at some other parts of the source code.
public class RenderingHints implements Map<Object,Object>, Cloneable
Unless you're writing a new general-purpose map implementation, why yould you ever implement Map
yourself?
* Instances of this class are immutable and unique which * means that tests for matches can be made using the * {@code ==} operator instead of the more expensive * {@code equals()} method.
Why? Who cares if we have to use equals() instead of == when all anyone ever does with these keys is set them once per render and then forget about them?
private static HashMap identitymap = new HashMap(17);
Why is the HashMap initialized to a size of 17? Where did this magic number come from? It can't possibly be relevant, because if there are more than 17 entries in the map it will just expand at a tiny little cost and no one will notice. What kind of keys and values does the map have? I don't know, because this is Java 7 and the code still hasn't been updated to use generics. (From looking at the code below, I figured out that the actual type of the field is HashMap<String, WeakReference<Key>>
. Obviously.)
/** * Returns true if the specified object is a valid value * for this Key. * @param val theObject
to test for validity * @returntrue
ifval
is valid; *false
otherwise. */ public abstract boolean isCompatibleValue(Object val);
There are so many better ways to do this.
HashMap hintmap = new HashMap(7);
Again with the magic numbers. Why 7?
public Object put(Object key, Object value) { if (!((Key) key).isCompatibleValue(value)) { throw new IllegalArgumentException(value+ " incompatible with "+ key); } return hintmap.put((Key) key, value); }
Aha. So that's why they implemented Map
themselves. That's... a really stupid reason.
public String toString() { if (hintmap == null) { return getClass().getName() + "@" + Integer.toHexString(hashCode()) + " (0 hints)"; }return hintmap.toString(); }</pre>
Why is there a case for
hintmap
being null? It's initialized on construction and nothing ever sets it again. Furthermore, the other methods in the class reference it as if it can't be null.Finally, virtually every reference to the
RenderingHints
class in client code consists of one or both of the following lines:g.addRenderingHints((Map<?, ?>) Toolkit.getDefaultToolkit().getDesktopProperty("awt.font.desktophints")); g.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);So really, the whole thing is an overcomplicated, excessively-general way to turn on settings that should be on by default.
Just spotted this incomprehensible wall of text in the source code for the java.awt.RenderingHints
class:
// Note that this system can fail in a mostly harmless // way. If we end up generating the same identity // String for 2 different classes (a very rare case) // then we correctly avoid throwing the exception above, // but we are about to drop through to a statement that // will replace the entry for the old Key subclass with // an entry for the new Key subclass. At that time the // old subclass will be vulnerable to someone generating // a duplicate Key instance for it. We could bail out // of the method here and let the old identity keep its // record in the map, but we are more likely to see a // duplicate key go by for the new class than the old // one since the new one is probably still in the // initialization stage. In either case, the probability // of loading 2 classes in the same VM with the same name // and identityHashCode should be nearly impossible.
I am in awe at the levels of WTF-ery required to necessitate such a comment.
It's like haiku, for stupidity.
Passwords stored safely.
Only decrypted for mail.
Uh-oh—inside job.
So is the name of the site supposed to sound like "travesty I"?
Some (maybe most) people just don't get how relational databases are supposed to work.
Incidentally, what's the deal with the xWalk prefixes? Does the x stand for cross/Cartesian product or something?
I think the reason the bitCount one is fastest is that the JIT compiler is actually optimizing the call to bitCount into a machine instruction. When I tried debugging a piece of code that uses bitCount, the debugger refused to step into it (even though I've got the source for the software implementation of bitCount in the JDK). I couldn't find much information on this, but here's something.
@morbiuswilters said:
How often do you have to write this same method?
Once per Java project where I need to check whether something is a power of two. =D
Seriously, I try to use Guava wherever possible, but there's a couple of functions I just end up rewriting over and over again.
In Java I always write this method as:
return n > 0 && Integer.bitCount(n) == 1;
In terms of bit-twiddling tricks, you can't get much clearer than that.
I have Eclipse set up to warn on enum switches that don't match against a constant in Java. I usually code such switches in a separate method like this:
switch (someValue) { case CONST1: ... return ...; case CONST2: case CONST3: ... return ...; } throw new AssertionError(someValue);
That way, the compiler will catch it, and it will fail at runtime if new constants have been added.
@tgape said:
7953.2 bonus points for implementing a 'no wait mutual exclusion mechanism' to prevent the thread writing the random data from scrawling all over the FFT input while the other two threads are doing nothing which looks decent but actually does nothing, and a completely different 'no wait mutual exclusion mechanism' to prevent the two threads doing FFTs from mucking up the data for the thread comparing the results, which also doesn't work.
I'm going to concede defeat before the plausibility of this starts depressing me.
@jpa said:
Let's see.. you could spawn N new threads, each with realtime priority, which would hog the CPU so that the original process pauses :)
Why stop at N threads? Use a fork bomb.
Each process would allocate a 1 gig array, FFT whatever random data is in it, then discard it.
@dhromed said:
I have no idea what that code does.If you have no idea what the code does because you come from a Java background, it's worth noting that a virtually identical syntax made it into Java 7:
try (Resource res = getResource()) { // Do stuff with res. }
P.S.: try-finally < using block < lambda callbacks < custom monads.
The WTF is presumably the potential localization problem, combined with the inferred lack of cohesion in a thousand-line class that includes this function.
So yeah, I'm numb to it too.
This thread continues to reinforce my belief that all languages are actually imperfect reflections of Haskell.
@toothrot said:
This doesn't help you with tornado's wrapper, but you may take a look at http://packages.python.org/oursql/ in the future..
Actually, I was just going to use Tornado's database module because it seemed convienient. Everything I read said that MySQLdb was the "standard" MySQL connector for Python. There's no restriction to using tornado.database instead of any other library; it's totally separate from the rest of the framework. So... I guess I'll try oursql instead.
@smmoonshoes said:
Is this it? http://sourceforge.net/projects/mysql-python/files/
The .exe installers in there usually work great for me in Windows.
Is there one for Python 2.7, or should I just give up and use 2.5? For that matter, why are there different versions for each Python version, anyway?
@blakeyrat said:
I'll bet dollars to donuts that that bug has nothing to do with a bug in the Windows API.
Yeah, me too, but it made a better rant blaming it on Microsoft.
So I'm working on my first nontrivial (i.e. not based on applying silly transformations to some data and writing it to stdout) Python project, involving a web server with a MySQL backend.
The server is written with the Tornado framework. Reading the Tornado documentation, the solution seems self-evident: access the database through the handy-dandy tornado.database
wrapper library. Sounds simple enough, right?
But that doesn't work. import tornado.database
generates an error about the abscence of a module named MySQLdb.constants
. Turns out Python doesn't have a built-in database connector for MySQL, so tornado.database
relies on a library called MySQLdb for this. OK, fair enough. I just have to download this library and add it to the PYTHONPATH
environment variable, like I've been doing for other libraries, right?
Wrong. Trying import tornado.database
now produces an error about a missing module named _mysql
. Googling the error message reveals that MySQLdb relies on a native C library for interfacing with MySQL.
The MySQLdb developer's website scolds me for not reading the README file before trying to install the library. I'm told to go follow the install instructions there. First, I'm supposed to download something called setuptools. Apparently it's some kind of system for installing Python modules, I don't know. From reading the install instructions of other Python libraries, there seem to be about 37 different commonly-used installation systems for Python. Simple, right?
Then I get to the next step. Here's where the real fun begins. MySQLdb doesn't include any binary builds of the native libraries it relies upon - you have to compile them yourself from source. I don't care what platform you're on, past experience has taught me that "compile this from source" is basically a euphemism for "enjoy spending the next 3+ hours of your life banging your head on the wall". But if you're on Windows, like I am, it changes to "mercury will crystallize in Hell before you get this working".
The readme explains how the developer doesn't use Windows, but how other people have managed to get the library working in the past. Wonderful. I'm supposed to set an environment variable to tell the installer where my MySQL installation is, because the developer can't be bothered to check the registry. It even says as much.
Why does it need a MySQL installation anyway? Because it needs the header files from the development utilities for MySQL, which I didn't install. So I need to re-run the installer for MySQL with that extra little checkbox ticked. Alright, fine.
The readme then suggests I try building MySQLdb's C library with Cygwin. I don't have Cygwin on this machine, so I need to run off and download and install it. 15 minutes later, I try running python setup.py install
, which proceeds to inform me:
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "C:\Program Files (x86)\Python\MySQLdb\setup_windows.py", line 7, in get_
config
serverKey = _winreg.OpenKey(_winreg.HKEY_LOCAL_MACHINE, options['registry_ke
y'])
WindowsError: [Error 2] The system cannot find the file specified
</module>
Gee, thanks.
OK, more Googling, I get this page telling me I'm supposed to edit the file site.cfg and change the MySQL version number to match my installation's version number. How the hell was I supposed to know that?!
So I change that, and now I get another error: Unable to find vcvarsall.bat
. At this point my patience is rapidly running out. Google, yada yada yada, basically this error means my compiler is screwed in the head and I need to use a different one. That means running off and downloading and installing MinGW.
Oh, but that's not the end of it. The MinGW installer vomits up an error message of the form "unable to execute file mingw-get.exe". Google Google Google, you know the drill. OK, apparently there's a race condition in the MinGW installer, related to some kind of defect in the Windows API, that makes it so I can't install MinGW on Windows 7 64-bit.
So basically, at the current point in time, in order to access a database I need to use a Python library that needs another Python library that needs a C library that needs to be compiled using MinGW, which I can't install because of a bug in Windows. Since, as we all know, Python is so easy-to-use and is really improving my productivity by orders of magnitude over, say, Java, where I can access a MySQL database by dropping a library on the classpath.
I'm going to go back to banging my head on a wall now.
@blakeyrat said:
The good news is that it's almost certainly actually counting characters and they just wrote "bytes" to be cute.
... except that the message doesn't make them look cute, it makes it look like they don't understand the concept of multi-byte character encodings. Which they apparently don't, since they can't handle accented characters. Maybe the really are using ASCII on the backend?
@Smitty said:
It seems that we received an insurance application yesterday containing a character that the Sql Server XML parser doesn't like (a '~').
... wait wait wait, what?
@Smitty said:
a character that the Sql Server XML parser doesn't like (a '~').
... but, wha? XML, what the wha bu (incoherent gibberish)
@Smitty said:
The workaround is simple; point a debugger at production and manually submit the policy by removing the offending character from the in-memory XML object
(sobs quietly)
Only here does every thread degenerate into a discussion of how horrible the forum software is.
So wait, you're telling me that what I posted was reasonable and what Qwerty posted was TRWTF?
My soul is saved! I'm allowed to post things on the Internet again! Callooh, callay!
I'm a n00b. I apologize for my limited experience with working with databases of that size
I sort of expected that they would make some attempt at assigning the tables names with some semblance of usefulness, like "ab3nc_42_items". (I do see one "hcfa" there, so they tried at least once.)
Here's my first WTF submission. I've been meaning to upload this for a while now.
I briefly worked at a healthcare company. Apparently their idea of HIPPA compliance was making their database so impenetrable that no one - not even their own employees - could gain access to the data to misuse it.
The above screenshot shows a few of the hundreds of tables in the largest of their multiple central databases. EVERY table, column, view, and stored procedure was named this way, or some other equally-esoteric pattern. This wasn't even caused by a total misunderstanding of the relational model, like we've seen here in a couple featured articles ("What's the maximum number of columns allowed?"). This is just how they decided to name things.
They also had a couple data dictionary documents - distributed, of course, by one all-knowing employee at a different office - describing what each table was for in less detail than the one-sentence summaries at the beginning of a Javadoc page. Judging by the other submissions to this site, I'm guessing that "job security" is the first thing one learns as a DBA?
BONUS WTF! The password for this database - which, somewhere deep within its bowels, contained all of their patient information - was six characters long. And contained three consecutive identical characters.
(That's the database's bowels, not the password's bowels.)
@JohnWestMinor said:
Well, keep in mind I'm talking about a more complex interface design than just "push onscreen button, do that." I.E, not just form applets (I have no problem with listeners for onscreen buttons). Considering that, having a step timer to call a general update method for all updateable objects and then letting them check the static Input.*() methods as needed is far easier. My system is also especially useful for complex button presses, like ctrl+a+s as all the neccesary variables are built into the Input class.
The right way to do this is to have listeners that set application-specific variables on the event dispatch thread, and then have the update call on the timer thread check those variables, do its processing, and set other variables which are in turn used to render back on the EDT. No singletons with huge arrays of key data necessary.
Wow. This guy managed to design an encryption algorithm that is even weaker than ROT13.
But I'm wondering the same thing as morbiuswilters. What's the point?
I wonder how much Microsoft had to pay the IUPAC to put their name on the element. Before long, we'll be seeing "Adobe Nitrogen" and "Google Ununoctium".
I have no words for this one.