<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>James Border</title>
	<atom:link href="http://jamesborder.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://jamesborder.com</link>
	<description>Interactive/Mobile/iOS Developer</description>
	<lastBuildDate>Tue, 01 May 2012 21:31:23 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.2</generator>
		<item>
		<title>Objective-C simple rotate</title>
		<link>http://jamesborder.com/2012/02/objective-c-simple-rotate/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-simple-rotate/#comments</comments>
		<pubDate>Tue, 14 Feb 2012 16:16:32 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=1006</guid>
		<description><![CDATA[#define degreesToRadians(x) (M_PI * x / 180.0) [UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationCurveEaseOut animations:^{ object.transform = CGAffineTransformRotate(object.transform, degreesToRadians(90)); } completion:nil ]; See https://github.com/jimsblogfiles/RotateSomething for project &#038; files]]></description>
			<content:encoded><![CDATA[<p>#define degreesToRadians(x) (M_PI * x / 180.0)</p>
<p>[UIView animateWithDuration:0.25 delay:0.0 options:UIViewAnimationCurveEaseOut<br />
				 animations:^{<br />
					 object.transform = CGAffineTransformRotate(object.transform, degreesToRadians(90));<br />
				 }	completion:nil<br />
 ];</p>
<p>See <a href="https://github.com/jimsblogfiles/RotateSomething" target="_blank">https://github.com/jimsblogfiles/RotateSomething</a> for project &#038; files</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-simple-rotate/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C remove nonalphanumeric chars</title>
		<link>http://jamesborder.com/2012/02/objective-c-remove-nonalphanumeric-chars/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-remove-nonalphanumeric-chars/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 04:28:56 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=1002</guid>
		<description><![CDATA[NSString *dirtyString = @&#8221;I just want text @#$!&#8221;; NSCharacterSet *nonAlphaNumericSet = [[ NSCharacterSet alphanumericCharacterSet ] invertedSet ]; NSString *cleanString = [[ dirtyString componentsSeparatedByCharactersInSet:nonAlphaNumericSet ] componentsJoinedByString:@&#8221;" ]; NSLog(@&#8221;>%@&#8221;, cleanString); 2012-02-12 22:29:24.645 Untitled 2[9145:707] >Ijustwanttext]]></description>
			<content:encoded><![CDATA[<p>		NSString *dirtyString = @&#8221;I just want text @#$!&#8221;;<br />
		NSCharacterSet *nonAlphaNumericSet = [[ NSCharacterSet alphanumericCharacterSet ] invertedSet ];</p>
<p>		NSString *cleanString = [[ dirtyString componentsSeparatedByCharactersInSet:nonAlphaNumericSet ] componentsJoinedByString:@&#8221;" ];</p>
<p>		NSLog(@&#8221;>%@&#8221;, cleanString);</p>
<p>2012-02-12 22:29:24.645 Untitled 2[9145:707] >Ijustwanttext</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-remove-nonalphanumeric-chars/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C NSNotificationCenter passing object</title>
		<link>http://jamesborder.com/2012/02/objective-c-nsnotificationcenter-passing-object/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-nsnotificationcenter-passing-object/#comments</comments>
		<pubDate>Mon, 13 Feb 2012 04:19:15 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=998</guid>
		<description><![CDATA[//viewdidload or similar [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateRequest:) name:@&#8221;myObject&#8221; object:nil]; //////////////////////////////////////////////////// ////////// FROM A BUTTON //button action or similar -(IBAction)doSomething:(id)sender { [[NSNotificationCenter defaultCenter] postNotificationName:@&#8221;myObject&#8221; object:sender]; } //handler -(void)handleUpdateRequest:(NSNotification *)notif { NSLog(@&#8221;>>>%i&#8221;,[notif.object tag]); } OR //////////////////////////////////////////////////// ////////// TABLE CELL -(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { NSNumber *indexPath_row = [[NSNumber alloc] initWithInt:indexPath.row]; [[NSNotificationCenter defaultCenter] postNotificationName:@&#8221;myObject&#8221; object:indexPath_row]; } //handler -(void)handleUpdateRequest:(NSNotification <a href='http://jamesborder.com/2012/02/objective-c-nsnotificationcenter-passing-object/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>//viewdidload or similar<br />
	[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(handleUpdateRequest:) name:@&#8221;myObject&#8221; object:nil];</p>
<p>////////////////////////////////////////////////////<br />
////////// FROM A BUTTON</p>
<p>//button action or similar<br />
-(IBAction)doSomething:(id)sender {</p>
<p>	[[NSNotificationCenter defaultCenter] postNotificationName:@&#8221;myObject&#8221; object:sender];</p>
<p>}</p>
<p>//handler<br />
-(void)handleUpdateRequest:(NSNotification *)notif {</p>
<p>	NSLog(@&#8221;>>>%i&#8221;,[notif.object tag]);</p>
<p>}</p>
<p>OR</p>
<p>////////////////////////////////////////////////////<br />
////////// TABLE CELL</p>
<p>-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {</p>
<p>	NSNumber *indexPath_row = [[NSNumber alloc] initWithInt:indexPath.row];<br />
    [[NSNotificationCenter defaultCenter] postNotificationName:@&#8221;myObject&#8221; object:indexPath_row];</p>
<p>}</p>
<p>//handler<br />
-(void)handleUpdateRequest:(NSNotification *)notif {</p>
<p>	NSLog(@&#8221;>>>%i&#8221;,[notif.object intValue]);</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-nsnotificationcenter-passing-object/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C PNG Sequence</title>
		<link>http://jamesborder.com/2012/02/objective-c-png-sequence/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-png-sequence/#comments</comments>
		<pubDate>Fri, 03 Feb 2012 03:17:49 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=994</guid>
		<description><![CDATA[NSMutableArray *imageArray = [[NSMutableArray alloc]init]; for (int i = 1; iy]]></description>
			<content:encoded><![CDATA[<p>	NSMutableArray *imageArray = [[NSMutableArray alloc]init];</p>
<p>	for (int i = 1; iy <= 40; i++) {<br />
		[imageArray addObject:[UIImage imageNamed:[NSString stringWithFormat:@"s%02i.png", i]]];<br />
	}</p>
<p>	UIImageView * ryuJump = [[[UIImageView alloc] initWithFrame:<br />
							 CGRectMake(0, 0, [UIScreen mainScreen].bounds.size.width, [UIScreen mainScreen].bounds.size.height)]autorelease];<br />
	ryuJump.animationImages = imageArray;<br />
	ryuJump.animationDuration = 2.1;<br />
	ryuJump.contentMode = UIViewContentModeCenter;</p>
<p>	[someview addSubview:ryuJump];</p>
<p>	[ryuJump startAnimating];<br />
	[imageArray release];</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-png-sequence/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C urlencode/urldecode</title>
		<link>http://jamesborder.com/2012/02/objective-c-urlencodeurldecode/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-urlencodeurldecode/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 19:03:47 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=991</guid>
		<description><![CDATA[-(NSString*)urlEncoded:(NSString*)str { NSString *escapedUrlString = [str stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; return escapedUrlString; } -(NSString*)urlDecoded:(NSString*)str { NSString *cleanUrlString = [str stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding]; return cleanUrlString; } NSString *devStr = @&#8221;http://localhost/dri/json?foo=#bar&#038;something=true&#038;miscc=Foo bar!&#8221;; NSLog(@&#8221;devStr: %@&#8221;,devStr); NSString *encString = [self urlEncoded:devStr]; NSLog(@&#8221;encString: %@&#8221;,encString); NSString *decString = [self urlDecoded:encString]; NSLog(@&#8221;decString: %@&#8221;,decString);]]></description>
			<content:encoded><![CDATA[<p>-(NSString*)urlEncoded:(NSString*)str {</p>
<p>    NSString *escapedUrlString = [str stringByAddingPercentEscapesUsingEncoding:NSASCIIStringEncoding];<br />
    return escapedUrlString;</p>
<p>}</p>
<p>-(NSString*)urlDecoded:(NSString*)str {</p>
<p>    NSString *cleanUrlString =  [str stringByReplacingPercentEscapesUsingEncoding:NSASCIIStringEncoding];<br />
    return cleanUrlString;</p>
<p>}</p>
<p>    NSString *devStr = @&#8221;http://localhost/dri/json?foo=#bar&#038;something=true&#038;miscc=Foo bar!&#8221;;</p>
<p>    NSLog(@&#8221;devStr: %@&#8221;,devStr);</p>
<p>    NSString *encString = [self urlEncoded:devStr];<br />
    NSLog(@&#8221;encString: %@&#8221;,encString);</p>
<p>    NSString *decString = [self urlDecoded:encString];<br />
    NSLog(@&#8221;decString: %@&#8221;,decString);</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-urlencodeurldecode/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C UIImage -&gt; UIImageView</title>
		<link>http://jamesborder.com/2012/02/objective-c-uiimage-uiimageview/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-uiimage-uiimageview/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 05:27:07 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=988</guid>
		<description><![CDATA[UIImage *image = [UIImage imageNamed:@"greatimage.png"]; UIImageView *imgView = [[UIImageView alloc] initWithImage:image]; imgView.frame = CGRectMake(0, 0, 320, 90); [self.view addSubview:imgView]; [imgView release];]]></description>
			<content:encoded><![CDATA[<p>	UIImage *image = [UIImage imageNamed:@"greatimage.png"];<br />
	UIImageView *imgView = [[UIImageView alloc] initWithImage:image];<br />
	imgView.frame = CGRectMake(0, 0, 320, 90);<br />
	[self.view addSubview:imgView];<br />
	[imgView release];</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-uiimage-uiimageview/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C UIButton</title>
		<link>http://jamesborder.com/2012/02/objective-c-uibutton/</link>
		<comments>http://jamesborder.com/2012/02/objective-c-uibutton/#comments</comments>
		<pubDate>Wed, 01 Feb 2012 05:16:48 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=984</guid>
		<description><![CDATA[// a button UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect]; [button addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchDown]; [button setTitle:@"Show View" forState:UIControlStateNormal]; button.frame = CGRectMake(0.0, 0.0, 160.0, 40.0); [self.view addSubview:button]; //////////////////////////////////////// // Button with background images //////////////////////////////////////// UIButton *bttn = [UIButton buttonWithType:UIButtonTypeCustom]; bttn.frame = CGRectMake(0, 200, 97, 38); [bttn setTitle:@"Dev One" forState:UIControlStateNormal]; [bttn addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchUpInside]; UIImage *bttnImageNormal = [UIImage imageNamed:@"button.png"]; <a href='http://jamesborder.com/2012/02/objective-c-uibutton/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>// a button<br />
UIButton *button = [UIButton buttonWithType:UIButtonTypeRoundedRect];<br />
[button addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchDown];<br />
[button setTitle:@"Show View" forState:UIControlStateNormal];<br />
button.frame = CGRectMake(0.0, 0.0, 160.0, 40.0);<br />
[self.view addSubview:button];</p>
<p>////////////////////////////////////////<br />
// Button with background images<br />
////////////////////////////////////////</p>
<p>UIButton *bttn = [UIButton buttonWithType:UIButtonTypeCustom];<br />
bttn.frame = CGRectMake(0, 200, 97, 38);<br />
[bttn setTitle:@"Dev One" forState:UIControlStateNormal];<br />
[bttn addTarget:self action:@selector(targetMethod:) forControlEvents:UIControlEventTouchUpInside];</p>
<p>UIImage *bttnImageNormal = [UIImage imageNamed:@"button.png"];<br />
[bttn setImage:bttnImageNormal forState:UIControlStateNormal];</p>
<p>UIImage *bttnImageSelected = [UIImage imageNamed:@"button-selected.png"];<br />
[bttn setImage:bttnImageSelected forState:UIControlStateHighlighted];</p>
<p>[self.view addSubview:bttn];</p>
<p>-(IBAction)targetMethod:(id)sender {</p>
<p>	NSLog(@&#8221;targetMethod&#8221;);</p>
<p>}</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/02/objective-c-uibutton/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-c NSLog alternatives</title>
		<link>http://jamesborder.com/2012/01/objective-c-nslog-alternatives/</link>
		<comments>http://jamesborder.com/2012/01/objective-c-nslog-alternatives/#comments</comments>
		<pubDate>Fri, 13 Jan 2012 20:30:57 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=1013</guid>
		<description><![CDATA[#define DEBUGGING #ifdef DEBUGGING # define LogBasic(fmt,&#8230;) fprintf(stderr,&#8221; :: %s\n&#8221;, [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); #else # define LogBasic(&#8230;) #endif #ifdef DEBUGGING # define LogFunc(fmt,&#8230;) fprintf(stderr,&#8221;%s :: Line %d >> %s\n&#8221;, __PRETTY_FUNCTION__, __LINE__, [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]); #else # define LogFunc(&#8230;) #endif #ifdef DEBUGGING # define LogAlert(fmt, &#8230;) { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n <a href='http://jamesborder.com/2012/01/objective-c-nslog-alternatives/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>#define DEBUGGING</p>
<p>#ifdef DEBUGGING<br />
#	define LogBasic(fmt,&#8230;) fprintf(stderr,&#8221; :: %s\n&#8221;, [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]);<br />
#else<br />
#   define LogBasic(&#8230;)<br />
#endif</p>
<p>#ifdef DEBUGGING<br />
#	define LogFunc(fmt,&#8230;) fprintf(stderr,&#8221;%s :: Line %d >> %s\n&#8221;, __PRETTY_FUNCTION__, __LINE__, [[NSString stringWithFormat:fmt, ##__VA_ARGS__] UTF8String]);<br />
#else<br />
#   define LogFunc(&#8230;)<br />
#endif</p>
<p>#ifdef DEBUGGING<br />
#   define LogAlert(fmt, &#8230;)  { UIAlertView *alert = [[UIAlertView alloc] initWithTitle:[NSString stringWithFormat:@"%s\n [Line %d] &#8220;, __PRETTY_FUNCTION__, __LINE__] message:[NSString stringWithFormat:fmt, ##__VA_ARGS__]  delegate:nil cancelButtonTitle:@&#8221;Ok&#8221; otherButtonTitles:nil]; [alert show]; }<br />
#else<br />
#   define LogAlert(&#8230;)<br />
#endif</p>
<p>
See <a href="https://github.com/jimsblogfiles/PrefixDefaultStuff">https://github.com/jimsblogfiles/PrefixDefaultStuff</a> for project &#038; files.</p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/01/objective-c-nslog-alternatives/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Objective-C Remote Plist -&gt; Dictionary -&gt; NSUserDefaults</title>
		<link>http://jamesborder.com/2012/01/objective-c-remote-plist-dictionary-nsuserdefaults/</link>
		<comments>http://jamesborder.com/2012/01/objective-c-remote-plist-dictionary-nsuserdefaults/#comments</comments>
		<pubDate>Tue, 10 Jan 2012 20:10:19 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Objective-C]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=974</guid>
		<description><![CDATA[#import &#60;Foundation/Foundation.h> @interface RemotePreferences : NSObject { NSMutableData *incomingData; } @end @implementation RemotePreferences -(id)init { self = [super init]; if (self) { NSURL *url = [NSURL URLWithString: @"http://example.com/configs.plist"]; NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30.0]; __unused NSURLConnection *fetchConn = [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease]; } return self; } - (void)connection:(NSURLConnection *)sender didReceiveData:(NSData *)data { if <a href='http://jamesborder.com/2012/01/objective-c-remote-plist-dictionary-nsuserdefaults/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p><code>#import &lt;Foundation/Foundation.h></p>
<p>@interface RemotePreferences : NSObject {<br />
	NSMutableData *incomingData;<br />
}</p>
<p>@end</p>
<p>@implementation RemotePreferences</p>
<p>-(id)init {</p>
<p>    self = [super init];</p>
<p>    if (self) {</p>
<p>		NSURL *url = [NSURL URLWithString: @"http://example.com/configs.plist"];<br />
		NSURLRequest *request = [NSURLRequest requestWithURL:url cachePolicy:NSURLRequestReloadIgnoringLocalCacheData timeoutInterval:30.0];<br />
		__unused NSURLConnection *fetchConn = [[[NSURLConnection alloc] initWithRequest:request delegate:self] autorelease];</p>
<p>    }</p>
<p>    return self;	</p>
<p>}</p>
<p>- (void)connection:(NSURLConnection *)sender didReceiveData:(NSData *)data {</p>
<p>	if (!incomingData) {<br />
		incomingData = [[NSMutableData alloc] init];<br />
	}</p>
<p>	[incomingData appendData:data];</p>
<p>}</p>
<p>- (void)connectionDidFinishLoading:(NSURLConnection *)sender {</p>
<p>	NSDictionary *prefsDict = [[[NSDictionary alloc] init] autorelease];<br />
	prefsDict = [NSPropertyListSerialization propertyListFromData:incomingData mutabilityOption:NSPropertyListImmutable format:nil errorDescription:nil];</p>
<p>	[[NSUserDefaults standardUserDefaults] registerDefaults:prefsDict];</p>
<p>	// NSLog(@"NSUserDefaults dump: %@", [[NSUserDefaults standardUserDefaults] dictionaryRepresentation]);</p>
<p>}</p>
<p>- (void)connection:(NSURLConnection *)sender didFailWithError:(NSError *)error {<br />
	NSLog(@"connection failed: %@", [error localizedDescription]);<br />
}</p>
<p>-(void)dealloc {<br />
	FuncLog();</p>
<p>    [super dealloc];</p>
<p>	[incomingData release];<br />
	incomingData = nil;</p>
<p>}</p>
<p>//- (NSURLRequest *)connection:(NSURLConnection *)c willSendRequest:(NSURLRequest *)req redirectResponse:(NSURLResponse *)res {}<br />
//- (void)connection:(NSURLConnection *)sender didReceiveAuthenticationChallenge:(NSURLAuthenticationChallenge *)ch {}<br />
//- (NSCachedURLResponse *)connection:(NSURLConnection *)sender willCacheResponse:(NSCachedURLResponse *)cachedResponse{}</p>
<p>@end<br />
</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2012/01/objective-c-remote-plist-dictionary-nsuserdefaults/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AS3 &#8211; Convert seconds to ww:dd:hh:mm:ss</title>
		<link>http://jamesborder.com/2011/12/as3-convert-seconds-to-wwddhhmmss/</link>
		<comments>http://jamesborder.com/2011/12/as3-convert-seconds-to-wwddhhmmss/#comments</comments>
		<pubDate>Thu, 29 Dec 2011 16:45:57 +0000</pubDate>
		<dc:creator>me</dc:creator>
				<category><![CDATA[Actionscript]]></category>

		<guid isPermaLink="false">http://jamesborder.com/?p=970</guid>
		<description><![CDATA[Credit where credit is due, originally found here: http://www.rblab.com/blog/2009/07/as3-snippet-convert-seconds-to-wwddhhmmss/ function convertTime(number:Number):String { number = Math.abs(number); var values:Array = new Array(5); values[0] = Math.floor(number / 86400 / 7);// weeks values[1] = Math.floor(number / 86400 % 7);// days values[2] = Math.floor(number / 3600 % 24);// hours values[3] = Math.floor(number / 60 % 60);// mins values[4] = Math.floor(number <a href='http://jamesborder.com/2011/12/as3-convert-seconds-to-wwddhhmmss/'>[...]</a>]]></description>
			<content:encoded><![CDATA[<p>Credit where credit is due, originally found here:<br />
<a href="http://www.rblab.com/blog/2009/07/as3-snippet-convert-seconds-to-wwddhhmmss/">http://www.rblab.com/blog/2009/07/as3-snippet-convert-seconds-to-wwddhhmmss/</a></p>
<p><code>function convertTime(number:Number):String<br />
{<br />
    number = Math.abs(number);<br />
    var values:Array = new Array(5);<br />
    values[0] = Math.floor(number / 86400 / 7);// weeks<br />
    values[1] = Math.floor(number / 86400 % 7);// days<br />
    values[2] = Math.floor(number / 3600 % 24);// hours<br />
    values[3] = Math.floor(number / 60 % 60);// mins<br />
    values[4] = Math.floor(number % 60);// secs</p>
<p>    var stopage:Boolean = false;<br />
    var cutIndex:Number = -1;</p>
<p>    for (var i:Number = 0; i < values.length; i++)<br />
    {<br />
        if (values[i] < 10)<br />
        {<br />
            values[i] = "0" + values[i];<br />
        }<br />
        if (values[i] == "00" &#038;&#038; i < (values.length - 2) &#038;&#038; !stopage)<br />
        {<br />
            cutIndex = i;<br />
        }<br />
        else<br />
        {<br />
            stopage = true;<br />
        }<br />
    }<br />
    values.splice(0, cutIndex + 1);</p>
<p>    return values.join(":");<br />
}</code></p>
]]></content:encoded>
			<wfw:commentRss>http://jamesborder.com/2011/12/as3-convert-seconds-to-wwddhhmmss/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

