Monday, May 5, 2014
Friday, March 28, 2014
Tuesday, December 17, 2013
Monday, December 16, 2013
SPOJ THINKBIT
Well, I always got "compilation error" or "wrong answer" in THIS.
Here are my solutions that works OK on my local machine but NOT on the SPOJ!
Whats wrong with SPOJ guys?
Here are my solutions that works OK on my local machine but NOT on the SPOJ!
return 2 | !(!(x >> 1)); // I like this one! // but they don't wanna bit shifts!
return 2 | !(!((x & 2) | (x & 4) | (x & 8) | (x & 16) | (x & 32) | (x & 64) | (x & 128) | (x & 256) | (x & 512) | (x & 1024) | (x & 2048) | (x & 4096))); // kinda idiotic, but works :)
return 2 | !(!(x & 1073741822)); // OK on 64-bit UNIX
return 2 | !(!(x & 65534)); // 32-bit? here it is...
return 2 | !(!(x & 4094)); // WTF?! this gives "wrong answer" on this f... SPOJ !
Whats wrong with SPOJ guys?
Friday, October 25, 2013
The Objective-C religion doesn't allow to insert Integers into NSDictionary
So...
// why they've done so with old good enums?
typedef NS_ENUM(NSUInteger, PaymentType) {
tCreditCard = 0,
tBankAccount = 1,
tBitcoin = 2
};
...
NSDictionary *payItem = [[NSDictionary alloc]
initWithObjectsAndKeys:[NSNumber numberWithInt:tCreditCard], @"type",
[self makeFakeCreditCardData], @"data", nil];
...
switch([[object valueForKey:@"type"] integerValue])
{
case tCreditCard:
// do something
break;
...
Labels:
anti-optimization,
anti-performance,
Objective-C
Thursday, October 17, 2013
Thank you very much!
Some editions of Windows 8 don’t support the free update to Windows 8.1. These include:
Windows 8 Enterprise
Windows 8 Enterprise
Tuesday, October 15, 2013
Linking Storyboards
Very "elegant" solution to resolve "We have one storyboard at all" iOS programmers group nightmare.
Yes, I'm making fun :)
Monday, October 7, 2013
Java versus Objective-C
Really good and helpful article: Java versus Objective-C.
Labels:
good parts of life,
Java,
Objective-C,
programming
Subscribe to:
Posts (Atom)