-
Лучший говнокод
- В номинации:
-
- За время:
-
-
+154
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
$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 минут грамотно.
miraage,
05 Марта 2013
-
+74
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
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(...).
Landing,
04 Марта 2013
-
−107
- 1
- 2
SelectionViewController* controller = [[[SelectionViewController alloc] initWithArray:options selectedIndex:&_selectedIndex] autorelease];
[self.navigationController pushViewController:controller animated:YES];
_selectedInded это ivar типа int, который передается по ссылке!! Ад!
notxcain,
22 Февраля 2013
-
−98
- 1
- 2
- 3
- 4
- 5
- 6
dispatch_async(dispatch_get_global_queue(0, 0), ^{
[NSThread sleepForTimeInterval:0.35];
[[NSThread mainThread] performBlock:^{
[titleLabel setHidden:NO];
}];
});
torip3ng,
20 Февраля 2013
-
+110
- 1
<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]
someone,
13 Февраля 2013
-
+131
- 1
- 2
- 3
- 4
- 5
- 6
- 7
void *threadFunc(void *)
{
// ...
pthread_exit( (void*)lTaskId );
return ( (void*)lTaskId );
// ...
}
позабавило.
для непосвященных: return в функции потока аналогичен вызову pthread_exit().
Dummy00001,
11 Февраля 2013
-
+135
- 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
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());
}
}
}
}
Парсим строки правильно...
javanesovsemgovno,
11 Февраля 2013
-
+106
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
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;
Я не смог раскрыть формат нужной программы, поэтому я извлекаю данные, бегая по окну с картинкой и считывая число из окна с температурой, лол.
Скорость считывания удручает, но пока альтернатив нет.
TarasB,
06 Февраля 2013
-
+137
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
SqlConnection connection = new SqlConnection(connectionString);
SqlCommand command = connection.CreateCommand();
using (connection = new SqlConnection(connectionString))
{
command.CommandText = storedProcedure;
}
command.Connection.Open();
Открывает соединение с сервером.
kore_sar,
05 Февраля 2013
-
+48
- 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
class A {
public $timeline = array();
function __construct(){
for ( $i=3; $i-->0;){
array_push($this->timeline, new B);
}
}
}
class B {
public $moments = array();
function __construct(){
for ( $i=3; $i-->0;){
array_push($this->moments, new C);
}
}
}
class C {
public $minutes = array();
function __construct(){
for ( $i=3; $i-->0;){
array_push($this->minutes, new D);
}
}
}
class D {
public $time = 0;
}
echo json_encode(new A);
Вопрос от автора: Добрый день, столкнулся с такой задачей, нужно составить массив в php что бы перегоняя в json он был вида (туткусокжасона) ...бла-бла-бла... Нашел что-то типо этого, расскажите пожалуйста толком как правильно это реализовать
Пруфлинк: http://forum.php.su/topic.php?forum=72&topic=1873
Razban_Guestov,
01 Февраля 2013