1. PHP / Говнокод #25469

    0

    1. 1
    2. 2
    3. 3
    4. 4
    <?php
    
    $st = $db->prepare("select id from huis where len > :len");
    $st->execute(array("len" => 20));

    Перепост http://govnokod.ru/20125#comment340813

    bormandyan, 24 Марта 2019

    Комментарии (15)
  2. Pascal / Говнокод #25468

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    Ent := 0.0;
      for I := Low(Freq) to High(Freq) do
        Ent := Ent + Freq[I];
      Ent := Ln(FileSize(Input)) / Ln(2) * Ent;
      for I := Low(Freq) to High(Freq) do
      begin
        if Freq[I] > 0 then
          Ent := Ent - Freq[I] * Ln(Freq[I]) / Ln(2);
      end;
      Ent := Ent / FileSize(Input);

    Скучно, девочки!

    Increment_Excrement, 23 Марта 2019

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

    0

    1. 1
    <?php

    Интересно, а бывает ли в "PHP" такое, чтобы страница не генерилась при каждом запросе, а только один раз при изменениях в БД, и отдавалась статическая страничка.

    COTOHuHCKuu_nemyx, 23 Марта 2019

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

    +4

    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
    #include <inttypes.h>
    
    auto a(auto b) __attribute__ ((noinline));
    
    auto a(auto b)
    {
        return b*1.5;
    }
    
    double test1(double in)
    {
      return a(in);
    }
    
    uint64_t test2(uint64_t in)
    {
      return a(in);
    }
    
    
    /*
    https://godbolt.org/z/6ZQAnv
    
    auto a<double>(double):
            mulsd   xmm0, QWORD PTR .LC0[rip]
            ret
    test1(double):
            jmp     auto a<double>(double)
    auto a<unsigned long>(unsigned long):
            test    rdi, rdi
            js      .L5
            pxor    xmm0, xmm0
            cvtsi2sd        xmm0, rdi
            mulsd   xmm0, QWORD PTR .LC0[rip] # хули ты мне плавучего питуха в xmm0 возвращаешь?
            ret
    .L5:
            mov     rax, rdi
            and     edi, 1
            pxor    xmm0, xmm0
            shr     rax
            or      rax, rdi
            cvtsi2sd        xmm0, rax
            addsd   xmm0, xmm0
            mulsd   xmm0, QWORD PTR .LC0[rip]
            ret
    test2(unsigned long):
            sub     rsp, 8
            call    auto a<unsigned long>(unsigned long)
            movsd   xmm1, QWORD PTR .LC1[rip]
            comisd  xmm0, xmm1
            jnb     .L8
            cvttsd2si       rax, xmm0 # ну нахуй тут надо double в uint64_t конвертить
            add     rsp, 8 # почему это не делается в auto a<unsigned long>(unsigned long)
            ret
    .L8:
            subsd   xmm0, xmm1
            add     rsp, 8
            cvttsd2si       rax, xmm0
            btc     rax, 63
            ret
    .LC0:
            .long   0
            .long   1073217536
    .LC1:
            .long   0
            .long   1138753536
    
    */

    концепты-хуепты

    j123123, 23 Марта 2019

    Комментарии (28)
  5. 1C / Говнокод #25465

    0

    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
    Набор = РегистрыСведений.ЗначенияСвойствОбъектов.СоздатьНаборЗаписей();
    		Отбор = Набор.Отбор;
    		Отбор.Объект.Использование = Истина;
    		Отбор.Объект.ВидСравнения = ВидСравнения.Равно;
    		Отбор.Свойство.ВидСравнения = ВидСравнения.Равно;
    		Отбор.Объект.Значение = Грузополучатель;                
    		Отбор.Свойство.Значение = ПланыВидовХарактеристик.СвойстваОбъектов.НайтиПоНаименованию("GLN").Ссылка;
    		Набор.Прочитать();
    		GLN_получ = "";
    		Если Набор.Количество() > 0 Тогда
    			Для нумер = 0 по Набор.Количество()-1 Цикл
    				Свво = Набор.Получить(нумер).Свойство;
    				Если СокрЛП(Свво.Наименование) = "GLN" Тогда
    					GLN_получ = Набор.Получить(нумер).Значение;
    				КонецЕсли;
    			КонецЦикла;
    		КонецЕсли;
    
    		ОбластьМакета.Параметры.GLN_получ       = GLN_получ;

    cdpoma, 22 Марта 2019

    Комментарии (18)
  6. JavaScript / Говнокод #25464

    +2

    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
    <script>
          qqq = 0;
            setInterval(function(){
                qqq++; 
                if ( qqq == 1 ) $('.qqq').text('.');  
                else if ( qqq == 2 ) $('.qqq').text('..');  
                else if ( qqq == 3 ) $('.qqq').text('...'); 
                else {
                    $('.qqq').empty(); 
                    qqq = 0;
                }
            },900);
       </script>

    Многоточия...
    Встретил случайно в одном из сайтов)

    fuckall, 21 Марта 2019

    Комментарии (46)
  7. PHP / Говнокод #25463

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    foreach ($result->getDataCollection() as $data) {
        if (!$data->getStatus() === Status::PAID)
            continue;
    
        // ACTIONS
    }

    Зачем использовать !== если есть ===

    P/s
    Смотрим на if (

    genkaok, 21 Марта 2019

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

    +1

    1. 1
    2. 2
    3. 3
    Страйкер приде — почту почине!
    
    Грустно без уведомлений из любимой соцсети.

    gost, 21 Марта 2019

    Комментарии (10)
  9. Куча / Говнокод #25461

    −1

    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
    Very strange dream which was partly cast by debate between supporters and opponents of OOP dreamed me...
    In a dream I saw a church porch on which the bald little man similar to Solovyov acted. He very much worried, every minute wiping a scarf a face and the top.
    Misters! - at last he declared. Today historical day! We will listen to debate of the parties, in the person of the master of OOP and the adherent of functional style.
    Storm of applause was distributed, and allegorical figures stepped on the stage. The old man in a magnificent gold cloak and a wreath, the adherent of a funktsionalshchina - the reserved young man who is very elegantly dressed appeared the master of OOP a severe look.
    Except them two, I rose by a church porch as well the young man in a hunting hat, with a piece of cervine wool instead of a feather.
    - Tomasz Gryshtar, he was presented, and took leave. He strongly burred, but was perfectly polite, nearly falling from feet from complaisance.
    The compere rubbed hands. So misters, we will pass to business. Today we will lift from an ocean floor (joke) in this world merits and demerits of both paradigms and we will be helped with it by our friend Thomas. Let in dispute the truth will open.
    - OOP isn't necessary, - the Adherent inconsiderately blurted out.
    - Oh, this very bold statement! - the compere laughed.
    The master densely reddened, but didn't utter words.
    - What you on it will tell, the sir?
    The master sat with a dead-pan. The compere, without having waited for the answer, I transferred the right of the word to Thomas
    - I believe that our friend-assemblershchik too has the right to express.
    That got a graceful gold shkatulochka because of a bosom and, having started the handle, opened her. The gentle melody was distributed.
    The master at last interrupted a silence vow:
    - And what was become with your "Titan"?
    - I... E-e-e. I lost source codes...
    - Very regrettably. But you kept the compiler?
    - "Fasm", sir.
    - Misters, misters! We after all gathered for the sake of an important issue, and still anything efficient didn't find.
    - OOP irrationally uses memory, - the adherent again interfered.
    At these words Master the loud scratch swayed slightly, distributed, his cloak was lifted up. It appeared that he sits in a wheelchair.
    Thomas again got a shkatulochka, it is obvious to relieve the tension.
    - OOP teaches bad style. The adherent took out a rosette from a buttonhole and began to smell her. He had an indifferent person.
    The master sighed, inclined the head, but answered nothing.
    Thomas again got a shkatulochka.
    The compere wiped sweat from a forehead and declared: - Misters, it seems to me, we in vain spend time.
    Shkatulochka suddenly was mistaken. Thomas lifted her over the head, shook - and about horror! - the thunderous crash was distributed and in a flash Thomas was buried under a heap of gears, springs and cranked shaft. The compere and the Master hurried to him to the aid. The adherent kept coolness, without having moved even a finger.
    - Debate is ended. The compere clapped and quitted the stage. It was visible that he is deeply vulnerable.
    The person in a frock coat approached the adherent and patted him shoulder. The young man squealed and discontentedly turned back.
    It appeared that it is the semi-idiot, obviously, the patient with a Down syndrome. The trustee handed him threads from red and yellow balloons, why the infantile face of the young man lit up with pleasure. They slowly went on a footpath...
    Tomasz and Metr long looked to him following.
    - How you think, the colleague, whether asmovstavka in language of high level are pertinent?
    - Why not?
    - I am glad that you so consider.

    Вариант перевода одного из рассказов c помощью translate.ru

    cmepmop, 21 Марта 2019

    Комментарии (38)
  10. Куча / Говнокод #25460

    −1

    1. 1
    Грибник

    http://yadelphi.do.am/publ/1-1-0-12

    cmepmop, 21 Марта 2019

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