- 1
- 2
- 3
- 4
- 5
$_SESSION["db_options"] = array ('host' => trim($this->IP).":".trim($this->Port),
'user' => trim($this->User),
'password' => trim($this->Pass),
'database' => trim($this->DB)
);
Нашли или выдавили из себя код, который нельзя назвать нормальным, на который без улыбки не взглянешь? Не торопитесь его удалять или рефакторить, — запостите его на говнокод.ру, посмеёмся вместе!
+153
$_SESSION["db_options"] = array ('host' => trim($this->IP).":".trim($this->Port),
'user' => trim($this->User),
'password' => trim($this->Pass),
'database' => trim($this->DB)
);
Наследование? Не, не слышал
+154
$code_date = strtotime($sms_action_date);
$date = date(
"Y-m-d H:i:s",
mktime(
date('H', $code_date),
date('i', $code_date) + 30,
date('s', $code_date),
date("m", $code_date),
date("d", $code_date),
date("Y", $code_date)
)
);
Определяем +30 минут грамотно.
+74
private boolean userInOneRegistrationNode() throws DfException {
String uname = OrganizationStaffStructureHelper.getCurrentUserName();
int i = 0;
IDfCollection NodesCol = DQLHelper.getCollection(DQL_GET_REGISTRATOR_DIV, new String[]{uname});
while (NodesCol.next()) {
if (!(NodesCol == null)) {
String group_name = NodesCol.getString(GROUP_NAME);
i = i + 1;
}
}
if (i == 1) {
return true;
}
return false;
}
Заменяется 2мя строками один - select count(*), вторая - полученный результат Integer.ValueOf(...).
−107
SelectionViewController* controller = [[[SelectionViewController alloc] initWithArray:options selectedIndex:&_selectedIndex] autorelease];
[self.navigationController pushViewController:controller animated:YES];
_selectedInded это ivar типа int, который передается по ссылке!! Ад!
−98
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[NSThread sleepForTimeInterval:0.35];
[[NSThread mainThread] performBlock:^{
[titleLabel setHidden:NO];
}];
});
+110
<img border="0" width="476" height="179" src="file:///C|/Users/jy88h0/AppData/Roaming/Macromedia/Dreamweaver /eCustomer/iq/images/AI289.jpg" alt="Image of a properly addressed mail piece">
http://faq.usps.com/eCustomer/iq/usps/request.do?create=kb%3AUSPSFAQ&view%28%2 9=c[c_usps0910]
+131
void *threadFunc(void *)
{
// ...
pthread_exit( (void*)lTaskId );
return ( (void*)lTaskId );
// ...
}
позабавило.
для непосвященных: return в функции потока аналогичен вызову pthread_exit().
+135
namespace CuttingBox
{
class Program
{
static public Tuple<int[], String> getProperty()
{
int[] itemDimensionProperty = new int[3];
String itemColorProperty;
String[] parseResult = new String[4];
parseResult = (Console.ReadLine().Split(' '));
for (int counter = 0; counter < 3; counter++)
{
itemDimensionProperty[counter] = Convert.ToInt32(parseResult[counter]);
}
itemColorProperty = parseResult[3];
Tuple<int[], String> itemProperty = new Tuple<int[], string>(itemDimensionProperty, itemColorProperty);
return itemProperty;
}
static void Main(string[] args)
{
List<Tuple<int[], String>> itemProperty = new List<Tuple<int[], String>>();
itemProperty.Add(getProperty());
int numberOfBoxes = Convert.ToInt32(Console.ReadLine());
for (int counter=1; counter<=numberOfBoxes; counter++){
itemProperty.Add(getProperty());
}
}
}
}
Парсим строки правильно...
+106
for j := Low(Matrix) to High(Matrix) do begin
Caption := 'Processing ' + IntToStr(j) + ' of ' + IntToStr(High(Matrix));
for i := Low(Matrix[j]) to High(Matrix[j]) do begin
SendMessage(PictureWindow, WM_MOUSEMOVE, 0, MakeLPARAM(i,j));
S := GetCaption(TemperatureWindow);
Matrix[j,i].V := StrToFloat(S);
end;
end;
Я не смог раскрыть формат нужной программы, поэтому я извлекаю данные, бегая по окну с картинкой и считывая число из окна с температурой, лол.
Скорость считывания удручает, но пока альтернатив нет.
+137
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = connection.CreateCommand();
using (connection = new SqlConnection(connectionString))
{
command.CommandText = storedProcedure;
}
command.Connection.Open();
Открывает соединение с сервером.