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

    +130

    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
    void main(void)
    {
    	int a1,a2,a3,a4,a5,a6,a7,a8,a9;
    	int b1,b2,b3,b4,b5,b6,b7,b8,b9;
    	int c1,c2,c3,c4,c5,c6,c7,c8,c9;
    	int d1,d2,d3,d4,d5,d6,d7,d8,d9;
    	int e1,e2,e3,e4,e5,e6,e7,e8,e9;
    	int f1,f2,f3,f4,f5,f6,f7,f8,f9;
    	int g1,g2,g3,g4,g5,g6,g7,g8,g9;
    	int h1,h2,h3,h4,h5,h6,h7,h8,h9;
    	int i1,i2,i3,i4,i5,i6,i7,i8,i9;
    
    ....
    
    }

    Когда-то когда я еще не знала о существовании массивов.... это начало программы для решения судоку.
    В продолжении этого были определены еще 729 переменных для вариантов решения.

    Daiver, 25 Мая 2013

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

    +161

    1. 1
    2. 2
    3. 3
    4. 4
    if (file_exists($path.'/'.$rename_to))
                throw Service_Unzip_Exception("Target catalog ".$path.'/'.$rename_to." already exist");
                rename($path.'/'.$old_dir,$path.'/'.$rename_to);
    }

    invision70, 25 Мая 2013

    Комментарии (12)
  3. Куча / Говнокод #13048

    +126

    1. 1
    <img src="/html/../images/menu/top.png" alt="" />

    Весь HTML вот так зашифрован, не знаю нормально ли это?

    straga_coda, 24 Мая 2013

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

    +128

    1. 1
    public int sended, zipsended;

    там же

    taburetka, 24 Мая 2013

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

    +149

    1. 1
    $years = range(date('Y', $now), date('Y', strtotime('+ 1 year', $now)));

    Пятница в моей голове... А надо было всеголтшь действующий и следующий

    nonamez, 24 Мая 2013

    Комментарии (1)
  6. Куча / Говнокод #13044

    +130

    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
    Class barcode
    	...
    	Dim CharData
    
    	Dim CharNumber
    
    	Public Function GetHTMLBar(BarData  ,  BarHeight  )
    		...
    		For lop = 1 To Len(x)
    			For s = 0 To UBound(CharData)
    					...
    					tsum = tsum + (CLng(CharNumber(s)) * lop)
    					...
    				End If
    			Next 
    		Next 
    	End Function
    
    	Private Sub Class_Initialize()
    		CharNumber = Split("0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96,97,98,99,100,101,102,103,104,105,106", ",")
    		...
    	End Sub
    End class

    VBScript.
    Массив, содержащий собственные индексы?

    slbsomeone, 24 Мая 2013

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

    +153

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    $payout_rate = isset( $transfer['draft'] ) ? ( $transfer['payout_rate'] == '' ? 0 : $transfer['payout_rate'] ) : 1;
            if( isset( $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["sum"] ) ) {
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["quantity"] += $transfer["quantity"];
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["sum"] += $transfer["perechisleno"] * $rate * $payout_rate;
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["commission"] += $transfer["udergano"] * $rate * $payout_rate;
            }
            else {
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["quantity"] = $transfer["quantity"];
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["sum"] = $transfer["perechisleno"] * $rate * $payout_rate;
                $this->_drafts[$transfer["agent"]][$transfer["id_project"]][$transfer["draft_date"]][$currencyId]["commission"] = $transfer["udergano"] * $rate * $payout_rate;
            }

    тайный культ массивов

    dimkich, 24 Мая 2013

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

    +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
    if (sLastChange.StartsWith("ERROR") && sLastChange != "ERROR_EXPOPR")
     {
       logClass.LogStd("========== DATABAZE RS WITH ELSE EXPOPR ERROR: " + sLastChange, MethodBase.GetCurrentMethod());
     }
     else
     {
       SqlCommand oCommand = oConToCom.CreateCommand();
       oCommand.CommandText = configClass.GetAppConfig(oXml, "ToDB_SqlSelectChangeDestinationAfter");
       string sDateLast = oCommand.ExecuteScalar().ToString();
    
       if (oConFrom.State != ConnectionState.Closed) { try { oConFrom.Close(); } catch { } }
        oConFrom.Open();
        oComDateFrom.CommandText = configClass.GetAppConfig(oXml, "ToDB_SqlSelectChangeSource");
        string sDateFrom = oComDateFrom.ExecuteScalar().ToString();
        if (oConFrom.State != ConnectionState.Closed) { try { oConFrom.Close(); } catch { } }
    
        if (sDateLast == sDateFrom)
        {
           logClass.LogStd("========== DATABAZE EXPOPR WITHOUT CHANGE", MethodBase.GetCurrentMethod());
        }

    устроился на новую работу, все вокруг с кучей сертификатов

    taburetka, 23 Мая 2013

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

    +69

    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
    public class Tree {
        
        ...
    
        public static int treeDepth;
    
        ...
    
        public static void runDepthTree(Node start, String method) {
    //        System.out.println("looking at " + start);
            ++treeDepth;
            Statement statement = buildStatement(start, method);
            try {
                statement.execute();
            }
            catch (Exception e) { 
                String msg = start + " ERROR at tree depth= " + treeDepth;
                
                System.out.println(); 
            }
            Node[] nodes = start.getChildren();
            if (nodes != null) {
                int count = start.getComponentCount();
                for (int i = 0; i<count; i++)  {
                    runDepthTree((Node)nodes[i], method); // recurse
                }
            }
            --treeDepth;
        }
    
        ...
    
    }

    Я бы не точно догадался

    myzone, 23 Мая 2013

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

    −158

    1. 1
    2. 2
    3. 3
    4. 4
    update "Employee"."Jobs" set "default_group_id" = '1' where "id" in (select "id" from "Employee"."Jobs" where title like '%родавец%');
    update "Employee"."Jobs" set "default_group_id" = '2' where "id" in (select "id" from "Employee"."Jobs" where title like '%правляющ%');
    update "Employee"."Jobs" set "default_group_id" = '3' where "id" in (select "id" from "Employee"."Jobs" where title like '%лиент%');
    update "Employee"."Jobs" set "default_group_id" = '4' where "id" in (select "id" from "Employee"."Jobs" where title like '%клад%' and title not like '%борщиц%');

    like '%клад% должен был включать всяких "работников склада" и "замзавсклада", но туда попала также и "уборщица склада" - пришлось заводить второе условие

    AntonioK, 23 Мая 2013

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