−106
- 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
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation
{
if (rotateBag > 6) //после возврата, шудавторотейт вызывается 7 раз, это условие для погашения этих вызовов
{
if ([portret isEqualToString:@"horizontal"])
{
if (firstLaunch == 0) // блок для первого запуска (по умолчанию всегда выставляет ландскейпРайт, а это не всегда правильно)
{
if (interfacePosition == 0)
{ self.view.transform = CGAffineTransformMakeRotation(M_PI); }
else
{ self.view.transform = CGAffineTransformIdentity; }
firstLaunch++;
indexLandscape = interfacePosition;
}
else
{
if (indexLandscape == 1) //если изначальный вариант был правосторонний
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) // если ЛандскейпРайт
{ self.view.transform = CGAffineTransformIdentity;
interfacePosition = 1; }
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) // если ЛандскейпЛефт
{ self.view.transform = CGAffineTransformMakeRotation(M_PI);
interfacePosition = 0; }
}
else //если изначальный вариант был левосторонний
{
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) // если ЛандскейпРайт
{ self.view.transform = CGAffineTransformMakeRotation(M_PI);
interfacePosition = 1; }
if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft) // если ЛандскейпЛефт
{ self.view.transform = CGAffineTransformIdentity;
interfacePosition = 0; }
}
}
}
else
{
if (firstLaunch == 0) // блок для первого запуска (по умолчанию показывается правильно, поэтому ничего делать не надо)
{ firstLaunch++; }
else
{
if (toInterfaceOrientation == UIInterfaceOrientationPortrait)
{ self.view.transform = CGAffineTransformIdentity; }
if (toInterfaceOrientation == UIInterfaceOrientationPortraitUpsideDown)
{ self.view.transform = CGAffineTransformMakeRotation(M_PI); }
}
}
}
else {
rotateBag++;
}
return false;
}
Крутящаяся сумка в действии...
Поворот дисплея в 50 строк :\
mrWindMak3r,
16 Июня 2011
+154
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
include "./include/db.conf.php";
$con = mysql_connect($DB["host"],$DB["user"],$DB["pass"]) or die ("could not connect:".mysql_error());
mysql_set_charset('utf8');
mysql_select_db($DB["dbName"]) or die ("could not connect:".mysql_error());
$hash = $_GET['hash'];
$login = $_GET['login'];
echo "SELECT id FROM reg WHERE log = '".$login."' AND hash = '".$hash."'";
$query = mysql_query("SELECT id FROM reg WHERE log = '".$login."' AND hash = '".$hash."'") or die ("MYSQL error".mysql_error());
if ($query) {
while($row = mysql_fetch_array($query)) {
echo row['id'];}
$query = mysql_query("UPDATE reg SET commit=1 WHERE id=".row['id'])
or die ("MYSQL error".mysql_error());}
Знакомая поделилась шедевром. Так, конечно, можно... но в общем комментарии излишни.
Да, форматирование оригинала сохранено.
0rt,
16 Июня 2011
+86
- 1
- 2
- 3
- 4
- 5
- 6
public static String hello()
{
String s = "";
s += "Добро пожаловать на наш сайт.";
return s;
}
redenemy,
16 Июня 2011
+163
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
// Checks if the passed input's value is nothing.
function isEmptyText(theField)
{
// Copy the value so changes can be made..
var theValue = theField.value;
// Strip whitespace off the left side.
while (theValue.length > 0 && (theValue.charAt(0) == ' ' || theValue.charAt(0) == '\t'))
theValue = theValue.substring(1, theValue.length);
// Strip whitespace off the right side.
while (theValue.length > 0 && (theValue.charAt(theValue.length - 1) == ' ' || theValue.charAt(theValue.length - 1) == '\t'))
theValue = theValue.substring(0, theValue.length - 1);
if (theValue == '')
return true;
else
return false;
}
...
function in_array(variable, theArray)
{
for (var i in theArray)
if (theArray == variable)
return true;
return false;
}
zomg,
16 Июня 2011
+125
- 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
protected string getUpdateNotesDE(string fieldNameAlias, string fieldName, string fieldValue, ASPxDateEdit newValue)
{
if (isSaveField("fieldName"))
{
if (fieldValue != "")
return "Field " + locCom.getFieldAlias("payTFNDeclaredOn") + ", Old Value = " + Convert.ToDateTime(fieldValue).ToString("dd/MM/yyyy") + ", New Value = " + Convert.ToDateTime(newValue.Text).ToString("dd/MM/yyyy") + " ; ";
else
if (newValue.Text != "")
return "Field " + locCom.getFieldAlias("payTFNDeclaredOn") + ", Old Value = , New Value = " + Convert.ToDateTime(newValue.Text).ToString("dd/MM/yyyy") + " ; ";
}
return "";
}
protected Boolean isSaveField(string fieldName)
{
if (locCom.getVisible(fieldName))
return true;
return false;
}
public bool getVisible(string fldName)
{
Boolean showall = Convert.ToBoolean(System.Web.Configuration.WebConfigurationManager.AppSettings.Get("Show-all-fields"));
if (showall) return true;
if (fldAccess.Tables.Count == 0) return false;
foreach (System.Data.DataRow item in fldAccess.Tables[0].Rows)
{
if (item["fieldname"].ToString().Replace('@', 'a').Replace("%", "percent").Replace("$", "dollar").ToLower() == fldName.ToLower())
return Convert.ToBoolean(item["visible"]);
}
return false;
}
особенно доставляет
protected string getUpdateNotesDE(string fieldName){
if (isSaveField( !!! "fieldName" !!!)){}
}
valorkin,
15 Июня 2011
+162
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
public function save() {
try {
try {
$this->create();
} catch (Exception $e) {
//probably dulplicate
$this->update();
}
} catch (Exception $e) {
logger::error($e);
}
}
try-catch много не бывает
super,
15 Июня 2011
+129
- 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
public void ReadFromFile()
{
LoadIntervals = new TimeIntervals(Color.Black);
StreamReader tReader = null;
tReader = File.OpenText("DefaultIntervals");
string income = null;
while ((income = tReader.ReadLine()) != null)
{
// string income = tReader.ReadLine();
string colorR = null; string colorG = null; string colorB = null; string colorA = null; string interval = null;
int i = 0;
for (i = 4; i < income.Length; i++)
{
if (income[i] != ',')
{
interval += income[i];
}
else { break; }
}
for (int a = i + 10; a < income.Length; a++)
{
if (income[a] != ',')
{
colorA += income[a];
}
else
{
for (int r = a + 4; r < income.Length; r++)
{
if (income[r] != ',')
{
colorR += income[r];
}
else
{
for (int g = r + 4; g < income.Length; g++)
if (income[g] != ',')
{
colorG += income[g];
}
else
{
for (int b = g + 4; b < income.Length; b++)
if (income[b] != ',')
{
if (income[b] != ']')
colorB += income[b];
}
else
{
break;
}
break;
}
break;
}
}
break;
}
}
TimePoint tp = new TimePoint(Convert.ToDouble(interval), Color.FromArgb(Convert.ToInt32(colorA), Color.FromArgb(Convert.ToInt32(colorR), Convert.ToInt32(colorG), Convert.ToInt32(colorB))));
LoadIntervals.Add(tp);
}
tReader.Close();
Intervals = LoadIntervals;
}
Так мы парсим файл конфигов вида. (Формат придуман автором кода)
Int=3,Color [A=223, R=253, G=4, B=38]
Int=10,Color [A=255, R=86, G=86, B=185]
Int=20,Color [A=200, R=255, G=215, B=0]
Int=50,Color [A=200, R=255, G=165, B=0]
lomomike,
15 Июня 2011
+85
- 1
boolean ROLLBACK = new Boolean(false).booleanValue();
И это пишет тимлид (сеньор) в моей конторе
Loord,
15 Июня 2011
+157
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
function date_preobr($date, $ind=0) {
$date1=substr($date, 8, 2); $date21=substr($date, 5, 2); $date3=substr($date, 0, 4);
if ($ind==0) $data=$date1.".".$date21.".".$date3;
elseif ($ind==1) $data=$date1.".".$date21.".".substr($date3, 2, strlen($date3)-2);
elseif ($ind==2) {switch ($date21) {case "01":$date21="января";break;case "02":$date21="февраля";break;
case "03":$date21="марта";break;case "04":$date21="апреля";break;case "05":$date21="мая";break;
case "06":$date21="июня";break;case "07":$date21="июля";break;case "08":$date21="августа";break;
case "09":$date21="сентября";break;case "10":$date21="октября";break;case "11":$date21="ноября";break;
case "12":$date21="декабря";break;} $data=$date1." ".$date21." ".$date3;}
return $data;}
Были даты, есть дата, будут даты.
Привожу в первозданном виде.
De-Luxis,
15 Июня 2011
+128
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
if (body.ToLower().Contains("pr") ||
subject.Contains("PM") ||
subject.Contains("pm") ||
subject.Contains("Pm") ||
subject.Contains("pM") ||
subject.Contains("PMR") ||
subject.Contains("prs") ||
subject.ToLower().Contains("prt") ||
subject.ToLower().Contains("prm") ||
subject.ToLower().Contains("pmt") ||
subject.ToLower().Contains("pmk") ||
subject.ToLower().Contains("pml") ||
subject.ToLower().Contains("pal"))
{
result = true;
}
Пишут друзья из Норвегии
jenik15,
15 Июня 2011