"Computed segue" in iOS?

2015-09-04 Thread Carl Hoefs
iOS 8.4.1

I need to segue from a UITableView to different view controllers depending 
which element in the table is touched (some elements are videos that need to be 
displayed/edited, some are data files that need to be graphed, etc.).

Is it possible to have a "computed segue" in iOS such that I can segue 
intelligently to the appropriate view controller based on some criteria? Or 
must I use a "stopgap" view controller invoked by the UITableView that will do 
the content analysis and then perform a segue to the appropriate view 
controller?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: "Computed segue" in iOS?

2015-09-07 Thread Carl Hoefs

> On Sep 6, 2015, at 10:27 AM, Mike Abdullah  wrote:
> 
> Ideally, you use different cells for the different data elements, and wire 
> them up to the appropriate segue, letting the system take care of most of it 
> for you.

This is for situations when one is not using a prototype cell in the 
UITableView? 
> 
> If you need something more complex, it’s time to trigger the segues 
> programatically. You can wire up multiple segues from your source View 
> Controller to other VCs.

I wish I knew how! IB allows me to wire up only a single segue from my source 
VC (with the UITableView) to another VC.
> 
> Probably simples from there is to implement the UITableViewDelegate method 
> which tells you a cell was selected and trigger the segue from it.

I understand this to require an additional (modal) storyboard segue + 
identifier to be defined in IB.

> But an alternative can be to wire up a single segue from the cell itself, and 
> override -shouldPerformSegueWithIdentifier: to return NO and trigger a 
> different segue instead.

This would work if I could wire up multiple segues from a single VC, each with 
an identifier. Then I could call -performSegueWithIdentifier: directly. But I'm 
not seeing how to define the additional segue + identifier in IB.

Thx,
-Carl

> 
>> On 5 Sep 2015, at 01:03, Carl Hoefs  wrote:
>> 
>> iOS 8.4.1
>> 
>> I need to segue from a UITableView to different view controllers depending 
>> which element in the table is touched (some elements are videos that need to 
>> be displayed/edited, some are data files that need to be graphed, etc.).
>> 
>> Is it possible to have a "computed segue" in iOS such that I can segue 
>> intelligently to the appropriate view controller based on some criteria? Or 
>> must I use a "stopgap" view controller invoked by the UITableView that will 
>> do the content analysis and then perform a segue to the appropriate view 
>> controller?
>> 
>> -Carl
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/mabdullah%40karelia.com
>> 
>> This email sent to mabdul...@karelia.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

iOS: clearing the keyboard word suggestion bar

2015-10-21 Thread Carl Hoefs
iOS 8.4

I'm using a UITextField with "secure text entry" enabled for a password field. 
This works well, but when subsequent text fields bring up the keyboard, guess 
what shows up by default in the word suggestion bar atop the keyboard. That's 
right - the password in clear text!

This sounds like a bug, and maybe it's fixed in iOS 9, but is there a way to 
clear the suggestion bar?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Multiple simultaneous UIAlertControllers

2015-11-05 Thread Carl Hoefs
iOS 9.1, iPhone 5S, ObjC

I'm getting the following runtime warning due to multiple simultaneous 
UIAlertControllers presenting at the same time:

Warning: Attempt to present  on 
 which is already presenting 

I know only one alert view controller can be presenting at a time, so the way I 
thought to serialize execution of each -presentViewController:: is:

dispatch_async( dispatch_get_main_queue(), ^{
[ self presentViewController: alert 
animated: YES 
  completion: nil ];
});

Why isn't dispatch_get_main_queue() enforcing serialized execution? Is there 
another way to do this?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Multiple simultaneous UIAlertControllers

2015-11-05 Thread Carl Hoefs
I don't want more than 1 alert presented at a time, of course, but they get 
generated asynchronously. I thought dispatch_get_main_queue() would nicely 
serialize any that occur. Thus David's comment that I'm just getting the 
requests issued in a serialized fashion. 

I'm not certain how to have alerts that are scattered all throughout the app to 
wait until some other alert's completion block executes. Are you saying to have 
it control a global flag or some such?
-Carl

> On Nov 5, 2015, at 3:53 PM, Eric E Dolecki  wrote:
> 
> That's the way. You should never need more than one presented at a time. 
> 
> Sent from my iP6+
> 
>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński  wrote:
>> 
>> You should present next UIAlertController when first one has been dismissed 
>> (when UIAlertAction handler is called).
>> 
>> Tomek
>> 
>>> Wiadomość napisana przez Carl Hoefs  w dniu 
>>> 05.11.2015, o godz. 23:37:
>>> 
>>> iOS 9.1, iPhone 5S, ObjC
>>> 
>>> I'm getting the following runtime warning due to multiple simultaneous 
>>> UIAlertControllers presenting at the same time:
>>> 
>>> Warning: Attempt to present  on 
>>>  which is already presenting 
>>> 
>>> 
>>> I know only one alert view controller can be presenting at a time, so the 
>>> way I thought to serialize execution of each -presentViewController:: is:
>>> 
>>>  dispatch_async( dispatch_get_main_queue(), ^{
>>>  [ self presentViewController: alert 
>>>  animated: YES 
>>>completion: nil ];
>>>  });
>>> 
>>> Why isn't dispatch_get_main_queue() enforcing serialized execution? Is 
>>> there another way to do this?
>>> -Carl
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/thom%40union.waw.pl
>>> 
>>> This email sent to t...@union.waw.pl
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>> 
>> This email sent to edole...@gmail.com
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Multiple simultaneous UIAlertControllers

2015-11-05 Thread Carl Hoefs
A queue of what? I would think that if only a single alert view can be
presented at a time, then iOS would serialize them and present them when
earlier ones complete. Is there no system-level solution to this?
-Carl


> Make a queue.
>
> Sent from my iPhone
>
>> On Nov 5, 2015, at 6:10 PM, Carl Hoefs 
>> wrote:
>>
>> I don't want more than 1 alert presented at a time, of course, but they
>> get generated asynchronously. I thought dispatch_get_main_queue() would
>> nicely serialize any that occur. Thus David's comment that I'm just
>> getting the requests issued in a serialized fashion.
>>
>> I'm not certain how to have alerts that are scattered all throughout the
>> app to wait until some other alert's completion block executes. Are you
>> saying to have it control a global flag or some such?
>> -Carl
>>
>>> On Nov 5, 2015, at 3:53 PM, Eric E Dolecki  wrote:
>>>
>>> That's the way. You should never need more than one presented at a
>>> time.
>>>
>>> Sent from my iP6+
>>>
>>>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński 
>>>> wrote:
>>>>
>>>> You should present next UIAlertController when first one has been
>>>> dismissed (when UIAlertAction handler is called).
>>>>
>>>> Tomek
>>>>
>>>>> Wiadomość napisana przez Carl Hoefs
>>>>>  w dniu 05.11.2015, o godz. 23:37:
>>>>>
>>>>> iOS 9.1, iPhone 5S, ObjC
>>>>>
>>>>> I'm getting the following runtime warning due to multiple
>>>>> simultaneous UIAlertControllers presenting at the same time:
>>>>>
>>>>> Warning: Attempt to present  on
>>>>>  which is already presenting
>>>>> 
>>>>>
>>>>> I know only one alert view controller can be presenting at a time, so
>>>>> the way I thought to serialize execution of each
>>>>> -presentViewController:: is:
>>>>>
>>>>> dispatch_async( dispatch_get_main_queue(), ^{
>>>>> [ self presentViewController: alert
>>>>> animated: YES
>>>>>   completion: nil ];
>>>>> });
>>>>>
>>>>> Why isn't dispatch_get_main_queue() enforcing serialized execution?
>>>>> Is there another way to do this?
>>>>> -Carl
>>>>>
>>>>>
>>>>> ___
>>>>>
>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>>>
>>>>> Please do not post admin requests or moderator comments to the list.
>>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>>
>>>>> Help/Unsubscribe/Update your Subscription:
>>>>> https://lists.apple.com/mailman/options/cocoa-dev/thom%40union.waw.pl
>>>>>
>>>>> This email sent to t...@union.waw.pl
>>>>
>>>>
>>>> ___
>>>>
>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>>
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
>>>>
>>>> This email sent to edole...@gmail.com
>>>
>>> ___
>>>
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>
>>> Help/Unsubscribe/Update your Subscription:
>>> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
>>>
>>> This email sent to newsli...@autonomy.caltech.edu
>>
>>
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/zav%40mac.com
>>
>> This email sent to z...@mac.com
>


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Multiple simultaneous UIAlertControllers

2015-11-05 Thread Carl Hoefs
Thanks for the tip, I'll look into it.

(As a general thought, though, it would appear that UIAlertController
should be a singleton app-wide, and it should manage its own serialized
presentation. Any other solution seems like external plumbing to fix a
design problem.)
-Carl

> Pretty sure the WWDC 2015 video on NSOperations tackles a similar scenario
> in a quite elegant way. That might be worth investigating.
>
> Peter
>
>> On Nov 5, 2015, at 6:42 PM, Carl Hoefs 
>> wrote:
>>
>> A queue of what? I would think that if only a single alert view can be
>> presented at a time, then iOS would serialize them and present them when
>> earlier ones complete. Is there no system-level solution to this?
>> -Carl
>>
>>
>>> Make a queue.
>>>
>>> Sent from my iPhone
>>>
>>>> On Nov 5, 2015, at 6:10 PM, Carl Hoefs
>>>> 
>>>> wrote:
>>>>
>>>> I don't want more than 1 alert presented at a time, of course, but
>>>> they
>>>> get generated asynchronously. I thought dispatch_get_main_queue()
>>>> would
>>>> nicely serialize any that occur. Thus David's comment that I'm just
>>>> getting the requests issued in a serialized fashion.
>>>>
>>>> I'm not certain how to have alerts that are scattered all throughout
>>>> the
>>>> app to wait until some other alert's completion block executes. Are
>>>> you
>>>> saying to have it control a global flag or some such?
>>>> -Carl
>>>>
>>>>> On Nov 5, 2015, at 3:53 PM, Eric E Dolecki 
>>>>> wrote:
>>>>>
>>>>> That's the way. You should never need more than one presented at a
>>>>> time.
>>>>>
>>>>> Sent from my iP6+
>>>>>
>>>>>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński 
>>>>>> wrote:
>>>>>>
>>>>>> You should present next UIAlertController when first one has been
>>>>>> dismissed (when UIAlertAction handler is called).
>>>>>>
>>>>>> Tomek
>>>>>>
>>>>>>> Wiadomość napisana przez Carl Hoefs
>>>>>>>  w dniu 05.11.2015, o godz. 23:37:
>>>>>>>
>>>>>>> iOS 9.1, iPhone 5S, ObjC
>>>>>>>
>>>>>>> I'm getting the following runtime warning due to multiple
>>>>>>> simultaneous UIAlertControllers presenting at the same time:
>>>>>>>
>>>>>>> Warning: Attempt to present  on
>>>>>>>  which is already presenting
>>>>>>> 
>>>>>>>
>>>>>>> I know only one alert view controller can be presenting at a time,
>>>>>>> so
>>>>>>> the way I thought to serialize execution of each
>>>>>>> -presentViewController:: is:
>>>>>>>
>>>>>>>dispatch_async( dispatch_get_main_queue(), ^{
>>>>>>>[ self presentViewController: alert
>>>>>>>animated: YES
>>>>>>>  completion: nil ];
>>>>>>>});
>>>>>>>
>>>>>>> Why isn't dispatch_get_main_queue() enforcing serialized execution?
>>>>>>> Is there another way to do this?
>>>>>>> -Carl
>>>>>>>
>>>>>>>
>>>>>>> ___
>>>>>>>
>>>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>>>>>
>>>>>>> Please do not post admin requests or moderator comments to the
>>>>>>> list.
>>>>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>>>>>
>>>>>>> Help/Unsubscribe/Update your Subscription:
>>>>>>> https://lists.apple.com/mailman/options/cocoa-dev/thom%40union.waw.pl
>>>>>>>
>>>>>>> This email sent to t...@union.waw.pl
>>>>>>
>>>>>>
>>>>>> ___
>>>>>>
>>>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>&g

Re: Multiple simultaneous UIAlertControllers

2015-11-06 Thread Carl Hoefs
On Nov 5, 2015, at 3:53 PM, Eric E Dolecki  wrote:
> 
> That's the way. You should never need more than one presented at a time. 
> 
> 
>> On Nov 5, 2015, at 5:44 PM, Tomasz Muszyński  wrote:
>> 
>> You should present next UIAlertController when first one has been dismissed 
>> (when UIAlertAction handler is called).

Now that I have an NSOperationQueue handling the serialized presentation of the 
UIAlertControllers, I'm getting this warning:

Warning: Attempt to present  on 
 whose view is not in the window hierarchy!

So far as I understand it, the view *is* in the window hierarchy, modally. What 
to do?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Multiple simultaneous UIAlertControllers

2015-11-07 Thread Carl Hoefs
On Nov 6, 2015, at 3:06 PM, Graham Cox  wrote:
> 
>> On 6 Nov 2015, at 10:58 AM, Carl Hoefs  
>> wrote:
>> 
>> (As a general thought, though, it would appear that UIAlertController
>> should be a singleton app-wide, and it should manage its own serialized
>> presentation. Any other solution seems like external plumbing to fix a
>> design problem.)
> 
> It is a design problem - yours :)

It's an Apple design problem.

>  having a bunch of endless alerts one after another

Who's doing that?

> that can asynchronously produce errors,

They're not errors, they're alerts. So when Apple pops up an "Allow access to 
the camera? Yes/No" alert (or a Settings alert, or any others), it squashes any 
alert from my app that might get presented. Apple design problem.

At any rate, I do have the correct paradigm working now, and it accommodates 
Apple's design flaw.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

iOS: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Carl Hoefs
I was about to implement my own singleton class to act as an app-wide context 
repository, but then I thought: wouldn't it be simpler just to use the 
appDelegate for that purpose? It's a singleton already and available to all 
classes via [[UIApplication sharedApplication] delegate]. All I need to do is 
add my @properties to it and I'm done.
Are there any drawbacks to this?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS: Using AppDelegate as an app-wide singleton

2015-12-01 Thread Carl Hoefs
The following seems to be working out for me.

#import "AppCommon.h"
@implementation AppCommon
+ (AppCommon *)shared
{
static AppCommon *shared = nil;
static dispatch_once_t token;
dispatch_once(&token, ^{
shared = [[self alloc] init];
});
return shared;
}

-Carl


> On Dec 1, 2015, at 4:55 PM, Quincey Morris 
>  wrote:
> 
> On Dec 1, 2015, at 12:58 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
> 
>> available to all classes via [[UIApplication sharedApplication] delegate].
> 
>> Are there any drawbacks to this?
> 
> I don’t find this practice very objectionable, but the drawback is that 
> '[[UIApplication sharedApplication] delegate]’ has the wrong class, so you 
> usually end up writing some sort of global function to get it pre-cast.
> 
> In that case, you may as well use a different object, make it a local static 
> variable in a class implementation, and write a static method 
> (“[MyContextCache sharedContextCache]”) to get it. Don’t forget to use 
> dispatch_once to create the singleton. You may not have any thread safety 
> concerns right now, but you might easily do so later.
> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Obtaining a value from a hex representation

