Hey, take it easy! I was just posting another horror ;P
adgonz
Posts
-
Encoding IP addresses -
Encoding IP addressesEasy to fix. You can use the code we use at our company to convert floats between european/american decimals notation:
Function CAMBIADECIMAL(ByVal NUMERO As String, ByVal TIPO As Integer) As String Dim I As Integer Dim J As Integer Dim ss As String Dim ss1 As String Dim PARTE1 As String Dim PARTE2 As String Select Case TIPO Case 1 ss = NUMERO I = ss.IndexOf(".") If I > 0 Then J = ss.Length - I - 1 PARTE1 = ss.Substring(0, I) PARTE2 = ss.Substring(I + 1, J) ss1 = PARTE1 + "," + PARTE2 Return (ss1) End If Return ss Case 2 ss = NUMERO I = ss.IndexOf(",") If I > 0 Then J = ss.Length - I - 1 PARTE1 = ss.Substring(0, I) PARTE2 = ss.Substring(I + 1, J) ss1 = PARTE1 + "." + PARTE2 Return (ss1) End If Return ss End Select End Function
-
GIJOTDIt's a 'Little Man of the Road' joke?
-
Windows 95 - 98?Maybe it works under linux: http://www.sane-project.org/[^]
-
Disable FF "Additional plugins are needed..." banner?about:config plugins.hide_infobar_for_missing_plugin
-
Differences between vb.net and c#Question:
PIEBALDconsult wrote:
!= == <> ?
Answer: != == Not Nullable.Equals(,)
-
Differences between vb.net and c#<> is (I used to think it was) to vb.net the same as != to C#
-
Differences between vb.net and c#The thing is that vb.net evaluates the comparison to
Nothing
when one of the operands isNothing
. And something like:If Nothing Then
End If
Is valid, even if you specify
Option Strict On
-
Differences between vb.net and c#cjb110 wrote:
does the situation change if both comparisons are != or <>?
Sorry, don't understand your question. Can you explain?
-
Differences between vb.net and c#Do you think this two pieces of code are the same? C#
private string f() { System.Nullable<System.Int32> a = null; System.Nullable<System.Int32> b = 7; if (a != b) { return "apple"; } else { return "orange"; } }
Function f() As String Dim a As System.Nullable(Of System.Int32) = Nothing Dim b As System.Nullable(Of System.Int32) = 7 If a <> b Then Return "apple" Else Return "orange" End If End Function
-
How to know if a column of type int is Identity using ADO.NET GetSchema()?Thanks! I have just found another way:
select COLUMNPROPERTY(OBJECT_ID('Table name'), COLUMN_NAME, 'IsIdentity') as IS_IDENTITY from INFORMATION_SCHEMA.COLUMNS
I'd prefer to use GetSchema(), but for now I'm using this. -
How to know if a column of type int is Identity using ADO.NET GetSchema()?I can't figure it using the data GetSchema() returns. Is there something I don't see? Is there any other way? Thanks! Edit: I'm using SQL Server 2008 and SQLConnection
-
Visual Studio autogenerated codePIEBALDconsult wrote:
You would delete the auto-generated code anyway wouldn't you? Actually isn't there a file (or files) that contain such things and you can change them there?
Of course, I can change the code, the same way you would change the code on all the horrors published here. Isn't this forum to publish horrors you find over there? I think this is a reply horror. :laugh:
-
Visual Studio autogenerated codeMegidolaon wrote:
If the user presses multiple directions
Then multiple events are fired.
-
Visual Studio autogenerated codeIt's not a big horror, its just funny to see it on Visual Studio. The correct implementation would be:
private void Form1\_KeyDown(object sender, KeyEventArgs e) { switch(e.KeyCode) { case System.Windows.Forms.Keys.Up: // Subir oscilador // Subir break; case System.Windows.Forms.Keys.Down: // Bajar oscilador // Bajar break; case System.Windows.Forms.Keys.Left: // Izquierda break; case System.Windows.Forms.Keys.Right: // Derecha break; case System.Windows.Forms.Keys.Enter: // Entrar break; } }
-
Visual Studio autogenerated codeThis is the base code vs generates to check for special keys, on a Smart Device project:
private void Form1\_KeyDown(object sender, KeyEventArgs e) { if ((e.KeyCode == System.Windows.Forms.Keys.Up)) { // Subir oscilador // Subir } if ((e.KeyCode == System.Windows.Forms.Keys.Down)) { // Bajar oscilador // Bajar } if ((e.KeyCode == System.Windows.Forms.Keys.Left)) { // Izquierda } if ((e.KeyCode == System.Windows.Forms.Keys.Right)) { // Derecha } if ((e.KeyCode == System.Windows.Forms.Keys.Enter)) { // Entrar } }
A Pocket PC is full of power, so let's check for every possible key.
-
5 in a 1 to 10 rangeIan Shlasko wrote:
Translation: Post one of the 10's! Heheh
A 6 or 7 (I'm not sure) is this code is from a function that should never had been called / written, so your better implementation is useless.
-
5 in a 1 to 10 rangeIf the worst horror you could find in my company is ranked 10 and a moderate horror is ranked 1, I think I could rank this with 5:
Dim key As String key= "N" key= "linatipedi=" + "'" + key+ "'" Dim rR As DataRow() = t.Select(key) If rR.Length() = 0 Then i = 0 Else Try For Each r In rR i += 1 Next r Catch If i = 0 Then Return True Else Return False End If End Try End If If i = 0 Then Return True Else Return False End If
-
How to detect invalid image in a ImageBrushHi, this is what I did, but there are still some problems: - The file could exists, but be a invalid image. - The file exists at the moment this code executes, but it is deleted before the Brush needs it (this can happen on my application). Thanks.
-
How to detect invalid image in a ImageBrushHi, Thanks, but it seems that this event is not fired (because of local file?) I also tried DecodeFailed, but neither is fired.