- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
std::string s1;
std::string s2;
int ret = strcmp(s1.c_str(), s2.c_str()); //А здесь мы сравниваем строки
if (ret == 0)
{
....
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+7
std::string s1;
std::string s2;
int ret = strcmp(s1.c_str(), s2.c_str()); //А здесь мы сравниваем строки
if (ret == 0)
{
....
}
+148
if(mysql_num_rows($records_sql)<1){
$_SESSION['site_msg']='no_user_found';
header('Location: customer_listing.php');
echo '<script type="text/javascript">';
echo 'window.location.href="customer_listing.php";';
echo '</script>';
echo '<noscript>';
echo '<meta http-equiv="refresh" content="0;url=customer_listing.php" />';
echo '</noscript>';
exit();
}
чтоб наверняка
+152.7
function handleServerResponse()
{
document.getElementById("guest").innerHTML = "<table width='100%'><tr><td align='center' valign='center'><p style='color:gray;text-align:center;'>" + xmlHttp.responseXML.documentElement.getElementsByTagName("ok").item(0).firstChild.data + "</p></td></tr></table>\n";
}
Обработка данных AJAX-ом.
+138.9
public static void loadDataToDataGridView(DataGridView objDataGridView, List<object> objResultSet, IList objects)
{
if (objDataGridView == null || objResultSet == null) return;
objDataGridView.Rows.Clear();
for (int i = 0; i < objResultSet.Count; i++)
{
for (int columnIndex = 0; columnIndex < ((List<object>)objResultSet[i]).Count; columnIndex++)
{
if (columnIndex == 0)
{
objDataGridView.Rows.Add();
}
objDataGridView.Rows[i].Cells[columnIndex].Value = ((List<object>)objResultSet[i])[columnIndex];
}
if (objects != null)
{
objDataGridView.Rows[i].Tag = objects[i];
}
}
}
public static void loadDataToDataGridView(DataGridView objDataGridView, List<object> objResultSet)
{
loadDataToDataGridView(objDataGridView, objResultSet, null);
}
...
use of this code:
...
List<object> values = new List<object>();
List<object> value = new List<object>();
if (_objPriceFormationFormula.RateVsEuro == 0)
{
value.Add(UtilHelper.Number2String(1.00,2));// String.Format(UtilHelper.getCultureInfo(),UtilHelper.NUMBERIC_FORMAT_2,1.00));//1.00
}
else
{
value.Add(UtilHelper.Number2String(_objPriceFormationFormula.RateVsEuro,2));// String.Format(UtilHelper.getCultureInfo(),UtilHelper.NUMBERIC_FORMAT_2,_objPriceFormationFormula.RateVsEuro));
}
values.Add(value);
UtilHelper.loadDataToDataGridView(this.dgridPFF2, values);
Instead of databind :)
+153
<?php
$thelist = array();
$dir = './upload/ftp/';
if ($handle = opendir($dir)) {
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != ".." && $file !="index.php" && $file !=".ftpquota") {
$file = $file;
$thelist[] = array('file' => $file, 'filemtime' => filemtime($file), 'filesize' => filesize($file));
}
}
closedir($handle);
}
?>
<?php
for($i = 0; $i < count($thelist); $i++) {
?><a href="sitename/<?=$thelist[$i]['file']?>"><?=$thelist[$i]['file']?></a><?php
}
?>
+155
if ( in_array($str, $first) )
{
for ( $j = 0; in_array($str . substr("000000000", 0, 9 - strlen("$j")) . $j, $first); ++$i );
$str = $str . substr( "000000000", 0, 9 - strlen("$j") ) . $j;
}
что этот код делает?
+155.7
<a href="#" onclick="if ($('#pasteLinkBlock').is(':visible')) $('#pasteLinkBlock').hide('fast'); else $('#pasteLinkBlock').show('fast'); return false">
Про toggle аффтар никогда не слышал...
+144.9
/a-z{3,}/.test(str);
Проверка содержит ли функция 3 символа алфавита или больше.
Правильно так: /[a-z]{3,}/
+144.9
$data=funny_parser($data);
//модуль недобавления слов вконец
$andtr=array('Андатра','Выпь','Пеликан','Пучеглаз','Хвостозуб','Декроль','Устрица','Челюстёлог','Рукоед','Йыждивение','Оторопь','Осётр','Кингура','Большой лось','Пученоска','Вомбат','Плоскогубка','');
$data=$data.' <span style="color:#93FF4A;font-size:15px">'.$andtr[rand(0,count($andtr)-1) ].'</span>';
кусок кода из upyachka.ru =)
этим всё сказано
+158
//============================================================================================================================================
function isadekvat($ps_user){
global $conn1,$zright;
$pb1=1;
$rs_2=mysql_query("select STATUS from tbl_user where CODE=".$ps_user,$conn1);
$rs=mysql_fetch_array($rs_2);
$ps1=$rs['STATUS'];
mysql_free_result($rs_2);
$rs_2=mysql_query("select * from tbl_user_status where CODE=".$ps1,$conn1);
$rs=mysql_fetch_array($rs_2);
if ($rs['DO_MODER']==1){
if ($zright['DO_MODERATOR']==1 || $zright['DO_SET']==1){
$pb1=1;
}else{
$pb1=0;
}
}
if ($rs['DO_MODERATOR']==1 || $rs['DO_SET']==1){
if ($zright['DO_SET']==1){
$pb1=1;
}else{
$pb1=0;
}
}
mysql_free_result($rs_2);
return $pb1;
}
//============================================================================================================================================
Проверка пользователя на адекватность
Magneto