- 1
Change mysql_query to @mysql_query and so on for the other references to suppress the error messages returned from the function calls.
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+121
Change mysql_query to @mysql_query and so on for the other references to suppress the error messages returned from the function calls.
Ответ на одном форуме, относится к куску кода на PHP. Решил накласть в кучу.
+82
//////////////
TextBuilder sb = new TextBuilder();
sb.append("<html>");
sb.append(new StringBuilder("<head><title>" + this.getTitle() + "</title></head><body><img src=\"....\">"));
sb.append("</body></html>");
В детстве видимо, матрёшек было маловато..
+120
using System;
class C
{
static void Main()
{
क्ष(0);
}
static void क्ष(int x) { Console.WriteLine(1); }
static void क्ष(object x) { Console.WriteLine(2); }
}
Что будет напечатано ?
Оч понравилось, нашел на простора интырнета (пардон если повтор)
+164
IEB = (uagent.indexOf('msie') != -1) ? true : false;
+152
$datetime=strtotime($new["date"]);
$m=date("m", $datetime);
if($m=='01') { $month="Янв"; }
if($m=='02') { $month="Фев"; }
if($m=='03') { $month="Март"; }
if($m=='04') { $month="Апр"; }
if($m=='05') { $month="Май"; }
if($m=='06') { $month="Июнь"; }
if($m=='07') { $month="Иль"; }
if($m=='08') { $month="Авг"; }
if($m=='09') { $month="Сен"; }
if($m=='10') { $month="Окт"; }
if($m=='11') { $month="Ноя"; }
if($m=='12') { $month="Дек"; }
$date = date("d", $datetime);
http://www.askdev.ru/php/6048/%D0%A0%D0%B5%D0%B0%D0%BB%D0%B8%D0%B7%D0% B0%D1%86%D0%B8%D1%8F-%D1%88%D0%B0%D0%B1%D0%BB%D0%BE%D0%BD%D0% BE%D0%B2-%D0%BD%D0%B0-PHP/
+78
public static DBFactory getInstance() throws SQLException
{
synchronized (DBFactory.class)
{
if (_dbinstance == null)
_dbinstance = new DBFactory();
}
return _dbinstance;
}
Серийный и беспощадный доступ к инстансу ДБ-Фэктори -_-
Причем, данный код фурычит в многопоточной среде, где порой по 20-30 потоков одновременно обращаются к Фэктори, чтобы взять коннект с пула.
+140
if (m_socket == INVALID_SOCKET)
{
printf("Client: socket() - Error at socket(): %ld\n", WSAGetLastError());
WSACleanup();
return EXIT_SUCCESS;
}
Лаба знакомого о сетям.
Очень, блин, SUCCESS!
+114
procedure TForm1.Button1Click(Sender: TObject);
var
a,b,c,x:integer;
chas, nedel1,nedel2,nedel3:integer;
begin
a:=0;
b:=0;
c:=0;
repeat
chas:= strtoint (edit1.text);
nedel1:= strtoint (edit2.text);
nedel2:= strtoint (edit3.text);
nedel3:= strtoint (edit4.text);
x:=((nedel1*a)+(nedel2*b)+(nedel3*c));
if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
a:=a+1;
if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
b:=b+1;
if chas<>((nedel1*a)+(nedel2*b)+(nedel3*c)) then
c:=c+1;
until chas=x;
label1.Caption:=inttostr (a);
label2.Caption:=inttostr (b);
label3.Caption:=inttostr (c);
end;
end.
евклид плачет
+163
$str = $note['count'];
$res = strpos($str, ',');
if($res){echo substr($str,0,$res);}else{echo $str;}
проверка на целое число
+165
class email_selector {
private static $number_per_page = 30;//
public function getNumberPerPage() {
return self::$number_per_page;
}
}
понятно, что это только кусок класса. увидев, просто не смог не запостить....