Uppercase ... what?
-
I found this bit in an app I have to change/update. This is in code that was written by a "seasoned" developer - who liked to use the latest technology / techniques, even if noone else was (wrote one app in C#, when the rest of the codebase is VB) ('r' is a row of
a datatable, dt2Row is a row from another datatable)...
If Val(r("MAX_AGE").ToString) > 99 Then
dt2Row(4) = "99".ToUpper
Else
dt2Row(4) = r("MAX_AGE").ToString
End If
Words fail me...And just in case you think, "maybe it was just a copy & paste snafu... it was done 5 more times, for other data tables...
-
@johnt519 said:
. it was done 5 more times, for other data tables...
So it was a copy & paste snafu ?
-
@johnt519 said:
Val(r("MAX_AGE").ToString)
So what data type is MAX_AGE? This looks like perhaps TRWTF, though it's hard to say without knowing more.
-
The app is importing data into an Oracle database (yeah, yeah). The MAX_AGE column is defined as a number. The source of the data are fixed length text files. r("MAX_AGE") is defined in the class as Public MAX_AGE As Int32. But the code is taking the imported data, which came in as a number, copying it to another temporary datatable, in which all fields are strings, then inserted from that data table into the database. Is it a number? Is it a string? Is it a floor wax? Is it a dessert topping? Hard to say...
-
I've done "string_literal".ToUpper() once. It was because I was lazy, and I subsequently removed it later. :)
...but then again mine actually transformed the string.
-
-
@campkev said:
No, it would be <font size="18" face="times new roman">’’</font> .@johnt519 said:
dt2Row(4) = "99".ToUpperWould the the uppercase of "99" be "66"?
-
@campkev said:
Would the the uppercase of "99" be "66"?
No, it's "((". Like how "%" is capital "5" or ">" is capital ".".
-
@campkev said:
No. ((@johnt519 said:
dt2Row(4) = "99".ToUpperWould the the uppercase of "99" be "66"?
(to drag up stuff mentioned else-thread, and assuming a commonly used keyboard.)
-
@PJH said:
@campkev said:
No. ((@johnt519 said:
dt2Row(4) = "99".ToUpperWould the the uppercase of "99" be "66"?
No, it is )) on mine (日本) that took a while to get used to...
-
@campkev said:
Would the the uppercase of "99" be "66"?
Since a character can be upper-cased by unsetting the 6th least significant bit:
char ucase(char c) {
return c & 0xdf;
}The upper case of "99" is then obviously "\x19\x19". This displays "↓↓" on my Windows console.
-
What's up with this, do they teach students nowadays that all datatypes except "string" are evil and bad, and need to be converted to strings at the first opportunity? Exactly when did this ToString() idiocy start? I blame Java, but this evil seems to have spread to just about every language by now.
It seems to me that many of the WTF:s we see nowadays contain something along the line of "(Val( (Val(a.ToString) + Val(b.ToString)).ToString ) * Val(c.ToString)).ToString" instead of "(a+b)*c".
Can we just start a movement to stop this madness now?
-
@boh said:
How else do you propose to work with data stored only in VARCHAR(255) columns in the database?What's up with this, do they teach students nowadays that all datatypes except "string" are evil and bad, and need to be converted to strings at the first opportunity? Exactly when did this ToString() idiocy start? I blame Java, but this evil seems to have spread to just about every language by now.
It seems to me that many of the WTF:s we see nowadays contain something along the line of "(Val( (Val(a.ToString) + Val(b.ToString)).ToString ) * Val(c.ToString)).ToString" instead of "(a+b)*c".
Can we just start a movement to stop this madness now?
-
@Benanov said:
I've done "string_literal".ToUpper() once. It was because I was lazy, and I subsequently removed it later. :)
...but then again mine actually transformed the string.
In Visual Studio you can use Ctrl+Shift+U to uppercase the selected text, and Ctrl+U to lowercase it.
-
@XIU said:
In Visual Studio you can use Ctrl+Shift+U to uppercase the selected text, and Ctrl+U to lowercase it.
For the sake of sanity, I hope that's the other way around.
-
@dhromed said:
Why? You use Shift when you want uppercase and don't when you do.@XIU said:
In Visual Studio you can use Ctrl+Shift+U to uppercase the selected text, and Ctrl+U to lowercase it.
For the sake of sanity, I hope that's the other way around.
-
@bstorer said:
How else do you propose to work with data stored only in VARCHAR(255) columns in the database?
That brings back so many bad memories…
-
Ctrl-[b]U[/b] should be [b]U[/b]ppercase
Shift in a key combination often means to do the opposite, so
Ctrl-Shift-U should be Not uppercase
-
@Zecc said:
@dhromed said:
Why? You use Shift when you want uppercase and don't when you do.@XIU said:
In Visual Studio you can use Ctrl+Shift+U to uppercase the selected text, and Ctrl+U to lowercase it.
For the sake of sanity, I hope that's the other way around.
@immibis said:
Ctrl-U should be Uppercase
Shift in a key combination often means to do the opposite, so
Ctrl-Shift-U should be Not uppercase
That.
-
@immibis said:
Ctrl-U should be Uppercase
Actually, I agree. I was just providing another point of view.Shift in a key combination often means to do the opposite, so
Ctrl-Shift-U should be Not uppercase
Also, - and I know this is quite a stretch of an argument - uppercasing is probably a more frequent operation than lowercasing, and pressing Ctrl+U is easier than typing Ctrl+Shift+U.
I'd personally go for Ctrl+U and Ctrl+L, but I'm sure Ctrl+L is already bound to something else. *checks on the net* Yep, "cuts the current line".
-
@Zecc said:
I'd personally go for Ctrl+U and Ctrl+L (...)
Alt+U -> Uppercase
Alt+L -> Lowercase
Alt+C -> Capitalize first letter
-
@bannedfromcoding said:
@Zecc said:
Much better.I'd personally go for Ctrl+U and Ctrl+L (...)
Alt+U -> Uppercase
Alt+L -> Lowercase
Alt+C ->Capitalize first letterCamelCase
-
-
@bannedfromcoding said:
@bstorer said:
There's nothing 'better' about camel case.Alt+C ->
Much better.Capitalize first letterCamelCase
-
Visual Studio: 1
Sanity: 0I have created a deriative work from your original graphic (plz dont sue) because it is a rich vein of WTFs and Huhs; but I concede that those may partially or all be inspired by my almost complete lack of VS experience.
-
@boomzilla said:
It's better when you don't have to type it yourself.@bannedfromcoding said:
@bstorer said:
There's nothing 'better' about camel case.Alt+C ->
Much better.Capitalize first letterCamelCase
-
@boomzilla said:
There's nothing 'better' about camel case.
Nor_is_there_about_god_damn_under_sco_re_s_.
-
@dhromed said:
wellmaybeyoudpreferjustshovingallthewordstogether?@boomzilla said:
There's nothing 'better' about camel case.
Nor_is_there_about_god_damn_under_sco_re_s_.
-
@dhromed said:
True, except, for, you know, being able to read it easily. Or maybe you're a FORTRAN kind of guy. You have my sympathies.@boomzilla said:
There's nothing 'better' about camel case.
Nor_is_there_about_god_damn_under_sco_re_s_.
-
@dhromed said:
I concede that those may partially or all be inspired by my almost complete lack of VS experience.
Yes. It's "Ctrl+K, Ctrl+F", not just "Ctrl+F". "Ctrl+K" is a common start of key chord sequences; I remember it being used back in Borland Pascal, and I'm pretty sure Borland stole it from someone else.
As for Ctrl+μ, I don't know, that command is mapped to "Ctrl+K, Ctrl+\" in my VS. Maybe he has some kind of International English keyboard layout.
-
Yup, you'll have to press both.
But they do allow you to customize all the shortcuts, based on where you are in the editor (and got some predefined schemes including an emacs scheme).
But this screenshot is from the (Default) one.
-
@bstorer said:
How else do you propose to work with data stored only in VARCHAR(255) columns in the database?
I propose the application of a User Corrective Action Tool, or HAMMER for short, to rectify the situation where all data is stored in VARCHAR(255). I mean, if you can't be bothered to change the defaults to BLOBs, then you're getting you're just deserts ;-). Or at least make them VARCHAR2's, I mean, am I right? I thought VARCHAR2's were introduced because they were better!!!eleven!oneOk, now that that's out of my system, seriously, what's up with leaving things at the default rather than people defining a supposed max-length of a field? Sure it has it's limitations, but for instance, how many first names are more than 50* characters long in traditional cultures? Yes, there are some titles that are longer than that, but those people ususally don't use a name that long in day to day interactions. TRWTF is professionals not doing their DAMNED JOBS.
* 50 being a number != 255. We could as easily use 30, or 72, or 99.
-
@drachenstern said:
@bstorer said:
Taking your advice, I tried playing "2 Legit 2 Quit" on a continuous loop at high volume in the DBA's office. Now I not only have a database full of VARCHAR(255)s, but we have an opening for a new DBA. It seems the last one was not legit enough, and thus quit.How else do you propose to work with data stored only in VARCHAR(255) columns in the database?
I propose the application of a User Corrective Action Tool, or HAMMER for short, to rectify the situation where all data is stored in VARCHAR(255).
-
@bstorer said:
@dhromed said:
In Thai, that's actually how it is. They have very few spaces.@boomzilla said:
wellmaybeyoudpreferjustshovingallthewordstogether?There's nothing 'better' about camel case.
Nor_is_there_about_god_damn_under_sco_re_s_.
-
@bstorer said:
@drachenstern said:
Now you owe me a job, as I began cackling uncontrollably at this comment and was escorted out, then subsequently committed. You never thought your little jokes could hurt anyone, did you?@bstorer said:
Taking your advice, I tried playing "2 Legit 2 Quit" on a continuous loop at high volume in the DBA's office. Now I not only have a database full of VARCHAR(255)s, but we have an opening for a new DBA. It seems the last one was not legit enough, and thus quit.How else do you propose to work with data stored only in VARCHAR(255) columns in the database?
I propose the application of a User Corrective Action Tool, or HAMMER for short, to rectify the situation where all data is stored in VARCHAR(255).
-
@belgariontheking said:
Now you owe me a job, as I began cackling uncontrollably at this comment and was escorted out, then subsequently committed. You never thought your little jokes could hurt anyone, did you?
I'ld offer you mine, but you'ld be silly to take it. Rather, if you're trying to decide between being committed and taking mine, I would tell you take the commit.
-
@bstorer said:
@drachenstern said:
@bstorer said:
Taking your advice, I tried playing "2 Legit 2 Quit" on a continuous loop at high volume in the DBA's office. Now I not only have a database full of VARCHAR(255)s, but we have an opening for a new DBA. It seems the last one was not legit enough, and thus quit.How else do you propose to work with data stored only in VARCHAR(255) columns in the database?
I propose the application of a User Corrective Action Tool, or HAMMER for short, to rectify the situation where all data is stored in VARCHAR(255).Cannot dereference 'this'. Execution stopped.
-
@Spectre said:
Yes. It's "Ctrl+K, Ctrl+F", not just "Ctrl+F". "Ctrl+K" is a common start of key chord sequences; I remember it being used back in Borland Pascal, and I'm pretty sure Borland stole it from someone else.
I like it.
-
@dhromed said:
@Spectre said:
Yes. It's "Ctrl+K, Ctrl+F", not just "Ctrl+F". "Ctrl+K" is a common start of key chord sequences; I remember it being used back in Borland Pascal, and I'm pretty sure Borland stole it from someone else.
I like it.
WordStar?
-
@bstorer said:
@boh said:
What's up with this, do they teach students nowadays that all datatypes except "string" are evil and bad, and need to be converted to strings at the first opportunity? Exactly when did this ToString() idiocy start? I blame Java, but this evil seems to have spread to just about every language by now.
It seems to me that many of the WTF:s we see nowadays contain something along the line of "(Val( (Val(a.ToString) + Val(b.ToString)).ToString ) * Val(c.ToString)).ToString" instead of "(a+b)*c".
Can we just start a movement to stop this madness now?
I blame web developers and the endemic use of XML.