- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
public void isChangenabledExc(){
if(isNew){
return;
}
if(true)return;//TODO
if(!isChangenabled()){
throw new ChangeEIsNotLockedException();
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+76.8
public void isChangenabledExc(){
if(isNew){
return;
}
if(true)return;//TODO
if(!isChangenabled()){
throw new ChangeEIsNotLockedException();
}
}
В этой функции находится единственный коментарий из всего файла.
Видимо в планах эта функция должна была делать нечто хорошее, но
планы так и не были осуществелны.
В результате получилась функция, которая ничего не делает, а только проверяет какие то условия.
поиском обнаружил 5 вызовов этой функции.
+118
<asp:Repeater runat="server" ID="rpAccountType">
<ItemTemplate>
<input type="checkbox" name="cbGroupAccountType" id="cbAccountType_<%#((KeyValuePair<string, object>)Container.DataItem).Value %>" value="<%#((KeyValuePair<string, object>)Container.DataItem).Value %>" <asp:Literal Id="lAccountTypeChecked" runat="server" />/><label for="cbAccountType_<%#((KeyValuePair<string, object>)Container.DataItem).Value %>"><asp:Literal runat="server" ID="lAccountTypeName" /></label><br />
</ItemTemplate>
</asp:Repeater>
ASP.NET. Значения генерируемых чекбоксов, в задумке, еще и на code-behind сильно влияют.
−88
if (_root["currKeyState"] == 3 and _root["currKeyStateCaps"] == "off") {
_root["currKeyState"] = 1;
if ("titleNewRec" == _root["currentInput"] or "msgText" == _root["currentInput"] or "prvSearchStr" == _root["currentInput"] or "mdengiId" == _root["currentInput"] or "fio" == _root["currentInput"] or "alfabplace" == _root["currentInput"] or "commut" == _root["currentInput"]) {
} else {
}
} else if (_root["currKeyState"] == 4 and _root["currKeyStateCaps"] == "off") {
_root["currKeyState"] = 2;
if ("titleNewRec" == _root["currentInput"] or "msgText" == _root["currentInput"] or "prvSearchStr" == _root["currentInput"] or "mdengiId" == _root["currentInput"] or "fio" == _root["currentInput"] or "alfabplace" == _root["currentInput"] or "commut" == _root["currentInput"]) {
} else {
}
}
Хотел посмотреть, как реализована логика в старом коде и нашел вот это...
+152.9
procedure TForm1.Button2Click(Sender: TObject);
var i:dword;
begin
if (Checkbox1.Checked)or(Checkbox3.Checked)or(Checkbox2.Checked) then
begin
form1.Cursor:=crhourglass;
Sleep(500);
progressbar1.Position:=10;
Sleep(1000);
progressbar1.Position:=20;
Sleep(500);
progressbar1.Position:=50;
Sleep(1000);
progressbar1.Position:=100;
Sleep(500);
end;
Трудимся в поте лица. :D
+99.3
procedure setrandomdoubleprecision(value:byte);
begin
precision:=10*value;
end;
function rangerandomdouble(minrandomdouble,maxrandomdouble:double):double;
begin
result:=randomdouble(maxrandomdouble+(-minrandomdouble))+minrandomdouble
end;
function randomdouble(maxdouble:double):double;
var
l1,l2:integer;
begin
l1:=random(trunc(maxdouble));
l2:=random(trunc(frac(maxdouble)*precision));
result:=l1+(l2/precision)
end;
Рандом с заданной точностью. O_o
+87.9
function LockBack:bool;
var sd:tddsurfacedesc2;
begin
fillchar(sd,sizeof(sd),0);
sd.dwSize:=sizeof(sd);
result:=fbacksurface.Lock(nil,sd,DDLOCK_SURFACEMEMORYPTR or ddlock_nosyslock or DDLOCK_WAIT,0)=dd_ok;
if not result then exit;
BackPtr:=sd.lpSurface;
end;
function UnLockBack:bool;
begin
result:=fbacksurface.UnLock(nil)=dd_ok;
BackPtr:=nil;
end;
function MakeSceenBackPtr:bool;
begin
result:=true;
if backptr=nil then
result:=lockBack;
end;
function GetSceenSafeBackPtr:pointer;//use only this
begin
result:=nil;
if not MakeSceenBackPtr then exit;
result:=backptr;
end;
Тот же проЭкт, что и ниже на DirectDraw7.
Не смотря на то, что была функция function UnLockBack:bool; - она никогда не вызывалась. Странно, что на многих машинах это работало, тк я успешно выполнял блитинг в заблокированные поверхности в течении многих часов. :D
+66.2
<!-- Подготавливаем счётчик для цикла -->
<xsl:variable name="i-tree">
<i/><i/><i/><i/><i/><i/>
<i/><i/> <i/><i/> <i/><i/>
<i/><i/><i/> <i/><i/><i/> <i/>
<i/><i/><i/><i/><i/><i/><i/>
<i/> <i/>
<i/><i/><i/><i/><i/><i/>
</xsl:variable>
<xsl:variable name="i" select="exslt:node-set($i-tree)/i" />
<!-- Подготавливаем параметр ссылок -->
<xsl:variable name="links">
<links next="0" previous="1">
<xsl:for-each select="$i[position() <= $date/@mday]">
<link mday="{position()}" />
</xsl:for-each>
</links>
</xsl:variable>
<div id="archive">
<xsl:call-template name="calendar">
<xsl:with-param name="title" select="'Архив'" />
<xsl:with-param name="url" select="concat($url_path,'%date%/')" />
<xsl:with-param name="links" select="exslt:node-set($links)/links" />
</xsl:call-template>
</div>
Вот так и мучаемся без for циклов в xsl
+161.4
function formatDate($mysqlDate, $time = false) {
$date = "";
if (is_int($mysqlDate))
$stamp = $mysqlDate;
else
$stamp = strtotime($mysqlDate);
$date .= date("j", $stamp) . " ";
$date .= $this->months[date("n", $stamp) - 1] . " ";
$thisYear = date("Y", time());
$year = date("Y", $stamp);
if ($thisYear != $year)
$date .= ", " . date("Y", $stamp);
if ($time)
$date .= " " . date("H:i", $stamp);
if ($time) return date("d/m/Y H:i");
else return date("d/m/Y");
return $date;
}
интересен ход мыслей программиста=)
−128.8
#102 Проверка конфигурации PHP в консоли
$ php -r "phpinfo\(\);"
php -i уже не в моде
+154.1
#include <iostream.h> //n
int main ()
{
int i;
for (i<7565445 ;;)
for (i<3564645;;)
for (i++;;)
for (i>34543546;;)
for (i>6;;)
cout <<"23 9 34 0-932 409 5494395 439 543-5435 3-953-5340";
cout <<" 1-1-1-1-1-1-11-1-1-1-1-";
return 0;
}
говнокод?xD