-
Лучший говнокод
- В номинации:
-
- За время:
-
-
0
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
SoftwareCommon::params::IParamLoader::TypeDb SettingsProxy::getTypeDb() const
{
try
{
auto type = Locator::Services::Locator->Resolve<ISettings^>()->Type;
switch (type)
{
case decltype(type)::Firebird: return IParamLoader::Firebird;
case decltype(type)::MSSQL: return IParamLoader::MSSQL;
default:
throw std::runtime_error("Unsupported db type");
}
}
catch (Exception ^ex)
{
throw std::runtime_error(marshal_1251(ex->ToString()));
}
}
laMer007,
13 Июля 2016
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
<table>
<?php
$showShowroomsIds = array();
foreach($available_sizes as $sizeName):
$available = false;
foreach($warehouses as $warehouse) :
$uuid = $warehouse['uuid'];
$name = $warehouse['name'];
$quantity = $size_quantity[$uuid][trim($sizeName)];
if($quantity >0) {
$available = true;
}
endforeach;
if(!$available) continue;
?>
<?php
foreach($warehouses as $warehouse) :
$uuid = $warehouse['uuid'];
//echo $uuid."<br>";
if(isset($showrooms[$uuid])) {
$showShowroomsIds[$uuid] = $uuid;
}
$name = $warehouse['name'];
$quantity = $size_quantity[$uuid][trim($sizeName)];
if($quantity) {
$eshopAvailable = '';
if($uuid == $eshopUuid && $quantity > 0) $eshopAvailable = 'eshop_available=\'y\'';
$quantity = ModelCommonWarehouse::getFormattedQuantity($quantity,$uuid);
$qtA = "";
} else {
continue;
$qtA = "not-available";
$quantity = "нет в наличии";
}
?>
<tr <?php echo $eshopAvailable?> available='y'>
<td class="td">
<?php if(isset($showrooms[$uuid])):?><a href="#" class="showroom-info" uuid="<?php echo $uuid;?>" icId="uuid" rel="nofollow"><?php endif;?>
<?php echo $name?>
<!--<?php echo $uuid;?>-->
<?php if(isset($showrooms[$uuid])):?></a><?php endif;?>
</td>
<td class="qt <?php echo $qtA;?>" ><?php echo $quantity;?></td>
</tr>
<?php endforeach;?>
<tr>
<td style="height: 10px;"></td>
</tr>
<?php endforeach;?>
</table>
Opencart. Прямо во вьюхе ровным слоем размазаны бизнес-логика и js.
Что самое интересное, оборот магазина составляет 7 млн. руб (о__О)
Panda,
13 Июля 2016
-
+3
- 1
session_decode(session_encode());
что это вообще такое и зачем оно?
kropotor,
27 Июня 2016
-
+1
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
// can only do five hundred at a time. can't find documentation
// for this number, but if I do more than that I get an error
// message
for (five_hundred <- pageranks.grouped(500))
{
try
{
upload(five_hundred)
}
catch
{
// the datastore is not entirely reliable. for less than 1% of the
// calls it seems to fail randomly. which is a bit annoying if
// you're uploading a lot of data and don't want to stop when half of
// it is already stored
case ex : Throwable =>
{
try
{
ex.printStackTrace()
// try a second time
upload(five_hundred)
}
catch
{
// don't try a third time. just continue
case ex : Throwable => ex.printStackTrace()
}
}
}
}
Наткнулся на пост, в котором некий Ph. D рекламировал scala в качестве замены питону
Fike,
09 Июня 2016
-
−4
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
Maven
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
<version>1.0.0.GA</version>
<classifier>sources</classifier>
<scope>provided</scope>
</dependency>
Кто-то изобретательный прицепил исходники библиотеки к проекту таким способом, чтобы переходить к ним при разработке.
morph,
02 Июня 2016
-
+4
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
public class tcMoveDirection
{
public enum tcDirection { R, L, N };
static public tcDirection fromstring(string expression)
{
switch (expression)
{
case "R":
return tcDirection.R;
case "L":
return tcDirection.L;
case "N":
return tcDirection.N;
default: throw new InvalidCastException();
}
}
}
dm_fomenok,
23 Мая 2016
-
+6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
#include <iostream>
using namespace std;
struct One
{
bool operator==(const One &) { cout << "hello from One!" << endl; return true; }
bool operator==(unsigned int) { cout << "hello from One!" << endl; return true; }
};
One operator "" x( unsigned long long int ) { return One{}; }
One operator "" xMAGICK( unsigned long long int ) { return One{}; }
int main()
{
cout << (0xMAGICK == 0x);
return 0;
}
http://ideone.com/gGYFce
Расширяем множество шестнадцатеричных цифр при помощи UDL
В C++17 осталось разрешить перегрузку операторов встроенных типов - вот тогда можно будет оторваться по-полной!
gost,
05 Мая 2016
-
+2
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
$vv = $_GET['new'];
$v1 = $_GET['1'];
$v2 = $_GET['2'];
$v3 = $_GET['3'];
$v4 = $_GET['4'];
$v5 = $_GET['5'];
$v6 = $_GET['6'];
$v7 = $_GET['7'];
$v8 = $_GET['8'];
$v9 = $_GET['9'];
$v10 = $_GET['10'];
$v11 = $_GET['11'];
$v12 = $_GET['12'];
if (mb_strlen($vv) >= 1) {
mysql_query ("INSERT INTO vote (title, votes) VALUES ('$vv', '0')");
header('Location: /index.php');
exit;
}
if (mb_strlen($v1) >= 1 or mb_strlen($v2) >= 1 or mb_strlen($v3) >= 1 or mb_strlen($v4) >= 1 or mb_strlen($v5) >= 1 or mb_strlen($v6) >= 1 or mb_strlen($v7) >= 1 or mb_strlen($v8) >= 1 or mb_strlen($v9) >= 1 or mb_strlen($v10) >= 1 or mb_strlen($v11) >= 1 or mb_strlen($v12) >= 1) {
mysql_query ("UPDATE vote SET title='$v1' WHERE id='1'");
mysql_query ("UPDATE vote SET title='$v2' WHERE id='2'");
mysql_query ("UPDATE vote SET title='$v3' WHERE id='3'");
mysql_query ("UPDATE vote SET title='$v4' WHERE id='4'");
mysql_query ("UPDATE vote SET title='$v5' WHERE id='5'");
mysql_query ("UPDATE vote SET title='$v6' WHERE id='6'");
mysql_query ("UPDATE vote SET title='$v7' WHERE id='7'");
mysql_query ("UPDATE vote SET title='$v8' WHERE id='8'");
mysql_query ("UPDATE vote SET title='$v9' WHERE id='9'");
mysql_query ("UPDATE vote SET title='$v10' WHERE id='10'");
mysql_query ("UPDATE vote SET title='$v11' WHERE id='11'");
mysql_query ("UPDATE vote SET title='$v12' WHERE id='12'");
header('Location: /');
exit;
}
Сохранение вопросов в опроснике.
slowpoke59rus,
27 Апреля 2016
-
+6
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
public static List<string[]> split(string s)
{
bool ins = false;
int no = 3;
var L = new List<string>();
var Res = new List<string[]>();
var B = new StringBuilder();
foreach (var c in s)
{
switch (c)
{
case '§':
if (ins)
{
ins = false;
L.Add(B.ToString());
if (no == 0)
{
Res.Add(L.ToArray<string>());
L.Clear();
no = 3;
}
}
else
{
ins = true;
B.Clear();
}
break;
case '|':
if (!ins) { no--; }
else B.Append(c);
break;
default:
if (ins) B.Append(c);
break;
}
}
return Res;
}
Судя по наименованиям - типичная лаба школьника.
Однако, автор - Сошников - евангелист мелкософта. Тот самый, который F# пропагандирует (катается с одной и той же лекцией уже несколько лет по разным конференциям; и, кстати, принимают его всегда восторженно).
Пруф: http://stackoverflow.com/a/36888673/5045688
koodeer,
27 Апреля 2016
-
+4
- 1
A notice tag marks out-of-service equipment, such as a fire hydrant. Included is a guide member that has one or more guide channels and which is inserted into a connector body. The CNT array is patterned by using a patterned metallic seed layer on the substrate to form the CNT array by chemical vapor deposition. The pivot arm has a biasing mechanism with a force that results in less impact force between the pivot arm roller and drive roller when the trailing edge of each mail piece passes through the take-away nip, resulting in less vibration of the weighing platform as mail pieces exit the weighing platform. The process gas is exhausted from the chamber.
Автоматическая генерация изобретений для общественного достояния
https://geektimes.ru/post/274156/
Вореции на страже от патентных троллей?
kerman,
12 Апреля 2016