-
+157
- 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
public function getSaleDepartment()
{
$_linkToDepLabel = '';
switch ($this->getfs_sale_department()) {
case '0':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/1.png';
break; //Moda
case '1':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/2.png';
break; //Belleza
case '2':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/3.png';
break; //Novia
case '3':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/4.png';
break; //Ocio
case '4':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/5.png';
break; //Deporte
case '5':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/6.png';
break; //Familia
case '6':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/7.png';
break; //Hogar
case '7':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/8.png';
break; //Viaje
case '8':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/9.png';
break; //Moda
case '9':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/10.png';
break; //Belleza
case '10':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/11.png';
break; //Novia
case '11':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/12.png';
break; //Ocio
case '12':
$_linkToDepLabel = $this->getBaseUrl();
$_linkToDepLabel .= 'media/flash_sales/saledepartment/13.png';
break; //Deporte
default:
$_linkToDepLabel = '';
break;
}
return $_linkToDepLabel;
}
ппц
CheshirskyCode,
21 Марта 2012
-
+153
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
$sql_query_result = mysql_query("select * from Organisations
inner join Goods on (Organisations.ID = Goods.OrgID)
where 1");
while($result_string = mysql_fetch_array($sql_query_result)) { array_push ($search_array, $result_string[3]); }
for($i=0;$i<=count($search_array);$i++)
{
if(eregi($search_string, $search_array[$i]))
{
array_push($search_matches, $search_array[$i]);
}
}
поиск в интернет магазине:
13000 записей
в строке 15 полей
в каждом строке есть 3 BLOB
2 с текстом и одно с картинкой товара
а жаловались что база тормозит
papavel,
21 Марта 2012
-
+150
- 1
- 2
- 3
- 4
- 5
- 6
<div style="display: none;">
<input type="hidden" name="_wpcf7" value="251" />
<input type="hidden" name="_wpcf7_version" value="3.1.1" />
<input type="hidden" name="_wpcf7_unit_tag" value="wpcf7-f251-t1-o1" />
<input type="hidden" name="_wpnonce" value="5963830b40" />
</div>
Плагин Contact Form 7 для Wordpress
glutaminefee,
20 Марта 2012
-
−132
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
Попытка
Если Число(ДисконтнаяКарта.НомерКарты) >= 111065251 И Число(ДисконтнаяКарта.НомерКарты) <= 111065453 И ПревышенаСуммаДисконта() Тогда
Отказ = Истина;
Сообщить("Сумма дисконта превышает оставшийся лимит по карте!",СтатусСообщения.Важное);
Возврат
КонецЕсли;
Исключение
КонецПопытки;
glavdir,
20 Марта 2012
-
+133
- 1
- 2
- 3
- 4
- 5
- 6
// for cdio:
#include <cdio.h>
#include <cdio_unconfig.h> # remove *all* symbols libcdio defines
// Add back in the ones you want your program
#include <config.h>
But now what about the problem that there are common preprocessor symbols in config_cdio.h that an application may want to define in a different manner, like PACKAGE_NAME?
For this, there is yet another header, <cdio/cdio_unconfig.h>.
rat4,
20 Марта 2012
-
+109
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
private IEnumerable<CharacteristicValue> GetCharacteristicValues(IQueryable<CharacteristicValue> allCharacteristicValues, int characteristicId)
{
var characteristicValues = new CharacteristicValue[userIds.Length];
for (var i = 0; i < userIds.Length; i++)
{
characteristicValues[i] = allCharacteristicValues.FirstOrDefault(cv => cv.UserId == userIds[i] && cv.CharacteristicId == characteristicId); // Todo: Try to replace with a single query.
}
return characteristicValues;
}
Драсьте, нашёл в коде такую вот какашку. Как видите параметр allCharacteristicsValues реализует интерфейс IQuarable из EF. То бишь каждый раз, когда будет вызываться метод FirstOrDefault будет делаться запрос к базе. В идеале это должно было бы выглядеть так:
var characteristicValues = allCharacteristicValues.Where(cv => cv.CharacteristicId == characteristicId && userIds.Contains(cv.UserId));
Но при такой реализации размер масива пользователей и значение может разниться:
Values:
val1
val2
val3
Users:
1
2
3
4
5
Для первого же варианта результат будет выглядеть так:
Values:
val1
val2
val3
null
null
Users:
1
2
3
4
5
Собственно всё )))) Надеюсь подсоветуете чего-нибудь хорошего ;)
walash,
20 Марта 2012
-
+158
- 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
<?php
class User
{
protected $_user_id;
protected $_user_email;
protected $_user_password;
public function __construct($user_id)
{
$user_record = self::_getUserRecord($user_id);
$this->_user_id = $user_record['id'];
$this->_user_email = $user_record['email'];
$this->_user_password = $user_record['password'];
}
public function __get($value) {}
public function __set($name, $value) {}
private static function _getUserRecord($user_id)
{
$user_record = array();
switch($user_id) {
case 1:
$user_record['id'] = 1;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'i like croissants';
break;
case 2:
$user_record['id'] = 2;
$user_record['email'] = '[email protected]';
$user_record['password'] = 'me too!';
break;
case 'error':
throw new Exception('Ошибка библиотеки SQL!');
break;
}
return $user_record;
}
}
?>
PHP исключения...
Govnisti_Diavol,
19 Марта 2012
-
+113
- 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
if ((label1.Text == "O") & (label2.Text == "O") & (label3.Text == "O") | ((label1.Text == "X") & (label2.Text == "X") & (label3.Text == "X")))
{
label1.ForeColor = Color.Red;
label2.ForeColor = Color.Red;
label3.ForeColor = Color.Red;
win = false;
}
if ((label4.Text == "O") & (label5.Text == "O") & (label6.Text == "O") | ((label4.Text == "X") & (label5.Text == "X") & (label6.Text == "X")))
{
label4.ForeColor = Color.Red;
label5.ForeColor = Color.Red;
label6.ForeColor = Color.Red;
win = false;
}
if ((label7.Text == "O") & (label8.Text == "O") & (label9.Text == "O") | ((label7.Text == "X") & (label8.Text == "X") & (label9.Text == "X")))
{
label4.ForeColor = Color.Red;
label5.ForeColor = Color.Red;
label6.ForeColor = Color.Red;
win = false;
}
if ((label1.Text == "O") & (label4.Text == "O") & (label7.Text == "O") | ((label1.Text == "X") & (label4.Text == "X") & (label7.Text == "X")))
{
label1.ForeColor = Color.Red;
label4.ForeColor = Color.Red;
label7.ForeColor = Color.Red;
win = false;
}
if ((label2.Text == "O") & (label5.Text == "O") & (label8.Text == "O") | ((label2.Text == "X") & (label5.Text == "X") & (label8.Text == "X")))
{
label2.ForeColor = Color.Red;
label5.ForeColor = Color.Red;
label8.ForeColor = Color.Red;
win = false;
}
if ((label3.Text == "O") & (label6.Text == "O") & (label9.Text == "O") | ((label3.Text == "X") & (label6.Text == "X") & (label9.Text == "X")))
{
label3.ForeColor = Color.Red;
label6.ForeColor = Color.Red;
label9.ForeColor = Color.Red;
win = false;
}
if ((label1.Text == "O") & (label5.Text == "O") & (label9.Text == "O") | ((label1.Text == "X") & (label5.Text == "X") & (label9.Text == "X")))
{
label1.ForeColor = Color.Red;
label5.ForeColor = Color.Red;
label9.ForeColor = Color.Red;
win = false;
}
if ((label3.Text == "O") & (label5.Text == "O") & (label7.Text == "O") | ((label3.Text == "X") & (label5.Text == "X") & (label7.Text == "X")))
{
label3.ForeColor = Color.Red;
label5.ForeColor = Color.Red;
label7.ForeColor = Color.Red;
win = false;
}
}
private void label7_MouseDown(object sender, MouseEventArgs e)
{
if (win)
for (int i = 0; i < 1; i++)
{
if (label7.Text == "")
{
label7.Text = "X";
if ((label1.Text == "O") & (label2.Text == "O") & (label3.Text == ""))
{
label3.Text = "O"; break;
}
if ((label1.Text == "O") & (label2.Text == "") & (label3.Text == "O"))
{
label2.Text = "O"; break;
}
if ((label1.Text == "") & (label2.Text == "O") & (label3.Text == "O"))
{
label1.Text = "O"; break;
}
Крестики-нолики с одного форума. Полная версия: http://pastebin.com/59W3547n
P4R4,
19 Марта 2012
-
+150
- 1
- 2
- 3
- 4
<?php
if ($_GET['type']) $link = 'type='.$_GET['type'];
if ($_GET['cat']) $link = 'cat='.$_GET['cat'];
if ($_GET['param']) $link = 'param='.$_GET['param'];
isset,
19 Марта 2012
-
+72
- 1
- 2
- 3
- 4
- 5
- 6
/**
* @return node with values
*/
public FQNode getValueGetter() {
return data;
}
accessor c повышенной энтропией, хуле
zloizerg,
19 Марта 2012