1. Си / Говнокод #12533

    +139

    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
    for( i=0; i<MAX_CHANNELS; i++ )
      {
        ht->ht_Voices[i].vc_Delta=1;
        ht->ht_Voices[i].vc_OverrideTranspose=1000;  // 1.5
        ht->ht_Voices[i].vc_SamplePos=ht->ht_Voices[i].vc_Track=ht->ht_Voices[i].vc_Transpose=ht->ht_Voices[i].vc_NextTrack = ht->ht_Voices[i].vc_NextTranspose = 0;
        ht->ht_Voices[i].vc_ADSRVolume=ht->ht_Voices[i].vc_InstrPeriod=ht->ht_Voices[i].vc_TrackPeriod=ht->ht_Voices[i].vc_VibratoPeriod=ht->ht_Voices[i].vc_NoteMaxVolume=ht->ht_Voices[i].vc_PerfSubVolume=ht->ht_Voices[i].vc_TrackMasterVolume=0;
        ht->ht_Voices[i].vc_NewWaveform=ht->ht_Voices[i].vc_Waveform=ht->ht_Voices[i].vc_PlantSquare=ht->ht_Voices[i].vc_PlantPeriod=ht->ht_Voices[i].vc_IgnoreSquare=0;
        ht->ht_Voices[i].vc_TrackOn=ht->ht_Voices[i].vc_FixedNote=ht->ht_Voices[i].vc_VolumeSlideUp=ht->ht_Voices[i].vc_VolumeSlideDown=ht->ht_Voices[i].vc_HardCut=ht->ht_Voices[i].vc_HardCutRelease=ht->ht_Voices[i].vc_HardCutReleaseF=0;
        ht->ht_Voices[i].vc_PeriodSlideSpeed=ht->ht_Voices[i].vc_PeriodSlidePeriod=ht->ht_Voices[i].vc_PeriodSlideLimit=ht->ht_Voices[i].vc_PeriodSlideOn=ht->ht_Voices[i].vc_PeriodSlideWithLimit=0;
        ht->ht_Voices[i].vc_PeriodPerfSlideSpeed=ht->ht_Voices[i].vc_PeriodPerfSlidePeriod=ht->ht_Voices[i].vc_PeriodPerfSlideOn=ht->ht_Voices[i].vc_VibratoDelay=ht->ht_Voices[i].vc_VibratoCurrent=ht->ht_Voices[i].vc_VibratoDepth=ht->ht_Voices[i].vc_VibratoSpeed=0;
        ht->ht_Voices[i].vc_SquareOn=ht->ht_Voices[i].vc_SquareInit=ht->ht_Voices[i].vc_SquareLowerLimit=ht->ht_Voices[i].vc_SquareUpperLimit=ht->ht_Voices[i].vc_SquarePos=ht->ht_Voices[i].vc_SquareSign=ht->ht_Voices[i].vc_SquareSlidingIn=ht->ht_Voices[i].vc_SquareReverse=0;
        ht->ht_Voices[i].vc_FilterOn=ht->ht_Voices[i].vc_FilterInit=ht->ht_Voices[i].vc_FilterLowerLimit=ht->ht_Voices[i].vc_FilterUpperLimit=ht->ht_Voices[i].vc_FilterPos=ht->ht_Voices[i].vc_FilterSign=ht->ht_Voices[i].vc_FilterSpeed=ht->ht_Voices[i].vc_FilterSlidingIn=ht->ht_Voices[i].vc_IgnoreFilter=0;
        ht->ht_Voices[i].vc_PerfCurrent=ht->ht_Voices[i].vc_PerfSpeed=ht->ht_Voices[i].vc_WaveLength=ht->ht_Voices[i].vc_NoteDelayOn=ht->ht_Voices[i].vc_NoteCutOn=0;
        ht->ht_Voices[i].vc_AudioPeriod=ht->ht_Voices[i].vc_AudioVolume=ht->ht_Voices[i].vc_VoiceVolume=ht->ht_Voices[i].vc_VoicePeriod=ht->ht_Voices[i].vc_VoiceNum=ht->ht_Voices[i].vc_WNRandom=0;
        ht->ht_Voices[i].vc_SquareWait=ht->ht_Voices[i].vc_FilterWait=ht->ht_Voices[i].vc_PerfWait=ht->ht_Voices[i].vc_NoteDelayWait=ht->ht_Voices[i].vc_NoteCutWait=0;
        ht->ht_Voices[i].vc_PerfList=0;
        ht->ht_Voices[i].vc_RingSamplePos=ht->ht_Voices[i].vc_RingDelta=ht->ht_Voices[i].vc_RingPlantPeriod=ht->ht_Voices[i].vc_RingAudioPeriod=ht->ht_Voices[i].vc_RingNewWaveform=ht->ht_Voices[i].vc_RingWaveform=ht->ht_Voices[i].vc_RingFixedPeriod=ht->ht_Voices[i].vc_RingBasePeriod=0;
    
        ht->ht_Voices[i].vc_RingMixSource = NULL;
        ht->ht_Voices[i].vc_RingAudioSource = NULL;
    
        memset(&ht->ht_Voices[i].vc_SquareTempBuffer,0,0x80);
        memset(&ht->ht_Voices[i].vc_ADSR,0,sizeof(struct hvl_envelope));
        memset(&ht->ht_Voices[i].vc_VoiceBuffer,0,0x281);
        memset(&ht->ht_Voices[i].vc_RingVoiceBuffer,0,0x281);
      }

    Щито оно делает?

    Govnocoder#0xFF, 03 Февраля 2013

    Комментарии (12)
  2. PHP / Говнокод #12532

    +79

    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
    if ($foto1 != "") {
                                            $fotourl = $foto1;
                                    } else {
                                            if ($foto2 != "") {
                                                    $fotourl = $foto2;
                                            } else {
                                                    if ($foto3 != "") {
                                                            $fotourl = $foto3;
                                                    } else {
                                                            if ($foto4 != "") {
                                                                    $fotourl = $foto4;
                                                            } else {
                                                                    if ($foto5 != "") {
                                                                            $fotourl = $foto5;
                                                                    } else {
                                                                            if ($foto6 != "") {
                                                                                    $fotourl = $foto6;
                                                                            } else {
                                                                                    if ($foto7 != "") {
                                                                                            $fotourl = $foto7;
                                                                                    } else {
                                                                                            if ($foto8 != "") {
                                                                                                    $fotourl = $foto8;
                                                                                            } else {
                                                                                                    if ($foto9 != "") {
                                                                                                            $fotourl = $foto9;
                                                                                                    } else {
                                                                                                            if ($foto10 != "") {
                                                                                                                    $fotourl = $foto10;
                                                                                                            } else {
                                                                                                                    if ($foto11 != "") {
                                                                                                                            $fotourl = $foto11;
                                                                                                                    } else {
                                                                                                                            if ($foto12 != "") {
                                                                                                                                    $fotourl = $foto12;
                                                                                                                            } else {
                                                                                                                                    if ($foto13 != "") {
                                                                                                                                            $fotourl = $foto13;
                                                                                                                                    } else {
                                                                                                                                            if ($foto14 != "") {
                                                                                                                                                    $fotourl = $foto14;
                                                                                                                                            } else {
                                                                                                                                                     // продолжение 
                                                                                                                                            }
                                                                                                                                    }
                                                                                                                            }
                                                                                                                    }
                                                                                                            }
                                                                                                    }
                                                                                            }
                                                                                    }
                                                                            }
                                                                    }
                                                            }
                                                    }
                                            }
                                    }

    Дали допилить сайт

    uadeveloper, 03 Февраля 2013

    Комментарии (22)
  3. C# / Говнокод #12531

    +140

    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
    <%@ Page Language="C#" AutoEventWireup="true" CodeBehind="user_task_list.aspx.cs" Inherits="prototype_alpha.user_task_list" %>
        <form id="user_task_list_form" action="user_task_list.aspx" method="post">
            <div>
                <p>Поданные заказы</p>
                <%foreach (LABA_OP_SITE.Task item in TaskList.Where(a => a.TaskState == 101 || a.TaskState == 102))
                  {
                      var q = BidList.Where(a => a.TaskID == item.TaskID);%>
                <%=TaskDataList.Where(a=>a.TaskID==item.TaskID).First().TaskTitle + " | " + q.Count() + " | " +item.TaskPutDate + " | "+ item.TaskDeadline + " | average bid(fuck up) | "+CommentList.Where(a=>a.TaskID==item.TaskID && a.CommentRead==0).Count()%>
                <br />
                <% }%>
                <p>task title* || bids' count* || task put date* || task work end date* || average bid || new comments*</p>
                <p>Выполняемые заказы</p>
                <%foreach (LABA_OP_SITE.Task item in TaskList.Where(a => a.TaskState >= 0 || a.TaskState < 100))
                  {
                <%=TaskDataList.Where(a=>a.TaskID==item.TaskID).First().TaskTitle + " | task start date | task work end date(time span) |"+item.TaskState+BidList.Where(a=>a.BidID==item.BidID).First().Bid1+" | "+CommentList.Where(a=>a.TaskID==item.TaskID && a.CommentRead==0).Count()%>
                <br />
                <% }%>
                <p>task title* || task start date || task work end date(time span) || state* || price* || new comments*</p>
                <p>Выполненные(не сданы) заказы</p>
                <%foreach (LABA_OP_SITE.Task item in TaskList.Where(a => a.TaskState == 100))
                  {
                <%=TaskDataList.Where(a=>a.TaskID==item.TaskID).First().TaskTitle + " | task start date | "+item.TaskWorkCompleteDate+" | "+BidList.Where(a=>a.BidID==item.BidID).First().Bid1+" | "+CommentList.Where(a=>a.TaskID==item.TaskID && a.CommentRead==0).Count()%>
                <br />
                <% }%>
                <p>task title* || task start date || task work end date(saw into)* || price* || new comments*</p>
                <p>Выполненные(сданы) заказы</p>
                <%foreach (LABA_OP_SITE.Task item in TaskList.Where(a => a.TaskState == 103 || a.TaskState == 104))
                  {
                <%=TaskDataList.Where(a=>a.TaskID==item.TaskID).First().TaskTitle + " | task start date | "+item.TaskWorkCompleteDate+" | "+BidList.Where(a=>a.BidID==item.BidID).First().Bid1%>
                <br />
                <% }%>
                <p>task title* || task start date || task work end date(saw into)* || price*</p>
                <p>Замороженные заказы</p>
                <%foreach (LABA_OP_SITE.Task item in TaskList.Where(a => a.TaskState <0))
                  {
                <%=TaskDataList.Where(a=>a.TaskID==item.TaskID).First().TaskTitle + " | task start date | "+item.TaskDeadline+" | "+BidList.Where(a=>a.BidID==item.BidID).First().Bid1%>
                <br />
                <% }%>
                <p>task title* || task start date || task work end date(deadline)* || price*</p>
            </div>
        </form>

    От человека требовалось написать написать отладочную страницу для списка заказов.

    *TaskList, TaskDataList, CommentList, BidList - массивы

    kasthack, 03 Февраля 2013

    Комментарии (9)
  4. Java / Говнокод #12530

    +63

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    int i = (int)Math.pow(10, (n - 1)); 
              int max = i*5;
              int count = 0;
                
              for (i = i; i < max; i++) {  // i = i ??              
                 if (isUnique(i, i*2, n)) { 
                    count++;
                    System.out.printf("%s %s \n", i, i*2);
                 }

    Как обойтись без такого кулхацкерного самоприсваивания?

    Govnocoder#0xFF, 02 Февраля 2013

    Комментарии (8)
  5. C++ / Говнокод #12529

    +7

    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
    74. 74
    75. 75
    #include <iostream>
    namespace detail
    {
      class CRWO;
      class CRO;
      class CWO;
      class CO;
    }
    typedef detail::CRWO&  CRWO;
    typedef detail::CRO&  CRO;
    typedef detail::CWO&  CWO;
    typedef detail::CO&  CO;
    class C
    {
        friend class detail::CRWO; 
        friend class detail::CRO; 
        friend class detail::CWO; 
        friend class detail::CO; 
      public:
        C( int a ) : value(a) {}
        ~C() {};
        operator CRWO() { return *static_cast<detail::CRWO*>(static_cast<void*>(this)); }
        operator CRO() { return *static_cast<detail::CRO*>(static_cast<void*>(this)); }
        operator CWO() { return *static_cast<detail::CWO*>(static_cast<void*>(this)); }
        operator CO() { return *static_cast<detail::CO*>(static_cast<void*>(this)); }
      private:
        void set( int newValue ) { value = newValue; }
        int get() { return value; }
      private:
        int value;
    };
    class detail::CRWO
    {
      public:
        void set( int newValue ) { static_cast<C*>(static_cast<void*>(this))->set( newValue ); }
        int get() { return static_cast<C*>(static_cast<void*>(this))->get( ); }
        operator ::CRO() { return *static_cast<detail::CRO*>(static_cast<void*>(this)); }
        operator ::CWO() { return *static_cast<detail::CWO*>(static_cast<void*>(this)); }
        operator ::CO() { return *static_cast<detail::CO*>(static_cast<void*>(this)); }    
      private:
        CRWO(); CRWO(const CRWO&);~CRWO();CRWO& operator=(const CRWO&);void operator&(); void operator*();
    };
    class detail::CWO
    {
      public:
        void set( int newValue ) { static_cast<C*>(static_cast<void*>(this))->set( newValue ); }
         operator ::CO() { return *static_cast<detail::CO*>(static_cast<void*>(this)); }    
      private:
        CWO(); CWO(const CWO&);~CWO();CWO& operator=(const CWO&);void operator&(); void operator*();
    };
    class detail::CRO
    {
      public:
        int get() { return static_cast<C*>(static_cast<void*>(this))->get( ); }
        operator ::CO() { return *static_cast<detail::CO*>(static_cast<void*>(this)); }    
      private:
        CRO(); CRO(const CRO&);~CRO();CRO& operator=(const CRO&);void operator&(); void operator*();
    };
    class detail::CO
    {
      public:
      private:
        CO(); CO(const CO&);~CO();CO& operator=(const CO&);void operator&(); void operator*();
    };int main(int argc, char *argv[])
    {
    C c(3);
    CRWO rwo = c;
    CRO ro = c;
    CWO wo = c;
    CO o = c;
      std::cout  << rwo.get() << std::endl;
      wo.set( 5);
      std::cout  << ro.get() << std::endl;
    return 0;
    }

    Оттуда.

    Автор требует указывать авторство при копировании.

    LispGovno, 02 Февраля 2013

    Комментарии (24)
  6. PHP / Говнокод #12528

    +49

    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
    switch ( ! empty($rules['last_online']) )
    {
    			case '3days':
    				$where .= " AND last_online > NOW() - INTERVAL '3 DAYS' ";
    			break;
    
    			case 'week':
    				$where .= " AND last_online > NOW() - INTERVAL '7 DAYS' ";
    			break;
    
    			case 'month':
    				$where .= " AND last_online > NOW() - INTERVAL '1 MONTH' ";
    			break;
    }

    Внезапно сломался фильтр .... И такое найти можно. Впервые подобное вижу

    nobody, 01 Февраля 2013

    Комментарии (74)
  7. Куча / Говнокод #12527

    +126

    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
    ZipWith[f_, vector1_, vector2_] := Table[ f[ vector1[[i]], vector2[[i]] ], {i, Min[Length[vector1], Length[vector2]] } ]
    
    UnZip[list_] := {Map[First, list], Map[Rest, list]}
    
    Zip[vector1_, vector2_] :=  ZipWith[{#1, #2} &, vector1, vector2]
    ZipWithIndex[vector_] := Zip[vector, Range[1, Length[vector]]]
    ZipWithIndexed[f_, vector1_, vector2_] := Map[f @@ # &, Map[Flatten, Zip[vector1, ZipWithIndex[vector2]]]] 
    
    Fold2[f_, initialState_, list1_ , list2_ ] := Fold[f @@ Prepend[#2, #1] &, initialState, Zip[list1, list2]]
    
    ZipWith1[f_, {}, any_] := {}
    ZipWith1[f_, any_, {}] := {}
    ZipWith1[f_, {h1_, t1___}, {h2_, t2___}] := Prepend[ZipWith1[f, {t1}, {t2}], f[h1, h2]]; (*Extremal version, but recursion depth is 256 *)
     
    GroupByIndex[list_, indexesOfGroup_] := (UnZip[#][[1]]) & /@ Gather[ZipWithIndex[list], (And @@ Map[(MemberQ[indexesOfGroup, #]) &, {#1[[2]], #2[[2]]}]) &]

    Wolfram Mathematica

    Говногость, 01 Февраля 2013

    Комментарии (19)
  8. C# / Говнокод #12526

    +152

    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
    var retriesLeft = 100;
    while (true)
    {
        try
        {
            return SetRestorePoint(0, pointType, enentType, description);
        }
        catch (Win32Exception ex)
        {
            if (ex.NativeErrorCode != ErrorServiceDisabled || retriesLeft < 0)
                throw;
    
            Thread.Sleep(500);
            retriesLeft--;
        }
    }

    abatishchev, 01 Февраля 2013

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

    +48

    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
    class A { 
    
        public $timeline = array();  
    
        function  __construct(){ 
            for ( $i=3; $i-->0;){ 
                array_push($this->timeline, new B); 
            } 
        } 
    } 
    
     
    
    class B { 
        public $moments = array(); 
    
        function  __construct(){ 
            for ( $i=3; $i-->0;){ 
                array_push($this->moments, new C); 
            } 
        } 
    } 
    
     
    
    class C { 
    
        public $minutes = array(); 
    
        function  __construct(){ 
            for ( $i=3; $i-->0;){ 
                array_push($this->minutes, new D); 
            } 
        } 
    } 
    
     
    
    class D { 
        public $time = 0; 
    } 
    
    echo json_encode(new A);

    Вопрос от автора: Добрый день, столкнулся с такой задачей, нужно составить массив в php что бы перегоняя в json он был вида (туткусокжасона) ...бла-бла-бла... Нашел что-то типо этого, расскажите пожалуйста толком как правильно это реализовать
    Пруфлинк: http://forum.php.su/topic.php?forum=72&topic=1873

    Razban_Guestov, 01 Февраля 2013

    Комментарии (3)
  10. PHP / Говнокод #12524

    +49

    1. 1
    // Ж. Попов: include('blocks/bd.php'); БИДЭ подключено, мои юные сантехники :)

    deep, 31 Января 2013

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