- 1
- 2
- 3
- 4
- 5
if (dataTank.UpdateSQLTable(addressTbl, (int)SharedConstants.FocusAdapterTables.Address, SharedConstants.FocusAdapterTables.Address.ToString()) > 0)
{
return true;
}
return false;
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+119
if (dataTank.UpdateSQLTable(addressTbl, (int)SharedConstants.FocusAdapterTables.Address, SharedConstants.FocusAdapterTables.Address.ToString()) > 0)
{
return true;
}
return false;
Yeah, baby!
Похоже, ребята специально создавали себе места для рефакторинга - набудущее, чтобы было чем заняться.
+165
<script>
function build_view(){
$('div.content').append(""+ <?php $flag=false; foreach($work_meters as $work){?> "<div id=\"<?=$work->id?>\" style='margin-bottom:30px;' > <span class=\"name\"><?=$work->name?> </span> <div s\
tyle=\"display:inline;float:left\" align=\"left\" > <table class='data_table' style=\"margin-top:50px;\" id='table_<?=$work->id?>'> <tr> <td>дата</td><td>значение</td>"+ <?php if(in_array\
(5, $user->roles)) { ?> " <td></td> "+ <?php } ?> <?php while(list($key, $vals) = each($work->data)){ ?> " <tr><td><?=$vals[0]?></td> <td><?=$vals[1]?></td> "+ <?php if(in_array(5,\
$user->roles)) { ?> " <td><a onclick=\"delete_row(<?=$key?>, <?=$work->id?>)\" href='javascript:void(0);'>удалить</a></td> "+ <?php } ?> " </tr> "+ <?php } ?>" \
</tr> "+ <?php if(in_array(5, $user->roles)) { ?> " <tr><td><input type='text' name='date' size='7'/></td><td><input type='text' name='value' size='5'/></td><td><input type='button' value='\
добавить' onclick='add_data(<?=$work->id?>, $(this).parent().parent());'></td></tr> <tr><td colspan='3' style='text-align:right;'><input type='button' onclick='save(<?=$work->id?>);' value='\
сохранить'></td></tr> "+ <?php } ?> " </table> </div> <div style=\"width:600px;height:300px;margin-left:120px;\" class=\"image\"> </div> <div class=\"description\" style='margin-top\
=10px;'> <?=$work->description?> </div> </div>"+ <?php $flag = true;} ?>"" );
}
</script>
эта ересь генерирует html для javascript функции которая втсавляет это всё в страницу.
+163
<?php
include ("config.php");
include ("css/css.inc.php");
include ("inc/audioplayer.inc.php");
// Определяем текущий раздел.
$CurSec=empty($_GET['section'])?null:$_GET['section'];
// Если после "?section=" ничего нет, то грузим файл по умолчанию,
// а именно "index.inc.php" из папки "sections".
if(empty($CurSec))
include("./sections/index.inc.php");
// Если "?section=MyHouse" и файл "MyHouse.inc.php" в папке "sections" существует,
// то подгружаем его.
elseif(file_exists("./sections/".basename($CurSec).".inc.php"))
include("./sections/".basename($CurSec).".inc.php");
// Если "?section=MyHouse" и файл "MyHouse.inc.php" в папке "sections" НЕ существует,
// то подгружаем "error.inc.php" всё из той же папки "sections".
else
include("./sections/error.inc.php");
print "$body";
?>
+162
$file=@implode("",file("http://www.google.com/search?&;q=site:$url&hl=en"));
Крутой аналог file_get_contents.
−155
<mx:VBox xmlns:mx="...">
<mx:ComboBox ... />
<mx:Box width="{width}" height="100%">
<mx:DataGrid id="grid" dataProvider="{rawData}" height="100%"/>
</mx:Box>
</mx:VBox>
В гриде дохрена колонок. В таком манёвре горизонтальный скорлл есть, а до вертикального нужно "доскролить" горизонтальным.
Задача: сделать чтобы были видны оба.
Видимо горе девелопер сделал <mx:DataGrid id="grid" dataProvider="{rawData}" width="100%" height="100%"/> без Box-а... и взгруснул от ширины колонок. Ему, бедному, не пришло в голову что при 2х дюжинах колонок можно смело поставить horizontalScrollpolicy="on" и не городить огород (и не смешить общественность).
... ё-маё и это Сеньёр Флекс Девелопер.
−138.6
# sysinfo bar
while :; do
echo $(uptime | awk '{ print $3"d, "$5" "$6"u"}') '|' $(free -k | grep "cache:" | awk '{print $3"k / "$4"k"}') '|^fg(#cccc00)' $(date | sed 's,MSD .*,,') "^fg(#bbbbdd)|" $(cat /proc/loadavg | awk '{print $1" "$2" "$3}') '|' $(gcpubar -o -c 1 | sed 's,CPU: ,,') ' '
sleep 1
done | dzen2 -ta r -x $WIDTH -y $Y $COLORS -fn $FONT -e 'button1=exec:mpc toggle;button2=exec:mpc prev;button3=exec:mpc next;button4=exec:mpcvolume +;button5=exec:mpcvolume -' &
подобных баров с пяток в скрипте, не стал все приводить
−135.4
echo ""
echo -e '\033[1m'" MONITOR FOR SYSTEM SWITCH $current"'\033[0m'
echo " *************************************************"
#1
{
read line1
} < $DIR_FLAG/$file1
{
read lines1
} < $DIR_FLAG/$files1
if [ "$line1" = "STOP" ]; then echo -e '\E[31m'" TASK 1: --> $lines1" ; tput sgr0
else echo -e '\E[32m'" TASK 1: >< $lines1" ; tput sgr0
fi
#2
{
read line2
} < $DIR_FLAG/$file2
{
read lines2
} < $DIR_FLAG/$files2
if [ "$line2" = "STOP" ]; then echo -e '\E[31m'" TASK 2: --> $lines2" ; tput sgr0
else echo -e '\E[32m'" TASK 2: >< $lines2" ; tput sgr0
fi
#3
{
read line3
} < $DIR_FLAG/$file3
{
read lines3
} < $DIR_FLAG/$files3
if [ "$line3" = "STOP" ]; then echo -e '\E[31m'" TASK 3: --> $lines3" ; tput sgr0
else echo -e '\E[32m'" TASK 3: >< $lines3" ; tput sgr0
fi
#4
{
read line4
} < $DIR_FLAG/$file4
{
read lines4
} < $DIR_FLAG/$files4
if [ "$line4" = "STOP" ]; then echo -e '\E[31m'" TASK 4: --> $lines4" ; tput sgr0
else echo -e '\E[32m'" TASK 4: >< $lines4" ; tput sgr0
fi
#5
{
read line5
} < $DIR_FLAG/$file5
{
read lines5
} < $DIR_FLAG/$files5
if [ "$line5" = "STOP" ]; then echo -e '\E[31m'" TASK 5: --> $lines5" ; tput sgr0
else echo -e '\E[32m'" TASK 5: >< $lines5" ; tput sgr0
fi
#6
{
read line6
} < $DIR_FLAG/$file6
{
read lines6
} < $DIR_FLAG/$files6
if [ "$line6" = "STOP" ]; then echo -e '\E[31m'" TASK 6: --> $lines6" ; tput sgr0
else echo -e '\E[32m'" TASK 6: >< $lines6" ; tput sgr0
fi
#7
{
read line7
} < $DIR_FLAG/$file7
{
read lines7
} < $DIR_FLAG/$files7
if [ "$line7" = "STOP" ]; then echo -e '\E[31m'" TASK 7: --> $lines7" ; tput sgr0
else echo -e '\E[32m'" TASK 7: >< $lines7" ; tput sgr0
fi
#8
{
read line8
} < $DIR_FLAG/$file8
{
read lines8
} < $DIR_FLAG/$files8
if [ "$line8" = "STOP" ]; then echo -e '\E[31m'" TASK 8: --> $lines8" ; tput sgr0
else echo -e '\E[32m'" TASK 8: >< $lines8" ; tput sgr0
fi
#9
{
read line9
} < $DIR_FLAG/$file9
{
read lines9
} < $DIR_FLAG/$files9
if [ "$line9" = "STOP" ]; then echo -e '\E[31m'" TASK 9: --> $lines9" ; tput sgr0
else echo -e '\E[32m'" TASK 9: >< $lines9" ; tput sgr0
fi
и т.д.
вот такой кодец остался нам в наследство....
−866.8
CREATE procedure dbo.BASE_W_ORDER_NEYAVKAM
@date_in as nvarchar(10),
@id_users as int
as
declare @date as datetime
set @date = convert(datetime, @date_in, 104)
--set @date = convert(datetime, cast(@date_in as datetime), 104)
select* from(
select
p.[ID] as [ID],
p.TABEL_NUM as TABEL_NUM,
p.FAMILY as FAMILY,
p.[NAME] as NAME,
p.SECNAME as SECNAME,
p.ID_DEPT as ID_DEPT,
d.[NAME] as DEPT,
p.POSITION as POSITION,
--dbo.GetCmena(p.ID_GRAPH, convert(nvarchar(10), getdate(), 104)) as SID,
s.[id] as SID,
s.[NAME] as SMENA,
s.START_SM as START_SM,
s.END_SM as END_SM,
s.START_DIN as START_DIN,
s.END_DIN as END_DIN,
p.PHOTO as PHOTO,
-- формируем отчет для тех
-- если приказ не назначен
case when not exists(select*from base_codes_s cc where cc.[id] = p.id_codes and cc.status like '0_1_____') then
-- у кого график назначен
case when (isnull(p.id_graph,0) = 0) then 1
-- у кого код пропуска присвоен
when (isnull(p.id_Codes,0) = 0) then 1
-- пропуск не имеет статус администратора
when exists(select*from base_codes_s cc where cc.[id] = p.id_codes and cc.status like '0_1_____') then 1
-- пропуск не просрочен
when (@date < isnull(c.date_in, @date)
or @date > isnull(c.date_out, @date)) then 1
-- Сотрудник в отпуске
when exists(select*from TABL_OTPUSK o where o.ID_PERSONAL = p.id_codes and convert(nvarchar(10), o.[DATE], 104) = convert(nvarchar(10), @date, 104)) then 1
-- празднечный день
when exists(select*from TABL_HOLIDAY_S hol where convert(nvarchar(10), hol.[DATE], 104) = convert(nvarchar(10), @date, 104)) then 1
else 0 end
else
-- делаем расчеты в соответствии с приказом
-- у кого график назначен
case when (isnull(p.id_graph,0) = 0) then 1
-- у кого код пропуска присвоен
when (isnull(p.id_Codes,0) = 0) then 1
-- пропуск не имеет статус администратора
when exists(select*from base_codes_s cc where cc.[id] = p.id_codes and cc.status like '0_1_____') then 1
-- пропуск не просрочен
when (@date < isnull(c.date_in, @date)
or @date > isnull(c.date_out, @date)) then 1
-- Сотрудник в отпуске
when exists(select*from TABL_OTPUSK o where o.ID_PERSONAL = p.id_codes and convert(nvarchar(10), o.[DATE], 104) = convert(nvarchar(10), @date, 104)) then 1
-- празднечный день
when exists(select*from TABL_HOLIDAY_S hol where convert(nvarchar(10), hol.[DATE], 104) = convert(nvarchar(10), @date, 104)) then 1
else 0 end end as XREN
from base_pesonal_S p
-- присоединяем пропуска
left join base_codes_s c on
p.id_codes = c.[id]
-- присоединяем отделы
left join base_dept d on
p.id_dept = d.[id]
-- Узнаем смену назначенную на день отчета для графика который назначен сотруднику
LEFT OUTER join BASE_SMENA_S s ON
s.[id] = (select top 1 ID_SM
from
BASE_GRAPH as g
inner join BASE_GRAPH_NAME_S as gn on gn.[id] = g.ID_GRAPH_NAME
inner join BASE_SMENA as s on s.[id] = g.id_SM
inner join (select BASE_GRAPH.ID_GRAPH_NAME, count(*) cntsmen from BASE_GRAPH group by BASE_GRAPH.ID_GRAPH_NAME) sm
on (datediff(dd, gn.date_in, convert(datetime, @date, 104)) % sm.cntsmen) + 1 = g.[num] and g.ID_GRAPH_NAME = sm.ID_GRAPH_NAME
where g.id_graph_name = p.ID_GRAPH)
) as t1
-- смена не должна быть выходной
where XREN <> 1
and SID <> 1
and not exists(select top 1 * from base_events e where id_p = [id]
and convert(nvarchar(10), e.[TIME], 104) = convert(nvarchar(10), @date, 104)
and (ascii(e.CODE) = ascii('I')
or ascii(e.CODE) = ascii('O')
)
)
and id_dept in(select id_dept from BASE_ACCEESS where id_users = @id_users) -- отчет только для интерисующих на отделов
GO
+144.8
<table width="100%">
<tr>
<td><input name="res" title="add new resource"/><td>
</tr>
</table>
а ведь это должен был быть <div>..</div> =)
+148
implode("','", array('product_gems'))
почему бы не заменить такое просто строкой...