- 1
- 2
- 3
- 4
for(int i = 0; i < fCount; i++)
{
result += Integer.parseInt(String.valueOf((fPart.charAt(i))), 10)*Math.pow(base, fCount-(i+1));
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+74
for(int i = 0; i < fCount; i++)
{
result += Integer.parseInt(String.valueOf((fPart.charAt(i))), 10)*Math.pow(base, fCount-(i+1));
}
+121
private static string GetShortDisciplineName(string longDsciplineName){
string[] words = longDsciplineName.Split(' ');
switch (words.Count()){
case 1:{
return longDsciplineName;
break;
}
+157
mysql_connect($MYSQL_HOST,$MYSQL_USER,$MYSQL_PASSWORD) OR DIE("Не могу создать соединение ");
mysql_select_db($MYSQL_DB_NAME) or die(mysql_error());
$query = "SELECT * FROM `Subdivision` WHERE `Checked`=1";
$result = mysql_query($query) or die(mysql_error());
$i=0;
while($row = mysql_fetch_assoc($result))
{
$data[$i]=$row;
$i++;
}
$query = "SELECT * FROM `Subdivision` WHERE `Subdivision_Name`='Спорт'";
$result = mysql_query($query) or die(mysql_error());
$row = mysql_fetch_assoc($result);
$data[]=$row;
$data['22']['Subdivision_Name']='Главная (интернет магазин прикольных футболок с надписью)';
$data['19']['Subdivision_Name']='Креативные футболки с прикольными рисунками';
$data['2']['Subdivision_Name']='Классные футболки для офиса';
$data['3']['Subdivision_Name']='Оригинальные студенческие футболки';
$data['4']['Subdivision_Name']='Самые лучшие футболки sexy';
$data['6']['Subdivision_Name']='Правильные футболки для админов';
$data['32']['Subdivision_Name']='Клевые футболки South Park ';
$data['35']['Subdivision_Name']='Эксклюзивные футболки на хэллоуин';
$array = array(13,9,11,10,12,14,15,16);
$sub_array = array(33,19,31,38,0,1,2,3,4,5,6,7,8,20,32,35,36,37);
$sitemap ="<ul>";
$sitemap.="<li><a href='".$data['22']['Hidden_URL']."'>".$data['22']['Subdivision_Name']."</a></li>";
$sitemap.="<ul>";
for($i=0;$i<count($sub_array);$i++)
{
$sitemap.="<li><a href='".$data[$sub_array[$i]]['Hidden_URL']."'>".$data[$sub_array[$i]]['Subdivision_Name']."</a></li>";
}
$sitemap.="</ul>";
for($i=0;$i<count($array);$i++)
{
$sitemap.="<li><a href='".$data[$array[$i]]['Hidden_URL']."'>".$data[$array[$i]]['Subdivision_Name']."</a></li>";
}
$sitemap.="</ul>";
return $sitemap;
комментарии излишни
+148
php_value register_globals 1
php_flag register_globals on
php_value magic_quotes 1
php_flag magic_quotes on
php_value magic_quotes_gpc 1
php_flag magic_quotes_gpc on
n/c
+78
> В какую середину?) он ставиться на свое место. У тебя не верное представление об устройстве данных в памяти.
procedure TForm1.Button1Click(Sender: TObject);
type
parr = ^tarr;
tarr = array of integer;
var
pparr: array of parr;
begin
setlength(pparr,1);
memo1.Lines.Add('first array pointer '+inttostr(integer(@pparr)));
new(pparr[0]);
memo1.Lines.Add('second array pointer '+inttostr(integer(pparr[0])));
memo1.Lines.Add('first element '+inttostr(integer(pparr[0]^)));
end;
> вывод
first array pointer 1242664
second array pointer 10822692
first element 0
Человек нашёл единственно верный путь использования двумерных динмассивов. Через указатель на указатель, правда он сам этого не понимает. Авторское форматирование и орфография сохранены.
Источник:
http://www.gamedev.ru/projects/forum/?id=161043&page=3#m35
+78
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line1, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line2, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line3, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line4, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line5, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line6, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line7, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line8, 0, y));
y+=drawable.getMinimumHeight();
i++;
mLoadingTextureMap.put(LINE +i, createFromResource(mLinesAtlas, this, R.drawable.loading_line9, 0, y));
вот так один паренек загружает в атлас текстуры....
нафиг циклы вообще нужны (=
+157
$(document).ready(function(){
// ...
var nom1=0;
var nom2=0;
$("#first").live("hover", function() {
$(".blocks1").addClass('activ_block');
$(".blocks1 .block1").addClass('activ_block');
$(".blocks1 .block2").addClass('activ_block');
$(".blocks1 .block2 ul").eq(0).addClass('activ_block');
$(".blocks1 .block1 a").eq(0).addClass('active_red');
nom1 = 0;
$(".blocks").removeClass('activ_block');
$(".blocks2").removeClass('activ_block');
$(".blocks3").removeClass('activ_block');
$(".blocks .blocks ul").removeClass('activ_block');
$(".blocks .blocks div").removeClass('activ_block');
$(".blocks .block1").removeClass('activ_block');
$(".blocks .block2").removeClass('activ_block');
$(".blocks .block3").removeClass('activ_block');
$(".blocks .block1 a").removeClass('active_reds');
$(".blocks .block2 a").removeClass('active_reds');
});
$(".blocks1 .block1 a").live("click", function() {
nom1 = $(".blocks1 .block1 a").index(this); // id level 2
$(".blocks1 .block1 a").removeClass('active_red');
$(this).addClass('active_red');
$(".blocks1 .block2 ul").removeClass('activ_block');
$(".blocks1 .block2").addClass('activ_block');
$(".blocks1 .block2 ul").eq((nom1)).addClass('activ_block');
});
$(".blocks1 .block2 a").live("hover", function() {
nom2 = $(".blocks1 .block2 ul.activ_block a").index(this); // id level 3
$(".blocks1 .block3 div").removeClass('activ_block');
$(".blocks1 .block3 div div").removeClass('activ_block');
$(".blocks1 .block3").addClass('activ_block');
$(".blocks1 .block3 div.z").eq((nom1)).addClass('activ_block');
$(".blocks1 .block3 div.activ_block div").eq((nom2)).addClass('activ_block');
$(".blocks1 .block2 a").removeClass('active_reds');
$(this).addClass('active_reds');
});
$(".blocks1 .block1").hover(function() {
$(".blocks1 .block3").removeClass('activ_block');
$(".blocks1 .block2 a").removeClass('active_reds');
$(".blocks1 .block3 div").removeClass('activ_block');
$(".blocks1 .block3 div div").removeClass('activ_block');
} ,
function() {
});
$(".blocks1 .block3").hover(function() {
} ,
function() {
});
$(".blocks1 .block2").hover(function() {
$(".blocks1 .block3").removeClass('activ_block');
$(".blocks1 .block3 div").removeClass('activ_block');
$(".blocks1 .block2 a").removeClass('active_reds');
} ,
function() {
if ($(".blocks1 .block3").hasClass('activ_block')) {
} else {
}
});
// ...
});
Очередной шедевр jQuery-мастеров. Скрипт меню, приведенный код - около трети от общего количества такого же.
+125
if (FileAssociation.IsAssociated(".avi") || !FileAssociation.IsAssociated(".avi"))
{
FileAssociation.Associate(".avi", "Flvplayer", ".avi", a, b);
}
http://www.cyberforum.ru/csharp-beginners/thread304416.html
+68
if (seriesOrder == SeriesRenderingOrder.REVERSE) {
//render series in reverse order
for (int pass = 0; pass < passCount; pass++) {
int seriesCount = dataset.getSeriesCount();
for (int series = seriesCount - 1; series >= 0; series--) {
int firstItem = 0;
int lastItem = dataset.getItemCount(series) - 1;
if (lastItem == -1) {
continue;
}
if (state.getProcessVisibleItemsOnly()) {
int[] itemBounds = RendererUtilities.findLiveItems(
dataset, series, xAxis.getLowerBound(),
xAxis.getUpperBound());
firstItem = Math.max(itemBounds[0] - 1, 0);
lastItem = Math.min(itemBounds[1] + 1, lastItem);
}
state.startSeriesPass(dataset, series, firstItem,
lastItem, pass, passCount);
for (int item = firstItem; item <= lastItem; item++) {
renderer.drawItem(g2, state, dataArea, info,
this, xAxis, yAxis, dataset, series, item,
crosshairState, pass);
}
state.endSeriesPass(dataset, series, firstItem,
lastItem, pass, passCount);
}
}
}
else {
//render series in forward order
for (int pass = 0; pass < passCount; pass++) {
int seriesCount = dataset.getSeriesCount();
for (int series = 0; series < seriesCount; series++) {
int firstItem = 0;
int lastItem = dataset.getItemCount(series) - 1;
if (state.getProcessVisibleItemsOnly()) {
int[] itemBounds = RendererUtilities.findLiveItems(
dataset, series, xAxis.getLowerBound(),
xAxis.getUpperBound());
firstItem = Math.max(itemBounds[0] - 1, 0);
lastItem = Math.min(itemBounds[1] + 1, lastItem);
}
state.startSeriesPass(dataset, series, firstItem,
lastItem, pass, passCount);
for (int item = firstItem; item <= lastItem; item++) {
renderer.drawItem(g2, state, dataArea, info,
this, xAxis, yAxis, dataset, series, item,
crosshairState, pass);
}
state.endSeriesPass(dataset, series, firstItem,
lastItem, pass, passCount);
}
}
}
нашел в jfreechart
Обе ветки if-else идентичны, только в одной цикл идет от нуля, в другой в обратную сторону.
Говнокод или нет?
−99
referer = ''
if 'HTTP_REFERER' in request.META :
referer = request.META['HTTP_REFERER']
И подобного кода в проекте тонны...