-
+73
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
final QOrder qSub = new QOrder("qSub");
final Predicate[] filters = getFilters(qSub, null, null);
if (filters.length > 0) {
// conditions.add(Arrays.asList(filters)); // Do not do this.
// The subquery is here so that MySQL doesn't use the wrong index for
// ORDER BY... LIMIT if we directly add the filter by custid/custdept
// to the list of filters, which will make the search very slow.
// Well, perhaps an ugly workaround, and we might want to adjust
// the custid/custdept index in the future... somehow.
conditions.add(q.id.in(QueryDsl.subFrom(qSub).where(filters).list(qSub.id)));
}
Обход косяков конкретной СУБД на уровне ORM. Абстракция, что и говорить.
lucidfox,
27 Сентября 2011
-
+157
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
// если пользователь зашел на www.site.ru,
// удаляем его куки и перенаправляем с www.site.ru на site.ru
// (чтобы куку всегда ставить только на домене третьего уровня)
if (stristr($_SERVER["HTTP_HOST"], 'www.site.ru')) {
setcookie("cookie1", "", time() - 3600);
setcookie("cookie1", "", time() - 3600);
header("Location: http://site.ru/" . $query_string);
die();
}
Нашел в очень старых скриптах. Комменты сохранены.
Доменное имя сайта изменено, названия кук изменены, любые совпадения являются случайными.
Nemoden,
27 Сентября 2011
-
+158
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
<?
$thePrice = $iblockelem[ "PROPERTIES" ][ "PRICE" ][ "VALUE" ];
$thePrice_s = '';
if(strlen(trim($thePrice))>3)
{
$priceArray = str_split($thePrice);
$priceArray = array_reverse($priceArray);
for($i = 1; $i <= count($priceArray); $i++)
{
$thePrice_s.=$priceArray[$i-1];
if(($i%3)==0)
$thePrice_s.=' ';
}
$thePrice = str_split($thePrice_s);
}
echo rtrim(ltrim(implode(array_reverse($thePrice))))
?>
<?=number_format($thePrice,0,"."," ")?>
fon-neiman,
27 Сентября 2011
-
+159
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
// ==UserScript==
// @name govnokod.ru new comments mark
// @namespace ('__'X)
// @description govnokod.ru new comments mark for Ctrl+F
// @include http://*.govnokod.ru/*
// @include http://govnokod.ru/*
// ==/UserScript==
function addNewMark()
{
var i, d = document.getElementsByTagName('div');
for (i in d) if (d[i].className == 'entry-comment-wrapper new')
{
d[i].getElementsByTagName('p')[0].getElementsByTagName('a')[1].innerHTML += 'new';
}
}
if (location.hostname.match(/govnokod\.ru$/))
{
if (document.addEventListener)
{
document.addEventListener('DOMContentLoaded', addNewMark(), false);
} else {
window.addEventListener('load', addNewMark(), false);
}
}
//* OR
//* 1) Copypaste into browser @field: javascript:var i,d=document.getElementsByTagName('div');for(i in d)if(d[i].className=='entry-comment-wrapper new')d[i].getElementsByTagName('p')[0].getElementsByTagName('a')[1].innerHTML+='new';void(0);
//* 2) Ctrl+F for '#new'
Накидал только что. Помечает новые посты меткой "#new", можно контролэфить.
Работает только для страниц отдельных ГК, в том числе из мусорки.
Треды до полсотни комментов можно и так оглядеть, если больше - открываю отдельно.
Но всё равно стоит добавить фичу на стороне сервера.
ej,
26 Сентября 2011
-
−107
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
while 2 > 1 do
@command = io.gets();
case @command
when 'version'
puts('0.01 Alpha for developers SUPIRPUPIRSIKRIT');
when 'register, #{@arg}'
@name = @arg;
@name = User.new;
@name.register;
@name = '';
@arg ='';
when 'login, arg '
@user = @arg;
@user.login;
@user = '';
when 'quit'
server.shutdown;
else
puts(@command);
end
end
Извиняюсь за мультипост.
P.S.: как здесь удалять посты?
urm,
26 Сентября 2011
-
−103
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
@name = @arg;
@name = User.new;
@name.register;
@name = '';
@arg ='';
@user = @arg;
@user.login;
@user = '';
Вырезан наиболее эпичный фрагмент кода
urm,
26 Сентября 2011
-
+170
- 1
- 2
- 3
- 4
- 5
- 6
public function getAvailabelWebsites() {
return $this->_w();
}
public function getAvailavelWebsites() {
return $this->_w();
}
Модуль LightCheckout для Magento за скромные $169.00 .
К сожалению, слово "available" так и не смогли написать правильно:)
Doglexx,
26 Сентября 2011
-
−152
Улыбнуло. Не помню, в какой то чей то нетленке видел...
F00FC7C8,
26 Сентября 2011
-
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
if (is_dir($mainDir))
{
if ($dh = opendir($mainDir))
{
while (($file = readdir($dh)) !== false)
{
if ( ($file!='.') && ($file!='..') ) $regions.=$file.',';
}
closedir($dh);
}
}
$regions = substr($regions, 0, -1);
$arrRegions = explode(",", $regions);
сразу пихать в массив файлы не судьба! надо изврат с строками
Rubaka,
26 Сентября 2011
-
+164
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
$rsAnswers = CFormAnswer::GetList( $QUESTION_ID, $by="s_id", $order="desc", $arFilter, $is_filtered );
$z = 0;
while ($arAnswer = $rsAnswers->Fetch())
{
$z = 1;
}
if ($z == 1) {
Когда там накопилось 100500 элементов сайт ВНЕЗАПНО начал лагать...
Tairesh,
26 Сентября 2011