- 1
http://rghost.ru/23248281
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+90
http://rghost.ru/23248281
+90
Procedure TfMain.CheckButtonsStatus;
begin
// Если есть кто-то в персональной очереди, то возобновить активна
if (dMain.PersonalQueueQuery.RecordCount > 0) then
TImageButton(mButtons[6]).mlabel.Enabled := true
else
TImageButton(mButtons[6]).mlabel.Enabled := False;
// 'приглашен', 3, 'оповещен', 4, 'оповещен', 5, 'прием начат')
if (dMain.StateQuery.FieldValues['state'] = 'свободно') then
begin
TImageButton(mButtons[0]).mlabel.Enabled := False;
TImageButton(mButtons[1]).mlabel.Enabled := False;
if dMain.CommonQueueQuery.RecordCount > 0 then
TImageButton(mButtons[2]).mlabel.Enabled := true
else
TImageButton(mButtons[2]).mlabel.Enabled := False;
TImageButton(mButtons[3]).mlabel.Enabled := False;
TImageButton(mButtons[4]).mlabel.Enabled := False;
TImageButton(mButtons[5]).mlabel.Enabled := False;
OperPopupMenu.Items[0].Enabled := False;
end;
if (dMain.StateQuery.FieldValues['state'] = 'приглашен') or
(dMain.StateQuery.FieldValues['state'] = 'оповещен') then
begin
TImageButton(mButtons[0]).mlabel.Enabled := true;
TImageButton(mButtons[1]).mlabel.Enabled := False;
TImageButton(mButtons[2]).mlabel.Enabled := False;
TImageButton(mButtons[3]).mlabel.Enabled := true;
TImageButton(mButtons[4]).mlabel.Enabled := False;
TImageButton(mButtons[5]).mlabel.Enabled := False;
TImageButton(mButtons[6]).mlabel.Enabled := False;
if (dMain.StateQuery.FieldValues['state'] = 'приглашен') then
OperPopupMenu.Items[0].Enabled := False
else
OperPopupMenu.Items[0].Enabled := true;
end;
if (dMain.StateQuery.FieldValues['state'] = 'прием начат') then
begin
TImageButton(mButtons[0]).mlabel.Enabled := False;
TImageButton(mButtons[1]).mlabel.Enabled := true;
TImageButton(mButtons[2]).mlabel.Enabled := False;
TImageButton(mButtons[3]).mlabel.Enabled := False;
TImageButton(mButtons[4]).mlabel.Enabled := true;
TImageButton(mButtons[5]).mlabel.Enabled := true;
TImageButton(mButtons[6]).mlabel.Enabled := False;
OperPopupMenu.Items[0].Enabled := False;
end;
end;
На работе достался проект, состоящий чуть менее чем полностью из подобных высеров.
+90
@Override
public Object clone() {
try {
return super.clone();
} catch (Exception e) {
return this;
}
}
"Клонирование"
+90
Uses CRT;
const
a=10;
b=21;
c=30;
Var
max: integer;
Begin
if (a>b) then
if (a>c) then
begin
max:=a;
end
else max:=c;
if (b>a)then
if (b>c)then
max:=b
else
max:=c;
Writeln(max);
if (max mod 5 = 0 ) then
writeln ('Кратное')
else writeln('некратное');
End.
+90
if (name != null ? !name.equals(module.name) : module.name != null) return false;
return true;
+90
if DirectoryExists(ExtractFilePath(Application.ExeName)+'Folder')=false then
CreateDir(ExtractFilePath(Application.ExeName)+'Folder');
+90
procedure TForm1.registration;
var
reg:TRegistry;
i,lbc:integer;
aentsys,alawarkey:boolean;
const
dw:DWORD =1800000;
begin
reg:=TRegistry.Create;
reg.RootKey:=HKEY_CURRENT_USER;
aentsys:= reg.KeyExists('software\Aent Sys');
alawarkey:=reg.KeyExists('software\Alawar');
//aentsys
if aentsys = true then
begin
reg.OpenKey('software\Aent Sys\pr',true);
reg.GetKeyNames(ListBox1.Items);
reg.CloseKey;
lbc:=listbox1.Items.Count;
sProgressBar1.Max:=lbc*10;
i:=0;
while not (i=lbc) do
begin
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('software\Aent Sys\pr',true);
reg.OpenKey(ListBox1.Items.Strings[i],true);
reg.GetKeyNames(ListBox2.Items);
reg.OpenKey(ListBox2.Items.Strings[0],true);
reg.WriteInteger('Program',dw);
sProgressBar1.Position:= sProgressBar1.Position+10;
i:=i+1;
listbox2.Clear;
reg.CloseKey;
end;
end;
i:=0;
listbox2.Clear;
listbox1.clear;
lbc:=0;
//alawar key
if alawarkey = true then
begin
reg.OpenKey('software\Alawar\play',true);
reg.GetKeyNames(ListBox1.Items);
reg.CloseKey;
lbc:=listbox1.Items.Count;
sProgressBar1.Max:=lbc*10;
i:=0;
while not (i=lbc) do
begin
reg.RootKey:=HKEY_CURRENT_USER;
reg.OpenKey('software\Alawar\play',true);
reg.OpenKey(ListBox1.Items.Strings[i]+'\trial',true);
reg.GetKeyNames(ListBox2.Items);
reg.OpenKey(ListBox2.Items.Strings[0],true);
reg.WriteInteger('Program',dw);
sProgressBar1.Position:= sProgressBar1.Position+10;
i:=i+1;
listbox2.Clear;
reg.CloseKey;
end;
end;
end;
Заново даёт триццать минут для игры от компании Alawar))) аццкое гавно
+89.9
static char DigitToChar(
int _Digit
)
{
switch (_Digit)
{
case 0: return '0';
case 1: return '1';
case 2: return '2';
case 3: return '3';
case 4: return '4';
case 5: return '5';
case 6: return '6';
case 7: return '7';
case 8: return '8';
case 9: return '9';
default: return ':';
}
}
в результате долгих размышлений всетаки заменили на return '0' + _Digit;
+89.5
private void ProcessActionsLookup(object sender)
{
LookUpEdit lookUpEdit = sender as LookUpEdit;
if (lookUpEdit != null)
{
if (lookUpEdit.EditValue != null)
{
if (lookUpEdit.EditValue.Equals(currentActionLookupValue))
{
if (actionsGridControlBindingSource.Current != null &&
!_presenter.ActionHasProperParameters(actionsGridView.FocusedRowHandle))
{
SetDataSourceForInnerGrid(sender);
}
}
else
{
SetDataSourceForInnerGrid(sender);
}
}
else
{
SetDataSourceForInnerGrid(sender);
}
}
}
Мы пойдем другим путем.
Некоторые скажут что в представленном контексте абсолютно нормальный код, я все же не соглашусь
+89.4
<option name="d">
<select value="collection">Коллекции</select>
<select value="cash">В наличии</select>
<select value="documents">Выставки</select>
<select value="bio">Биография</select>
<select value="int">Интерьер</select>
</option>
HTML без комментариев) Я валялся от смеха, когда увидел :D