Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Tamba
Apr 5, 2010

http://www.kalzumeus.com/2010/06/17/falsehoods-programmers-believe-about-names/

quote:

I have never seen a computer system which handles names properly and doubt one exists, anywhere.

So, as a public service, I’m going to list assumptions your systems probably make about names. All of these assumptions are wrong. Try to make less of them next time you write a system which touches names.

*List of 40 items*

Adbot
ADBOT LOVES YOU

The Gripper
Sep 14, 2004
i am winner
My rule for names is that if I can't read your name enough to even attempt to pronounce it, then I don't care if my system breaks on it.

e: pretty much the same rules that would apply if I met someone in person.

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

The Gripper posted:

My rule for names is that if I can't read your name enough to even attempt to pronounce it, then I don't care if my system breaks on it.
Sure hope you're only developing programs to be used in extremely-localized areas, then. Supporting non-Latin alphabets is really easy. (and if you can't read Иван Иванович Иванов then that's your problem)

Similar article: Falsehoods programmers believe about time and part 2.

e: the SA forums are gross if you use unicode

Malloc Voidstar fucked around with this message at 12:27 on Oct 25, 2012

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Are you endorsing this article, or pointing it out for derision, or just presenting it as food for thought? Admittedly it might be very different to work on a system that's supposed to store and use people's real names (as opposed to their sign-in names for a service), but admonishing the assumption that people's names can be expressed in unicode, without giving suggestions as to a way to avoid making such assumptions, just reads like a load of self-important wank rather than serious discussion. I mean, the author points out a number of genuine pitfalls but I get the impression that he thinks that if someone comes along and tells you that their name is , or , your system should say "sure, no problem!" His list of peeves is of no use without some suggestion as to how to avoid them, given that some of them would be all but impossible practically to avoid in a working system.

The time articles linked by Aleksei have much the same issue. I would be interested in reading about why it is a misconception, as it is presented in part 2, that every year has either 365 or 366 days, but no explanatory link is provided.

1337JiveTurkey
Feb 17, 2005

Hammerite posted:

The time articles linked by Aleksei have much the same issue. I would be interested in reading about why it is a misconception, as it is presented in part 2, that every year has either 365 or 366 days, but no explanatory link is provided.

The switch from julian to gregorian.

code:
$ cal 9 1752
   September 1752
Su Mo Tu We Th Fr Sa
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

Malloc Voidstar
May 7, 2007

Fuck the cowboys. Unf. Fuck em hard.

Hammerite posted:

Are you endorsing this article, or pointing it out for derision, or just presenting it as food for thought? Admittedly it might be very different to work on a system that's supposed to store and use people's real names (as opposed to their sign-in names for a service), but admonishing the assumption that people's names can be expressed in unicode, without giving suggestions as to a way to avoid making such assumptions, just reads like a load of self-important wank rather than serious discussion. I mean, the author points out a number of genuine pitfalls but I get the impression that he thinks that if someone comes along and tells you that their name is , or , your system should say "sure, no problem!"
No:

quote:

All of these assumptions are wrong. Try to make less of them next time you write a system which touches names.
Pretty sure there are quite a few programmers who won't have paid any attention to names other than "it must accept a name like mine".
See sites that don't accept apostrophes or hyphens, or apply length requirements.

Polio Vax Scene
Apr 5, 2009




Hi, my name is 37F89DA9-612C-498C-AFA5-AB9DF762E55F, but my friends call me 37.

Golbez
Oct 9, 2002

1 2 3!
If you want to take a shot at me get in line, line
1 2 3!
Baby, I've had all my shots and I'm fine
PHP code:
define("TRUE", false);

if (TRUE) {
 echo "TRUE";
} else {
 echo "FALSE";
}
http://3v4l.org/Nc84q

ToxicFrog
Apr 26, 2008


Hammerite posted:

Are you endorsing this article, or pointing it out for derision, or just presenting it as food for thought? Admittedly it might be very different to work on a system that's supposed to store and use people's real names (as opposed to their sign-in names for a service), but admonishing the assumption that people's names can be expressed in unicode, without giving suggestions as to a way to avoid making such assumptions, just reads like a load of self-important wank rather than serious discussion.

He is, in fact, talking about real names and not account names. A lot of systems expect your real name in addition to your account name (or will attempt to derive your account name from your real name, or will just assign you an account number or something). And a surprising number of those will choke and die if your name has an apostrophe in it, or a hyphen, or non-ASCII characters of any sort. Or it'll work fine, but changing your name later is either outright impossible or causes other things to break. And so on.

