- 1
- 2
- 3
- 4
- 5
private Boolean active = false;
...
synchronized (active) {
...
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+76
private Boolean active = false;
...
synchronized (active) {
...
}
Чудо синхронизации. Блокируется раз и навсегда.
+53
void _debugPrintWaveHeader(const char *path, const WAVHEADER &source_header)
{
FILE *debug = fopen("path", "wt");
fprintf(debug, "chunkId = %s\n", source_header.chunkId);
fprintf(debug, "chunkSize = %u\n", source_header.chunkSize);
fprintf(debug, "format = %s\n", source_header.format);
fprintf(debug, "subCh1Id = %s\n", source_header.subchunk1Id);
fprintf(debug, "subCh1Size = %u\n", source_header.subchunk1Size);
fprintf(debug, "audioform = %u\n", source_header.audioFormat);
fprintf(debug, "numChanels = %u\n", source_header.numChannels);
fprintf(debug, "sampleRate = %u\n", source_header.sampleRate);
fprintf(debug, "byteRate = %u\n", source_header.byteRate);
fprintf(debug, "blockAlign = %u\n", source_header.blockAlign);
fprintf(debug, "bitsPerSam = %u\n", source_header.bitsPerSample);
fprintf(debug, "subCh2Id = %s\n", source_header.subchunk2Id);
fprintf(debug, "subCh2Size = %u\n", source_header.subchunk2Size);
fclose(debug);
}
Начал разгребать один говнопроект... При отладке программа всё падает и падает, падает и не может остановится. Смотрю на код - все в норме, а потом, по прошествии нескольких часов...
+58
if(ext == ".wav")
{
if(main_header.bitsPerSample == 8)
{
switch(main_header.bitsPerSample)
{
case 8:
{
open_mode = n8bit_mode;
}break;
case 16:
{
open_mode = n16bit_mode;
}break;
default: open_mode = nNULL;
}
....далее какото код
}
...
+121
long longVariable = <...>;
...
double doubleVariable = new Double(longVariable).doubleValue();
Вот так делается по ВСЕМУ проекту, когда нужно перевести long в double.
+126
using питух = String;
...
protected питух AccessToken { get; set; }
В память о плавающем
+172
if ($year == '1996' && $year == '1995' && $year == '1994' && $year == '1993' && $year == '1992' && $year == '1991' && $year == '1990' && $year == '1989' && $year == '1988' && $year == '1987' && $year == '1986' && $year == '1985' && $year == '1984' && $year == '1983' && $year == '1982' && $year == '1981' && $year == '1980' && $year == '1979' && $year == '1978' && $year == '1977' && $year == '1976' && $year == '1975' && $year == '1974' && $year == '1973' && $year == '1972' && $year == '1971' && $year == '1970' && $year == '1969' && $year == '1968' && $year == '1967' && $year == '1966' && $year == '1965' && $year == '1964' && $year == '1963' && $year == '1962' && $year == '1960' && $year == '1959' && $year == '1958' && $year == '1957' && $year == '1956' && $year == '1955' && $year == '1954' && $year == '1953' && $year == '1952' && $year == '1951' && $year == '1950')
Я просто рыдаю. Мало того, что каждый год ручками вбит, так ещё и пользак должен обязательно быть рождённым во всех этих годах))
+124
class A
{
a:
Console.WriteLine("Буква А");
goto b;
}
Class B:A
{
b:
Console.WriteLine("Буква Б");
goto a;
}
Моему другу было нечего делать... Побробовал засорить мой комп.
+164
public function is_number($s){
$result = true;
for($i=0;$i<strlen($s); $i++){
switch($s[$i]){
case '0': break;
case '1': break;
case '2': break;
case '3': break;
case '4': break;
case '5': break;
case '6': break;
case '7': break;
case '8': break;
case '9': break;
default: $result = false; return;
}
}
return ($result) ? $s : int($s);
}
+158
function in($param) {
global
$_POST,
$_GET;
preg_match('#([^\[]+)(.*)#',$param,$match);
$match[2]=str_replace('[','["',$match[2]);
$match[2]=str_replace(']','"]',$match[2]);
$param2=eval('return htmlspecialchars(strip_tags($_POST["'.$match[1].'"]'.$match[2].'));');
if($param2=='' && $match[2]=='') {
$param2=eval('return htmlspecialchars(strip_tags($_GET["'.$match[1].'"]));');
}
return $param2;
}
Функция для фильтрации входящих переменных.
+131
module Main:
program factorial:
algorithm factorial:
description of the algorithm:
factorial of n is the algorithm that calculates the product of all the positive integers less than or equal to n.
end of description of the algorithm.
example of usage of the algorithm:
var1 is equal to call algorithm with parameter n which is equal to 5;
begin of a comment:
var1 is now1 120 = 5*4*3*2*1.
end of a comment.
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from other modules.
callable from this module.
can be used in expressions.
end of properties of the algorithm.
parameters of the algorithm:
data n: type is positive integer.
end of parameters of the algorithm.
variables of the algorithm:
data res: type is positive integer.
data now1: type is positive integer.
end of variables of the algorithm.
initialization of the variables of the algorithm:
res is equal to 1.
now1 is equal to n.
end of initialization of the variables of the algorithm.
begin of the algorithm:
cycle: while now1 is not 1, repeat:
res is equal to multiply res by now1.
now1 is equal to subtract 1 from now1.
end of cycle.
result of the algorithm is res
end of the algorithm.
algorithm main:
description of the algorithm:
main algorithm that shows the factorial of the inputted number.
end of description of the algorithm.
example of usage of the algorithm:
end of example of usage of the algorithm.
description of author of the algorithm:
name: John.
surname: Smith.
date of writing of the algorithm: 2009.
end of description of author of the algorithm.
properties of the algorithm:
callable from the system.
end of properties of the algorithm.
parameters of the algorithm:
data arguments: type is array of strings.
end of parameters of the algorithm.
variables of the algorithm:
end of variables of the algorithm.
initialization of the variables of the algorithm:
end of initialization of the variables of the algorithm.
begin of the algorithm:
call algorithm writeInteger with parameter str which is equal to
call algorithm factorial with parameter n which is equal to
call algorithm readInteger without parameters.
result of the algorithm is 0.
end of the algorithm.
Небольшой ответ набирающему популярность WCT. Новый язык программирования LOOOONG:
- Отступы обязательны.
- Все блоки в функциях ("алгоритмах") обязательны.
- блоки нужно записывать именно в таком порядке.
- Имена параметров необходимо помнить, когда вызываешь "алгоритм".
- Ключевых слов ОЧЕНЬ МНОГО.