- 1
NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys:@(NO?1:2), @"EVENT_VISIBILITY"];
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−126
NSDictionary *d = [NSDictionary dictionaryWithObjectsAndKeys:@(NO?1:2), @"EVENT_VISIBILITY"];
+136
begin
if(TimerVremya.Enabled = True) then
begin
if(CheckBox1.Checked = False) then
begin
Bass_channelPlay(Channel, false);
Panel1.Caption := 'Playing';
TimerFraza.Enabled := False;
end
else
begin
Bass_channelPlay(Privlek, false);
Timer2.Enabled := True;
TimerFraza.Enabled := False;
end;
end;
А не ударить ли нам по басам? Вот только запашок не к месту, с чего бы такая оказия?..
+141
function GetProcessUser(aPID: Cardinal; var aResult: string): Boolean;
type
PTOKEN_USER = ^TOKEN_USER;
_TOKEN_USER = record
User: TSidAndAttributes;
end;
TOKEN_USER = _TOKEN_USER;
var
cbBuf: Cardinal;
ptiUser: PTOKEN_USER;
snu: SID_NAME_USE;
hToken, hProcess: THandle;
UserSize, DomainSize: Cardinal;
bSuccess: Boolean;
sUser, sDomain: string;
begin
Result := False;
hProcess := OpenProcess(PROCESS_QUERY_INFORMATION, False, aPID);
if hProcess <> 0 then
begin
if OpenProcessToken(hProcess, TOKEN_QUERY, hToken) then
begin
bSuccess := GetTokenInformation(hToken, TokenUser, nil, 0, cbBuf);
ptiUser := nil;
while (not bSuccess) and (GetLastError = ERROR_INSUFFICIENT_BUFFER) do
begin
ReallocMem(ptiUser, cbBuf);
bSuccess := GetTokenInformation(hToken, TokenUser, ptiUser, cbBuf, cbBuf);
end;
CloseHandle(hToken);
if not bSuccess then
Убило название. Дальше можете не читать.
http://www.programmersforum.ru/showthread.php?t=242541
+134
procedure TForm1.BitBtn1Click(Sender: TObject);
var
MText ,temp: string;
memorystream:tmemorystream;
link:string;
i:integer;
startpos,endpos:integer;
stag,etag:string;
c:integer;
begin
stop:=false;
try
memorystream:=tmemorystream.create;
stag:='target="_blank" href="#url?to=';
memorystream.clear;
try
idhttp1.Get('http://otvet.mail.ru/93516',memorystream);
except
end;
if idhttp1.connected=true then
idhttp1.Disconnect;
mtext:=memo1.text;//memorystreamtostring(memorystream);
memo1.lines.add(mtext);
// Выдает access violation
StartPos := 0;
endpos:=0;
while (true) do
begin
startPos := Posex(stag, MText,startpos+1);
endPos := PosEx(etag, MText, startPos);
if startpos>0 then
begin
temp := Copy(MText, startPos, endPos - startPos);
Memo2.lines.add(temp);
end
else
break;
end;
finally
end;
end;
Вонь стоит жуткая. Тому, кто первым найдет ошибку, поставлю пятерку)
Ы.з. Это мой сотый код, так что теперь я на все 100% с Вами) обнимаю вас всех.
+110
// Двухклеточная прямая.
({D2A2}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clBlack) and{D2A2} (Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite) and{D2A2}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A2}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A2}
({D2A2A-1}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite) and{D2A2A-1}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite) and{D2A2A-1}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clBlack) and{D2A2A-1}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A2A-1}
({D2A3}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite) and{D2A3}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack) and{D2A3}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A3}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite) and{D2A3}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2A3}
({D2A4}(Pixels[X+h,Y-1]=clBlack) and(Pixels[x+h,y-2]=clBlack) and(Pixels[x+h,y-3]=clWhite) and{D2A4}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite) and{D2A4}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2A4}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite)) or {D2A4}
... Ещё 20 строк в таком стиле
({D2B2}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clBlack) and{D2B2}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clWhite) and{D2B2}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2B2}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite) and{D2B2}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2B2}
({D2B3}(Pixels[X+h,Y-1]=clWhite) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clWhite) and{D2B3}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack) and{D2B3}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2B3}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite) and{D2B3}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) or {D2B3}
({D2B4}(Pixels[X+h,Y-1]=clBlack) and(Pixels[x+h,y-2]=clWhite) and(Pixels[x+h,y-3]=clWhite) and{D2B4}(Pixels[x+h+1,y-1]=clWhite) and(Pixels[x+h+1,y-2]=clBlack) and(Pixels[x+h+1,y-3]=clBlack) and{D2B4}(Pixels[x+h+2,y-2]=clWhite) and(Pixels[x+h+2,y-3]=clBlack) and(Pixels[x+h+2,y-4]=clWhite) and{D2B4}(Pixels[x+h+3,y-2]=clWhite) and(Pixels[x+h+3,y-3]=clBlack) and(Pixels[x+h+3,y-4]=clWhite) and{D2B4}(Pixels[x+h+4,y-3]=clWhite) and(Pixels[x+h+4,y-4]=clBlack) and(Pixels[x+h+4,y-5]=clWhite)) {or} {D2B4}
{(J1(Pixels[X+h,Y-1]=clWhite) and (Pixels[x+h,y]=clWhite) and (Pixels[x+h,y-2]=clBlack))} then // Проверка, если обрыв по x, начало следующей ступенрки.
begin
goto k8;
end ;
goto k3;//Если убрать эту строчку,то может фиксироваться вся линия исключая точку с дифектоми, т.к.
end; // если не отрабатывает сравнение пикселей по длине ступеньки и не отрабатывает по переходу на новую ступеньку, прог. прибавляет h и перемещает пиксель опроса в право.
k8: if (CPlx-CPLxI=0) or (CPlx-CPlxI=1) or (CPlxI-CPlx=1)or(CPlxI-CPlx=CPlxI/2) or (CPlx-CPlxI=CPlx/2) or (CPlxI-CPlx=(CPlxI/2)-1) or (CPlx-CPlxI=(CPlx/2)-1) or ((CPlxI-CPlx>(CPlxI/2)-1) and (CPlxI-CPlx<(CPlxI/2)+1)) then
begin
a:=x+h;
b:=y-1;
count:=count+1; // Счет ступеник.
goto k5;
end;
k3: OperEnd:=DateTimeToTimeStamp(Now);
Total:=OperEnd.Time-OperBegin.Time;
ListBox1.Items.Add(IntToStr(CPlx0)+' CPlx0');
ListBox1.Items.Add(IntToStr(CPlxI)+' CPlxI');
ListBox1.Items.Add(IntToStr(count)+' Ступеньки.');
ListBox1.Items.Add(IntToStr(Total)+' MSec');
end; // Конец прог.
end;
end.
Адовый пиздец с киберфорума.
http://www.cyberforum.ru/delphi-beginners/thread941698.html
+141
/// <summary>
/// Стартовый метод потока, который отображает процесс вычисления.
/// </summary>
public static void LoadingThread()
{
int curLoadingStep = 0;
while(!bStop)
{
Console.Clear();
switch(curLoadingStep)
{
case 0:
Console.WriteLine("Производится вычисление");
curLoadingStep = 1;
break;
case 1:
Console.WriteLine("Производится вычисление.");
curLoadingStep = 2;
break;
case 2:
Console.WriteLine("Производится вычисление..");
curLoadingStep = 3;
break;
case 3:
Console.WriteLine("Производится вычисление...");
curLoadingStep = 0;
break;
}
Thread.Sleep(800);
}
}
Наткнулся на форуме.
Чего то в этой жизни я явно не понимаю
+144
clientsize:function () {
if (window.innerWidth || window.innerHeight) {
return {"w":window.innerWidth,"h":window.innerHeight};
}
else if (_$$.$().documentElement && (_$$.$().documentElement.clientWidth || _$$.$().documentElement.clientHeight)) {
return {"w":_$$.$().documentElement.clientWidth,"h":_$$.$().documentElement.clientHeight};
}
else if (_$$.$().body.clientWidth || _$$.$().body.clientHeight) {
return {"w":_$$.$().body.clientWidth,"h":_$$.$().body.clientHeight};
}
else {
return {"w":0,"h":0};
}
},
scrollpos:function () {
if (window.innerWidth || window.innerHeight) {
return {"l":window.pageXOffset,"t":window.pageYOffset};
}
else if (_$$.$().documentElement && (_$$.$().documentElement.clientWidth || _$$.$().documentElement.clientHeight)) {
return {"l":_$$.$().documentElement.scrollLeft,"t":_$$.$().documentElement.scrollTop};
}
else if (_$$.$().body.clientWidth || _$$.$().body.clientHeight) {
return {"l":_$$.$().body.scrollLeft,"t":_$$.$().body.scrollTop};
}
else {
return {"l":0,"t":0};
}
},
scrollsize:function () {
if (_$$.$().documentElement && (_$$.$().documentElement.scrollWidth || _$$.$().documentElement.scrollHeight)) {
return {"w":_$$.$().documentElement.scrollWidth,"h":_$$.$().documentElement.scrollHeight};
}
else if (_$$.$().body.scrollWidth || _$$.$().body.scrollHeight) {
return {"w":_$$.$().body.scrollWidth,"h":_$$.$().body.scrollHeight};
}
else {
return {"w":0,"h":0};
}
},
Йебанайтунг координатунг ...
+144
movement_8: function() {
var d_param=effect.noeffect.winparam();
var main_left=Math.round(d_param[4]+(d_param[0]-this.width)/2);
var main_top=Math.round(d_param[5]+(d_param[1]-this.height)/2);
document.getElementById('panel_p_el_1').style.left=parseInt(document.getElementById('panel_p_el_1').style.left)-this.step+'px';
document.getElementById('panel_p_el_1').style.top=main_top+'px';
if(parseInt(document.getElementById('panel_p_el_1').style.left)>main_left+Math.round(this.width/2)) {
setTimeout('effect.panel.movement_8();',this.speed);
}
else {
document.getElementById('panel_p_el_1').style.left=main_left+Math.round(this.width/2)+'px';
document.getElementById('panel_p_el_1').style.top=main_top+'px';
this.key[1]=1;
if(this.key[0]+this.key[1]+this.key[2]+this.key[3]==4) {
document.getElementById('panel_p_el_0').style.visibility='hidden';
document.getElementById('panel_p_el_1').style.visibility='hidden';
document.getElementById('panel_p_el_2').style.visibility='hidden';
document.getElementById('panel_p_el_3').style.visibility='hidden';
document.getElementById('panel_p_el_m').style.visibility='visible';
document.getElementById('panel_p_el_m').style.left=main_left+'px';
document.getElementById('panel_p_el_m').style.top=main_top+'px';
}
}
},
Зачем канвас и иксэмэл, давай нажарим цыэсэсом ... Вообще так оно и делается быстрее всего, геймдевы еще не расчухали толком :D Однако, HTML для этого избыточен ...
+144
var cooker = {
set: function(cookie_name, cookie_value, cookie_expires, cookie_path, cookie_domain, cookie_secure) {
if(cookie_name!==undefined) {
cookie_expires=cookie_expires || 0;
var expire_date = new Date;
expire_date.setTime(expire_date.getTime() + (cookie_expires*1000));
document.cookie = cookie_name + "=" + escape(cookie_value)+'; ' +
((cookie_expires === undefined) ? '' : 'expires=' + expire_date.toGMTString()+'; ') +
((cookie_path === undefined) ? 'path=/;' : 'path='+cookie_path+'; ') +
((cookie_domain === undefined) ? '' : 'domain='+cookie_domain+'; ') +
((cookie_secure === true) ? 'secure; ' : '');
}
},
get: function(cookie_name) {
var cookie = document.cookie, length = cookie.length;
if(length) {
var cookie_start = cookie.indexOf(cookie_name + '=');
if(cookie_start != -1) {
var cookie_end = cookie.indexOf(';', cookie_start);
if(cookie_end == -1) {
cookie_end = length;
}
cookie_start += cookie_name.length + 1;
return unescape(cookie.substring(cookie_start, cookie_end));
}
}
},
erase: function(cookie_name) {
cooker.set(cookie_name, '', -1);
},
test: function() {
cooker.set('test_cookie', 'test', 10);
var work = (cooker.get('test_cookie') === 'test') ? true : false;
cooker.erase('test_cookie');
return work;
}
};
+130
Народ, вы где? Я реально соскучился.