- 1
- 2
Стартовал форум работы еще много, тестить уже можно
http://gvforum.ru/
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+113
Стартовал форум работы еще много, тестить уже можно
http://gvforum.ru/
0
Type: Null
https://bulbapedia.bulbagarden.net/wiki/Type:_Null_(Pok%C3%A9mon)
+21
class socket_exception
{
public:
char *buf;
int ret;
socket_exception()
{
buf=new char[10000];
ret=RET_OK;
}
socket_exception(char *b, int r)
{
buf=new char[10000];
snprintf(buf,9999,"%s",b);
ret=r;
}
socket_exception(vsocket_exception &ex)
{
buf=new char[10000];
snprintf(buf, 9999, "%s", ex.buf);
ret=ex.ret;
}
const char * what (){return buf;}
int get_ret(){return ret;}
~socket_exception(){delete[] buf;}
};
фрактал
+102
function naq(a:integer;n:integer;m:integer):string;
var astr:string;
begin
astr:=inttostr(a);
case m of
1: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*1)+'*p^'+inttostr(n+1);
2: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*2)+'*p^'+inttostr(n+1)+'+'+inttostr(a*1)+'*p^'+inttostr(n+2);
3: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*3)+'*p^'+inttostr(n+1)+'+'+inttostr(a*3)+'*p^'+inttostr(n+2)+'-'+inttostr(a*1)+'*p^'+inttostr(n+3);
4: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*4)+'*p^'+inttostr(n+1)+'+'+inttostr(a*6)+'*p^'+inttostr(n+2)+'-'+inttostr(a*4)+'*p^'+inttostr(n+3)+'+'+inttostr(a*1)+'*p^'+inttostr(n+4);
5: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*5)+'*p^'+inttostr(n+1)+'+'+inttostr(a*10)+'*p^'+inttostr(n+2)+'-'+inttostr(a*10)+'*p^'+inttostr(n+3)+'+'+inttostr(a*5)+'*p^'+inttostr(n+4)+'-'+inttostr(a*1)+'*p^'+inttostr(n+5);
6: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*6)+'*p^'+inttostr(n+1)+'+'+inttostr(a*15)+'*p^'+inttostr(n+2)+'-'+inttostr(a*20)+'*p^'+inttostr(n+3)+'+'+inttostr(a*15)+'*p^'+inttostr(n+4)+'-'+inttostr(a*6)+'*p^'+inttostr(n+5)+'+'+inttostr(a*1)+'*p^'+inttostr(n+6);
7: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*7)+'*p^'+inttostr(n+1)+'+'+inttostr(a*21)+'*p^'+inttostr(n+2)+'-'+inttostr(a*35)+'*p^'+inttostr(n+3)+'+'+inttostr(a*35)+'*p^'+inttostr(n+4)+'-'+inttostr(a*21)+'*p^'+inttostr(n+5)+'+'+inttostr(a*7)+'*p^'+inttostr(n+6)+'-'+inttostr(a*1)+'*p^'+inttostr(n+7);
8: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*8)+'*p^'+inttostr(n+1)+'+'+inttostr(a*28)+'*p^'+inttostr(n+2)+'-'+inttostr(a*56)+'*p^'+inttostr(n+3)+'+'+inttostr(a*70)+'*p^'+inttostr(n+4)+'-'+inttostr(a*56)+'*p^'+inttostr(n+5)+'+'+inttostr(a*28)+'*p^'+inttostr(n+6)+'-'+inttostr(a*8)+'*p^'+inttostr(n+7)+'+'+inttostr(a*1)+'*p^'+inttostr(n+8);
9: naq:=astr+'*p^'+inttostr(n)+'-'+inttostr(a*9)+'*p^'+inttostr(n+1)+'+'+inttostr(a*36)+'*p^'+inttostr(n+2)+'-'+inttostr(a*84)+'*p^'+inttostr(n+3)+'+'+inttostr(a*126)+'*p^'+inttostr(n+4)+'-'+inttostr(a*126)+'*p^'+inttostr(n+5)+'+'+inttostr(a*84)+'*p^'+inttostr(n+6)+'-'+inttostr(a*36)+'*p^'+inttostr(n+7)+'+'+inttostr(a*9)+'*p^'+inttostr(n+8)+'+'+inttostr(a*1)+'*p^'+inttostr(n+9);
end;
end;
Лень было искать алгоритм раскрытия (1-q)^n
+160
$url = $_SERVER['HTTP_REFERER'];
$pos = strrpos($url, 'id');
$id = substr($url, $pos + 2);
Получаем id человека)))
−2
// POST /login
exports.login = function login(req, res) {
var email = req.body.email;
var password = req.body.password;
security.rateLimitRequest( 'reset', req, function( err ) {
if ( err )
return res.status( 400 ).send( err );
db.Account.find({email: email, password: password}, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.getAccountStatistics(account, function(err, account) {
if ( err )
return res.status( 400 ).send( err );
account.incrementAccountLoginCount(account, function(err) {
if ( err )
return res.status( 400 ).send( err );
res.send(account);
});
});
});
});
});
У меня радость во все поля:
// POST /login
exports.login = function *login() {
var email = req.body.email;
var password = req.body.password;
try
{
// Throws an error if rate limit exceeded
yield security.rateLimitRequest( 'reset', req );
// Query MongoDB for account
var account = yield db.Account.find({email: email, password: password});
account.statistics = yield account.getAccountStatistics(account);
// Increment login count
yield account.incrementAccountLoginCount(account);
this.body = account;
}
catch( err ) {
// Return the error as JSON
return res.status( 400 ).send( err );
}
});
+3
foreach($arResult['ITEMS'] as $key => &$arItem) {
$priceRes2 = CIBlockElement::GetList(array(), array("IBLOCK_ID" => 34, "PROPERTY_PERIOD" => 1, "PROPERTY_PERIOD_TYPE" => 85, "PROPERTY_OBJECT_RELATION" => $arItem['ID']), false, false, array("NAME"));
"Я программист 1C-bitrix и с каждой новой итерацией я делаю новый запрос к инфоблоку."
+119
Почитываю иногда комменты на govnokod.ru
Сложилось впечатление, что Stertor, bormand, kegdan, inkanus-gray, 1024--, и многие другие - один и тот же человек
так ли это?
+1
using System;
namespace Test
{
public class HttpException : Exception
{
public HttpException(int status)
{
StatusCode = status;
}
public int StatusCode { get; set; }
}
class Program
{
static void TestCatch(int status)
{
try
{
throw new HttpException(status);
}
catch (HttpException ex) when (ex.StatusCode == 404)
{
Console.WriteLine("Not Found!");
}
catch (HttpException ex) when (ex.StatusCode >= 500 && ex.StatusCode < 600)
{
Console.WriteLine("Server Error");
}
catch (HttpException ex)
{
Console.WriteLine("HTTP Error {0}", ex.StatusCode);
}
}
static void Main(string[] args)
{
TestCatch(404);
TestCatch(501);
TestCatch(101);
}
}
}
https://ideone.com/zXstg3
Именно поэтому я за «C#».
+143
private void bSaveLog_Click(object sender, EventArgs e)
{
String x = Game.choosen().name;
String y = "Data\\" + x + ".txt";
FileInfo file = new FileInfo(y);
DirectoryInfo di = Directory.CreateDirectory("Data\\");
if (file.Exists == false)
{
file.Create();
using (StreamWriter sw = file.AppendText())
{
sw.WriteLine("Hello");
sw.WriteLine("And");
sw.WriteLine("Welcome");
sw.Flush();
sw.Close();
}
}
}
Помогите советом мудрым, почему при записи в файл выдаёт "Процесс не может получить доступ к файлу..."? Как сделать правильно?