|
As mentioned, this is the wrong forum. However, since this is one of the few times I've seen somebody post about Umbraco here, you may want to check out my article: Umbrazure: Limitless Websites with Umbraco on Azure. Also, I created a thread in case anybody wants to ask me Umbraco questions.
|
|
|
|
|
While converting old FoxPro project to new .NET solution.. This is what I am putting up with...
IF printer_type = 1 then
* ELECTRIC LABEL
IF ALLTRIM(lin_array(2)) = "ENVIRO" then
DO eleclabv4
ELSE
DO eleclabv1
ENDIF
* label form testlab noconsole TO PRINTER
ELSE
IF printer_type = 2 then
* GAS LABEL
DO gaslabv1
ELSE
IF printer_type = 3 then
SET FILTER TO dpl.dpl_part = "50V136G" && need to trick the label printing routine to see 1 record to print .. enamel chain items don't have any records in the datplate (dpl) file, therefore nothing will print if we don't trick the program
DO echnlabv1
ELSE
IF printer_type = 4 then
DO gaslabv2
ELSE
IF printer_type = 5 then
*Sunpro gas
DO gaslabv3
ELSE
IF printer_type = 6 then
*Sunpro electric
DO gaslabv3
ELSE
IF printer_type = 7 then
* Titan
DO eleclabv2
ELSE
IF printer_type = 8 then
* Centaur
DO eleclabv3
ELSE
IF printer_type = 9 then
* GEneric label
DO genlabelele
ELSE
IF printer_type = 10 then
* GEneric label
DO genlabelgas
ELSE
IF printer_type = 11 then
* Revision D Electric label
DO genlabeleleRevD
ELSE
IF printer_type = 12 then
* Revision D Electric label
DO genlabelgasRevD
ELSE
IF printer_type = 13 then
* Revision D Electric label
DO conergyelec
ELSE
IF printer_type = 15 then
* Therman electric label
DO genlabeleleThermann
ELSE
IF printer_type = 16 then
* Therman electric label
DO genlabeleleChina2
ELSE
IF printer_type = 17 then
* H4047 A version label
DO eleclabv5
endif
endif
endif
endif
endif
endif
endif
endif
endif
endif
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
ENDIF
Zen and the art of software maintenance : rm -rf *
Math is like love : a simple idea but it can get complicated.
|
|
|
|
|
Hey, at least they tabbed it in nicely for you!!
|
|
|
|
|
give me the blue pill!!!
you want something inspirational??
|
|
|
|
|
Apparently he had no idea what DO CASE ENDCASE was, unless I'm not reading it right and it really does need to be nested...
|
|
|
|
|
I hath been through it, it can be a simple CASE block.
Reality is an illusion caused by a lack of alcohol
"Nagy, you have won the internets." - Keith Barrow
|
|
|
|
|
Agree!!!
|
|
|
|
|
Looks like a fallen tree..
The signature is in building process.. Please wait...
|
|
|
|
|
that code sure is a pain in a neck
What???
|
|
|
|
|
"Zen and the art of software maintenance : rm -rf * " - The best maintenance ever
|
|
|
|
|
I think you shouldn't change this code...
You could angry the titans and centaurs who can ignite some gas using an electric cable. You will end up with a label with a printed "ownd by Therman, the undead coder".
I warned you, mortal.
Greetings - Jacek
|
|
|
|
|
At least it works. I once had to rewrite an entire module because it contained more nesting than the Microsoft C 5.1 compiler could handle.
Hooray for greenbar tractor feed paper and multiple colored pens.
Oh yeah, that code had Goto's in it. Not only the normal backwards ones, but forward ones too.
|
|
|
|
|
Dim strBrowser As String = Request.Browser.Browser.ToString()
Dim strBroswerVersion As String = Request.Browser.Version.ToString()
If strBrowser.ToString() = "IE" Then
If IsNumeric(strBroswerVersion.ToString()) Then
If strBroswerVersion < 9 Then
End If
End If
End If
While fixing compiler errors after enabling option strict, I have come across a prodigious level of crap. I can't post it all, but this one stood out for being crap on almost every level imaginable. Here are a few notes off the top of my head:
- Generally, you should avoid checking browser versions, especially in server-side code (I believe the reasoning is that older browsers are slower, so some value was changed).
- Compilation breaks when trying to compare a string against a number.
- Anything this would have done has been commented out, so it does nothing.
- Calling ToString on a string (which I think might even throw a null reference exception if the original string is null)... four times.
- Comparing strings without ignoring case.
- The commented out code (not shown) would have caused a compiler error too (attempt to divide a string by a number).
- Hungarian notation.
Can I cry yet?
|
|
|
|
|
And to top it all off, someone wrote it in VB!
|
|
|
|
|
AspDotNetDev wrote: If strBroswerVersion < 9 Then
Man i cant imagine anything which has to be done in order to see something working as it should be on IE
|
|
|
|
|
You should see some of the crap *wonderful* third-party VB code I've been asked to help with!
Here's a typical example:
Public Shared Function GetBitNr(ByVal TestInteger As Integer, ByVal Nr As Integer) As Integer
If TestInteger < 0 Then
If Nr = 32 Then
Return 1
End If
TestInteger = TestInteger + CInt(&H80000000)
End If
Dim i As Long = 30
Dim str As String = ""
Do While (i > -1)
If 2 ^ i <= TestInteger Then
str = str & "1"
TestInteger = CInt(Math.Round(TestInteger - 2 ^ i))
ElseIf Left(str, 1) = "1" Then
str = str & "0"
End If
i = i - 1
Loop
Dim result As Integer
If Len(str) >= Nr Then
result = CInt(Mid(str, Len(str) - Nr + 1, 1))
Else
result = 0
End If
Return CInt(result)
End Function
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Richard Deeming wrote: CInt(&H80000000)
Probably i should not ask but from pure curiosity: What is this ?
|
|
|
|
|
&H is VB prefix for Hex constant: so &H100 is 256, &H200 is 512, and so forth.
So it's converting a 32 bit hexadecimal integer constant value to a 32 bit integer value...
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
But if this is a signed integer, wouldn't it just add -1 to the input instead of turning the sign around? Or is Cint() a conversion to unsigned int?
Also converting the whole number when you only need one bit, thats "just great".
|
|
|
|
|
Well - no. What it will do is throw an OverflowException "Value was either too large or too small for an Int32." when you try to do the convert in the C# version, or "Arithmetic operation resulted in an overflow." when you add the two together in the VB...
The universe is composed of electrons, neutrons, protons and......morons. (ThePhantomUpvoter)
|
|
|
|
|
Not to mention converting the string manually instead of using Convert.ToString(TestInteger, 2)[^].
Or concatenating up to 31 strings during the conversion.
Or extracting a single character as a string instead of a character.
Or using CInt when you know it will be either "0" or "1" .
Or even the fact that the whole method could be replaced with:
Return If(TestInteger And (2 ^ (Nr - 1)) = 0, 0, 1)
And as for the fact that the function was only ever called with a single value of Nr , so that all the calls could be replaced with:
If (someValue And 64) <> 0 Then
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
Now I see the point of lessons on Assembler... One of the first tasks was to "convert a decimal number to a binary representation and output to the console". If you have to write something in ASM, you desperately look for a smallest an easiest solution possible. Everybody should have such lessons. It teaches how the computer arithmetic works better than a houndred of calculus lectures.
Greetings - Jacek
|
|
|
|
|
Hehe finally i made my way to The Weird and The Wonderful. Enjoy!
I am sitting here writing some vc++ code cloning some Dom nodes with MSXML and cloneNode(VARIANT_BOOL deep) and i noticed that the deep cloning isn't working. After some googling i found this gem
typedef short VARIANT_BOOL;
#define VARIANT_TRUE ((VARIANT_BOOL)-1)
#define VARIANT_FALSE ((VARIANT_BOOL)0)
with this explanation "This was developed by the Visual Basic folks" Clickety
Microsoft... the only place where VARIANT_TRUE != true
Thank you Visual Basic Team.
|
|
|
|
|
Welcome to W & W
http://authenticcode.com
|
|
|
|
|
This isn't a Microsoft thing. BASIC is the issue. non-zero = TRUE.
But it's still idiotic, and yet another reason to avoid lecacy crap such as BASIC.
|
|
|
|