2016-01-08 Thread Carl Hoefs
A user enters the hexadecimal representation of a number like "0x31C8FD" into a 
text field. The intValue of such strings is 0. Is there a Cocoa method (like 
.hexValue) to convert the hex representation string into a value?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Obtaining a value from a hex representation

2016-01-08 Thread Carl Hoefs
On Jan 8, 2016, at 3:16 PM, Steve Mills  wrote:
> 
> Either use NSScanner or strtol if you have char* (or strtoll if it's longer 
> than 8 hex chars).
> Sent from iCloud's ridiculous UI, so, sorry about the formatting
> 
Hadn't thought to use NSScanner, though it appears a bit overkill. 

strtoll() works fine. (Note: Hex values greater than 7FFF require the use 
of strtoll(). strtol() returns -1 in such cases.)

Guess I'll create a NSString category so I can have a -hexValue method after 
all. 

Thanks Steve, Quincey, Jens!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Panes vs. Separate Windows

2016-01-11 Thread Carl Hoefs
FWIW, I find it odd that so many apps these days seem to be following Xcode's 
"lead", if you want to call it that. I still miss Xcode 3.2.6 because I could 
configure it for the way *I* was most productive. Now you gotta use that 
ginormous "plate" window. It shows you what it wants to show you when it wants 
to show it to you, and enforces a sort of implicit multiple exclusion among the 
various views.

If you're an OmniGraffle user (a flowchart/design app), you'll notice that in 
the lastest release they also changed over from the infinitely more usable 
multiple floating windows design to one ginormous clunker of a main window. 
Ugh. Maybe it's a trend toward one-dimensional thinking? 

For CAD I can't imagine how a single large window would be best. Most often 
you're using multiple screens, and it's best to break up the windows into 
logical groups. CAD on a laptop is an exercise in futility.

-Carl

> On Jan 11, 2016, at 12:54 PM, Rick Mann  wrote:
> 
> I'm pleased to see so many in favor of multiple windows. It seems the 
> arguments in favor of a single monolithic window hinge smaller screens. But I 
> find that monolithic windows require larger screens (and can't share 
> screens). The thing about separate windows is they can overlap and still be 
> useful, increasing available screen space.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Obj-C - your thoughts on hiding data members?

2016-01-27 Thread Carl Hoefs

> On Jan 27, 2016, at 4:38 AM, Dave  wrote:
> 
>>> 
 I'm going to step out on a limb and since Xcode has supported editing in 
 UTF-8 and 16, that we look into those character sets and pick some symbols 
 that accurately represent public, protected and private.
>>> 
>>> Now you’re pulling our legs, right Alex?
>> 
>> Yeah, I know.  It's really non conventional, buuut… I've started using some 
>> of the characters such as the block and non breaking line to make better 
>> formatting for comments and logging.
> 
> Wow Man, you *do* like living on the wild-side. I hope it doesn’t come back 
> to bite you! 
> 
>> Other people who are on the Swift side of things are even using smilies and 
>> emoticons in their code.  Or so they claim.  That scares me.
> 
> I’m more of a if its not in the ASCII set it ain’t Source Code brigade! lol

If I can't make a punched card deck out of it, it ain't REAL source code.

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

UITableView -reloadData woes

2016-02-12 Thread Carl Hoefs
iOS 9.2

Is there a trick to using UITableView -reloadData? I can't get it to do 
anything.

My view controller has a UITableView instance (VC is both UITableView delegate 
and dataSource), and I populate it with cells from my data source via the 
delegate callback method -tableView:cellForRowAtIndexPath:. That works fine. 

Now, when the data source has additional data, it calls -reloadData to 
rebuild/redisplay the table view, but this has no effect. The delegate callback 
method -tableView:cellForRowAtIndexPath: doesn't get invoked, and the contents 
of the table view don't change. In the debugger, I've verified that the 
UITableView property is valid:

_sbsTableView is: ; layer = ; contentOffset: {0, 0}; contentSize: 
{528, 616}>

The reload doesn't reload the table, causing an index out of range exception 
downstream when trying to access a row that -reload should have added. 

  // Reload the table's data
  [_sbsTableView reloadData];  // no visible change onscreen
  // Reposition the table view to display the new entry
  NSIndexPath *indxPath = [NSIndexPath indexPathForRow:user_no
 inSection:sec_no];
  [_sbsTableView selectRowAtIndexPath:indxPath   // <- exception
 animated:YES
   scrollPosition:UITableViewScrollPositionMiddle];
  [_sbsTableView scrollToRowAtIndexPath:indxPath
   atScrollPosition:UITableViewScrollPositionMiddle 
   animated:YES];


The docs say: 

1. "The table view’s delegate or data source calls this method when it wants 
the table view to completely reload its data."

2. "Call this method to reload all the data that is used to construct the 
table, including cells, section headers and footers, index arrays, and so on."

Wouldn't that necessitate the invocation of the delegate callback method 
-tableView:cellForRowAtIndexPath:? FWIW, the next time the app is run, the 
additional data does appear in the table.

There must be something obvious I'm overlooking...
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITableView -reloadData woes

2016-02-12 Thread Carl Hoefs

> On Feb 12, 2016, at 1:39 PM, Quincey Morris 
>  wrote:
> 
> I think the one thing you can count on is that the ‘reloadData’ API isn’t 
> broken.

But it's very tempting to think so... ;-)

When I issue the -reloadData, the -tableView:numberOfRowsInSection: callback 
gets invoked. But, it returns the number of rows _before_ the addition. If I 
return from that view controller and then go back into it, it has the correct 
number. It's behaving like there's something blocking the -reloadData 
operation. 

Perhaps -reloadData is sensitive to where it is called from? My context is that 
I have a table of users, the 0th element of which segues modally to a new VC to 
add a new user, then returns. Then in the original VC's -viewWillAppear: I 
issue the -reloadData. Should I instead do this from within the "add new user" 
VC? Or is there some other iOS pattern to do this?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Cocoa-dev Digest, Vol 13, Issue 82

2016-02-12 Thread Carl Hoefs
Mike,

The -reloadData is being issued on the main thread:

{number = 1, name = main}

-Carl


> On Feb 12, 2016, at 4:19 PM, Michael Swan  wrote:
> 
> Right before you call reload data log the current thread [NSThread 
> currentThread];
> If it says anything other than main that's the issue. It happens all the time 
> since it's easy to forget that whatever callback tells you about the added 
> data ends up coming in on the background.
> 
> Hope that helps,
> Mike Swan
> OS X & iOS Developer
> TheMikeSwan.com
> 
>> On Feb 12, 2016, at 5:53 PM, cocoa-dev-requ...@lists.apple.com wrote:
>> 
>> Message: 1
>> Date: Fri, 12 Feb 2016 12:37:53 -0800
>> From: Carl Hoefs 
>> To: "Cocoa-dev@lists.apple.com dev" 
>> Subject: UITableView -reloadData woes
>> Message-ID:
>>   <8cd75bc0-ee70-429d-ab76-61aad7b83...@autonomy.caltech.edu>
>> Content-Type: text/plain;charset=utf-8
>> 
>> iOS 9.2
>> 
>> Is there a trick to using UITableView -reloadData? I can't get it to do 
>> anything.
>> 
>> My view controller has a UITableView instance (VC is both UITableView 
>> delegate and dataSource), and I populate it with cells from my data source 
>> via the delegate callback method -tableView:cellForRowAtIndexPath:. That 
>> works fine. 
>> 
>> Now, when the data source has additional data, it calls -reloadData to 
>> rebuild/redisplay the table view, but this has no effect. The delegate 
>> callback method -tableView:cellForRowAtIndexPath: doesn't get invoked, and 
>> the contents of the table view don't change. In the debugger, I've verified 
>> that the UITableView property is valid:
>> 
>> _sbsTableView is: > clipsToBounds = YES; autoresize = RM+BM; gestureRecognizers = > 0x146f22a0>; layer = ; contentOffset: {0, 0}; 
>> contentSize: {528, 616}>
>> 
>> The reload doesn't reload the table, causing an index out of range exception 
>> downstream when trying to access a row that -reload should have added. 
>> 
>> // Reload the table's data
>> [_sbsTableView reloadData];  // no visible change onscreen
>> // Reposition the table view to display the new entry
>> NSIndexPath *indxPath = [NSIndexPath indexPathForRow:user_no
>>inSection:sec_no];
>> [_sbsTableView selectRowAtIndexPath:indxPath   // <- exception
>>animated:YES
>>  scrollPosition:UITableViewScrollPositionMiddle];
>> [_sbsTableView scrollToRowAtIndexPath:indxPath
>>  atScrollPosition:UITableViewScrollPositionMiddle 
>>  animated:YES];
>> 
>> 
>> The docs say: 
>> 
>> 1. "The table view’s delegate or data source calls this method when it wants 
>> the table view to completely reload its data."
>> 
>> 2. "Call this method to reload all the data that is used to construct the 
>> table, including cells, section headers and footers, index arrays, and so 
>> on."
>> 
>> Wouldn't that necessitate the invocation of the delegate callback method 
>> -tableView:cellForRowAtIndexPath:? FWIW, the next time the app is run, the 
>> additional data does appear in the table.
>> 
>> There must be something obvious I'm overlooking...
>> -Carl
>> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: UITableView -reloadData woes

2016-02-12 Thread Carl Hoefs
On Feb 12, 2016, at 4:28 PM, Quincey Morris 
 wrote:
> 
> On Feb 12, 2016, at 16:23 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> When I issue the -reloadData, the -tableView:numberOfRowsInSection: callback 
>> gets invoked. But, it returns the number of rows _before_ the addition.
> 
> Whoa. *You* return the number of rows from *your* data model, which you 
> presumably updated just before calling reloadData. If you’re returning the 
> old number of rows, you’re doing something wrong.

Bingo! I didn't refresh the data model from the database, so it had stagnant 
data. Thanks for spotting this! It's been a long day. My boss is yelling at me, 
"There's a reason the sun goes down!" 

Thanks a mil!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Triggering UITableView's -didSelectRowAtIndexPath: delegate callback

2016-02-27 Thread Carl Hoefs
iOS 9.2

At certain times I need to update the data source for a table view. Then I 
cause the row that was updated to be selected using UITableView's 
-selectRowAtIndexPath::: method. That much works fine. 

The problem is that the delegate callback associated with selecting that row 
doesn't occur. And indeed, I have since found that the documentation for this 
method says:

"Calling this method does not cause the delegate to receive a 
tableView:didSelectRowAtIndexPath: message."

Is there a method to call (or some other way) that will do this?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Triggering UITableView's -didSelectRowAtIndexPath: delegate callback

2016-02-27 Thread Carl Hoefs
On Feb 27, 2016, at 12:10 PM, Ben Kennedy  wrote:
> 
>> On Feb 27, 2016, at 11:01 AM, Carl Hoefs  
>> wrote:
>> 
>> The problem is that the delegate callback associated with selecting that row 
>> doesn't occur. And indeed, I have since found that the documentation for 
>> this method says:
>> 
>> "Calling this method does not cause the delegate to receive a 
>> tableView:didSelectRowAtIndexPath: message."
>> 
>> Is there a method to call (or some other way) that will do this?
> 
> Why not just call that method yourself?

Yes, that works, thanks! I just thought there might be a "preferred" way to do 
it. I guess I was hoping for something like:

[myTableView selectRowAtIndexPath:indexPath 
 animated:YES 
   scrollPosition:UITableViewScrollPositionMiddle
 triggersDelegateCallback:YES];
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Customizing a UISwitch?

2016-03-04 Thread Carl Hoefs
iOS 9.2

The 2016 Apple documentation shows UISwitch -onImage and -offImage properties. 
They're not noted as deprecated, except for iOS 7, yet they don't seem to do 
anything on iOS9. Xcode shows these properties to be settable. I have set them 
both, in Xcode and in my app code, but they seem to have no effect on the 
storyboard or when running the app.

What's the trick in customizing a UISwitch with different images? If this 
functionality is busted, is there another way to achieve it? I don't see an 
on/off style button in the palette.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customizing a UISwitch?

2016-03-04 Thread Carl Hoefs
I replaced the UISwitch with a UIButton. But when I set the button's new image 
in the event method (myButton.imageView.image = ...), still nothing happens 
(the button's image doesn't redraw). What do I have to do to cause this to 
happen?
-Carl

> On Mar 4, 2016, at 2:00 PM, Gary L. Wade  wrote:
> 
> Maybe the docs should say iOS 7 and later since that's what it means. You 
> can't do this in 7, 8, 9, or X/10/whatever iOS is coming this fall. It 
> shouldn't be hard to roll your own UIControl subclass or work with the 
> current classes.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>> On Mar 4, 2016, at 11:10 AM, Carl Hoefs  
>> wrote:
>> 
>> iOS 9.2
>> 
>> The 2016 Apple documentation shows UISwitch -onImage and -offImage 
>> properties. They're not noted as deprecated, except for iOS 7, yet they 
>> don't seem to do anything on iOS9. Xcode shows these properties to be 
>> settable. I have set them both, in Xcode and in my app code, but they seem 
>> to have no effect on the storyboard or when running the app.
>> 
>> What's the trick in customizing a UISwitch with different images? If this 
>> functionality is busted, is there another way to achieve it? I don't see an 
>> on/off style button in the palette.
>> -Carl
>> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customizing a UISwitch?

2016-03-04 Thread Carl Hoefs
According to docs, .imageView.image = ... performs this for the Normal state of 
the button.

"This image is displayed when the image view is in its natural state."

Is this what you mean?
-Carl

> On Mar 4, 2016, at 4:50 PM, Eric E. Dolecki  wrote:
> 
> Are you doing this for the proper state? I.e. Normal ?

> On Fri, Mar 4, 2016 at 6:41 PM Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
> I replaced the UISwitch with a UIButton. But when I set the button's new 
> image in the event method (myButton.imageView.image = ...), still nothing 
> happens (the button's image doesn't redraw). What do I have to do to cause 
> this to happen?
> -Carl
> 
> > On Mar 4, 2016, at 2:00 PM, Gary L. Wade  > <mailto:garyw...@desisoftsystems.com>> wrote:
> >
> > Maybe the docs should say iOS 7 and later since that's what it means. You 
> > can't do this in 7, 8, 9, or X/10/whatever iOS is coming this fall. It 
> > shouldn't be hard to roll your own UIControl subclass or work with the 
> > current classes.
> > --
> > Gary L. Wade (Sent from my iPhone)
> > http://www.garywade.com/ <http://www.garywade.com/>
> >
> >> On Mar 4, 2016, at 11:10 AM, Carl Hoefs  >> <mailto:newsli...@autonomy.caltech.edu>> wrote:
> >>
> >> iOS 9.2
> >>
> >> The 2016 Apple documentation shows UISwitch -onImage and -offImage 
> >> properties. They're not noted as deprecated, except for iOS 7, yet they 
> >> don't seem to do anything on iOS9. Xcode shows these properties to be 
> >> settable. I have set them both, in Xcode and in my app code, but they seem 
> >> to have no effect on the storyboard or when running the app.
> >>
> >> What's the trick in customizing a UISwitch with different images? If this 
> >> functionality is busted, is there another way to achieve it? I don't see 
> >> an on/off style button in the palette.
> >> -Carl
> >>
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
> <mailto:Cocoa-dev@lists.apple.com>)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
> <http://lists.apple.com/>
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com>
> 
> This email sent to edole...@gmail.com <mailto:edole...@gmail.com>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Customizing a UISwitch?

