- 1
print('HELLO')
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−12
print('HELLO')
ОЧЕНЬ СЛОЖНЫЙ КОД
0
https://text.skynet.center/
"Это гениально! И, причём, для настоящих ценителей художественной литературы", - заявил Бот, и после этого
−1
// https://cdn.staticaly.com/gh/landawn/abacus-util/master/docs/MutableBoolean_view.html
// https://github.com/landawn/abacus-util/blob/76cb7c712d4ce2d167f9170f8d92fd9857db8f99/src/main/java/com/landawn/abacus/util/MutableBoolean.java
public final class MutableBoolean implements Mutable, Serializable, Comparable<MutableBoolean> {
/**
* Constructs a new MutableBoolean with the default value of false.
*/
MutableBoolean() {
super();
}
/**
* Constructs a new MutableBoolean with the specified value.
*
* @param value the initial value to store
*/
MutableBoolean(final boolean value) {
super();
this.value = value;
}
/**
*
* @param value
* @return
*/
public static MutableBoolean of(final boolean value) {
return new MutableBoolean(value);
}
/**
*
* @return true, if successful
*/
public boolean value() {
return value;
}
/**
* Sets the value.
*
* @param value the value to set
*/
public void setValue(final boolean value) {
this.value = value;
}
}
Тут человек изменяемый булеан сделал, что думаете? Функциональное программирование уже проиграло ООП?
+1
public class Main {
public static void main(String[] args) {
ThreeD[] f = {new ThreeD(5, 9, 7), new FourD(1,3,8,5)};
Coords<ThreeD> c = new Coords<>(f);
showXYZ(c);
FiveD[] x = new FiveD[] {new FiveD(11,22,3,4, 123)};
Coords<FiveD> b = new Coords<>(x);
showAll(b);
FiveD[] z = new FiveD[] {new FiveD(1,2,1,6,5)};
Coords<FiveD> zz = new Coords<>(z);
}
private static void showXY(Coords<? super FourD> c) {
for(int i = 0; i < c.coords.length; i++) {
System.out.println(c.coords[i].x +" "+ c.coords[i].y+" ");
}
}
private static void showXYZ(Coords<? extends ThreeD> c) {
for(int i = 0; i < c.coords.length; i++) {
System.out.println(c.coords[i].x +" "+ c.coords[i].y+" "+c.coords[i].z+" ");
}
}
private static void showAll(Coords<? extends FiveD> c) {
for(int i = 0; i < c.coords.length; i++) {
System.out.println(c.coords[i].x +" "+ c.coords[i].y+" "+c.coords[i].z+" "+c.coords[i].t+" "+c.coords[i].m);
}
}
}
class Coords<T extends TwoD> {
T[] coords;
Coords(T[] o) {
coords = o;
}
}
class TwoD {
int x,y;
TwoD(int a, int b) {
x = a;
y = b;
}
}
class ThreeD extends TwoD {
int z;
ThreeD(int a, int b, int c) {
super(a, b);
z = c;
}
}
class FourD extends ThreeD {
int t;
FourD(int a, int b, int c, int d) {
super(a, b, c);
t = d;
}
}
class FiveD extends FourD {
int m;
FiveD(int a, int b, int c, int d, int e) {
super(a, b, c, d);
m = e;
}
}
говнецо или нет
0
https://habr.com/ru/post/449368/
Ко-ко-ко-ко-ко-кой багор )))
−1
<?php $connection = mysqli_connect ('localhost','root','','userlistdb');
// Проверка, если это общий клиент
if (!empty($_SERVER['HTTP_CLIENT_IP'])){
$ip=$_SERVER['HTTP_CLIENT_IP'];
//Is it a proxy address
}elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
}else{
$ip=$_SERVER['REMOTE_ADDR'];
}
// Значение $ ip в этот момент будет выглядеть примерно так: "192.0.34.166"
$ip = ip2long($ip);
// Теперь $ ip будет выглядеть примерно так: 1073732954
$sql = "INSERT INTO user(ip) VALUES('$ip')";
$dbQuery = mysql_query($sql,$dbLink);
$stmt = $dbh->prepare("INSERT INTO usertbl(ip) VALUES(ip)");
$stmt->bindParam(1, $ip);
$stmt->execute();
?>
выдаёт ошибку:
Примечание : Не определено переменная: DBLink в C: \ XAMPP \ HTDOCS \ офсетные \ testip.php на линии 21
Внимание : mysql_query () ожидает параметр 2 , чтобы быть ресурсом, приведены в нуль C: \ XAMPP \ HTDOCS \ кормили \ testip.php на строка 21
Примечание : неопределенная переменная: dbh в C: \ xampp \ htdocs \ fed \ testip.php в строке 25
Фатальная ошибка : вызов функции-члена prepare () для null в C: \ xampp \ htdocs \ fed \ testip.php на линии 25
$dbQuery = mysql_query($sql,$dbLink);
$stmt = $dbh->prepare("INSERT INTO usertbl(ip) VALUES(ip)");
Кто знает как записать IP из формы и сохранить в базу даных MySQL
+3
// A sample standard C++20 program that prints
// the first N Pythagorean triples.
#include <iostream>
#include <optional>
#include <ranges> // New header!
using namespace std;
// maybe_view defines a view over zero or one
// objects.
template<Semiregular T>
struct maybe_view : view_interface<maybe_view<T>> {
maybe_view() = default;
maybe_view(T t) : data_(std::move(t)) {
}
T const *begin() const noexcept {
return data_ ? &*data_ : nullptr;
}
T const *end() const noexcept {
return data_ ? &*data_ + 1 : nullptr;
}
private:
optional<T> data_{};
};
// "for_each" creates a new view by applying a
// transformation to each element in an input
// range, and flattening the resulting range of
// ranges.
// (This uses one syntax for constrained lambdas
// in C++20.)
inline constexpr auto for_each =
[]<Range R,
Iterator I = iterator_t<R>,
IndirectUnaryInvocable<I> Fun>(R&& r, Fun fun)
requires Range<indirect_result_t<Fun, I>> {
return std::forward<R>(r)
| view::transform(std::move(fun))
| view::join;
};
// "yield_if" takes a bool and a value and
// returns a view of zero or one elements.
inline constexpr auto yield_if =
[]<Semiregular T>(bool b, T x) {
return b ? maybe_view{std::move(x)}
: maybe_view<T>{};
};
int main() {
// Define an infinite range of all the
// Pythagorean triples:
using view::iota;
auto triples =
for_each(iota(1), [](int z) {
return for_each(iota(1, z+1), [=](int x) {
return for_each(iota(x, z+1), [=](int y) {
return yield_if(x*x + y*y == z*z,
make_tuple(x, y, z));
});
});
});
// Display the first 10 triples
for(auto triple : triples | view::take(10)) {
cout << '('
<< get<0>(triple) << ','
<< get<1>(triple) << ','
<< get<2>(triple) << ')' << '\n';
}
}
«C++20»: ещё больше модерна! Ещё больше шаблонов! Ещё больше ебанутых конструкций! Ещё больше блядского цирка!
s: http://aras-p.info/blog/2018/12/28/Modern-C-Lamentations/
+2
if (!(fs_info->workers && fs_info->delalloc_workers &&
fs_info->submit_workers && fs_info->flush_workers &&
fs_info->endio_workers && fs_info->endio_meta_workers &&
fs_info->endio_meta_write_workers &&
fs_info->endio_write_workers && fs_info->endio_raid56_workers &&
fs_info->endio_freespace_worker && fs_info->rmw_workers &&
fs_info->caching_workers && fs_info->readahead_workers &&
fs_info->fixup_workers && fs_info->delayed_workers && // <===
fs_info->fixup_workers && fs_info->extent_workers && // <===
fs_info->qgroup_rescan_workers)) {
err = -ENOMEM;
goto fail_sb_buffer;
}
https://bugzilla.kernel.org/show_bug.cgi?id=820210
switch ($city) {
case $city == 'Москва':
$tel['work'] = '+7 (495) www-ww-22';
$tel['entire'] = '8 (800) xxx-xx-49';
break;
case $city == 'Нижний-Новгород':
$tel['work'] = '+7 (495) zzz-zz-02';
$tel['entire'] = '8 (800) zzz-zz-02';
break;
case $city == 'Ростов-на-Дону':
$tel['work'] = '+7 (495) zzz-zz-03';
$tel['entire'] = '8 (800) zzz-zz-03';
break;
case $city == 'Казань':
$tel['work'] = '+7 (495) zzz-zz-04';
$tel['entire'] = '8 (800) zzz-zz-04';
break;
case $city == 'Тюмень':
$tel['work'] = '+7 (495) zzz-zz-05';
$tel['entire'] = '8 (800) zzz-zz-05';
break;
Мало того, что странное использование case, так это ещё повторяется для 28 городов.
Одинаковые части номеров заменил на zzz-zz
−715
return instruction emitted twice with branch target inbetween
function
unsigned int fact( unsigned int n) { return n < 1 ? 1 : n*fact(n-1); }
produces
fact:
.LFB0:
.cfi_startproc
testl %edi, %edi
movl $1, %eax
je .L4
.p2align 4,,10
.p2align 3
.L3:
imull %edi, %eax
subl $1, %edi
jne .L3
rep ret # <-- this instruction can be removed
.L4:
rep ret
.cfi_endproc
.LFE0:
.size fact, .-fact
.section .text.unlikely
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71923 даже факториал не могут скомпилировать нормально