- 1
private string[] months = new string[12] {"Январь","Февраль","Март", "Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"};
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+135.1
private string[] months = new string[12] {"Январь","Февраль","Март", "Апрель","Май","Июнь","Июль","Август","Сентябрь","Октябрь","Ноябрь","Декабрь"};
безусловно сильный ход. особенно для .NET
+161.1
$w="";
foreach(array("id_page","id_point","id") as $i)
$w.=$$i?(($w?" and ":"")."$i=".$$i):"";
$sql="select * from ".$this->_name." where $w order by ordr,ts desc";
и без комментов, ага.
+138
txtCollimator.parentNode.parentNode.parentNode.parentNode.parentNode.style.display = "none";
Прапрапрадедушка можно уже не показывать.
Дикая вложенность UserContol в ASP.Net дает о себе знать.
+70.9
public class SHcoGlobalInf extends Hashtable {
//много-много констант, но в силу ограничений обьема я их сокращаю
public static final String KEY_KAKKO_MAE = "KEY_KAKKO_S";
public static final String KEY_KAKKO_MAE_0 = "KEY_KAKKO_S0";
// ..... исчо набор "как"
public static final String KEY_KAKKO_MAE_K = "KEY_KAKKO_SK";
public static final String KEY_KAKKO_ATO = "KEY_KAKKO_E";
public static final String KEY_KAKKO_ATO_0 = "KEY_KAKKO_E0";
//набор "каков-атов"
public static final String KEY_KAKKO_ATO_K = "KEY_KAKKO_EK";
public static final String KEY_HATUHENDEN_CD = "KEY_HATUHENDEN_CD";
public static final String KEY_SODEN_CD = "KEY_SODEN_CD";
public static final String KEY_BUTTON_W = "KEY_BUTTON_W";
public static final String KEY_BUTTON_H = "KEY_BUTTON_H";
public static final String KEY_TOTAL = "KEY_TOTAL";
public static final String KEY_BUNRUI_CD = "KEY_BUNRUI_CD";
public static final String KEY_SIZAI_SVR_URL = "comSizaiSvrUrl";
public static final String KEY_BIZ_LIMIT_RANGE_MINUTE = "KEY_BIZ_LIMIT_RANGE_MINUTE";
public static final String KEY_SIZAI_SVR_DIRECT_URL = "comSizaiSvrDirectUrl";
public static final String KEY_DOMAIN_MOBILE = "comPsmoDomainMobile";
public static final String KEY_TRAINING_MODE = "comTrainingMode";
public static final String KEY_BATCH_HOME = "comBatchHome";
public String getKakkoStart(String strShuyakuCd) {
StringBuffer strAttributeName = new StringBuffer();
strAttributeName.append(KEY_KAKKO_MAE);
strAttributeName.append(strShuyakuCd);
Object obj = this.get(strAttributeName.toString());
if(obj instanceof String) {
return (String) obj;
} else {
return "";
}
}
public String getKakkoEnd(String strShuyakuCd) {
StringBuffer strAttributeName = new StringBuffer();
strAttributeName.append(KEY_KAKKO_ATO);
strAttributeName.append(strShuyakuCd);
Object obj = this.get(strAttributeName.toString());
if(obj instanceof String) {
return (String) obj;
} else {
return "";
}
}
public String parseKakko(String strValue, String strShuyakuCd) {
String strResult = "";
if(strValue instanceof String) {
if(!strValue.equals("")) {
StringBuffer outValue = new StringBuffer();
outValue.append(this.getKakkoStart(strShuyakuCd));
outValue.append(strValue);
outValue.append(this.getKakkoEnd(strShuyakuCd));
return outValue.toString();
}
}
return strResult;
}
public String getCodeSet(String strKey) {
Object obj = this.get(strKey);
return (String) obj;
}
public String getHostUrl() {
StringBuffer sbHostUrl = new StringBuffer();
sbHostUrl.append((String)this.get("KEY_PROTOCOL"));
sbHostUrl.append((String)this.get("comHstAplSvr"));
sbHostUrl.append(".");
sbHostUrl.append((String)this.get("comPsmoDomain"));
return sbHostUrl.toString();
}
}
Пример, как нельзя подходящий местному сайту. Почему? Обратите внимание на названия констант и методов. Они берут "каки", т.е. говно.
Ето чудо наваяно дишовыми китайцами, мною сокращено ибо со всеми константами занимало 500 строк. Также важно заметить, что етот какоед наследуется от хештейбла, по видимому в целях поднятия производительности:)
+129.4
(string) $def == (string) $value
Видимо о том, что == сравнивает строковые представления программист не знал.
+143.2
if o is TSpellChecker then
begin
TSpellChecker(o).FinishMessage := ml(TSpellChecker(o).FinishMessage, form.Name);
TSpellChecker(o).caption := ml(TSpellChecker(o).caption, form.Name);
end else
if o is Tform then
begin
TMenuItem(o).Caption := ml(TMenuItem(o).Caption, form.Name);
TMenuItem(o).Hint := ml(TMenuItem(o).Hint, form.Name);
end else
if o is TComboBox then
begin
//TComboBox(o).Caption:=ml(TMenuItem(o).Caption,form.Name);
TComboBox(o).Hint := ml(TComboBox(o).Hint, form.Name);
end else
if o is TMenuItem then
begin
TMenuItem(o).Caption := ml(TMenuItem(o).Caption, form.Name);
TMenuItem(o).Hint := ml(TMenuItem(o).Hint, form.Name);
end else
if (o is TTBXButton) then
begin
TTBXButton(o).Caption := ml(TTBXButton(o).Caption, form.Name);
TTBXButton(o).Hint := ml(TTBXButton(o).Hint, form.Name);
end else
if (o is TTBXLink) then
begin
TTBXLink(o).Caption := ml(TTBXLink(o).Caption, form.Name);
TTBXLink(o).Hint := ml(TTBXLink(o).Hint, form.Name);
end else
if (o is TRzGroup) then
begin
TRzGroupBox(o).Caption := ml(TRzGroup(o).Caption, form.Name);
TRzGroupBox(o).Hint := ml(TRzGroup(o).Hint, form.Name);
end else
if (o is TRzPanel) then
begin
TRzGroupBox(o).Caption := ml(TRzPanel(o).Caption, form.Name);
TRzGroupBox(o).Hint := ml(TRzPanel(o).Hint, form.Name);
end else
if (o is TRzButton) then
begin
TRzButton(o).Caption := ml(TRzButton(o).Caption, form.Name);
TRzButton(o).Hint := ml(TRzButton(o).Hint, form.Name);
end else
if (o is TRzTabControl) then
begin
TRzTabControl(o).Hint := ml(TRzTabControl(o).Hint, form.Name);
for k := 0 to TRzTabControl(o).Tabs.Count - 1 do
begin
TRzTabControl(o).Tabs.Items[k].Caption := ml(TRzTabControl(o).Tabs.Items[k].Caption, form.Name);
TRzTabControl(o).Tabs.Items[k].Hint := ml(TRzTabControl(o).Tabs.Items[k].Hint, form.Name);
end;
end else
if (o is TRzTabSheet) then
begin
TRzTabSheet(o).Caption := ml(TRzTabSheet(o).Caption, form.Name);
end else
if (o is TRzGroupBox) then
begin
TRzGroupBox(o).Caption := ml(TRzGroupBox(o).Caption, form.Name);
TRzGroupBox(o).Hint := ml(TRzGroupBox(o).Hint, form.Name);
end else
if (o is TRzGroupItems) then
begin
TRzGroupBox(o).Caption := ml(TRzGroupBox(o).Caption, form.Name);
TRzGroupBox(o).Hint := ml(TRzGroupBox(o).Hint, form.Name);
end else
if (o is TToolButton) then
begin
TToolButton(o).Caption := ml(TToolButton(o).Caption, form.Name);
TToolButton(o).Hint := ml(TToolButton(o).Hint, form.Name);
end else
if o is TButton then
begin
TButton(o).Caption := ml(TButton(o).Caption, form.Name);
TButton(o).Hint := ml(TButton(o).Hint, form.Name);
end else
if o is TBitBtn then
begin
TBitBtn(o).Caption := ml(TBitBtn(o).Caption, form.Name);
TBitBtn(o).Hint := ml(TBitBtn(o).Hint, form.Name);
end else
if o is TSpeedButton then
begin
TSpeedButton(o).Caption := ml(TSpeedButton(o).Caption, form.Name);
TSpeedButton(o).Hint := ml(TSpeedButton(o).Hint, form.Name);
end else
if o is TRzToolButton then
begin
TRzToolButton(o).Caption := ml(TRzToolButton(o).Caption, form.Name);
TRzToolButton(o).Hint := ml(TRzToolButton(o).Hint, form.Name);
end else
if o is TRadioButton then
begin
TRadioButton(o).Caption := ml(TRadioButton(o).Caption, form.Name);
TRadioButton(o).Hint := ml(TRadioButton(o).Hint, form.Name);
end else
это пестец
+121.3
public SaveOpenTemplate getThis() {
return this;
}
Они это сделали!
+92
header('Location: '.$_SERVER['REQUEST_URI']);
exit();
die();
на всякий случай :)
+3
try
{
GetRecentOrdersList();
}
catch (XmlFileHasWrongFormatException)
{
wrongClientSettingsXmlFormat = true;
}
if (wrongClientSettingsXmlFormat == true)
{
IList<RecentDocumentInfo> fakeList = new List<RecentDocumentInfo>();
SetRecentOrdersList(fakeList);
wrongClientSettingsXmlFormat = false;
}
Как правильно обрабатывать исключения
+128.2
public static string ValidateEmail(string Email)
{
try
{
if (Email.Trim() == string.Empty)
{
return "Empty Parameter - Email";
}
}
catch
{
return "Empty Parameter - Email";
}
return null;
}