My App refuses to rotate

2013-05-28 Thread Gerriet M. Denkmann
I have an iOS 6.1 app. Info.plist contains: UIInterfaceOrientation UIInterfaceOrientationPortrait UISupportedInterfaceOrientations UIInterfaceOrientationLandscapeRight UIInterfaceOrientationLandscapeLeft UIInterface

Re: NSMapTable with C strings as keys

2013-05-28 Thread Jean-Daniel Dupas
Le 28 mai 2013 à 08:25, Oleg Krupnov a écrit : > Hi Jens, > > I guess you may be right. But… two questions in this regard: > > 1. I thought that "isEqual" method is alternative to "hash" method, > because searching by key and searching by hash are two mutually > exclusive methods of looking up

Re: My App refuses to rotate

2013-05-28 Thread David Duncan
Did you set the window's rootViewController to your view controller? On May 28, 2013, at 12:01 AM, Gerriet M. Denkmann wrote: > I have an iOS 6.1 app. > > Info.plist contains: > UIInterfaceOrientation > UIInterfaceOrientationPortrait > > UISupportedInterfaceOrientations >

Re: My App refuses to rotate

2013-05-28 Thread Andreas Liebschner
On Tue, May 28, 2013 at 9:01 AM, Gerriet M. Denkmann wrote: > But in the iPhone simulator and in the iPhone device the rootViewController > always has interfaceOrientation = 1 (Portrait). > All other ViewControllers also show interfaceOrientation = 1 (Portrait). Any chance that what you are refe

Re: My App refuses to rotate

2013-05-28 Thread Gerriet M. Denkmann
On 28 May 2013, at 14:03, David Duncan wrote: > Did you set the window's rootViewController to your view controller? In WordsViewController (subclass of UIViewController) I added: UIView *view = ss.view; UIWindow *window = view.window; UIViewController *rootViewControll

Re: My App refuses to rotate

2013-05-28 Thread Gerriet M. Denkmann
On 28 May 2013, at 14:14, Andreas Liebschner wrote: > On Tue, May 28, 2013 at 9:01 AM, Gerriet M. Denkmann > wrote: > >> But in the iPhone simulator and in the iPhone device the rootViewController >> always has interfaceOrientation = 1 (Portrait). >> All other ViewControllers also show interfa

Re: NSMapTable with C strings as keys

2013-05-28 Thread Oleg Krupnov
I just made the following experiment: I specified a hash method for my NSMapTable, but it always returns 0. This seems to force the NSMapGet to always use key comparison for searching for elements, as hash is always "not unique". Is this a good idea? Let me think. The keys are quite short string

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On May 28, 2013, at 7:15 AM, Quincey Morris wrote: > In the broadest MVC terms, the "C" is often a NSWindowController subclass. > The "M" is often the app delegate *or* a NSDocument subclass, or is a more > specialized object graph to which the app delegate or document holds a > reference. The

Re: Show / hide application menu / icon in dock / windows cycling / ...

2013-05-28 Thread Robert Vojta
Ken, thanks for the reply. Prohibited is no way. Maybe you know how to solve following problem and there will be no need for switching activation policy or creating another helper. 1. App creates new Wizard NSWindow 2. Window is visible, user did go through several steps and now I do ask ACAcco

Re: Show / hide application menu / icon in dock / windows cycling / ...

2013-05-28 Thread Ken Thomases
On May 28, 2013, at 6:20 AM, Robert Vojta wrote: > Maybe you know how to solve following problem and there will be no need for > switching activation policy or creating another helper. > > 1. App creates new Wizard NSWindow > 2. Window is visible, user did go through several steps and now I do a

Re: Show / hide application menu / icon in dock / windows cycling / ...

2013-05-28 Thread Robert Vojta
On Tuesday, 28. May 2013 at 13:31, Ken Thomases wrote: > Can't you just activate your app (if it's been deactivated) and order your > window to the front when the ACAccountStore request completes? Ouch, stupid me, yes, does work ;-) Thanks. ___ Coco