2016-03-04 Thread Carl Hoefs
Bingo! -setImage:forState: UIControlStateNormal works perfectly. Not sure what 
setImage: is doing.
Thx Gary & Eric!
-Carl


> On Mar 4, 2016, at 4:55 PM, Gary L. Wade  wrote:
> 
> Look instead at the set…:forState: methods.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>> On Mar 4, 2016, at 3:40 PM, Carl Hoefs  
>> wrote:
>> 
>> I replaced the UISwitch with a UIButton. But when I set the button's new 
>> image in the event method (myButton.imageView.image = ...), still nothing 
>> happens (the button's image doesn't redraw). What do I have to do to cause 
>> this to happen?
>> -Carl
>> 
>>> On Mar 4, 2016, at 2:00 PM, Gary L. Wade  
>>> wrote:
>>> 
>>> Maybe the docs should say iOS 7 and later since that's what it means. You 
>>> can't do this in 7, 8, 9, or X/10/whatever iOS is coming this fall. It 
>>> shouldn't be hard to roll your own UIControl subclass or work with the 
>>> current classes.
>>> --
>>> Gary L. Wade (Sent from my iPhone)
>>> http://www.garywade.com/
>>> 
>>>> On Mar 4, 2016, at 11:10 AM, Carl Hoefs  
>>>> wrote:
>>>> 
>>>> iOS 9.2
>>>> 
>>>> The 2016 Apple documentation shows UISwitch -onImage and -offImage 
>>>> properties. They're not noted as deprecated, except for iOS 7, yet they 
>>>> don't seem to do anything on iOS9. Xcode shows these properties to be 
>>>> settable. I have set them both, in Xcode and in my app code, but they seem 
>>>> to have no effect on the storyboard or when running the app.
>>>> 
>>>> What's the trick in customizing a UISwitch with different images? If this 
>>>> functionality is busted, is there another way to achieve it? I don't see 
>>>> an on/off style button in the palette.
>>>> -Carl
>> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Variable type representations

2016-03-11 Thread Carl Hoefs
On x86_64 OS X systems, ObjC variable type 'long' uses an 8-byte 
representation, whereas 'int' uses 4 bytes. I'm converting NSStrings to values, 
but it has no 'longValue' method or property. According to the documentation, 
NSString supports:

doubleValue   - 8 bytes
floatValue- 4 bytes
intValue  - 4 bytes
integerValue  - 8 bytes
longLongValue - 8 bytes
boolValue - 1 byte

Q1: How can 'long' and 'long long' have the same 8-byte representation? 
Q2: How to get an unsigned long int value from an NSString? Use NSInteger?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Window updates stall on headless Mac mini

2016-03-18 Thread Carl Hoefs

> On Mar 18, 2016, at 1:16 PM, Steve Mills  wrote:
> 
> Any wild theories? 

We ran into similar issues running headless. Adding a 'headless display 
emulator' seemed to be the cure for us:

http://www.amazon.com/CompuLab-fit-Headless-Display-Emulator/dp/B00FLZXGJ6

HTH,
-Carl




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Window updates stall on headless Mac mini

2016-03-19 Thread Carl Hoefs

> On Mar 19, 2016, at 1:02 AM, Steve Mills  wrote:
> 
> On Mar 18, 2016, at 17:14:25, Carl Hoefs  
> wrote:
>> 
>> 
>> We ran into similar issues running headless. Adding a 'headless display 
>> emulator' seemed to be the cure for us:
>> 
>> http://www.amazon.com/CompuLab-fit-Headless-Display-Emulator/dp/B00FLZXGJ6
> 
> Interesting. Didn't know they had such a thing. This mini is in another 
> state, so we'll need to go through channels to get it done, if it comes to 
> that.

You may have other issues going on, so a video emulator might not be the "cure" 
you're looking for. But my understanding is that when there's no monitor 
attached to the Mini, the GPU doesn't get activated. The result is that the 
graphical elements of OS X such as OpenGL revert to being emulated in software. 
Also, there's a big difference in accessing such a machine via ARD because 
without the GPU, the CPU is doing all the screen rendering, causing a lot of 
lag.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs
I have a daemon process that needs to generate a series of sequenced files 
(named sequentially, such as "file_01944576_1.dat", "file_01944576_2.dat", 
etc.) in the same directory. Does Cocoa provide a way to do this?

NSFileManager's -createFileAtPath:contents:attributes: method states:
 "If a file already exists at path, this method overwrites the contents of that 
file..."

I would hate to do this blindly, such as with fstat() in a loop, because there 
will potentially be many sequences, and each can grow to an arbitrary number. 
How do Finder and other OS X agents accomplish this?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs
> Not that I know of. But surely it’s only 2 lines of code, apart from error 
> checking and recovery?


I'd love to see those 2 lines of code! :-)

But I'm concerned mainly with efficiency, as determining the next number in the 
naming sequence potentially can be extremely inefficient - trying 1000s of 
times until the next available number every time a new file needs to be 
written, and also every time the latest-written file needs to be retrieved. 

But I'm hearing this is the only way?
-Carl


> On Apr 16, 2016, at 2:58 PM, Quincey Morris 
>  wrote:
> 
> On Apr 16, 2016, at 14:36 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I have a daemon process that needs to generate a series of sequenced files 
>> (named sequentially, such as "file_01944576_1.dat", "file_01944576_2.dat", 
>> etc.) in the same directory. Does Cocoa provide a way to do this?
> 
> Not that I know of. But surely it’s only 2 lines of code, apart from error 
> checking and recovery?
> 
>> NSFileManager's -createFileAtPath:contents:attributes: method states:
>> "If a file already exists at path, this method overwrites the contents of 
>> that file…"
> 
> Do not use this method: it’s obsolete. Use NSData.writeToURL:options: 
> instead, with the NSDataWritingWithoutOverwriting option.
> 
>> I would hate to do this blindly, such as with fstat() in a loop, because 
>> there will potentially be many sequences, and each can grow to an arbitrary 
>> number. How do Finder and other OS X agents accomplish this?
> 
> Blindly in what sense? Even you have a lot of files, those are the files you 
> want. There’s nothing inherently dangerous in creating them. If you mean, 
> because of the possibility of conflicts with existing files, you should 
> follow the normal best practices inside your ‘writeToFile’ loop:
> 
> — (Optional) Preflight the loop to ensure that conflicting files don’t exist. 
> This is only an approximate safety measure, since conflicting files can be 
> created after you check, but provides a better user experience if there is 
> some reasonable expectation of conflict.
> 
> — Detect any actual conflict by the failure of ‘writeToFile’ and offer user 
> recovery options at that point.
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Creating a series of sequenced files

2016-04-16 Thread Carl Hoefs

> On Apr 16, 2016, at 3:20 PM, Quincey Morris 
>  wrote:
> 
> On Apr 16, 2016, at 15:10 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> But I'm concerned mainly with efficiency, as determining the next number in 
>> the naming sequence potentially can be extremely inefficient - trying 1000s 
>> of times until the next available number every time a new file needs to be 
>> written, and also every time the latest-written file needs to be retrieved. 
> 
> If you really need to examine the existing files, then I suggest you start 
> your process with a one-time directory enumeration, and find the file that 
> you regard as "last". However I foresee that there are actually two things 
> you might want to find:
> 
> 1. The next sequence number to use.
> 
> 2. The most recently-written file.
> 
> There’s really nothing you can do to guarantee that these are the same, in 
> all scenarios, so you may as well treat them as separate results.
> 
> This would only get complicated if there’s another process creating files in 
> your sequence. Otherwise an initial directory enumeration will get you 
> sync-ed up, and after that you can just do the simple 
> nextInSequence-incrementing thing.
> 


For a single sequence, it wouldn't be so bad, but I have potentially n 
different ongoing sequences, so it seems like this approach could end up 
hitting the filesystem really hard. I'll code it up and see how inefficient it 
becomes. 
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

BOOL parameter passed as nil object

2016-04-18 Thread Carl Hoefs
Suppose I have an object with a declared method signature:
  -(void)myMethod:(BOOL)a_bool;

Q1: If I invoke it like this:
  [self performSelector:@selector(myMethod:) withObject:nil];  // nil obj
Will argument a_bool end up with a 0 value assigned to it?

Q2: But if I invoke it like this:
  [self performSelector:@selector(myMethod:) withObject:someObj];  // valid obj
Will argument a_bool end up with a 1 value assigned to it?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-20 Thread Carl Hoefs

On Apr 19, 2016, at 1:50 PM, John McCall wrote:

> We strongly encourage you not to worry about any of this and just always call 
> methods using the right method signature.

Roger, wilco!  (It had a 'smell' to it, but I wasn't quite certain why. Now I 
know! ;-)
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-22 Thread Carl Hoefs

> On Apr 19, 2016, at 1:50 PM, John McCall  wrote:
> 
> We strongly encourage you not to worry about any of this and just always call 
> methods using the right method signature.

Sorry to beat a dead horse, but does this mean that there is no inherent way to 
handle the 1000s of Foundation and AppKit method signatures which don't specify 
an object but a value parameter? There is no recommended way to have them 
performed on the main thread? 
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-22 Thread Carl Hoefs

> On Apr 22, 2016, at 2:57 PM, Quincey Morris 
>  wrote:
> 
> The recommended way to have them performed on the main thread is to use a 
> block and GCD dispatch_async (dispatch_get_main_queue (), …).

Ahh, that's clean. Implemented and working! That saves me a lot of effort.
Thanks!
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-22 Thread Carl Hoefs
On Apr 22, 2016, at 2:57 PM, Quincey Morris 
 wrote:
> 
> If you must use performSelector, then you can write your own glue method that 
> takes an object parameter and invokes the API that takes the scalar parameter.

-performSelectorOnMainThread:withObject:waitUntilDone:modes: can handle 
NSRunLoopCommonModes, such as to ensure an animation continues to run in all 
run loop common modes. Does the block+GCD+dispatch_async approach support this, 
or is this a case where -performSelector: should be used?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: BOOL parameter passed as nil object

2016-04-22 Thread Carl Hoefs
Yes, CFRunLoopPerformBlock: works well!
Thanks,
-Carl

> On Apr 22, 2016, at 4:09 PM, Clark Cox  wrote:
> 
> If you really need the block to run in specific runloop modes, you can use 
> CFRunLoopPerformBlock:
> 
> 
> 
> CFRunLoopPerformBlock(CFRunLoopGetMain(), kCFRunLoopCommonModes, ^{
>   //Code to be performed on main thread
> });
> 
> 
>> On Apr 22, 2016, at 16:00, Carl Hoefs  wrote:
>> 
>> On Apr 22, 2016, at 2:57 PM, Quincey Morris 
>>  wrote:
>>> 
>>> If you must use performSelector, then you can write your own glue method 
>>> that takes an object parameter and invokes the API that takes the scalar 
>>> parameter.
>> 
>> -performSelectorOnMainThread:withObject:waitUntilDone:modes: can handle 
>> NSRunLoopCommonModes, such as to ensure an animation continues to run in all 
>> run loop common modes. Does the block+GCD+dispatch_async approach support 
>> this, or is this a case where -performSelector: should be used?
>> 
>> -Carl
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/clarkcox3%40gmail.com
>> 
>> This email sent to clarkc...@gmail.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Very basic need, very difficult to achieve.

2016-05-03 Thread Carl Hoefs

> On May 3, 2016, at 7:18 PM, Graham Cox  wrote:
> 
> I went to the app store (arrgh!!) to redownload the full installer image (why 
> oh why is this not available as a developer download from apple dev? Using 
> the app store is an abysmal non-choice to force on developers). I could not 
> download 10.9 as the button was greyed out with “downloaded” on it.

Go to a different machine, launch AppStore, and select the Purchased tab. I 
don't know why, but you'll find that none of your previously purchased items 
will be grayed out there. This is how I re-download already downloaded items.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Receiver type for instance message is a forward declaration

2016-05-06 Thread Carl Hoefs
I'm building for iOS 9.3, and am using NSOperationQueue throughout. Once in a 
while, NSOperationQueue -addOperation: throws an exception. I guess this is a 
well-known bug going all the way back to 2008. I found Mike Ash's writeup on 
the issue, and have downloaded his replacement class, RAOperationQueue. 
However, it was written long ago for GC not ARC. I have one remaining problem 
in converting the code.

- (BOOL)_runOperationFromList: (RAAtomicListRef *)listPtr sourceList: 
(RAAtomicListRef *)sourceListPtr
{
RAOperation *op = [self _popOperation: listPtr];
if( !op )
{
*listPtr = RAAtomicListSteal( sourceListPtr );
// source lists are in LIFO order, but we want to execute 
operations in the order they were enqueued
// so we reverse the list before we do anything with it
RAAtomicListReverse( listPtr );
op = [self _popOperation: listPtr];
}

if( op )
[op run];  <-- ERROR HERE

return op != nil;
}

The error I'm getting is: Receiver type 'RAOperation' for instance message is a 
forward declaration.

What does this error mean, and how can I fix it?
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-06 Thread Carl Hoefs

> On May 6, 2016, at 1:35 PM, John McCall  wrote:
> 
>> On May 6, 2016, at 1:32 PM, Carl Hoefs  
>> wrote:
>> I'm building for iOS 9.3, and am using NSOperationQueue throughout. Once in 
>> a while, NSOperationQueue -addOperation: throws an exception. I guess this 
>> is a well-known bug going all the way back to 2008. I found Mike Ash's 
>> writeup on the issue, and have downloaded his replacement class, 
>> RAOperationQueue. However, it was written long ago for GC not ARC. I have 
>> one remaining problem in converting the code.
>> 
>> - (BOOL)_runOperationFromList: (RAAtomicListRef *)listPtr sourceList: 
>> (RAAtomicListRef *)sourceListPtr
>> {
>>  RAOperation *op = [self _popOperation: listPtr];
>>  if( !op )
>>  {
>>  *listPtr = RAAtomicListSteal( sourceListPtr );
>>  // source lists are in LIFO order, but we want to execute 
>> operations in the order they were enqueued
>>  // so we reverse the list before we do anything with it
>>  RAAtomicListReverse( listPtr );
>>  op = [self _popOperation: listPtr];
>>  }
>>  
>>  if( op )
>>  [op run];  <-- ERROR HERE
>>  
>>  return op != nil;
>> }
>> 
>> The error I'm getting is: Receiver type 'RAOperation' for instance message 
>> is a forward declaration.
>> 
>> What does this error mean, and how can I fix it?
> 
> It means you haven't #included the header with the @interface declaration for 
> RAOperation.
> 
Indeed, that silenced the error, thanks! 
I would have thought that this earlier line would have been flagged if 
RAOperation.h hadn't been included:

RAOperation *op = [self _popOperation: listPtr];

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-06 Thread Carl Hoefs

