- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
while(ba.bytesAvailable)
{
try
{
var b:String = ba.readUTFBytes(1);
bas[bas.length - 1] += b;
}
catch(e:Error)
{
bas.push("");
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−122
while(ba.bytesAvailable)
{
try
{
var b:String = ba.readUTFBytes(1);
bas[bas.length - 1] += b;
}
catch(e:Error)
{
bas.push("");
}
}
Это тот же человек, который до этого XML из строк сам строил. Теперь ему нужно было прочитать несколько строк из потока, разделенныхе нуль-байтами.
+145
#include <stdio.h>
int main(int argc,char argv)
{
int start=90;
int end=2;
int divd=10;
for(int i=start;i>=end;i--)
{
if(i>=10){
for(int nm=10;nm>=1;nm--)
{
int res=i/nm;
int ost=i%nm;
if(ost==0 && res<=10)printf("%d=%d*%d\n",i,res,nm);
};
} else {
for(int nm=i;nm>=1;nm--)
{
int res=i/nm;
int ost=i%nm;
if(ost==0)printf("%d=%d*%d\n",i,res,nm);
};
};
};
return 0;
};
Таблица умножения
+159
<?php
session_start();
require_once 'connection/ConnectionConfig.php';
require_once 'classes/DBClass.php';
$DB = new DB($host, $user, $password);
function LoadContent($DB) {
if (isset($_GET["ShowTable"]) || isset($_GET["ViewPage"]) || isset($_POST["Cancel"])) {
$DB->SelectBase($_SESSION["CurrentDB"]);
include 'loaders/view_table.te.php';
}
if (isset($_GET["NewRecord"]) || isset($_GET["EditRecord"])) {
if (isset($_GET["EditRecord"]) && (!isset($_GET["SelectedRecord"]))) {
$message = "Не выбрана запись для редактирования!";
include 'templates/message.te.html';
}
else
include 'loaders/edit_record.te.php';
}
if (isset($_POST["Save"])) {
include 'loaders/edit_function.te.php';
}
if (isset($_GET["DeleteRecord"])) {
if (!isset($_GET["SelectedRecord"])) {
$message = "Не выбрана запись для удаления!";
include 'templates/message.te.html';
} else {
include 'loaders/del_function.te.php';
}
}
}
function LoadMenu($DB) {
include 'loaders/menu_bases.te.php';
if (isset($_GET["SelectDatabase"])) {
$DB->SelectBase($_GET["SelectedDatabase"]);
$_SESSION["CurrentDB"] = $DB->GetCurrentBase();
}
if (isset($_SESSION["CurrentDB"]))
include 'loaders/menu_tables.te.php';
}
include 'templates/common.te.html';
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1251">
<link rel="stylesheet" type="text/css" href="style/style.css">
</head>
<body>
<table border="1" class="common">
<tr>
<td width="250" height="130">
<img src="image/logo1.jpg" alt="logo"/>
</td>
<td rowspan="2" valign="top">
<?php LoadContent($DB); ?>
</td>
</tr>
<tr>
<td valign="top" class="menu_container">
<?php LoadMenu($DB); ?>
</td>
</tr>
<tr>
<td colspan="2">
<p class="copyright">Разработано: 2011г. Автор: Тяготенков В.Э.</p>
</td>
</tr>
</table>
</body>
</html>
−135
var messageFormatedForClientView:String = "<font color=\u0022#" + VRSettings.chatClientColor + "\u0022>" + messageFormated + "</font>";
Человек "нашел выход"...
+159
/* Draw the legend of the active series */
function drawLegend($X,$Y,$Format="")
{
$Family = isset($Format["Family"]) ? $Format["Family"] : LEGEND_FAMILY_BOX;
...
$Mode = isset($Format["Mode"]) ? $Format["Mode"] : LEGEND_VERTICAL;
if ( $Surrounding != NULL ) { $BorderR = $R + $Surrounding; $BorderG = $G + $Surrounding; $BorderB = $B + $Surrounding; }
$YStep = max($this->FontSize,$BoxHeight) + 5;
$XStep = $BoxWidth + 5;
$XStep = $XSpacing;
$Data = $this->DataSet->getData();
$Boundaries = ""; $Boundaries["L"] = $X; $Boundaries["T"] = $Y; $Boundaries["R"] = 0; $Boundaries["B"] = 0; $vY = $Y; $vX = $X;
foreach($Data["Series"] as $SerieName => $Serie)
{
if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
{
if ( $Mode == LEGEND_VERTICAL )
{
$BoxArray = $this->getTextBox($vX+$BoxWidth+4,$vY+$BoxHeight/2,$FontName,$FontSize,0,$Serie["Description"]);
if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
$Lines = preg_split("/\n/",$Serie["Description"]);
$vY = $vY + max($this->FontSize*count($Lines),$BoxHeight) + 5;
}
elseif ( $Mode == LEGEND_HORIZONTAL )
{
$Lines = preg_split("/\n/",$Serie["Description"]);
$Width = "";
foreach($Lines as $Key => $Value)
{
$BoxArray = $this->getTextBox($vX+$BoxWidth+6,$Y+$BoxHeight/2+(($YStep-3)*$Key),$FontName,$FontSize,0,$Value);
if ( $Boundaries["T"] > $BoxArray[2]["Y"]+$BoxHeight/2 ) { $Boundaries["T"] = $BoxArray[2]["Y"]+$BoxHeight/2; }
if ( $Boundaries["R"] < $BoxArray[1]["X"]+2 ) { $Boundaries["R"] = $BoxArray[1]["X"]+2; }
if ( $Boundaries["B"] < $BoxArray[1]["Y"]+2+$BoxHeight/2 ) { $Boundaries["B"] = $BoxArray[1]["Y"]+2+$BoxHeight/2; }
$Width[] = $BoxArray[1]["X"];
}
$vX=max($Width)+$XStep;
}
}
}
$vY=$vY-$YStep; $vX=$vX-$XStep;
$TopOffset = $Y - $Boundaries["T"];
if ( $Boundaries["B"]-($vY+$BoxHeight) < $TopOffset ) { $Boundaries["B"] = $vY+$BoxHeight+$TopOffset; }
if ( $Style == LEGEND_ROUND ) $this->drawRoundedFilledRectangle(...);
elseif ( $Style == LEGEND_BOX ) $this->drawFilledRectangle(...);
$RestoreShadow = $this->Shadow; $this->Shadow = FALSE;
foreach($Data["Series"] as $SerieName => $Serie)
{
if ( $Serie["isDrawable"] == TRUE && $SerieName != $Data["Abscissa"] )
{
$R = $Serie["Color"]["R"]; $G = $Serie["Color"]["G"]; $B = $Serie["Color"]["B"];
$Ticks = $Serie["Ticks"]; $Weight = $Serie["Weight"];
if ( $Family == LEGEND_FAMILY_BOX )
}
$this->Shadow = $RestoreShadow;
}
Наша либа, которая рисует графики: функция рисующая легенду.
+174
if (!isEclipse() || window.name != ECLIPSE_FRAME_NAME) {titleBar_setSubTitle("D Index"); titleBar_setSubNav(false,false,false,false,false,false,false,false,false,false,false,false,false,false,false,false);}
Разбирал генератор документации, нашлось вот...
+145
int getRandomNumber()
{
return 4; // chosen by fair dice roll.
// guaranteed to be random.
}
Sony PlayStation 3
http://www.youtube.com/watch?v=LP1t_pzxKyE (4:13)
+145
#ifndef UTF8_ONLY
I HATE YOU!!!!
#endif
+159
function calls() {
//document.frm_param.form.value="client_calls";
//document.frm_param.title_.value="Работа с клиентом | Звонки";
s_url="$bill_cgi$?form=calls"+
"&date_begin=01.01.1990"+
"&date_end=01.01.2010"+
"&call_type=100"+
"&phone="+
"&to_phone="+
"&client=$client$"+
"&town_code="+
"&direction="+
"&zone="+
"&order_by=date_"+
"&order_by2="+
"&group_by="+
"&calls_recalc="+
"&calls_print=1";
window.top.location=s_url;
}
(c) Руслан Залата
+160
<?php
if ($res) {
$i=0;
while ( $arr = $res->fetchRow() )
{
$id = $arr['id'];
$userid = $arr['userid'];
$alias = $arr['alias'];
$startcity = $arr['startcity'];
$endcity = $arr['endcity'];
$godate = $arr['godate'];
$gohour = $arr['gohour'];
$gorecset = mapSetToWeekdays($arr['gorecset']);
$recdays = implode(" ", $gorecset);
$godate = ereg_replace("Mon", $l['mo'], $godate);
$godate = ereg_replace("Tue", $l['tu'], $godate);
$godate = ereg_replace("Wed", $l['we'], $godate);
$godate = ereg_replace("Thu", $l['th'], $godate);
$godate = ereg_replace("Fri", $l['fr'], $godate);
$godate = ereg_replace("Sat", $l['sa'], $godate);
$godate = ereg_replace("Sun", $l['su'], $godate);
$rides[$i] = array('id' => $id,
'userid' => $userid,
'alias' => $alias,
'startcity' => $startcity,
'endcity' => $endcity,
'gohour' => $gohour,
'godate' => $godate,
'recdays' => $recdays,
);
$i++;
}
$SMARTY->assign("rides", $rides);
}
Этот чудесный пример говнокода написал один финн, с которым мне приходится работать вместе.
Как видно, он, имея 4 года опыта разработки на PHP, так и не знает про extract(), compact(), а также про возможность использовать массивы в качестве аргументов str_replace. Хотя, в данном случае можно было просто написать $rides[] = $arr;