1. 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)
  2. VisualBasic / Говнокод #2025

    −129

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

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

    xeonix, 22 Октября 2009

    Комментарии (9)
  3. 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)
  4. 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)
  5. 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)
  6. 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)
  7. 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)
  8. VisualBasic / Говнокод #1575

    −114

    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
    Module MyChrModule
        Private Declare Function GetAsyncKeyState Lib "user32" (ByVal vKey As Long) As Integer
        '49 to 57 Chr , 32 space
        Public Function Mychr(ByVal ChrNumber As Long) As String
            If ChrNumber = 1 Then Mychr = "[LMB]"
            If ChrNumber = 2 Then Mychr = "[RMB]"
            If ChrNumber = 4 Then Mychr = "[MMB]" ' MouseMiddleButton ( Scroll button )
            If ChrNumber = 9 Then Mychr = "[Tab]"
            If ChrNumber = 20 Then Mychr = "[CapsLock]"
            If ChrNumber = 160 Then Mychr = "[LeftShift]"
            If ChrNumber = 162 Then Mychr = "[LeftCtrl]"
            If ChrNumber = 192 Then Mychr = "`"
            If ChrNumber = 112 Then Mychr = "[F1]" '112 to 123
            If ChrNumber = 113 Then Mychr = "[F2]"
            If ChrNumber = 114 Then Mychr = "[F3]"
            If ChrNumber = 115 Then Mychr = "[F4]"
            If ChrNumber = 116 Then Mychr = "[F5]"
            If ChrNumber = 117 Then Mychr = "[F6]"
            If ChrNumber = 118 Then Mychr = "[F7]"
            If ChrNumber = 119 Then Mychr = "[F8]"
            If ChrNumber = 120 Then Mychr = "[F9]"
            If ChrNumber = 121 Then Mychr = "[F10]"
            If ChrNumber = 122 Then Mychr = "[F11]"
            If ChrNumber = 123 Then Mychr = "[F12]"
            If ChrNumber = 189 Then Mychr = "-"
            If ChrNumber = 187 Then Mychr = "="
            If ChrNumber = 220 Then Mychr = "\"
            If ChrNumber = 219 Then Mychr = "["
            If ChrNumber = 221 Then Mychr = "]"
            If ChrNumber = 186 Then Mychr = ";"
            If ChrNumber = 220 Then Mychr = "\"
            If ChrNumber = 222 Then Mychr = "'"
            If ChrNumber = 188 Then Mychr = ","
            If ChrNumber = 190 Then Mychr = "."
            If ChrNumber = 191 Then Mychr = "/"
            If ChrNumber = 8 Then Mychr = "[BckSpc]"
            If ChrNumber = 123 Then Mychr = "[F12]"
            If ChrNumber = 13 Then Mychr = "[Enter]"
            If ChrNumber = 161 Then Mychr = "[RightShift]"
            If ChrNumber = 91 Then Mychr = "[LeftLogo]"
            If ChrNumber = 92 Then Mychr = "[RightLogo]"
            If ChrNumber = 93 Then Mychr = "[RMB Key]"
            If ChrNumber = 163 Then Mychr = "[RightCtrl]"
            If ChrNumber = 164 Then Mychr = "[LeftAlt]"
            If ChrNumber = 165 Then Mychr = "[RightAlt]"
            If ChrNumber = 44 Then Mychr = "[Print]"
            If ChrNumber = 19 Then Mychr = "[Pause]"
            If ChrNumber = 45 Then Mychr = "[Insert]"
            If ChrNumber = 36 Then Mychr = "[Home]"
            If ChrNumber = 33 Then Mychr = "[PageUp]"
            If ChrNumber = 46 Then Mychr = "[Delete]"
            If ChrNumber = 35 Then Mychr = "[End]"
            If ChrNumber = 34 Then Mychr = "[PageDown]"
            If ChrNumber = 37 Then Mychr = "[Left]"
            If ChrNumber = 38 Then Mychr = "[Up]"
            If ChrNumber = 39 Then Mychr = "[Right]"
            If ChrNumber = 40 Then Mychr = "[Down]"
            If ChrNumber = 144 Then Mychr = "[NumLock]"
    '...

    Один из модулей кейлогера...

    psina-from-ua, 13 Августа 2009

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

    −85

    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
    Try
    	dt.Rows(n)("NAME") = "*****"
    Catch ex As Exception
    End Try
    Try
    	dt.Rows(n)("NAME") = "*****"
    Catch ex As Exception
    End Try
    Try
    	dt.Rows(n)("SURNAME") = "*****"
    Catch ex As Exception
    End Try
    Try
    	dt.Rows(n)("PATRONYMIC_NAME") = "*****"
    Catch ex As Exception
    End Try

    Вот он, structured exception handling во всей свой красе! :)

    guest, 28 Июля 2009

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

    −363.8

    1. 1
    2. 2
    3. 3
    4. 4
    If dd.Items.Count < 1 Then
        dd.Items.Clear()
        ...
    End If

    guest, 23 Июля 2009

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