> On May 6, 2016, at 2:34 PM, Quincey Morris 
>  wrote:
> 
> On May 6, 2016, at 13:32 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> Once in a while, NSOperationQueue -addOperation: throws an exception. I 
>> guess this is a well-known bug going all the way back to 2008. I found Mike 
>> Ash's writeup on the issue, and have downloaded his replacement class, 
>> RAOperationQueue. However, it was written long ago for GC not ARC.
> 
> As a side issue, you didn’t give us any explicit references to Mike’s 
> discussion, but looking back through his blog 
> (mikeash.com/pyblog/use-nsoperationqueue.html 
> <http://mikeash.com/pyblog/use-nsoperationqueue.html>), I see that he 
> reported that *his* problem was fixed in 10.5.7:
> 
>> "Mac OS X 10.5.7 has shipped and includes a fix for the NSOperationQueue bug 
>> that I discovered late last year. I have run all of my old test cases 
>> against 10.5.7 and it appears to perform as advertised. As far as I can see, 
>> NSOperationQueue is now safe to use.”
> 
> 
> These days, if I had any doubts about NSOperationQueue, I’d switch to using 
> GCD directly. There’s very little that NSOperationQueue does that GCD 
> doesn’t, and I must admit I’ve never regarded NSOperationQueue as superior**, 
> apart from the fact that it got here first. (IIRC) NSOperationQueue started 
> to displace raw threading only just before GCD arrived on the scene.

I've noticed infrequent objcExceptionThrow()s using NSOperationQueue for quite 
a while now, always thinking it must be something I'm doing. Unfortunately, the 
exception appears so seldom that I've never had the time to look into the issue 
at the time it happens. All I'm doing is -addOperation: when it blows. I can't 
reproduce it at will. I should have taken a stack trace when it occurred today. 

Sadly, RAOperationQueue et al is suffering from code rot. I couldn't get it to 
work at all. Thanks for the GCD suggestion as an alternative, I'll go with it. 
(It isn't that NSOperationQueue is superior to GCD or not, it was just a very 
conveniently-oriented object to use.)
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-09 Thread Carl Hoefs

> On May 6, 2016, at 3:45 PM, Carl Hoefs  wrote:
> 
>> These days, if I had any doubts about NSOperationQueue, I’d switch to using 
>> GCD directly. There’s very little that NSOperationQueue does that GCD doesn’t

Alas, there appear to be no GCD dispatch queue introspection functions, 
specifically to find out what is executing (if anything) and what's waiting in 
the queue. Or did I overlook something?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 9, 2016, at 1:51 PM, Quincey Morris 
>  wrote:
> 
> Perhaps it’s worth going back to that, in the hope that your crashes get more 
> frequent, and you can investigate what really causes them.

At last, it blew again! Can someone interpret this? The context is that I 
touched a button in my iOS 9.3 app which invokes a method that creates an 
NSOperation and enqueues it to an established NSOperationQueue "upload queue".
-Carl


2016-05-10 13:29:16.980 iApp[2465:2101493] *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: '{type = mutable-small, count = 1, values = (
0 : 
+++
Timestamp:   27419184482629
Total Latency:   33461 us
SenderID:0x0001023E
BuiltIn: 0
ValueType:   Absolute
EventType:   Digitizer
DisplayIntegrated:   0
TransducerType:  Finger
TransducerIndex: 3
Identity:2
EventMask:   2051
Events:  Range Touch FromEdgeTip 
ButtonMask:  0
Range:   0
Touch:   0
Pressure:0.00
AuxiliaryPressure:   0.00
Twist:   90.00
GenerationCount: 0
WillUpdateMask:  
DidUpdateMask:   
X:   467.50
Y:   294.50
Z:   0.00
Quality: 0.00
Density: 0.00
Irregularity:0.00
MajorRadius: 0.00
MinorRadius: 0.00
Accuracy:0.011230
+++

)}: An -observeValueForKeyPath:ofObject:change:context: message was received 
but not handled.
Key path: operations
Observed object: {name = 'Upload Queue'}
Change: {
kind = 1;
}
Context: 0x0'
*** First throw call stack:
(0x20d19b8b 0x204d6dff 0x20d19ad1 0x2151cd7d 0x214a3d81 0x21482fe3 0x21482c3b 
0x2151e311 0x214822d1 0x2152f761 0x12d06d 0x25322521 0x253224b1 0x2530a3eb 
0x25321dd1 0x25321a3f 0x2531a3c7 0x252eac85 0x252e9229 0x20cdba67 0x20cdb657 
0x20cd99bf 0x20c28289 0x20c2807d 0x22244af9 0x253532c5 0x148dd7 0x208d4873)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb) bt
* thread #1: tid = 0x2010f5, 0x209a7c5c libsystem_kernel.dylib`__pthread_kill + 
8, queue = 'com.apple.main-thread', stop reason = signal SIGABRT
frame #0: 0x209a7c5c libsystem_kernel.dylib`__pthread_kill + 8
frame #1: 0x20a4db46 libsystem_pthread.dylib`pthread_kill + 62
frame #2: 0x2093c0c4 libsystem_c.dylib`abort + 108
frame #3: 0x204b27dc libc++abi.dylib`abort_message + 108
frame #4: 0x204cb6a0 libc++abi.dylib`default_terminate_handler() + 268
frame #5: 0x204d7098 libobjc.A.dylib`_objc_terminate() + 192
frame #6: 0x204c8e16 libc++abi.dylib`std::__terminate(void (*)()) + 78
frame #7: 0x204c88f6 libc++abi.dylib`__cxa_rethrow + 102
frame #8: 0x204d6f46 libobjc.A.dylib`objc_exception_rethrow + 42
frame #9: 0x20c2830e CoreFoundation`CFRunLoopRunSpecific + 650
frame #10: 0x20c2807c CoreFoundation`CFRunLoopRunInMode + 108
frame #11: 0x22244af8 GraphicsServices`GSEventRunModal + 160
frame #12: 0x253532c4 UIKit`UIApplicationMain + 144
  * frame #13: 0x00148dd6 iApp`main(argc=1, argv=0x003a7bd4) + 122 at main.m:14
(lldb) 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 3:52 PM, Quincey Morris 
>  wrote:
> 
> On May 10, 2016, at 13:38 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> At last, it blew again!
> 
> Well, here’s the exception message:
> 
>> An -observeValueForKeyPath:ofObject:change:context: message was received but 
>> not handled.
>> Key path: operations
>> Observed object: {name = 'Upload Queue'}
>> Change: {
>>kind = 1;
>> }
>> Context: 0x0
> 
> 
> So, some object has established itself as an observer of changes to the 
> “operations” property of the NSOperationQueue named “Upload Queue”, but has 
> failed to act on the observed change. Since the message says “received but 
> not handled”, the likelihood is that the observer object *has* a method named 
> 'observeValueForKeyPath:ofObject:change:context:’ (or one of its superclasses 
> does), and is invoking the ‘super’ method to pass the change upwards to an 
> ancestor class, but nothing actually handles it.
> 
> The most likely cause is that the observer registered itself using 
> ‘addObserver:forKeyPath:options:context:’ specifying a nil context, but is 
> checking for a different context in 
> 'observeValueForKeyPath:ofObject:change:context:’.
> 
> It’s also possible that the exception message means something more obscure, 
> in which case the cause may be more complicated, but you should search your 
> code for ‘addObserver’ and ‘observeValueForKeyPath’, and make sure that the 
> context is set and checked consistently. (Your code should *never* use a nil 
> context explicitly.)
> 
Yes, yes, and yes! I'm using a nil context. I'm not sure how context is to be 
used here... Is this an arbitrary value that I check in -observeValueForKeyPath?
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 4:13 PM, Quincey Morris 
>  wrote:
> 
> On May 10, 2016, at 16:05 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I'm not sure how context is to be used here
> 
> It has to be a value that’s unique to the piece of code that tests it. In 
> effect, this means unique to the class that creates and responds to the 
> observations. If you’re in Obj-C, the usual trick is to use the static 
> address of something, like this:
> 
>> static void* kvoContext = &kvoContext;
> 
> This exploits a quirk of C to initialize the static variable as containing 
> its own address. That means you can specify the ‘context:’ parameter as 
> EITHER ‘kvoContext’ OR ‘&kvoContext’, so that forgetting the & is harmless.
> 
> 
Okay...  It appears that for some odd reason, once in a blue moon, 'object' and 
'keyPath' aren't what they're supposed to be, so I super it, and it blows.

- (void) observeValueForKeyPath:(NSString *)keyPath 
   ofObject:(id)object 
 change:(NSDictionary *)change 
context:(void *)context
{
if ((object == uploadQueue) && [keyPath isEqualToString:@"operations"]) {
[self performSelectorOnMainThread:@selector(displayQueueInfo)
withObject:nil 
 waitUntilDone:NO];
} else {
[super observeValueForKeyPath:keyPath 
  ofObject:object 
change:change 
   context:context];
}
}

I will set 'context' and use it in my check instead.
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 4:39 PM, Quincey Morris 
>  wrote:
> 
> On May 10, 2016, at 16:22 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I will set 'context' and use it in my check instead.
> 
> Yup, use the context to decide whether to call super *and return* but nothing 
> else. Once you get past that check, don’t call super.
> 
>>  It appears that for some odd reason, once in a blue moon, 'object' and 
>> 'keyPath' aren't what they're supposed to be,
> 
> It’s not odd, if they’re the object and keyPath of a different observation 
> registered by a superclass of your class. You’ve proved it happens!
> 

Now that I've changed things over to use the context value, I get this at the 
moment I add an NSOperation to the NSOperationQueue:

[uploadQueue addOperation:opn]; <-- Thread 1, EXC_BAD_ADDRESS (code=1, 
address=0xc)

(lldb) po uploadQueue
{name = 'Upload Queue'}

(lldb) po opn


(lldb) bt
* thread #1: tid = 0x207807, 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6, stop 
reason = EXC_BAD_ACCESS (code=1, address=0xc)
frame #0: 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6
frame #1: 0x2151e27e Foundation`-[NSObject(NSKeyValueObservingPrivate) 
_changeValueForKeys:count:maybeOldValuesDict:usingBlock:] + 278
frame #2: 0x214822d0 Foundation`-[NSObject(NSKeyValueObservingPrivate) 
_changeValueForKey:key:key:usingBlock:] + 68
frame #3: 0x2152f760 Foundation`__addOperations + 1528
  * frame #4: 0x000ac9b4 iApp`-[AppSetupConfigViewController 
saveAppSettings:](self=0x17ed4e20, _cmd="saveAppSettings:", sender=0x17ed2200) 
+ 5776 at AppSetupConfigViewController.m:275
frame #5: 0x25322520 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 
80
frame #6: 0x253224b0 UIKit`-[UIControl sendAction:to:forEvent:] + 64
frame #7: 0x2530a3ea UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 
466
frame #8: 0x25321dd0 UIKit`-[UIControl touchesEnded:withEvent:] + 616
frame #9: 0x25321a3e UIKit`-[UIWindow _sendTouchesForEvent:] + 646
frame #10: 0x2531a3c6 UIKit`-[UIWindow sendEvent:] + 642
frame #11: 0x252eac84 UIKit`-[UIApplication sendEvent:] + 204
frame #12: 0x252e9228 UIKit`_UIApplicationHandleEventQueue + 5016
frame #13: 0x20cdba66 
CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
frame #14: 0x20cdb656 CoreFoundation`__CFRunLoopDoSources0 + 454
frame #15: 0x20cd99be CoreFoundation`__CFRunLoopRun + 806
frame #16: 0x20c28288 CoreFoundation`CFRunLoopRunSpecific + 516
frame #17: 0x20c2807c CoreFoundation`CFRunLoopRunInMode + 108
frame #18: 0x22244af8 GraphicsServices`GSEventRunModal + 160
frame #19: 0x253532c4 UIKit`UIApplicationMain + 144
frame #20: 0x000c86c6 iApp`main(argc=1, argv=0x00327bd4) + 122 at main.m:14
(lldb) 

-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 4:55 PM, Carl Hoefs  
> wrote:
> 
> 
>> On May 10, 2016, at 4:39 PM, Quincey Morris 
>>  wrote:
>> 
>> On May 10, 2016, at 16:22 , Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>>> 
>>> I will set 'context' and use it in my check instead.
>> 
>> Yup, use the context to decide whether to call super *and return* but 
>> nothing else. Once you get past that check, don’t call super.
>> 
>>> It appears that for some odd reason, once in a blue moon, 'object' and 
>>> 'keyPath' aren't what they're supposed to be,
>> 
>> It’s not odd, if they’re the object and keyPath of a different observation 
>> registered by a superclass of your class. You’ve proved it happens!
>> 
> 
> Now that I've changed things over to use the context value, I get this at the 
> moment I add an NSOperation to the NSOperationQueue:
> 
>[uploadQueue addOperation:opn]; <-- Thread 1, EXC_BAD_ADDRESS (code=1, 
> address=0xc)
> 
> (lldb) po uploadQueue
> {name = 'Upload Queue'}
> 
> (lldb) po opn
> 
> 
> (lldb) bt
> * thread #1: tid = 0x207807, 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6, 
> stop reason = EXC_BAD_ACCESS (code=1, address=0xc)
>frame #0: 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6
>frame #1: 0x2151e27e Foundation`-[NSObject(NSKeyValueObservingPrivate) 
> _changeValueForKeys:count:maybeOldValuesDict:usingBlock:] + 278
>frame #2: 0x214822d0 Foundation`-[NSObject(NSKeyValueObservingPrivate) 
> _changeValueForKey:key:key:usingBlock:] + 68
>frame #3: 0x2152f760 Foundation`__addOperations + 1528
>  * frame #4: 0x000ac9b4 iApp`-[AppSetupConfigViewController 
> saveAppSettings:](self=0x17ed4e20, _cmd="saveAppSettings:", 
> sender=0x17ed2200) + 5776 at AppSetupConfigViewController.m:275
>frame #5: 0x25322520 UIKit`-[UIApplication sendAction:to:from:forEvent:] + 
> 80
>frame #6: 0x253224b0 UIKit`-[UIControl sendAction:to:forEvent:] + 64
>frame #7: 0x2530a3ea UIKit`-[UIControl _sendActionsForEvents:withEvent:] + 
> 466
>frame #8: 0x25321dd0 UIKit`-[UIControl touchesEnded:withEvent:] + 616
>frame #9: 0x25321a3e UIKit`-[UIWindow _sendTouchesForEvent:] + 646
>frame #10: 0x2531a3c6 UIKit`-[UIWindow sendEvent:] + 642
>frame #11: 0x252eac84 UIKit`-[UIApplication sendEvent:] + 204
>frame #12: 0x252e9228 UIKit`_UIApplicationHandleEventQueue + 5016
>frame #13: 0x20cdba66 
> CoreFoundation`__CFRUNLOOP_IS_CALLING_OUT_TO_A_SOURCE0_PERFORM_FUNCTION__ + 14
>frame #14: 0x20cdb656 CoreFoundation`__CFRunLoopDoSources0 + 454
>frame #15: 0x20cd99be CoreFoundation`__CFRunLoopRun + 806
>frame #16: 0x20c28288 CoreFoundation`CFRunLoopRunSpecific + 516
>frame #17: 0x20c2807c CoreFoundation`CFRunLoopRunInMode + 108
>frame #18: 0x22244af8 GraphicsServices`GSEventRunModal + 160
>frame #19: 0x253532c4 UIKit`UIApplicationMain + 144
>frame #20: 0x000c86c6 iApp`main(argc=1, argv=0x00327bd4) + 122 at main.m:14
> (lldb) 

