- 1
У МИНЯ ЕСТЬ АЙФОН 5 И БАЛЬШОЙ ДОМ В МАЙНКРАВТЕ А ЧИВО ДАБИЛСЯ ТЫ?
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+132
У МИНЯ ЕСТЬ АЙФОН 5 И БАЛЬШОЙ ДОМ В МАЙНКРАВТЕ А ЧИВО ДАБИЛСЯ ТЫ?
Я БАГАТ И УСПЕШОН
+135
Byte[] content = setting.RecipientType == ReportRecipientType.A?
Processor.Process(Encoding.ASCII.GetBytes(report.Value),"A",String.Empty) :
setting.RecipientType == ReportRecipientType.B || setting.RecipientType == ReportRecipientType.BX?
Processor.Process (Encoding.ASCII.GetBytes(report.Value), "B", String.Empty) :
setting.RecipientType == ReportRecipientType.C?
Processor.Process (Encoding.UTF8.GetBytes(report.Value), "C", String.Empty) :
setting.RecipientType == ReportRecipientType.D?
Processor.Process (Encoding.UTF8.GetBytes(report.Value), "D", String.Empty) :
Processor.Process (Encoding.UTF8.GetBytes(report.Value), filename, DateTime.Now, setting.data);
Имена переменных и методов обфусцированы, но суть не в них.
Какой сумрачный гений родил такую управляющую структуру?
+138
if (newGame) resources.free();
s = FILENAME + 3;
setLocation(); load(s);
loadDialog.process();
try { setGamerColor(RED); }
catch(Exception e) { reset(); }
while (notReady) { objects.make();
if (resourceNotFound) break; }
byte result; // сменить на int!
music();
System.out.print("");
Читать с выражением!
+124
// System.Web.Security.FormsAuthentication
/// <summary>Returns the redirect URL for the original request that caused the redirect to the login page.</summary>
/// <returns>A string that contains the redirect URL.</returns>
/// <param name="userName">The name of the authenticated user. </param>
/// <param name="createPersistentCookie">This parameter is ignored.</param>
public static string GetRedirectUrl(string userName, bool createPersistentCookie)
{
if (userName == null)
{
return null;
}
return FormsAuthentication.GetReturnUrl(true);
}
http://msdn.microsoft.com/en-us/library/system.web.security.formsauthentication. getredirecturl.aspx
Разработчики ASP.NET'а опять доставляют... И не лень было столько параметров делать, а потом ещё и описывать...
+124
var
Form1: TForm1;
tlst:tthreadlist;
implementation
{$R *.dfm}
function getCount : integer;
begin
Result := tlst.LockList.Count;
tlst.UnlockList;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
tlst:=tthreadlist.Create;
end;
{ tmythread }
constructor tmythread.create(filename: string);
begin
self.FreeOnTerminate:=true;
self.filename:=filename;
inherited create(true);
self.Priority:=tphigher;
self.Resume;
tlst.LockList.Add(self);
tlst.UnlockList;
end;
destructor tmythread.destroy;
begin
tlst.Remove(self);
tlst.UnlockList;
end;
procedure tmythread.execute;
begin
while not terminated do
sleep(100); // в качестве примера, чем-то нагружаем цикл.
end;
procedure TForm1.Button2Click(Sender: TObject);
var
i:integer;
n:string;
temp:tmythread;
s:string;
begin
for i:=0 to getcount-1 do
begin
temp:=tlst.LockList.Items[i]; // вот это место. Как Вам кажется, это правильно, или не?
if assigned(temp) then
n:=temp.filename;
if n='ololo' then // это просто пример, не смеемся) АХАХАХАХ )
begin
showmessage('Сканирование этого файла уже выполняется') ;
exit;
end;
end;
tmythread.create('ololo');
end;
end.
Стоит задача сканировать файлы в разных потоках. Как Вам кажется, это адекватное решение?
+147
А не использовать ли нам пиписюнчик?
+125
sh-4.1$ make
make[1]: Entering directory `/cygdrive/c/CrossCompiler/binutils-2.8/libiberty'
echo "# !Automatically generated from ./functions.def"\
"- DO NOT EDIT!" >needed2.awk
grep '^DEFVAR(' < ./functions.def \
| sed -e '/DEFVAR/s|DEFVAR.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
>>needed2.awk
grep '^DEFFUNC(' < ./functions.def \
| sed -e '/DEFFUNC/s|DEFFUNC.\([^,]*\).*|/\1/ { printf "#ifndef NEED_\1\\n#define NEED_\1\\n#endif\\n" }|' \
>>needed2.awk
gcc -O2 -c -O2 -I. -I./../include -DNEED_sys_siglist -DNEED_basename -DNEED_strsignal ./dummy.c 2>/dev/null
make[1]: *** [dummy.o] Ошибка 1
make[1]: Leaving directory `/cygdrive/c/CrossCompiler/binutils-2.8/libiberty'
make: *** [all-libiberty] Ошибка 2
Угадайте чего оно хочет. Я не знаю (awk есть, если что).
+162
changeFace($arr) {
switch ($arr['custtype']) {
case 2: $facetype = 'Ф'; break; //Физическое
case 1: $facetype = 'Ю'; break; //Юридическое лицо
default: $facetype = ' '; break;
}
return $facetype;
}
В этом смысле лицо - "person"
+121
public int sum(final Type type, final int increment) {
switch(type) {
case REDOS:
return redos += increment;
case ONCE:
return onceRedoneOrders += increment;
case TWICE:
return twiceRedoneOrders += increment;
case THRICE:
return thriceRedoneOrders += increment;
case MORE:
return moreRedoneOrders += increment;
default:
break;
}
throw new RuntimeException();
}
Осталось в наследство. Даже не знаю, что хотел изобразить предыдущий оратор...
+162
$('html body table tbody tr td:nth-child(2) table tbody tr td table:nth-child(1) tbody tr:nth-child(2) td table tbody tr td:nth-child(2)')
from stackoverflow