- 1
[color=green][s][u][b][size=20]ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ[/size][/color][/b][/u][/s]
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−1
[color=green][s][u][b][size=20]ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ[/size][/color][/b][/u][/s]
ДАВАЙТЕ ФЛУДИТЬ И ТРОЛЛИТЬ
+142
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
session_start();
require "db.php";
$id = $_GET["id"];
pagedel($id);
header ("location: index.php");
function pagedel($id){ // функция удаления страниц
$sql = "DELETE FROM mesage WHERE id=$id";
mysql_query($sql) or die (mysql_error());
}
?>
не работает фукция удаления строки
+82
public class main {
public static void main(String[] args) {
Boolean[] table = new Boolean[1000001];
for(int i=2; i<=1000000; i++) {
table[i]=true;
}
Boolean cont=true;
int p=2;
while(cont) {
for(int i=2; i<=1000000; i++) {
try{
table[p*i]=false;
}
catch(Exception e) {}
}
int find=2;
while(!table[find]) find++;
if(find==2) {cont=false; break;}
p=find;
}
for(int i=2; i<=1000000; i++) {
if(table[i]) System.out.println(i);
}
}
}
Коротко о том, как найти нечетные числа от 2 до 1000000
−104
return (loginLength * passwordLength) > 0 ? YES:NO;
А вдруг?
+73
GZIPOutputStream out = new GZIPOutputStream(out) {
{
def.setLevel(Deflater.BEST_COMPRESSION);
}
};
Вот так можно выставить максимальную степень сжатия GZIP-потока в жабе.
+171
public abstract class BaseDateTime
extends AbstractDateTime
implements ReadableDateTime, Serializable {
/** The millis from 1970-01-01T00:00:00Z */
private volatile long iMillis;
/** The chronology to use */
private volatile Chronology iChronology;
/////////////////////////////////////////////////////////////////
/*
* DateTime is thread-safe and immutable, provided that the Chronology is as well.
* All standard Chronology classes supplied are thread-safe and immutable.
*
* @see MutableDateTime
*/
public final class DateTime
extends BaseDateTime
Любителям joda-time.
Cмущает меня этот volatile, который приходит в немутабельный класс от родителя.
+142
private static string AddStr(string s1, string s2)
{
string result;
if (s1 == string.Empty)
{
result = s2;
}
else
{
if (s2 == string.Empty)
{
result = s1;
}
else
{
result = s1 + " " + s2;
}
}
return result;
}
Код - бессмысленный и беспощадный
+131
int rotate(int a, int k) {
return (a << k) | (a >> (32-k));
}
Вращение на k бит влево.
+24
void sleep_in_qt_ms(unsigned millisec) {
QMutex foo;
foo.lock();
foo.try_lock(millisec);
foo.unlock();
}
sleep в Qt - что, серьезно, чтоли?
особенно порадовало: Warning: Destroying a locked mutex may result in undefined behavior.
действительно, накой нам деструкторы?
+66
// генрация паролей
function generatePassword($l = 8) {
function make_seed() {
list($usec, $sec) = explode(' ', microtime());
return (float) $sec + ((float) $usec * 100000);
}
$le = split('-', 'q-w-e-r-t-y-u-i-o-p-a-s-d-f-g-h-j-k-l-z-x-c-v-b-n-m-q-W-E-R-T-Y-U-I-O-P-A-S-D-F-G-H-J-K-L-Z-X-C-V-B-N-M-7-2-1-8-6-3-8-7-2-1-6-0-9-g-s-a-d-f-k-a-k-j-w-q-h-2-7-8-1-6-3-g-d-h-m-H-U-F-G-K-J-H-A-S-G-J-G');
$password = '';
while (strlen($password)<$l) {
srand(make_seed());
$rnd = rand(0, count($le)-1);
$password.=$le[$rnd];
}
return $password;
}
Крайне хардкорный генератор случайных паролей заданной длины. Особенно гениальна строчка №7. Всем говнокоду за мой счет!