Crossdomain image loading hack

So about that little crossdomain image loading hack.

on the INIT event of your loader do the following:

var lInfo:LoaderInfo = e.target as LoaderInfo;
var dO:DisplayObject;
try{
dO = lInfo.content as DisplayObject;
} catch(err:SecurityError){
var spt:Sprite = new Sprite();
spt.addChild(lInfo.loader);
dO = spt;
}

Courtesy of @michaelSvendsen

Finding http-links in NSString

Had some problem with long http links in a UIWebView so I created this simple function that finds links existing in a NSString and creates an a-tag with a “Read more” label. Suited my needs for the moment.

- (NSString *)parseLinks:(NSString *)html { NSScanner *theScanner; NSString *text = nil; theScanner = [NSScanner scannerWithString:html]; while ([theScanner isAtEnd] == NO) { // find start of tag [theScanner scanUpToString:@"http" intoString:NULL] ; // find end of tags [theScanner scanUpToString:@"<" intoString:&text] ; html = [html stringByReplacingOccurrencesOfString: [NSString stringWithFormat:@"%@", text] withString:[NSString stringWithFormat:@"Read more", text]]; break; } return html; }

NSUserDefaults

Want to store light information such as user defaults, current highscore fast and easy? Just use NSUserDefault.

Example: Adding the current highscore:
[[NSUserDefaults standardUserDefaults] setInteger:scoreValue forKey:@"score"];

Example: Get the current highscore
[[NSUserDefaults standardUserDefaults] integerForKey:@"score"]];

Except primitives it works for NSData, NSString, NSNumber, NSDate, NSArray and NSDictionary

Trying it

Trying out tumblr. Thinking this going to some sort of a iphone dev diary for me. Peace

Crossdomain image loading hack

So about that little crossdomain image loading hack.

on the INIT event of your loader do the following:

var lInfo:LoaderInfo = e.target as LoaderInfo;
var dO:DisplayObject;
try{
dO = lInfo.content as DisplayObject;
} catch(err:SecurityError){
var spt:Sprite = new Sprite();
spt.addChild(lInfo.loader);
dO = spt;
}

Courtesy of @michaelSvendsen

Finding http-links in NSString

Had some problem with long http links in a UIWebView so I created this simple function that finds links existing in a NSString and creates an a-tag with a “Read more” label. Suited my needs for the moment.

- (NSString *)parseLinks:(NSString *)html { NSScanner *theScanner; NSString *text = nil; theScanner = [NSScanner scannerWithString:html]; while ([theScanner isAtEnd] == NO) { // find start of tag [theScanner scanUpToString:@"http" intoString:NULL] ; // find end of tags [theScanner scanUpToString:@"<" intoString:&text] ; html = [html stringByReplacingOccurrencesOfString: [NSString stringWithFormat:@"%@", text] withString:[NSString stringWithFormat:@"Read more", text]]; break; } return html; }

NSUserDefaults

Want to store light information such as user defaults, current highscore fast and easy? Just use NSUserDefault.

Example: Adding the current highscore:
[[NSUserDefaults standardUserDefaults] setInteger:scoreValue forKey:@"score"];

Example: Get the current highscore
[[NSUserDefaults standardUserDefaults] integerForKey:@"score"]];

Except primitives it works for NSData, NSString, NSNumber, NSDate, NSArray and NSDictionary

Trying it

Trying out tumblr. Thinking this going to some sort of a iphone dev diary for me. Peace

Twitter dev gems of September 2010
Crossdomain image loading hack
Finding http-links in NSString
NSUserDefaults
Trying it

About:

Following: