-
+8
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
- 14
- 15
//список строк
QStringList rows_list = text.split("\n");
uint32_t row=0;
uint32_t col=0;
for(QStringList::iterator itR=rows_list.begin(); itR!=rows_list.end(); itR++,row++)
{
QStringList columns_list=itR->split(";");
col=0;
for(QStringList::iterator itC=columns_list.begin(); itC!=columns_list.end(); itC++,col++)
{
//*itC,row,col
}
}
Человек осилил итераторы в с++...
(для тех, кто не в теме - QStringList имеет доступ по индексу за константное время)
А еще мне нравятся uint32_t вместо int или, на худой конец, quint32.
ABBAPOH,
22 Февраля 2013
-
+150
- 1
<a href="javascript: document.location.href = document.location.href;" onclick="s_objectID="javascript: document.location.href = document.location.href;_1";return this.s_oc?this.s_oc(e):true">Нажмите здесь, если сканирование не закончилось.</a>
document.location.href = document.location.href
TRANE73,
22 Февраля 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
-
+140
- 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
DoubleAnimation S4A = new DoubleAnimation();
S4A.To = koef4;
S4A.Duration = TimeSpan.FromSeconds(T);
Trans1.BeginAnimation(TranslateTransform3D.OffsetXProperty, S4A);
DoubleAnimation S4ACX = new DoubleAnimation();
S4ACX.Duration = TimeSpan.FromSeconds(T);
S4ACX.To = 0.4;
Kleshni1Trans.BeginAnimation(RotateTransform3D.CenterXProperty, S4ACX);//Корректировка центра вращения клешни
DoubleAnimation S5A = new DoubleAnimation();
S5A.To = koef5;
S5A.Duration = TimeSpan.FromSeconds(T);
Slider5.BeginAnimation(Slider.ValueProperty, S5A);//конец анимации робота
BoxRotate2Center.CenterX = -BoxMove.OffsetX;
BoxRotate2Center.CenterZ = -BoxMove.OffsetZ;
BoxRotate1Center.CenterZ = -1.2;
DoubleAnimation B1A = new DoubleAnimation();
B1A.BeginTime = TimeSpan.FromSeconds(T*(2/1.5));
B1A.To = 180+((180*Math.Asin(0.2/Math.Sqrt((1.2 - BoxMove.OffsetZ)*(1.2 - BoxMove.OffsetZ) + BoxMove.OffsetX*BoxMove.OffsetX)))/Math.PI)-(180*Math.Atan((BoxMove.OffsetX)/(-1.2+BoxMove.OffsetZ))/Math.PI);//Формула корректировки угла поворота коробки
B1A.Duration = TimeSpan.FromSeconds(T);
BoxRotate2.BeginAnimation(AxisAngleRotation3D.AngleProperty, B1A);//анимация вращения коробки
DoubleAnimation B2A = new DoubleAnimation();
B2A.BeginTime = TimeSpan.FromSeconds(T+T/4 +T * (2 / 1.5));
B2A.To = 90 + 180 * Math.Atan((BoxMove.OffsetX) / (-1.2 + BoxMove.OffsetZ)) / Math.PI;
B2A.Duration = TimeSpan.FromSeconds(T/4);
BoxRotate1.BeginAnimation(AxisAngleRotation3D.AngleProperty, B2A);
DoubleAnimation B3A = new DoubleAnimation();
B3A.BeginTime = TimeSpan.FromSeconds(T * (2 / 1.5));
B3A.To = 1;
B3A.AutoReverse = true;
B3A.Duration = TimeSpan.FromSeconds(T/1.5);
BoxLiftAndMove.BeginAnimation(TranslateTransform3D.OffsetYProperty, B3A);
DoubleAnimation B4A = new DoubleAnimation();
B4A.BeginTime = TimeSpan.FromSeconds(T+T * (2 / 1.5));
B4A.To = 3.75 - Math.Sqrt((1.2 - BoxMove.OffsetZ)*(1.2 - BoxMove.OffsetZ) + BoxMove.OffsetX*BoxMove.OffsetX);//формула для перемещения коробки вдоль оси Z
B4A.Duration = TimeSpan.FromSeconds(T/4);
BoxLiftAndMove.BeginAnimation(TranslateTransform3D.OffsetZProperty, B4A);//Анимация подъема и перемещения коробки
DoubleAnimation B1A2 = new DoubleAnimation();
B1A2.BeginTime = TimeSpan.FromSeconds(T * (2 / 1.5));
B1A2.To = 180;
B1A2.Duration = TimeSpan.FromSeconds(T);
DoubleAnimation B2A2 = new DoubleAnimation();
B2A2.BeginTime = TimeSpan.FromSeconds(T + T/4 + T * (2 / 1.5));
B2A2.To = 0;
B2A2.Duration = TimeSpan.FromSeconds(T/4);
DoubleAnimation B3A2 = new DoubleAnimation();
B3A2.BeginTime = TimeSpan.FromSeconds(T * (2 / 1.5));
B3A2.To = 0;
B3A2.AutoReverse = true;
B3A2.Duration = TimeSpan.FromSeconds(T / 1.5);
DoubleAnimation B4A2 = new DoubleAnimation();
B4A2.BeginTime = TimeSpan.FromSeconds(T+T * (2 / 1.5));
B4A2.To = -0.5;
B4A2.Duration = TimeSpan.FromSeconds(T/4);
Тут больше: http://www.cyberforum.ru/wpf-silverlight/thread789214.html
Парниша делает робота на С#.
Govnocoder#0xFF,
21 Февраля 2013
-
+17
- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 10
- 11
- 12
- 13
class Test
{
public:
Test() : f(&Test::f0), f0(&Test::f1), f1( &Test::f2 ) {}
float ( Test::* const Test::* const Test::* const f)();
private:
float ( Test::* const Test::* const f0)();
float ( Test::* const f1)() ;
float f2() { return 0; }
};
Test t;
cout << (t.*(t.*(t.*(t.f))))();
LispGovno,
21 Февраля 2013
-
−110
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
case 3:
#if !SOME_SWITCH
vc = [AViewController new];
break;
case 4:
#endif
[[EGOCache currentCache] clearCache];
break;
За такое, по-хорошему, стоит руки отрывать, но я сильно торопился.
byss,
21 Февраля 2013
-
+142
- 1
- 2
if(!true) // это - не говнокод. это - заглушка.
return false;
Оправдывается ещё )
pitch,
21 Февраля 2013
-
+153
- 1
- 2
- 3
- 4
- 5
- 6
if($this->memberData['posts'] >= $this->settings['post_pm_number'] || $time_diff >= 86400*$this->settings['post_pm_days'] || in_array( $this->memberData['member_group_id'], $exludedgids)){
// action allowed
}else{
$this->registry->class_localization->loadLanguageFile( array( 'public_global' ), 'core' );
$this->registry->output->showError(sprintf($this->lang->words['post_pm_restriction'], $this->settings['post_pm_number'], $this->settings['post_pm_days']));
}
action allowed :)
CheshirskyCode,
21 Февраля 2013
-
−100
- 1
- 2
- 3
- 4
- 5
- 6
- 7
BOOL isMan = [[NSUserDefaults standardUserDefaults] boolForKey:POLM];
BOOL newSex = [[NSUserDefaults standardUserDefaults] boolForKey:SEX];
if (isMan != newSex) {
// Меняем пол
[[NSUserDefaults standardUserDefaults] setBool:newSex forKey:POLM];
[[NSUserDefaults standardUserDefaults] synchronize];
}
Операция по смене пола - это не так просто, как кажется
mas_an,
21 Февраля 2013
-
−107
- 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
- (void)viewDidLoad
{
[super viewDidLoad];
[self performSegueWithIdentifier:@"manWomanView" sender:self];
return;
//40 строк кода...
NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
// 5 строк формируем реквест
NSData *responseData = [NSURLConnection sendSynchronousRequest:theRequest returningResponse:nil error:&err];
if (!responseData) {
NSLog(@"Connection Error: %@", [err localizedDescription]);
}
NSString *responseString = [[NSString alloc] initWithData:responseData encoding:NSUTF8StringEncoding];
NSLog(@"Response: %@", responseString);
NSString *isSucces = [AYDataFetcher isSucces:responseString];
if ([isSucces isEqualToString:@"success"]) {
NSLog(@"Signup Succes");
// Проверяем и записываем оплату
NSNumber *isPlat = [AYDataFetcher isPlat:responseString];
//NSLog(@"%@", isPlat);
NSLog(@"%@", [isPlat boolValue]?@"Paid account":@"No paid account");
[[NSUserDefaults standardUserDefaults] setBool:[isPlat boolValue] forKey:PLAT];
[[NSUserDefaults standardUserDefaults] synchronize];
if(FALSE) // if([[MKStoreManager sharedManager] isSubscriptionActive:kMyFeatureIdentifier])
{
// 80 строк кода
} else {
if (FALSE) {
//50 строк кода......
Клиент обратился - Приложение сделано фрилансером по имени Андрей Андреев. При переходе с одного таба на другой приложение подвисало на 5-10 секунд. Смотрим код, радуемся - все запросы к апи шлются через NSURLConnection sendSynchronousRequest, в коде куча блоков вроде if(FALSE). И это уже в релизе.
mas_an,
21 Февраля 2013