- 1
- 2
- 3
- 4
- 5
- 6
if($row['status_id'] != 6){
if($row['assist_type'] == 0){
$row['assist_type'] == 3;
}
...
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+147
if($row['status_id'] != 6){
if($row['assist_type'] == 0){
$row['assist_type'] == 3;
}
...
}
:-|
+110
public partial class ProductForm : Form
{
private delegate bool ProductManipulation();
private static ProductManipulation pmd;
public ProductForm()
{
InitializeComponent();
this.FormClosing += this.ProductForm_Closing;
ProductsLB.DoubleClick += this.ChangeBtn_Click;
ProductsLB.Click += this.LoadProductKey;
pmd = LoadDataToLB;
pmd();
}
...
private void AddBtn_Click(object sender, EventArgs e)
{
pmd -= LoadDataToLB;
pmd += AddProduct + pmd;
pmd += LoadDataToLB;
pmd();
pmd -= AddProduct;
}
...
Обильное делегирование
+142
CREATE TABLE `users` (
нормальные поля типо имя
`ff` text NOT NULL,
`da` char(100) NOT NULL,
Дали мне дампик таблицы... В полях ДА! вот это...
00A00A00000A0A0AA793655265A00AA000000A00 00A000A72540000AA0A00560A000000A9A990000 0000AAA00000104A004010A00A000A0A0A0AA599 135A00A000A0A0000A00000000A4A450000A0AAA 010AAAA000AA9A0000AAAAA0AAA0A000104AA04A AAA000A0000A00000000AAA000A0A00000000A00 0070000AA00A0000000000A0000000A00000A080 900A0000000A00A00000AAA0000A000A00000000 A00000A0A000000000000070000A00000A000000 00A00000000000A000001A1A0000000000000000 0A00000A00000000A00000000A0A0A000A000A00 0000000000000A00AAAA00AAA000A0A00A0000A0 00AAAAA0A0AA0A00A000','01000000000100000 000000001B261000000000000000000000000000 0000000000000000000000000000000000000000 000
−106
def simpleEncrDecr( alphabet, alphabetKey, encrDecrWord, triger) #простой метод одну букву из алфавита заменяет другой
alphabet = alphabet.chars.to_a
alphabetKey = alphabetKey.chars.to_a
encrDecrWord = encrDecrWord.chars.to_a
if triger == 'encryption' then
for i in 0..encrDecrWord.length-1
encrDecrWord[i] = alphabetKey[alphabet.rindex(encrDecrWord[i])]
end
elsif triger == 'decryption'
for i in 0..encrDecrWord.length-1
encrDecrWord[i] = alphabet[alphabetKey.rindex(encrDecrWord[i])]
end
else
p "You is looser! :-)"
end
encrDecrWord.join
end
def manyAlphEncrDecr( alphabet, alpKey, encrDecrWord, triger) #для закодування нужное слово которое будет ключом
alphabet = alphabet.chars.to_a
encrDecrWord = encrDecrWord.chars.to_a
if triger == 'encryption' then
for i in 0..encrDecrWord.length-1
sum = alphabet.rindex(encrDecrWord[i])+alphabet.rindex(alpKey[i])
encrDecrWord[i] = alphabet[sum%alphabet.length]
end
elsif triger == 'decryption'
for i in 0..encrDecrWord.length-1
div = alphabet.rindex(encrDecrWord[i])-alphabet.rindex(alpKey[i])
encrDecrWord[i] = alphabet[div]
end
else
p "You is looser! :-)"
end
encrDecrWord.join
end
def permutationEncrDecr( permKeyNew, encrDecrWord, triger) #меняет местами буквы в соответствии с ключом, 1234 <=> 3241
encrDecrWord = encrDecrWord.chars.to_a
encrDecrWordNew = Array.new
if triger == 'encryption' then
for i in 0..encrDecrWord.length-1
encrDecrWordNew[i] = encrDecrWord[permKeyNew[i]]
end
elsif triger == 'decryption'
for i in 0..encrDecrWord.length-1
encrDecrWordNew[permKeyNew[i]] = encrDecrWord[i]
end
else
p "You is looser! :-)"
end
encrDecrWordNew.join
end
def frequencyAnalysis(textForAnalis) #частотный анализ текста (подсчет букв)
analisHash = Hash.new
for i in 0..textForAnalis.length-1
analisHash[textForAnalis[i]] = 0
end
for i in 0..textForAnalis.length-1
analisHash[textForAnalis[i]] += 1
end
puts "Frequency Analysis - #{analisHash}"
end
p "Alphabet - #{alphabet = ('0'..'z').to_a.join}"
print "Enter words for encryption/decryption:"
wordForEncryped = gets.chomp
print "Type method:\n1-simple\n2-many alphabetic\n3-permutation\n"
method = gets.chomp
case
when method == '1' then
puts "Key for alphabet - #{alphabetKey = alphabet.chars.to_a.shuffle.join}"
puts "Simple Encryped - #{encrypedWord = simpleEncrDecr( alphabet, alphabetKey, wordForEncryped, 'encryption')}"
frequencyAnalysis(encrypedWord)
puts "Simple Decryped - #{simpleEncrDecr( alphabet, alphabetKey, encrypedWord, 'decryption')}"
when method == '2' then
print "Enter word for many alphabetical encryption/decryption:"
wordForManyAlphKey = gets.chomp.chars.to_a
manyAlphKey = Array.new
for i in 0..wordForEncryped.length-1
manyAlphKey[i] = wordForManyAlphKey[i%wordForManyAlphKey.length]
end
puts "Many Alphabetic Encryped - #{encrWordForManyAlph = manyAlphEncrDecr( alphabet, manyAlphKey, wordForEncryped, 'encryption')}"
frequencyAnalysis(encrWordForManyAlph)
puts "Many Alphabetic Decryped - #{manyAlphEncrDecr( alphabet, manyAlphKey, encrWordForManyAlph, 'decryption')}"
when method == '3' then
print 'Please typed key(f.e. 23451):'
permKey = gets.chomp.chars.to_a
lengthForSum = permKey.length
newPermKey = Array.new
for i in 0..wordForEncryped.length-1
lengthForSum += permKey.length if i==lengthForSum
newPermKey[i] = permKey[i%permKey.length].to_i + lengthForSum - permKey.length-1
end
puts "Permutation Encryped - #{encrypedWordForPrem = permutationEncrDecr( newPermKey, wordForEncryped, 'encryption')}"
frequencyAnalysis(encrypedWordForPrem)
puts "Permutation Decryped - #{permutationEncrDecr( newPermKey, encrypedWordForPrem, 'decryption')}"
else p 'Incorect typed'
end
Методьі кодирования
1. простой метод одну букву из алфавита заменяет другой
2. для закодування нужное слово которое будет ключом
3. меняет местами буквы в соответствии с ключом, 1234 <=> 3241
4. частотный анализ текста (подсчет букв)
у каждого метода кроме 4 есть триггер - выбор в каком режиме метод будет работать (кодирование или декодирование)
+65
for (...) {
Comparator<Date> date_comparator = new Comparator<Date>() {
@Override
public int compare(Date s1, Date s2) {
long n1 = s1.getTime();
long n2 = s2.getTime();
if (n1 < n2)
return -1;
else if (n1 > n2)
return 1;
else
return 0;
}
};
Date beforeSaveDate = (Date) beforeSaveParam.getValue();
beforeSaveDate.setSeconds(0);
Date toSaveDate = (Date) toSaveParam.getValue();
comparedValue = date_comparator.compare(beforeSaveDate, toSaveDate);
}
Задача была сравнить две даты, игнорируя при этом секунды.
+167
$zfunctv=0;
if ($zfunctv==1 || $zfunctv==2 || $zfunctv==3 || $zfunctv==4) require_once('function1.php');
if ($zfunctv==2 || $zfunctv==3) require_once('function2.php');
if ($zfunctv==3 || $zfunctv==4) require_once('function3.php');
if ($zfunctv==''){
require_once('function1.php');//Для всех окон
require_once('function2.php');//Для полноразмерных окон
require_once('function3.php');//Для оборудования
require_once('admfunct.php');
}
Какого хрена? Как это работает?! Код коммерческой системы UserSide v2.48
+132
#include <iostream>
#include <cstdio>
#include <cstring>
#include <cstdlib>
#include <time.h>
char a[150],c[150];
int main(int argc, char **argv) {
FILE * tmp;
while(1) {
int b=0,b1=0;
bool A=0;
tmp=fopen(".tmp.txt","r");
fgets(c,150,tmp);
fclose(tmp);
system("rm .tmp.txt");
system("xwininfo -tree -root | grep -i '\\- deadbeef-0.5.1' > .tmp.txt");
tmp=fopen(".tmp.txt","r");
fgets(a,150,tmp);
fclose(tmp);
for(int i=16;i<149;i++) {
c[i-16]=c[i];
a[i-16]=a[i];
if(a[i-16]=='-')
b++;
if(c[i-16]=='-')
b1++;
if(b==2)
a[i-16]=0;
if(b1==2)
c[i-16]=0;
}
for(int j=0;j<(int)strlen(c);j++) {
if (a[j]!=c[j]) A=true;
}
if (A) {
char lamp[]="/usr/bin/purple-remote \"setstatus?status=available&message=";
strcat(lamp,a);
strcat(lamp,"\"");
system(lamp);
}
sleep(5);
}
return 0;
}
Реализация аналога pidgin-musictracker для deadbeef
+123
Попался на одном сайте опрос:
Approximately how speedy is your Internet connection?
Pony express
512kb/s
1Mb/s
2Mb/s
4Mb/s
10Mb/s
100Mb/s
Greased lightning
Увидев первый пункт в опросе, и учитывая местный культ, решил поделиться :)
+121
ibox.com.ua/
ibox.com.ua/index.php
Решил тут найти почитать что можно пополнить через терминал ibox. Там флешка и закрыть ее я не нашел где... ну ради прикола на index.php ринулся.
На сервере установлен PHP версии 5.1.6, однако для WordPress 3.3.1 требуется хотя бы 5.2.4.
Ну вот скажите разве такая прибыльная компания не может себе нормальный сайт заказать?
−129
SELECT COUNT(*) FROM passwords WHERE program=program AND website=website AND login=login AND password=password
Okay :(