- 1
for (size_t i=v.size()-1; i<v.size(); --i)
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+56
for (size_t i=v.size()-1; i<v.size(); --i)
unsigned в массивах не нужен, нахуй усрались длинные массивы?
+64
void GetVoid()
{
return delete &"Возвращаем void";
};
Функция для получения void.
+135
private void button1_Click(object sender, EventArgs e)
{
if (comboBox1.Text == "Випадково")
{
LoadMatrixRand(masP, dataGridView1);
}
if (comboBox1.Text == "Повна")
{
LoadMatrixFull(masP, dataGridView1);
}
if (comboBox1.Text == "Пуста")
{
LoadMatrixZero(masP, dataGridView1);
}
if (comboBox1.Text == "Діагональна")
{
LoadMatrixDiagonal(masP, dataGridView1);
}
if (comboBox1.Text == "Антидіагональна")
{
LoadMatrixAntiDiagonal(masP, dataGridView1);
}
}
private void button2_Click(object sender, EventArgs e)
{
if (comboBox2.Text == "Випадково")
{
LoadMatrixRand(masQ, dataGridView2);
}
if (comboBox2.Text == "Повна")
{
LoadMatrixFull(masQ, dataGridView2);
}
if (comboBox2.Text == "Пуста")
{
LoadMatrixZero(masQ, dataGridView2);
}
if (comboBox2.Text == "Діагональна")
{
LoadMatrixDiagonal(masQ, dataGridView2);
}
if (comboBox2.Text == "Антидіагональна")
{
LoadMatrixAntiDiagonal(masQ, dataGridView2);
}
}
private void button3_Click(object sender, EventArgs e)
{
if (comboBox3.Text == "Випадково")
{
LoadMatrixRand(masR, dataGridView3);
}
if (comboBox3.Text == "Повна")
{
LoadMatrixFull(masR, dataGridView3);
}
if (comboBox3.Text == "Пуста")
{
LoadMatrixZero(masR, dataGridView3);
}
if (comboBox3.Text == "Діагональна")
{
LoadMatrixDiagonal(masR, dataGridView3);
}
if (comboBox3.Text == "Антидіагональна")
{
LoadMatrixAntiDiagonal(masR, dataGridView3);
}
}
shitty life as my code
+131
/*
* Copyright (C) 2007-2012 Allwinner Technology Co., Ltd.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
* MA 02111-1307 USA
*/
#ifndef __DISP_DISPLAY_I_H__
#define __DISP_DISPLAY_I_H__
#include "ebios_de.h"
#include "ebios_lcdc_tve.h"
#include "drv_disp_i.h" /* For DISP_XXXXXX status codes */
#define DE_INF __inf
#define DE_WRN __wrn
#define OSAL_IRQ_RETURN IRQ_HANDLED
#define HANDTOID(handle) ((handle) - 100)
#define IDTOHAND(ID) ((ID) + 100)
#define INTC_IRQNO_SCALER0 SW_INT_IRQNO_DEFEBE0
#define INTC_IRQNO_SCALER1 SW_INT_IRQNO_DEFEBE1
#define INTC_IRQNO_LCDC0 SW_INT_IRQNO_LCDCTRL0
#define INTC_IRQNO_LCDC1 SW_INT_IRQNO_LCDCTRL1
#define MAX_SPRITE_BLOCKS 32
/*basic data information definition*/
enum {
FALSE = 0,
TRUE
};
#define DIS_NULL 0
#define BIT0 0x00000001
#define BIT1 0x00000002
#define BIT2 0x00000004
#define BIT3 0x00000008
#define BIT4 0x00000010
#define BIT5 0x00000020
#define BIT6 0x00000040
#define BIT7 0x00000080
#define BIT8 0x00000100
#define BIT9 0x00000200
#define BIT10 0x00000400
#define BIT11 0x00000800
#define BIT12 0x00001000
#define BIT13 0x00002000
#define BIT14 0x00004000
#define BIT15 0x00008000
#define BIT16 0x00010000
#define BIT17 0x00020000
#define BIT18 0x00040000
#define BIT19 0x00080000
#define BIT20 0x00100000
#define BIT21 0x00200000
#define BIT22 0x00400000
#define BIT23 0x00800000
#define BIT24 0x01000000
#define BIT25 0x02000000
#define BIT26 0x04000000
#define BIT27 0x08000000
#define BIT28 0x10000000
#define BIT29 0x20000000
#define BIT30 0x40000000
#define BIT31 0x80000000
#endif
Нашёл в драйвере дисплея. Вместо 1<<N.
+126
using питух = String;
...
protected питух AccessToken { get; set; }
В память о плавающем
+134
String r_count = "";
String r_cat = "";
String r_pansion = "";
for (Int32 ii = 0; ii < rows.Count; ii++)
{
Int32 j = rows[ii].NNight;
DateTime d = rows[ii].DateBeg;
DateTime d_e = rows[ii].DateEnd;
Int32 type = rows[ii].MinLength > 0 ? 3 : 2;
j = (type == 3) ? -1 : j;
Int32 lengthMin = rows[ii].MinLength;
if (((d < date1 || d > date2) && type != 3))
continue;
else
if (!(d <= date1 && d_e >= date1 || d <= date2 && d_e >= date2) && date1 != DateTime.MinValue && date2 != DateTime.MaxValue && type == 3)
continue;
String _r_count = _Rooms[rows[ii].RoomId];
String _r_cat = _RoomCat[rows[ii].RoomCatId];
String _r_pansion = _Pansions[rows[ii].PansionId];
List<String> a = new List<string>();
if (_r_count != r_count || _r_cat != r_cat || _r_pansion != r_pansion)
{
if (!String.IsNullOrEmpty(r_count) && !String.IsNullOrEmpty(r_cat))
{
Pricing.RoomCat cat = new Pricing.RoomCat();
cat.RoomCount = r_count;
cat.RoomName = r_cat;
cat.PansionName = r_pansion;
p.rooms.Add(cat);
}
r_count = _r_count;
r_cat = _r_cat;
r_pansion = _r_pansion;
}
Краху туроператоров способствовали также и собственные инженеры.
+134
class UnathorizedDevice : ArgumentException { public UnathorizedDevice() : base() { } }
class LocalException : ArgumentException { public LocalException(string message) : base(message) { } }
Говно или не говно? Мне кажется первое
+69
"add()\n";
assert((row_indx >= 0 && row_indx <= rows) &&
(col_indx >= 0 && col_indx < cols)
);
if(row_indx == rows)
addRow();
if(init_flag_arr[row_indx][col_indx])
{
std::cout « "in moving\n";
int uninit_i, uninit_j;
bool found = false;
for(int i = row_indx; found == false && i < rows; i++)
for(int j = col_indx; found == false && j < cols; j++)
if(!init_flag_arr[i][j]) // если флаг == false
{
std::cout « "found!\n";
uninit_i = i;
uninit_j = j;
found = true;
}
if(!found)
{
std::cout « "not found!\n";
addRow(); // добовляем новую строку в матрицу (rows++)
uninit_i = rows - 1;
uninit_j = 0;
}
bool exit = false;
for(int i = uninit_i, j = uninit_j; exit == false; i--)
{
for(; ;j--)
{
if(j == col_indx && i == row_indx)
{
exit = true;
break;
}
if(j == 0)
{
matrix[i][j] = matrix[i - 1][cols - 1];
init_flag_arr[i][j] = init_flag_arr[i - 1][cols - 1];
break;
}
matrix[i][j] = matrix[i][j - 1];
init_flag_arr[i][j] = init_flag_arr[i][j - 1];
}
j = cols - 1;
}
}
matrix[row_indx][col_indx] = obj;
init_flag_arr[row_indx][col_indx] = true;
std::cout « "end add()\n";
}
// Для дебага, вывод инициализированных ячеек матрицы
void Matrix::InitTable(std::ostream& os)const // чисто для дебага
{
for(int i = 0; i < rows; i++)
{
for(int j = 0; j < cols; j++)
if(!init_flag_arr[i][j])
os « "false\t";
else
os « "true\t";
os « std::endl;
}
}
// Удаление объекта с матрицы
void Matrix::remove(int row_indx, int col_indx)
{
std::cout « "remove()\n";
assert((row_indx >= 0 && row_indx < rows) &&
(col_indx >= 0 && col_indx < cols)
);
matrix[row_indx][col_indx] = 0;
init_flag_arr[row_indx][col_indx] = false;
std::cout « "end remove()\n";
}
void Matrix::removeRow(int row_indx)
{
assert(row_indx >= 0 && row_indx < rows);
int** new_matrix = new int*[rows - 1];
bool** new_init_flag_arr = new bool*[rows];
for(int i = 0; i < rows - 1; i++)
{
new_matrix[i] = new int[cols];
new_init_flag_arr[i] = new bool[cols];
//for(int j = 0; j < cols; j++)
//{
// new_matrix[i][j] = 0;
// new_init_flag_arr[i][j] = false;
//}/
...
+157
# http://habrahabr.ru/post/227277/
# открыл первый попавшийся скрипт на гитхабе по ссылке в посте, дальше не читал
function validate_email($str)
{
return preg_match('/^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,3})$/',$str);
}
−166
CREATE OR REPLACE FUNCTION "GET_SOTR_FULL_NAME" (sotr_id in number)
RETURN varchar2 IS
cursor surname (sotr_id number)
is
select fc_fam from tsotr
where tsotr.fk_id=sotr_id;
cursor name (sotr_id number)
is
select fc_name from tsotr
where tsotr.fk_id=sotr_id;
cursor patronym (sotr_id number)
is
select fc_otch from tsotr
where tsotr.fk_id=sotr_id;
fio varchar2(90);
fam varchar2(30);
im varchar2(30);
otch varchar2(30);
BEGIN
open surname (sotr_id);
fetch surname into fam;
close surname;
open name (sotr_id);
fetch name into im;
close name;
open patronym (sotr_id);
fetch patronym into otch;
close patronym;
fio:=fam||' '||im||' '||otch;
return fio;
END;
По ИД сотрудника получаем его ФИО