- 1
- 2
- 3
- 4
- 5
var lst = new List<string>();
foreach (String parameterName in parameters.Keys) // parameters это Dictionary<String, Object>
{
lst.Add(parameterName + ": " + parameters[parameterName].ToString());
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
var lst = new List<string>();
foreach (String parameterName in parameters.Keys) // parameters это Dictionary<String, Object>
{
lst.Add(parameterName + ": " + parameters[parameterName].ToString());
}
Долгий вариант перебора словаря: перебор ключей в цикле и на каждой итерации получение по ключу значения из словаря
+142
public String ExecuteInDispancerMonitoring
{
get
{
string st = "";
IndividualService service = this;
int iter = 100;
while (iter != 0)
{
if (service.ParentService != null)
{
service = service.ParentService;
if (service is DispanserMonitoring)
{
st = service.CalcStrServiceName; // Строковое представление названия услуги
if (service.CalcStartDate.HasValue)
{
st += " c " + service.CalcStartDate.Value.ToShortDateString();
}
return st;
}
}
else
{
return st;
}
iter--;
}
return "";
}
}
+145
$change = FALSE;
if ($formdata['information_status'] == 0)
{
$change = TRUE;
}
$change = FALSE;
+143
https://github.com/lhartikk/ArnoldC
+38
link.setUrlDownload(url.replaceAll("%21", "!").replaceAll("%20", ""));
Необучаемость.
−88
{ cat "$FETCH_LOGFILE"; cat "$PROCESSING_LOGFILE"; } >>"$SHARED_LOG"
Ma, look! I am groupinng commands!
+140
int __STRNCMP__(const char s1, const char s2, size_t n)
{
for (; n > 0; s1++, s2++, --n)
if (s1 != s2)
return (((unsigned char )s1 < (unsigned char )s2) ? -1 : +1);
else if (*s1 == '\0')
return 0;
return 0;
}
Зачем нужен такой велосипед?
+142
setExpanded : function(val) {
val = val ? true : false;
this._expanded = val;
}
+145
<?
include "mode.php";
#session_start();
?>
<? $carttext .='<div class="text">';
$carttext .= "<form action=\"?confirm\" method=\"post\"><table border=\"0\" width=\"100%\" cellpadding=\"3\" cellspacing=\"0\">";
$carttext .="<tr>";
$split = explode(",",$list);
foreach ($split as $item) {
$check = explode("+",$item);
$query = mysql_query("SELECT p.id, p.urlname, p.name, p.group_join_category, p.price, c.name, p.photo_foto, c.urlname FROM catalog_prod as p left join catalog_category as c ON p.group_join_category=c.id WHERE p.id=$check[0]");
$row = mysql_fetch_row($query);
$row[10]="руб.";
$add_item="";
$add_item.=$row[1]."/";
$carttext .= "</tr><tr>";
if (!empty($row[6])) {
if(file_exists($_SERVER['DOCUMENT_ROOT'].$row[6])) {
$fo1 = '<img style="border:3px solid #f1f1f1;" src="/image.php/image-name.jpg?width=100&cropratio=1:1&image='.$row[6].'" alt="'.$row[2].'" width="100" height="100" align="left" />';}
else {$fo1 = '<img style="border:3px solid #f1f1f1;" src="/images/nofoto.png" alt="'.$row[2].'" width="100" height="100" align="left" />';}
} else {
$fo1 = '<img style="border:3px solid #f1f1f1;" src="/images/nofoto.png" alt="'.$row[2].'" width="100" height="100" align="left" />';
}
$carttext .= "<td valign=\"top\" width=\"100\">
<a href=\"/catalog/$row[7]/$add_item\">$fo1</a></td><td class=\"catlist\" valign=\"top\" width=\"100%\"><a href=\"/catalog/$row[7]/$add_item\">$row[2]</a></td>";
$carttext .= "<td valign=\"top\" class=\"catlist\" nowrap=\"nowrap\">$row[4] $row[10]</td>";
$carttext .= '<td valign=\"top\" class="catlist"><input type="hidden" value="'.$row[4].'" name="curprice" id="'.$check[0].'_curprice" /><input type="text" maxlength="5" size="3" style="width:20px" name="'.$check[0].'_amount" value="'.$check[1].'" id="'.$check[0].'_amount" class="basketinput1" onKeypress="onlyDigit(event);" onkeyup="updateBasket('.$check[0].');" /></td>';
$price = $row[4] * $check[1];
$price = sprintf("%0.2f", $price);
$carttext .= "<td valign=\"top\" class=\"catlist\" nowrap>$price $row[10]</td>";
$carttext .= '<td valign=\"top\" class="catlist"><input type="button" onclick="xajax_DelFromCart('.$check[0].');" value="Удалить" class="cartsubmit1" /></td>';
if (!IsSet($total1)) {
$total1 = 0;
}
if (!IsSet($totalcheck1)) {
$totalcheck1 = 0;
}
$total1 = $total1+ $price;
$totalcheck1 = $totalcheck1 + $check[1];
$total1 = sprintf("%0.2f", $total1);
}
$carttext .= "</tr><tr>";
$carttext .= "</tr><tr>";
$carttext .= "<td colspan=\"6\"><div style=\"border-bottom: solid 1px #3e1f16; padding: 5px 0 0 0; font-size:1px;\"> </div></td>";
$carttext .= "</tr><tr>";
$carttext .= "<td width=\"100%\" colspan=\"3\" class=\"catlist1\"><b>Итого:</b></td>";
$carttext .= "<td class=\"catlist1\">$totalcheck1</td>";
$carttext .= "<td class=\"catlist1\" colspan=\"2\" nowrap><b>$total1 $value</b></td>";
$carttext .= "</tr><tr>";
$carttext .= '';
$carttext .= "<td colspan=\"6\"><div style=\"border-bottom: solid 1px #3e1f16; padding: 1px 0 0 0; font-size:1px;\"> </div><br><input type=\"submit\" value=\"Оформить заказ\" class=\"inputsubmit1\" /></td>";
$carttext .= "</tr></table></form></div>";
?>
Специалист формирует корзину товаров. ЗП 1500$
+142
void BloomPattern::process(GLuint rectangleVao, float blurRadius) const
{
sptrFrameBufferTwo->enable();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
sptrBrightPassShaderProgram->enable();
glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, sptrFrameBufferThree->getColorTexture().getTexture());
sptrBrightPassShaderProgram->setUniform("colorTexture", 0);
glBindVertexArray(rectangleVao);
glViewport(0, 0, windowWidth >> 1, windowHeight >> 1);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
sptrFrameBufferOne->enable();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
sptrBlurShaderProgram->enable();
glBindTexture(GL_TEXTURE_2D, sptrFrameBufferTwo->getColorTexture().getTexture());
sptrBlurShaderProgram->setUniform("defaultTexture", 0);
sptrBlurShaderProgram->setUniform("blurRadius", 1.0F / (windowWidth >> 1), 0.0F, blurRadius);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
sptrFrameBufferTwo->enable();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
glBindTexture(GL_TEXTURE_2D, sptrFrameBufferOne->getColorTexture().getTexture());
sptrBlurShaderProgram->setUniform("defaultTexture", 0);
sptrBlurShaderProgram->setUniform("blurRadius", 0.0F, 1.0F / (windowHeight >> 1), blurRadius);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
sptrFinalFrameBuffer->enable();
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
sptrBloomShaderProgram->enable();
glBindTexture(GL_TEXTURE_2D, sptrFrameBufferThree->getColorTexture().getTexture());
glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, sptrFrameBufferTwo->getColorTexture().getTexture());
sptrBloomShaderProgram->setUniform("defaultTexture", 0);
sptrBloomShaderProgram->setUniform("brightpassTexture", 1);
glViewport(0, 0, windowWidth, windowHeight);
glDrawElements(GL_TRIANGLES, 6, GL_UNSIGNED_SHORT, nullptr);
glBindFramebuffer(GL_FRAMEBUFFER, 0);
}