Re: Preferences caching?

2013-11-29 Thread Marcel Weiher
Hmm…I’ve had cases where the preferences were corrupted (presumably by Apple, I was only using the APIs) and prevented the app from launching. In terms of overall problems I think this was second to “I lost my license, can you help me”. Marcel On Nov 27, 2013, at 19:38 , Alex Kac wrote: > Wh

overlapping status bar

2013-11-29 Thread Gerriet M. Denkmann
On iPad 7.0.4: AViewController *a = ... BViewController *b = ... UISplitViewController *spv = [ [ UISplitViewController alloc ] init ]; spv.viewControllers = @[ a, b ]; spv.delegate = ...; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; self.window.rootViewController

MKMapView, screen grabs and other discussions

2013-11-29 Thread Graham Cox
Hi all, What I want to do is to use MapKit to get imagery of a particular region, display it as a layer in an app, and allow the user to trace over it. MapKit makes this hard, probably deliberately. First, MKMapView is the only object available for displaying the map - there is no lower-level

Re: MKMapView, screen grabs and other discussions

2013-11-29 Thread Roland King
Does MKMapSnapshotter do what you want? There's a bunch of stuff about maps in OSX in the WWDC 2013 videos, I think I remember seeing that there. On 29 Nov, 2013, at 9:14 pm, Graham Cox wrote: > Hi all, > > What I want to do is to use MapKit to get imagery of a particular region, > display i

Re: MKMapView, screen grabs and other discussions

2013-11-29 Thread Graham Cox
Aha! I hadn’t spotted that class. Looks very promising… I’ll check out the videos also. cheers, Graham On 29 Nov 2013, at 2:21 pm, Roland King wrote: > Does MKMapSnapshotter do what you want? There's a bunch of stuff about maps > in OSX in the WWDC 2013 videos, I think I remember seeing that

Re: MKMapView, screen grabs and other discussions

2013-11-29 Thread Graham Cox
Thanks again, works perfectly for my needs. I guess that its existence indicates that you can use it freely, so the legality question is moot. —Graham On 29 Nov 2013, at 3:21 pm, Graham Cox wrote: > Aha! I hadn’t spotted that class. Looks very promising… I’ll check out the > videos also.

Re: overlapping status bar

2013-11-29 Thread Kyle Sluder
> On Nov 29, 2013, at 1:18 AM, "Gerriet M. Denkmann" > wrote: > > The problem: the status bar is visible (as it should be) but it overlaps both > view a and b, which looks ugly. > Is there any way to tell these views to move down a little bit (using > autolayout)? UIViewController.topLayoutGu

Fast hash of NSData?

2013-11-29 Thread Graham Cox
Another general question. Does anyone have a quick-and-dirty (but functional) way to hash NSData? I’m currently using SHA-1 but it’s quite slow. All I need is a way to determine whether one block of data is identical to another or not - but every bit counts. It doesn’t need to be of crypto-stan

Re: Fast hash of NSData?

2013-11-29 Thread Robert Vojta
It's old, but try to start with these: https://code.google.com/p/xxhash/ Sent from my iPhone > On 29. 11. 2013, at 20:58, Graham Cox wrote: > > Another general question. > > Does anyone have a quick-and-dirty (but functional) way to hash NSData? I’m > currently using SHA-1 but it’s quite slo

Re: Fast hash of NSData?

2013-11-29 Thread Kyle Sluder
> On Nov 29, 2013, at 11:58 AM, Graham Cox wrote: > > Another general question. > > Does anyone have a quick-and-dirty (but functional) way to hash NSData? I’m > currently using SHA-1 but it’s quite slow. All I need is a way to determine > whether one block of data is identical to another or

Re: Fast hash of NSData?

2013-11-29 Thread Tito Ciuro
Hello, If memory serves well, CRC-32 is quite fast. How large are the BLOBs you're trying to compare? If they're not too large, the following may work for you: #include @implementation NSData (CRC32) - (uint32_t)CRC32 { uLong crc = crc32(0L, NULL, 0); crc = crc32(crc, [self bytes], [se

Re: Fast hash of NSData?

2013-11-29 Thread Graham Cox
On 29 Nov 2013, at 9:36 pm, Kyle Sluder wrote: > Often, it's better to improve the data structure before trying a different > hash function. It's much easier to reason about how to improve a solution in > terms of algorithm analysis of your data structure rather than it is to > perform an emp

Re: Fast hash of NSData?

2013-11-29 Thread Kyle Sluder
> On Nov 29, 2013, at 12:56 PM, Graham Cox wrote: > > The situation is, my app allows users to include images, which I’d like to > preserve in their original formats as far as possible. i.e. if they drag in a > JPEG, then I track the JPEG data and ultimately that gets embedded in my > file. If

Re: Fast hash of NSData?

2013-11-29 Thread Graham Cox
On 29 Nov 2013, at 10:49 pm, Kyle Sluder wrote: > In this scheme, if there is a hash collision, you lose user data. That should > be a non-starter. You *must* do a full bytewise comparison in case of > collision. I wouldn’t say a non-starter. In practice, the odds of this are exceedingly sm

Re: Fast hash of NSData?

