Skip to content

Instantly share code, notes, and snippets.

static WatchListServiceConnection *WLSCSharedInstance;
+ (WatchListServiceConnection*)sharedConnection {
@synchronized(self) {
if (WLSCSharedInstance == nil) {
// Even though assignment is already done in allocWithZone: (as it
// should be), assignment is done again here to make Clang SA happy
WLSCSharedInstance = [[WatchListServiceConnection alloc] init];
}
}
(gdb) po [priceArray objectAtIndex:3]
2.99
(gdb) po [appData watchPrice]
2.99
(gdb) print (float) [[priceArray objectAtIndex:3] floatValue]
$25 = 2.99000001
(gdb) print (float) [[appData watchPrice] floatValue]
$26 = 2.99000001
(gdb) print (BOOL) [(NSNumber*)[priceArray objectAtIndex:3] isEqual:(NSNumber*)[appData watchPrice]]
$28 = 0 '\000'
// Flowchat
WatchListServiceRequest *addReq = [[WatchListServiceRequest alloc] initWithRequestType:WatchListServiceRequestAddToList appIdentifier:@"317685067" watchPrice:[NSNumber numberWithFloat:2.99]];
[[WatchListServiceConnection sharedConnection] performServiceRequest:addReq delegate:nil];
[addReq release];
// Rolando 2
addReq = [[WatchListServiceRequest alloc] initWithRequestType:WatchListServiceRequestAddToList appIdentifier:@"321084051" watchPrice:[NSNumber numberWithFloat:0.00]];
[[WatchListServiceConnection sharedConnection] performServiceRequest:addReq delegate:nil];
[addReq release];
#ifdef DEBUG
#define debugLog(fmt, ...) NSLog(fmt, ##__VA_ARGS__)
#define debugLogPretty(fmt, ...) NSLog(@"%s (%@:%d)\n%@", \
__PRETTY_FUNCTION__, \
[[NSString stringWithUTF8String:__FILE__] lastPathComponent], \
__LINE__, \
[NSString stringWithFormat:(fmt), ##__VA_ARGS__])
#else
#define debugLog(fmt, ...)
#define debugLogPretty(fmt, ...)
2009-11-21 13:54:00.713 AppAdvice[6164:207] Loading HTML string: <html><body style='background-color: transparent; width: 300px; height: 500px'><div id='ContentDiv'>Content Here</div></body></html>
2009-11-21 13:54:00.772 AppAdvice[6164:207] document.body.offsetHeight/Width: {300, 500}
2009-11-21 13:54:00.772 AppAdvice[6164:207] document.getElementbyId('ContentDiv').offsetHeight/Width: {300, 20}
2009-11-21 13:54:00.772 AppAdvice[6164:207] sizeThatFits: {308, 516}
- (void)viewDidLoad {
[super viewDidLoad];
self.webView.backgroundColor = [UIColor clearColor];
NSString *documentsPath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *cssString = @"body { background-color: transparent; max-width: 320px; margin: 0; padding: 0; }";
[cssString writeToFile:[documentsPath stringByAppendingPathComponent:@"cache.css"] atomically:YES encoding:NSUTF8StringEncoding error:NULL];
NSString *youtubeLink = @"http://www.youtube.com/watch?v=nRwRfYDzeqg";
NSDictionary ("high hierarchy dictionary", represents all countries)
|
|--- NSDictionary ("subdictionaries", represents single country each)
|
|--- name, NSString
|--- currency, NSString
|--- population, NSNumber
|--- etc...
+ (AppDisplayView*)loadFromNib {
AppDisplayView *cell = nil;
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"AppDisplayView" owner:self options:nil];
for (id object in nibObjects) {
if ([object isKindOfClass:self]) {
cell = object;
}
}
return cell;
- (void)loadNibAndInitializeWithFrame:(CGRect)finalFrame {
NSArray *nibObjects = [[NSBundle mainBundle] loadNibNamed:@"AppDisplayView" owner:self options:nil];
UIView *containerView = [nibObjects lastObject];
NSArray *subviewsToAdd = [containerView subviews];
self.frame = containerView.frame;
for (UIView *view in subviewsToAdd) {
[self addSubview:view];
}
- (id) initWithBase64EncodedString:(NSString *) string {
NSMutableData *mutableData = nil;
if( string ) {
unsigned long ixtext = 0;
unsigned long lentext = 0;
unsigned char ch = 0;
unsigned char inbuf[3], outbuf[4];
short i = 0, ixinbuf = 0;
BOOL flignore = NO;