2016-05-10 16:58:36.066 iApp[2549:2131821] *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: '(
"; target= <(action=oneFingerDoubleTap:, 
target=)>; numberOfTapsRequired = 2>",
"; target= <(action=tapAndAHalf:, 
target=)>>",
"; target= <(action=oneFingerTap:, 
target=)>>",
"; target= 
<(action=loupeGesture:, target=)>>"
): An -observeValueForKeyPath:ofObject:change:context: message was received but 
not handled.
Key path: operations
Observed object: {name = 'Upload Queue'}
Change: {
kind = 1;
}
Context: 0x1c7bb0'
*** First throw call stack:
(0x20d19b8b 0x204d6dff 0x20d19ad1 0x2151cd7d 0x214a3d81 0x21482fe3 0x21482c3b 
0x2151e311 0x214822d1 0x2152f761 0xf89b5 0x25322521 0x253224b1 0x2530a3eb 
0x25321dd1 0x25321a3f 0x2531a3c7 0x252eac85 0x252e9229 0x20cdba67 0x20cdb657 
0x20cd99bf 0x20c28289 0x20c2807d 0x22244af9 0x253532c5 0x1146c7 0x208d4873)
libc++abi.dylib: terminating with uncaught exception of type NSException

BTW, if I remove the addObserver code, this doesn't happen.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 5:04 PM, Quincey Morris 
>  wrote:
> 
> On May 10, 2016, at 16:43 , Roland King  > wrote:
>> 
>> Well no he hasn’t
> 
> Correct … no he hasn’t. I mis-edited a longer draft of the post.
> 
>> Now that I've changed things over to use the context value, I get this at 
>> the moment I add an NSOperation to the NSOperationQueue:
>> 
>> [uploadQueue addOperation:opn]; <-- Thread 1, EXC_BAD_ADDRESS (code=1, 
>> address=0xc)
>> 
>> (lldb) po uploadQueue
>> {name = 'Upload Queue'}
>> 
>> (lldb) po opn
>> 
>> 
>> (lldb) bt
>> * thread #1: tid = 0x207807, 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6, 
>> stop reason = EXC_BAD_ACCESS (code=1, address=0xc)
>> frame #0: 0x204e3a86 libobjc.A.dylib`objc_msgSend + 6
>> frame #1: 0x2151e27e Foundation`-[NSObject(NSKeyValueObservingPrivate) 
>> _changeValueForKeys:count:maybeOldValuesDict:usingBlock:] + 278
>> frame #2: 0x214822d0 Foundation`-[NSObject(NSKeyValueObservingPrivate) 
>> _changeValueForKey:key:key:usingBlock:] + 68
> 
> It’s in the middle of handling a change notification. I’d suggest setting a 
> breakpoint at the top of your ‘observeValueForKeyPath:…’ method.
> 

Hmm, I think I may see what the problem is. I assumed 
-dismissViewControllerAnimated: would end up invoking -prepareForSegue: but it 
doesn't, so my -removeObserver: call never got invoked. So when transitioning 
to another ViewController, it would still KVO notify the original VC which was 
no longer being presented.

Adding -removeObserver: to both places seems to have solved this.
-Carl
 
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Receiver type for instance message is a forward declaration

2016-05-10 Thread Carl Hoefs

> On May 10, 2016, at 5:16 PM, Roland King  wrote:
> 
>> 
>> 2016-05-10 16:58:36.066 iApp[2549:2131821] *** Terminating app due to 
>> uncaught exception 'NSInternalInconsistencyException', reason: '(
>>"> NO; view = ; target= <(action=oneFingerDoubleTap:, 
>> target=)>; numberOfTapsRequired = 2>",
>>"> ; target= <(action=tapAndAHalf:, 
>> target=)>>",
>>"> NO; view = ; target= <(action=oneFingerTap:, 
>> target=)>>",
>>"> delaysTouchesEnded = NO; view = ; target= 
>> <(action=loupeGesture:, target=)>>"
>> ): An -observeValueForKeyPath:ofObject:change:context: message was received 
>> but not handled.
>> Key path: operations
>> Observed object: {name = 'Upload Queue'}
>> Change: {
>>kind = 1;
>> }
>> Context: 0x1c7bb0'
>> *** First throw call stack:
>> (0x20d19b8b 0x204d6dff 0x20d19ad1 0x2151cd7d 0x214a3d81 0x21482fe3 
>> 0x21482c3b 0x2151e311 0x214822d1 0x2152f761 0xf89b5 0x25322521 0x253224b1 
>> 0x2530a3eb 0x25321dd1 0x25321a3f 0x2531a3c7 0x252eac85 0x252e9229 0x20cdba67 
>> 0x20cdb657 0x20cd99bf 0x20c28289 0x20c2807d 0x22244af9 0x253532c5 0x1146c7 
>> 0x208d4873)
>> libc++abi.dylib: terminating with uncaught exception of type NSException
>> 
>> BTW, if I remove the addObserver code, this doesn't happen.
>> -Carl
> 
> Rather hard to tell but that seems to be hinting that the object not handling 
> the KVO is a UITextTapRecognizer. But that may just be an artefact of what’s 
> getting printed out. 
> 
> But I’ll ask the question I asked earlier
> 
> "Are you getting the warning anywhere in your debug logs that an object was 
> deallocated whilst still having KVO notifications registered on it? That 
> explicitly tells you that the KVO notifications can get attached to the wrong 
> object.”. 
> 
> because it looks here as if something was deallocated with KVO still attached 
> to it and now your KVO calls are going somewhere incorrect. 

Yes, I think it's because I didn't remove the observation when segueing to 
another VC.
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs
In iOS 9.3, I have a UIView that displays a graph, and the view is pinchable. 
That works fine but I want to programmatically pinch the UIView so the default 
display initially shows the graph a bit smaller. How can I do this? 
Alternately, I've tried setting self.view.contentScaleFactor but this property 
seems to have no effect.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs

> On May 11, 2016, at 1:38 PM, David Duncan  wrote:
> 
>> On May 11, 2016, at 1:32 PM, Carl Hoefs  
>> wrote:
>> 
>> In iOS 9.3, I have a UIView that displays a graph, and the view is 
>> pinchable. That works fine but I want to programmatically pinch the UIView 
>> so the default display initially shows the graph a bit smaller. How can I do 
>> this? Alternately, I've tried setting self.view.contentScaleFactor but this 
>> property seems to have no effect.
> 
> contentScaleFactor determines the pixel : point relationship when using 
> -drawRect: on a view. You want to set the transform for something like this 
> (note that this will affect the view’s frame as well).

Right, I was hoping there was a way to initially programmatically pinch the 
view down by 10%, so the view's frame isn't reduced as well. Then the user can 
pinch it to zoom in/out as desired.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs
On May 11, 2016, at 1:45 PM, Carl Hoefs  wrote:
> 
>> On May 11, 2016, at 1:38 PM, David Duncan  wrote:
>> 
>>> On May 11, 2016, at 1:32 PM, Carl Hoefs  
>>> wrote:
>>> 
>>> In iOS 9.3, I have a UIView that displays a graph, and the view is 
>>> pinchable. That works fine but I want to programmatically pinch the UIView 
>>> so the default display initially shows the graph a bit smaller. How can I 
>>> do this? Alternately, I've tried setting self.view.contentScaleFactor but 
>>> this property seems to have no effect.
>> 
>> contentScaleFactor determines the pixel : point relationship when using 
>> -drawRect: on a view. You want to set the transform for something like this 
>> (note that this will affect the view’s frame as well).
> 
> Right, I was hoping there was a way to initially programmatically pinch the 
> view down by 10%, so the view's frame isn't reduced as well. Then the user 
> can pinch it to zoom in/out as desired.

Would it help if I changed my UIView to be a UIScrollView instead? Then I could 
use -setZoomScale:.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs

> On May 11, 2016, at 1:51 PM, Carl Hoefs  
> wrote:
> 
> On May 11, 2016, at 1:45 PM, Carl Hoefs  
> wrote:
>> 
>>> On May 11, 2016, at 1:38 PM, David Duncan  wrote:
>>> 
>>>> On May 11, 2016, at 1:32 PM, Carl Hoefs  
>>>> wrote:
>>>> 
>>>> In iOS 9.3, I have a UIView that displays a graph, and the view is 
>>>> pinchable. That works fine but I want to programmatically pinch the UIView 
>>>> so the default display initially shows the graph a bit smaller. How can I 
>>>> do this? Alternately, I've tried setting self.view.contentScaleFactor but 
>>>> this property seems to have no effect.
>>> 
>>> contentScaleFactor determines the pixel : point relationship when using 
>>> -drawRect: on a view. You want to set the transform for something like this 
>>> (note that this will affect the view’s frame as well).
>> 
>> Right, I was hoping there was a way to initially programmatically pinch the 
>> view down by 10%, so the view's frame isn't reduced as well. Then the user 
>> can pinch it to zoom in/out as desired.
> 
> Would it help if I changed my UIView to be a UIScrollView instead? Then I 
> could use -setZoomScale:.

I just tried UIScrollView & -setZoomScale:. No effect.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs

> On May 11, 2016, at 2:08 PM, Quincey Morris 
>  wrote:
> 
> On May 11, 2016, at 13:56 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I just tried UIScrollView & -setZoomScale:. No effect.
> 
> I think you’re flailing now. ;)
> 
>> I was hoping there was a way to initially programmatically pinch the view 
>> down by 10%, so the view's frame isn't reduced as well
> 
> You can’t make a view smaller without making it … smaller. Perhaps you’re not 
> distinguishing the frame from the bounds? If you apply a 10% reduction to a 
> 100 x 100 view via a transform, its frame will be 90 x 90, but its bounds 
> will still be 100 x 100.
> 
>> Would it help if I changed my UIView to be a UIScrollView instead?
> 
> Well, you wouldn’t change your custom UIView to *be* a UIScrollView, but you 
> might place your custom UIView *inside* a UIScrollView. Setting the zoomScale 
> on a scroll view changes the transform on the content subviews, not on the 
> scroll view itself. But wouldn’t you have a zoomable custom view inside a 
> scroll view anyway? How else do you plan for the user to pan around when it’s 
> zoomed in?
> 
>> I was hoping there was a way to initially programmatically pinch the view 
>> down by 10%
> 
> You could, I suppose, scale your content drawing, rather than scaling the 
> view. In that case, you’d need to put the pinch gesture recognizer on your 
> view, save the calculated scale factor every time the recognizer changes 
> state, and redraw your view in drawRect: using the saved scale. But that’s 
> the functionality that UIScrollView is generally designed to provide for you.
> 
Okay, I'm a little confused... the UIView that's currently there handles pinch 
zoom in/out fine. Is there a way to programmatically cause a 'pinch zoom out by 
10%'? Do you mean that the only way to accomplish this is to have fingers touch 
the screen?
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Programmatically pinch a UIView

2016-05-11 Thread Carl Hoefs

> On May 11, 2016, at 2:33 PM, Quincey Morris 
>  wrote:
> 
> On May 11, 2016, at 14:14 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> the UIView that's currently there handles pinch zoom in/out fine. 
> 
> You should at this point explain what mechanism you’re using to do this.
> 
Indeed! I took another look at the gesture recognizer code I had for the UIView 
subclass, and I simply made an additional method that issued a scale via the 
same means but by a supplied zoom factor (as opposed to calculating it from the 
touch points). Voila!

Thanks for the sagely advice, Quincey. I woulda kept on flailing otherwise... 
:-)
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Recurrent background thread

2016-05-13 Thread Carl Hoefs
I want a method running on a background thread to reissue itself after it is 
done processing. How can I do this?

I'm using the following code but it runs just once and is never heard from 
again...

// initial invocation from main thread
[self performSelectorInBackground:@selector(_checkSensor:) withObject:@50];


// target method on background thread
-(void)_checkSensor:(NSNumber *)delaySecs
{
// check sensor...
// processing...

// reschedule
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:_cmd 
object:nil];
[self performSelector:_cmd withObject:nil afterDelay: delaySecs];
}

As a test, the above works if run on the main thread, so I'm guessing it has 
something to do with there being no runloop after the background thread exits. 
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Recurrent background thread

2016-05-13 Thread Carl Hoefs
Thanks! I knew I was doing it the /old/ way!
-Carl


> On May 13, 2016, at 12:56 PM, Doug Hill  wrote:
> 
> I’ve had luck using dispatch queues to accomplish recurring events, 
> specifically dispatch_after. For example:
> 
> - (void) doStuffAfterDelay
> {
>dispatch_queue_t theQueue = dispatch_queue_create("Recurring work queue", 
> DISPATCH_QUEUE_SERIAL);
> dispatch_time_t futureTime = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 
> * NSEC_PER_SEC));
> dispatch_after(futureTime, theQueue,
> ^{
> DoStuff();
> 
> [self doStuffAfterDelay];
> ;});
> }
> 
> You can also use an NSTimer that repeats, such as:
> 
> NSTimeInterval delaySecs = 5;
> self.timer = [NSTimer scheduledTimerWithTimeInterval:delaySecs
>   target:self selector:@selector(doStuff:)
>   userInfo:nil repeats:YES];
> 
> Hope this helps.
> 
> Doug Hill
> 
> 
>> On May 13, 2016, at 12:34 PM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I want a method running on a background thread to reissue itself after it is 
>> done processing. How can I do this?
>> 
>> I'm using the following code but it runs just once and is never heard from 
>> again...
>> 
>>// initial invocation from main thread
>>[self performSelectorInBackground:@selector(_checkSensor:) 
>> withObject:@50];
>> 
>> 
>> // target method on background thread
>> -(void)_checkSensor:(NSNumber *)delaySecs
>> {
>>// check sensor...
>>// processing...
>> 
>>// reschedule
>>[NSObject cancelPreviousPerformRequestsWithTarget:self selector:_cmd 
>> object:nil];
>>[self performSelector:_cmd withObject:nil afterDelay: delaySecs];
>> }
>> 
>> As a test, the above works if run on the main thread, so I'm guessing it has 
>> something to do with there being no runloop after the background thread 
>> exits. 
>> -Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Emailing from a daemon process

2016-07-07 Thread Carl Hoefs
I have a daemon app built on Foundation (aka "command line tool") running in 
the background and I need it to issue a textual email on certain conditions. 

The solutions for emailing that I've been able to find (NSWorkspace, 
NSSharingService, LSOpenCFURLRef) all involve launching an email client like 
Mail.app, which is inappropriate for a backgraound daemon process.

Is there a way to fire off a simple email from an ObjC Foundation-only app 
running in the background on OS X 10.10.5 (not Server)? I'm told that ages ago 
there was a handly class named NSMailDelivery, but it's long gone...

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:33 AM, Jens Alfke  wrote:
> 
>> On Jul 7, 2016, at 9:13 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I have a daemon app built on Foundation (aka "command line tool") running in 
>> the background and I need it to issue a textual email on certain conditions. 
> 
> Do you mean daemon or agent? A daemon runs outside of any user login session 
> and is usually started at boot time. An agent has no UI but is part of the 
> login session. This is significant, because an agent process can communicate 
> with GUI apps using AppleEvents or XPC.

It's a daemon, started at boot time and runs outside of a user login. Even so, 
it wouldn't be appropriate to communicate with a GUI app, which still requires 
user intervention, if only to press the Send button.

> 
> There isn’t any easy way of doing this that I know of, if you can’t tell 
> Mail.app to do it. There are built-in Postfix mail tools, but they’re not 
> configured for relaying mail to a server. You’d have to talk to the SMTP 
> server yourself, but that involves reading the user prefs to get the server 
> configuration, and likely finding credentials to log in with… (There might be 
> a 3rd party library for doing this, though.)

It seems a bit odd to me that I can connect all sorts of little network devices 
(webcams, network monitors, remote power switches, etc) to a LAN and they can 
all be set to issue email. I didn't really want to go 3rd party, as there is a 
yearly cost to the only package I could find (which is just a dylib, not 
source).

