- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
if (value != null)
{
bool boolValue = (Boolean)value;
switch (boolValue)
{
case true:
return true;
case false:
return false;
}
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+141
if (value != null)
{
bool boolValue = (Boolean)value;
switch (boolValue)
{
case true:
return true;
case false:
return false;
}
}
Конвертер для CheckBox в WPF
+135
#include <stdio.h>
#include <unistd.h>
#include <stdlib.h>
#define MAX_STEP 6
static int num;
int seq_gen(int step){
if(step<MAX_STEP){
for(int idx=1;idx<=MAX_STEP;idx++){
for(int i=0;i<=step;i++)printf(" ");
printf("<id%d step=\"%d\">\n",idx,step);
seq_gen(++step);
--step;
printf("</id%d>\n",idx);
};
};
if(step==MAX_STEP){
for(int i=1;i<=MAX_STEP;i++){
for(int si=0;si<=step;si++)printf(" ");
printf("<id%d>%d</id%d>\n",i,num++,i);
}
}
};
int main(){
printf("<root>\n");
seq_gen(1);
printf("</root>");
return 0;
};
Создает xml файл с 6 элементов с 6 вложенными элементами пока уровень вложенности достигнет 6.
+56
if ('cardiscon' == $key) {
echo '<td class="even cardiscon">'.$row['name'].':</td>';
} elseif ('cardprice' == $key) {
echo '<td class="even cardiscon">'.$row['name'].':</td>';
} else {
echo '<td class="even">'.$row['name'].':</td>';
}
Странная конструкция
+48
if (
($my_var[1] == "add_article" ||
$my_var[1] == "add_topic" ||
$my_var[1] == "add_topic2" ||
$my_var[1] == "add_initiative"
) && (
$_REQUEST["publish"] == "before" ||
$_REQUEST["publish"] == "current")
) {
} else {
echo <<<EOD
<!doctype html>
EOD;
}
форматирование сохранено
+137
#define FMT_2_LEN 16
#define FMT_4_LEN 24
// и т.д. всего около десятка форматов
void calc_check_code(const unsigned char * from, unsigned fmt, unsigned * code)
{
switch (fmt) {
case 2:
//...
memset(data, 0, sizeof(FMT_2_LEN));
// выборочное наполнение data из from
make_code(data, FMT_2_LEN, code);
break;
case 4:
//...
memset(data, 0, sizeof(FMT_4_LEN));
// выборочное наполнение data из from
make_code(data, FMT_2_LEN, code);
break;
// для всех остальных аналогично
}
странно, и почему контрольный код не совпадает с эталонными примерами...
+140
foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
$name_file = explode(".",$filename);
if (!file_exists($name_file[0].".out")){
// заливаем в jar
exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
echo "Insert " . $filename . " Complete!\n\r";
usleep(10000);
}
else echo "You have uploaded this file already!\n\r";
}
+141
foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
$name_file = explode(".",$filename);
if (!file_exists($name_file[0].".out")){
// заливаем в jar
exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
echo "Insert " . $filename . " Complete!\n\r";
usleep(10000);
}
else echo "You have uploaded this file already!\n\r";
}
+141
foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
$name_file = explode(".",$filename);
if (!file_exists($name_file[0].".out")){
// заливаем в jar
exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
echo "Insert " . $filename . " Complete!\n\r";
usleep(10000);
}
else echo "You have uploaded this file already!\n\r";
}
+141
foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
$name_file = explode(".",$filename);
if (!file_exists($name_file[0].".out")){
// заливаем в jar
exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
echo "Insert " . $filename . " Complete!\n\r";
usleep(10000);
}
else echo "You have uploaded this file already!\n\r";
}
+141
foreach (glob('data/'.$year . "/unzip/*.txt") as $filename) {
$name_file = explode(".",$filename);
if (!file_exists($name_file[0].".out")){
// заливаем в jar
exec('nohup java -jar "noaa.jar" ' . $filename . ' ' . $name_file[0] . '.out > /dev/null &', $log, $log1);
echo "Insert " . $filename . " Complete!\n\r";
usleep(10000);
}
else echo "You have uploaded this file already!\n\r";
}