1. C# / Говнокод #5025

    +110

    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
    protected void Page_Load(object sender, EventArgs e)
            {
                Common.CheckAuthorization(Response, Session);     
    
                string uniqueID = Request["__EVENTTARGET"];
                if (uniqueID != null)
                {
                    UpdatePanel.ContentTemplateContainer.Controls.Clear();
                    string controlPath;
                    Control control = GetViewControlOnEvent(uniqueID, out controlPath);
    
                    if (control != null)
                    {
                        UpdatePanel.ContentTemplateContainer.Controls.Add(control);
                        Helpers.SetKeyInSession(Common.CATALOG_KEYS.CONTROL_PATH, controlPath, Session);
                    }
                    else
                    {
                        UpdatePanel.ContentTemplateContainer.Controls.Add(
                            GetViewControlOnSession());
                    }
                }
                else
                {
                    if (ControlParam == null)
                        Helpers.SetKeyInSession(Common.CATALOG_KEYS.CONTROL_PATH, Common.PATHS.USER_CONTROLS.MAIN_CONTROL, Session);   
    
                    UpdatePanel.ContentTemplateContainer.Controls.Add(
                        GetViewControlOnSession());
                }
                TreeViewState.SaveTreeView(treeCatalogs, this.GetType().ToString());
    
                this.PreRender += OnPreRender;
            }

    Nigma143, 22 Декабря 2010

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

    +145

    1. 1
    for(rptr=0;rptr<10;rptr++) // пока очередь не опустела

    выборка элементов из FIFO =D

    resettik, 22 Декабря 2010

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

    +167

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    T toPower(T base, int exponent)
    {
    	//cout << "++++++++Start template+++++++++++++" << endl;
    	T result = base;
    	if(exponent == 0) return (T)1;
    	if(exponent < 0) return (T)0;
    
    	while(--exponent)
    		result *= base;
    	//cout << "++++++++Finish template++++++++++++" << endl;
    	return result;
    }

    1_and_0, 22 Декабря 2010

    Комментарии (30)
  4. Pascal / Говнокод #5022

    +106

    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
    function IsRunningWithAdminPrivs: Boolean;
    begin
    var
      List: TStringList;
    begin
      List := TStringList.Create;
      try
        try
          List.Text := 'Sample';
          // Use SHGetFolder path to retreive the program files folder
          // here is hardcoded for the sake of the example
          List.SaveToFile('C:\program files\test.txt');
          Result := True;
        except
          Result := False;
        end;
      finally
        List.Free;
        DeleteFile('C:\program files\test.txt');
      end;
    end;

    Нуфф Саид

    bugmenot, 22 Декабря 2010

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

    +145

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    if(blya_check($baba_id))
    {
    	mysql_query("update {$prefX}actions set `count`=`count`+1 where id='{$baba_id}'");
    	blya_log($baba_id);
    }

    De-Luxis, 22 Декабря 2010

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

    +159

    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
    $link = 'http://www.logofon.ru/xml/ips.xml';
    
    $file = win_to_utf(file_get_contents($link));
    
    $file = trim(substr((substr($file,0,strripos($file,'</operators>'))),(stripos($file,'<operators>') + 11)));
    
    #echo substr_count($file,'<operator').'<br />';
    
    #preg_match_all('|\<operator(.*)\>(.*)\<\/operator\>|sUu',$file,$res);
    #array_dump($res);
    
    preg_match_all('|\<operator id="([0-9]*)" name="([[:space:]a-zA-Zа-яА-ЯёЁ0-9-(){}_.:]*)" label="([[:space:]a-zA-Z0-9]*)" tld="([a-zA-Z0-9]*)" country="([[:space:]a-zA-Zа-яА-Я0-9-(){}_.]*)" publish="([0-9]*)"\>(.*)\<\/operator\>|Usu',$file,$result);
    
    
    
    //-- Количество операторов
    $count_oper = count($result[0]);
    
    //-- Массив операторов
    $operators = array();
    
    //-- Запускаем цикл
     for($i = 0;$i < $count_oper; $i ++)
    {
    //-- Массив текущего оператора
    $operators[$i] = array();
    
    $operators[$i]['id'] = $result[1][$i];
    $operators[$i]['name'] = $result[2][$i];
    #$operators[$i]['label'] = $result[3][$i];
    $operators[$i]['tld'] = $result[4][$i];
    $operators[$i]['country'] = $result[5][$i];
    
    
    
    //-- Создаем базы IP
    $operators[$i]['ip'] = array();
    
    preg_match_all('|\<range ip1="([0-9]{10})" ip2="([0-9]{10})" mode="([0-9]*)" \/\>|Usu',$result[7][$i],$result2);
    #echo '<b>#'.($i + 1).'.</b>'.htmlspecialchars($result[7][$i]).'<br />';
    #array_dump($result2);
    
    //-- Количество диапазанов для текущего опера
    $count_ip = count($result2[0]);
    
    //-- Еще один цикл
      for($j = 0;$j < $count_ip; $j ++)
     {
     	query("INSERT INTO `$db[prefix]ips` SET `name`='{$operators[$i]['name']}',`id_op`='{$operators[$i]['id']}',`country`='{$operators[$i]['country']}',`tld`='{$operators[$i]['tld']}',`ip1`='{$result2[1][$j]}',`ip2`='{$result2[2][$j]}' ")or my_error();
    # $operators[$i]['ip'][$j] = array($result2[1][$j],$result2[2][$j]);
    #echo long2ip($result2[1][$j]).' --- '.long2ip($result2[2][$j]).'<br />';
     }
    
    }
    
    
    echo 'Операторов после : <b>'.($count_op_after = mysql_num_rows(query("SELECT COUNT(*) FROM `$db[prefix]ips` GROUP BY `id_op` "))).'</b><br />';
    echo 'Диапазонов после : <b>'.($count_di_after = mysql_result(query("SELECT COUNT(*) FROM `$db[prefix]ips` "),0)).'</b><br />';

    Парсинг диапазонов IP мобильных операторов

    Morgan, 22 Декабря 2010

    Комментарии (13)
  7. JavaScript / Говнокод #5019

    +164

    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
    function createSettings()
        {
        
            var queryVariables = getQueryVariables();
    
            var settings =
                "<settings"+"\n"+
                "	map_type=\"combine\""+"\n";
            if (queryVariables["workspaceId"] != undefined)
                settings += "	default_ws_id=\"" + queryVariables["workspaceId"] + "\""+"\n";
            else settings += "	default_ws_id=\"2\""+"\n";
    
            if (queryVariables["scaleLevel"] != undefined)
                settings += "	start_scale=\"" + queryVariables["scaleLevel"] + "\""+"\n";
            else settings += "	start_scale=\"1\""+"\n";
    
            if (queryVariables["x"] != undefined)
                settings += "	start_x=\"" + queryVariables["x"] + "\""+"\n";
            else  settings += "	start_x=\"50.06542\""+"\n";
    
            if (queryVariables["y"] != undefined)
                settings += "	start_y=\"" + queryVariables["y"] + "\""+"\n";
            else settings += "	start_y=\"42.335648\""+"\n";
    
    
      
            settings +=
                "	max_objects_to_load =\"1000000\""+"\n"+
                "	thematic_layers_opacity=\"0.5\""+"\n"+
                "	min_chart_square=\"2000\""+"\n"+
                "	vector_parallel_load=\"true\""+"\n"+
                "	draw_when_vector_loaded=\"true\""+"\n"+
                "	min_dist_points=\"50\""+"\n"+
                "	min_dist_points_labels=\"20\""+"\n"+
                "	min_dist_mpoints=\"10\""+"\n"+
                "	min_dist_mpoints_labels=\"20\""+"\n"+
                "	show_points_for_new_selection=\"true\""+"\n"+
                "	waves_color=\"white\""+"\n"+
                "	skin=\"blue.swf\""+"\n"+
                "	info1=\"Геопортал Роскосмоса\" "+"\n"+
    
                '	username="guest" '+"\n"+
                '	password="8071c11b0c08015469a2b48b750849a0" '+"\n"+
    
                /*"	username=\"guest\""+"\n"+
                    "	password=\"8071c11b0c08015469a2b48b750849a0\""+"\n"+*/
    
              
    
                " />";
          
            return settings;
        }

    Роскосмос запустил конкурента Google Maps
    http://lenta.ru/news/2010/12/21/geoportal/

    Геопортал разрабатывался ОАО "Российские космические системы" совместно с НИИ точных приборов.
    На создание ресурса было потрачено 10 миллионов рублей.

    http://geoportal.ntsomz.ru/

    mrbig66, 22 Декабря 2010

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

    +181

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    int maxOf5(int a, int b, int c, int d, int e) {
            int arr[5];
            arr[0] = a;
            arr[1] = b;
            arr[2] = c;
            arr[3] = d;
            arr[4] = e;
            bubbleSort(&arr, 5);
            return arr[0];
    }

    no comments...

    wh_, 22 Декабря 2010

    Комментарии (52)
  9. JavaScript / Говнокод #5017

    +160

    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
    var countdownfrom=35*10
    
    
    	var currentsecond=document.getElementById('countdown').innerHTML=countdownfrom+1
    
    
    	function cntredirect(){
    
    	if (currentsecond!=0){
    	currentsecond-=1
    	curs=currentsecond/10
    	cc=curs
    	cc=cc.toString();
    	if(curs>=10)
    	if(cc.length<4)cc=cc+".0";
    
    	if(curs<10){
    
    	if(cc.length<3)cc=cc+".0";
    	}
    	document.getElementById('countdown').innerHTML=cc
    	}
    	else{
        		document.getElementById('linkplace').innerHTML=' <a href="'+'http://dl4.rapidshare.ru/1710955/24966/GK.komprenda.user.js">Щелкните здесь для скачивания файла (ссылка активна 12 часов)</a>'
        
    	return
    	}
    	setTimeout("cntredirect()",100)
    	}
    	
    	cntredirect()

    славянская рапида, реализация обратного отсчета

    bugmenot, 22 Декабря 2010

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

    +118

    1. 1
    2. 2
    3. 3
    4. 4
    5. 5
    6. 6
    7. 7
    8. 8
    9. 9
    public void AllSolutionButtons(bool TrueOrFalse)
            {
                SetButtons("TopCorners", TrueOrFalse);
                SetButtons("TopWings", TrueOrFalse);
                SetButtons("BottomCorners", TrueOrFalse);
                SetButtons("BottomWings", TrueOrFalse);
                SetButtons("middleSlice", TrueOrFalse);
                SetButtons("Solve", TrueOrFalse);
            }

    У меня зла не хватает ...... как вообще так можно писать ... а главное как такое придумать можно %)

    Arbium, 22 Декабря 2010

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