- 1
- 2
- 3
<?
echo $i++ + ++$i;
?>
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+144.8
<?
echo $i++ + ++$i;
?>
+149.8
if( preg_match("#list(/$|$)#is", $requestUri) )
Человек никогда не слышал про квантификаторы в регулярных выражениях.
+154.8
//Таблица для пароля администратора
mysql_query("CREATE TABLE $admintable (
ID SMALLINT UNSIGNED NOT NULL auto_increment,
pass VARCHAR(30) NOT NULL,
PRIMARY KEY(ID)
)");
mysql_query("INSERT INTO $admintable (pass) VALUES ('')");
оригинальный способ хранения пароля администратора в системе nevius
+74.2
package efi.base.business.metadata;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
public class MetaModel {
private String name = null;
private List attributeNames = new ArrayList();
private List attributeValues = new ArrayList();
public MetaModel(String name) {
this.name = name;
}
public String getName() {
return name;
}
public void addAttribute(Attribute attribute) {
attributeNames.add(attribute.getName());
attributeValues.add(attribute);
}
public Attribute getAttribute(String attrubuteName) {
return (Attribute) attributeValues.get(attributeNames.indexOf(attrubuteName));
}
public Iterator attributesIterator() {
return attributeNames.iterator();
}
}
Человек, писавший этот говнокласс, видимо и не подозревал, что в JDK кроме листов есть еще и Map-ы :-)
−140.6
from random import randint
import sys
import re
def recupIP():
s = r"(%s)" % ("\.".join(['(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)']*4))
patt = re.compile(s)
fn = "ip.txt"
s = open(fn).read()
i = 0
global permulist
permulist = []
global recuplist
recuplist = []
while True:
m = patt.search(s, i)
if m:
recuplist.append(m.group(1))
i = m.end()+1
else:
break
#########convertir decimal au binaire###########
def decimalbinaire(string):
quotient=int(string)
liste=[]
global res
res=""
if quotient==0:
res="00000000"
else:
while quotient!=1:
liste=liste+[quotient%2]
quotient=quotient/2
liste=liste+[1]
while liste!=[]:
res=res+str(liste[-1])
liste=liste[:-1]
if len(res)<8:
octet=8-len(res)
res='0'*octet + res
return res
recupIP()
z = 0
binip,convert = [],[]
i=0
while i < len(recuplist):
string = str(recuplist[i])
string = string.split(".")
while z < len(string):
decimalbinaire(string[z])
binip.append(res)
z = z + 1
binip="".join(binip)
convert.append(binip)
i=i+1
Насколько я понял из условия того кто это делал - программа должна брать список IP-адресов, конвертить их в бинарный формат и затем, сохраняя формат, создавать новый список.
Реализацию я до конца понять не смог.
+144.8
#ifndef __gen_spi_h
#define __gen_spi_h
#ifndef SPI_PORT_TYPE_OVERRIDE
#define SPI_PORT_TYPE unsigned int
#endif
#ifndef SPI_BYTE_TYPE_OVERRIDE
#define SPI_BYTE_TYPE unsigned char
#endif
// SPI SS SIGNAL --- OUT
#define DECL_SS(N, P, B) \
volatile SPI_PORT_TYPE *const _##N##_SS_POUT = &(P##OUT); \
volatile SPI_PORT_TYPE *const _##N##_SS_PDIR = &(P##DIR); \
const SPI_PORT_TYPE _##N##_SS_BIT = B
// SPI SCK SIGNAL --- OUT
#define DECL_SCK(N, P, B) \
volatile SPI_PORT_TYPE *const _##N##_SCK_POUT = &P##OUT; \
volatile SPI_PORT_TYPE *const _##N##_SCK_PDIR = &(P##DIR); \
const SPI_PORT_TYPE _##N##_SCK_BIT = B
// SPI MOSI SIGNAL --- OUT
#define DECL_MOSI(N, P, B) \
volatile SPI_PORT_TYPE *const _##N##_MOSI_POUT = &P##OUT; \
volatile SPI_PORT_TYPE *const _##N##_MOSI_PDIR = &P##DIR; \
const SPI_PORT_TYPE _##N##_MOSI_BIT = B
// SPI MISO SIGNAL --- IN
#define DECL_MISO(N, P, B) \
volatile SPI_PORT_TYPE *const _##N##_MISO_PIN = &P##IN; \
volatile SPI_PORT_TYPE *const _##N##_MISO_PDIR = &P##DIR; \
const SPI_PORT_TYPE _##N##_MISO_BIT = B
#define SETSS(N) *(_##N##_SS_POUT) |= _##N##_SS_BIT
#define CLRSS(N) *(_##N##_SS_POUT) &= ~(_##N##_SS_BIT)
#define SETMOSI(N) *(_##N##_MOSI_POUT) |= _##N##_MOSI_BIT
#define CLRMOSI(N) *(_##N##_MOSI_POUT) &= ~(_##N##_MOSI_BIT)
#define SETCLK(N) *(_##N##_SCK_POUT) |= _##N##_SCK_BIT
#define CLRCLK(N) *(_##N##_SCK_POUT) &= ~(_##N##_SCK_BIT)
#define READMISO(N) (((*(_##N##_MISO_PIN)) & _##N##_MISO_BIT) != 0)
#define SPI_SETUP(N) \
SETSS(N); \
*(_##N##_SCK_PDIR) |= _##N##_SCK_BIT; \
*(_##N##_MOSI_PDIR) |= _##N##_MOSI_BIT; \
*(_##N##_SS_PDIR) |= _##N##_SS_BIT; \
*(_##N##_MISO_PDIR) &= ~(_##N##_MISO_BIT); \
CLRSS(N); \
SETSS(N)
#define DECL_SPI_TRANS_BYTE(N) \
SPI_BYTE_TYPE _##N##_spi_trans_byte(SPI_BYTE_TYPE val) { \
register SPI_BYTE_TYPE bitnum; \
for (bitnum = 0; bitnum < 8; bitnum++) { \
if (val & 0x80) SETMOSI(N); \
else CLRMOSI(N); \
val <<= 1; \
SETCLK(N); \
val |= READMISO(N); \
CLRCLK(N); \
} \
return val; \
} \
#define SPI_BEGIN(N) SETSS(N);CLRSS(N)
#define SPI_END(N) SETSS(N)
#define SPI_TRANS_BYTE(N, B) _##N##_spi_trans_byte((B))
#endif
−143.2
# Это не баш, это cmd.exe, просто в ListBox'e нет интерпретатора Винды, что намекает как бы, но коль родственно немного
# тем более покажемс Вам POSIX Винды
SET a1 = [time /T] && SET b1 = [\time.%a1%.tmp] && whoami /all > %b1% && notepad %b1% && edit %b1%
Это не баш, это cmd.exe, просто в ListBox'e нет интерпретатора Винды, что намекает как бы, но коль родственно немного, тем более покажемс Вам POSIX Винды.
+122.6
string[] mas_param = a.Split('_');
this.s_sw_neraspred = mas_param[15];
s_neraspred.Text = this.s_sw_neraspred;
int i = a.IndexOf("_", 0, a.Length);
sw_id = a.Substring(0, i);
int j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
mf_id = a.Substring(j, i - j);
//mf1=a.Substring(j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
ta_ed = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
this.s_op = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_rm = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_tm = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_sw = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
ta_sd = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
sw_sd = a.Substring(j, i - j);
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
sw_ed = a.Substring(j, i - j);
//mf_topsw
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
mf_topsw = a.Substring(j, i - j);
//s_op_topsw
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_op_topsw = a.Substring(j, i - j);
//s_rm_topsw
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_rm_topsw = a.Substring(j, i - j);
//s_tm_topsw
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_tm_topsw = a.Substring(j, i - j);
//s_sw_topsw
j = i + 1;
i = a.IndexOf("_", j, a.Length - j);
s_sw_topsw = a.Substring(j, i - j);
//ta
ta_id = a.Split('_')[mas_param.Length-1];
a - строка вида
{0}_{1}_{2}_{3}_{4}_{5}_{6}_{7}_{8}_{9}_ {10}_{11}_{12}_{13}_{14}_{15}_{16}
+96
char str[STR_LEN + 1];
strncpy(str, inpust_str, STR_LEN);
xxx[STR_LEN] = '\0';
str[ strlen(str) ] = ':';
str[ strlen(str) + 1 ] = '1';
str[ strlen(str) + 2 ] = '\0';
Попытка добавить ":1" к строке.
Первым же "str[ strlen(str) ] = ':';" гробим нулевой символ в конце строки. Дальнейшие вызовы "strlen" - просто фигня какая-то. Ну и портим память.
+152.6
function str_replace ( search, replace, subject ) { // Replace all occurrences of the search string with the replacement string
//
// + original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
// + improved by: Gabriel Paderni
if(!(replace instanceof Array)){
replace=new Array(replace);
if(search instanceof Array){//If search is an array and replace is a string, then this replacement string is used for every value of search
while(search.length>replace.length){
replace[replace.length]=replace[0];
}
}
}
if(!(search instanceof Array))search=new Array(search);
while(search.length>replace.length){//If replace has fewer values than search , then an empty string is used for the rest of replacement values
replace[replace.length]='';
}
if(subject instanceof Array){//If subject is an array, then the search and replace is performed with every entry of subject , and the return value is an array as well.
for(k in subject){
subject[k]=str_replace(search,replace,subject[k]);
}
return subject;
}
for(var k=0; k<search.length; k++){
var i = subject.indexOf(search[k]);
while(i>-1){
subject = subject.replace(search[k], replace[k]);
i = subject.indexOf(search[k],i);
}
}
return subject;
}
function str_replace(search, replace, subject) { return subject.split(search).join(replace);}