-
+159
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
$("input[name=site]").bind("focus", function(event){
if ($("input[name=site]").attr("value") == "") $("input[name=site]").attr("value", "http://");
$("input[name=site]").addClass("fhover");
});
$("input[name=site]").bind("blur", function(event){
if ($("input[name=site]").attr("value") == "http://")
{
$("input[name=site]").attr("value", "");// now fix error message
$("#sitespan").removeClass().addClass("f-lup f-lod").html("не обязательно");
$("input[name=site]").removeClass("fhover");
}
});
input[name=site] раз 10 использовано. Наверняка можно было где-то использовать this, или вообще получить объект один раз и сохранить в переменную.
increazon,
18 Сентября 2011
-
+158
- 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
std::ostringstream str;
str << "Русский текст" << std::endl;
Print(str.c_str());
//Оттуда же:
void ConsoleCout(const char* _text)
{
char* buffer=0;
unsigned int bufferSize=0;
if(!_text) return;
while(_text[bufferSize]) bufferSize++;
buffer=new (std::nothrow) char[bufferSize+1];
if(!buffer) return;
buffer[bufferSize]=0;
if(!CharToOemA(_text,buffer))
{
delete[] buffer;
return;
}
std::cout<<buffer;
delete[] buffer;
}
[code]http://www.gamedev.ru/code/forum/?id=152499[\code]
CPPGovno,
18 Сентября 2011
-
+149
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
for(int i=0;i<size1;i+=4)
{
float4 boxMax(plist[i+0].Box().vmax[axis], plist[i+1].Box().vmax[axis], plist[i+2].Box().vmax[axis], plist[i+3].Box().vmax[axis]);
float4 boxMin(plist[i+0].Box().vmin[axis], plist[i+1].Box().vmin[axis], plist[i+2].Box().vmin[axis], plist[i+3].Box().vmin[axis]);
register __m128 a = _mm_and_ps(_mm_cmplt_ps(boxMax, vSplit), one);
register __m128 b = _mm_and_ps(_mm_cmpgt_ps(boxMin, vSplit), one);
register __m128 left = _mm_sub_ps(one, b); // left = 1 - b; same as not(b)
register __m128 right = _mm_sub_ps(one, a); // right = 1 - a; same as not(a)
summLeft += (left.m128_i32[0] + left.m128_i32[1] + left.m128_i32[2] + left.m128_i32[3]);
summRight+= (right.m128_i32[0] + right.m128_i32[1] + right.m128_i32[2] + right.m128_i32[3]);
}
http://www.gamedev.ru/code/forum/?id=141592
История про то, как Пятачок оптимизировал простой цикл:
for(int i=0;i<plist.size();i++)
{
if(plist[i].Box().vmax[axis] < split)
summLeft++;
else if(plist[i].Box().vmin[axis] > split)
summRight++;
else
{
summLeft++;
summRight++;
}
}
CPPGovno,
18 Сентября 2011
-
+165
- 1
$sExt = file_exists("files/" . $sId . ".flv") ? "m4v" : "flv";
Вот с такой проверкой столкнулся работая над воспроизведением видео.
Лишний раз доказывает очень высокопрофессиональный уровень программистов из Пакистана, которые работали над проектом до меня :)
Hits,
17 Сентября 2011
-
+129
- 1
IsDirty = InitialLoad ? false : true;
Классический индусокод, в исполнении расового полового индуса.
VasyaMatros,
17 Сентября 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
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
// Функция создания списка страниц типа << < 1 2 3 > >>
function PageBar($adsNum, $nowPage, $currUrl){
$maxpageinHalf = intval (MAX_PAGEIN / 2);
$maxpagein = MAX_PAGEIN;
$maxresults = MAX_RESULTS;
$pn=($adsNum%MAX_RESULTS!=0);
$pageNum = intval($adsNum / $maxresults) + $pn;
$pageNum==0?$pageNum=1:"";
if ($nowPage < $maxpageinHalf ){ // определение первой половины списка страниц.
$minPage = 0;
$maxPage = $maxpagein;
($maxPage>$pageNum)?$maxPage=$pageNum:"";
$previous10Page = 0;
$next10Page = $nowPage + $maxpagein;
}
elseif ($nowPage > $pageNum - $maxpageinHalf) {
$maxPage = $pageNum;
$minPage = $pageNum - $maxpagein;
($minPage<=0)?$minPage=0:"";
$previous10Page = $nowPage - $maxpageinHalf;
$next10Page = $pageNum;
}
else {
$minPage = $nowPage - $maxpageinHalf;
$maxPage = $nowPage + $maxpageinHalf;
$previous10Page = $nowPage - $maxpagein;
$next10Page = $nowPage + $maxpagein;
}
$next10Page >= $pageNum? $next10Page = $pageNum-1:"";
$listing = "<a href='p0,a,".$currUrl."' title=\"В начало\" class=\"ads-link1\">|<<</a> ";
$listing .= "<a href='p$previous10Page,a,".$currUrl."' title=\"Предыдущие $maxpagein страниц\" class=\"ads-link1\"><</a> ";
for ( $i = $minPage; $i < $maxPage; $i++) {
if ( $i == $nowPage )
$listing .= "<span style=\"font-size:16px; color:red;\">".($i+1)."</span> ";
else
$listing .= "<a href=\"p".$i.",a,".$currUrl."\" title=\"Страница ".($i+1)."/$pageNum\" class=\"ads-link1\">".($i+1)."</a> ";
}
$listing .= " <a href='p".($next10Page).",a,".$currUrl."' title=\"Следующие $maxpagein страниц\" class=\"ads-link1\">></a> ";
$listing .= "<a href='p".($pageNum-1).",a,".$currUrl."' title=\"В конец\" class=\"ads-link1\">>>|</a>";
return $listing;
}
Два дня ебался, но чувствую, что здесь что-то не то :D
Alkonost,
17 Сентября 2011
-
+956
- 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
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
private void SetDisplay(string Group)
{
string taxInt = "144";
switch (Group.ToLower())
{
case "bond":
taxInt = "141";
..............
break;
case "commodity":
taxInt = "329";
..............
break;
case "emarkets":
taxInt = "142";
..............
break;
default:
taxInt = "144";
..............
break;
}
SetItems(taxInt);
}
public void SetItems(string taxInt)
{
Trace.Write(taxInt);
int number;
bool result = Int32.TryParse(taxInt, out number);
if (result)
{
tid = number;
}
else
{
tid = 144;
this.lbHard.Style.Add("color", "#000");
}
Trace.Write(tid.ToString());
if (tid > 0)
{
..............
}
else
{
//здесь было пусто
}
}
Лишний код удалён, оставлена только самая важная часть кода))
dimon1988,
17 Сентября 2011
-
+147
- 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
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
private void SetDisplay(string Group)
{
string taxInt = "144";
switch (Group.ToLower())
{
case "bond":
taxInt = "141";
..............
break;
case "commodity":
taxInt = "329";
..............
break;
case "emarkets":
taxInt = "142";
..............
break;
default:
taxInt = "144";
..............
break;
}
SetItems(taxInt);
}
public void SetItems(string taxInt)
{
Trace.Write(taxInt);
int number;
bool result = Int32.TryParse(taxInt, out number);
if (result)
{
tid = number;
}
else
{
tid = 144;
this.lbHard.Style.Add("color", "#000");
}
Trace.Write(tid.ToString());
if (tid > 0)
{
..............
}
else
{
//здесь было пусто
}
}
Лишний код удалён, оставлена только самая важная часть кода))
dimon1988,
17 Сентября 2011
-
+145
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
<?php
header('Content-Type: text/html; charset=utf-8');
function даешь_кириллицу_блеать($оказывается_можно_и_так_0_о) {
echo $оказывается_можно_и_так_0_о;
}
даешь_кириллицу_блеать('век живи');
$хуй=' - век учись';
echo $хуй;
?>
я кирпичами сру, ОНО РАБОТАЕТ!!!!!
jokz,
17 Сентября 2011
-
+156
- 1
- 2
- 3
- 4
- 5
$c = (int)(bool)$_POST['chat'];
// через сто строк
$q = 'UPDATE ....., `chat`='.$c.' WHERE ....';
интригующе
jokz,
16 Сентября 2011