- 1
select.under{background-color : transparent; border: 1px solid #000000; width: 250;}
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+145
select.under{background-color : transparent; border: 1px solid #000000; width: 250;}
Какую же ширину имел ввиду автор может пиксели а может и проценты %-)
+123
//1. Реализовать с помощью персептронов распознавание изображений букв, заданных в виде матриц (4x4, 8x8 или др.).
//Набор букв для распознавания определяется фамилией студента (‘Иванов‘ = ‘И‘, ‘В‘, ‘А‘, ‘Н‘, ‘О‘).
//Выполнить в виде сети из одного слоя. Необходимо выполнить обучение сети на требуемый набор букв.
namespace lab1_1
{
class Program
{
static int[,] wRe = new int[5,25] {
{1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1 },
{1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1, 1, 1, 0, 1, 1 }, ...
};
...
/// Дельта обучение
static int delta()
{
bool p = true;
while (p){
p = false;
int yRes1 = 0, yRes2 = 0, yRes3 = 0, yRes4 = 0, yRes5 = 0;
if ((y[0, 0] == 1) && (y[0, 1] == 0) && (y[0, 2] == 0) && (y[0, 3] == 0) && (y[0, 4] == 0)) yRes1 = 1;
if ((y[1, 0] == 0) && (y[1, 1] == 1) && (y[1, 2] == 0) && (y[1, 3] == 0) && (y[1, 4] == 0)) yRes2 = 1;
....
for (int i = 0; i < 25; i++) w[i]=wRe[0, i];
// суматоры
int s1 = b[0] + w[0] * iBukva[0, 0] + w[1] * iBukva[0, 1] + w[2] * iBukva[0, 2] + w[3] * iBukva[0, 3] + w[4] * iBukva[0, 4] +
w[5] * iBukva[1, 0] + w[6] * iBukva[1, 1] + w[7] * iBukva[1, 2] + w[8] * iBukva[1, 3] + w[9] * iBukva[1, 4] +
....
t1 = s1 < fi ? 0 : 1;
int yResT1 = 0;
if ((t1 == 1) && (t2 == 0) && (t3 == 0) && (t4 == 0) && (t5 == 0)) yResT1 = 1;
// первая буква
if ((yRes1 != yResT1) && (yRes1 == 0))
{
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
if (iBukva[i, j] == 1) w[5 * i + j]--;
b[0]--;
p = true;
}
if ((yRes1 != yResT1) && (yRes1 == 1))
{
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
if (iBukva[i, j] == 1) w[5 * i + j]++;
b[0]++;
p = true;
}
for (int i = 0; i < 25; i++) wRe[0, i] = w[i];
for (int i = 0; i < 25; i++) w[i] = wRe[1, i];
int s2 = b[1] + w[0] * vBukva[0, 0] + w[1] * vBukva[0, 1] + w[2] * vBukva[0, 2] + w[3] * vBukva[0, 3] + w[4] * vBukva[0, 4] +
w[5] * vBukva[1, 0] + w[6] * vBukva[1, 1] + w[7] * vBukva[1, 2] + w[8] * vBukva[1, 3] + w[9] * vBukva[1, 4] +
...
t2 = s2 < fi ? 0 : 1;
int yResT2 = 0;
if ((t1 == 0) && (t2 == 1) && (t3 == 0) && (t4 == 0) && (t5 == 0)) yResT2 = 1;
//вторая буква
if ((yRes2 != yResT2) && (yRes2 == 0))
{
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
if (vBukva[i, j] == 1) w[5 * i + j]--;
b[1]--;
p = true;
}
if ((yRes2 != yResT2) && (yRes2 == 1))
{
for (int i = 0; i < 5; i++)
for (int j = 0; j < 5; j++)
if (vBukva[i, j] == 1) w[5 * i + j]++;
b[1]++;
p = true;
}
for (int i = 0; i < 25; i++) wRe[1, i] = w[i];
for (int i = 0; i < 25; i++) w[i] = wRe[2, i];
int s3 = b[2] + w[0] * aBukva[0, 0] + w[1] * aBukva[0, 1] + w[2] * aBukva[0, 2] + w[3] * aBukva[0, 3] + w[4] * aBukva[0, 4] +
w[5] * aBukva[1, 0] + w[6] * aBukva[1, 1] + w[7] * aBukva[1, 2] + w[8] * aBukva[1, 3] + w[9] * aBukva[1, 4] +
w[10] * aBukva[2, 0] + w[11] * aBukva[2, 1] + w[12] * aBukva[2, 2] + w[13] * aBukva[2, 3] + w[14] * aBukva[2, 4] +
w[15] * aBukva[3, 0] + w[16] * aBukva[3, 1] + w[17] * aBukva[3, 2] + w[18] * aBukva[3, 3] + w[19] * aBukva[3, 4] +
w[20] * aBukva[4, 0] + w[21] * aBukva[4, 1] + w[22] * aBukva[4, 2] + w[23] * aBukva[4, 3] + w[24] * aBukva[4, 4];
...
−859
"SELECT c.type AS type,
ELT(c.type, g.genre_id, l.label_id, f.film_id, a.actor_id, s.show_id, ch.channel_id,aw.award_id) AS id,
ELT(c.type, g.value, l.value, f.real_name, a.real_name, s.real_name, ch.name, aw.description) AS real_name,
ELT(c.type, NULL, NULL, f.name, a.name, s.name, NULL, NULL) AS name
FROM connector AS c
LEFT JOIN genres AS g ON (c.second = g.genre_id)
LEFT JOIN labels AS l ON (c.second = l.label_id)
LEFT JOIN films AS f ON (c.second = f.film_id)
LEFT JOIN actors AS a ON (c.second = a.actor_id)
LEFT JOIN shows AS s ON (c.second = s.show_id)
LEFT JOIN channels AS ch ON (c.second = ch.channel_id)
LEFT JOIN awards AS aw ON (c.second = aw.award_id)
WHERE c.first = ".$_SESSION['user_id']
Вот как это делается!
+145
public String readMessage(String subject) throws Exception {
String messageString = null;
try {
for (final Message message : Arrays.asList(this.inbox.getMessages())) {
if (subject.equals(message.getSubject())) {
messageString = "To: " + Arrays.asList(message.getAllRecipients()) + "n" + "From: " + Arrays.asList(message.getFrom()) + "n" + "Sent: "
+ message.getSentDate() + "n" + "Subject: " + message.getSubject() + "n" + "Text: " + message.getContent();
break;
}
}
} catch (final MessagingException me) {
throw new Exception("Error reading Inbox", me);
} catch (final IOException e) {/* Not using streams, only plain text */
}
return messageString;
}
тестовый javamail клиент(отправка тест-письма,поиск его и удаление). В методе ищем письмо с нужной темой, возвращаем текстовое представление.
говно, кроме очевидных ляпов, в том, что мы лазием по всем сообщениям, сверяя тему, а получение письма занимает около секунды. Надо ли говорить, что в современном ящике писем тысячи...
для сравнения:
если заменить в 4 строчке конструкцию
Arrays.asList(this.inbox.getMessages())
на new SubjectTerm(subject)
, то время выполнения сокращается с (неизвестно,точно более времени чаепития) до пары секунд = )
+127
public IQueryable<AuditEntry> ViewAudit()
{
var items = _operationEntities.AuditItems.AsQueryable();
return items.Select((item) => new AuditEntry()
{
OperationID = item.Id,
CreationTime = item.CreationTime,
Description = item.AuditItemType.StringFormat.Replace(
"{0}", item.InsertionStrings.Where((x) => x.StringId == 0).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{1}", item.InsertionStrings.Where((x) => x.StringId == 1).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{2}", item.InsertionStrings.Where((x) => x.StringId == 2).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{3}", item.InsertionStrings.Where((x) => x.StringId == 3).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{4}", item.InsertionStrings.Where((x) => x.StringId == 4).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{5}", item.InsertionStrings.Where((x) => x.StringId == 5).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{6}", item.InsertionStrings.Where((x) => x.StringId == 6).Select((x) => x.String).FirstOrDefault() ?? String.Empty).Replace(
"{7}", item.InsertionStrings.Where((x) => x.StringId == 7).Select((x) => x.String).FirstOrDefault() ?? String.Empty),
CreatedBy = item.CreatedBy,
OperationType = item.AuditItemType.MessageType.Name,
OperationCategory = item.AuditItemType.AuditCategory.Name,
});
}
Паровозик. Реализация string.Format() в виде linq-запроса
−97
import string
k=input()
a=range(1000)
if k==1:
a[0]=input()
else:
t = string.replace(str(raw_input()), ' ', ', ')
a=eval('('+t+')')
4
2 3 4 5
----
Не знаю я питон :(
По другому не смог быстро написать..
−116
$answer=~ s/\\/\\\\/g;
$answer=~ s/\'/\\\'/g;
# ...
$dbh->do("INSERT INTO docflow_rules (type_,state1,state2,p,entity,subj_require,comm_require) VALUES ($doctype,$from_,$to_,'$answer',$entity,$subj_r,$comm_r)");
Еще от неизменного автора.
−118
if(
( $session_begin ge $tariff_ref->{date} ) &&
( !$tariff_ref->{date_end} || $session_begin le $tariff_ref->{date_end} ) &&
( !$tariff_ref->{nas_id} || $tariff_ref->{nas_id} eq $nas_id) &&
( !$tariff_ref->{ppp_type} || $tariff_ref->{ppp_type} eq $ppp_type) &&
( $notariffzone || !$tariff_ref->{tariff_zone} ||
$tariff_ref->{tariff_zone} eq $tariff_zone) &&
( !$tariff_ref->{client_type} || $tariff_ref->{client_type} eq $client_type) &&
( !$tariff_ref->{day_type} || $tariff_ref->{day_type} eq
&common::type_of_day($oper_id,$session_begin) ) &&
(
(!$divide_by_time_zone &&
(!$tariff_ref->{time_from} || !$tariff_ref->{time_to} ||
&common::check_time_zone(
$session_begin,
$tariff_ref->{time_from},
$tariff_ref->{time_to}
)
)
) ||
($divide_by_time_zone &&
(!$tariff_ref->{time_from} || !$tariff_ref->{time_to} ||
&common::check_time_zone(
$session_begin,
$tariff_ref->{time_from},
$tariff_ref->{time_to}
) ||
&common::check_time_zone(
$session_end,
$tariff_ref->{time_from},
$tariff_ref->{time_to}
) ||
&common::check_time_zone(
$tariff_ref->{time_from},
common::get_time_from_str($session_begin),
common::get_time_from_str($session_end),
)
)
)
) &&
(
(!$divide_by_counter &&
(!defined($tariff_ref->{counter1_from}) || !defined($tariff_ref->{counter1_to})
|| ($tariff_ref->{counter1_from} <= $resource_begin &&
$resource_begin < $tariff_ref->{counter1_to} )
)
) ||
($divide_by_counter &&
(!defined($tariff_ref->{counter1_from}) || !defined($tariff_ref->{counter1_to})
|| ($tariff_ref->{counter1_from} <= $resource_begin &&
$resource_begin < $tariff_ref->{counter1_to} )
|| ($tariff_ref->{counter1_from} <= $resource_end &&
$resource_end < $tariff_ref->{counter1_to} )
|| ($resource_begin <= $tariff_ref->{counter1_from} &&
$tariff_ref->{counter1_from} < $resource_end)
)
)
)
) {
Один if от создателя :) Еще (с) Руслан Залата
+159
for (i = 1; i < <?php echo count($prog[1])?>; i++){
if (document.getElementById('module'+i).checked)
module_tmp= Math.abs($('#module'+i).val())+module_tmp;
+132
<select name="select" id="planeSel" onChange="javascript:self.location.href=this.value;">
<option disabled selected>Выберите карту</option>
<option value="http://172.23.67.36/ingeo/index.asp?db=Address">Адресный план</option>
<option value="http://172.23.67.36/ingeo/index.asp?db=GenPlan">Генеральный план</option>
<option value="http://172.23.67.36/ingeo/index.asp?db=PZZ">Правила землепользования</option>
<option value="http://172.23.67.36/ingeo/index.asp?db=Building">Новое строительство</option>
</select>
www.eguar.ru/ingeo/index.asp?db=Building