- 1
- 2
- 3
AND (type = 2 OR type = 5 AND (type <> 3 OR type <> 20))
Очередной перл предшественника :)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−126
AND (type = 2 OR type = 5 AND (type <> 3 OR type <> 20))
Очередной перл предшественника :)
+102
function naq(a:integer;n:integer;m:integer):string;
var astr:string;
begin
astr:=inttostr(a);
case m of
1: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*1)+'*p^'+inttostr(n+1);
2: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*2)+'*p^'+inttostr(n+1)+'+'+inttostr(a*1)+'*p^'+inttostr(n+2);
3: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*3)+'*p^'+inttostr(n+1)+'+'+inttostr(a*3)+'*p^'+inttostr(n+2)+'-'+inttostr(a*1)+'*p^'+inttostr(n+3);
4: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*4)+'*p^'+inttostr(n+1)+'+'+inttostr(a*6)+'*p^'+inttostr(n+2)+'-'+inttostr(a*4)+'*p^'+inttostr(n+3)+'+'+inttostr(a*1)+'*p^'+inttostr(n+4);
5: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*5)+'*p^'+inttostr(n+1)+'+'+inttostr(a*10)+'*p^'+inttostr(n+2)+'-'+inttostr(a*10)+'*p^'+inttostr(n+3)+'+'+inttostr(a*5)+'*p^'+inttostr(n+4)+'-'+inttostr(a*1)+'*p^'+inttostr(n+5);
6: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*6)+'*p^'+inttostr(n+1)+'+'+inttostr(a*15)+'*p^'+inttostr(n+2)+'-'+inttostr(a*20)+'*p^'+inttostr(n+3)+'+'+inttostr(a*15)+'*p^'+inttostr(n+4)+'-'+inttostr(a*6)+'*p^'+inttostr(n+5)+'+'+inttostr(a*1)+'*p^'+inttostr(n+6);
7: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*7)+'*p^'+inttostr(n+1)+'+'+inttostr(a*21)+'*p^'+inttostr(n+2)+'-'+inttostr(a*35)+'*p^'+inttostr(n+3)+'+'+inttostr(a*35)+'*p^'+inttostr(n+4)+'-'+inttostr(a*21)+'*p^'+inttostr(n+5)+'+'+inttostr(a*7)+'*p^'+inttostr(n+6)+'-'+inttostr(a*1)+'*p^'+inttostr(n+7);
8: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*8)+'*p^'+inttostr(n+1)+'+'+inttostr(a*28)+'*p^'+inttostr(n+2)+'-'+inttostr(a*56)+'*p^'+inttostr(n+3)+'+'+inttostr(a*70)+'*p^'+inttostr(n+4)+'-'+inttostr(a*56)+'*p^'+inttostr(n+5)+'+'+inttostr(a*28)+'*p^'+inttostr(n+6)+'-'+inttostr(a*8)+'*p^'+inttostr(n+7)+'+'+inttostr(a*1)+'*p^'+inttostr(n+8);
9: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*9)+'*p^'+inttostr(n+1)+'+'+inttostr(a*36)+'*p^'+inttostr(n+2)+'-'+inttostr(a*84)+'*p^'+inttostr(n+3)+'+'+inttostr(a*126)+'*p^'+inttostr(n+4)+'-'+inttostr(a*126)+'*p^'+inttostr(n+5)+'+'+inttostr(a*84)+'*p^'+inttostr(n+6)+'-'+inttostr(a*36)+'*p^'+inttostr(n+7)+'+'+inttostr(a*9)+'*p^'+inttostr(n+8)+'+'+inttostr(a*1)+'*p^'+inttostr(n+9);
end;
end;
Лень было искать алгоритм раскрытия (1-q)^n
+148
eval(' ~ function ( __ , ___ ) { _ = __ ( ___ ( "__", "return __ ") ({}) ) } (eval, Function) , _[("_")] = _ ');
не могу понять как работает =(
+163
Обратите внимание:
http://govnokod.ru/user/4788
http://govnokod.ru/user/4789
+171
// Записываем просмотр профайла
MySQL::QueryInsert(
'profile_views',
array(
'profile_id' => (int)$user['id'],
'visitor' => (int)User::$current['id'],
'date' => (int)$cur_time,
'hidden' => (int)User::$current['hidden']
)
);
// Смотрим последнюю запись в просмотрах
$prev_visit = MySQL::FetchAll(
MySQL::Query(
'SELECT `visitor`,`date`
FROM profile_views
WHERE profile_id='.(int)$user['id'].' AND `date`<'.(int)$cur_time.
' AND `hidden`='.(int)User::$current['hidden'].'
ORDER BY `date` DESC
LIMIT 1'
)
);
// если юзер сам посмотрел свой профиль - удаляем только что вставленную запись
if ($prev_visit[0]['visitor'] == User::$current['id']) {
MySQL::Query(
'DELETE FROM profile_views
WHERE profile_id='.(int)$user['id'].'
AND `date`='.(int)$prev_visit[0]['date'].
' AND `hidden`='.(int)User::$current['hidden'].'
AND visitor='.(int)User::$current['id']
);
};
Комментарии мои. Сука, я потихоньку начинаю ненавидеть прибалтийских программеров
+147
$field_value = trim( $field_value, ' \n"' );
+165
@jfredys 23-Mar-2011 01:07
I was looking for trimming all the elements in an array, I found this as the simplest solution:
<?php
array_walk($ids, create_function('&$val', '$val = trim($val);'));
?>
array_map? не, не слышал.
+96
MediaPlayer1.FileName := './data/gong.wav';
MediaPlayer1.Open;
g1 := timetostr(time);
g2 := timetostr(strtotime('0:00:00'));
g3 := timetostr(strtotime('3:00:00'));
g4 := timetostr(strtotime('6:00:00'));
g5 := timetostr(strtotime('5:00:00'));
g6 := timetostr(strtotime('12:00:00'));
g7 := timetostr(strtotime('15:00:00'));
g8 := timetostr(strtotime('18:00:00'));
g9 := timetostr(strtotime('21:00:00'));
if g1 = g2 then
MediaPlayer1.Play
else
Label2.Caption := 'не работает тварь...';
этнический таджик, а в душе - индокитаец
+161
<? include "../o-proekte/connect.php";?>
<ul id="nav">
<li><a class=" link" href="citaty-i-aforizmy/">А</a>
<ul>
<?$a = iconv('utf8', 'cp1251', "А");
$sql = 'SELECT * FROM authors WHERE name LIKE "'.$a.'%"';
$query = mysql_query($sql) or die("Invalid query: " . mysql_error());
While ($row = mysql_fetch_array ($query))
{$results[] = $row;};?>
<? foreach ($results as $num=> $result ) {
echo iconv("cp1251", "utf8", "<li><a href=".$result['id']." id=".$result['name'].">".$result['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">Б</a>
<ul>
<?$b = iconv('utf8', 'cp1251', "Б");
$sqlb = 'SELECT * FROM authors WHERE name LIKE "'.$b.'%"';
$queryb = mysql_query($sqlb) or die("Invalid query: " . mysql_error());
While ($rowb = mysql_fetch_array ($queryb))
{$resultsb[] = $rowb;};?>
<? foreach ($resultsb as $numb=> $resultb ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultb['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">В</a>
<ul>
<?$v = iconv('utf8', 'cp1251', "В");
$sqlv = 'SELECT * FROM authors WHERE name LIKE "'.$v.'%"';
$queryv = mysql_query($sqlv) or die("Invalid query: " . mysql_error());
While ($rowv = mysql_fetch_array ($queryv))
{$resultsv[] = $rowv;};?>
<? foreach ($resultsv as $numv=> $resultv ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultv['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">Г</a>
<ul>
<?$g = iconv('utf8', 'cp1251', "Г");
$sqlg = 'SELECT * FROM authors WHERE name LIKE "'.$g.'%"';
$queryg = mysql_query($sqlg) or die("Invalid query: " . mysql_error());
While ($rowg = mysql_fetch_array ($queryg))
{$resultsg[] = $rowg;};?>
<? foreach ($resultsg as $numg=> $resultg ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultg['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">Д</a>
<ul>
<?$d = iconv('utf8', 'cp1251', "Д");
$sqld = 'SELECT * FROM authors WHERE name LIKE "'.$d.'%"';
$queryd = mysql_query($sqld) or die("Invalid query: " . mysql_error());
While ($rowd = mysql_fetch_array ($queryd))
{$resultsd[] = $rowd;};?>
<? foreach ($resultsd as $numd=> $resultd ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultd['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">Е</a>
<ul>
<?$e = iconv('utf8', 'cp1251', "Е");
$sqle = 'SELECT * FROM authors WHERE name LIKE "'.$e.'%"';
$querye = mysql_query($sqle) or die("Invalid query: " . mysql_error());
While ($rowe = mysql_fetch_array ($querye))
{$resultse[] = $rowe;};?>
<? foreach ($resultse as $nume=> $resulte ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resulte['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">Ж</a>
<ul>
<?$j = iconv('utf8', 'cp1251', "Ж");
$sqlj = 'SELECT * FROM authors WHERE name LIKE "'.$j.'%"';
$queryj = mysql_query($sqlj) or die("Invalid query: " . mysql_error());
While ($rowj = mysql_fetch_array ($queryj))
{$resultsj[] = $rowj;};?>
<? foreach ($resultsj as $numj=> $resultj ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultj['name']."</a></li>");
}?>
</ul>
</li>
<li><a class=" link" href="citaty-i-aforizmy/">З</a>
<ul>
<?$z = iconv('utf8', 'cp1251', "З");
$sqlz = 'SELECT * FROM authors WHERE name LIKE "'.$z.'%"';
$queryz = mysql_query($sqlz) or die("Invalid query: " . mysql_error());
While ($rowz = mysql_fetch_array ($queryz))
{$resultsz[] = $rowz;};?>
<? foreach ($resultsz as $numz=> $resultz ) {
echo iconv("cp1251", "utf8", "<li><a href=\"\">".$resultz['name']."</a></li>");
нужно чтобы php выводил что то типа
А Б
август Брайан
Бекхем
и т.д. (c)phpforum.ru
+1001
QStringList list;
QStringList::iterator i, j;
//...
i = qLowerBound(list.begin(), list.end(), value);
j = qUpperBound(list.begin(), list.end(), value);
while (i != j) {
processItem(*i);
++i;
}
Пахучее пятнышко из брошюры "Qt 4's Generic Algorithms"