What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
Though it's clearly defined in the docs when to use NSMubleAnything vs. NSAnything (insert Array, Dictionary, String, etc for Anything), there is no compiler warning when you perform a simple action such as allocate a string and then reassign values to it. With this in mind, what exactly consti

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Roland King
On 28 May, 2013, at 9:39 PM, Alex Zavatone wrote: > Though it's clearly defined in the docs when to use NSMubleAnything vs. > NSAnything (insert Array, Dictionary, String, etc for Anything), there is no > compiler warning when you perform a simple action such as allocate a string > and then r

rate limiting calls

2013-05-28 Thread Torsten Curdt
I am getting a lot of calls to a selector "setValue:" from a slider control - but setting this value takes an considerable amount of time. In order to keep the UI responsive I need to rate limit the actual calls or move the value setting into an async background queue. While the queue sounds like

Re: rate limiting calls

2013-05-28 Thread Igor Elland
Hi, Quick question: how often are you calling setValue:? Every time it changes or is it inside an NSTimer/CADisplayLink? Can you give us more information on this particular flow? Cheers, Igor Ranieri On May 28, 2013, at 4:28 PM, Torsten Curdt wrote: > I am getting a lot of calls to a selector

Re: rate limiting calls

2013-05-28 Thread Torsten Curdt
> Quick question: how often are you calling setValue:? Every time it changes > or is it inside an NSTimer/CADisplayLink? Every time the user moves the slider. > Can you give us more information on this particular flow? If I execute the "setValue:" on each value change of the slider the UI feels

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
On May 28, 2013, at 9:50 AM, Roland King wrote: > > On 28 May, 2013, at 9:39 PM, Alex Zavatone wrote: > >> Though it's clearly defined in the docs when to use NSMubleAnything vs. >> NSAnything (insert Array, Dictionary, String, etc for Anything), there is no >> compiler warning when you perf

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Steve Mills
On May 28, 2013, at 08:39:21, Alex Zavatone wrote: > Though it's clearly defined in the docs when to use NSMubleAnything vs. > NSAnything (insert Array, Dictionary, String, etc for Anything), there is no > compiler warning when you perform a simple action such as allocate a string > and then r

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Alex Zavatone
On May 28, 2013, at 9:46 AM, Steve Mills wrote: > On May 28, 2013, at 08:39:21, Alex Zavatone wrote: > >> Though it's clearly defined in the docs when to use NSMubleAnything vs. >> NSAnything (insert Array, Dictionary, String, etc for Anything), there is no >> compiler warning when you perfor

Re: rate limiting calls

2013-05-28 Thread John Pannell
Hi Torsten- You might consider something like the coalescing described in this blog entry: http://www.takingnotes.co/blog/2013/01/03/coalescing/ In short, you'd be using performSelector:withObject:afterDelay: to make the desired method call, and cancelPreviousPerformRequestsWithTarget:selector

Re: NSMapTable with C strings as keys

2013-05-28 Thread Kyle Sluder
On May 28, 2013, at 12:38 AM, Oleg Krupnov wrote: > I just made the following experiment: > > I specified a hash method for my NSMapTable, but it always returns 0. > This seems to force the NSMapGet to always use key comparison for > searching for elements, as hash is always "not unique". > > I

Re: rate limiting calls

2013-05-28 Thread Scott Ribe
On May 28, 2013, at 8:41 AM, Torsten Curdt wrote: > Any easier or more elegant way you could think of? Well, if you don't want to deal with a queue and background thread, use NSTimer. In setValue, cancel the timer if it exists, then create a new one scheduled to run .someting seconds. If a time

Re: rate limiting calls

2013-05-28 Thread Torsten Curdt
Hey John, thanks for the pointer. I used a similar pattern before but at that time it was just a selector without parameter. AFAIU cancelPreviousPerformRequestsWithTarget:selector:object will match the object parameter to see what to cancel. (and nil is not a match-all). Since here the parameter i

Re: rate limiting calls

2013-05-28 Thread Steve Mills
On May 28, 2013, at 10:16:07, Scott Ribe wrote: > On May 28, 2013, at 8:41 AM, Torsten Curdt wrote: > >> Any easier or more elegant way you could think of? > > Well, if you don't want to deal with a queue and background thread, use > NSTimer. In setValue, cancel the timer if it exists, then cr

Re: rate limiting calls

