|
I don't know what to say so :
pfft....
Rtn = ""
Rtn = Rtn & " Some text " & vbCrLf
... repeat that many times ...
Content = Rtn
MainInfo = WrapContent(Content)
Function WrapContent(connection,content)
Rtn = ""
Rtn = Rtn & ... logic for gathering more information (all in h4 tags) with vbCrLf ..
if Content > "" then
Rtn = Rtn & "" & vbCrLf
Rtn = Rtn & Content
xRtn = Rtn
Rtn = HtmlReFormat(xRtn & vbCrLf)
end if
WrapContent = Rtn
End Function
Function HtmlReFormat(Content)
Content = Replace(Content,vbCRLF,"<br>")
Content = Replace(Content," "," ")
End Function
Variable = trim(rs("some value"))
Variable = iif(Variable,"=","value","Something",Variable)
Variable = iif(Variable,"=","other value","Something",Variable)
Variable = iif(Variable,"=","yet another value","Something",Variable)
... a few more times ...
Variable = iif(Variable,"=","","Undefined",Variable)
Function IIF(sVal1, Equal, sVal2 , IfTrue, IfFalse)
dim Rtn
Equal = trim(Equal)
select case Equal
case "="
if sVal1 = sVal2 then
Rtn = IfTrue
Else
Rtn = IfFalse
End If
case "<"
if sVal1 < sVal2 then
Rtn = IfTrue
Else
Rtn = IfFalse
End If
case ">"
if sVal1 > sVal2 then
Rtn = IfTrue
Else
Rtn = IfFalse
End If
case "<="
if sVal1 <= sVal2 then
Rtn = IfTrue
Else
Rtn = IfFalse
End If
case ">="
if sVal1 >= sVal2 then
Rtn = IfTrue
Else
Rtn = IfFalse
End If
end select
IIF = Rtn
End Function
If it moves, compile it
|
|
|
|
|
Wow...
You should stick an Option Explicit in there and wait for the guy to come complaining about a bunch of compile errors that weren't there yesterday...
And I love how he defines his own "enhanced" version of IIf...
|
|
|
|
|
Have a 5 for the sheer level of involved in this.
|
|
|
|
|
I usually don't post his code on here. There are mountains of stuff in everything he touches. My first job when I got here was to learn a couple of things he was in charge of so that SOMEONE in the company would understand what the heck is going on with them.
Everything that involves him that I have to do gives me a headache. It takes me longer to read and understand what is going on with his code than it would for me to write it again from scratch.
Funny thing is, it takes him just as long to explain his code as it would me. It's faster to read it yourself than to ask him a question about it because he has to go through the same process (re-reading, trying to figure out what the heck is going on) as I do.
Really, I can't even convey what type of coding he does.
If it moves, compile it
|
|
|
|
|
loctrice wrote: Really, I can't even convey what type of coding he does.
The term "Cowboy Coding" comes to my mind. ('cause the coder rides roughshod all over the code)
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]
|
|
|
|
|
I say he's not a programmer , he's a script kiddie. He can make a computer do something given enough time, but has no place in professional code.
If it moves, compile it
|
|
|
|
|
Think I got as far as & vbCrLf before I knew it was going to be some fun.
Thanks! It certainly didn't disappoint.
|
|
|
|
|
loctrice wrote: I don't know what to say
I second that. Well... I know what to say, but there's too much and 99.999% of it is not really kid sister safe to say
"The clue train passed his station without stopping." - John Simmons / outlaw programmer
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
"Not only do you continue to babble nonsense, you can't even correctly remember the nonsense you babbled just minutes ago." - Rob Graham
|
|
|
|
|
Wow, that is some of the worst garbage code I have seen and I have seen a lot of poor code.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Trust me , this is nothing compared to his regular coding. Just a little window from what is, for him, a clean file. I just had enough of dealing with it this time and decided to post.
If it moves, compile it
|
|
|
|
|
My sympathies to you for having to put up with that nonsense.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
This guy must be brilliant if he can write that much code!
What's best about code such as this is it is really easy to maintain. Need to store anything? Just use Rtn ! Need a new variable? Name it Rtn ! Need input? Rtn ! Need output? Rtn !
Rtn , your all-round coding solution, now coming to code near you!
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
Found this in my colleagues' code today. We had a good laugh on that
\\ some code
var item = values.TryGet<ITimelineItem>(3);
var dt = (DateTime)values[0];
var tomorrow = new DateTime(2012, 4, 26);
if(item != null)
\\ some more code
|
|
|
|
|
Christian Brüggemann wrote: my colleague
You surely mean ex-colleague. By rough estimations, he should have been shot a few times
|
|
|
|
|
|
var tomorrow = new DateTime(2012, 4, 26);
Fixed the comment for you
|
|
|
|
|
Just one error I see in there...
var twentySixthAprilTwoThousandAndTwelve = new DateTime(2012, 4, 26); FTFY
It's an OO world.
public class Naerling : Lazy<Person>{
public void DoWork(){ throw new NotImplementedException(); }
}
|
|
|
|
|
When I see stuff like this I genuinely don't know whether to laugh or cry!
|
|
|
|
|
Here's one person that believes coding languages do evolve.
|
|
|
|
|
You won't believe it but I found very similar line in our code a few days ago, just the variable name was "yesterday" and it was set to May 22.
|
|
|
|
|
Humm, must be a new pattern.
Just because the code works, it doesn't mean that it is good code.
|
|
|
|
|
Or the same employee, different company.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
----
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
But, hey, it worked without errors when he wrote and debugged it on April 25th. Actually it looks like it might have been used to trigger some event on the 25th - but for only 2012? Scratch that! Why code to look for tomorrow instead of today.
I'm through trying to rationalize this. I guess I try to assume there is a reason for everything and people are better then they really are.
Hope it wasn't moved into production.
|
|
|
|
|
Simple rationale - running this on a test system and the last day that the test system has data for is 4/26. A quick change to the code for debug purposes, just make sure to roll it back before release... oops!
|
|
|
|
|
#if DEBUG
#else
#endif anyone?
public class SysAdmin : Employee
{
public override void DoWork(IWorkItem workItem)
{
if (workItem.User.Type == UserType.NoLearn){
throw new NoIWillNotFixYourComputerException(new Luser(workItem.User));
}else{
base.DoWork(workItem);
}
}
}
|
|
|
|