|
And he shall never return ... unless he got some burgers with him
(yes|no|maybe)*
|
|
|
|
|
Ok, you convinced me. I will do that right after work.
"I just exchanged opinions with my boss. I went in with mine and came out with his." - me, 2011
--- I am endeavoring, Madam, to construct a mnemonic memory circuit using stone knives and bearskins - Mr. Spock 1935 and me 2011
|
|
|
|
|
Probably thinks he's a data visualization expert.
"You get that on the big jobs."
|
|
|
|
|
Is the colleague actually a programmer? If so, I echo said "stunned silence".
|
|
|
|
|
So it sounds like he has effectively implemented his own array, albeit with poor choices in how to store and access the data, but I think that shows good logic. After all, he doesn't know what an array is, yet he has decided an array style function is the best approach.
He may not have the "experience" of a great developer, but being able to think for himself is a good thing. I think too many programmers are around that just do what the book says, and therefore struggle to be creative when a need arises for something that has yet to be documented.
I may or may not be responsible for my own actions
|
|
|
|
|
If the "colleague" was a high school intern who has never taken a programming class, then yes their logical abilities show promise and they could be trained. However, if this is someone with a degree in programming then they really missed some very basic stuff.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
That is a serious gap in knowledge!
Did this person graduate with a programming related degree.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
The degree bit is not relevant - I'm self-taught, but can read books too. This is really really basic.
|
|
|
|
|
Public Sub SomeMethod()
For Each da As DataRow In myTable.Rows
da(11) = i + 1
items(i) = da(0) & ":" & da(1) & ":NaN:" & da(3) & ":" & da(4) & ":" & da(5) &
":" & da(6) & ":" & da(7) & ":" & da(8) & ":" & da(9) & ":" & da(10) & ":" & da(11) & ":" & da(1)
i += 1
Next
Session("itemTable") = items
End Sub
<AjaxMethod()> _
Public Function GetSessionData(ByVal name As String) As Object
Return HttpContext.Current.Session(name)
End Function
That is some code I just came across (I took out some stuff and renamed some things to protect the innocent). That basically gets information from a DataTable by index (rather than by field name), puts it into a colon-separated-value string (some of the data items include company names and addresses, which could potentially contain colons) that is stored in an array that gets shoved into the session. There is then some JavaScript that calls the server to get that session data (or any session data a client script feels like grabbing).
Luckily, I am replacing this code entirely.
|
|
|
|
|
Let me guess. The programmer thought CSV meant "Colon Separated Values".
Any reason for "da(1)" to be included twice.
Chris Meech
I am Canadian. [heard in a local bar]
In theory there is no difference between theory and practice. In practice there is. [Yogi Berra]
posting about Crystal Reports here is like discussing gay marriage on a catholic church’s website.[Nishant Sivakumar]
|
|
|
|
|
CSV is actually a great example of how not to design a text-based data format. UNIX-style DSV is much more sane, and there colon is the default separator. So I wouldn't make fun of using colons to delimiter values, even though the rest of the code is horrible.
|
|
|
|
|
AspDotNetDev wrote: I am replacing this code entirely
Changing or replacing it is easy, but will it be an improvement?
Luc Pattyn [Forum Guidelines] [My Articles] Nil Volentibus Arduum
Please use <PRE> tags for code snippets, they preserve indentation, improve readability, and make me actually look at the code.
|
|
|
|
|
Well it doesn't get any worse than the code already is, so there's really only one direction to go. Rapture, here I come!
|
|
|
|
|
Yeah, that looks like code that should be replaced.
Sadly, I see far too much legacy code that should be replaced.
Just because the code works, it doesn't mean that it is good code.
modified on Monday, May 23, 2011 9:18 AM
|
|
|
|
|
Isn't that the definition of legacy code?
|
|
|
|
|
I cant overlook that it would have been so much easier to keep the datatable in the session rather than mangle it as a colon csv, there must have been a good reason... then again we see this stuff on DailyWTF.com all the time
|
|
|
|
|
function sleep(milliSeconds) {
var startTime = new Date().getTime();
while (new Date().getTime() < startTime + milliSeconds);
}
function verifySleep(milliSeconds) {
var startTime = new Date().getTime();
sleep(milliSeconds);
alert('blocked for ' + ((new Date().getTime()) - startTime) + ' milli seconds');
}
|
|
|
|
|
What's wrong with that? That's how scroll lock was implemented in the original PC BIOS (and no doubt a zillion clones). Back in the good ol' days, IBM actually published BIOS listings!
Cheers,
Peter
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
Presumably the intention is to suspend the thread and not hog the CPU, in which case you should use setTimeout.
|
|
|
|
|
Missed the joke icon?
Software rusts. Simon Stephenson, ca 1994.
|
|
|
|
|
yeah
|
|
|
|
|
I just got an answer[^] downvoted in Q&A because I used & instead of && in this line:
if(UsernameTextBox.Text == "Manager" & PasswordTextBox.Text == "Maintenance")
I'm still waiting for a response to my "Why?"
|
|
|
|
|
I don't know who voted you down, but there is lot of difference between using & and && in an if statement. & is a bitwise operation and && is the logical operator.
|
|
|
|
|
So, are you saying you can't use & in that case?!
They do the same except for the fact that && is short-circuited.
|
|
|
|
|
I don't know which language you are talking about, but in C#, they have different meaning, bitwise operators and logical operators are not the same. And in C# all logical operators always short-circuit.
|
|
|
|