2013-05-28 Thread Torsten Curdt
kSliderDelay = 0.0 > -(void)setValue:(NSObject*)value > { > self.value = value; > > [NSObject > cancelPreviousPerformRequestsWithTarget:self > selector:@selector(updateValue) > object:ni

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Thomas Wetmore
Alex, What your three lines of code do: > NSString *myString; Compiler allocates space for a pointer on the run time stack. > myString = @"Hi"; Compiler creates an NSString object somewhere in the heap with the value @"Hi" and points the pointer to it. > myString = @"Hi there"; Compiler cre

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Thomas Wetmore
Alex, Forget what I said about memory management. It is wrong. Your confusion probably stems from the fact that the pointer named myString is allowed to point to any number of string during the execution of your program. It is the objects that are immutable, not the pointers to them. Tom Wetmo

Re: rate limiting calls

2013-05-28 Thread Torsten Curdt
> Hm - this does not seem to work and I cannot see why not. > > The cancel and perform selector calls are being called but updateValue > is only performed when I release the slider handle. > I don't quite get why. Would still be eager to know why but a GCD implementation was super simple and works

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread YT
In the latest set of responses to my query "Building an MVC based App for Mac OS X - NOT iOS" The question of - am I building a "Document Based App"? After reading the Apple Document "Designing a Document-Based Application" I can say NO, I don't believe I am building a Document Based App. I

Re: rate limiting calls

2013-05-28 Thread Scott Ribe
On May 28, 2013, at 10:03 AM, Torsten Curdt wrote: > The cancel and perform selector calls are being called but updateValue > is only performed when I release the slider handle. > I don't quite get why. Oh, because those post into the event loop, and during slider manipulation I bet the event lo

Re: rate limiting calls

2013-05-28 Thread Kyle Sluder
On May 28, 2013, at 9:03 AM, Torsten Curdt wrote: > > The cancel and perform selector calls are being called but updateValue > is only performed when I release the slider handle. > I don't quite get why. Well, aside from using performSelector:@selector(updateValue:) when the method is actually

Re: rate limiting calls

2013-05-28 Thread Dave Fernandes
I use the GCD serial queue approach. On each update from the slider, cancel all operations in the queue and then add a new operation with the latest slider value. However, the NSOperation subclass should NOT check whether it is cancelled once it starts executing. That way, once it starts, it is

Re: rate limiting calls

2013-05-28 Thread Kyle Sluder
On May 28, 2013, at 10:12 AM, Dave Fernandes wrote: > I use the GCD serial queue approach. On each update from the slider, cancel > all operations in the queue and then add a new operation with the latest > slider value. However, the NSOperation subclass should NOT check whether it > is cancel

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Quincey Morris
On May 28, 2013, at 10:01 , YT wrote: > I did run a test and created a NEW Project and checked the box "Create a > Document-based App" > AND no Controller files (.h,.m) were automatically generated. Actually, two controllers *were* generated: 1. The app delegate. This object has the role of a

Re: rate limiting calls

2013-05-28 Thread Seth Willits
A while ago I was fiddling with various APIs to do rate limited calls. This is the simplest one. Morph it as you please. Maybe it'll be useful to someone. @interface GCDCoalescent : NSObject - (void)dispatchOn:(dispatch_queue_t)queue after:(double)seconds block:(dispatch_block_t)block; @end

Re: rate limiting calls

2013-05-28 Thread Dave Fernandes
Er, that would be NSOperationQueue. Haven't had my coffee yet today. On 2013-05-28, at 1:17 PM, Kyle Sluder wrote: > On May 28, 2013, at 10:12 AM, Dave Fernandes > wrote: > >> I use the GCD serial queue approach. On each update from the slider, cancel >> all operations in the queue and then

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Lee Ann Rucker
On May 28, 2013, at 7:44 AM, Alex Zavatone wrote: > > On May 28, 2013, at 9:46 AM, Steve Mills wrote: > >> On May 28, 2013, at 08:39:21, Alex Zavatone wrote: >> >>> Though it's clearly defined in the docs when to use NSMubleAnything vs. >>> NSAnything (insert Array, Dictionary, String, etc f

Re: NSMapTable with C strings as keys

2013-05-28 Thread Oleg Krupnov
> If you're going to do that, why bother with an NSMapTable at all? Just store > your pointers in a C array. The string pointers can be different, but they can contain identical string keys, resulting in identical values. I wanted to find values by in a more efficient way than dumb array iteratio

NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?

2013-05-28 Thread Paul Johnson
I have a slider, a stepper, and a textField that are synchronized using bindings. I didn't write any code to do this, just used Xcode with its Interface Builder. When the program starts I don't see the slider set to the "Current" position I'd like and the textField doesn't show the "Current" value

Re: NSSlider, NSStepper, and NSTextfield with Bindings: how to display initial value?

2013-05-28 Thread Quincey Morris
On May 28, 2013, at 13:16 , Paul Johnson wrote: > I have a slider, a stepper, and a textField that are synchronized using > bindings. I didn't write any code to do this, just used Xcode with its > Interface Builder. When the program starts I don't see the slider set to > the "Current" position I'

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Jens Alfke
On May 28, 2013, at 6:39 AM, Alex Zavatone wrote: > NSString *myString; You’ve declared myString as a _mutable_ pointer to an _immutable_ object. If you had declared it as NSString* const myString = @“Hi"; then the variable itself would be immutable, and the compiler would give you a

Re: NSMapTable with C strings as keys

2013-05-28 Thread Jens Alfke
On May 27, 2013, at 11:42 PM, Michael Crawford wrote: > For purposes of looking up strings in a hash table, a 32 bit CRC > (Cyclic Redundancy Check) would be quick to calculate with few > collisions. It also doesn't require multiprecision arithmetic. CRC is primarily a checksum, not a hash fun

NSMatrix used as menu item's view appears wrong

2013-05-28 Thread Steve Mills
I have a popup whose menu contains 1 item that uses a view, followed by a bunch of hidden menu items. The first time I pop up the menu, it looks correct. Every time after that, the view is scrolled way off the top with only a tiny bit still visible. Screenshots at: https://www.dropbox.com/s/ggz

Nib image caching

2013-05-28 Thread James West
Does anyone know if nibs cache images or not inside of UIImageView? In code, one would use - (UIImage *)imageNamed for a cached image, and - (UIImage *)imageWithContentsOfFile to pull directly from disk. But I'd like to learn how UIKit unarchives them from nibs. Cheers, -- James West j...@

Re: NSMapTable with C strings as keys

2013-05-28 Thread Michael Hall
On May 28, 2013, at 4:10 PM, Jens Alfke wrote: > CRC is primarily a checksum, not a hash function. It's good for verifying > data integrity, e.g. in a network protocol or file format, but more expensive > than you’d like for a hash table. There are much faster hash functions: > Wikipedia has a

Re: NSMapTable with C strings as keys

2013-05-28 Thread Michael Hall
On May 28, 2013, at 5:27 PM, Michael Hall wrote: > I thought I saw SHA-1 being used as a general purpose hash function somewhere > sort of surprising recently but I'm not remembering exactly where. Ah, sorry to reply to my own but maybe this was it… https://news.ycombinator.com/item?id=4036878

Re: Nib image caching

2013-05-28 Thread Nick Zitzmann
On May 28, 2013, at 4:25 PM, James West wrote: > Does anyone know if nibs cache images or not inside of UIImageView? They don't. IIRC early versions of OS X allowed this, but it was taken out pretty quickly. Nick Zitzmann

Re: NSMapTable with C strings as keys

2013-05-28 Thread Graham Cox
On 28/05/2013, at 3:46 PM, Oleg Krupnov wrote: > I'd like to have a dictionary using C strings as keys (because I > already have const char* strings and would like to spare on creating > NSString wrappers) For the sake of avoiding something you *assume* to be slow, or inefficient, you've take

Re: NSMapTable with C strings as keys

2013-05-28 Thread Jens Alfke
On May 28, 2013, at 3:39 PM, Michael Hall wrote: > https://news.ycombinator.com/item?id=4036878 > SHA-1is still used in applications such as git as a general purpose hash > function. > Not this particular article where I saw it but I recently signed up on git > and think I may of seen it's use

Re: NSMapTable with C strings as keys

2013-05-28 Thread Greg Parker
On May 28, 2013, at 3:39 PM, Michael Hall wrote: > On May 28, 2013, at 5:27 PM, Michael Hall wrote: >> I thought I saw SHA-1 being used as a general purpose hash function >> somewhere sort of surprising recently but I'm not remembering exactly where. > > Ah, sorry to reply to my own but maybe th

Re: NSMatrix used as menu item's view appears wrong

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 23:50, Steve Mills wrote: > I have a popup whose menu contains 1 item that uses a view, followed by a > bunch of hidden menu items. The first time I pop up the menu, it looks > correct. Every time after that, the view is scrolled way off the top with > only a tiny bit still vi

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:01, YT wrote: > I did run a test and created a NEW Project and checked the box "Create a > Document-based App" > AND no Controller files (.h,.m) were automatically generated. "Controller" is a pattern, not a class name. When you create a document-based app, it creates a

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:01, YT wrote: > You have to disconnect the Auto generated Delegate from the Outlets > Connection in the File's Owner Object in the IB Doc > Please correct me if I am wrong about this point. > > All of you discuss the utilities of the following Controllers. > NSWindowContro

Re: Building an MVC based App for Mac OS X - NOT for iOS

2013-05-28 Thread Uli Kusterer
On 28.05.2013, at 19:28, Quincey Morris wrote: > Similarly, a MVC "view" is not necessarily a view. Rather, it's a component > of your app design that interacts with the user. It may be implemented as a > window, or as a view, or as a window with a hierarchy of views, or something > more compl

Re: NSMatrix used as menu item's view appears wrong

2013-05-28 Thread Steve Mills
On May 28, 2013, at 18:08:55, Uli Kusterer wrote: > My guess is this is what's happening in your case: It "selects" an item > number beyond your NSMatrix, and scrolls it into view, thus scrolling your > matrix off-screen. Could that be it? I admit I would expect a little > "continuation" arrow

Core Data never seems to be able to auto-update schema

2013-05-28 Thread Rick Mann
In the past, Core Data was able to deal with a simple addition of a property to an Entity. Now, every time I add a property, I get "Can't find model for source store" errors during auto update. I'm using the following options when creating the persistent store coordinator: NSDictionary*

Re: Core Data never seems to be able to auto-update schema

2013-05-28 Thread Dave Fernandes
Forgive the basic question, but do you still have the old version of the model present in your versioned model? On 2013-05-28, at 10:18 PM, Rick Mann wrote: > In the past, Core Data was able to deal with a simple addition of a property > to an Entity. Now, every time I add a property, I get "C

Re: Core Data never seems to be able to auto-update schema

2013-05-28 Thread Rick Mann
On May 28, 2013, at 20:50 , Dave Fernandes wrote: > Forgive the basic question, but do you still have the old version of the > model present in your versioned model? That's an excellent question, and no, I don't. But I still thought I've successfully added properties without actually making d

Re: Core Data never seems to be able to auto-update schema

2013-05-28 Thread Dave Fernandes
I think I have gotten away with that for development purposes in the past, but that isn't the way it is supposed to work. And things have definitely been tightened up as Core Data has evolved. If you want to open old persistent stores, you will need to have a copy of the model that goes with it.

Re: NSMapTable with C strings as keys

2013-05-28 Thread Oleg Krupnov
> Why not just create NSString wrappers? By using the > -initWithBytesNoCopy:length:encoding:freeWhenDone: method you can avoid it > copying the actual C string characters, it literally just becomes a thin > wrapper. In my case it's more about extra calls than extra memory but thanks! Didn't k

Re: Core Data never seems to be able to auto-update schema

2013-05-28 Thread Rick Mann
Pity Xcode doesn't automatically make a copy of the model when you make a change (after each build). Thanks. On May 28, 2013, at 21:14 , Dave Fernandes wrote: > I think I have gotten away with that for development purposes in the past, > but that isn't the way it is supposed to work. And thin

Re: What, exactly constitutes a mutable action on an instance?

2013-05-28 Thread Diederik Meijer | Ten Horses
May I add two questions to this enlightening thread? 1. With ARC, do we still have to worry about string1 leaking in the following scenario? @property (nonatomic, copy) NSString *string1; ….. self.string1 = @"Hello"; string1 = @"Hello hello"; string1 = @"Hello hello hello"; 2. How do the stron