-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:55 AM, Jens Alfke  wrote:
> 
> 
>> On Jul 7, 2016, at 9:44 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> It seems a bit odd to me that I can connect all sorts of little network 
>> devices (webcams, network monitors, remote power switches, etc) to a LAN and 
>> they can all be set to issue email.
> 
> The manufacturers are probably running their own SMTP servers, and the 
> devices either talk to those directly, or (more likely) send HTTP requests to 
> the manufacturer’s web server, which then formats the email and sends it to 
> the SMTP server.

I seem to recall that in the distant past I accomplished issuing emails from a 
daemon process on Linux by directly interfacing to /usr/sbin/sendmail. Is this 
the 'Postfix mail tools' you mentioned?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Emailing from a daemon process

2016-07-07 Thread Carl Hoefs

> On Jul 7, 2016, at 9:55 AM, Jens Alfke  wrote:
> 
> 
>> On Jul 7, 2016, at 9:44 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> It seems a bit odd to me that I can connect all sorts of little network 
>> devices (webcams, network monitors, remote power switches, etc) to a LAN and 
>> they can all be set to issue email.
> 
> The manufacturers are probably running their own SMTP servers, and the 
> devices either talk to those directly, or (more likely) send HTTP requests to 
> the manufacturer’s web server, which then formats the email and sends it to 
> the SMTP server.

Yes, this seems to be correct. I just checked such emails and I see the 
manufacturers usually exploit gmail for this purpose (and I have no gmail 
account).

Received: from localhost ([72.87.216.146]) by smtp.gmail.com 
<http://smtp.gmail.com/>

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Vertical orientation of UISlider

2016-07-20 Thread Carl Hoefs
iOS 9

Is there a way to change the orientation of a UISlider to vertical instead of 
horizontal?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Vertical orientation of UISlider

2016-07-20 Thread Carl Hoefs
Something like this?

slider.transform = CGAffineTransformMakeRotation(M_PI * 0.5);

I was looking for the obvious, a simple property like slider.orientation or 
some such.
-Carl


> On Jul 20, 2016, at 11:55 AM, Jeff Kelley  wrote:
> 
> Hi Carl,
> 
>   Have you tried applying a transform to the slider? A simple rotation 
> should do the trick.
> 
> 
> Jeff Kelley
> 
> slauncha...@gmail.com <mailto:slauncha...@gmail.com> | @SlaunchaMan 
> <https://twitter.com/SlaunchaMan> | jeffkelley.org <http://jeffkelley.org/>
>> On Jul 20, 2016, at 11:48 AM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> iOS 9
>> 
>> Is there a way to change the orientation of a UISlider to vertical instead 
>> of horizontal?
>> 
>> -Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Vertical orientation of UISlider

2016-07-20 Thread Carl Hoefs
Out of interest, I just tried swapping the slider's bounds size.width and 
size.height. It seems to have no effect.

The transform works; it rotates the control about its center point.
Thx!
-Carl

> On Jul 20, 2016, at 12:11 PM, Jens Alfke  wrote:
> 
> 
>> On Jul 20, 2016, at 12:02 PM, Carl Hoefs > <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> I was looking for the obvious, a simple property like slider.orientation or 
>> some such.
> 
> In AppKit, an NSSlider’s orientation is determined simply by whether its 
> bounds rectangle is longer than it’s wide, or vice versa. Is the same true of 
> UIKit?
> 
> —Jens

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Do Debug Apps Expire on iOS?

2016-07-22 Thread Carl Hoefs
Go to Window -> Devices -> View Device Logs

-Carl


> On Jul 22, 2016, at 4:17 AM, Charles Jenkins  wrote:
> 
> Thank you all. I’ll start my research on how to find crash logs.
> 
> On Thu, Jul 21, 2016 at 10:30 AM, Roland King  wrote:
> 
>> 
>>> On 21 Jul 2016, at 22:15, Steve Bird  wrote:
>>> 
>>> 
 On Jul 21, 2016, at 10:05 AM, Eric E. Dolecki 
>> wrote:
 
 I believe that debug apps built directly to hardware have a shelf life
>> of
 one year. At least they did.
>>> 
>>> I don’t know, but I would hope that they would pop up some notice like
>> “This app has expired. Contact the developer for the current version”.
>>> 
>>> That would seem to be the polite thing to do, rather than driving off
>> into the ditch and staying there.
>> 
>> Debug apps expire when your debug provisioning profile expires, which you
>> should know because you renewed your membership.
>> 
>> TestFlight apps have a shorter lifetime to encourage developers to release
>> test versions on a regular basis and stop TestFlight just being an easy
>> mechanism for distributing private apps to your friends for a year at a
>> time.
>> 
>> So the original poster most likely has a bug.
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/cejwork%40gmail.com
>> 
>> This email sent to cejw...@gmail.com
>> 
> 
> 
> 
> -- 
> 
> Charles
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: array = [NSArray new] or array = [NSArray array]?

2016-08-19 Thread Carl Hoefs

> On Aug 19, 2016, at 1:46 PM, Quincey Morris 
>  wrote:
> 
> My point is that Apple might revisit the implementation of NSArray at any 
> time (in these Swiftian days, stranger things have happened), and choose to 
> write it with full ARC compatibility, which means there might not be any 
> autorelease when invoked from ARC client code, since ARC can optimize the 
> code when it handles both ends of the invocation.

This is true for other classes as well, such as [NSSet set], [NSDictionary 
dictionary], etc.  Interesting that doing something like [NSNumber new] returns 
nil.
-Carl



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Xcode 8 causes scroll issue when displaying keyboard

2016-10-11 Thread Carl Hoefs
Rick,

I think I may have encountered similar issues. -viewWillAppear: occurs very 
early in the view instantiation process, too early for certain things to 
execute successfully, and so it's likely that becomeFirstResponder() may not 
work properly or reliably from -viewWillAppear:. I solved my issues by using 
-viewDidAppear: or -viewDidLoad, both of which also execute on the main thread, 
but later in the view instantiation process.

-Carl

> On Oct 11, 2016, at 6:29 PM, Rick Mann  wrote:
> 
> Ah, it happens because we call becomeFirstResponder() on the first text field 
> while in viewWillAppear(). Dispatching that on the main queue asynchronously 
> fixes the problem, but ugh it's so hacky.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Obtaining the color of the screen at a known point

2016-11-05 Thread Carl Hoefs
I have an iOS app in which the user touches the screen, and I need to read the 
color of screen at the touched point. How can this be done in iOS 9.3? The only 
solution I could find uses CGDisplayCreateImageForRect() and 
CGDisplayAddressForPosition(), which apparently no longer exist.

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Obtaining the color of the screen at a known point

2016-11-05 Thread Carl Hoefs
On Nov 5, 2016, at 5:15 PM, Richard Charles  wrote:
> 
>> On Nov 5, 2016, at 5:50 PM, Carl Hoefs  
>> wrote:
>> 
>> I have an iOS app in which the user touches the screen, and I need to read 
>> the color of screen at the touched point. How can this be done in iOS 9.3?
> 
> OpenGL ES glReadPixels?

Thanks, that's the hint I was looking for! Got it working!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Documentation Workflow

2016-11-17 Thread Carl Hoefs
Fixing the layout of the documentation doesn't help the core problem, namely, 
the way in which it's organized. Each page is so sparse as to be almost 
worthless. You have to drill down 2, 3, 4 or more links to find the information 
that you want, dragging the reader through page after page...

Why not simply have all the relevant information on the page, where it belongs?

-Carl


> On Nov 17, 2016, at 8:38 AM, Alex Zavatone  wrote:
> 
> 
> On Nov 17, 2016, at 9:13 AM, Slipp Douglas Thompson wrote:
> 
>> No, you don't need to know HTML or CSS to get this to work.
>> 
>> Here's a basic step-by-step:
>> 
>> 1. Download & install the Stylish plugin/add-on/extension for your browser 
>> of choice.  The official userstyles.org Stylish is available for Chrome ( 
>> https://chrome.google.com/webstore/detail/stylish/fjnbnpbmkenffdnngjfgmeleoegfcffe?hl=en
>>  ) and Firefox ( https://addons.mozilla.org/en-us/firefox/addon/stylish/ ), 
>> though it looks like someone else made a Safari version ( 
>> http://sobolev.us/stylish/ ).
>> 2. Download the 2 files from that gist.
>> 3. Open up the Stylish plugin/add-on/extension's UI and click the import 
>> button, choose one file, then click import and choose the other file.
>> 4. Enjoy better layout/styling whenever you visit a URL matching 
>> `http[s]://developer.apple.com/reference/*`.  ;-)
>> 5 (optional). Stylish for Chrome allows you to toggle styles on & off for 
>> the current page by clicking the toolbar icon for the extension (to the 
>> right of the address bar; the Stylish extension's icon is an “S” in a 
>> 4-colored square), so you can decide on-the-fly if you really want to use 
>> these changes or not.  I'd imagine Stylish for other browsers works 
>> similarly.
>> 6 (optional). Modify the CSS to your liking.  The most obvious point of 
>> customization would be the `font-size: 10pt !important;` line— you can 
>> change the `10pt` to `12pt` or `24pt` or `6pt` or whatever other numerical 
>> font size you please.
>> 
> 
> Oh, man.  What a godsend.  No more UI that looks like it was a graphic design 
> major's "testing limits" project.
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS

2016-12-06 Thread Carl Hoefs
I get the following crash in my iOS 9 app simply by adding a CALayer to the 
current view controller's self.view.layer and then dismissing the current view 
controller. Simplified code:

@property (strong,nonatomic) CALayer *layer;
.  .  .
_layer = [[CALayer alloc] init];
[_layer setDelegate: self];
[self.view.layer addSublayer:_layer];

Upon dismissing the VC:

[self dismissViewControllerAnimated:YES completion:nil];

The following exception occurs:

(lldb) bt
* thread #1: tid = 0x121bd, 0x22c2c68a libobjc.A.dylib`objc_retain + 10, queue 
= 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, 
address=0xb010)
frame #0: 0x22c2c68a libobjc.A.dylib`objc_retain + 10
frame #1: 0x27a2a22a UIKit`-[UIView(Hierarchy) subviews] + 330
frame #2: 0x27b3e1ea UIKit`discardEngineRecursive + 118
frame #3: 0x27a2fd06 UIKit`-[UIView dealloc] + 630
frame #4: 0x2336cd98 CoreFoundation`-[__NSDictionaryM dealloc] + 132
frame #5: 0x22c2cf8a libobjc.A.dylib`objc_object::sidetable_release(bool) + 
150
frame #6: 0x22c2d3cc libobjc.A.dylib`(anonymous 
namespace)::AutoreleasePoolPage::pop(void*) + 388
frame #7: 0x23363f30 CoreFoundation`_CFAutoreleasePoolPop + 16
frame #8: 0x23415c56 CoreFoundation`__CFRunLoopRun + 1598
frame #9: 0x233641c8 CoreFoundation`CFRunLoopRunSpecific + 516
frame #10: 0x23363fbc CoreFoundation`CFRunLoopRunInMode + 108
frame #11: 0x24980af8 GraphicsServices`GSEventRunModal + 160
frame #12: 0x27a9c434 UIKit`UIApplicationMain + 144
  * frame #13: 0x001b655e ProteinFold`main(argc=1, argv=0x0043bbc8) + 122 at 
main.m:14

If I remove the CALayer first before the 
-dismissViewControllerAnimated:completion:, it doesn't crash:

[layer removeFromSuperlayer];

Why do I need to explicitly remove my added CALayer before dismissing the VC? 
Note: If I declare layer as weak, the crash does not occur, but neither does 
the layer display onscreen.
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS

2016-12-06 Thread Carl Hoefs
FWIW, it still crashes if I change the code to use self.layer instead of _layer:

   @property (strong,nonatomic) CALayer *layer;
   .  .  .
   self.layer = [[CALayer alloc] init];
   [self.layer setDelegate: self];
   [self.view.layer addSublayer:self.layer];

-Carl

> On Dec 6, 2016, at 12:51 PM, Doug Hill  wrote:
> 
> I've wondered about this before, but maybe some Objective-C runtime experts 
> know.
> 
> Does writing directly to the ivar backing a property bypass the ARC features 
> of the property. For example, will a strong property be retained if you write 
> directly to the ivar?
> 
> If not, that's your problem.
> 
> Doug
> 
>> On Dec 6, 2016, at 11:44 AM, Carl Hoefs  
>> wrote:
>> 
>> I get the following crash in my iOS 9 app simply by adding a CALayer to the 
>> current view controller's self.view.layer and then dismissing the current 
>> view controller. Simplified code:
>> 
>>   @property (strong,nonatomic) CALayer *layer;
>>   .  .  .
>>   _layer = [[CALayer alloc] init];
>>   [_layer setDelegate: self];
>>   [self.view.layer addSublayer:_layer];
>> 
>> Upon dismissing the VC:
>> 
>>   [self dismissViewControllerAnimated:YES completion:nil];
>> 
>> The following exception occurs:
>> 
>> (lldb) bt
>> * thread #1: tid = 0x121bd, 0x22c2c68a libobjc.A.dylib`objc_retain + 10, 
>> queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=1, 
>> address=0xb010)
>>   frame #0: 0x22c2c68a libobjc.A.dylib`objc_retain + 10
>>   frame #1: 0x27a2a22a UIKit`-[UIView(Hierarchy) subviews] + 330
>>   frame #2: 0x27b3e1ea UIKit`discardEngineRecursive + 118
>>   frame #3: 0x27a2fd06 UIKit`-[UIView dealloc] + 630
>>   frame #4: 0x2336cd98 CoreFoundation`-[__NSDictionaryM dealloc] + 132
>>   frame #5: 0x22c2cf8a libobjc.A.dylib`objc_object::sidetable_release(bool) 
>> + 150
>>   frame #6: 0x22c2d3cc libobjc.A.dylib`(anonymous 
>> namespace)::AutoreleasePoolPage::pop(void*) + 388
>>   frame #7: 0x23363f30 CoreFoundation`_CFAutoreleasePoolPop + 16
>>   frame #8: 0x23415c56 CoreFoundation`__CFRunLoopRun + 1598
>>   frame #9: 0x233641c8 CoreFoundation`CFRunLoopRunSpecific + 516
>>   frame #10: 0x23363fbc CoreFoundation`CFRunLoopRunInMode + 108
>>   frame #11: 0x24980af8 GraphicsServices`GSEventRunModal + 160
>>   frame #12: 0x27a9c434 UIKit`UIApplicationMain + 144
>> * frame #13: 0x001b655e ProteinFold`main(argc=1, argv=0x0043bbc8) + 122 at 
>> main.m:14
>> 
>> If I remove the CALayer first before the 
>> -dismissViewControllerAnimated:completion:, it doesn't crash:
>> 
>>   [layer removeFromSuperlayer];
>> 
>> Why do I need to explicitly remove my added CALayer before dismissing the 
>> VC? Note: If I declare layer as weak, the crash does not occur, but neither 
>> does the layer display onscreen.
>> -Carl
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40breaqz.com
>> 
>> This email sent to cocoa...@breaqz.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS

2016-12-06 Thread Carl Hoefs

