- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
I have no idea why you would want to define your outcomes before gathering data /sarcasm
Admin
Just to nitpick, 020 is an area code, not a local exchange. London has a lot more than one of the latter, I assure you.
Admin
That must be American endians
Admin
I've never met anyone who actually tried to defend it. Most just shrug their shoulders and walk away.
Admin
While I agree with you in the general, the important point to remember about that phrase is the "if you aren't doing arithmetic on it". Sometimes doing arithmetic on a number has better performance than doing string manipulation on the equivalent string.
For example, I'm guessing that the Highly Paid Consultant graduates chose to use integers to store the phone numbers because they were doing some sort of parsing of the number. Maybe to get the area code, department, building, etc. As a integer with a well defined length, it's easy to use modulus to get whatever portion of the number you want. As a string, you'd have to use some sort of substring function which is almost always worse performing. If they are doing this on older hardware and the parsing happens a lot, then storing the phone number as an integer makes sense.
The point though, is that you have to actually think about it and figure out if your use case is the general or a specific outlier.
Admin
Number of CPU cycles for calculating IDIV on an 8086 (which includes calculating remainder): 8 bit reg 101-112 16 bit reg 165-184 8 bit mem 107-118 + EA 16 bit mem 171-190 + EA
And that is already fast, many older processors didn't have hardware support for DIV
Admin
Extensions, country codes, different formats for area codes, etc...definitely not a well-defined length.
Admin
I've heard a defense for it. It goes something like
"Most of the time, the year is obvious, and so can be omitted, leaving MM-DD as the sane, sortably ordered date. Then in cases in which the year isn't obvious, it should be added to the rest of the date in a format that doesn't disrupt the ordering, so it gets tacked on to the back. This gives MM-DD-YYYY. So if you write a list of dates
2/9 5/21 8/11
And you want to add last year's January 30 to the top without rewriting the entire list, you can just add '1/30/YYYY'."
It's a mistake approximate to storing the year as two ASCII values. It works fine and saves time/space when the data only sticks around for a while and all parties involved know about the missing information (in this case, the year, in that case the prefixing of "19". When you start doing anything beyond those limitations, it's a pain in the neck.
Admin
Admin
Admin
Client: "Fix this, it doesn't work." Me: "Okay, all I have to do is change this bit here." Client: "You can't change that bit because it has to keep doing what it's always done." Me: "What it's always done? You mean not working?"
Admin
Dialing overseas from the U.S. starts with 011. So not just a problem in the U.K.
Admin
Depends where you are from. International dial-out in Australia is a 1100 prefix + country code + local number
Admin
Also, why wasn't that comment blued the first time? http://thedailywtf.com/Comments/Confessions-The-Phone-Number.aspx?pg=4#385655
Akismet says thedailywtf.com is a spam site.
Admin
Admin
Admin
Admin
Admin
Yes, all those conversion between integer and string, after (in a typical scenario) you read from an ORM like Hibernate that uses reflection to populate class fields, after it has decoded a JDBC result set which was populated by the driver after it interpreted the data it read from a buffer that was filled by a socket class that had to interact with the OS level socket...
I guess it's easy to win an argument with people who have no clue how anything works.
Admin
Good question, and I confess I misremember the details. I think because when we dig into it we found that the month had been formatted to as many digits as the month happened to have, so while 22nd Sept would have been 229hhmmss, ... well, you see where this goes.
Admin
No it's not. It's 0011. Hilarity ensues with PABX systems that require you to dial a 0 for an outside line, and emergency services being 000.
Admin
That might not be ah..extendable enough. Store half the value and indicate that the phone number is odd using the negative.
Admin
Sheesh, don't be so rude. It's "native endians".
Admin
No, everyone knows that nvarchar is the most efficient storage data type. Don't they?
I had a colleague a few years ago who approached me one day to ask what the maximum value in a particular database column was, or was ever likely to be. Expecting him to suggest using a smaller int data type (I was feeling lazy when I wrote the table definition and just plumped for plain old int ;) ), I sheepishly confirmed that they were unlikely to go over about 50, at which point he converted the column to nvarchar(2), to save space in the database.
I kid you not.
Admin
Do it the purist way. Your successors will not thank you, because they'll never have to deal with problems that don't happen. By the same token, they won't curse you, either.
Admin
No, 1100 in Australia is "Dial before you dig" - a service that should tell you where underground telephone, electricity, gas, water, sewage, etc lines are.
Yes it's 0011 and most phone systems use 0 for "outside line" (and 0 prefix for interstate) so you could accidentally dial emergency 000. Similar in the USA where 9 is often "outside line" and 1 for long-distance, if you double up on the 1 you could accidentally dial 911.
I'd really like Australia to change the 0011 to simply 00, like most of the world, but then we'd probably have to change the emergency number to something like 112. I'd also like to remove area codes, dropping the leading 0, and have simple nationwide nine-digit numbers. But I'm not in charge of numbering.
And to call Russia with love you'd use 007. :)
Admin
This was my first thought when reading the post.
There would be a possible conflict between 11 January and 1 November or 11 February and 1 December. But was that number just used as an identifier?
Admin
Like :-)
Admin
Admin
But 221000000, 222000000, etc are well under MAX_INT. So it couldn't have been a problem until a double digit month...
Admin
I ran into a similar bug a few years ago, except the issue was with a system taking in US numbers, and the problem was that most user were having their numbers turned into a random Texas number. Of course, it turned out that a bit of logic was putting it through an integer transform that cut it down to the maximum possible value if it exceeded - and (214) 748 3648 is a valid Texas phone number...
Admin
Developers that do shit like this should be shot.
Admin
The files would not be expected to hang around for that long. They are temporary files used to hold reports (usually monthly) which would be expected, once printed, to be mailed to the customer. The directory would have been cleared by end of week at latest.
Admin
Admin
Admin
There, someone defended it.
Admin
They do this right in Japan, I believe; big-endian:
2014-01-23 17:28:07 1234
(With the added advantage that lexical order is date order.)
Admin
The fact that you're describing an integer as having a "well defined length" indicates that you're making the elementary mistake that inspired the saying: you're thinking of integers in terms of the way they are presented as text in base-ten. Integers do not have lengths. Strings have lengths.
Storing non-numeric data in a numeric format does not make sense, period. There is no counter-argument to this that doesn't involve some bizarre external artificial restrictions.
Just because it's non-numeric doesn't mean it's a string, though. What you're describing is neither textual nor numeric. It's a structure with multiple components: area code, department, building. If we want to process those individually, then we store them in such a way that they can be accessed individually.
Admin
The 00 is the international access code and the 1 is the country code for US. When you call from the UK, the US uses 011 and 44 is the country code for the UK.
The convention is to use the + for the international access code, then the country code and then the number without the leading 0.
Admin
Admin
Admin
Admin
Is this the same Ebony from My Immortal? I had wondered where she'd ended up...
Admin
Right. The other option is that they only implemented this change in October.
Admin
So dumb and naïve to store a phone number as an integer.
"A phone number is a number, right? So we should use a numeric type to store it!".
Admin
I live in Thailand. Most of the time, on the Internet, I enter my phone number starting with "+66", which is the Thailand country code. Sometimes the GUI won't take the plus sign.
Admin
Admin
Admin
Admin
Ebony was clearly not destined to become a Highly Paid Consultant. Else she'd have simply explained to management that in order for the application to support mobile numbers, the university would need to upgrade it to the 64-bit version.