Why to complain, at least the errors are handled!
Posts made by sirhegel
-
RE: Who said VB coders are careless?
-
RE: BlnEvtName = blnEvtName == false? true : false;
>I think it might indicate if another variable contains the name of an event or of something else.
This might indeed be the case. This is actually a brilliant idea; you do not have to explicitely define variable types, plus you can use less variables. You can define all variables as objects and use booleans, enums etc. to indicate what the variables will contain. This way you can even change the very purpose of any variable in run-time.
For example;
'Note that you do not have to define variable type, which is usually a PITA
Dim objValue
'Do not define variable type, since these variables can be reused somewhere else as some other data type
Dim blnObjValueContainsCustomerName = True
Dim blnObjValueContainsExcelApplication = False'Somewhere deep in the code where no man has gone before
If blnObjValueContainsCustomerName = True Then
txtCustomerName.Text = objValue.ToString
Else
If blnObjValueContainsExcelApplication = True Then
'Note that in this case the blnObjValueContainsCustomerName variable contains the worksheet object
blnObjValueContainsCustomerName.Save
blnObjValueContainsCustomerName.Close
objValue.Quit
End If
End If
-
RE: Dynamic Fusebox
What about this page? http://www.dynamicfusebox.com/future_rockstar.html
The "false latin" is excerpt from Lorem Ipsum.
-
RE: Paula's heritage
@ammoQ said:
In German (Voigtländer was founded in Vienna), "Brillant" means some kind of diamond (I think the english word for it is "brilliant cut")
Uhmmm... Well, what do you think "Brilliant" means in English, then? Why would anything be called brilliant, such as Paula Beans?
-
RE: Magic numbers, strings and exceptions
Instead of magic numbers the author should obviously have used an application setting to make sure that the application can easily be customized to be used on another planets and celestial objects.
-
RE: A huge collection of VB6 WTF's (Warning: Long post!)
@Treeki said:
@Ice^^Heat said:
What is the advantage of VB6 over VB.NET?
As far as I can see, nothing. I've tried VB2005, and immediately gave up. I'm not about to rewrite over half of my project just for the so-called advantages of .NET. I'm familiar with VB6, it works fine for me, and I ran into many problems when I tried to convert my program.
Have you ever heard about so-called object-oriented programming?
I would never ever return back to VB6, but unfortunately I still have to maintain my old VB6 applications and that is a true P.I.T.A.
-
RE: War on right clickers, tides have turned!
I don't get the point of this product. You could always hit ALT-PntsScrn, paste the image of the page to Word, print the word document, tape the document to a wooden table, flip the table over, put it on a scanner, scan the page and finally run it through OCR software to steal the text. No nerdy guru skills required.
-
RE: Is it Intellisense-abuse?
There is yet another good reason for referring to String.Empty instead of "". Whoever knows if Microsoft decides to change the very definition of an empty string in the future? Or if the empty string may be platform- or culture-specific. ;-)
-
RE: Visualize A Stable IDE
@djork said:
He's actually not the only one who sees VB in that light. sirhegel should have said "background compilation" instead of "syntax highlighting" though, but I think we all get the point.
http://www.codinghorror.com/blog/archives/000860.html
Great article, that was just exactly what I ment; sorry for mixing these (indeed obviously different) terms.
-
RE: Game Loops
@GettinSadda said:
Really?
Maybe you did not read the original post:
"forever loops are useful only when you have another loop that is nested between it"
-
RE: Visualize A Stable IDE
@merreborn said:
That's one of the worst reasons to pick a language I've ever heard. There are good reasons to pick VB (namely, knocking out a simple windows UI-heavy app in no time), but "It has good syntax highlighting"? If your editor doesn't have good syntax highlighting for a language, you pick a new editor, not a new language.
Silly response IMHO; I did not choose VB because "it has good syntax highlighting". Instead I did not switch to C# because I found the IntelliSense to be buggier in C#. The reason I code mostly in VB.Net is simply because I have been programming in VB6. If you look at .NET framework more closely, there is quite few practical differences beetween programming in C# of VB.Net. Of course the syntax is different and a good reason for many nearly religional opinions, but the framework and OO stuff is the same. Try using eg. .NET reflector, you can decompile the IL code to either C# or VB.Net and compile it back to fully functional application, so there is (almost) no practical difference beetween them. Just opinions, I.M.H.O.
-
RE: Is it Intellisense-abuse?
Hard coding values, such as strings, should be avoided as far as possible, and IntelliSense helps to type in values quickly! How about this example:
Public Enum FirstName
John
Dick
Elaine
End Enum
Public Enum LastName
Harrison
Smith
Ivanovich
End Enum
Public Function GetFirstName(ByVal Name As FirstName) As String
Return Name.ToString
End Function
Public Function GetLastName(ByVal Name As LastName) As String
Return Name.ToString
End Function
Sub Main()
Console.WriteLine("My name is " & GetFirstName(FirstName.Dick) & " and my last name is " & GetLastName(LastName.Harrison))
End Sub
-
RE: MSXML WTF & lot's of head banging against wall
@asuffield said:
@Jeff S said:
Do we really need more "M$ suckz, dude!" jokes?
I think that you do not understand the purpose of this site. With proper spelling and grammar, yes, we do. It's why we're here.
<emotion type="sarcasm" level="novice" intention="humorous">Maybe we should encourage each other to use specific tags to indicate the intended emotional content of the written text, just to help people with no sense of humour.</emotion>
-
RE: Visualize A Stable IDE
I have been considering to switch from Vb.Net to C#, but one of the main reasons to stay in VB is that the syntax higlighting actually works quite well in VB. I am very happy to see typing and programming errors realtime. In C# it sucks, you have to rebuild to see if something is wrong in your code. Well, that's how things have usually been in the past, but I like the way how Visual Studio does syntax check realtime in the background, it just makes things more fluent. I wonder why it works well only in VB?
-
RE: MSXML WTF & lot's of head banging against wall
>If you are a newbie, blah blah..
I am shocked, I thought that this site and these anecdotes written here are ment to be humorous and thus amuse the readers. I am sorry if I have misunderstood. I am very sorry if I spoiled your day by writing a Daily WTF post which did not fill your WTFiness criteria.
>Don't be a sheepDon't be a donkey, go learn some sense of humour, jackass.
The real WTF in this topic seems to be how seriously these WTF's can be taken.-h-
-
RE: MSXML WTF & lot's of head banging against wall
>Sorry, much as I'd love to blame MickeySoft, it's you.
Of course it was, and it was just a mouse click away to STFG how to fix this. The point was just that it was just quite unintuitive; I may be still a newbie but I would expect that such a simple stylesheet would pass through as-is.
-
MSXML WTF & lot's of head banging against wall
Ouch, my forehad... 'been banging my head against solid brick wall for couple of hours for now. I am writing an application to our customer to integrate several systems together. My application collects data to internal XML document and uses XSLT transform to send it to another application. Works well, so far so good.
I realized that I could transform the internal XML document to some user-friendly format - such as XHTML to be viewed direcly in web browser. Well, that's what XSLT is ment to be used, so this should be a quite easy task. I created a very simple stylesheet:
<?xml version="1.0" encoding="iso-8859-1" ?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
<xsl:template match="/">
<html>
<head>
<title>Summary</title>
</head>
<body>
<xsl:apply-templates/>
</body>
</html>
</xsl:template>
<xsl:template match="RootElement">
<p>foo</p>
</xsl:template>
</xsl:stylesheet>
Then I wrote a very simple piece of code to transform the internal XML to HTML by using TransformNodeToObject method:blah blah...
Dim summaryDocument
Set summaryDocument = CreateObject("Msxml2.DOMDocument")
Dim summaryStylesheet
Set summaryStylesheet = CreateObject("Msxml2.DOMDocument")
summaryStylesheet.load stylesheetPath & summaryStylesheetName
intermediateXMLDocument.transformNodeToObject summaryStylesheet, summaryDocument
summaryDocument.save summaryFolderPath & summaryFileNameI know, I know, the real WTF is that this is actually VBSript code (!) so no need to mention it, but anyway... For couple of hours I have been trying to find out why the XSLT transform fails and the resulting HTML file is empty. Trying to figure out row by row and character by character what is wron in the code and the stylesheet (which does not even do any formatting to actual data etc.).
Finally I was able to find out, that in the extremely complex XSLT transform mentioned above, the following stylesheet source
<head>
<title>Summary</title>
</head>transforms into
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-16">
<title>Summary</title>
</head>in the result document, which is not valid XML since the tag is not closed. Therefore it causes a parse error and I get an empty result. Simple enough.
But hey, WTF - where did that META tag come from? Apparently Mycro$oft XML parser uses some clever internal heuristics (maybe Office Assistant) to help me output "proper" html. "It seems that you are trying to output HTML data. Perhaps you would like to include some extra tags in your source? How about some META ones?" Whoops, it's not valid xml anymore, but who cares.
-
RE: Really platform-independent code...
There seems to be a WTF.GetInnerWTF() in the code; the carefully constructed string variable s is not used, but instead the command string re-constructed in runtime.exec function call.
-
RE: Newbie Modulus Animation WTF
I found it particulary astonishing, how the computationally expensive modulus operation was replaced with much faster manually calculated value, which undoubtedly gives a huge increase in performance. This algorithm can be used easily in similar cases, such as if some task has to be executed every third day of a year, you just have to add more cases.
-
Newbie Modulus Animation WTF
I found the following awesome algorithm in one of our products. The code was written by a newbie, and since it "works", it is not a true WTF, just a funny over-complex solution to simple problem.
Imagine you have a long running application. Could it be nice to indicate the end user somehow that the application has not crashed, but is still actually doing something? Wo-hoo, got an idea, you could run an ASCII animation of some sort in the status bar! That can be easily accomplished by a neat function, like following (feel free to use it in your own software!):
Public Shared Tim As Date
Public Shared ApplicationIsRunning = True
Private Sub StatusRunningText(ByVal Str As String)
If ApplicationIsRunning = True Then
Select Case Me.Tim.Now.Second
Case 0, 3, 6, 9, 12, 16, 19, 21, 24, 27, 30, 33, 36, 39, 42, 45, 48, 51, 54, 57, 59
Me.StatusBarPanel1.Text = Str + "."
Case 1, 4, 7, 10, 13, 17, 20, 22, 25, 28, 31, 34, 37, 40, 43, 46, 49, 52, 55, 58
Me.StatusBarPanel1.Text = Str + ".."
Case Else
Me.StatusBarPanel1.Text = Str + "..."
End Select
End If
End Sub
Note the ingenious fact, that the (global!) Tim variable has to be updated and this method has to be called repeatedly by some other routine to actually see some animation.
-
RE: MOSS 2007 Checkout
@Albatross said:
Heh. Reminds me of VB6's similar error: When you tried to execute
Dim SomeThing As AnObject
SomeThing = New AnObjectIt would tell you that "Object variable or with block not set", meaning that SomeThing = Nothing. Well of course it does! That's why I'm setting it to a New AnObject!
This is a WTF only until you know that there is something called "Default Property" in VB6. Practically what happens is that VB is trying to call AnObject.[Default] (or whatever) method, since you have forgot to use Set keyword.
This causes indeed lots of head banging if you have to write both vb6 & vb.net, since in .net you do not have to Set object variables.