Yeah, it would be nice to have more information on how to avoid that issues, but it's a rant, not a lesson.

Jewel
May 2, 2009

ToxicFrog posted:

He is, in fact, talking about real names and not account names. A lot of systems expect your real name in addition to your account name (or will attempt to derive your account name from your real name, or will just assign you an account number or something). And a surprising number of those will choke and die if your name has an apostrophe in it, or a hyphen, or non-ASCII characters of any sort. Or it'll work fine, but changing your name later is either outright impossible or causes other things to break. And so on.

Yeah, it would be nice to have more information on how to avoid that issues, but it's a rant, not a lesson.

If I legally get my name changed to Jewel I have a lot of problems too because sites like to say "OH NO YOUR NAME HAS 'JEW' IN IT, WE CAN'T ACCEPT THIS". A lot of sites currently do this even with my name as a Username, I've gotten banned from BigPond's gamearena TF2 servers because Jewel's an "offensive name" (I had to contact them to get it whitelisted, took a month), and I couldn't register to a few other services with the name either for the same reason. Never ever put a restriction on usernames, just let users report offensive ones if it's in an environment where it matters.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe
Excuse me but I come from a long line of Bonerhitlers,

The Gripper
Sep 14, 2004
i am winner
Plus there's weird barely-known countries like Australia, where if you're open and notorious with using an assumed name it's considered legal, and there's no formal process required to use it wherever you want. e; the only caveat is a few government agencies require written proof to issue you certain documents, but that's not necessary for the name to be legal.

If I openly called myself Jewbag McNegrofingers then I could have that name considered as my legal name, despite it being dumb and racisty.

I'm pretty sure you'd get no objections to banning me from your service for it though, since you're not obligated to provide me any services and I'd obviously be a worthless person.

The Gripper fucked around with this message at 16:47 on Oct 25, 2012

tef
May 30, 2004

-> some l-system crap ->

Similarly, http://qntm.org/gay

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang




There's a proposed genealogy data exchange format being developed by FamilySearch, a mormon company, and (surprisingly?) it will support gay marriages :allears:

The old standard (Gedcom) has hardcoded HUSB/WIFE fields; GedcomX Couple relationship types will allow any two persons.

https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md

darthbob88
Oct 13, 2011

YOSPOS

Manslaughter posted:

Hi, my name is 37F89DA9-612C-498C-AFA5-AB9DF762E55F, but my friends call me 37.

Any relation to Tom Lehrer's friend Hen3ry?

Zamujasa
Oct 27, 2010



Bread Liar

Golbez posted:

PHP code:
define("TRUE", false);

if (TRUE) {
 echo "TRUE";
} else {
 echo "FALSE";
}
http://3v4l.org/Nc84q

:suspense:

Every time I try to justify to myself that PHP, while terrible, is at least perfectly usable if you're aware of some common problems, something like this comes along. It's not even that it's different. It's that it keeps changing back and forth for newer versions.

Kal
Jun 3, 2007

code:
Main.userList.put(this.dm[1].toUpperCase().replaceAll("<", "").replaceAll(">", ""), new Friend(this.dm[1].toUpperCase().replaceAll("<", "").replaceAll(">", ""), this.dm[2].replaceAll("<", "").replaceAll(">", ""), this.s.getInetAddress(), this.dm[4].replaceAll("<", "").replaceAll(">", ""), this.now));
Found this gem is the source code of a chat server that is used for a college Java class I'm taking. And no, it's not written by some clueless student but by the person who ran the course last year :downs:

Mogomra
Nov 5, 2005

simply having a wonderful time

Golbez posted:

PHP code:
define("TRUE", false);

if (TRUE) {
 echo "TRUE";
} else {
 echo "FALSE";
}
http://3v4l.org/Nc84q
http://3v4l.org/2s1sK

Seems like it might be a bug that's been introduced in 5.1.3. I don't see why anyone would ever want to do stuff like that in PHP unless it was a practical joke, though. There's always the possibility that somewhere deep in the bowels of the PHP documentation, there's a note saying you can't actually define constants using reserved words too. "Nope, guys. Working as intended!" - :shepface:


Either way, you can't really call it a coding horror if you're trying to alter something like the truthiness of TRUE at runtime, and you get unexpected results. That kind of nonsense might have worked in days gone by, but we now we have evolved sensibilities, man!

