- 1
- 2
- 3
- 4
- 5
- 6
- 7
Процедура ПриЗаписи(Отказ)
Док = Ссылка.ПолучитьОбъект();
Док.ОбменДанными.Загрузка = Истина;
Док.Записать();
КонецПроцедуры
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
−168
Процедура ПриЗаписи(Отказ)
Док = Ссылка.ПолучитьОбъект();
Док.ОбменДанными.Загрузка = Истина;
Док.Записать();
КонецПроцедуры
И это все в форме документа
+154
class Registration{
protected $data;
protected $linc = "reg.php";
protected $v_log;
protected $query_login;
protected $v_pass;
protected $v_r_pass;
protected $v_pass_r_pass;
protected $v_mail;
public function __construct() {
$this->data = array('login'=> NULL, 'password'=> NULL, 'r_password'=> NULL, 'mail'=> NULL);
foreach($this->data as $key => $val) {
$this->data[$key] = $_POST[$key];
}
$this->v_log = $this->ver_login($this->data['login']);
$this->v_pass = $this->ver_pass($this->data['password']);
$this->v_r_pass = $this->ver_r_pass($this->data['r_password']);
$this->v_pass_r_pass = $this->ver_pass_r_pass($this->data['password'],$this->data['r_password']);
$this->v_mail = $this->ver_mail($this->data['mail']);
$this->error_reporting($this->v_log,$this->v_pass,$this->v_r_pass,$this->v_pass_r_pass,$this->v_mail, $this->error_log($this->linc));
}
protected function error_log($linc){
return("<p>В поле введены неверные данные!</p></br>"
. "<form action='$linc' metod='get'>"
. "<p>Вернуться и проверить<input type = 'submit' value = 'вернуться'></p>"
. "</form>");
}
protected function ver_login($login) {
if(empty($login) or (!preg_match("/^\A(\w){6,20}\Z/", $login))) {
$login = FALSE;
unset($login);
}else{
$login == TRUE;
$this->ver_db($login);
return($login);
}
}
protected function ver_db($log) {
$q = mysql_query("SELECT id FROM users WHERE login = '$log'");
$f = mysql_fetch_array($q);
if(empty($f['id']) or $f['id'] == '') {
return($log);
}else{
echo('Есть такой');
}
}
protected function ver_pass($pass) {
if(empty($pass) or (!preg_match("/^\A(\w){6,20}\Z/", $pass))) {
$pass == FALSE;
unset($pass);
}else {
$pass == TRUE;
$pass = md5($pass);
return($pass);
}
}
protected function ver_r_pass($r_pass) {
if(empty($r_pass) or (!preg_match("/^\A(\w){6,20}\Z/", $r_pass))) {
$r_pass == FALSE;
unset($r_pass);
}else {
$r_pass == TRUE;
$r_pass = md5($r_pass);
return($r_pass);
}
}
protected function ver_pass_r_pass($pass,$r_pass) {
if($pass != $r_pass) {
return(FALSE);
}else {
return (TRUE);
}
}
protected function ver_mail($mail) {
if(empty($mail) or (!preg_match("/^[a-zA-Z0-9_\.\-]+@([a-zA-Z0-9\-]+\.)+[a-zA-Z]{2,6}$/", $mail))) {
$mail == FALSE;
unset($mail);
}else {
$mail == TRUE;
return($mail);
}
}
protected function reg_ins($log,$pass,$mail) {
$date = date("d.m.y");
$const = ACCES_KEY_DEFAULT;
$ins_query = "INSERT INTO users(login,password,mail,date,acces) VALUES ('$log','$pass','$mail','$date','$const')";
$insert = mysql_query($ins_query);
if(!$insert){
echo('error');
} else {
echo('ok');
}
}
protected function error_reporting($log,$pass,$r_pass,$pass_r_pass,$mail,$error) {
if($log == FALSE or $pass == FALSE or $r_pass == FALSE or $pass_r_pass == FALSE or $mail == FALSE){
echo($error);
} else {
//выполняем если все данные введены верно
$this->reg_ins($log, $pass, $mail);
}
:)
+53
long int p, q, n, t, flag, e[100], d[100], temp[100], m[100], en[100], j, i;
char msg[100];
long int cd(long int x)
{
long int k = 1;
while (1)
{
k = k + t;
if (k%x == 0)
return(k / x);
}
}
int prime(long int pr)
{
int i;
j = sqrtl(pr);
for (i = 2; i <= j; i++)
{
if (pr%i == 0)
return 0;
}
return 1;
}
void ce()
{
int k;
k = 0;
for (i = 2; i<t; i++)
{
if (t%i == 0)
continue;
flag = prime(i);
if (flag == 1 && i != p&&i != q)
{
e[k] = i;
flag = cd(e[k]);
if (flag>0)
{
d[k] = flag;
k++;
}
if (k == 99)
break;
}
}
}
void encrypt()
{
long int pt, ct, key = e[0], k, len;
i = 0;
len = strlen(msg);
while (i != len)
{
pt = m[i];
pt = pt - 96;
k = 1;
for (j = 0; j<key; j++)
{
k = k*pt;
k = k%n;
}
temp[i] = k;
ct = k + 96;
en[i] = ct;
i++;
}
en[i] = -1;
printf("\nTHE ENCRYPTED MESSAGE IS\n");
for (i = 0; en[i] != -1; i++)
printf("%c", en[i]);
}
трушные функции
+75
db.insertInto(VISIBILITY_CONSTRAINT,
VISIBILITY_CONSTRAINT.UUID,
VISIBILITY_CONSTRAINT.VERSION,
VISIBILITY_CONSTRAINT.FIRST_NAME_HIDDEN,
VISIBILITY_CONSTRAINT.MIDDLE_NAME_HIDDEN,
VISIBILITY_CONSTRAINT.LAST_NAME_HIDDEN,
VISIBILITY_CONSTRAINT.BIRTHDAY_HIDDEN,
VISIBILITY_CONSTRAINT.GENDER_HIDDEN,
VISIBILITY_CONSTRAINT.EMAIL_HIDDEN,
VISIBILITY_CONSTRAINT.COUNTRY_HIDDEN,
VISIBILITY_CONSTRAINT.REGION_HIDDEN,
VISIBILITY_CONSTRAINT.CITY_HIDDEN,
VISIBILITY_CONSTRAINT.STREET_HIDDEN,
VISIBILITY_CONSTRAINT.ZIP_CODE_HIDDEN,
VISIBILITY_CONSTRAINT.PHONE_NUMBER_HIDDEN,
VISIBILITY_CONSTRAINT.HOME_PAGE_HIDDEN,
VISIBILITY_CONSTRAINT.HOBBIES_HIDDEN
).values(
visibilityConstraintId,
UInteger.valueOf(0),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
0.byteValue(),
'0', // shit happens
0.byteValue(),
0.byteValue()
).execute()
Пока писал тесты к говнопроекту, нашел PHONE_NUMBER_HIDDEN VARCHAR(64) NOT NULL. Hibernate по умолчанию ставил туда null. Там еще много всего, но остальное сюда не уместится.
+133
//You can assign Values to the ASPNET RadioButton like this way:
protected void Page_Load(object sender, EventArgs e)
{
RadioButton1.Attributes.Add("value", "ASPNET");
}
//Then you can access the value this way:
protected void Button1_Click(object sender, EventArgs e)
{
Response.Write(RadioButton1.Attributes["value"].ToString());
}
сегодня для меня стало новостью, что у высокоуровневого контрола asp.net web form RadioButton, который по сути рендерится в <input type="radio">, нет атрибута value.
http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.radiobutton(v= vs.110).aspx да, его нет.
но сначала я подумал, что все же может это я кривой и не туда смотрю, а потом нахожу велосипед, который предлагает MVP http://forums.asp.net/t/1379187.aspx?Why+does+an+ASP+NET+RadioBu tton+control+not+have+a+property+to+prog ramatically+set+the+value+attribute+
−89
public function getName():String
{
if (sourceUrl && sourceUrl != "")
{
var urlArray:Array = sourceUrl.split("/");
if (urlArray.length > 0)
{
var fileName:String;
fileName= urlArray[urlArray.length - 1] as String;
return fileName.substr(0,13);
}
}
return "";
}
Удача сопутствует смелым!
(Никакого очевидного повода к тому, чтобы в имени файла было какое-то определенное количество символов нет, я не знаю почему 13).
+157
for ($j=1; $j<8; $j++) {
$up = "";
$down = "";
for ($i=1; $i<7; $i++) {
if (($i==4)&&($j==4)) {
$up = $up.'<td class="simp" colspan="2" rowspan="4">Военная<br>Подготовка</td>';
continue;
}
if (($i==4)&&($j>3)&&($j<6)) {
continue;
}
$x = $i*2-1;
$y = $j*2-1;
if (($table[$x][$y]==$table[$x][$y+1])&&($table[$x+1][$y+1]==$table[$x+1][$y])&&($table[$x+1][$y+1]==$table[$x][$y])) {
$up = $up.str_replace("<br><br>","","<td title='".$table[$x][$y]['description']."' class='simp' colspan='2' rowspan='2'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>");
}
else {
$cnt = 0;
if ($table[$x][$y]==$s) $cnt++;
if ($table[$x][$y+1]==$s) $cnt++;
if ($table[$x+1][$y]==$s) $cnt++;
if ($table[$x+1][$y+1]==$s) $cnt++;
if ($cnt==3) {
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
$up = $up."<td title='".$table[$x+1][$y]['description']."' class='insm'>".$table[$x+1][$y]['subject']."<br>".$table[$x+1][$y]['auditory']."<br>".$table[$x+1][$y]['lecturer']."</td>";
$down = $down."<td title='".$table[$x][$y+1]['description']."' class='insm'>".$table[$x][$y+1]['subject']."<br>".$table[$x][$y+1]['auditory']."<br>".$table[$x][$y+1]['lecturer']."</td>";
$down = $down."<td title='".$table[$x+1][$y+1]['description']."' class='insm'>".$table[$x+1][$y+1]['subject']."<br>".$table[$x+1][$y+1]['auditory']."<br>".$table[$x+1][$y+1]['lecturer']."</td>";
}
else {
if ($table[$x][$y]==$table[$x][$y+1]) { // Левые совпадают
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm' rowspan='2'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
if ($table[$x+1][$y]==$table[$x+1][$y+1]) {
$up = $up."<td title='".$table[$x+1][$y]['description']."' class='insm' rowspan='2'>".$table[$x+1][$y]['subject']."<br>".$table[$x+1][$y]['auditory']."<br>".$table[$x+1][$y]['lecturer']."</td>";
}
else {
$up = $up."<td title='".$table[$x+1][$y]['description']."' class='insm'>".$table[$x+1][$y]['subject']."<br>".$table[$x+1][$y]['auditory']."<br>".$table[$x+1][$y]['lecturer']."</td>";
$down = $down."<td title='".$table[$x+1][$y+1]['description']."' class='insm'>".$table[$x+1][$y+1]['subject']."<br>".$table[$x+1][$y+1]['auditory']."<br>".$table[$x+1][$y+1]['lecturer']."</td>";
}
} else {
if ($table[$x+1][$y]==$table[$x+1][$y+1]) { // Правые совпадают
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
$down = $down."<td title='".$table[$x][$y+1]['description']."' class='insm'>".$table[$x][$y+1]['subject']."<br>".$table[$x][$y+1]['auditory']."<br>".$table[$x][$y+1]['lecturer']."</td>";
$up = $up."<td title='".$table[$x+1][$y]['description']."' class='insm' rowspan='2'>".$table[$x+1][$y]['subject']."<br>".$table[$x+1][$y]['auditory']."<br>".$table[$x+1][$y]['lecturer']."</td>";
}
else {
if ($table[$x][$y]==$table[$x+1][$y]) { // Верхние совпадают
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm' colspan='2'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
if ($table[$x][$y+1]==$table[$x+1][$y+1]) {
$down = $down."<td title='".$table[$x][$y+1]['description']."' class='insm' colspan='2'>".$table[$x][$y+1]['subject']."<br>".$table[$x][$y+1]['auditory']."<br>".$table[$x][$y+1]['lecturer']."</td>";
}
else {
$down = $down."<td title='".$table[$x][$y+1]['description']."' class='insm'>".$table[$x][$y+1]['subject']."<br>".$table[$x][$y+1]['auditory']."<br>".$table[$x][$y+1]['lecturer']."</td>";
$down = $down."<td title='".$table[$x+1][$y+1]['description']."' class='insm'>".$table[$x+1][$y+1]['subject']."<br>".$table[$x+1][$y+1]['auditory']."<br>".$table[$x+1][$y+1]['lecturer']."</td>";
}
}
else {
if ($table[$x][$y+1]==$table[$x+1][$y+1]) { // Нижние совпадают
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
$up = $up."<td title='".$table[$x+1][$y]['description']."' class='insm'>".$table[$x+1][$y]['subject']."<br>".$table[$x+1][$y]['auditory']."<br>".$table[$x+1][$y]['lecturer']."</td>";
$down = $down."<td title='".$table[$x][$y+1]['description']."' class='insm' colspan='2'>".$table[$x][$y+1]['subject']."<br>".$table[$x][$y+1]['auditory']."<br>".$table[$x][$y+1]['lecturer']."</td>";
}
else {
$up = $up."<td title='".$table[$x][$y]['description']."' class='insm'>".$table[$x][$y]['subject']."<br>".$table[$x][$y]['auditory']."<br>".$table[$x][$y]['lecturer']."</td>";
...
Рендер расписания занятий из базы данных в табличку на HTML
+157
function tedit_object()
{
if($this->authlib->logged_in()) {
$manager = $this->authlib->logged_manager_data();
$object_id = $this->input->post('object_id');
$type = $this->input->post('type');
$doprice = $this->input->post('doprice');
$price = $this->input->post('price');
$valute = $this->input->post('valute');
$dop = $this->input->post('dop');
$dozag = $this->input->post('dozag');
$zag = $this->input->post('zag');
$poslezag = $this->input->post('poslezag');
$rajon = $this->input->post('rajon');
$naselenp = $this->input->post('naselenp');
$opisanie = $this->input->post('opisanie');
$coordinatesgmap = $this->input->post('coordinatesgmap');
$dorprice = $this->input->post('dorprice');
$porprice = $this->input->post('porprice');
$domorepered = $this->input->post('domorepered');
$domore = $this->input->post('domore');
$domoreposle = $this->input->post('domoreposle');
$sdanpered = $this->input->post('sdanpered');
$sdan = $this->input->post('sdan');
$stars = $this->input->post('stars');
$kakchestvo = $this->input->post('kakchestvo');
$jivetpered = $this->input->post('jivetpered');
$jivet = $this->input->post('jivet');
$jivetposle = $this->input->post('jivetposle');
$jivetposle2 = $this->input->post('jivetposle2');
$rprice = $this->input->post('rprice');
$vip = $this->input->post('vip');
$data_to_object = array(
'manager_id' => $manager['id'],
'type_id' => $type,
'dorprice' => $dorprice,
'doprice' => $doprice,
'porprice' => $porprice,
'price' => $price,
'valute_id' => $valute,
'dop' => $dop,
'dozag' => $dozag,
'zag' => $zag,
'poslezag' => $poslezag,
'domorepered' => $domorepered,
'domore' => $domore,
'domoreposle' => $domoreposle,
'sdanpered' => $sdanpered,
'sdan' => $sdan,
'stars' => $stars,
'kakchestvo' => $kakchestvo,
'jivetpered' => $jivetpered,
'jivet' => $jivet,
'jivetposle' => $jivetposle,
'jivetposle2' => $jivetposle2,
'rprice' => $rprice,
'vip' => $vip,
'map' => $coordinatesgmap,
'naselenp' => $naselenp,
'rajon' => $rajon,
'desc' => $opisanie,
'modified' => date('Y-m-d H:i:s')
);
$this->db->where('id', $object_id);
$this->db->update('object_only', $data_to_object);
///echo $object_id;
redirect('/edit_object/'.$object_id, 'refresh');
} else { redirect('/authorization/', 'refresh'); }
}
Любимый проект <3
+78
public class ComponentProvider implements ObjectProvider {
@SuppressWarnings("unchecked")
@Override
public <T> T provide(final Class<T> objectType, final AnnotationProvider annotationProvider,
final ObjectLocator locator) {
return objectType.getName().startsWith(
locator.getService(SymbolSource.class).valueForSymbol(FXSymbols.FX_PACKAGE)) ? locator.getService(
ComponentLocator.class).isComponentValid(objectType.getName()) ? (T) locator.getService(
ComponentInstantiatorSource.class).newInstance(objectType.getName()) : null : null;
}
}
и в конце грустное : null : null;
−161
// RangeError: Error #2006: The supplied index is out of bounds.
// at flash.display::DisplayObjectContainer/getChildAt()
// at com.pt.utils::CustomSWFLoaderUtil$/isCorrectCustomSWF()[/var/lib/jenkins/workspace/<secret>/src/com/pt/utils/CustomSWFLoaderUtil.as:23]
private static function isCorrectCustomSWF(swf:SWFLoader):Boolean
{
if (swf &&
swf.content &&
swf.content is ContentDisplay &&
(swf.content as ContentDisplay).getChildAt(0) &&
(swf.content as ContentDisplay).getChildAt(0) is MovieClip &&
((swf.content as ContentDisplay).getChildAt(0) as MovieClip).numChildren == 1)
return (swf.content.getChildAt(0) is MovieClip);
else
return false;
}
Ну не фарт!