- 1
- 2
$('div.contain p ~ a[href$="jpg"]').attr('id', 'linker');
document.getElementById('linker').style.color = 'green';
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+158
$('div.contain p ~ a[href$="jpg"]').attr('id', 'linker');
document.getElementById('linker').style.color = 'green';
+111
/// <summary>
/// Получает IPAdress к которому нужно подключиться
/// </summary>
private int Get_IPAdress_Server()
{
string Buf = "";
for (int i = 0; i < Server_IP.Servers_IP.Length; i++ )
{
try
{
TcpClient tc = new TcpClient(Server_IP.Servers_IP[i], Server_IP.Servers_Port[i]);
byte[] buffer = new byte[19];
NetworkStream nss = tc.GetStream();
nss.Read(buffer, 0, 19);
Buf = Encoding.ASCII.GetString(buffer).Trim();
Server_IPAdress = Buf.Substring(0, Buf.IndexOf(":"));
Server_Port = int.Parse(Buf.Substring(Buf.IndexOf(":") + 1, Buf.Length - Buf.IndexOf(":") - 1));
return 0;
}
catch (SocketException)
{
}
}
return -1;
}
Получаем индекс в коллекции где хранятся список серверов Первый доступный!
+157
struct Vertex
{
float x, y, z;
float tu0, tv0;
} vertices[20000] =
{
-X, 0, Z, 0, 0,
X, 0, Z, 0, 0,
-X, 0, -Z, 0, 0,
X, 0, -Z, 0, 0,
0, Z, X, 0, 0,
0, Z, -X, 0, 0,
0, -Z, X, 0, 0,
0, -Z, -X, 0, 0,
Z, X, 0, 0, 0,
-Z, X, 0, 0, 0,
Z, -X, 0, 0, 0,
-Z, -X, 0, 0, 0,
};
+120
private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
{
ComboBox
cb = sender as ComboBox;
TextBox
tb = new TextBox();
if (cb == comboBox1)
{
tb = textBox7;
}
if (cb == comboBox2)
{
tb = textBox6;
}
if (cb == comboBox12)
{
tb = textBox2;
}
if (cb == comboBox3)
{
tb = textBox8;
}
if (cb == comboBox4)
{
tb = textBox9;
}
if (cb == comboBox5)
{
tb = textBox10;
}
if (cb == comboBox6)
{
tb = textBox11;
}
if (cb == comboBox7)
{
tb = textBox12;
}
if (cb == comboBox8)
{
tb = textBox13;
}
if (cb == comboBox11)
{
tb = textBox14;
}
tb.Enabled = !(cb.SelectedIndex > 0);
tb.Text = (cb.SelectedIndex > 0) ? "" : tb.Text;
}
+98
procedure TfmAllParams.NInsertParamSelebrationClick(Sender: TObject);
var
str: string;
begin
str := //Новый год
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '01.01.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(1,1,null,null,null) ' +
//День св. Валентина
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '14.02.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(14,2,null,null,null) ' +
//8 марта
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '08.03.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(8,3,' + #39 + 'жін.' + #39 + ',null,null) ' +
//1 мая
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '01.05.' + IntToStr(YearOf(GetServerDate)) + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,selebration_state,text_selebration,selebration_year)' +
' values(1,5,null,null,null) ' +
//Пасха
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '04.04.2010' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(4,4,' + #39 + 'Pasha' + #39 + ',2010) ' +
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '24.04.2011' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(24,4,' + #39 + 'Pasha' + #39 + ',2011) ' +
// И 10 таких же запросов на каждый год!
' if not exists (select id from sta_param_selebration ' +
' where date_selebration=' + #39 + '24.04.2022' + #39 + ' and text_selebration=' + #39 + 'Pasha' + #39 + ')' +
' insert into sta_param_selebration (selebration_day, selebration_month ,text_selebration,selebration_year)' +
' values(24,4,' + #39 + 'Pasha' + #39 + ',2022) ' +
+164
if (strlen($str)>1 && substr($str,strlen($str)-2,1)=="1") {
switch(substr($str,strlen($str)-1,1)) {
case "0": $newstr="десять рублей";break;
case "1": $newstr="одиннадцать рублей";break;
case "2": $newstr="двенадцать рублей";break;
case "3": $newstr="тринадцать рублей";break;
case "4": $newstr="четырнадцать рублей";break;
case "5": $newstr="пятнадцать рублей";break;
case "6": $newstr="шестнадцать рублей";break;
case "7": $newstr="семьнадцать рублей";break;
case "8": $newstr="восемьнадцать рублей";break;
case "9": $newstr="девятьнадцать рублей";break;}}
else {
switch(substr($str,strlen($str)-1,1)) {
case "0": $newstr="рублей";break;
case "1": $newstr="один рубль";break;
case "2": $newstr="два рубля";break;
case "3": $newstr="три рубля";break;
case "4": $newstr="четыре рубля";break;
case "5": $newstr="пять рублей";break;
.......................................
case "7": $newstr="семь миллионов ".$newstr;break;
case "8": $newstr="восемь миллионов ".$newstr;break;
case "9": $newstr="девять миллионов ".$newstr;break;}
if (strlen($str)>7) {
switch(substr($str,strlen($str)-8,1)) {
case "2": $newstr="двадцать ".$newstr;break;
case "3": $newstr="тридцать ".$newstr;break;
case "4": $newstr="сорок ".$newstr;break;
case "5": $newstr="пятьдесят ".$newstr;break;
case "6": $newstr="шестьдесят ".$newstr;break;
case "7": $newstr="семьдесят ".$newstr;break;
case "8": $newstr="восемьдесят ".$newstr;break;
case "9": $newstr="девяносто ".$newstr;break;}}}}
if (strlen($str)>8) {
switch(substr($str,strlen($str)-9,1)) {
case "0": $newstr="сто ".$newstr;break;
case "1": $newstr="сто ".$newstr;break;
case "2": $newstr="двести ".$newstr;break;
case "3": $newstr="триста ".$newstr;break;
case "4": $newstr="четыреста ".$newstr;break;
case "5": $newstr="пятьсот ".$newstr;break;
case "6": $newstr="шестьсот ".$newstr;break;
case "7": $newstr="семьсот ".$newstr;break;
case "8": $newstr="восемьсот ".$newstr;break;
case "9": $newstr="девятьсот ".$newstr;break;}}
Вот так делают "сумму прописью".
Радует и форматирование, и порядок порядков чисел в if .. elseif .. else
+162
function get_root($root, $is = 0)
{
if (!preg_match('/^\d+$/',$root))
{
print '\$root isn\'t an integer.';
return false;
}
if (!preg_match('/^\d+$/',$is))
{
print '\$is isn\'t an integer.';
return false;
}
if ($root > 511 || $root < 0)
{
print '\$root > 255 or \$root < 0';
return false;
}
if ($root < $is) return false;
$t_arr = array ('256', '128', '64', '32', '16', '8', '4', '2', '1');
if (!in_array($is, $t_arr) && $is != 0)
{
print '\$is isn\'t in array.';
return false;
}
if ($root == 0) return array('0');
$t_int = $root;
$t_root = array();
while ($t_int > 0)
{
for ($i = 0; $i < sizeof($t_arr); $i++)
{
if ($t_int >= $t_arr[$i])
{
$t_int -= $t_arr[$i];
$t_root[] = $t_arr[$i];
}
}
}
if ($is != 0)
{ if (in_array($is, $t_root)) return true;
else return false;
}
else return $t_root;
}
Немного опешив, я наконец-то понял, что это еще один велосипед.
+181
//Эта функция потенциальный источник багов. Я гарантирую это.
и дли-и-инная функция с кучей неясностей и без единого комента 0_0
Встретил в проекте
Похоже вместо того чтобы нормально коментировать код писавший это читал лурк...
+165
$config["maxcount"]=50;
...
$qwe = mysql_query("SELECT * FROM ...");
$i=0;
while($i<$config["maxcount"]){
$asd=mysql_result($qwe, $i, 0);
$asdasd=mysql_result($qwe, $i, 1);
$asdasdasd=mysql_result($qwe, $i, 2);
if($asd&&$asdasd&&$asdasdasd){
...
$i=$i+1;
}
}
Красивый код + красивые переменные.
И что будет если $asd=0 или в результате запроса не 50 строк? xD
−861
/* Ask Dian for changing this enormous DECODE */
sprintf( ranges_sort_condition,
"DECODE(CONTRACT_ID, '%s', 1, 0) + "
"DECODE(ISS_INST, '%s', 2, 0) + "
"DECODE(ACQ_INST, '%s', 4, 0) + "
"DECODE(ISS_BIN, '%s', 8, 0) + "
"DECODE(TERM_TYPE, %d, 16, 0) + "
"DECODE(IS_PRIMARY_CARD, %d, 32, 0), "
" 0, 1, 64, 2, 32, 3, 16, 4, 4, 5, 8, 6, 96, 7, 80, 8,"
" 68, 9, 72, 10, 40, 11, 24, 12, 12, 13, 2, 14, 10, 15, 48, 16,"
" 36, 17, 104, 18, 88, 19, 76, 20, 66, 21, 74, 22, 112, 23, 100, 24,"
" 56, 25, 44, 26, 34, 27, 42, 28, 20, 29, 28, 30, 18, 31, 6, 32,"
" 26, 33, 14, 34, 52, 35, 60, 36, 124, 37, 50, 38, 38, 39, 22, 40,"
"118, 41, 122, 42, 110, 43, 94, 44, 126, 45, 1, 46, 65, 47, 97, 48,"
" 81, 49, 5, 50, 73, 51, 105, 52, 89, 53, 77, 54, 67, 55, 75, 56,"
"113, 57, 121, 58, 101, 59, 109, 60, 99, 61, 107, 62, 85, 63, 93, 64,"
" 83, 65, 71, 66, 91, 67, 79, 68, 117, 69, 125, 70, 115, 71, 103, 72,"
" 87, 73, 119, 74, 59, 75, 47, 76, 95, 77, 63, 78, 127, 79, 999",
"-1", DEFAULT_INST_ID, DEFAULT_INST_ID, "-1", TERM_TYPE_DEF, IS_PRIMARY_DEF );
ora_sql_stmt_buff.len = sprintf( (char*)ora_sql_stmt_buff.arr,
"SELECT ACQ_INST, "
" ISS_INST, "
" ISS_BIN, "
" TERM_TYPE, "
" MSGTYPE, "
" TASK, "
" REVERSAL, "
" CONTRACT_ID, "
" IS_PRIMARY_CARD, "
" TMPL_ID "
" FROM T_TRANS_AUTH_ALG "
" WHERE TRANS_TYPE = :ora_trans_type "
" ORDER BY DECODE(%s)", ranges_sort_condition );
Это хоть и на Си, но формирование запроса SQL, так что попадает сюда.
Хоть бы комментарий какой написали, демоны!