- 1
- 2
- 3
- 4
if (!isset($pmas_table[0][3])) $pmas_table[0][3]='';
if (!isset($pmas_table[0][5])) $pmas_table[0][5]='';
if (!isset($pmas_table[0][6])) $pmas_table[0][6]='';
if (!isset($pmas_table[0][7])) $pmas_table[0][7]='';
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+150
if (!isset($pmas_table[0][3])) $pmas_table[0][3]='';
if (!isset($pmas_table[0][5])) $pmas_table[0][5]='';
if (!isset($pmas_table[0][6])) $pmas_table[0][6]='';
if (!isset($pmas_table[0][7])) $pmas_table[0][7]='';
UserSide v2.48 again. Так как там каждая строчка имеет право быть на этом сайте, выкладываю The best of the best =)
+126
public static bool IsLong(string tmpStr)
{
bool blRetVal = true;
for (int i = 0; i < tmpStr.Length; i++)
{
if (tmpStr[i] != '0' && tmpStr[i] != '1' && tmpStr[i] != '2' &&
tmpStr[i] != '3' && tmpStr[i] != '4' && tmpStr[i] != '5' &&
tmpStr[i] != '6' && tmpStr[i] != '7' && tmpStr[i] != '8' &&
tmpStr[i] != '9')
blRetVal = false;
}
return blRetVal;
}
static public string ConvertDateTimeForSQL(DateTime tmpDateTime)
{
return (
tmpDateTime.Year.ToString() + "-" +
(tmpDateTime.Month < 10 ? "0" : "") + tmpDateTime.Month.ToString() + "-" +
(tmpDateTime.Day < 10 ? "0" : "") + tmpDateTime.Day.ToString() + " " +
(tmpDateTime.Hour < 10 ? "0" : "") + tmpDateTime.Hour.ToString() + ":" +
(tmpDateTime.Minute < 10 ? "0" : "") + tmpDateTime.Minute.ToString() + ":" +
(tmpDateTime.Second < 10 ? "0" : "") + tmpDateTime.Second.ToString());
}
static public string ConvertDateTimeShortForSQL(DateTime tmpDateTime)
{
return (tmpDateTime.Year.ToString() + "-" +
(tmpDateTime.Month < 10 ? "0" : "") + tmpDateTime.Month.ToString() + "-" +
(tmpDateTime.Day < 10 ? "0" : "") + tmpDateTime.Day.ToString());
}
-----------------------------------
P.S. Версия .NET 3.5
+65
for (...) {
Comparator<Date> date_comparator = new Comparator<Date>() {
@Override
public int compare(Date s1, Date s2) {
long n1 = s1.getTime();
long n2 = s2.getTime();
if (n1 < n2)
return -1;
else if (n1 > n2)
return 1;
else
return 0;
}
};
Date beforeSaveDate = (Date) beforeSaveParam.getValue();
beforeSaveDate.setSeconds(0);
Date toSaveDate = (Date) toSaveParam.getValue();
comparedValue = date_comparator.compare(beforeSaveDate, toSaveDate);
}
Задача была сравнить две даты, игнорируя при этом секунды.
+118
private Excel._Application _excel;
...
private void RefreshFormulas(FormulaRefreshOption formulaRefreshOption, object objectToRefresh)
{
//Где-то в дебрях километрового метода бросилось в глаза
...
try
{
Excel.Range intersection = selection, selection2 = selection;
while (selection2 != null)
{
intersection = _excel.Intersect(selection2, selection2.Dependents,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing,
Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing, Type.Missing);
System.Windows.Forms.Application.DoEvents();
excelUtilities.RecalculateRangeInstance(true, intersection/*_excel.Selection as Excel.Range*/);
selection2 = intersection;
}
}
catch (Exception) { /*ignore the exception because .Dependents will throw an exception if there aren't any dependents*/}
...
}
+144
$
+1001
void Object::destroy ()
{
evas_object_del (o);
// do a suicide as the delete operator isn't public available
// the reason is that the C design below is a suicide design :-(
//delete (this); // TODO: why does this make problems sometimes???
}
source: trunk/BINDINGS/cxx/elementaryxx/src/Object.cpp @ 65926
+166
<?php
@fwrite($fp, "<?php
\$config['dbhost'] = \"".str_replace("\"","\\\\\"",stripslashes(trim($_POST['dbhost'])))."\";
\$config['dbuser'] = \"".str_replace("\"","\\\\\"",stripslashes(trim($_POST['dbuser'])))."\";
\$config['dbpass'] = \"".str_replace("\"","\\\\\"",stripslashes(trim($_POST['dbpass'])))."\";
\$config['dbname'] = \"".str_replace("\"","\\\\\"",stripslashes(trim($_POST['dbname'])))."\";
\$config['dbpref'] = \"".str_replace("\"","\\\\\"",stripslashes(trim($_POST['dbprefix'])))."\";
?>");
?>
avecms нах.
+152
if(!$this->result = $this->dbo->query($this->sql))
{
throw new Exception('Error Query: '. $this->sql);
}
Ооо я знаю про исключения...
+168
preg_match('/(.*?)[.,!|]/',ltrim(preg_replace('/[\n\r]+/','|',strip_tags($item[$this->tooltip])),'|'),$regs);
жонглирование регулярками
+145
this.getRgbaAtColor = function(color)
{
color = (color.charAt(0)=="#") ? color.substring(1,9):color;
color = (color.substring(0,2)=="0x") ? color.substring(2,10):color;var r = parseInt(color.substring(0,2),16);
var g = parseInt(color.substring(2,4),16);
var b = parseInt(color.substring(4,6),16);
var a = color.substring(6,8);
a = (a=="") ? 255:parseInt(a,16);
return "rgba("+r+","+g+","+b+","+(a/255)+")";
}
геймдев..