2013-11-29 Thread Graham Cox
On 29 Nov 2013, at 11:19 pm, Graham Cox wrote: > Good idea, though ideally it would only compute the actual hash lazily if it > got as far as needing to (i.e. when the length matched). I’ll give it a go. Hmm, of course that can’t be worthwhile if it’s used as a dictionary key, as it will alw

Re: Fast hash of NSData?

2013-11-29 Thread Graham Cox
On 29 Nov 2013, at 11:19 pm, Graham Cox wrote: >> You also have another, damn-quick "hash key" that takes zero disk access to >> compute: -[NSData length]. > > Yep, that’s a great idea. OK, I’ve implemented this much as your suggestion, and I’m also saving the hash object along with the dat

Re: Fast hash of NSData?

2013-11-29 Thread Kyle Sluder
> On Nov 29, 2013, at 3:35 PM, Graham Cox wrote: > > > On 29 Nov 2013, at 11:19 pm, Graham Cox wrote: > >>> You also have another, damn-quick "hash key" that takes zero disk access to >>> compute: -[NSData length]. >> >> Yep, that’s a great idea. > > > OK, I’ve implemented this much as yo

Re: Fast hash of NSData?

2013-11-29 Thread Kyle Sluder
> On Nov 29, 2013, at 2:19 PM, Graham Cox wrote: > > >> On 29 Nov 2013, at 10:49 pm, Kyle Sluder wrote: >> >> In this scheme, if there is a hash collision, you lose user data. That >> should be a non-starter. You *must* do a full bytewise comparison in case of >> collision. > > I wouldn’t

Re: Fast hash of NSData?

2013-11-29 Thread Scott Ribe
On Nov 29, 2013, at 12:58 PM, Graham Cox wrote: > Another general question. > > Does anyone have a quick-and-dirty (but functional) way to hash NSData? I’m > currently using SHA-1 but it’s quite slow. All I need is a way to determine > whether one block of data is identical to another or not -

Re: Fast hash of NSData?

2013-11-29 Thread Scott Ribe
On Nov 29, 2013, at 2:49 PM, Kyle Sluder wrote: > In this scheme, if there is a hash collision, you lose user data. That should > be a non-starter. You *must* do a full bytewise comparison in case of > collision. a 1 in 2^64, or 2^128, or 2^256 chance, so no, it is just fine. __

Re: Fast hash of NSData?

2013-11-29 Thread Jens Alfke
On Nov 29, 2013, at 6:26 PM, Scott Ribe wrote: > I recently (last week, no kidding) investigated this question, and went with > murmur hash. Murmur is an excellent 32-bit hash function, but it’s not suitable for Graham’s use case where a collision would result in data loss. >> In this schem

Can't add bar button items to nav bar

2013-11-29 Thread Rick Mann
I have an iPad storyboard with a straightforward uinavcontroller and uitableviewcontroller. I'm trying to drag a UIBarButtonItem to the nav bar, but it keeps creating a toolbar at the bottom and putting it there. iOS 7 view. If I drag it to the navigation item in the outline view, it adds it to

SOLVED. Can't add bar button items to nav bar

2013-11-29 Thread Rick Mann
Ugh, nevermind. Quitting and re-launching Xcode fixed it. I have an iPad storyboard with a straightforward uinavcontroller and uitableviewcontroller. I'm trying to drag a UIBarButtonItem to the nav bar, but it keeps creating a toolbar at the bottom and putting it there. iOS 7 view. If I dra

Re: Preferences caching?

2013-11-29 Thread Jerry Krinock
A quick lesson in avoiding “corrupt preferences” bugs… CODE: NSUserDefaults* ud = [NSUserDefaults standardUserDefaults] ; NSLog(@"safely: %@", [ud stringForKey:@“myDataObject"]) ; NSLog(@"unsafe: %@", [[ud objectForKey:@"myDataObject"] stringValue]) ; CONSOLE OUTPUT: safely: (null) -[__NSCFData

Re: Fast hash of NSData?

2013-11-29 Thread Gary L. Wade
If it is possible to compare the attributes of your file besides length, such as modified date, created date, inode, etc., then you might be able to further catch the cases where the length is the same but the data changed is large enough that you would rather delay any full-file access whether

Re: Fast hash of NSData?

2013-11-29 Thread Scott Ribe
On Nov 29, 2013, at 7:40 PM, Jens Alfke wrote: > Murmur is an excellent 32-bit hash function, but it’s not suitable for > Graham’s use case where a collision would result in data loss. FYI, murmur has continued to evolve, with some tweaks both for performance and for better distribution, *and*

Re: overlapping status bar

2013-11-29 Thread Gerriet M. Denkmann
On 30 Nov 2013, at 00:42, Kyle Sluder wrote: >> On Nov 29, 2013, at 1:18 AM, "Gerriet M. Denkmann" >> wrote: >> >> The problem: the status bar is visible (as it should be) but it overlaps >> both view a and b, which looks ugly. >> Is there any way to tell these views to move down a little bi

Re: overlapping status bar

2013-11-29 Thread Gerriet M. Denkmann
On 30 Nov 2013, at 00:42, Kyle Sluder wrote: >> On Nov 29, 2013, at 1:18 AM, "Gerriet M. Denkmann" >> wrote: >> >> The problem: the status bar is visible (as it should be) but it overlaps >> both view a and b, which looks ugly. >> Is there any way to tell these views to move down a little bi