1. VisualBasic / Говнокод #2290

    −135.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    Module Module1
    
        Private Const VK_ENTER As UInt32 = &HD
        Private Const KEYEVENTF_KEYUP As UInt32 = &H2
        Declare Auto Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
        Declare Auto Sub Sleep Lib "kernel32" Alias "Sleep" (ByVal dwMilliseconds As Long)
        Declare Auto Sub keybd_event Lib "user32.dll" (ByVal bVk As Byte, ByVal bScan As Byte, ByVal dwFlags As Long, ByVal dwExtraInfo As Long)
    
    
        Sub Main()
            Console.Title = "AntiPornoAd"
            Console.Write("Подключение к серверу для загрузки списка запрещенных сайтов.")
            Sleep(500)
            Console.Write(".")
            Sleep(500)
            Console.Write(".")
            Sleep(500)
            Console.Write(".")
            Sleep(500)
            Console.Write(".")
            Sleep(500)
            Console.Write(".")
            Sleep(500)
            Console.WriteLine("")
            Console.Title = "Попытка сбора данных об ошибке..."
            Console.WriteLine("По неизвестной причине произошла ошибка в программе")
            Console.WriteLine("Начался сбор данных об ошибке")
            Console.WriteLine("Пожалуйста не закрывайте программу до завершения")
            Dim key As Integer
            Do While True
                key = GetAsyncKeyState(2)
                If key <> 0 Then
                    Sleep(90)
                    keybd_event(VK_ENTER, 0, 0, 0)
                    keybd_event(VK_ENTER, 0, KEYEVENTF_KEYUP, 0)
                    Sleep(50)
                End If
    
            Loop
        End Sub
    End Module

    Попробуйте запустить на компе подруги - масса эмоций гарантирована
    (не будет работать правая кнопка мыши :))

    x0wl, 16 Декабря 2009

    Комментарии (6)
  2. VisualBasic / Говнокод #2189

    −124.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    Function DosToKoi ( TextBlock )
    	FOR TXB = 1 TO LEN( TextBlock )
    		Select Case Asc( Mid( TextBlock, TXB, 1 ) )
    			Case 192 DosToKoi = DosToKoi & Chr(225)
    			Case 193 DosToKoi = DosToKoi & Chr(226)
    			Case 194 DosToKoi = DosToKoi & Chr(247)
    			Case 195 DosToKoi = DosToKoi & Chr(231)
    			Case 196 DosToKoi = DosToKoi & Chr(228)
    			Case 197 DosToKoi = DosToKoi & Chr(229)
    			Case 168 DosToKoi = DosToKoi & Chr(179)
    			Case 198 DosToKoi = DosToKoi & Chr(246)
    			Case 199 DosToKoi = DosToKoi & Chr(250)
    			Case 200 DosToKoi = DosToKoi & Chr(233)
    			Case 201 DosToKoi = DosToKoi & Chr(234)
    			Case 202 DosToKoi = DosToKoi & Chr(235)
    			Case 203 DosToKoi = DosToKoi & Chr(236)
    			Case 204 DosToKoi = DosToKoi & Chr(237)
    			Case 205 DosToKoi = DosToKoi & Chr(238)
    			Case 206 DosToKoi = DosToKoi & Chr(239)
    			Case 207 DosToKoi = DosToKoi & Chr(240)
    			Case 208 DosToKoi = DosToKoi & Chr(242)
    			Case 209 DosToKoi = DosToKoi & Chr(243)
    			Case 210 DosToKoi = DosToKoi & Chr(244)
    			Case 211 DosToKoi = DosToKoi & Chr(245)
    			Case 212 DosToKoi = DosToKoi & Chr(230)
    			Case 213 DosToKoi = DosToKoi & Chr(232)
    			Case 214 DosToKoi = DosToKoi & Chr(227)
    			Case 215 DosToKoi = DosToKoi & Chr(254)
    			Case 216 DosToKoi = DosToKoi & Chr(251)
    			Case 217 DosToKoi = DosToKoi & Chr(253)
    			Case 220 DosToKoi = DosToKoi & Chr(248)
    			Case 219 DosToKoi = DosToKoi & Chr(249)
    			Case 218 DosToKoi = DosToKoi & Chr(255)
    			Case 221 DosToKoi = DosToKoi & Chr(252)
    			Case 222 DosToKoi = DosToKoi & Chr(224)
    			Case 223 DosToKoi = DosToKoi & Chr(241)
    			Case 224 DosToKoi = DosToKoi & Chr(193)
    			Case 225 DosToKoi = DosToKoi & Chr(194)
    			Case 226 DosToKoi = DosToKoi & Chr(215)
    			Case 227 DosToKoi = DosToKoi & Chr(199)
    			Case 228 DosToKoi = DosToKoi & Chr(196)
    			Case 229 DosToKoi = DosToKoi & Chr(197)
    			Case 184 DosToKoi = DosToKoi & Chr(163)
    			Case 230 DosToKoi = DosToKoi & Chr(214)
    			Case 231 DosToKoi = DosToKoi & Chr(218)
    			Case 232 DosToKoi = DosToKoi & Chr(201)
    			Case 233 DosToKoi = DosToKoi & Chr(202)
    			Case 234 DosToKoi = DosToKoi & Chr(203)
    			Case 235 DosToKoi = DosToKoi & Chr(204)
    			Case 236 DosToKoi = DosToKoi & Chr(205)
    			Case 237 DosToKoi = DosToKoi & Chr(206)
    			Case 238 DosToKoi = DosToKoi & Chr(207)
    			Case 239 DosToKoi = DosToKoi & Chr(208)
    			Case 240 DosToKoi = DosToKoi & Chr(210)
    			Case 241 DosToKoi = DosToKoi & Chr(211)
    			Case 242 DosToKoi = DosToKoi & Chr(212)
    			Case 243 DosToKoi = DosToKoi & Chr(213)
    			Case 244 DosToKoi = DosToKoi & Chr(198)
    			Case 245 DosToKoi = DosToKoi & Chr(200)
    			Case 246 DosToKoi = DosToKoi & Chr(195)
    			Case 247 DosToKoi = DosToKoi & Chr(222)
    			Case 248 DosToKoi = DosToKoi & Chr(219)
    			Case 249 DosToKoi = DosToKoi & Chr(221)
    			Case 252 DosToKoi = DosToKoi & Chr(216)
    			Case 251 DosToKoi = DosToKoi & Chr(217)
    			Case 250 DosToKoi = DosToKoi & Chr(223)
    			Case 253 DosToKoi = DosToKoi & Chr(220)
    			Case 254 DosToKoi = DosToKoi & Chr(192)
    			Case 255 DosToKoi = DosToKoi & Chr(209)
    			Case Else DosToKoi = DosToKoi & Mid( TextBlock, TXB, 1 )
    		End Select
    	NEXT
    End Function

    mephist, 27 Ноября 2009

    Комментарии (5)
  3. VisualBasic / Говнокод #2173

    −366.8

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    Public Overrides Function DataChanged() As Boolean
            Const CONST_PROC_NAME = "DataChanged"
            Try
                Return False
            Catch objExcp As Exception
                Me.DisplayMessageBox("Unexpected Exception in " & CONST_CLASS_NAME & "." & CONST_PROC_NAME & " : " & objExcp.Message.ToString, MessageBoxIcon.Error)
            End Try
        End Function

    По суровому закону нашего проекта каждая функция должна быть обернута ловлей эксепшиона. Каждая. Всегда.

    6istik, 24 Ноября 2009

    Комментарии (20)
  4. VisualBasic / Говнокод #2026

    −129.8

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    For intAtts As Integer = 5 To strParams.Length - 1
                Select Case (intAtts + 1) Mod 3
                    Case 0
                        '--- Set where to find the attachments
                        Select Case strParams(intAtts).ToUpper
                            Case "TASKVIEW"
                                strAttach = CType(Me.Parent, ctlTaskViewTemplate).ctlDocNavigator.ContainerID.ToString & ","
                            Case "WORKITEM"
                                strAttach = WorkItem.WorkItemContainer.ToString & ","
                            Case "CASE"
                                strAttach = BFECase.CaseContainerID.ToString & ","
                        End Select
                    Case 1
                        '--- Set the relative path of where to find the attachments
                        strAttach = strAttach & strParams(intAtts) & ","
                    Case 2
                        '--- Set the type of document used to find the attachments
                        strAttach = strAttach & strParams(intAtts)
                        arrAttachments.Add(strAttach)
                        strAttach = ""
                End Select
            Next intAtts

    вот и попробуй пойми что в этих массивах по какому принципу лежит

    6istik, 22 Октября 2009

    Комментарии (2)
  5. VisualBasic / Говнокод #2025

    −129

    1. 1
    Dim datestart As DateTime = New DateTime(DateTime.Now.Year, DateTime.Now.Month, DateTime.Now.Day)

    очередная индусятина

    xeonix, 22 Октября 2009

    Комментарии (9)
  6. VisualBasic / Говнокод #1972

    −124.6

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    ''' <summary>
    ''' Представляет обект RSS-новость
    ''' </summary>
    ''' <remarks></remarks>
    Public Class NewsItems
    ...
        Public Property AgencyTitle() As String
            Get
                Return Me._agencyTitle
            End Get
            Set(ByVal value As String)
                Me._agencyTitle = value
            End Set
        End Property
    ...
        ''' <summary>
        ''' Вставка региональной новости в БД
        ''' </summary>
        ''' <param name="Lang">язык</param>
        ''' <param name="DateFormat">формат даты в рассылке</param>
        ''' <param name="region">ID региона</param>
        ''' <remarks></remarks>
        Public Sub AddNewRegion(ByVal Lang As String, ByVal DateFormat As String, ByVal region As Integer)
            If AgencyTitle.StartsWith("зБЪЕФБ.Ru") Then
                Exit Sub
            End If
    ...
        End Sub
    ...
    End Class

    заставили разбираца с проектом на ВБ...
    и вот шо я там нашол.
    ...ну конешно... я бы тоже испугался новостного агенства с таким названием )))

    xeonix, 13 Октября 2009

    Комментарии (9)
  7. VisualBasic / Говнокод #1941

    −116.9

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Public Function Str2Hex(ByVal strData As String)
    Dim i As Long, CryptString As String, tmpAppend As String
        On Local Error Resume Next
        For i = 1 To Len(strData)
            tmpAppend = Hex$(Asc(Mid$(strData, i, 1)))
            If Len(tmpAppend) = 1 Then tmpAppend = Trim$(Str$(0)) & tmpAppend
            CryptString = CryptString & tmpAppend: DoEvents
        Next i
        Str2Hex = CryptString
    End Function

    Работающий перевод строки в Hex.
    Но:
    1. On Error ... - Где тут может быть Error?!
    2. Вместо "0" почему-то написано Trim$(Str$(0)
    3. DoEvents, выполняющийся после каждого добавления к строке сильно замедлит код

    KIRK, 05 Октября 2009

    Комментарии (4)
  8. VisualBasic / Говнокод #1746

    −128.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    Select Case Microsoft.VisualBasic.Right(FileLBL.Text.Trim, 3)
                        Case "pdf"
                            IconIMG.ImageUrl = "~/img/pdf.bmp"
                        Case "doc"
                            IconIMG.ImageUrl = "~/img/word.bmp"
                        Case "xls", "csv"
                            IconIMG.ImageUrl = "~/img/excel.bmp"
                        Case "rpt"
                            IconIMG.ImageUrl = "~/img/crystal.bmp"
                        Case "txt"
                            IconIMG.ImageUrl = "~/img/text.bmp"
                        Case Else
                            IconIMG.ImageUrl = "~/img/blank.bmp"
                    End Select

    Valera, 02 Сентября 2009

    Комментарии (5)
  9. VisualBasic / Говнокод #1729

    −115.5

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    #Region "КОНСТАНТЫ ЭЛЕМЕНТОВ И АТТРИБУТОВ EXCEL"
        Public Const STYLE_DEFAULT As String = "Default"
        Public Const STYLE_ROW_VAC As String = "RvaC"
        Public Const STYLE_COLUMN As String = "Column"
        Public Const STYLE_f7I_bN_vaC_haL_n As String = "f7IbNvaChaL"
        Public Const STYLE_f7_bN_vaC_haL_nS As String = "f7bNvaChaLnS"
        Public Const STYLE_f7_bN_vaC_haR_nS As String = "f7bNvaChaRnS"
        Public Const STYLE_f7U_bl1r1Dt2_vaC_haL_n As String = "f7Ubl1t2r1DvaChaL"
        Public Const STYLE_f7_bl1Dr1t2_vaC_haL_n As String = "f7bl1Dr1t2vaChaL"
        Public Const STYLE_f7_br1D_vaC_haL_n As String = "f7br1DvaChaL"
        Public Const STYLE_f7_bl1Dr1_vaC_haL_nP As String = "f7bl1Dr1vaChaLnP"
        Public Const STYLE_f12B_bN_vaC_haL_n As String = "f11BbNvaChaL"
        Public Const STYLE_f12_bN_vaC_haL_n As String = "f11bNvaChaL"
        Public Const STYLE_f7_bN_vaT_haL_n As String = "f7bNvaThaL"
        Public Const STYLE_f12B_bl1r1t2_vaC_haL_n As String = "f11Bbl1r1t2vaChaL"
        Public Const STYLE_f7B_bN_vaC_haR_nS As String = "f7BvaChaRnS"
        Public Const STYLE_f7_bN_vaC_haC_n As String = "f7bNvaChaC"
        Public Const STYLE_f7B_bN_vaC_haL_nS As String = "f7BbNvaChaLnS"
        Public Const STYLE_f7B_bN_vaC_haC_n As String = "f7BbNvaChaC"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haC_n As String = "f7Bbl1r1t1b1vaChaC"
        Public Const STYLE_f7B_bl1_vaC_haL_n As String = "f7bl1vaChaL"
        Public Const STYLE_f7B_bt2_vaC_haL_nS As String = "f7Bbt2vaChaLnS"
        Public Const STYLE_f7B_bt2_vaC_haC_n As String = "f7Bbt2vaChaC"
        Public Const STYLE_f7B_bt2_vaC_haR_nS As String = "f7Bbt2vaChaRnS"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nS As String = "f7bl1r1t2b1vaChaCnS"
        Public Const STYLE_f7_bl1r1t2_vaC_haR_nS As String = "f7bl1r1t2vaChaRnS"
        Public Const STYLE_f7B_bl1r1t2b1_vaC_haR_nS As String = "f7Bbl1r1t2b1vaChaRnS"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haR_nS As String = "f7bl1r1t2b1vaChaRnS"
        Public Const STYLE_f7_bl1r1b1_vaC_haR_nS As String = "f7bl1r1b1vaChaRnS"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haR_nS As String = "f7Bbl1r1t1b1vaChaRnS"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haR_nS As String = "f7bl1r1t1b1vaChaRnS"
        Public Const STYLE_f7U_bl1r1t1b1_vaC_haL_n As String = "f7Ubl1r1t1b1vaChaL"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_n As String = "f7Ibl1r1t1b1vaChaC"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haL_nS As String = "f7bl1r1t1b1vaChaLnS"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nS As String = "f7bl1r1t1b1vaChaCnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haR_n As String = "f7Ibl1r1t1b1vaChaR"
        Public Const STYLE_f7_bl1r1t2b1_vaC_haC_nN As String = "f7bl1r1t2b1vaChaCnN"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haC_nN As String = "f7bl1r1t1b1vaChaCnN"
        Public Const STYLE_f7B_bl1r1t2b2_vaC_haL_nS As String = "f7Bbl1r1t2b2vaChaLnS"
        Public Const STYLE_f7_bl1r1t2b2_vaC_haC_nS As String = "f7bl1r1t2b2vaChaCnS"
        Public Const STYLE_f7B_bl1r1t2b2_vaC_haR_nS As String = "f7Bbl1r1t2b2vaChaRnS"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haL_nS As String = "f7Bbl1r1t1b1vaChaLnS"
        Public Const STYLE_f12B_bN_vaC_haR_nS As String = "f12BbNvaChaRnS"
        Public Const STYLE_f12_bN_vaC_haC_nS As String = "f12bNvaChaCnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haL_nS As String = "f7Ibl1r1t1b1vaChaLnS"
        Public Const STYLE_f7I_bl1r1t1b1_vaC_haC_nN As String = "f7Ibl1r1t1b1vaChaCnN"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haC As String = "f7BvaChaC" 'STYLE_f7B_bl1r1t1b1_vaC_haC_n ' "f7Bbl1r1t1b1vaChaC"
        Public Const STYLE_f7B_bl1r1t1b1_vaC_haL As String = "f7BvaChaL" '"f7Bbl1r1t1b1vaChaL"
        Public Const STYLE_f7_bl1r1t1b1_vaC_haL As String = "f7vaChaL" '"f7bl1r1t1b1vaChaL"
        Public Const STYLE_f7_bl1r1t1b1_vaT_haLW As String = "f7vaThaLW" '"f7bl1r1t1b1vaChaL"
    #End Region

    Трудно поверить, но этот кусок кода написан живым человеком. И, что самое странное, этот человек считал, что использовать такие константы очень удобно.

    iley, 31 Августа 2009

    Комментарии (43)
  10. VisualBasic / Говнокод #1672

    −130.3

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    Public Overrides Sub OnViewInitialized()
                Dim userId As String = _guard.GetCurrentUserId()
    
                BindGroups()
                Bind()
                DoHackyStuff()
            End Sub
    
            Private Function GetUrls() As Dictionary(Of String, String)
    
                Dim dic As New Dictionary(Of String, String)
                For Each assembly In AppDomain.CurrentDomain.GetAssemblies()
                    For Each type In assembly.GetTypes.Where(Function(q) q.FullName.EndsWith("Url"))
                        Dim url = CType(_container.GetByType(type), IUrl).Page
                        Dim name = type.FullName.Split(".".ToCharArray)
    
                        dic.Add(url, name.Reverse.First + ", " + name.Reverse.Skip(1).First)
                    Next
                Next
                Return dic
    
            End Function
    
            Private Sub DoHackyStuff()
    
                Dim siteMap = _container.Get(Of ISiteMapGenerator)().GetSiteMap()
                Dim urls = GetUrls()
    
                Dim sb As New StringBuilder
                For Each top In siteMap.Nodes
    
                    sb.AppendLine(String.Format("<top display-name=""{0}"" id=""{1}"">", top.Name, urls(top.Url)))
                    For Each group In top.Nodes
                        sb.AppendLine(String.Format("<group display-name=""{0}"">", group.Name))
                        For Each item1 In group.Nodes
                            sb.AppendLine(String.Format("<item display-name=""{0}"" id=""{1}""/>", item1.Name, urls(item1.Url)))
                        Next
                        sb.Append("</group>")
                    Next
                    sb.Append("</top>")
                Next
    
            End Sub

    Быстро пытался сгенерить xml-ку по ран-тайм структуре.

    Valera, 24 Августа 2009

    Комментарии (2)