> On Dec 6, 2016, at 1:24 PM, David Duncan  wrote:
> 
> Your safest bets are to either clear the delegate of the layer at an 
> appropriate time (possibly in your view controller’s dealloc is all that is 
> necessary), or to use a UIView instead of a raw CALayer in this case. 
> Removing the layer would also suffice, as that would prevent UIKit from 
> seeing it at the time in question. Making the layer weak is probably causing 
> your reference to deallocate before it can be added to the layer tree, which 
> is why it doesn’t display in that case.

Thanks for this explanation, David! 

I've verified that using either of:
[self.layer setDelegate:nil];
or
[self.layer removeFromSuperlayer];
will prevent the crash. It's just a bit
surprising to me that this is needed...

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS 9: Adding CALayer to self.view.layer causes EXC_BAD_ACCESS

2016-12-06 Thread Carl Hoefs

> On Dec 6, 2016, at 1:33 PM, Carl Hoefs  wrote:
> 
>> On Dec 6, 2016, at 1:24 PM, David Duncan  wrote:
>> 
>> Your safest bets are to either clear the delegate of the layer at an 
>> appropriate time (possibly in your view controller’s dealloc is all that is 
>> necessary), or to use a UIView instead of a raw CALayer in this case. 
>> Removing the layer would also suffice, as that would prevent UIKit from 
>> seeing it at the time in question. Making the layer weak is probably causing 
>> your reference to deallocate before it can be added to the layer tree, which 
>> is why it doesn’t display in that case.
> 
> Thanks for this explanation, David! 
> 
> I've verified that using either of:
>[self.layer setDelegate:nil];
> or
>[self.layer removeFromSuperlayer];
> will prevent the crash. 

Followup: It turns out that the 'offending' line of code is:

  [self.layer setDelegate:self];

If I don't set this, everything still works correctly, and there's no crash at 
dealloc time.

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Documentation Workflow

2016-12-06 Thread Carl Hoefs

> On Dec 3, 2016, at 11:52 AM, Richard Charles  wrote:
> 
>> On Dec 2, 2016, at 11:34 AM, Slipp Douglas Thompson 
>>  wrote:
>> 
>> Alternatively, there's always archive.org's Wayback Machine.
> 
>> Since developer.apple.com's URL paths have changed quite a bit with the 
>> recent narrow-body-giant-text-ification, I plugged 
>> https://developer.apple.com/library/ios/navigation/ into the Wayback Machine 
>> ( https://developer.apple.com/library/mac/navigation/ also works), chose a 
>> capture date a couple years ago, and then used the “Documents [ 
>> ] 4293 of 4293” search input to find the doc I was looking for.
> 
> It appears that October 21, 2014 was the last archive date for old style iOS 
> documentation and content.
> 
> It appears that November 5, 2015 was the last archive date for old style mac 
> documentation and content.
> 
> This would be a good starting point if you are looking for something older 
> that is now gone.
> 

Just now I was looking for a list of NSString method signatures to peruse. Is 
that now impossible? It seems all methods are shoveled onto a single mega-page 
called "Methods to Override", with full descriptions, but no there's no 
overview method list any more, as there is no disclosure triangle on the 
"Methods to Override" element in the left column. 

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: My app only shows a black screen in the recent apps list

2016-12-30 Thread Carl Hoefs

> On Dec 30, 2016, at 12:34 PM, David Duncan  wrote:
> 
> Honestly, just remove UIApplicationExistsOnSuspend. Its simply not a behavior 
> that is expected of modern iOS applications.

True in general, but UIApplicationExitsOnSuspend is useful for multi-user 
professional apps (such as medical apps associated with hardware). Otherwise 
there is the potential of a different user reactivating the app without having 
to log into it, and thus gaining access to private information.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: My app only shows a black screen in the recent apps list

2016-12-30 Thread Carl Hoefs

> On Dec 30, 2016, at 4:00 PM, Quincey Morris 
>  wrote:
> 
> On Dec 30, 2016, at 13:58 , Carl Hoefs  <mailto:newsli...@autonomy.caltech.edu>> wrote:
>> 
>> UIApplicationExitsOnSuspend is useful for multi-user professional apps (such 
>> as medical apps associated with hardware). Otherwise there is the potential 
>> of a different user reactivating the app without having to log into it, and 
>> thus gaining access to private information.
> 
> This makes no sense to me. You could implement 
> application-logs-out-on-suspend behavior yourself. I can’t see any added 
> value in making the process quit too.
> 
> Secondarily, this isn’t very secure in itself. There is also the potential of 
> the current user walking away from the iOS device, leaving the app in the 
> foreground. Presumably, you *also* rely on an activity timeout to trigger a 
> log-out, and in that case it’s not clear what added value you get from 
> logging out on suspend.
> 
I didn't mean to imply that that's the only mechanism at play. Just that it's a 
useful one.
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS database within sandbox

2014-08-23 Thread Carl Hoefs
Wow, I didn’t realize there were so many options. I’ll be looking into all of 
these (SQLite, CoreData, FMDB, Realm) to see which fits into my project's 
design best (and which appeals to me).

Thanks for all the great suggestions!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: iOS database within sandbox

2014-08-23 Thread Carl Hoefs

On Aug 23, 2014, at 9:23 AM, Glenn L. Austin  wrote:

> CoreData is not a database (according to Marcus Zarra -- and he should know). 
>  Even though it *can* use an SQLite data store (and most people do that), it 
> doesn't depend upon SQLite functionality.

However, specifically on iOS, I take it that SQLite is the *only* database 
available, the other items (CoreData, FMDB, Realm, YapDatabase) being 
object-management abstractions built atop it?

-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Scaling an NSImage to have exact pixel dimensions

2014-10-09 Thread Carl Hoefs
OS X 10.9

I need to scale an NSImage's dimensions to exactly 640x480 pixels before 
sending it remotely for processing. If I use NSImage's -setSize:(NSSize) 
method, it does set the size - temporarily. If I then try to serialize that 
NSImage into an NSData for transfer, that resize information seems to get lost:

NSImage *oldImage = [[NSImage alloc] initWithContentsOfFile:myFilename];
[oldImage setSize:NSMakeSize(640.0,480.0)];
NSLog(@"Old Image: %@",oldImage);

NSData *dataObj = [oldImage 
TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0 ];
NSImage *newImage = [[NSImage alloc ] initWithData:dataObj];
NSLog(@"New Image: %@",newImage);


* Old Image: 

 * New Image: 

What is the correct way to do this?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scaling an NSImage to have exact pixel dimensions

2014-10-09 Thread Carl Hoefs

On Oct 9, 2014, at 8:05 PM, Ken Thomases  wrote:

> On Oct 9, 2014, at 9:08 PM, Carl Hoefs  wrote:
> 
>> I need to scale an NSImage's dimensions to exactly 640x480 pixels before 
>> sending it remotely for processing.
> 
>> What is the correct way to do this?
> 
> Create an NSBitmapImageRep with the appropriate properties.  Create an 
> NSGraphicsContext from that bitmap image rep using +[NSGraphicsContext 
> graphicsContextWithBitmapImageRep:].  Make that graphics context current.  
> Draw the image.  Flush and restore the graphics context.  Get the data from 
> the bitmap image rep in an image file format using 
> -representationUsingType:properties: or (if you really want TIFF) 
> -TIFFRepresentationUsingCompression:factor:.

Awesome pointers, I got it to work! The tricky part was the actual scaling. It 
would crop but not scale, so resorted to using CIImage. If there’s a cleaner 
way, please let me know!

NSRect imgRect = NSMakeRect(0.0, 0.0, 640.0, 480.0);
NSSize imgSize = imgRect.size;
NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc]
   initWithBitmapDataPlanes:NULL
 pixelsWide:imgSize.width
 pixelsHigh:imgSize.height
  bitsPerSample:8
samplesPerPixel:4
   hasAlpha:YES
   isPlanar:NO
 
colorSpaceName:NSDeviceRGBColorSpace
   
bitmapFormat:NSAlphaFirstBitmapFormat

bytesPerRow:8*4*imgSize.width
   bitsPerPixel:32];
// set offscreen context
NSGraphicsContext *gc = [NSGraphicsContext 
graphicsContextWithBitmapImageRep:offscreenRep];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:gc];

// scale the image from cgRect down to imgRect
CIImage *ciImage = [CIImage imageWithData:dataObj];
CGRect cgRect = [ciImage extent];
[[gc CIContext] drawImage:ciImage inRect:imgRect fromRect:cgRect];

// reset the current context
[NSGraphicsContext restoreGraphicsState];

// create an NSImage and add the rep to it
NSImage *img = [[NSImage alloc] initWithSize:imgSize];
[img addRepresentation:offscreenRep];
NSLog(@"* Final Image: %@",img);


* Final Image: 

Thanks again!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Scaling an NSImage to have exact pixel dimensions

2014-10-10 Thread Carl Hoefs
On Oct 10, 2014, at 1:02 AM, Graham Cox  wrote:
> 
> // ... set up destination context ...
> 
> [[NSGraphicsContext currentContext] setImageInterpolation: 
> NSImageInterpolationHigh];
> [sourceImage drawInRect:dest fromRect:NSZeroRect operation:NSCompositeCopy 
> fraction:1.0 respectFlipped:YES hints:nil];
> 
> // ... clean up leaving NSBitMapImageRep alone...
> 
> NSData* imageData = [destBitMapRep representationUsingType:... properties:…];

Thanks Graham and Ken! You’re right, no need at all for the CIImage (flail) 
step. Here’s my cleaned-up code, combining both your inputs, works perfectly. 
Anything still superfluous here? 
-Carl

. . .
NSRect imgRect = NSMakeRect(0.0, 0.0, 640.0, 480.0);
NSBitmapImageRep *offscreenRep = [[NSBitmapImageRep alloc]
   initWithBitmapDataPlanes:NULL
 
pixelsWide:imgRect.size.width
 
pixelsHigh:imgRect.size.height
  bitsPerSample:8
samplesPerPixel:4
   hasAlpha:YES
   isPlanar:NO
 
colorSpaceName:NSDeviceRGBColorSpace
   
bitmapFormat:NSAlphaFirstBitmapFormat
bytesPerRow:0
   bitsPerPixel:32];
NSGraphicsContext *gc = [NSGraphicsContext 
graphicsContextWithBitmapImageRep:offscreenRep];
[NSGraphicsContext saveGraphicsState];
[NSGraphicsContext setCurrentContext:gc];
[[NSGraphicsContext currentContext] setImageInterpolation: 
NSImageInterpolationHigh];
[srcImage drawInRect:imgRect fromRect:NSZeroRect operation:NSCompositeCopy 
fraction:1.0 respectFlipped:YES hints:nil];
[NSGraphicsContext restoreGraphicsState];
NSData *dataObj = [offscreenRep representationUsingType:NSJPEGFileType 
properties:nil];
. . .

* Final NSImage: 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Background CIFilter processing?

2014-11-03 Thread Carl Hoefs
I’m developing a background daemon server process (Cocoa, OSX 10.10) that will 
process (analyze, segment, classify) an image sent to it on demand, and then 
send the processed image back to the client. For some operations, CIFilters 
would be ideal to use. However, CIFilters require the QuartzCore framework. 
Doesn't that also imply access to or ownership of the screen or GUI to render? 
If so, is there an alternate way to implement a background image processor?

-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Background CIFilter processing?

2014-11-03 Thread Carl Hoefs
Awesome! 

The only general restriction would be in using something like the Video Input 
patch, correct? As far as I can tell, that patch needs to render somewhere in 
real time or it outputs nothing. But my application is only for processing 
image data in memory.

-Carl

On Nov 3, 2014, at 1:37 PM, Tamas Nagy  wrote:

> No, CIFIlters should work fine in background processes.
> 
>> On 03 Nov 2014, at 21:29, Carl Hoefs  wrote:
>> 
>> I’m developing a background daemon server process (Cocoa, OSX 10.10) that 
>> will process (analyze, segment, classify) an image sent to it on demand, and 
>> then send the processed image back to the client. For some operations, 
>> CIFilters would be ideal to use. However, CIFilters require the QuartzCore 
>> framework. Doesn't that also imply access to or ownership of the screen or 
>> GUI to render? If so, is there an alternate way to implement a background 
>> image processor?
>> 
>> -Carl
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> https://lists.apple.com/mailman/options/cocoa-dev/tamas.lov.nagy%40gmail.com
>> 
>> This email sent to tamas.lov.n...@gmail.com
> 


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Background CIFilter processing?

2014-11-04 Thread Carl Hoefs
Thanks for the pointers, Tamas! Got it working by using [NSCIImageRep 
imageRepWithCIImage:] and then [NSImage addRepresentation:]

-Carl

On Nov 3, 2014, at 2:18 PM, Tamas Nagy  wrote:

> Well, no Video Input patch is exists with CIFilters, maybe you are talking 
> about Quartz Composer?
> 
> Anyway, you will need an OpenGL context for the CIFilters, but that should 
> not be a problem - just don’t forget to set the NSOpenGLPFAOffScreen 
> attribute when you will create your NSOpenGLContext instance. Or you can use 
> a CG context too - but that depends on where your image data come from.
> 
>> On 03 Nov 2014, at 21:48, Carl Hoefs  wrote:
>> 
>> Awesome! 
>> 
>> The only general restriction would be in using something like the Video 
>> Input patch, correct? As far as I can tell, that patch needs to render 
>> somewhere in real time or it outputs nothing. But my application is only for 
>> processing image data in memory.
>> 
>> -Carl
>> 
>> On Nov 3, 2014, at 1:37 PM, Tamas Nagy  wrote:
>> 
>>> No, CIFIlters should work fine in background processes.
>>> 
>>>> On 03 Nov 2014, at 21:29, Carl Hoefs  
>>>> wrote:
>>>> 
>>>> I’m developing a background daemon server process (Cocoa, OSX 10.10) that 
>>>> will process (analyze, segment, classify) an image sent to it on demand, 
>>>> and then send the processed image back to the client. For some operations, 
>>>> CIFilters would be ideal to use. However, CIFilters require the QuartzCore 
>>>> framework. Doesn't that also imply access to or ownership of the screen or 
>>>> GUI to render? If so, is there an alternate way to implement a background 
>>>> image processor?
>>>> 
>>>> -Carl
>>>> 
>>>> ___
>>>> 
>>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>>> 
>>>> Please do not post admin requests or moderator comments to the list.
>>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>>> 
>>>> Help/Unsubscribe/Update your Subscription:
>>>> https://lists.apple.com/mailman/options/cocoa-dev/tamas.lov.nagy%40gmail.com
>>>> 
>>>> This email sent to tamas.lov.n...@gmail.com
>>> 
>> 
> 

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Altering the size of UISlider's “slider ball”

2014-11-25 Thread Carl Hoefs
iOS 8
Is there some way (in IB or programmatically) to alter the size of the “slider 
ball” of a UISlider?
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Altering the size of UISlider's “slider ball”

2014-11-25 Thread Carl Hoefs

> On Nov 25, 2014, at 6:10 PM, Roland King  wrote:
> 
>> On 26 Nov 2014, at 9:58 am, Carl Hoefs  
>> wrote:
>> 
>> iOS 8
>> Is there some way (in IB or programmatically) to alter the size of the 
>> “slider ball” of a UISlider?
>> -Carl
>> 
> You can’t specify the size of it, no, but you can make an image of your own 
> the size, shape and colour you want and replace it entirely. Not ideal as it 
> changes from iOS release to release, the current one appears to be a white 
> circle with a thin grey border and a drop shadow, pretty easy to replicate, 
> could probably even generate the image in code if you wanted.

