-
+69
- 001
- 002
- 003
- 004
- 005
- 006
- 007
- 008
- 009
- 010
- 011
- 012
- 013
- 014
- 015
- 016
- 017
- 018
- 019
- 020
- 021
- 022
- 023
- 024
- 025
- 026
- 027
- 028
- 029
- 030
- 031
- 032
- 033
- 034
- 035
- 036
- 037
- 038
- 039
- 040
- 041
- 042
- 043
- 044
- 045
- 046
- 047
- 048
- 049
- 050
- 051
- 052
- 053
- 054
- 055
- 056
- 057
- 058
- 059
- 060
- 061
- 062
- 063
- 064
- 065
- 066
- 067
- 068
- 069
- 070
- 071
- 072
- 073
- 074
- 075
- 076
- 077
- 078
- 079
- 080
- 081
- 082
- 083
- 084
- 085
- 086
- 087
- 088
- 089
- 090
- 091
- 092
- 093
- 094
- 095
- 096
- 097
- 098
- 099
- 100
"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;
//}/
...
ana_stasia ,
06 Августа 2014
-
+126
- 1
- 2
- 3
GOD BAD DOG GARAGE AGE
;В exe файлы не запихивать в wct editor-е, а то шиндоус пострадает ;-)
Вот такие слова можно составить на системе счисления wct :)
!!! ВНИМАНИЕ !!! В exe файлы не запихивать в wct editor-е, а то шиндоус пострадает ;-)
(ЗЫ: для тех, кто не знает, что такое wct, прошу сюда - vk.com/wct_official, http://wctsite.tk)
Mobac,
05 Августа 2014
-
+133
- 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
private CMSEntities entities = new CMSEntities();
private List<Object> ObjectSets { get; set; }
private List<Type> Types { get; set; }
public void GetFields()
{
Types = new List<Type>();
var entitiesType = entities.GetType();
var assembly = Assembly.Load("CMS.Data");
var types = assembly.GetTypes();
foreach (var type in assembly.GetTypes())
{
if (type.BaseType != null &&
type.BaseType.Name.Equals("EntityObject") &&
type.Name.IndexOf("aspnet",StringComparison.InvariantCultureIgnoreCase)<0 &&
type.Name != "sysdiagram")
{
Types.Add(type);
}
}
var properties = entitiesType.GetProperties();
ObjectSets = new List<Object>();
foreach (var propertyInfo in properties)
{
var obj = propertyInfo.GetValue(entities, null);
if(propertyInfo.PropertyType.IsGenericType && obj!=null) ObjectSets.Add(obj);
}
}
Рефлексия и Entity Framework
Serg,
05 Августа 2014
-
+163
- 1
- 2
- 3
- 4
if( window == top ){
document.cookie = "st=0; path=/; expires=100";
window.location = window.location;
}
sa-kirich,
05 Августа 2014
-
+139
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
Есть односвязный список. Каждый элемент списка содержит указатель на следующий элемент (next).
Нам известен указатель на первый элемент списка (root). Необходимо без использования каких-либо
дополнительных структур данных и без изменения структуры элементов списка определить зациклен ли данный список.
Ответ
public static boolean isCycleList(Item root){
Item first = root;
while(first.getNext() != null){
Item subFirst = root;
do {
if (subFirst == first.getNext())
return true;
subFirst = subFirst.getNext();
}
while (subFirst != first.getNext());
first = first.getNext();
}
return false;
}
kegdan,
05 Августа 2014
-
+138
- 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
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
int _ZN12LoggersChain2DoE10LogLevel_tPKcPv(){printf("_ZN12LoggersChain2DoE10LogLevel_tPKcPv\n");}
int _ZN12LoggersChain10AddLogFuncERK7FunctorIv8TypeListIK10LogLevel_tS1_IPKcS1_IPv8NullTypeEEEE(){printf("_ZN12LoggersChain10AddLogFuncERK7FunctorIv8TypeListIK10LogLevel_tS1_IPKcS1_IPv8NullTypeEEEE\n");}
int _ZN12LoggersChainC1Ev(){printf("_ZN12LoggersChainC1Ev\n");}
int _Z22SetLoggerForExceptionsR7FunctorIv8TypeListIK10LogLevel_tS0_IPKcS0_IPv8NullTypeEEEE(){printf("_Z22SetLoggerForExceptionsR7FunctorIv8TypeListIK10LogLevel_tS0_IPKcS0_IPv8NullTypeEEEE\n");}
int _Z19SetLoggerForSignalsR7FunctorIv8TypeListIK10LogLevel_tS0_IPKcS0_IPv8NullTypeEEEE(){printf("_Z19SetLoggerForSignalsR7FunctorIv8TypeListIK10LogLevel_tS0_IPKcS0_IPv8NullTypeEEEE\n");}
int _Z24GetCppSigHandlerInstancev(){printf("_Z24GetCppSigHandlerInstancev\n");}
int _ZN13CppSigHandler11set_handlerERKSt6vectorIiSaIiEERK7FunctorIv8TypeListIi8NullTypeEE(){printf("_ZN13CppSigHandler11set_handlerERKSt6vectorIiSaIiEERK7FunctorIv8TypeListIi8NullTypeEE\n");}
int _ZN7OSErrorC1EPFPKciE(){printf("_ZN7OSErrorC1EPFPKciE\n");}
int osso_initialize(){printf("osso_initialize\n");}
con_ic_connection_new(){
printf("con_ic_connection_new\n");
return 0;
}
int osso_get_dbus_connection()
{
return 0;
}
int osso_get_sys_dbus_connection()
{
return 0;
}
}
int dbus_connection_add_filter ()
{
return 0;
}
int dbus_connection_send_with_reply_and_block ()
{
return 0;
}
int _dbus_header_get_message_type()
{
return 0;
}
int hildon_gtk_entry_set_input_mode(){printf("hildon_gtk_entry_set_input_mode\n");}
int hildon_gtk_im_context_hide()
{
}int url_label_new()
{
return 0;
}
int url_label_set_text()
{
return 0;
}
int url_label_get_type()
{
return 0;
}
int hildon_uri_get_scheme_from_uri()
{
return 0;
}
int gtk_widget_tap_and_hold_setup()
{
printf("gtk_widget_tap_and_hold_setup\n");
return 0;
}
int message_view_new_with_content()
{
printf("message_view_new_with_content\n");
return 0;
}
int message_view_get_type()
{
printf("message_view_get_type\n");
return 0;
}
int message_view_hide_content(){printf("message_view_hide_conteny\n");return 0;}
Врапперы для запуска maemo-приложений на других платформах. Убого, но skype запускается.
mittorn,
05 Августа 2014
-
+157
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
try{
$this->em->flush();
}catch(DBALException $ex){
// \Doctrine\Common\Util\Debug::dump($user);
$result='notOK';
}
echo json_encode(array('status'=>$result));
die();
код человека которого хотели но не сделали тим лидом, на что он обиделся и ушел
moledet2,
05 Августа 2014
-
+160
- 1
($isLead) ? $customerBalance = 0 : $customerBalance = $customerMapper->calculateBalance($customer);
Код от мастера Йода
andr435,
05 Августа 2014
-
+154
- 1
- 2
- 3
- 4
foreach($_GET as $v01=>$v02)
$$v01 = $v02;
foreach($_POST as $v01=>$v02)
$$v01 = $v02;
register_globals для слабаков!
sslobodyanyuk,
05 Августа 2014
-
+156
- 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
$query_result = mysql_query("SELECT parking FROM `cat_info` WHERE is_sold = 0");
$numpark = array();
$numpark[2]=0;
$numpark[3]=0;
$numpark[5]=0;
$numpark[6]=0;
if($query_result)
{
while ($row = mysql_fetch_array($query_result))
{
switch ($row["parking"]){
case 2:
$numpark[2]++;
break;
case 3:
$numpark[3]++;
break;
case 5:
$numpark[5]++;
break;
case 6:
$numpark[6]++;
break;
}
}
}
Этот код считает количество записей в таблице, в зависимости от числа в колонке parking.
bashtannik,
05 Августа 2014