I'm thinking that TRUE and FALSE aren't actually constants, and calling "define("TRUE", $some_val);" creates a constant that will always be trumped by TRUE in the interpreter.

Note: I'm not defending PHP in general, I'm defending it in this specific case. There are legitimate horrors in that language, but we can't go around calling things horrors just because they don't behave the way we expect them to.

nielsm
Jun 1, 2009



I believe "true" is a keyword in PHP, and keywords are case insensitive. So in version 5.1.3 defines might have been made to resolve after keywords are checked for.

Zombywuf
Mar 29, 2008

Aleksei Vasiliev posted:

No:
Pretty sure there are quite a few programmers who won't have paid any attention to names other than "it must accept a name like mine".
See sites that don't accept apostrophes or hyphens, or apply length requirements.

I feel it is wrong to call these people programmers. Although there is also a very good chance they are programmers but their boss is a micromanaging idiot. However the unicode thing is not an assumption, it is the point where you throw up your hands and go "look, you're just going to have to meet me in the middle here, wtf do I put in the email template 'Dear _____,' and no; I'm not putting an image there."

Strong Sauce
Jul 2, 2003

You know I am not really your father.





Golbez posted:

PHP code:
define("TRUE", false);

if (TRUE) {
 echo "TRUE";
} else {
 echo "FALSE";
}
http://3v4l.org/Nc84q

Stuff like this is going to happen as PHP devs try to make PHP behave more consistently.

Here is the entry for it in the changelog for 5.1.3

quote:

* Eliminated run-time constant fetching for TRUE, FALSE and NULL

I do not see this as a Coding Horror, more like it's trying to correct a previous Coding Horror. Considering this change was made to PHP more than 6 years ago and it's doing something that no sane coder would do, I don't think it's that big of a deal.

Hammerite
Mar 9, 2007

And you don't remember what I said here, either, but it was pompous and stupid.
Jade Ear Joe

Zamujasa posted:

:suspense:

... It's that it keeps changing back and forth for newer versions.

According to the linked page it doesn't? It gives one result for versions 5.1.2 and earlier, another result for versions 5.1.3 and later

ohgodwhat
Aug 6, 2005

Carthag posted:

There's a proposed genealogy data exchange format being developed by FamilySearch, a mormon company, and (surprisingly?) it will support gay marriages :allears:

The old standard (Gedcom) has hardcoded HUSB/WIFE fields; GedcomX Couple relationship types will allow any two persons.

https://github.com/FamilySearch/gedcomx/blob/master/specifications/conceptual-model-specification.md

You'd think they'd generalize it to handle polygamy?

bobthecheese
Jun 7, 2006
Although I've never met Martha Stewart, I'll probably never birth her child.

nielsm posted:

I believe "true" is a keyword in PHP, and keywords are case insensitive. So in version 5.1.3 defines might have been made to resolve after keywords are checked for.

No, if you try to
code:
define('true', false);
then it'll give you a notice telling you that 'true' is already defined.

So the horror here is that it's allowing you to make a variable definition, not notifying you that it won't work, and then ignoring it. The example itself was stupid (redefining true as false), but I can think of a semi legitimate reason to make a define that would say, define TRUE as a string 'true', or as 1, or as a number of things to deal with things like input parsing.

I'm not saying that it's a good thing to do, but I'm sure that someone, somewhere, would think that it's a good idea, and when that happens, PHP should either let them do it, or be consistent with notifying them that it won't work.

Janitor Prime
Jan 22, 2004

PC LOAD LETTER

What da fuck does that mean

Fun Shoe
Horrors all the way down
https://crypto.stanford.edu/~dabo/pubs/abstracts/ssl-client-bugs.html

:stare:

Carthag Tuek
Oct 15, 2005

Tider skal komme,
tider skal henrulle,
slægt skal følge slægters gang



ohgodwhat posted:

You'd think they'd generalize it to handle polygamy?

Yeah actually that'd make sense. Though I guess they'd just model a polygamous person by having them in several concurrent marriages. Depends on the exact nature of the marriage I guess, I mean if it's an "equal" one where everybody is married to everybody, or it's one dude with 5 wives.

I should open an issue on github :haw:

qntm
Jun 17, 2009

The Gripper posted:

My rule for names is that if I can't read your name enough to even attempt to pronounce it, then I don't care if my system breaks on it.

e: pretty much the same rules that would apply if I met someone in person.

Not a fan of the Chinese, huh

