|
You missed a couple:
9) Undocumented
10) 100 numeric states. How do you keep track of which one does what...
No trees were harmed in the sending of this message; however, a significant number of electrons were slightly inconvenienced.
This message is made of fully recyclable Zeros and Ones
|
|
|
|
|
Other than the missing semi-colon on the first statement, that's how it should be.
|
|
|
|
|
Well I have very good idea what happened. The programmer tried to implement fall-through switch, which is not allowed in C#. When he discovered that, he decided to work around it with those goto calls.
He was either rusty on his goto or he could not figure how to "declare" a label or maybe the language he was using before did allow something similar... That's what happens when you switch languages. For a while you keep thinking in terms of the old language thus producing such jems.
|
|
|
|
|
He shoulda written it recursively
|
|
|
|
|
He should have used the for- case pattern
|
|
|
|
|
Could easily be c++ -> C# .
But still, this isn't nice in C++ as well.
You have the thought that modern physics just relay on assumptions, that somehow depends on a smile of a cat, which isn’t there.( Albert Einstein)
|
|
|
|
|
OriginalGriff wrote: Fortran programmer.
Hehe, he is still alive!
|
|
|
|
|
state=1<br />
for (int n = state; n<101;n++)<br />
{<br />
switch (n)<br />
{<br />
case 1:<br />
<br />
case 2:<br />
<br />
<br />
case 3: <br />
<br />
............<br />
<br />
<br />
case 100:<br />
<br />
<br />
}<br />
}
What could be easier than that
|
|
|
|
|
If the syntax is correctet, the compiler doesn't complain...
thank you for teaching me that -
int state=1;
switch (state)
{
case 1:
goto case 2;
case 2:
goto case 3;
case 3:
goto case 4;
case 4:
break;
}
|
|
|
|
|
I'm still in favor of
which compiles just fine.
Luc Pattyn [Forum Guidelines] [My Articles]
The quality and detail of your question reflects on the effectiveness of the help you are likely to get.
Show formatted code inside PRE tags, and give clear symptoms when describing a problem.
|
|
|
|
|
Whatever he was trying to do, It results in what Luc has written.
Ultimately, he ended up getting the same result with extra lines of code.
|
|
|
|
|
looooool - OMFG, took me a few minutes before I could type again after reading this - ROFL!!!
GSoC 2009 student for SMW!
---
My little forums: http://code.bn2vs.com
---
70 72 6F 67 72 61 6D 6D 69 6E 67 20 34 20 6C 69 66 65!
|
|
|
|
|
Shite!
Sometimes while reading the programming forums, I just feel like jabbing a fork into my eyes.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
I guess the programmer of the snippet below found a function to fill a DropDownList and adjusted it just enough to fill a TextBox...
Private Sub ShowName(ByVal id As String)
Dim daNames As New SqlDataAdapter("SELECT ID, NAME FROM TBL_NAMES", ConnectionString)
Dim dsNames As New DataSet("NAMES")
daNames.Fill(dsNames, "NAMES")
Dim drNames As DataRow = dsNames.Tables(0).NewRow
drNames("ID") = -1
drNames("NAME") = ""
dsNames.Tables(0).Rows.InsertAt(drNames, 0)
If dsNames.Tables("NAMES").Rows.Count > 0 Then
Try
Dim drs() As DataRow = dsNames.Tables(0).Select("ID = " & id)
txtName.Text = drs(0).Item("NAME").ToString
Catch e As Exception
'
End Try
Else
txtName.Text = ""
End If
End Sub
|
|
|
|
|
DataAdapter and DataSet are so powerful they can be used to do anything... poorly.
|
|
|
|
|
Cool! Can i quote that?
I had a boss who used those as his all powerful silver bullet, and many a wtf ensued.
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
|
#if (LIBRARYFLAG)
using Product.Client;
#else
using Product.Server;
#endif
using Product.Server;
To explain - we have the same services defined in Client and Server - this is using WCF. For development we set off LibraryFlag so use the services directly - without using WCF (it is faster and makes debugging easier)
Of course, if you create a new service, then dont create the client service, and set LIBRARYFLAG, resharper pops up a "Press alt-enter to add the 'using'" message.
I musta pressed it - so now it adds the using for the Server version.
Ohh it took me a while to spot what was happening!
___________________________________________
.\\axxx
(That's an 'M')
|
|
|
|
|
There are more #if #endif -related ReSharper bugs. Here is one of them which I spotted some time ago:
I you'd enable generating XML documentation in your project settings, you will get warnings in every place where you didn't make documentation. So far so good. However, once upon a time I wanted to have a different description for debugging and realase builds.
#if DEBUG
#else
#endif
public class Damage : Occurance
C# compiler wasn't complaing, but ReSharper wanted me to add another summary.
Greetings - Jacek Gajek
|
|
|
|
|
Found in a stored procedure...
Declare @IsClosed bit
SET @IsClosed = (SELECT ISNULL(Closed,0)
FROM TimeRegHeader
WHERE TSID = @TSID)
If @IsClosed Is Null
BEGIN
Select 0
END
else
BEGIN
Select @IsClosed
END
|
|
|
|
|
Well, you really have to be sure about these things!!
|
|
|
|
|
Arnaud Lhopiteau wrote: ISNULL(Closed,0)
belts...
Arnaud Lhopiteau wrote: If @IsClosed Is Null
and braces.
What more do you want?
Panic, Chaos, Destruction.
My work here is done.
|
|
|
|
|
|
Hardly a Coding Horror. An inefficient process to be sure, but not a horror.
* Sensible Function names
* Sensible Method Sizes
* Sensible Variable Declarations
* Clear Intent
-------------------------------
Carrier Bags - 21st Century Tumbleweed.
|
|
|
|
|
' MAIN()
'
' Entry point. No more PPd. & Add. (^800 = 5)
'
'^:MAIN
MAIN:
'^PR^! Retract form in printer.
PRINT CMD("PR");
'^PL66^! Set line count to 66 for this form.
PRINT CMD("PL66");
'^PN^! Normal print mode on.
PRINT CMD("PN")
'^:GET.TERMS
GET.TERMS:
'^?"BOL ENTER TERMS (1 - 4): 1. PREPAID 2. COLLECT 3. 3RD PARTY 4. COD"1"1""%d"800
'A%=VAL(INPUTBOX$("BOL ENTER TERMS (1 - 4): 1. PREPAID 2. COLLECT 3. 3RD PARTY 4.COD",1,"1"))
A%=3
'^OC(^800 < 1)(^GT GET.TERMS)
'^OC(^800 > 4)(^GT GET.TERMS)
IF (A%<1) OR (A%>4) THEN GOTO GET.TERMS
'^H
'
' Goto line 2
'^G2
PRINT CMD("G4");
'
' DATE, ORIGIN, DESTINATION
'
PRINT CMD("C50");CMD("D");STRING$(4," "); K$ ; STRING$(6," "); STRJUST$(FLD(14,0),3,"L"," ")
'GOTO ENDING
'
' Skip a line
'
PRINT
'PRINT
'
' Shippers acct Number
PRINT STRING$(20," "); L$
'
'
PRINT
PRINT
'
PRINT STRING$(2," "); CMD("YL");CMD("7");CMD("YB")
PRINT STRING$(2," "); CMD("YL");CMD("8");CMD("YB")
PRINT STRING$(2," "); CMD("YL");CMD("9");CMD("YB"); STRING$(32," "); CMD("PB"); "HAWB#: ";STRJUST$(FLD(10,0),18, "L", " ");CMD("Pb")
PRINT STRING$(2," "); " "
'
PRINT STRING$(2," "); " ";STRING$(20," "); M$
PRINT STRING$(2," ");STRIP$(FLD(40,0),"C", " ")
'
'
'Skip 4 lines
'
PRINT
PRINT
PRINT
PRINT
'
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("2"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("3"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("4"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("14"),"C"," ");CMD("YB")
'PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("5"),"C"," ");", ";STRIP$(CMD("6"),"C"," ");" ";STRIP$(CMD("7"),"C"," ");CMD("YB")
PRINT STRING$(2," ");CMD("YL");STRIP$(CMD("5"),"C"," ");CMD("YB")
'PRINT
PRINT STRING$(2," ");CMD("YL");STRJUST$(FLD(10,2),18,"L"," ");CMD("YB"); STRING$(2," "); STRIP$(FLD(8,2),"C"," ")
'PRINT STRING$(2," ");
' PO (13chars) / BOL #
PRINT STRING$(2," ");STRJUST$(FLD(40,0),20,"L"," "); STRING$(1," "); STRJUST$(FLD(9,0), 16, "L"," ");
'PRINT STRING$(2," ");STRJUST$(FLD(9,0),13,"L"," "); STRING$(1," "); STRJUST$(FLD(2,0), 16, "L"," ")
'
|
|
|
|
|