- 1
- 2
- 3
// string errorMessage;
if (result == false)
result = true; //because model is not changed
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+142
// string errorMessage;
if (result == false)
result = true; //because model is not changed
because
−122
Public m_Values As Hashtable
Public Function GetSensorType(p_SensorType As SensorType) As SensorValue
For Each de As DictionaryEntry In m_Values
If CType(de.Key, SensorType) = p_SensorType Then
Return de.Value
End If
Next
Return Nothing
End Function
Отличный пример работы с Hashtable!
+138
public new string ID
{
get
{
return base.ID;
}
set
{
base.ID = value;
}
}
−97
def constant_time_compare(val1, val2):
"""
Returns True if the two strings are equal, False otherwise.
The time taken is independent of the number of characters that match.
"""
if len(val1) != len(val2):
return False
result = 0
for x, y in zip(val1, val2):
result |= ord(x) ^ ord(y)
return result == 0
Django.utils.crypto в Django 1.4
−124
<?"Объект">_и="";<?"Объект">_с=0;<?"Объект">_кол=<?"Объект">.Количество();<?"Объект">_нд=ТекущаяДата();<?"Объект">_пд=<?"Объект">_нд;
<?"Объект">_с=<?"Объект">_с+1;Если <?"Объект">_пд<>ТекущаяДата() Тогда <?"Объект">_пд=ТекущаяДата();<?"Объект">_ост=(<?"Объект">_пд-<?"Объект">_нд)/<?"Объект">_с*(<?"Объект">_кол-<?"Объект">_с);Состояние(<?"Объект">_и+Формат(<?"Объект">_с/<?"Объект">_кол*100,"ЧДЦ=1;")+"% "+формат('00010101'+<?"Объект">_ост,"ДФ=ЧЧ:мм:сс"));КонецЕсли;
Шаблон для строки состояния. Видимо, первая строка вставляется перед циклом, вторая внутри.
+132
SqlConnection cmdConnection = GetSKDConnection();
cmdConnection.Open();
SqlCommand resetCardCmd = new SqlCommand("UPDATE hPerson SET CurrentCardNr=NULL WHERE PersonalNr='" + pass.Number.TrimStart('0'), cmdConnection);
resetCardCmd.CommandText = "DELETE FROM bCardData WHERE CardFK=" + (from pf in pass.PassFieldList where pf.FieldTypeName == "radio" select pf).Single().Card.CardNumber;
resetCardCmd.ExecuteNonQuery();
Мне кажется, или что то важное точно не произойдет?
−117
SET_CCC="CCC= ${CCC}"
Где-то в макросах для autotools.
−93
# Source: python3.4/distutils/dir_util.py
# cache for by mkpath() -- in addition to cheapening redundant calls,
# eliminates redundant "creating /foo/bar/baz" messages in dry-run mode
_path_created = {}
# I don't use os.makedirs because a) it's new to Python 1.5.2, and
# b) it blows up if the directory already exists (I want to silently
# succeed in that case).
def mkpath(name, mode=0777, verbose=1, dry_run=0):
"""Create a directory and any missing ancestor directories.
If the directory already exists (or if 'name' is the empty string, which
means the current directory, which of course exists), then do nothing.
Raise DistutilsFileError if unable to create some directory along the way
(eg. some sub-path exists, but is a file rather than a directory).
If 'verbose' is true, print a one-line summary of each mkdir to stdout.
Return the list of directories actually created.
"""
global _path_created
# Detect a common bug -- name is None
if not isinstance(name, basestring):
raise DistutilsInternalError, \
"mkpath: 'name' must be a string (got %r)" % (name,)
# XXX what's the better way to handle verbosity? print as we create
# each directory in the path (the current behaviour), or only announce
# the creation of the whole path? (quite easy to do the latter since
# we're not using a recursive algorithm)
name = os.path.normpath(name)
created_dirs = []
if os.path.isdir(name) or name == '':
return created_dirs
if _path_created.get(os.path.abspath(name)):
return created_dirs
...
Мало того, что метод жив на основании того, что os.makedirs был добавлен только в Python 1.5.2 (мама родная, 2.7 скоро закопаем, а говно всё тянется), так его ещё и умудрились наиндусить на 60 строк кода, да ещё и ХХХ секцию аккуратно положили. Ладно, чего это я придираюсь... Ах да, оно кеширует уже созданные директории, так что если создать папку и удалить её, второй раз её уже никак не создашь...
+134
//#if UNITY_IPHONE && !(UNITY_3_0 || UNITY_3_1 || UNITY_3_2 || UNITY_3_3 || UNITY_3_4 || UNITY_3_5 || UNITY_3_6 || UNITY_3_7 || UNITY_3_8 || UNITY_3_9 || UNITY_4_0 || UNITY_4_1 || UNITY_4_2 || UNITY_4_3 || UNITY_4_4 || UNITY_4_5 || UNITY_4_6 || UNITY_4_7 || UNITY_4_8 || UNITY_4_9)
if (Selection.activeGameObject != null)
control = (IControl)Selection.activeGameObject.GetComponent("IControl");
//#endif
принял код от юнити юниора
+153
document.body.innerHTML = document.body.innerHTML.replace(/guest/g, '');<