pokeyman
Nov 26, 2006

That elephant ate my entire platoon.

The Gripper posted:

My rule for names is that if I can't read your name enough to even attempt to pronounce it, then I don't care if my system breaks on it.

e: pretty much the same rules that would apply if I met someone in person.

How often are you reading someone's name in person? Don't you just repeat their name after they introduce themselves? Do you live in a conference centre?

The Gripper
Sep 14, 2004
i am winner
I spend most of my free time at AA, reading nametags.

DaTroof
Nov 16, 2000

CC LIMERICK CONTEST GRAND CHAMPION
There once was a poster named Troof
Who was getting quite long in the toof

The Gripper posted:

I spend most of my free time at AA, reading nametags.

And I'm sure the frequency of members using unpronounceable symbols to identify themselves is a problem that destroys meetings.

Opinion Haver
Apr 9, 2007

Carthag posted:

Yeah actually that'd make sense. Though I guess they'd just model a polygamous person by having them in several concurrent marriages. Depends on the exact nature of the marriage I guess, I mean if it's an "equal" one where everybody is married to everybody, or it's one dude with 5 wives.

I should open an issue on github :haw:

I can't wait until people have to learn graph theory to understand marriages.

God of Mischief
Oct 22, 2010

yaoi prophet posted:

I can't wait until people have to learn graph theory to understand marriages.

Is that when the Deep South allows homosexual polygamy?

"Well, I'm married to my grandma, nephew, sister, father and myself (and my pig but he don't count)."

Deus Rex
Mar 5, 2005

yaoi prophet posted:

I can't wait until people have to learn graph theory to understand marriages.

classic: http://stackoverflow.com/questions/6163683/cycles-in-family-tree-software

Tern
Oct 18, 2012

God of Mischief posted:

Is that when the Deep South allows homosexual polygamy?

"Well, I'm married to my grandma, nephew, sister, father and myself (and my pig but he don't count)."

I suppose then the rule will be that one must be able to construct a spanning tree for each family.

Edit: crap, Deus Rex kinda beat me to it.

fritz
Jul 26, 2003

1337JiveTurkey posted:

The switch from julian to gregorian.

code:
$ cal 9 1752
   September 1752
Su Mo Tu We Th Fr Sa
       1  2 14 15 16
17 18 19 20 21 22 23
24 25 26 27 28 29 30

That was only the switch in the UK & subsidiaries, and I think they were late because the Gregorian calendar was papist. (and didn't places Greece switch really late, like early 20th century?)

Otto Skorzeny posted:

The idea that + should be commutative is not remotely unreasonable

It's clearly not always, though. Floating point isn't guaranteed to be commutative.

hobbesmaster
Jan 28, 2008

fritz posted:

It's clearly not always, though. Floating point isn't guaranteed to be commutative.

Floating point underflow and related issues are to be expected though.

Jabor
Jul 16, 2010

#1 Loser at SpaceChem
Floating point + clearly isn't associative, but I can't think of anything off the top of my head where it's not commutative.

tef
May 30, 2004

-> some l-system crap ->

fritz posted:

That was only the switch in the UK & subsidiaries, and I think they were late because the Gregorian calendar was papist. (and didn't places Greece switch really late, like early 20th century?)

http://en.wikipedia.org/wiki/February_30#Swedish_calendar the swedish changeover was the best

Outer Science
Dec 21, 2008

Daisangen

Jabor posted:

Floating point + clearly isn't associative, but I can't think of anything off the top of my head where it's not commutative.

String concatenation in languages that use it as such, for one obvious (but vaguely cheaty :v:) answer

Adbot
ADBOT LOVES YOU

Jewel
May 2, 2009

Ahaha, I found some good addon for Chrome that I wanted to use, but it had a lot of features that broke some stuff, where I only wanted one of the features, so I downloaded the .crx and extracted it with winrar, giving me access to all the code so I could just change it and put it back into extensions. This line of code is in one of the files, I have no idea what it does:

JavaScript code:
function bug2(what) {
	if (1==2) { console.log('>>>'+what); }
}
It used like this about 5 times throughout the 300 line script:

JavaScript code:
bug2('this page is good? '+ good +' ('+ taburl +')' );
But since there's the "if (1==2)" won't that never run??

Edit: Oh, right, debugging exists, could change it to 1==1 whenever they wanted to debug. Carry on!!

Jewel fucked around with this message at 05:39 on Oct 26, 2012

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply