- 1
- 2
- 3
- 4
- 5
- 6
- 7
StringBuffer possibleNames = new StringBuffer();
int max = item.getPossibleNames().length;
for (int i = 0; i < max; i++) {
..
possibleNames.append(ing.name + " " + ( i != (max-1) ? ", " : ""));
..
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+71
StringBuffer possibleNames = new StringBuffer();
int max = item.getPossibleNames().length;
for (int i = 0; i < max; i++) {
..
possibleNames.append(ing.name + " " + ( i != (max-1) ? ", " : ""));
..
}
вставка запятых между элементами массива
+119
ApiException(final ResourceException cause, final Representation repr,
final Class<? extends ErrorResponse> responseClass) {
super(cause);
this.cause = cause;
ErrorResponse response = null;
try {
response = new ObjectMapper().readValue(repr.getText(), responseClass);
} catch (final Exception e) {
log.error("Error attempting to parse the error response", e);
} finally {
this.response = response;
}
}
Возникла ошибка при возникновении ошибки...
+154
function unbb($str)
{
return preg_replace('#\[(.*?)\]#ui', '', preg_replace('#\[(.*?)\](.*?)\[\/(.*?)\]#ui', '', $str));
}
+154
$query = rawurldecode(A::get('query'));
$maps = strtolower($query);
$maps_array = array();
// cs_assault,"de_dust",de_inferno
$map = strtok($maps, ',');
do
{
$map = trim($map);
// если экранирование кавычками то искать точное совпадение, пример: "de_dust"
if(preg_match('/^"(.*)"$/', $map, $match_map))
{
$map = mysql::safe(end($match_map));
$maps_array[] = "map = '".$map."'";
}
else
{
$maps_array[] = "map LIKE '%".mysql::safe($map)."%'";
}
} while($map = strtok(','));
mysql::query("SELECT * FROM servers WHERE status=1 ".join(" OR ", $maps_array));
+159
// Конструктор
public function __construct($tablename,
$detal = "*",
$where,
$order = "",
$pnumber = 10,
$page_link = 3,
$parameters = "")
{
if (empty($detal)) $this->detal = '*'; else $this->detal = $detal;
parent::__construct($tablename,
$where,
$order,
$pnumber,
$page_link,
$parameters);
}
ооп
+142
void main()
{
int mass[6]={4,1,3,5,7,0};
quicksort(mass,5);
while(mass[5]<7)
printf("%d",mass[5]);
getch();
}
в общем дал препод готовую программу, задание было найти ошибки, так как программа компилируется, и вроде как ошибка не очевидна, как там виндовс выполнять это будет не знаю, у меня бы вылетело с ошибкой сегментирования, делаю предположение. Изначально проблемное место выглядело примерно так:
while(mass[5]<5)
printf("%d",mass[mass[5]]);
вот это исправление одного из студентов нашего потока, так это второй курс специальности ЭВМ, (facepalm)
+157
function othercomplaints ()
{
if (window.document.Profiles.OtherComplaints !== undefined)
if (window.document.Profiles.OtherComplaints.checked) {
for (i=1;i<=20;i++) {
eval("document.getElementById('otherc"+i+"').style.display = 'block';");
}
} else {
for (i=1;i<=20;i++) {
eval("document.getElementById('otherc"+i+"').style.display = 'none';");
}
}
}
+146
if( file_exists("controllers/{$controller}.php") ) {
include_once "controllers/{$controller}.php";
} else {
throw new Exception('Controller is invalid.');
}
с хабры.
Вообще, эт делается самим парсером php скрипта, без лишних телодвижений <_<
+152
if ($current['username'] == 'admin')
{
$admin = true;
}
+131
$(EXTRA_SRC) :
cp -f $(PROJ_ROOT)/src/libA/com_print.c ./com_print.cpp
cp -f $(PROJ_ROOT)/src/libA/com_misc.c ./com_misc.cpp
из Makefile'а. /другой/ способ подключения нужной библиотеки к модулю.