tag:blogger.com,1999:blog-2177473232402653333.comments2023-09-20T08:59:25.895-07:00David Golightly - PatternsDavid Golightlyhttp://www.blogger.com/profile/15826032679447528405noreply@blogger.comBlogger39125tag:blogger.com,1999:blog-2177473232402653333.post-55897121442518430282010-03-18T02:06:46.306-07:002010-03-18T02:06:46.306-07:00@pufpuf
Thanks very much for sharing your impleme...@pufpuf<br /><br />Thanks very much for sharing your implementation. It's really helped me out a lot in terms of my project and learning more.dubhttps://www.blogger.com/profile/15210884246509271906noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-66750046411338644942010-03-17T03:00:19.306-07:002010-03-17T03:00:19.306-07:00Here is another implementation of this technic: ht...Here is another implementation of this technic: http://github.com/rs/SDWebImage, with the advantage to provide an UIImageView category for seamless integration in your code.Olivier Poitreyhttps://www.blogger.com/profile/03327952979365797254noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-85794738341023191942010-03-16T09:12:36.709-07:002010-03-16T09:12:36.709-07:00Hi,
I downloaded the example from solo purely bec...Hi,<br /><br />I downloaded the example from solo purely because there was the fixes and an example. However the example implementation is for a tableview cell.<br /><br />Could any body offer an implentation for using just a UIImageView?dubhttps://www.blogger.com/profile/15210884246509271906noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-87311790526120086062010-03-07T18:51:01.980-08:002010-03-07T18:51:01.980-08:00Hi David...
What is it the license of this class?...Hi David...<br /><br />What is it the license of this class? Could I use this in my commercial app?<br /><br />ThanksUnknownhttps://www.blogger.com/profile/00149308437620509269noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-8051585736066149682010-03-06T14:12:23.924-08:002010-03-06T14:12:23.924-08:00Should you have the new line removal before removi...Should you have the new line removal before removing comments, or does this code handle multiple line comments?Samer Ziadehhttps://www.blogger.com/profile/10396335413969420484noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-46496150797616709942010-02-28T04:23:26.036-08:002010-02-28T04:23:26.036-08:00This comment has been removed by a blog administrator.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-47417494529980186442010-02-27T19:41:34.742-08:002010-02-27T19:41:34.742-08:00Thanks so much for this! I've extened it a li...Thanks so much for this! I've extened it a little bit, to avoid filename conflicts by md5suming the url.<br /><br /><br />see http://pastebin.ca/1815226Unknownhttps://www.blogger.com/profile/02340814857571061171noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-28184976434175594292010-02-20T09:20:13.832-08:002010-02-20T09:20:13.832-08:00If I scroll fast it crashes?
2010-02-20 11:19:25....If I scroll fast it crashes?<br /><br />2010-02-20 11:19:25.732 MusicPix[2855:5d0b] *** -[NSURLRequest _CFURLRequest]: message sent to deallocated instance 0x45a21e0Jameshttps://www.blogger.com/profile/14321014011439044154noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-12882005696500439712010-02-02T19:59:35.255-08:002010-02-02T19:59:35.255-08:00This comment has been removed by a blog administrator.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-27071369192624037682010-01-24T11:27:49.870-08:002010-01-24T11:27:49.870-08:00There's one more item that needs addressing : ...There's one more item that needs addressing : there can only be one client request active at a time. It's up to the client to wait until the previous request is complete before invoking <b>addClientToDownloadQueue</b> again. For a subclass of UIViewController something like this:<br /><br /><br />- (void)fetchRemoteImage:(NSString *)imageName {<br /> <br /> if ( self.ur != nil ) {<br /> return; // can handle one and only one request at a time<br /> }<br /> <br /> UIActivityIndicatorView *av = [[UIActivityIndicatorView alloc] initWithActivityIndicatorStyle:UIActivityIndicatorViewStyleGray];<br /> av.frame = CGRectMake( 10, 10, 20, 20 );<br /> [self.view addSubview:av];<br /> [av startAnimating];<br /> [self.view setNeedsDisplay];<br /> <br /> self.ur = [NSURLRequest requestWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"http://.../%@", imageName]]<br /> cachePolicy:NSURLRequestUseProtocolCachePolicy<br /> timeoutInterval:kCachedImageLoaderRequestTimeout<br /> ];<br /> [[CachedImageLoader sharedImageLoader] addClientToDownloadQueue:self];<br /> <br />}<br /><br />- (void)renderImage:(UIImage *)image {<br /> <br /> if ( [[self.view subviews] count] >=1 ) {<br /> [ [ [self.view subviews] objectAtIndex:0] removeFromSuperview]; // remove UIActivityIndicator<br /> }<br /> ((UIImageView *)self.view).image = image;<br /> [self.view setNeedsDisplay];<br /> self.ur = nil;<br /> <br />}Unknownhttps://www.blogger.com/profile/01105042204559618178noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-82356638127389666342010-01-20T12:02:34.196-08:002010-01-20T12:02:34.196-08:00Hi David;
You can pick up my mods plus another bu...Hi David;<br /><br />You can pick up my mods plus another bug fix plus example at http://www.lehigh.edu/~sol0/cache2.tar.gz - thanks again for the code,<br /><br />SteveUnknownhttps://www.blogger.com/profile/01105042204559618178noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-69857135865949468022010-01-19T11:58:42.904-08:002010-01-19T11:58:42.904-08:00There's also a spurious autorelease that will ...There's also a spurious autorelease that will crash the code if the NSURLRequest timesout:<br /><br /> //[error autorelease];<br /><br />To test, when invoking <b>addClientToDownloadQueue</b> create the <b>NSURLRequest</b> via <b>requestWithURL:cachePolicy:timeoutInterval</b> and use a small timeout value like 0.01.<br /><br />The code now seems, well, really solid ... I'll hand you back my modified version of cache.tar files later tonight, hopefully. I took the liberty of changing the protocol name to <i>CachedImageConsumer</i>, but then again that was *only* for my benefit only. Maybe it should be <i>CachedImageLoaderConsumer</i>, I don't know.<br /><br />To summarize, the code seems to work well with these mods:<br /><br />1) create cache folder if non-existant<br />2) check local cache folder first<br />3) prevent double <b>free</b><br /><br />Thanks again, this is a wonderful example of how to cache net images locally in an iPhone app that persist over app restarts, and without blocking the GUI.<br /><br />More testing is required to check for edge cases like case overflow, etc,but so far I'm very pleased.Unknownhttps://www.blogger.com/profile/01105042204559618178noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-6123563536861364512010-01-19T10:46:52.630-08:002010-01-19T10:46:52.630-08:00macario, have you made any progress here? I'd...macario, have you made any progress here? I'd love to see this get off the ground, though I don't have time to contribute myself right now (currently in the studio recording an album with my band) - but it seems one of the main benefits of client/server architecture is going unused in SC - namely, that the server should be independent from client implementation as long as the protocol is implemented correctly.David Golightlyhttps://www.blogger.com/profile/15826032679447528405noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-64605011929909517792010-01-19T10:43:21.563-08:002010-01-19T10:43:21.563-08:00Thanks for the comments, guys. Crake, your proble...Thanks for the comments, guys. Crake, your problem is probably fixed by creating the cache directory using the example code given by goranche. sol0, thanks for the feedback. I've updated the code with some of your suggestions.David Golightlyhttps://www.blogger.com/profile/15826032679447528405noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-30991517050245143162010-01-17T17:02:24.905-08:002010-01-17T17:02:24.905-08:00Hi;
First, these comments are very nice, as is th...Hi;<br /><br />First, these comments are very nice, as is the code. As others have noted there is an issue with the initial creation of the cache folder. What's not been noted is that the code on the web page does not match the code in the tar file. In particular, the tar code never calls cachedImageForClient:, so even if/when an image is cached it's never retrieved from cache on subsequent calls.<br /><br />So closely examine addClientToDownloadQueue: and add the if clause so that the disc cache is checked.Unknownhttps://www.blogger.com/profile/01105042204559618178noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-34851575485222517072009-12-16T19:52:03.198-08:002009-12-16T19:52:03.198-08:00Nice post!!!
I'm trying to use your classes, ...Nice post!!!<br /><br />I'm trying to use your classes, so far I got the images downloaded and displayed.<br /><br />But I'm getting an error with DiskCache:<br /><br />"ERROR: Could not create file at path: ..."<br /><br />Am I missing something?<br /><br />Thnkx a lotUnknownhttps://www.blogger.com/profile/01917587725805525511noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-16367821370024727362009-11-29T13:08:50.005-08:002009-11-29T13:08:50.005-08:00ok, maybe I wrote too soon... :)
I changed the &qu...ok, maybe I wrote too soon... :)<br />I changed the "- (NSString *)cacheDir" method, hope it helps someone ;)<br /><br />- (NSString *)cacheDir {<br />if (_cacheDir == nil)<br />{<br /> NSArray *paths = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES);<br /> _cacheDir = [[NSString alloc] initWithString:[[paths objectAtIndex:0] stringByAppendingPathComponent:@"URLCache"]];<br />}<br /><br />/* check for existence of cache directory */<br />if ([[NSFileManager defaultManager] fileExistsAtPath:_cacheDir]) {<br /> return _cacheDir;<br />}<br /><br />/* create a new cache directory */<br />if (![[NSFileManager defaultManager] createDirectoryAtPath:_cacheDir <br /> withIntermediateDirectories:NO<br /> attributes:nil <br /> error:nil]) {<br /> NSLog(@"Error creating cache directory");<br />}<br />return _cacheDir;<br />}Unknownhttps://www.blogger.com/profile/06405529385129202626noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-4605663083310962572009-11-29T12:12:36.098-08:002009-11-29T12:12:36.098-08:00first, thanks for this code and article, it helped...first, thanks for this code and article, it helped me both in solving an actual problem as well as gave me much insight into stuff... :)<br /><br />anyway, I did notice (of course, I might be wrong), that the code does not create the cache directory, so if it doesn't exist, no caching...<br /><br />I'm not (yet) experienced enough to claim I can do this elegantly (or "the right" way), so I hope it will be added, so I can learn even more ;)Unknownhttps://www.blogger.com/profile/06405529385129202626noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-36696713920988322009-11-26T13:48:35.832-08:002009-11-26T13:48:35.832-08:00I've updated the post with a link to the sourc...I've updated the post with a link to the source files.David Golightlyhttps://www.blogger.com/profile/15826032679447528405noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-72566644140985958332009-11-26T13:39:14.913-08:002009-11-26T13:39:14.913-08:00Thanks marzagao, I hadn't seen that library. ...Thanks marzagao, I hadn't seen that library. Will give it a go.David Golightlyhttps://www.blogger.com/profile/15826032679447528405noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-91167761989198052212009-09-08T01:44:15.777-07:002009-09-08T01:44:15.777-07:00Hi David,
thanks for the post.
It seems one of the...Hi David,<br />thanks for the post.<br />It seems one of the cleaner examples I've seen so far on the topic.<br /><br />Could it be possible for you to share the code?<br /><br />It would be very helpful for a lot of people.<br /><br />Cheers,<br />AntonioAntonio Virzìhttps://www.blogger.com/profile/13783510608111438455noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-85874456422127172512009-08-11T08:25:03.601-07:002009-08-11T08:25:03.601-07:00David, are you willing to share the complete sourc...David, are you willing to share the complete source for this pattern?Jasonhttps://www.blogger.com/profile/01286360223097937173noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-45191983355812017102009-07-21T15:14:48.855-07:002009-07-21T15:14:48.855-07:00Interesting blog, but this post is rather pointles...Interesting blog, but this post is rather pointless without actual code.Unknownhttps://www.blogger.com/profile/07413320294119262599noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-55943786932692771362009-07-19T13:43:03.545-07:002009-07-19T13:43:03.545-07:00Hi, I've been working for a while in SuperColl...Hi, I've been working for a while in SuperCollider client in Ruby. <br />Is incredible how similar Ruby and SCLang (the supercollider interpreted language) are but I like Ruby syntax better and I think is denser (you can do more in less lines) plus you have access to many Ruby libraries (OpenGL for instance).<br /><br />My SuperCollider client is incomplete, not yet packed in a gem (for easy instalation, I will do this very soon) and poorly documented in comparission to SuperCollider built in documentation but is functional for doing sound synthesis, I've been using it in a Sound Synthesis workshop I am ito.<br /><br />The way you build a synthesizer is very similar to SCLang.<br /><br />Is hosted @ http://github.com/maca/scrubyAnonymoushttps://www.blogger.com/profile/17343324843060786594noreply@blogger.comtag:blogger.com,1999:blog-2177473232402653333.post-23538789053239970212009-07-10T03:27:14.498-07:002009-07-10T03:27:14.498-07:00Hi
Could you mail me at lohigorry@gmail.com an e...Hi<br /><br /><br />Could you mail me at lohigorry@gmail.com an example with all the code in order to understand well your code ?<br /><br />Thanks a lotUnknownhttps://www.blogger.com/profile/05863942669398712952noreply@blogger.com