1. Pascal / Говнокод #3764

    +120

    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
    begin
       if not directoryexists('input') then createdir('input');
       if not directoryexists('output') then createdir('output');
       if not directoryexists('temp') then createdir('temp');
       if not directoryexists('temp\temp') then createdir('temp\temp');
       if not directoryexists('temp\temp_') then createdir('temp\temp_');
       if not directoryexists('temp\temp__') then createdir('temp\temp__');
       if not directoryexists('temp\temp___') then createdir('temp\temp___');
       if not directoryexists('temp\temp____') then createdir('temp\temp____');
       if not directoryexists('temp\temp_____') then createdir('temp\temp_____');
       if not directoryexists('temp\temp______') then createdir('temp\temp______');
       if not directoryexists('temp\temp_______') then createdir('temp\temp_______');
       if not directoryexists('temp\temp________') then createdir('temp\temp________');
       if not directoryexists('temp\temp_________') then createdir('temp\temp_________');
       if not directoryexists('temp\temp__________') then createdir('temp\temp__________');
       if not directoryexists('temp\temp___________') then createdir('temp\temp___________');
       if not directoryexists('temp\temp____________') then createdir('temp\temp____________');
       if not directoryexists('temp\temp_____________') then createdir('temp\temp_____________');
       if not directoryexists('temp\temp______________') then createdir('temp\temp______________');
       if not directoryexists('temp\temp_______________') then createdir('temp\temp_______________');
       if not directoryexists('temp\temp________________') then createdir('temp\temp________________');
       print_('Вас приветствует программа для сортировки слвоарей True Sort');
       print_('Если у вас есть какие-то вопросы по её работе - нажмите Help');
       turbo:=false;
    end;

    Кинул знаковый в асю=\

    BlincAttack, 23 Июля 2010

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

    +171

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    <?php 
    
    $visitor = $_SERVER['REMOTE_ADDR']; 
    if (preg_match("/217.66.26.85/",$visitor))  
    {header('Location: http://site.ru/page.html');} 
    
    ?>

    http://forum.searchengines.ru/showpost.php?p=7312251&postcount=1

    GoodTalkBot, 22 Июля 2010

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

    +148

    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
    #include <cstdio>
    #include <memory.h>
    
    #define maxn 18
    
    char c[maxn][maxn];
    int d[1 << maxn];
    
    int main()
    {
      freopen("network.in", "rt", stdin);
      freopen("network.out", "wt", stdout);
      
      int n; scanf("%d", &n);
      for (int i = 0; i < n; i++)
        scanf("%s", c[i]);
        
      memset(d, 0, sizeof(d));
      
      for (int k = 0; k < (1 << n); k++)
        for (int i = 0; i < n; i++)
          for (int j = 0; j < n; j++)
            if (c[i][j] == 'Y' && k & (1 << i) && k & (1 << j) && d[k - (1 << i) - (1 << j)] + 2 > d[k])
              d[k] = d[k - (1 << i) - (1 << j)] + 2;
              
      int max = 0;
      for (int i = 0; i < (1 << n); i++)
        if (d[i] > max)
          max = d[i];
          
      printf("%d\n", max);
      
      return 0;
    }

    ACM-задачка на динамику по подмножествам.
    Кто поймет, тому 5 ;)

    ystepanov, 22 Июля 2010

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

    +129

    1. 1
    2. 2
    {{ object.xml_data.file.read|safe }}
    {% if object.xml_data.file.close %}{% endif %}

    Мой говнокод. Django template. Не хотелось писать отдельный view, забацал все в шаблоне + generic views. Лень страшная сила)
    object.xml_data обычный FileField

    sbb, 22 Июля 2010

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

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    void get_tomorrow_date( struct timeval *date ) 
    { 
    sleep( 86400 ); // 60 * 60 * 24 
    gettimeofday( date, 0 ); 
    }

    Программистский шедевр на индусском форуме на тему «как узнать завтрашнюю дату» остался непревзойденным.

    REDNES, 22 Июля 2010

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

    +168

    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
    function endPanel()
    	{
    		if($this->type=="common" || $this->type=="common_blank")
    		{
    				?>
    								</div>
    						</div>
    				</div>
    				<?php
    		}
    		elseif($this->type=="common_short")
    		{
    				?>
    								</div>
    						</div>
    				</div>
    				<?php
    		}
    		elseif($this->type=="main" || $this->type=="main_small")
    		{
    			?>
    					</div>
    				</div>
    				<div class="bottom">
    					<div class="bottom-right"></div>
    				</div>
    			</div>
    			<?php
    		}
    		elseif($this->type=="light" || $this->type=="light_blank" || $this->type=="light_narrow")
    		{
    			?>
    					</div>
    				</div>
    				<div class="bottom">
    					<div class="bottom-right"></div>
    				</div>
    			</div>
    			<?php
    		}
    	}

    Прислали на работе проект на доработку, мало того предыдущий программер не знает про разделение логики и представления, дак еще и такие штуки на каждом шагу встречаются

    xoros, 22 Июля 2010

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

    +156

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    <?php
    
    if(true) {
    ...
    }
    else $blacklist_numbers_error="неверный тип файла";
    
    ?>

    разбираю на работе код ><

    DmitryDick, 22 Июля 2010

    Комментарии (28)
  8. PHP / Говнокод #3757

    +167

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    <?php
    // Парсируем установочный файл
    if(@parse_ini_file("../../phpshop/inc/config.ini",1))
    $SysValue=parse_ini_file("../../phpshop/inc/config.ini",1);
     elseif(@parse_ini_file("../../../phpshop/inc/config.ini",1))
        $SysValue=parse_ini_file("../../../phpshop/inc/config.ini",1);
    	  elseif(@parse_ini_file("../../../../phpshop/inc/config.ini",1))
    	      $SysValue=parse_ini_file("../../../../phpshop/inc/config.ini",1);
    	     else $SysValue=@parse_ini_file("../../../../../phpshop/inc/config.ini",1);

    PHPShop

    Under, 22 Июля 2010

    Комментарии (21)
  9. C# / Говнокод #3756

    +118

    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
    void Say(bool work)
            {
                if (work)
                {
                    r = new Random();
                    i = r.Next(100);
                    textBlock1.Text = i.ToString();
    
                    textBlock1.Dispatcher.BeginInvoke(new AsyncSay(this.Say), DispatcherPriority.SystemIdle, null);
                }
            }
    
    void BtnSay_Click(object sender, RoutedEventArgs e)
            {
                Say(true);
            }
    
            private void BtnStopSay_Click(object sender, RoutedEventArgs e)
            {
                Say(false);
            }

    sergylens, 22 Июля 2010

    Комментарии (6)
  10. C# / Говнокод #3755

    +144

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    // Assembly2.cs
    // Compile with: /target:library
    public class BaseClass 
    {
       infernal static int intM = 0;
    }

    Это пример из MSDN.
    На самом деле там был internal static int. Просто я сегодня много работал. Мало ли что покажется. :)

    anmiles, 21 Июля 2010

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