Got it to work using -setThumbImage: and -thumbRectForBounds:trackRect:value:
Thanks!
-Carl

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

UIImagePickerController confused by landscape-only layout

2014-12-17 Thread Carl Hoefs
How can I make the iOS 8 camera image picker (UIImagePickerController aka 
PLUICameraViewController) present properly in a landscape-only mode app? When I 
do this, the picker comes up in landscape mode but the camera image within it 
is displayed rotated by +90 degrees no matter the rotation of the iPhone. If I 
do snap an image, it does come out properly landscaped.

For -supportedInterfaceOrientationsForWindow: my app delegate returns 
UIInterfaceOrientationMaskAll. If I try returning 
UIInterfaceOrientationMaskLandscape the app crashes:

*** Terminating app due to uncaught exception 
'UIApplicationInvalidInterfaceOrientation', reason: 'Supported orientations has 
no common orientation with the application, and [PLUICameraViewController 
shouldAutorotate] is returning YES’

I had this working properly in iOS 7, but iOS 8 seems to have new rules about 
this.

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: system sounds in iOS

2014-12-20 Thread Carl Hoefs
On Dec 19, 2014, at 11:12 PM, Donald Hall  wrote:

> I want to play a sound indicating that the user has tried to type a 
> non-allowed character (e.g. a letter where a number is needed) in conjunction 
> with "textField:textField shouldChangeCharactersInRange:replacementString:” I 
> was thinking of “tink.caf” or “tock.caf”


#import 
#import 

AudioServicesPlaySystemSound(1057);

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Idea for Improving Vibrancy

2015-02-16 Thread Carl Hoefs
On Feb 16, 2015, at 5:34 AM, Roland King  wrote:

> And for anyone, like me, who doesn't like the vibrancy effect, you can turn 
> it off in preferences.

Is this the right setting:  “◽ Disable Windows® look and feel”
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Carl Hoefs
> On another note, I don't know why this is having trouble:
>
> dispatch_apply(4950,
>dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,
> 0),
>^(size_t idx) {  <--- error
> });
> Incompatible block pointer types passing 'int (^)(size_t)' to parameter of
> type 'void (^)(size_t)'

My bad. I had an inadvertent 'return 0' in the block. Gotta learn to
translate Xcodese!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Carl Hoefs
OS X 10.10

I have a highly CPU-bound project that parallelizes well. A small case has
about 5000 tasks that can execute concurrently (max is ~100,000). I would
like to use GCD queues to take advantage of the 24 cores I have on my
MacPro. Does GCD automatically limit the number of tasks that become
current on its queues to the number of cores (hw.logicalcpu)? Or is it the
programmer's responsibility to manage this?

Suppose I do something like this:

dispatch_group_t workgroup = dispatch_group_create();

dispatch_apply(4950,
   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,
0),
   ^(size_t i) {

dispatch_group_enter(workgroup);

// Code block for executing task i . . .

dispatch_group_leave(workgroup);

});

dispatch_group_wait(workgroup, DISPATCH_TIME_FOREVER);

// Done with all 4950 tasks


Will this cause GCD to limit itself to 24 actively concurrent tasks until
all 4950 are done? Is there a better way to manage this?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Carl Hoefs
> On Apr 9, 2015, at 2:23 PM, Clark Smith Cox III 
> wrote:
>
>> On Apr 9, 2015, at 12:07, Carl Hoefs 
>> wrote:
>>>
>>> I have a highly CPU-bound project that parallelizes well. A small case
>>> has
>>> about 5000 tasks that can execute concurrently (max is ~100,000). I
>>> would
>>> like to use GCD queues to take advantage of the 24 cores I have on my
>>> MacPro. Does GCD automatically limit the number of tasks that become
>>> current on its queues to the number of cores (hw.logicalcpu)?
>>
>> Yes.
>
> Well, it's not as simple as limiting to the number of cores.  It will
> continue to spawn worker threads so long as there is spare overall system
> capacity (up to some internal limit, but that's not the number of cores).
>
> If there are other processes/threads doing work on your system, your
> process will use fewer threads than cores.
>
> If some of your tasks are blocked (due to I/O or locks or even sleeps),
> then you may have more tasks in flight than there are cores, because the
> blocked tasks don't consume CPU capacity.  This can actually be a problem
> if you have tasks which are mixed I/O and computation, because GCD will
> over-subscribe the CPU.  When the tasks unblock, there are more tasks
> wanting CPU than there are cores.
>
> As much as possible, use dispatch I/O or dispatch sources for I/O.  Keep
> tasks segregated to doing either I/O or computation, not a mix.  If you
> can't use dispatch I/O or sources, then try to self-limit the number of
> I/O tasks in flight at once (for example by submitting them to a serial
> queue or low-concurrency-limit NSOperationQueue per device).  Once you do
> that, you should be safe to submit large numbers of CPU tasks and let GCD
> manage them.


Interesting point. That could present a problem, as I do some I/O within
the block. I'll have to try it out and see how it performs. Or perhaps
there is there a way to tell a GCD concurrent queue to limit itself to N
tasks?

On another note, I don't know why this is having trouble:

dispatch_apply(4950,
   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,
0),
   ^(size_t idx) {  <--- error
});
Incompatible block pointer types passing 'int (^)(size_t)' to parameter of
type 'void (^)(size_t)'

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Carl Hoefs
Wonderful! Thank you for clearing this up for me!
-Carl

>
>> On Apr 9, 2015, at 12:07, Carl Hoefs 
>> wrote:
>>
>> OS X 10.10
>>
>> I have a highly CPU-bound project that parallelizes well. A small case
>> has
>> about 5000 tasks that can execute concurrently (max is ~100,000). I
>> would
>> like to use GCD queues to take advantage of the 24 cores I have on my
>> MacPro. Does GCD automatically limit the number of tasks that become
>> current on its queues to the number of cores (hw.logicalcpu)?
>
> Yes.
>
>> Or is it the
>> programmer's responsibility to manage this?
>>
>> Suppose I do something like this:
>>
>>dispatch_group_t workgroup = dispatch_group_create();
>>
>>dispatch_apply(4950,
>>   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH,
>> 0),
>>   ^(size_t i) {
>>
>>dispatch_group_enter(workgroup);
>>
>>  // Code block for executing task i . . .
>>
>>dispatch_group_leave(workgroup);
>>
>>});
>>
>>dispatch_group_wait(workgroup, DISPATCH_TIME_FOREVER);
>>
>
> Note that your use of a dispatch_group here is redundant; dispatch_apply
> always executes synchronously with respect to the caller (i.e. when the
> above dispatch_apply has returned, all 4950 executions of your block have
> already completed).
>
>
> --
> Clark Smith Cox III
> clark@apple.com
>
>


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Does GCD auto-limit concurrent tasks to number of cores?

2015-04-09 Thread Carl Hoefs
> On Thu, 9 Apr 2015 14:40:16 -0500, Sean McBride said:
>
> Not just IO, but memory usage too.  If you have 24 cores, and GCD spins up
> 24 simultaneous 'tasks', and each needs 2 GB of RAM, then you better hope
> you have 48 GB of RAM too, or you'll swap and easily end up dog slow.

I just now ran a small 600 task subset on an 8-core iMac, and I got these
performance numbers:

Memory usage:  800MB (100MB per task)
CPU usage:   93.75% (over all cores)
Energy impact:  Very high
Disk I/O:  800 KB/s

So, I'm thinking this should scale well to the 24 core MacPro w/32GB RAM.

Thx all for the great help!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Limiting GCD concurrent queues

2015-05-08 Thread Carl Hoefs
OS X 10.10.3  Xcode 6.3.1

I need to limit a GCD concurrent queue to a specific number of concurrently 
executing tasks (less than the number of cores available). The only way I can 
get this to work is by adding "external plumbing" in the form of semaphores to 
the dispatch invocation:

  dispatch_queue_t gcdConcQueue = dispatch_queue_create("GCDProcQueue", 
DISPATCH_QUEUE_CONCURRENT);
  dispatch_semaphore_t concLimitSem = dispatch_semaphore_create(16);
. . .
  dispatch_async(gcdConcQueue, ^{
dispatch_semaphore_wait(concLimitSem, DISPATCH_TIME_FOREVER);
// Concurrent DB access, etc . . .
dispatch_semaphore_signal(concLimitSem);
});

I was hoping an API like the following might be lurking around somewhere:

gcdConcQueue = dispatch_queue_create("GCDConcQueue", 
DISPATCH_QUEUE_CONCURRENT, 16);

in which the queue manages itself behind the scenes. Is the semaphore approach 
currently the (only) way to do this? Would this make sense as an API 
enhancement? Am I overlooking something obvious?

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Limiting GCD concurrent queues

2015-05-08 Thread Carl Hoefs

> On May 8, 2015, at 1:19 PM, Ken Thomases  wrote:
> 
> You should use an NSOperationQueue.  You can set its 
> maxConcurrentOperationCount.  You can add blocks to it using 
> -addOperationWithBlock: or by instantiating NSBlockOperation objects and 
> adding those with -addOperation:.

Awesome, thanks for the pointer to NSOperationQueue. Sounds just like what I 
was searching for. 

-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Using CFSTR() with const char * variable

2015-06-05 Thread Carl Hoefs
If I use CFSTR() in the following way:
CFStringRef mystr = CFSTR( "This is a string" );
there is no problem.

However, if I use a variable instead of “string” Xcode flags this as an error:
const char *mystring = "This is a string";
CFStringRef mystr = CFSTR( mystring );
   ^   <— Expected ")"

In CFString.h, CFSTR is defined as:
#define CFSTR(cStr)  __CFStringMakeConstantString("" cStr "")

Is it possible to use CFSTR() with a const char * variable?

Xcode 6.3.2
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Using CFSTR() with const char * variable

2015-06-05 Thread Carl Hoefs

> On Jun 5, 2015, at 8:17 PM, Ken Thomases  wrote:
> 
> On Jun 5, 2015, at 10:02 PM, Carl Hoefs  
> wrote:
> 
>> If I use CFSTR() in the following way:
>>   CFStringRef mystr = CFSTR( "This is a string" );
>> there is no problem.
>> 
>> However, if I use a variable instead of “string” Xcode flags this as an 
>> error:
>>   const char *mystring = "This is a string";
>>   CFStringRef mystr = CFSTR( mystring );
>>  ^   <— Expected ")"
>> 
>> In CFString.h, CFSTR is defined as:
>>   #define CFSTR(cStr)  __CFStringMakeConstantString("" cStr "")
>> 
>> Is it possible to use CFSTR() with a const char * variable?
> 
> No.  As you can see from the quoted macro definition, it relies on 
> concatenation of adjacent string literals.
> 
> You should use an appropriate CFStringCreate…() function to create a CFString 
> from the C string.  Or just create a CFString or NSString literal from the 
> start.
> 
> Be careful with CFStringCreateWithCStringNoCopy(…, kCFAllocatorNull), which 
> you might be tempted to use.  Only use that with pointer to static storage.  
> The mystring variable in your example does point to static storage, but could 
> be changed to point to something else (it's a pointer to const char, not a 
> const pointer to const char).
> 
> Something like this is _not_ safe:
> 
>const char mystring[] = "This is a string";
> 
> That is auto-lifetime storage allocated on the heap, which will be 
> deallocated at end of scope.
> 
> This would be safe:
> 
>static const char mystring[] = "This is a string”;

Okay, got it. (BTW, it’s probably just me, but the entire set of CF* functions 
seems to be a bit oddly designed, no?)

Thanks Ken and Roland!
-Carl


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Re: Language options: Objective-C, Swift, C or C++?

2015-06-12 Thread Carl Hoefs
2-cent note from an uninformed lurker… 

I busted my rear for couple of years learning and getting to think in Obj C, 
and I love the object oriented feel it has, especially compared with the likes 
of C++ and Java, where object orientation feels like a tacked-on afterthought. 

Okay, so now there's Swift. Ugh. At first glance it looks like a throwback to 
Basic (let x =), so it make me shudder. I suppose I'll hold my nose and learn 
it, but the main question would be why? Is there some glaring irredeemable 
deficiency in Obj C that will end its days? I don’t recall anyone clamoring for 
a new language…

What problem/issue/deficiency is Swift intended to address? The mindset I use 
when programming in Obj C is “pure and simple object orientation”. What mindset 
am I to adopt in learning Swift?  I’m having a hard time getting a “feel” for 
Swift's orientation. It seems so… syntaxy.

-Carl

> On Jun 12, 2015, at 6:59 PM, Maxthon Chan  wrote:
> 
> It seemed to me that my decision on start learning Swift this year dodged a 
> bullet here. Still my Swift experience will not start until I built a Swift 
> compiler on Linux.
> 
> For me the embedded land is still C and C only. In 8-bit land Microchip XC8 
> for PIC as well as SDCC for Intel 8051 are C only, and AVR-GCC’s C++ support 
> is rarely used by me (unless I am doing something with Arduino) and on 32-bit 
> since I generally don’t use Cortex-M, the ARM9, ARM11 and Cortex-A processors 
> that I use generally runs Linux and hence GNUstep, so those will use a mix of 
> C and Objective-C.
> 
> Call me a weirdo as my recent Web project is written in pure C, as an Apache 
> 2.4 module.
> 
>> On Jun 13, 2015, at 09:31, Roland King  wrote:
>> 
>> 
>>> On 13 Jun 2015, at 08:51, Maxthon Chan  wrote:
>>> 
>>> News outlets says that Objective-C is quickly falling out of people’s 
>>> attention and developers are turning away from it to Swift and C++. So what 
>>> language will you use to code various parts of your new project? 
>>> Objective-C? Swift 2? C++? Or the good old plain C?
>>> 
>>> For me, it is still Objective-C and plain C, maybe Swift 2 in the future. I 
>>> always hated C++ for its confusing feature set and difficulty in mastering 
>>> it, let alone fragile ABI and inability to use modules to accelerate 
>>> compilation time. I never looked at the original version of Swift language 
>>> closely because it is not feature stable yet and it is confusing since all 
>>> my previous experiences are Objective-C, Visual Basic .net and a little bit 
>>> C# (I am a convert from Windows and Windows Phone camp, gave up Microsoft 
>>> four years ago when I began to see the downfall of Windows as a decent 
>>> operating system) The Objective-C and C also have the advantage of being 
>>> able to be ported rather effortlessly to Linux using GNUstep.
>>> 
>>> Swift 2 though, provided all (Objective-)C currently have, so I am 
>>> interested and will look into it once I downloaded Xcode 7.
>>> ___
>> 
>> I wouldn’t take a sod of notice what “News Outlets” say. They wouldn’t know 
>> a programming language from a large hole in the ground and are mostly 
>> regurgitating frothy press articles and random surveys.
>> 
>> I would start learning Swift. It was a rough experience last year, it’s 
>> looking orders of magnitude better this year, because Apple put some serious 
>> hard work into it and responded to the piles and piles of bug reports they 
>> must have had when it first came out. It’s where the puck is going at least 
>> for Apple OS programming, and it’s pretty usable although it’s going to take 
>> me a while before I really start getting the full power out of it.
>> 
>> I hadn’t touched C++ for years until recently, but it came in very handy 
>> for, of all things, some embedded programming.
>> 
>> So right tool for the right job. I’d keep them all sharp and use them 
>> appropriately.
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/newslists%40autonomy.caltech.edu
> 
> This email sent to newsli...@autonomy.caltech.edu


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

  1   2   3   >