- 1
- 2
- 3
- 4
- 5
- 6
- 7
if (button.getSelection()) {
combo.getCombo().setVisible(false);
text.setVisible(true);
} else {
combo.getCombo().setVisible(true);
text.setVisible(false);
}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+72
if (button.getSelection()) {
combo.getCombo().setVisible(false);
text.setVisible(true);
} else {
combo.getCombo().setVisible(true);
text.setVisible(false);
}
+151
$params['monthes'] = array(
1 => 'January',
2 => 'February',
3 => 'March',
4 => 'April',
5 => 'May',
6 => 'June',
7 => 'July',
8 => 'August',
9 => 'September',
10 => 'October',
11 => 'November',
12 => 'December',
);
О существовании date() видимо никто не знает.
+152
<?php
//Скрипт расчета времени.
foreach ($_POST as $k=>$v) $$k=$v;
if (!$to_month and !$to_day and !$to_year and !$to_hours and !$to_minutes and !$to_seconds) {
echo "<h1>Введите данные для расчета</h1>";
}
else {
$to_time = mktime(intval($to_hours),intval($to_minutes),intval($to_seconds),intval($to_month),intval($to_day),intval($to_year)) ;
$from_time = mktime(intval($from_hours),intval($from_minutes),intval($from_seconds),intval($from_month),intval($from_day),intval($from_year)) ;
$time = $to_time - $from_time;
echo
"От $from_month/$from_day/$from_year $from_hours:$from_minutes:$from_seconds
<br>До $to_month/$to_day/$to_year $to_hours:$to_minutes:$to_seconds
<br>Миллисекунд: ",$time*1000,"
<br>Секунд: ",$time,"
<br>Минут: ",$time/60,"
<br>Часов: ",$time/3600,"
<br>Дней: ",$time/86400,"
<br>Недель: ",$time/604800,"
<br>Месяцев: ",$time/2628000,"
<br>Лет: ",$time/31536000; //31557600 по Юлианскому.
}
?>
<!DOCTYPE html>
<html>
<head>
<title>Сколько времени пройдет от и до</title>
<style>
body {
margin-left: 38%;
font-family: Verdana, Arial, Helvetica, sans-serif;
}
h1 {
font-size: 90%;
color: #333366;
}
input {
margin: 2px;
padding: 2px;
width: 200px;
}
h2 {
font-size: 70%;
color: #333366;
}
p {
font-size: 60%;
color: #f00;
}
</style>
</head>
<body>
<h2>Задайте время от:</h2>
<form method="post" target="_blank" action="date.php">
<input type="text" name="from_year" value="<?=date('Y')?>"> Год<br>
<input type="text" name="from_month" value="<?=date('m')?>"> Месяц<br>
<input type="text" name="from_day" value="<?=date('d')?>"> День<br>
<input type="text" name="from_hours" value="<?=date('G')?>"> Час<br>
<input type="text" name="from_minutes" value="<?=date('i')?>"> Минут<br>
<input type="text" name="from_seconds" value="<?=date('s')?>"> Секунд
<h2>Задайте время до:</h2>
<input type="text" name="to_year"> Год<br>
<input type="text" name="to_month"> Месяц<br>
<input type="text" name="to_day"> День<br>
<input type="text" name="to_hours"> Час<br>
<input type="text" name="to_minutes"> Минут<br>
<input type="text" name="to_seconds"> Секунд<br>
<input type="submit" value="Рассчитать">
</form>
<p>* Заполнять все поля не обязательно.<br>** Расчеты для лет верны если год - 365 дней.</p>
</body>
</html>
Лаксори эдишен
+129
[System.Runtime.Serialization.DataMember(Name = "o")]
public OnlineOperator[] AvailableOperators
{
get
{
List<OnlineOperator> o = new List<OnlineOperator>();
if (this.AllOperators != null)
{
Boolean flag = false;
List<OnlineOperator> o2 = new List<OnlineOperator>();
foreach (OnlineOperator oo in this.AllOperators)
{
if (oo.Status != OperatorStatus.Offline)
{
if (oo.Priority == 0)
{
if (oo.Status == OperatorStatus.Online)
{
flag = true;
}
o.Add(oo);
}
if (!flag)
{
o2.Add(oo);
}
}
}
if (!flag)
{
o = o2;
}
}
//if (o.Count < 1)
{
o.Add(new OnlineOperator()
{
Id = 0,
UserDisplayName = String.Format(Resources.pattern_offline, this.OfflineNote),
Status = OperatorStatus.None
});
}
return o.ToArray();
}
set
{
;
}
}
Логика конечно странновато реализована, но реализация ReadOnly свойства меня просто убила
−268
NSMutableArray * constraints_to_remove = [ @[] mutableCopy] ;
Мсье знает толк!
+134
#include <stdio.h>
#define max(x,y) ((x>y)?x:y)
#define N 255
typedef unsigned char uchar;
uchar s,t,x,y,z,n,S[10000],FO[N+N*(N-1)/2];
uchar mask[]={1,2,4,8,16,32,64,128};
int TOP=0;
unsigned int COUNTER=0,AO[N];
FILE *in;
int pop(){
//if the top element in the stack is passed and stack is not empty,
//find next parent vertex
while(S[TOP]>128 && TOP>0) TOP-=S[TOP]-128;
return(TOP);
}
int push(){ //add new elements to the stack
int tmp=TOP,i,j,k; //tmp is a temporary variable
x=S[TOP-S[TOP]+1]; //x is a parent vertex
for(i=1;i<=FO[AO[x]];i++){
y=FO[AO[x]+i]; //y is a neigbour of x
if(!test(y)){ //y is visited? if not keep going
k=max(y/8+1,S[TOP]-2); //copy set P(x) to the new set P(y)
S[++tmp]=y;
for(j=0;j<k;j++,S[++tmp]=0);
S[++tmp]=k+2;
for(j=1;j<=S[TOP]-2;j++) S[tmp-j]=S[TOP-j];
S[tmp-(y/8+1)]|=mask[y-(y/8)*8]; //add child y to P(y)
}
}
S[TOP]+=128; //drop flag for the vertex x
TOP=tmp; //the last child y become parent
}
int test(int j){ //does vertex j in the set P(TOP)?
z=((j/8+1)>S[TOP]-2)?0:(S[TOP-(j/8+1)] & mask[j-(j/8)*8])?1:0;
return(z);
}
int inc(){ //the path was found
COUNTER++;
S[TOP]+=128;
}
int main(){
int i,j,k;
in=fopen("Data15.txt","r"); //open file
fscanf(in," %d %d",&i,&n); //read the number of vertices
for(k=n,i=0;k>=0;k--){
fscanf(in,"%d %d",&j,&FO[i]);
j=FO[i];
for(AO[n-k]=++i-1;j>0;j--,i++){
fscanf(in,"%d ",&FO[i]);
}
}
printf("Type first and end nodes: "); //type s and t separated by space
scanf("%d %d",&s,&t);
S[0]=s;
for(j=1;j<=s/8+1;S[j++]=0);
S[j]=s/8+3;
TOP=j;
S[TOP-(s/8+1)]|=mask[s-(s/8)*8];
while(pop()>=0) (test(s) && test(t))?inc():push(); //launch breadth-search algorithm
printf("# of paths in the graph b/w s=%d and t=%d equals %d\n",s,t,COUNTER);
return(0);
}
разбирая старый CD бэкап откопал лабу...(знаю,знаю что продакшн кошернее, и на сях не пишу со студенчества)
хотел вайпнуть безжалости но вспомнил про говнокодосайт.
помоему код люто доставляет.
прога подсчитывает полное число путей в графе между заданными вершинами s и t.
граф считывается из файла в формате: "номер_вершины степень_вершины {достижимые_вершины_через_пробел}"
(по коду видно)
+150
// DLE LOL, ../engine/inc/options.php
$config['offline_reason'] = str_replace( '"', '"', $config['offline_reason'] );
−102
is_zipped = not request.args.get('is_zipped', "false") == "false"
>>> bool("false")
True
>>> bool("False")
True
почему бы не сделать их ложью
+150
public function responsive()
{
$month = array("1" => "Responsive", "2" => "Unresponsive");
for ($i = 1; $i <= 2; $i++)
{
$data[] = array('text' => $month[$i], 'value' => $i);
}
echo json_encode($data);
}
Мне кажеться индусы пишут лучше
+91
if not DM.For_Akc_Base_Update.InTransaction then
DM.For_Akc_Base_Update.StartTransaction;
Close;
SQL.Clear;
SQL.Add('insert into Bank (BNAME, full_name, bik, ks, inn, rkc,postind,postcity,postaddr,telef ) values ');
SQL.Add('('''+edName.Text+''', '''+mFull_Name.Text+''', ');
SQL.Add(' '''+edBik.Text+''', ');
SQL.Add(''''+edKS.Text+''', '''+edInn.Text+''', ');
SQL.Add(''''+edRkc.Text+''', '''+edInd.Text+''', ');
SQL.Add(''''+edCity.Text+''', '''+edAdr.Text+''', ');
SQL.Add(''''+edTel.Text+''' )');
ExecSQL;
DM.For_Akc_Base_Update.Commit;
DM.Bank.Close;
DM.Bank.Open;
Принял проект. Начал смотреть. Вот так вот добавляют запись в таблицу. И так по всему проекту.