Re: Environment woes executing scripts from my OS X app

2015-12-16 Thread Peter
Hm, maybe I’m getting this wrong but how about

NSTask 
- (void)setEnvironment:(NSDictionary *)environmentDictionary

Am 16.12.2015 um 13:46 schrieb Maxthon Chan :

> If you can call /usr/bin/env you can use that as an intermediary.
> 
> Sent from my iPhone
> 
>> On Dec 16, 2015, at 15:47, Rick Mann  wrote:
>> 
>> I'm working on an OS X app that unfortunately has to call a series of bash 
>> and python scripts for part of the processing it does. I was able to include 
>> the scripts in my app's bundle, and invoke them there, but the environment 
>> is different when launched via my app than when launched on the command 
>> line. How can I best control the environment used when executing external 
>> scripts?
>> 
>> -- 
>> Rick Mann
>> rm...@latencyzero.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/max%40maxchan.info
>> 
>> This email sent to m...@maxchan.info
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___ Peter Hartmann 

mailto:hphartm...@justmail.de



___ Peter Hartmann 

mailto:hphartm...@justmail.de


___

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

Debugging com.apple.LaunchServices.DatabaseChange messages

2014-10-26 Thread Peter
Hi,

lately (OS10.9.5) I find my console log littered with messages like this

[QL] Launch Services Database change notification 
(com.apple.LaunchServices.DatabaseChange). Resetting Generator caches.

on message for each running app, amounting to several thousand a day.

I suspect some outdated Quicklook generator behind. As these are quite often 
hidden in the application bundle it is almost impossible to disable them, as 
one can do in the case of the ones stored in the respective library folders.

Does anybody know what might trigger these messages? I get them at regular 
intervals of 2 Minutes, sometimes 10 seconds even.

How could I possibly debug this?

I read up on QuickLook put couldn’t find an appropriate entry point.

Any pointers are welcome.

Thanks,

Peter



___

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: dispatch_source does not work

2014-11-04 Thread Peter
http://stackoverflow.com/questions/12343833/cocoa-monitor-a-file-for-modifications/26304208#26304208

has some info on this.

___ Peter Hartmann 

mailto:hphartm...@justmail.de


Am 05.11.2014 um 07:50 schrieb Gerriet M. Denkmann :

> I want to monitor a file for changed content.
> Polling is generally not a good idea, so I tried dispatch_source.
> 
> But it does not work.
> 
> Here the code:
> 
> static NSString *const kTestPath  = @"/tmp/a.test";   
> 
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification 
> {
>   const char *filename = kTestPath.fileSystemRepresentation;
>   int fd = open(filename, O_RDONLY);
>   fcntl(fd, F_SETFL, O_NONBLOCK);  
>   uintptr_t fD = (uintptr_t)fd;
>   dispatch_queue_t queue = 
> dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0);
>   const uint64_t flags = DISPATCH_VNODE_WRITE | DISPATCH_VNODE_LINK; 
>   dispatch_source_t my_source = 
> dispatch_source_create(DISPATCH_SOURCE_TYPE_VNODE, fD, flags, queue);
>   dispatch_source_set_event_handler(my_source, ^{ [self fileDidChange]; } 
> );
>   dispatch_resume(my_source);
> }
> 
> - (void)fileDidChange
> {
>   NSLog(@"%s",__FUNCTION__);  //  never seen
> }
> 
> - (IBAction)buttonClicked: sender
> {
>   static NSUInteger seqq = 0;
>   seqq++;
>   
>   const char *stats_temp_file = "/tmp/a.temp";
>   FILE *fp = fopen(stats_temp_file, "w");
>   fprintf(fp, "%lu\n", seqq);
>   (void)fclose(fp);
>   
>   const char *filename = kTestPath.fileSystemRepresentation;
>   int a = rename(stats_temp_file, filename);
> }
> 
> What am I doing wrong? (Writing directly to kTestPath without rename() also 
> does not work).
> 
> Gerriet.
> 
> 
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___

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: What's up with the Cocoa Text System?

2015-01-23 Thread Peter
Maybe this sounds silly, but have you tried to increase the keyboard repeat 
frequency in the system preferences. I once was silly enough not to.

___ Peter Hartmann 



Am 23.01.2015 um 14:50 schrieb Charles Jenkins :

> For some reason, typing text on a Mac has always had a little bit of 
> friction: however the OS receives keyboard input, it doesn't seem to be able 
> to keep up as well as a PC. But lately, toward the end of Mavericks' lifespan 
> and now on Yosemite, it has actually become painful to type in text. I'm 
> excited about working on my app, but when it comes time to sit down and work 
> on it, I always feel noticeable dread about having to type code into XCode.
> 
> (Does anyone use BBEdit? Is it more responsive?)
> 
> I don't want to open a Mac-vs-PC debate, so let me say I've used Macs since 
> the advent of Jaguar and I'd never buy anything else for my primary, personal 
> use. I work on PCs all day at work, but I bought a Mac mini there and work on 
> PCs remotely through Jump Desktop because the Mac can handle my display 
> better. Year over year, my experience is that everything is better on a 
> Mac... except typing text. The PC just keeps up better.
> 
> I'm not just complaining here: I'm writing a word processor, so I'm concerned 
> about how to make my app more responsive.
> 
> I'm composing this email using Airmail 2, but it wouldn't matter what email 
> client I used. I recently switched from Sparrow, where I had exactly the same 
> problems. I have turned off Autocorrect and Check Spelling While Typing to 
> eliminate the significant pause that happens each time you finish a word and 
> hit the space bar. I just wrote a reply and still had regular hiccups as I 
> typed, so then I turned off Substitutions - Smart Links and Substitutions - 
> Text Replacement. Now typing flows better and I'm able to get more words 
> typed in before a pause. It's much better now, but there are still times when 
> the computer will seem to hang for a bit and then a group of ten or so 
> characters will all appear at once.
> 
> I am not a fast touch-typist, but post-Mavericks, it seems that in every new 
> app I have go go and turn off a bunch of text system features we Mac users 
> have come to rely on over the years in order to make typing at all bearable.
> 
> Is there anything I can do as a developer to make my app more responsive and 
> make typing flow better, other than defaulting the app to turn off as many 
> text features as possible or writing my own replacement for NSTextView?
> 
> -- 
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___

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

Accessory NSPanel vanishes on first click after app launches

2011-08-02 Thread Peter
Developing for OS 10.5 and 10.6 I have an application with a main window (no 
documents window) and a (non-modal) accessory NSPanel I want to show only when 
the main window is the key window. I want the NSPanel hidden, however, when the 
preferences or about window comes up or when the app is in the background. The 
panel never is only for use with the mouse and does not have to become key 
window.

I implemented this using the following delegate methods for the main window:

- (void)windowDidBecomeKey:(NSNotification *)notification
{
   if ([notification object] == mainWindow) {
  [editPanel orderFront:self];
   }
}

- (void)windowDidResignKey:(NSNotification *)notification
{
   if ([notification object] == mainWindow) {
  [editPanel orderOut:self];
   }
}

Everything works as intended - except immediately after the applications 
launches:

The main window is shown, and floating above it the panel, as intended.
When I click on the the panel for the first time, however, the panel vanishes 
from the screen.

After I deactivate and activate the window again (e.g. by showing the 
preferences window etc.) the panel is shown again and from then on works 
absolutely normally: When the main window is key, the panel is shown and 
accepts mouse clicks, and it is hidden when the main window resigns key. (Both 
the panel and the main window are instantiated in the nib. Turning visible at 
launch on or off does not seem to have an influence. I am not using any 
bindings for both windows in question. None of the windows in question use 
dedicated window controllers.)

I am puzzled and I don't have a clue how to debug this. The debugger log shows 
nothing.

I experimented with

[mainWindow addChildWindow:editPanel ordered:NSWindowAbove];

and

[mainWindow removeChildWindow:editPanel];

but did not manage to achieve the desired effect.

Thanks for any insight or pointers to relevant documentation.

Peter___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Accessory NSPanel vanishes on first click after app launches - Follow up

2011-08-02 Thread Peter
After setting a breakpoint at -[NSWindow orderOut:] (thanks for this and other 
hints to Kyle Sluder! - in a post on this list about a year ago) it turns out 
that it is exactly my

- (void)windowDidResignKey:(NSNotification *)notification

which takes the panel off the screen. (I wonder why I hadn't realized this 
before, when I set a breakpoint in that very method...)

I am still puzzled: why should a click on the panel make the main window resign 
from key only once and the first time after the app launched?
The initial state of the app before this first mouse click is: "main window is 
front and key, i.e. window header is hilited, insertion point blinking in the 
text view designated to be the first responder", "panel is visible but not key, 
i.e. window header is greyed out".

I added

- (void)awakeFromNib
{
   [editPanel setBecomesKeyOnlyIfNeeded:YES];
}

to the controller, which does not change anything, except that now I have click 
on the window header of the panel to make it vanish. After that everything 
works normally again, as previously described.

I also tried

[editPanel orderWindow:NSWindowAbove relativeTo:[mainWindow windowNumber]];

but this also does not change anything.

Placing NSLogs in both delegate methods reports the following three messages 
when executing a single click on the panel header right after the app launched:

window resign: 
window key: 
window key: 

So after the click, the panel is key window and off-screen at the same time, 
where in fact the main window is key. And this is the last time I get a 
notification about the panel before I restart the app, no matter how hard I 
try. Both the panel and the window each have a single memory address throughout 
the app's lifetime.

Any pointers?

Thanks a lot!

(I corrected a couple of language problems in the following self-quotation)

> Developing for OS 10.5 and 10.6 I have an application with a main window (no 
> documents window
> s) and a (non-modal) accessory NSPanel I want to show only when the main 
> window is the key window. I want the NSPanel hidden, however, when the 
> preferences or about window comes up or when the app is in the background. 
> The panel is only for use with the mouse and does not have to become key 
> window.
> 
> I implemented this using the following delegate methods for the main window:
> 
> - (void)windowDidBecomeKey:(NSNotification *)notification
> {
>   if ([notification object] == mainWindow) {
>  [editPanel orderFront:self];
>   }
> }
> 
> - (void)windowDidResignKey:(NSNotification *)notification
> {
>   if ([notification object] == mainWindow) {
>  [editPanel orderOut:self];
>   }
> }
> 
> Everything works as intended - except immediately after the applications 
> launches:
> 
> The main window is shown, and floating above it the panel, as intended.
> When I click on the the panel for the first time, however, the panel vanishes 
> from the screen.
> 
> After I deactivate and activate the window again (e.g. by showing the 
> preferences window etc.) the panel is shown again and from then on works 
> absolutely normally: When the main window is key, the panel is shown and 
> accepts mouse clicks, and it is hidden when the main window resigns key. 
> (Both the panel and the main window are instantiated in the nib. Turning 
> visible at launch on or off does not seem to have an influence. I am not 
> using any bindings for both windows in question. None of the windows in 
> question use dedicated window controllers.)
> 
> I am puzzled and I don't have a clue how to debug this. The debugger log 
> shows nothing.
> 
> I experimented with
> 
> [mainWindow addChildWindow:editPanel ordered:NSWindowAbove];
> 
> and
> 
> [mainWindow removeChildWindow:editPanel];
> 
> but did not manage to achieve the desired effect.
> 
> Thanks for any insight or pointers to relevant documentation.
> 
Peter___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Accessory NSPanel vanishes on first click after app launches - Follow up

2011-08-02 Thread Peter
I forgot to add:

Using

- (void)windowDidBecomeMain:(NSNotification *)notification
- (void)windowDidResignMain:(NSNotification *)notification

make the panel stay on the screen after the first mouse click, but on the other 
hand do not achieve the desired effect, i.e. remove the panel when other 
windows become key.
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Why does initWithCoder has other self-object?

2011-08-18 Thread Peter
You have two independent initializers in your class.
You should have one designated initializer which is called by all other 
initializers in your class.

Quoting from "The Objective-C Programming Language"

In the implementation of a custom initializer, you must ultimately invoke a 
designated initializer.
Designated initializers are described in “The Designated Initializer”; a full 
explanation of this issue is given in “Coordinating Classes.”

In brief, if you are implementing a new designated initializer, it must invoke 
the superclass’ designated initializer. If you are implementing any other 
initializer, it should invoke its own class’s designated initializer, or 
another of its own initializers that ultimately invokes the designated 
initializer.

This makes sure that you don't get inconsistencies like those you describe.

Am 17.08.2011 um 13:34 schrieb Arno Oesterheld:

> Hello,
> 
> I am a beginner with Xcode and Objective-C and stuck with a quite simple 
> thing for over two days now. I hope you can help me.
> 
> My Project is deployed for OS X 10.6, it uses Garbage Collection and I am 
> using Xcode 4.0.1.
> 
> I made a multi document application starting with the template provided by 
> Xcode. I just have one class as subclass of NSDocument.
> 
> For opening documents I use initWithCoder. The decoding mithin this method 
> works fine - I get the values that were saved.
> But these values are "lost" when I would like to use them in an other method 
> (of the same class).
> 
> I assume that I make some mistakes with using the right comibation of init: / 
> initWithCoder: / initWithContentsOfURL: etc.
> The self-object does always have a different adress in the initWithCoder 
> method then in the other methods.
> I tried plenty of combinations of the above methods and even tried to call 
> differend methods in the super class (NSDocument) within initWithCoder.
> 
> 
> This is my header file:
> 
> #import
> 
> @interface OptimiererZwoMultiDoc : NSDocument  {
>__strong struct bildanalyse {
>float winkelo;
>   ...
>float skalfak;// Der Skalierungsfaktor, den dieses Bild erfahren 
> muss damit es so gross ist wie das kleinste - Wert ist also immer<= 0
>};
> 
>__strong struct bildanalyse *analyse;
>__strong int16_t anzahlanalysewerte;
>   ...
> 
> @private
>NSTextView *ausgabe;
>   ...
> }
> 
> - (void)applicationDidFinishLaunching:(NSNotification *)aNotification;
> - (void) prepareAnalyseDoc;
> ...
> 
> @property (assign) IBOutlet NSTextView *ausgabe;
> @property __strong struct bildanalyse *analyse;
> @property __strong int16_t anzahlanalysewerte;
> @end
> 
> 
> 
> When I try this implementation:
> 
> #import "OptimiererZwoMultiDoc.h"
> 
> @implementation OptimiererZwoMultiDoc
> 
> @synthesize ausgabe;
> @synthesize analyse;
> @synthesize anzahlanalysewerte;
> ...
> 
> 
> - (id)init
> {
>self = [super init];
>NSLog(@"init self=%@",self);
>if (self) {
>...
>}
>return self;
> }
> 
> 
> - (NSString *)windowNibName
> {
>NSLog(@"windowNibName self=%@",self);
>return @"OptimiererZwoMultiDoc";
> }
> 
> 
> - (void)windowControllerDidLoadNib:(NSWindowController *)aController
> {
>NSLog(@"windowControllerDidLoadNib self=%@",self);
>[super windowControllerDidLoadNib:aController];
> }
> 
> 
> - (BOOL) readFromData:(NSData *)data ofType:(NSString *)typeName 
> error:(NSError **)outError{
> NSLog(@"readFromData self=%@",self);
> [NSKeyedUnarchiver unarchiveObjectWithData: data];
> if (outError) {
> *outError = [NSError errorWithDomain:NSOSStatusErrorDomain 
> code:unimpErr userInfo:NULL];
> }
> return YES;
> }
> 
> 
> - (id) initWithCoder: (NSCoder *) coder{
>struct bildanalyse tempAnalyse;
> 
>NSLog(@"initWithCoder self=%@",self);
>anzahlanalysewerte = [coder decodeIntForKey:@"anzahlanalysewerte"];
>
>return self;
> }
> 
> then I get this output:
> 
> init self=
> readFromData self=
> initWithCoder self=
> windowNibName self=
> windowControllerDidLoadNib self=
> 
> As you can see, the object self is different in initWithCoder. Why? What's 
> wrong with my code?
> 
> Any advice is very welcome.
> 
> Thank you very much in advance!
> 
> Best regards
> Arno
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the l

Re: Find a frame of an item in an NSOutlineView?

2011-08-18 Thread Peter
Haven't tried it, but AppKiDo tells me that NSOutlineView inherits the 
following method from NSTableView:

frameOfCellAtColumn:row:

as well as

rectOfColumn:

and

rectOfRow:

Am 18.08.2011 um 21:47 schrieb James Walker:

> Is there a way to find the frame rectangle of an item/row in an NSOutlineView?
> 
> Looking through the table of contents of the NSOutlineView reference, I saw
> 
>  Getting the Frame for a Cell
>– frameOfOutlineCellAtRow:
> 
> which sounded like what I wanted, but it turns out that it just gets the 
> frame of the little expand/collapse widget, if any, not the whole row.
> -- 
>  James W. Walker, Innoventive Software LLC
>  
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: determine whether an ancillary program/task can run

2011-09-01 Thread Peter

Am 02.09.2011 um 00:19 schrieb Philip Ershler:

> 
> On Sep 1, 2011, at 4:11 PM, Martin Wierschin wrote:
> 
>> Hi Dave,
>> 
>> Thanks for your reply. I was hoping to avoid handling that inspection 
>> myself, but even if I go that route there's another problem: the ancillary 
>> tool isn't a proper bundle, it's just a plain executable, so NSBundle's 
>> initializers will just return nil. That's a pity because there's even 
>> -[NSBundle preflightAndReturnError:] which sounds to be exactly what I want.
>> 
>> Offhand does anyone know how to inspect the architecture(s) of a plain 
>> executable file? I've been googling for a little bit and haven't hit upon 
>> anything that works yet.
> 
> Won't otool do the job for you?
> 
> Phil

Or file even - is otool included in the standard OS install, or does the user 
have to have dev tools installed?

file /Applications/Dashboard.app/Contents/MacOS/Dashboard 
/Applications/Dashboard.app/Contents/MacOS/Dashboard: Mach-O universal binary 
with 3 architectures
/Applications/Dashboard.app/Contents/MacOS/Dashboard (for architecture x86_64): 
Mach-O 64-bit executable x86_64
/Applications/Dashboard.app/Contents/MacOS/Dashboard (for architecture i386):   
Mach-O executable i386
/Applications/Dashboard.app/Contents/MacOS/Dashboard (for architecture 
ppc7400):Mach-O executable ppc



>> 
>> Thanks,
>> ~Martin
>> 
>> 
>> On Sep 1, 2011, at 2:12 PM, Dave DeLong wrote:
>> 
>>> You could probably catch this before attempting to launch the task.  Create 
>>> a new NSBundle object pointing at the executable path, and then ask the 
>>> bundle for the -executableArchitectures, and see if one of the returned 
>>> values matches the architecture of the machine you're running. If it 
>>> matches, then launch the task.  :)
>>> 
>>> Cheers,
>>> 
>>> Dave
>>> 
>>> On Sep 1, 2011, at 2:09 PM, Martin Wierschin wrote:
>>> 
 Hello all,
 
 My application sometimes need to run an ancillary program (included in the 
 app's resources). I do this via NSTask and normally it works great. 
 
 The problem is that this ancillary program is sometimes Intel-only, or 
 sometimes PPC-only, while the main application is Universal. The use of 
 this ancillary program is not mandatory, so displaying an error message, 
 or using a fallback solution is acceptable. The issue is that trying to 
 run an ancillary program on an unsupported architecture triggers a hard 
 crash:
 
>> Exception Type:  EXC_BREAKPOINT (SIGTRAP)
>> Exception Codes: 0x0001, 0x9030c0b0
>> Crashed Thread:  0
>> 
>> Application Specific Information:
>> *** NSTask: Task create for path '.../Resources/mysubtool' failed: 86, 
>> "Bad CPU type in executable".  Terminating temporary process.
>> *** multi-threaded process forked ***
 
>> 
>> Thread 0 Crashed:
>> 0   com.apple.Foundation 0x9030c0b0 
>> ___NEW_PROCESS_COULD_NOT_BE_EXECD___ + 0
>> 1   com.apple.Foundation 0x901d0354 -[NSConcreteTask 
>> launchWithDictionary:] + 2472
 
 Is there an elegant way to catch this? I'd rather not try to figure out 
 the arch of the ancillary program, host arch, and (if relevant) whether 
 Rosetta is installed or not. 
 
 Thanks,
 ~Martin
 
 ___
 
 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:
 http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
 
 This email sent to davedel...@me.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


sender is nil in action method from NSPopupButtonCell in an NSTextFieldCell

2011-09-15 Thread Peter
I have a header cell for an NSTableView based on NSTextFieldCell containing an 
NSPopupButtonCell.
I am setting the NSPopupButtonCell up programmatically. I set an action method 
for the NSPopupButtonCell in the standard fashion:

[self.popupCell setAction:@selector(headerCellPopupChanged:)];

This works in principle but when the dummy action method

- (void)headerCellPopupChanged:(id)sender{
   NSLog(@"Changed: %@", sender);
}

is called, sender is nil:

Changed: (null)

Am I missing something? Has anybody seen this?

Thanks,

Peter___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: applicationWillFinishLaunching

2011-09-30 Thread Peter
I am not sure I get your first sentence right, but rather than relying on the 
automatic delegate notification mechanism, you might want to actively subscribe 
to the notification. You can do so from any object, not just a delegate.

[[NSNotificationCenter defaultCenter] addObserver:self
 
selector:@selector(finishInitialization)
 
name:NSApplicationWillFinishLaunchingNotification 
   object:NSApp];

If your app needs to do something at this stage which requires the existence 
and activity of a run loop you could plug in a run loop observer once for the 
first cycle of the run loop.

In something like your appController you implement a method and a function to 
set things up:

void MyRunLoopObserver(CFRunLoopObserverRef observer,
   CFRunLoopActivity activity,
   void* info)
{
   //replace MyAppController here by the name of the class of self
   //refToSelf gives you access to everything (methods and ivars etc.) of self
   //doSomething here is the method you want to call when the run loop starts
   [(MyAppController *)refToSelf doSomething];
}

- (void) installRunLoopObserver
{
   CFRunLoopObserverRef myObserver = NULL;
   myObserver = CFRunLoopObserverCreate(NULL,
kCFRunLoopEntry,/* plug in at 
the beginning of the run loop */
NO,/* do not repeat */
0,
&MyRunLoopObserver,
0);
   
   if (myObserver)
   {
  // Now add it to the run loop
  CFRunLoopAddObserver(CFRunLoopGetCurrent(),
   myObserver,
   kCFRunLoopCommonModes);
   }
   
   CFRelease(myObserver);
}

Then, in the same class, from somewhere early in the app launch process, e.g. 
awakeFromNib, you set a global void * refToSelf (declared outside 
@implementation)

refToSelf = self; //self, BTW, could be replaced by any object implementing the 
doSomething method

and call

[self installRunLoopObserver]; //whereas self here, of course, is the object 
calling installRunLoopObserver on itself

When the app enters the first run loop, doSomething is executed.

Note that the example in the documentation (of which the above is derived) does 
not work as advertised. (I had consistent crashes when working with *info as a 
container for self. Therefore I use the global refToSelf). This one works - 
although I can not give you any guarantee that it will work out for your 
special condition "plug into the first run loop cycle of the app", since I 
haven't tried this special case. But since everything should be set up properly 
at this point, it should work out.

Hope this helps.

Am 30.09.2011 um 01:48 schrieb koko:

> I have implemented applicationWillFinishLaunching in my app delegate but 
> strangely (to me) it is not called but applicationDidFinishLaunching is 
> called so I know my delegate is properly connected.
> 
> Are there some conditions that must be met  for 
> applicationWillFinishLaunching to be called?
> 
> What I want to do is ask for a serial number before the main window is 
> displayed as the serial number will determine the app configuration and hence 
> what appears in the main window.  So, I thought I would ask for the serial 
> number in applicationWillFinishLaunching thinking the main window will yet be 
> visible. I would the configure the app.
> 
> If there is a better way to accomplish this sequence of events I am all ears.
> 
> -koko
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: adding something to a setter

2011-10-06 Thread Peter
But probably that bad feeling is self-inflicted ...

At least for standard views or controls, if there is a need to redisplay, the 
property in question should probably belong to a model object not a view 
object. And in that case your object would not observe its *own* property but a 
property of the model object - and this observation then would trigger a 
display refresh. MVC+KVO.

I hope I am not too wide off the mark.

Am 06.10.2011 um 15:23 schrieb Thomas Davie:

> 
> On 6 Oct 2011, at 14:16, Torsten Curdt wrote:
> 
>> Hm... using KVO for an object to observe it's own properties?
>> That's feels wrong to me.
>> Is that just me?
> 
> No, definitely not just you... But then, I find KVO pretty wrong in the first 
> place.
> 
> if (*ra4 != 0xffc78948) { return false; }
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Read carefully:

The original poster stated: "any more text" - or are you suggesting that he 
should disable the text box when a certain number of characters are reached? I 
guess not.

AFAIK, the focus ring is not accessible programmatically, except form setting 
it by making something the first responder.

You could use a text formatter or one of the validation methods and simply stop 
accepting key strokes, change the text color to red and/or display an alert.

Am 06.10.2011 um 17:43 schrieb Thomas Davie:

> The correct way to notify a user that he can't enter text in a text box is to 
> disabled it.
> 
> Bob
> if (*ra4 != 0xffc78948) { return false; }
> 
> On 6 Oct 2011, at 16:33, Nick wrote:
> 
>> Hello
>> I am wondering if there's a way to do this, notifying the user that he can't
>> enter any more text into NSTextField edit box?
>> Is there a way to change the color of the NSTextField's focus ring to red
>> (to highlight that this is an error)?
>> How difficult would that be to implement?
>> Thank you!
>> ___
>> 
>> 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:
>> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
>> 
>> This email sent to tom.da...@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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to blink with a focus ring of the text box?

2011-10-06 Thread Peter
Adding to my own post I just found this in my snippets collection:

This listing shows how you draw such a focus ring. It requires you to override 
the NSCell drawWithFrame:inView: In this method, if the cell is supposed to 
draw evidence of first-responder status, set the rectangle for the focus ring, 
call NSSetFocusRingStyle with an argument of NSFocusRingOnly, and then create 
and fill a bezier path defining that rectangle. Filling in this case simply 
draws the ring.

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView;
{
// other stuff might happen here
if ([self showsFirstResponder]) {
 // showsFirstResponder is set for us by the NSControl that is drawing  
us.
NSRect focusRingFrame = cellFrame;
focusRingFrame.size.height -= 2.0f;
[NSGraphicsContextsaveGraphicsState];
NSSetFocusRingStyle(NSFocusRingOnly);
[[NSBezierPath bezierPathWithRect: NSInsetRect(focusRingFrame, 4.0f, 
4.0f)] fill];
[NSGraphicsContext restoreGraphicsState];
}
// other stuff might happen here
}

So possibly you could create your own NSTextFieldCell, set your NSTextField to 
use it, call [super drawWithFrame.] somewhere in the above method to do the 
standard drawing and move on from there. The flashing could be implemented 
using a CALayer animation or something.

If you manage to implement this you should make it open source :-) since I 
guess it's quite a bit of work to get it done.

> Read carefully:
> 
> The original poster stated: "any more text" - or are you suggesting that he 
> should disable the text box when a certain number of characters are reached? 
> I guess not.
> 
> AFAIK, the focus ring is not accessible programmatically, except form setting 
> it by making something the first responder.
> 
> You could use a text formatter or one of the validation methods and simply 
> stop accepting key strokes, change the text color to red and/or display an 
> alert.
> 
> Am 06.10.2011 um 17:43 schrieb Thomas Davie:
> 
>> The correct way to notify a user that he can't enter text in a text box is 
>> to disabled it.
>> 
>> Bob
>> if (*ra4 != 0xffc78948) { return false; }
>> 
>> On 6 Oct 2011, at 16:33, Nick wrote:
>> 
>>> Hello
>>> I am wondering if there's a way to do this, notifying the user that he can't
>>> enter any more text into NSTextField edit box?
>>> Is there a way to change the color of the NSTextField's focus ring to red
>>> (to highlight that this is an error)?
>>> How difficult would that be to implement?
>>> Thank you!
>>> ___
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
>>> 
>>> This email sent to tom.da...@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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Tool Tip Format

2011-10-24 Thread Peter
Are you using double quotes?

For my tool tips I am returning something like this:

return [NSString stringWithFormat:@"%@\n\n%@", currentFilePath, @"▸ File is 
missing!"];

Which works out perfectly.

Am 24.10.2011 um 23:36 schrieb koko:

> I want to add a new line to tool tip.
> 
> I have tried by putting a \n where the line should break but it just shows up 
> in too tip.
> 
> Line\nNext Line
> 
> Can a new line be put into a tool tip.
> 
> -koko___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How select NSTextField programatically?

2011-12-13 Thread Peter

Am 13.12.2011 um 17:15 schrieb Kyle Sluder:

> On Tue, Dec 13, 2011 at 8:10 AM, McLaughlin, Michael P.  
> wrote:
>> I have a Cocoa "dialog" with several textfields for numerical input.  When 
>> the user enters a bad value, I want to select that view programatically 
>> along with an NSBeep() so that the user can fix it.
>> 
>> What is the best way to select that subview given that I know its tag?
> 
> Why tags? Use an outlet. Then just call -selectText:.
> 
> --Kyle Sluder

Or if you like it a bit more twisted (I guess that in your case outlets might 
not be an option if you have many text fields wired up to the controller via 
bindings), although I am not sure what you mean by "select that subview" - I 
take it to mean "select the bad input value in the current field editor":

In the respective delegate method (control:textShouldEndEditing: most likely), 
use the field editor from the method (or get it from the userInfo in the 
notification (key @"NSFieldEditor") for the other methods), and talk to it, 
i.e. -selectAll or the like.
Most likely you need to check which text field makes currently use of field 
editor in order to make a proper decision: go ahead and ask the field editor in 
turn for its delegate: While the field editor is active in a text field, this 
text field is set as its delegate. Ask the delegate for its tag or send 
whatever message the delegate knows about.

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: responding to NSStepper clicks

2011-12-16 Thread Peter

Am 16.12.2011 um 13:59 schrieb Koen van der Drift:

> On Thu, Dec 15, 2011 at 10:50 AM, Koen van der Drift
>  wrote:
>> On Thu, Dec 15, 2011 at 10:17 AM, Mike Abdullah
>>  wrote:
>> 
>>> NSStepper is a subclass of NSControl. Hook up its action/target to be 
>>> notified when it's adjusted.
>> 
>> I'll try that, thanks.  Using bindings sometimes makes you forget that
>> there is still some cdong needed :)
>> 
>> - Koen.
> 
> (with cdong, I meant coding :)
> 
> Adding an IBAction did the trick indeed. One aditional question, how
> do I make the textfield immediately send the updated value to
> controlTextDidChange without the need of htting enter of tabbing out
> of the field? See eg the Date/Time preference panel.
> 
> - Koen.

Not sure I am getting you right here:

As long as everything is correctly hooked up (esp. the delegate outlet of the 
text field) each and every keystroke will trigger 
-(void)controlTextDidChange:(NSNotification *)aNotification in the delegate. 
This should work out of the box. Works for me at least and has worked like this 
ever since. Put an NSLog inside or set a breakpoint to see if it works. If 
bindings are involved you might want to check the various binding options in IB.
___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: responding to NSStepper clicks

2011-12-17 Thread Peter
Here is a simple tutorial by a list member of ours:

http://juliuspaintings.co.uk/cgi-bin/paint_css/animatedPaint/059-NSStepper-NSTextField.pl

This example uses an object controller but can be reconfigured to bypass it and 
bind to an ivar easily.

Even though it uses a number formatter besides the controller it exposes the 
problem you are facing, too:

(1) Validation happens only when you leave the field.
(2) The user is not prevented from entering crap values right on the spot.

I took it as a base for some experiments of my own:

By setting validates immediately in IB for the text field and putting a handler 
like

- (BOOL)validateFloatValue:(id *)ioValue error:(NSError **)outError
{
   NSLog(@"validating");
   return YES;
}

into the model class, you can prove that whenever you type a number digit into 
the text field you see a validating message in the console, but at the same 
time the user may happily type any other crap without the validation even 
bothering to kick in. Validation furthermore stops if the value exceeds the max 
value defined in the number formatter. I could not find anything about this in 
the KVC docs, so go figure. I hope it's just me doing something terribly wrong 
or Apple's implementation is rather usless for this purpose.
I guess you might have to implement this method as a supllement if your value 
is set programmatically from various other sources.
All in all it seems way to complicated to achieve the desired effect without 
use of the delegate method. I'd be happy to see an example which does not have 
to rely on it, if this is possible at all. Maybe you have to use a custom value 
converter in the bindings or something. Dunno.

Therefore, my own implementation of a text field + stepper combination goes 
like this:

Specs:
- Only integers are allowed. Single 0 inputs, which eventually would lead to 
leading zeros, are forbidden, since the...
- minimum value is hardcoded at 2 anyway.
- The maximum value is calculated in code (by the window controller's delegate).

So I have a window controller sub-subclass for a modal window implemented like 
this (only relevant parts are shown here):

MyWC.h
@interface MyWC : ContextMenuWC {
   IBOutlet NSTextField *unitNumberField;
   IBOutlet NSStepper *unitNumberStepper;
   
   NSInteger unitSize;
   IBOutlet id delegate;
}

@property (nonatomic, assign) NSInteger unitSize;
@property (nonatomic, assign) id delegate;

- (IBAction) okAction:(id)sender;

- (id)initWithDelegate:(id )theDelegate;
@end

The stepper's value is bound directly to unitSize. IB binding setting is 
validates immediately.
The NSTextField is equally bound to unitSize. IB binding settings are all off.


MyWC.m

#import "RegexKitLite.h"

- (void)controlTextDidChange:(NSNotification *)aNotification
{
   NSText *theFieldEditor = [aNotification.userInfo 
objectForKey:@"NSFieldEditor"];
   NSString *theString = [theFieldEditor string];
   
   //0-9 only, but no single 0 (i.e. 0 only allowed in double or more digit 
numbers)
   BOOL isAcceptableIntegersOnly = ([theString 
isMatchedByRegex:@"^[0-9]{1,2}$"] && ![theString isMatchedByRegex:@"^0{1,2}$"]);
   
   if (!isAcceptableIntegersOnly) {
  //fall back to max value if input is bad
  [theFieldEditor setString:[NSString stringWithFormat:@"%ld", 
(NSInteger)[unitNumberStepper maxValue]]];
  [theFieldEditor setSelectedRange:NSMakeRange(0, [[theFieldEditor string] 
length])];
  self.unitSize = [[theFieldEditor string] integerValue];
  [self.okButton setEnabled:YES];
  return;
   }
   
   //regex matches, so the following is safe, otherwise integerValue just 
extracts digits from any kind of string value
   NSInteger theInteger = [theString integerValue];
   NSInteger theMinValue = (NSInteger)[unitNumberStepper minValue];
   //if 10 shall be allowed as input, the user has to be able to type 1
   if (theInteger < theMinValue) {
  [self.okButton setEnabled:NO];
  return;
   }
   
   if (theInteger > (NSInteger)[unitNumberStepper maxValue]) {
  //fall back to max value if input is too high
  [theFieldEditor setString:[NSString stringWithFormat:@"%ld", 
(NSInteger)[unitNumberStepper maxValue]]];
  [theFieldEditor setSelectedRange:NSMakeRange(0, [[theFieldEditor string] 
length])];
   }
   [self.okButton setEnabled:YES];
   self.unitSize = [[theFieldEditor string] integerValue];
}


Note that I initialize the bound variable to some predefined value (the maximum 
value possible in this case).
Moreover, even though both GUI elements are bound to self.unitSize, I set this 
value "manually" at the end of the delegate method to make things work.

Took me quite a bit of experimentation to get it as I wanted it. I also 
experimented with KVC validation methods for unitSize but these also didn't 
help.

(Furthermore, I experimented with a @property (copy) previousUnitSizeString as 
a backup to restore a previously accepted value if the code rejects the user 
input, but the user experience didn't

Re: Sheet created by NSObjectContoller??

2011-12-17 Thread Peter

Am 17.12.2011 um 19:59 schrieb Robert Monaghan:

> Hi Everyone,
> 
> Perhaps someone can help point me in the right direction on this:
> 
> I have an NSObjectController that maintains a UI for me.
> I have an NSTextField which contains numerical value. You could type in a 
> number, which populates an NSNumber object deep inside my code..
> Magically, my NSObjectController does its thing and maintains the UI. Very 
> cool stuff!
> 
> I just recently updated my bindings for this NSTextField, so that a a Min and 
> Max Value is respected.

Interesting! How did you do that via bindings?

> As a test, I typed a value which is outside the Min/Max value, to see what I 
> need to implement. To my surprise, a sheet is created saying "The Value 500 
> is too large." It prompts the user to Discard or Keep Change.
> Where did this come from? And how do I override this?

Implement a KVC validation method for your property. I guess.
See 
file:///Library/Developer/Shared/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html#//apple_ref/doc/uid/20002173

> I can't find info in the docs. I do see a vague reference to a "sheet" in the 
> NSObjectController Docs, with add/remove selectors, etc. But nothing concrete.
> Ideas?
> 
> Thanks!
> 
> bob.
> 
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Sheet created by NSObjectContoller??

2011-12-17 Thread Peter
Thanks for the info!
I never realized that this is possible with object controllers.

But wait a minute: While playing around with this mechanism, it turns out that 
you have a number formatter installed on the text field for this to work. I 
realized this when my app crashed after I had removed the number formatter with 
the max value binding still in place! Removing the number formatter made the 
min and max bindings as well as the discard?-dialogs disappear obviously.

Just tested this with the example project I referred to in my posting "Re: 
responding to NSStepper clicks" of tonight:
Implementing the validateXXX method for your property XXX does not help at all.
Sorry for pointing into the wrong direction.
I had hoped you might need to overwrite something in your object controller 
subclass but there seems to be nothing.

Here is a very old thread initiated by Matt Neuburg on cocoabuilder on the 
issue:

http://www.cocoabuilder.com/archive/cocoa/73532-who-is-putting-up-this-dialog.html

And another posting on the issue:

http://www.cocoabuilder.com/archive/cocoa/101845-using-validatevalue-forkey-error-to-limit-slider-range-with-cocoa-bindings.html

I couldn't make any of these work though.

And that's about all I could find - no answers really.

Am 17.12.2011 um 20:17 schrieb Robert Monaghan:

> The binding is straight forward..
> 
> You create an NSObjectController, and set the "Mode" to "Class" and the Class 
> Name to your object with a bunch of NSNumbers. (prepared with 
> @property/@synthesize, naturally)
> 
> In my NSTextField, I bind my "value", "Min Value" and "Max Value" to the 
> NSObjectController, specifying which NSNumbers are to be used for each.
> So I have have inside my object a set of NSNumbers called "maxVal" "minVal" 
> and "currentVal", my NSTextField would reflect those values.
> 
> If minVal is 10, maxValue is 20, and currentValue is 15. Everything is great. 
> Now type in 500 in the NSTextField, and out pops a sheet!
> 
> I am going to see about validation. Perhaps that is how this is happening.
> 
> bob..
> 
> 
> 
> On Dec 17, 2011, at 11:10 AM, Peter wrote:
> 
>> 
>> Am 17.12.2011 um 19:59 schrieb Robert Monaghan:
>> 
>>> Hi Everyone,
>>> 
>>> Perhaps someone can help point me in the right direction on this:
>>> 
>>> I have an NSObjectController that maintains a UI for me.
>>> I have an NSTextField which contains numerical value. You could type in a 
>>> number, which populates an NSNumber object deep inside my code..
>>> Magically, my NSObjectController does its thing and maintains the UI. Very 
>>> cool stuff!
>>> 
>>> I just recently updated my bindings for this NSTextField, so that a a Min 
>>> and Max Value is respected.
>> 
>> Interesting! How did you do that via bindings?
>> 
>>> As a test, I typed a value which is outside the Min/Max value, to see what 
>>> I need to implement. To my surprise, a sheet is created saying "The Value 
>>> 500 is too large." It prompts the user to Discard or Keep Change.
>>> Where did this come from? And how do I override this?
>> 
>> Implement a KVC validation method for your property. I guess.
>> See 
>> file:///Library/Developer/Shared/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Validation.html#//apple_ref/doc/uid/20002173
>> 
>>> I can't find info in the docs. I do see a vague reference to a "sheet" in 
>>> the NSObjectController Docs, with add/remove selectors, etc. But nothing 
>>> concrete.
>>> Ideas?
>>> 
>>> Thanks!
>>> 
>>> bob.
>>> 
>>> 
>>> ___
>>> 
>>> 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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
>>> 
>>> This email sent to magn...@web.de
>>> 
>> 
> 
> ___
> 
> 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:
> http://lists.apple.com/mailman/options/cocoa-dev/magnard%40web.de
> 
> This email sent to magn...@web.de
> 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


10.6 NSPasteboard API mixes up types?

2012-02-19 Thread Peter
I am using the following code:

  NSPasteboard *pb = [NSPasteboard generalPasteboard];
  
  if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5) {
 //linesArray contains file paths as NSStrings
 //namesArray contains file names as NSStrings
 [pb declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, 
NSStringPboardType, nil] owner:nil];
 [pb setPropertyList:linesArray forType:NSFilenamesPboardType];
 [pb setString:[namesArray componentsJoinedByString:@"\n"] 
forType:NSStringPboardType];
  }
  else { // >= 10.6
 //linesArray contains NSURLs
 //namesArray contains file names as NSStrings
 [pb clearContents];
 [pb setString:[namesArray componentsJoinedByString:@"\n"] 
forType:NSPasteboardTypeString];
   //[pb writeObjects:namesArray];
 [pb writeObjects:linesArray]; // write the URLs
 }

The 10.5 code results in distinct entities for both of the pasteboard types as 
I expected.

type: 'public.utf8-plain-text' 
'aaa.bbb.ccc'

The 10.6 code results in the following:

type: 'public.utf8-plain-text'
'aaa.bbb.ccc.file'
'://localhost/Use'
'rs/peterjhartman'
'n/Desktop/aaa.fl'
'v.file://localho'
'st/Users/peterjh'
'artmann/Desktop/'
'bbb.flv.file://l'
'ocalhost/Users/p'
'eterjhartmann/De'
'sktop/ccc.flv'

For reasons beyond my comprehension the NSURLs are converted to string data 
behind my back and added to the existing string data, no matter wether I use 
writeObjects or setString.

NSFilenamesPboardType contains identical property list of three file paths for 
this example in both code branches.

'./Users/pete'
'rjhartmann/Deskt'
'op/aaa.flv../Us'
'ers/peterjhartma'
'nn/Desktop/bbb.f'
'lv../Users/pete'
'rjhartmann/Deskt'
'op/ccc.flv'
'...'

Interestingly, I see file paths where I would expect file urls on 10.6.

What am I possibly doing wrong?
How could I avoid this?

Thank you for any pointers!

Peter
___

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


Bug in 10.6 NSPasteboard API? (was: 10.6 NSPasteboard API mixes up types?)

2012-02-27 Thread Peter
I am still very much puzzled by the issue I described below, so I still hope to 
find a taker for it.

While the OS 10.5 API cleanly separated pasteboard types, the 10.6 API converts 
NSURL data to strings and adds it to any existing string data - i.e. when 
pasting the data into e.g. a text view in 10.6 I get

file://localhost/Users/peterjhartmann/Desktop/Eigene%20Bilder/jan.jpg
file://localhost/Users/peterjhartmann/Desktop/Eigene%20Bilder/Nob.jpg
jan
Nob

instead of 

jan
Nob

which is the result using the 10.5 API. As described, this happens no matter 
wether I use writeObjects: or setString: and no matter wether I write the URLs 
before or after the strings.

I consider this to be a bug. Am I wrong? If so, what am I doing wrong?

Does anybody use the 10.6 pasteboard API? Judging from my web searches it seems 
that almost nobody does.

One member contacted my privately stating ...

> Not sure if you've fixed this or had any other replies, but in reading it 
> through, I notice you're not declaring the pasteboard type ([pb 
> declareTypes:...]) within this block.  Does this explain the symptoms?

but declareTypes belongs to the old API. Mixing this with the new API is 
discouraged on p. 33 of Apple's PasteboardGuide106.pdf.

I'd be very happy about any pointers into the right direction.

My original post is here:

Am 19.02.2012 um 21:24 schrieb Peter:

> I am using the following code:
> 
>  NSPasteboard *pb = [NSPasteboard generalPasteboard];
> 
>  if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5) {
> //linesArray contains file paths as NSStrings
> //namesArray contains file names as NSStrings
> [pb declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, 
> NSStringPboardType, nil] owner:nil];
> [pb setPropertyList:linesArray forType:NSFilenamesPboardType];
> [pb setString:[namesArray componentsJoinedByString:@"\n"] 
> forType:NSStringPboardType];
>  }
>  else { // >= 10.6
> //linesArray contains NSURLs
> //namesArray contains file names as NSStrings
> [pb clearContents];
> [pb setString:[namesArray componentsJoinedByString:@"\n"] 
> forType:NSPasteboardTypeString];
>   //[pb writeObjects:namesArray];
> [pb writeObjects:linesArray]; // write the URLs
> }
> 
> The 10.5 code results in distinct entities for both of the pasteboard types 
> as I expected.
> 
> type: 'public.utf8-plain-text' 
> 'aaa.bbb.ccc'
> 
> The 10.6 code results in the following:
> 
> type: 'public.utf8-plain-text'
> 'aaa.bbb.ccc.file'
> '://localhost/Use'
> 'rs/peterjhartman'
> 'n/Desktop/aaa.fl'
> 'v.file://localho'
> 'st/Users/peterjh'
> 'artmann/Desktop/'
> 'bbb.flv.file://l'
> 'ocalhost/Users/p'
> 'eterjhartmann/De'
> 'sktop/ccc.flv'
> 
> For reasons beyond my comprehension the NSURLs are converted to string data 
> behind my back and added to the existing string data, no matter wether I use 
> writeObjects or setString.
> 
> NSFilenamesPboardType contains identical property list of three file paths 
> for this example in both code branches.
> 
> ' '.0" encoding="UT'
> 'F-8"?>. ' plist PUBLIC "-'
> '//Apple//DTD PLI'
> 'ST 1.0//EN" "htt'
> 'p://www.apple.co'
> 'm/DTDs/PropertyL'
> 'ist-1.0.dtd">. 'list version="1.'
> '0">... 'ring>/Users/pete'
> 'rjhartmann/Deskt'
> 'op/aaa.flv 'ng>../Us'
> 'ers/peterjhartma'
> 'nn/Desktop/bbb.f'
> 'lv.. 'ring>/Users/pete'
> 'rjhartmann/Deskt'
> 'op/ccc.flv 'ng>.. 'tring>..'
> '. 'y>..'
> 
> Interestingly, I see file paths where I would expect file urls on 10.6.
> 
> What am I possibly doing wrong?
> How could I avoid this?
> 
> Thank you for any pointers!
> 
> Peter
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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: sudden errors

2012-02-28 Thread Peter
I'd suggest that you check that the target for your ViewManager .h and .m files 
is (still) correctly set.
Get info on the files in XCode (in XCode 3 using a ctrl-click on the file) and 
check the target.


Am 28.02.2012 um 10:45 schrieb H. Miersch:

> 
> i just ran a little test: i went into my appcontroller.h and turned the 
> #import "ViewManager.h" line into a comment, then tried to build. result: 
> EXACTLY the same errors. it's like that line isn't even there. WTF?
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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: Finding object array index when iterating through array

2012-03-08 Thread Peter

Am 08.03.2012 um 03:39 schrieb Greg Parker:

> On Mar 6, 2012, at 6:19 PM, Marco Tabini  wrote:
>>> I have an array and I am iterating through it using this technique:
>>> 
>>>> for (id object in array) {
>>>>  // do something with object
>>>> }
>>> 
>>> Is there  way to obtain the object's current array index position or do I 
>>> have to add a counter?
>> 
>> [array indexOfObject:object] should do the trick, though, if you need to do 
>> it at every iteration, keeping a counter may be better.
> 
> Note that -indexOfObject: returns an object from the array that is -isEqual: 
> to the parameter. This might not be the same object that you are looking at. 
> 
> -indexOfObjectIdenticalTo: would solve the -isEqual: problem, but would still 
> return the wrong index if the same object were in the array twice.
> 
> You should add a counter to your for..in loop, or use a traditional counted 
> for loop and -objectAtIndex:

Finally...
After reading so much "doubtful" (= outright bad) advice I began to doubt my 
own understanding of Objective-C.
What a relief!
Thank you!

Peter
___

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


Exposing NSTableView's usesAlternatingRowBackgroundColors in the user preferences

2011-07-13 Thread Peter
I'd like to expose NSTableView's option usesAlternatingRowBackgroundColors as a 
settable preference in my app's preferences window. "Easy, just use a binding", 
I thought before I realized that NSTableView does not expose this setting via 
bindings, neither using IB nor programatically.

I found two solutions to this problem, both of them more or less 
unsatisfactory. In my NSTableView's subclass +initialize method I register the 
default value

#define defaults [NSUserDefaults standardUserDefaults]
NSDictionary *appDefaults = [NSDictionary 
dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], 
@"usesAlternatingRowBackgroundColors", nil];
[defaults registerDefaults:appDefaults];

whereas in -awakeFromNib I use the value stored in the user defaults

#define defaultValues [[NSUserDefaultsController sharedUserDefaultsController] 
values]
[self setUsesAlternatingRowBackgroundColors:[[defaultValues 
valueForKey:@"usesAlternatingRowBackgroundColors"] boolValue]];

In my preferences panel I have bound the value key of a checkbox to the shared 
user defaults controller.
This is all pretty standard and it works so far.

1. Solution
In my preferences panel's controller I have defined the following action method 
for the check box

- (IBAction)clickAlternatingRowsCheckbox:(id)sender{
   NSInteger checkboxState = [sender state];
   if (checkboxState == NSOffState) {
  [myTableView setUsesAlternatingRowBackgroundColors:NO];
   }
   else if (checkboxState == NSOnState) {
  [myTableView setUsesAlternatingRowBackgroundColors:YES];
   }
}

This solution saves the setting to the user defaults via bindings, but works 
only when the value is changed via the GUI and breaks MVC - the preferences 
controller should better not be hooked up with a view used elsewhere in the 
app. To avoid this, I deviced a 

2. Solution
I set the controller of my NSTableView's subclass as KVO observer of the key in 
the sharedUserDefaultsController:

   #define theDefaultsController [NSUserDefaultsController 
sharedUserDefaultsController]
   [theDefaultsController addObserver:self 
forKeyPath:@"values.usesAlternatingRowBackgroundColors" options: 
NSKeyValueObservingOptionNew context:NULL];   

The controller handles the observation like this

- (void) observeValueForKeyPath: (NSString *) keyPath
   ofObject: (id) object
 change: (NSDictionary *) change
context: (void *) context
{
   if ( [keyPath isEqualToString:@"values.usesAlternatingRowBackgroundColors"] 
) {
  //NSLog(@"%@", [change objectForKey:NSKeyValueChangeNewKey]);
  [self.myTableView 
setUsesAlternatingRowBackgroundColors:[[theDefaultsController 
valueForKeyPath:@"values.usesAlternatingRowBackgroundColors"] boolValue]];
   }
}

The problem is, that since [change objectForKey:NSKeyValueChangeNewKey] returns 
 in the log, I can't get the changed value from the change dictionary, so 
I have to read it from the sharedUserDefaultsController - which works, but 
seems pretty ridiculous. (Instead of checking the check boxes state, I could 
have used the same approach in the 1. solution, too, BTW.) Somehow, KVO seems 
to be unable to handle the boolean encoded as NSNumber. Ideas on this anybody?

Maybe the problem is that I should be using NSData to be able to use 
NSUnarchiveFromData as a value transformer - but I have no clue how to put a 
boolean into an NSData object or get one out of it in a manner which is 
compliant to NSUnarchiveFromData.

Any ideas on how to do better?

Thanks a lot!

 

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Removing (foo) from a NSString

2011-07-13 Thread Peter

Am 12.07.2011 um 21:42 schrieb Fritz Anderson:

> On 12 Jul 2011, at 2:23 PM, Eric E. Dolecki wrote:
> 
>> What would be the easiest way to strip out parens and everything between
>> them from an NSString?
>> 
>> Into The Fire (Live)
>> becomes
>> Into The Fire
> 
> NSRegularExpression will do, but it is iOS-only (so far) and doesn't help you 
> with nesting.
> 
> It should be easy to walk the string with NSScanner.

Try this as a very primitive starter (no error checking, no warranty, nothing) 
- don't use this verbatim in production code, it will work for some simple 
cases but not for others (e.g. unmatched brackets etc.).

- (NSString *)throwOutBracketedStuffFrom:(NSString *)aString {
   
   NSScanner *theScanner;
   NSString *text = nil;
   
   theScanner = [NSScanner scannerWithString:aString];
   
   while ([theScanner isAtEnd] == NO) {
  
  [theScanner scanUpToString:@"(" intoString:NULL] ; 
  
  [theScanner scanUpToString:@")" intoString:&text] ;

  aString = [aString stringByReplacingOccurrencesOfString:[NSString 
stringWithFormat:@"%@%@", text, @")"] withString:@""];
  
   }
   
   return aString;
   
}

Read up on NSScanner.
Or try RegExKitLite, which I 
prefer.___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: programmatically sorting an NSTableView

2011-07-13 Thread Peter
See here:

http://www.cocoabuilder.com/archive/cocoa/174051-programmatically-sort-nstableview.html

and here

http://www.cocoabuilder.com/archive/cocoa/115880-programatically-sorting-tableview.html

Am 12.07.2011 um 22:43 schrieb James Walker:

> I have an NSTableView containing one column, which is bound to an 
> NSArrayController.  I've set a sort key and selector for the column in IB, 
> and I've called setSortDescriptors: on the array controller. Clicking the 
> column header sorts it, but how can I sort programmatically?  It seems odd 
> that I look through the methods of NSTableView, NSTableColumn, and 
> NSArrayController, and there are methods for setting sort descriptors but 
> nothing that says "sort it".  I suppose that -[NSTableView 
> setAutomaticallyRearrangesObjects:] might help, but it requires 10.5 and I 
> need to support 10.4.  Help?
> -- 
>  James W. Walker, Innoventive Software LLC
>  

___

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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Exposing NSTableView's usesAlternatingRowBackgroundColors in the user preferences

2011-07-14 Thread Peter
Thanks Kyle for the enlightenment! Very much appreciated.
So however awkward - I guess I have to live with this technique.

Am 14.07.2011 um 18:29 schrieb Kyle Sluder:

> On Tue, Jul 12, 2011 at 11:53 AM, Peter  wrote:
>> I'd like to expose NSTableView's option usesAlternatingRowBackgroundColors 
>> as a settable preference in my app's preferences window. "Easy, just use a 
>> binding", I thought before I realized that NSTableView does not expose this 
>> setting via bindings, neither using IB nor programatically.
>> 
>> I found two solutions to this problem, both of them more or less 
>> unsatisfactory. In my NSTableView's subclass +initialize method I register 
>> the default value
>> 
>> #define defaults [NSUserDefaults standardUserDefaults]
>> NSDictionary *appDefaults = [NSDictionary 
>> dictionaryWithObjectsAndKeys:[NSNumber numberWithBool:YES], 
>> @"usesAlternatingRowBackgroundColors", nil];
>> [defaults registerDefaults:appDefaults];
>> 
>> whereas in -awakeFromNib I use the value stored in the user defaults
>> 
>> #define defaultValues [[NSUserDefaultsController 
>> sharedUserDefaultsController] values]
>> [self setUsesAlternatingRowBackgroundColors:[[defaultValues 
>> valueForKey:@"usesAlternatingRowBackgroundColors"] boolValue]];
>> 
>> In my preferences panel I have bound the value key of a checkbox to the 
>> shared user defaults controller.
>> This is all pretty standard and it works so far.
>> 
>> 1. Solution
>> In my preferences panel's controller I have defined the following action 
>> method for the check box
>> 
>> - (IBAction)clickAlternatingRowsCheckbox:(id)sender{
>>  NSInteger checkboxState = [sender state];
>>  if (checkboxState == NSOffState) {
>> [myTableView setUsesAlternatingRowBackgroundColors:NO];
>>  }
>>  else if (checkboxState == NSOnState) {
>> [myTableView setUsesAlternatingRowBackgroundColors:YES];
>>  }
>> }
>> 
>> This solution saves the setting to the user defaults via bindings, but works 
>> only when the value is changed via the GUI and breaks MVC - the preferences 
>> controller should better not be hooked up with a view used elsewhere in the 
>> app. To avoid this, I deviced a
>> 
>> 2. Solution
>> I set the controller of my NSTableView's subclass as KVO observer of the key 
>> in the sharedUserDefaultsController:
>> 
>>  #define theDefaultsController [NSUserDefaultsController 
>> sharedUserDefaultsController]
>>  [theDefaultsController addObserver:self 
>> forKeyPath:@"values.usesAlternatingRowBackgroundColors" options: 
>> NSKeyValueObservingOptionNew context:NULL];
>> 
>> The controller handles the observation like this
>> 
>> - (void) observeValueForKeyPath: (NSString *) keyPath
>>  ofObject: (id) object
>>change: (NSDictionary *) change
>>   context: (void *) context
>> {
>>  if ( [keyPath isEqualToString:@"values.usesAlternatingRowBackgroundColors"] 
>> ) {
>> //NSLog(@"%@", [change objectForKey:NSKeyValueChangeNewKey]);
>> [self.myTableView 
>> setUsesAlternatingRowBackgroundColors:[[theDefaultsController 
>> valueForKeyPath:@"values.usesAlternatingRowBackgroundColors"] boolValue]];
>>  }
>> }
>> 
>> The problem is, that since [change objectForKey:NSKeyValueChangeNewKey] 
>> returns  in the log, I can't get the changed value from the change 
>> dictionary, so I have to read it from the sharedUserDefaultsController - 
>> which works, but seems pretty ridiculous. (Instead of checking the check 
>> boxes state, I could have used the same approach in the 1. solution, too, 
>> BTW.) Somehow, KVO seems to be unable to handle the boolean encoded as 
>> NSNumber. Ideas on this anybody?
> 
> 
> No, all of this seems pretty standard.
> 
> NSController subclasses do not support NSKeyValueChangeOldKey or
> NSKeyValueChangeNewKey. This is a longstanding bug in NSController.
> rdar://problem/3404770
> 
> The solution is to query the object directly for its new value.
> Really, this is all that NSKeyValueChangeNewKey is doing for you. See
> the comments on the various -will/didChangeValueForKey: variants in
> NSKeyValueObserving.h for precisely what NSKeyValueChange{Old,New}Key
> contains. NSKeyValueChangeOldKey is slightly more powerful, since it
> gets sent at -didChangeValueForKey: time but contains information that
> only existed at -willChangeValueForKey: time. But in many

A better solution? - Accessing an array of strings saved to user defaults via bindings (solved in the end...)

2011-07-14 Thread Peter
I have found various references on this list and on the web about the 
impossibility to hook up an *editable* single-column NSTableView to an 
NSMutableArray of strings via bindings - and about some clever ways to work 
around this limitation. These workarounds may work in principle, but fail in a 
NSUserDefaultsController-NSArrayController-NSTableView setup.

I tried to be exceedingly clever using the following category (as proposed by 
Joanna Carter http://carterconsulting.org.uk/forums/viewtopic.php?f=3&t=14):

@interface NSMutableString (KVCHelper) 
@property (copy) NSString *string;
@end

@implementation NSMutableString (KVCHelper)
@dynamic string;
- (NSString *) string{
   return self;
} 
@end

alongside with various NSValueTransformers converting strings or arrays to 
their mutable variants, as well as converting the array to a mutable dictionary 
and back using this one

#import "ArrayOfStringsToArrayOfMutableDictionariesVT.h"
#define kStringKey @"stringKey"

@implementation ArrayOfStringsToArrayOfMutableDictionariesVT
+ (Class) transformedValueClass
{
return [NSMutableArray class];
}

+ (BOOL) allowsReverseTransformation
{
return YES;
}

- (id) transformedValue:(id)array
{
   NSMutableArray *myMutableArray = [[NSMutableArray alloc] 
initWithCapacity:[array count]];
   for (NSString *myString in array) {
  [myMutableArray addObject:[NSMutableDictionary 
dictionaryWithObject:myString forKey:kStringKey]];
   }
   return [myMutableArray autorelease];
}

- (id) reverseTransformedValue:(id)array
{
   NSMutableArray *myMutableArray = [[NSMutableArray alloc] 
initWithCapacity:[array count]];
   for (NSDictionary *myDictionary in array) {
  [myMutableArray addObject:[myDictionary objectForKey:kStringKey]];
   }
   return [myMutableArray autorelease];
}
@end

All to no avail, they work but don't help. The dead end is always 
NSUserDefaults, or more precisely its controller. It's such a pain that you can 
save an NSArray in user defaults but then nevertheless be unable to access it 
using bindings.

So my question is:

How could I possibly wrap an NSArray in the user defaults in a way that I can 
conveniently access it via bindings to populate an editable NSTableView? Is 
there a way to wrap an NSArray into some kind of opaque data object, so that 
the array controller is prevented from accessing single items in the array, but 
instead receives it from and hands it over to the user defaults controller in a 
single item lump?

My point is: I'd like to abandon saving an NSArray in the user defaults if I 
can use something similarly ordered and access it via bindings instead. I know 
I could create a wrapper class for each string element in the array, but I 
wonder if there isn't an easier solution choosing a different container object.

There is still a rumor about the NSUserDefaultsController yielding immutable 
objects and this being one source for this problem. That's untrue. It seems to 
have changed with OS 10.4. I can write data from a table view to the 
applications preferences plist, but the data type is wrong - the string "test" 
(set via the table view in the GUI) is wrapped into a dictionary on write, 
whereas the rest (set programmatically on initialization) are simple strings:

{
fruitsList = (
{
abc = test;
},
Orange,
Strawberry,
Raspberry,
Whatnot
);
}
 
OK - this was the pointer to myself - silly...

I converted my original array of strings (= myArray) to a mutable array of 
mutable dictionaries, each containing a single string under some arbitrary key 
(which has to be kept constant for all these dictionaries, of course). So my 
+initialize method looks as follows:

   NSArray *myArray = [NSMutableArray arrayWithObjects:@"Apple", @"Orange", 
@"Strawberry", @"Raspberry", @"Whatnot", nil];
   NSMutableArray *myMutableArray = [[NSMutableArray alloc] 
initWithCapacity:[myArray count]];
   for (NSString *myString in myArray) {
  [myMutableArray addObject:[NSMutableDictionary 
dictionaryWithObject:myString forKey:@"abc"]];
   }
   
   NSDictionary *appDefaults = [NSDictionary dictionaryWithObjectsAndKeys:
myMutableArray,
@"fruitsList", 
nil];
   
   [[NSUserDefaults standardUserDefaults] registerDefaults:appDefaults];

And my application prefs plist looks like this:
{
fruitsList = (
{
abc = Apple;
},
{
abc = Orange;
},
{
abc = Strawberry;
},
{
abc = Raspberry;
},
{
abc = Whatnot;
}
);
}

Setting the model key path for the table column to abc (while checking Handles 
Content as Compound Value) makes it possible to access and edit all these 
strings via bindings.

Is there a more elegant/efficient solution than l

Re: NSTextView won't deallocate

2011-07-18 Thread Peter
Maybe I am missing something, but given your example - which in some sense 
contradicts your comment, why do you expect dealloc to be called?

If the retain count is in fact > 0 after the release (4 in your example below) 
dealloc is not called, since the view can not yet be deallocated.
View.release just means "*I* (i.e. the caller) don't care about you any 
longer". But if some other object still cares (i.e. the retain count > 0, as in 
your example), dealloc won't be called. In short: release != dealloc. Or the 
other way round: only after x retains are balanced by the same number of 
release messages, dealloc eventually will be called by the runtime and the 
object is  finally cleaned up and purged from memory.

Sorry if I am getting you wrong and point out the obvious ...

Am 17.07.2011 um 22:41 schrieb Ryan Joseph:

> Simple question that is causing serious memory leaks in my app. Why given 
> that example will dealloc never be called? I know the retainCount doesn't 
> tell the whole story and it may be retained by other objects (rightfully so) 
> but then WHEN will it be released if not when I request it to? I must be 
> missing something... Thanks!
> 
> The code (in Pascal):
> 
> view := NSTextView.alloc.initWithFrame(NSMakeRect(0, 0, 0, 0));
> // retainCount = 5
> view.release;
> // retainCount = 4, dealloc never called
> 
> Regards,
>   Ryan Joseph
>   thealchemistguild.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: NSTextView won't deallocate

2011-07-18 Thread Peter
Yes - so the more appropriate question is why it was retained 4 times.
I don't see Cocoa doing it.
It's the programmer - mostly.
Could you give us more code?

Cocoa gives us a very reliable way to know, when an object is released: If the 
reference count goes down to 0.
The question now is how to bring it down to 0.

Maybe these could be of help:

<http://www.friday.com/bbum/2010/01/10/using-malloc-to-debug-memory-misuse-in-cocoa/>
<http://chanson.livejournal.com/147902.html>

Both have some special tips which helped me a couple of months ago.

Am 18.07.2011 um 16:17 schrieb Ryan Joseph:

> Sure, I get reference counted memory and it could very well be true that 
> Cocoa has no intent on releasing this at anytime I could expect and that was 
> its design.
> 
> If that's true when I would ask WHEN will it be deallocated? I'm leaking 
> memory like crazy allocating these objects and would argue it's bad design on 
> Cocoas part to not give the programmer a reliable way to know when it's 
> memory will be released, as for example we may need to perform some clean up 
> when the object is released.
> 
> I wonder why Cocoa has retained it 4 times and what it plans to do with it 
> since I don't see thing that will cause the memory to be released.
> 
> Thanks.
> 
> On Jul 18, 2011, at 8:07 AM, Peter wrote:
> 
>> Maybe I am missing something, but given your example - which in some sense 
>> contradicts your comment, why do you expect dealloc to be called?
>> If the retain count is in fact > 0 after the release (4 in your example 
>> below) dealloc is not called, since the view can not yet be deallocated.
>> View.release just means "*I* (i.e. the caller) don't care about you any 
>> longer". But if some other object still cares (i.e. the retain count > 0, as 
>> in your example), dealloc won't be called. In short: release != dealloc. Or 
>> the other way round: only after x retains are balanced by the same number of 
>> release messages, dealloc eventually will be called by the runtime and the 
>> object is  finally cleaned up and purged from memory.
>> 
>> Sorry if I am getting you wrong and point out the obvious ...
> 
> Regards,
>   Ryan Joseph
>   thealchemistguild.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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Sending a list of path strings to the Finder via Scripting Bridge

2012-05-24 Thread Peter
Hi,

I'd like to reveal/select multiple items in the Finder.
NSWorkspace only handles single files as in 

[[NSWorkspace sharedWorkspace] selectFile:currentFilePath
 inFileViewerRootedAtPath:currentFilePath];

I searched Google and tried to pick up every scrap of information on the 
Scripting Bridge but I could not find anything about sending a LIST of paths.

If all fails I'll have to convert the path strings to hfs paths and 
string-assemble a script to run using NSAppleScript in code - which feels 
clumsy.

Thank you for any pointers!

Peter
___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Peter

Am 25.05.2012 um 09:09 schrieb Quincey Morris:

> On May 24, 2012, at 23:56 , Peter wrote:
> 
>> I'd like to reveal/select multiple items in the Finder.
>> NSWorkspace only handles single files as in 
>> 
>>[[NSWorkspace sharedWorkspace] selectFile:currentFilePath
>> inFileViewerRootedAtPath:currentFilePath];
> 
> How about -[NSWorkspace activateFileViewerSelectingURLs:] (10.6+)?

Oh, thanks - I admit I missed this one, but I am supporting OS 10.5, so I still 
have to find a way for it.
___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-25 Thread Peter
Thanks Shane! This is indeed a nice trick - and it's so obvious, once you are 
told. ;-)

Am 25.05.2012 um 09:24 schrieb Shane Stanley:

> On 25/05/2012, at 4:56 PM, Peter wrote:
> 
>> If all fails I'll have to convert the path strings to hfs paths and 
>> string-assemble a script to run using NSAppleScript in code
> 
> If you do end up using NSAppleScript, you can still avoid HFS paths: just use 
> 'POSIX file "/Users/fred/whatever.txt"'.
> 
> -- 
> Shane Stanley 
> 'AppleScriptObjC Explored' 
> 
> 
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
Answering my own post:

After much experimentation I come to the conclusion that this is impossible 
using Scripting Bridge.
Interestingly, a code example from Apple called SBSetFinderComment, which 
illustrates setting Finder comments using Scripting Bridge includes a "Reveal 
in Finder" function - for which it uses the method -[NSWorkspace 
activateFileViewerSelectingURLs:] Quincey Morris pointed out to me.

The reason for this, as far as I can see, is a fundamental design problem, i.e. 
to my utter astonishment, there is no way to assemble a list of arbitrary paths 
as the target of an AppleScript command.

(a) All AS elements have to be added to a SBElementsArray before you can work 
with them.

(b) There is no way to alloc-init an SBElementsArray to add arbitrary elements 
to it.

(c) Therefore you have to use one of the SBElementsArrays prepared by the 
Finder, i.e. [finder items] (see the code example above), which BTW, as it 
would in plain AppleScript, by default designates the items on the user's 
Desktop. There seems to be no way to specify any user defined folder (!) - see 
(f) below.

(d) There is no way to delete the items from a given SBElementsArray and then 
add elements by the user's choice: [[finder items] removeAllObjects] will not 
clear the array, but instead move all items on your Desktop to the trash! (I 
consider this to be a bug.)

(e) It is perfectly possible to reveal multiple items in the Finder. It is as 
simple as issuing [[finder items] reveal]. The problem is that there is no way 
to specify multiple arbitrary items: You can easily loop over an array of file 
paths, convert them to NSURLs (although Finder.h maintains that the URLs have 
to be NSStrings), and issue [[[finder items] objectAtLocation:theFileURL] 
reveal] - but this way the items will be revealed consecutively and not 
simultaneously. There are of course a lot of occasions where consecutive 
execution may be perfectly viable, but not here.

(f) The Scripting Bridge talks at length about efficient coding using bulk 
operation methods. On the other hand, it does not even seem to provide a simple 
means to, say, access the elements from a specific folder X and narrow these 
down using filteredArrayUsingPredicate - with the exceptions of those 
predefined in the Finder sdef/Finder.h: i.e. the trash, home, startup disk, 
desktop and the like. For all other cases you have to access items individually 
and therefore inefficiently using objectAtLocation: or similar.

This is an ugly mess. I am sorry to say so. I could not believe it, which is 
why I asked here. At least, Scripting Bridge was certainly not designed with 
the Finder in mind. It may work better for other scriptable applications, 
though. One more half-baked technology from Apple (as is the new pasteboard API 
in its current implementation even if it looks very elegant on the surface - I 
guess quite a good deal of people will be bitten by it if it becomes 
compulsory, since it prevents you from doing some simple things possible with 
the current API; see my inquiry on this list a couple of weeks ago). It is a 
shame that appscript can no longer be supported for current and future OSes. It 
is/was far superior.

In the end I chose to use NSAppleScript using Shane's trick below and it turns 
out to be astonishingly fast and easy. (Even if it is supposed to leak memory.)

Thanks for all your comments!

Am 25.05.2012 um 09:31 schrieb Peter:

> Am 25.05.2012 um 09:24 schrieb Shane Stanley:
> 
>> On 25/05/2012, at 4:56 PM, Peter wrote:
>> 
>>> If all fails I'll have to convert the path strings to hfs paths and 
>>> string-assemble a script to run using NSAppleScript in code
>> 
>> If you do end up using NSAppleScript, you can still avoid HFS paths: just 
>> use 'POSIX file "/Users/fred/whatever.txt"'.
>> 
>> -- 
>> Shane Stanley 
>> 'AppleScriptObjC Explored' 


___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
David,

thank you, but no, this will not work. I should have stated this explicitly:

'*** -[SBElementArray init]: should never be used.'

is the exception I get when using the method proposed by you. In my experience, 
all other alloc-init variants fail in the same way. It is impossible to alloc 
and/or init an SBElementArray.

(Posting this to the list, too, since it is a valuable addition to the 
discussion.)

Am 26.05.2012 um 11:26 schrieb David A. Lyons:

> I haven't tried it myself, but:
> 
> <https://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html>
> 
>> For adding scripting objects to element arrays, you may use NSMutableArray 
>> methods such as insertObject:atIndex: and addObject:. To remove objects from 
>> element arrays, call removeObject: (or a related method of NSMutableArray) 
>> on the element array.
> 
> ...so perhaps you can call +[SBElementArray array] to get an empty one and 
> then add to it.  Cheers,
> 
> --Dave
> 
> 
> 
> On May 26, 2012, at 12:42 AM, Peter  wrote:
> 
>> Answering my own post:
>> 
>> After much experimentation I come to the conclusion that this is impossible 
>> using Scripting Bridge.
>> Interestingly, a code example from Apple called SBSetFinderComment, which 
>> illustrates setting Finder comments using Scripting Bridge includes a 
>> "Reveal in Finder" function - for which it uses the method -[NSWorkspace 
>> activateFileViewerSelectingURLs:] Quincey Morris pointed out to me.
>> 
>> The reason for this, as far as I can see, is a fundamental design problem, 
>> i.e. to my utter astonishment, there is no way to assemble a list of 
>> arbitrary paths as the target of an AppleScript command.
>> 
>> (a) All AS elements have to be added to a SBElementsArray before you can 
>> work with them.
>> 
>> (b) There is no way to alloc-init an SBElementsArray to add arbitrary 
>> elements to it.
>> 
>> (c) Therefore you have to use one of the SBElementsArrays prepared by the 
>> Finder, i.e. [finder items] (see the code example above), which BTW, as it 
>> would in plain AppleScript, by default designates the items on the user's 
>> Desktop. There seems to be no way to specify any user defined folder (!) - 
>> see (f) below.
>> 
>> (d) There is no way to delete the items from a given SBElementsArray and 
>> then add elements by the user's choice: [[finder items] removeAllObjects] 
>> will not clear the array, but instead move all items on your Desktop to the 
>> trash! (I consider this to be a bug.)
>> 
>> (e) It is perfectly possible to reveal multiple items in the Finder. It is 
>> as simple as issuing [[finder items] reveal]. The problem is that there is 
>> no way to specify multiple arbitrary items: You can easily loop over an 
>> array of file paths, convert them to NSURLs (although Finder.h maintains 
>> that the URLs have to be NSStrings), and issue [[[finder items] 
>> objectAtLocation:theFileURL] reveal] - but this way the items will be 
>> revealed consecutively and not simultaneously. There are of course a lot of 
>> occasions where consecutive execution may be perfectly viable, but not here.
>> 
>> (f) The Scripting Bridge talks at length about efficient coding using bulk 
>> operation methods. On the other hand, it does not even seem to provide a 
>> simple means to, say, access the elements from a specific folder X and 
>> narrow these down using filteredArrayUsingPredicate - with the exceptions of 
>> those predefined in the Finder sdef/Finder.h: i.e. the trash, home, startup 
>> disk, desktop and the like. For all other cases you have to access items 
>> individually and therefore inefficiently using objectAtLocation: or similar.
>> 
>> This is an ugly mess. I am sorry to say so. I could not believe it, which is 
>> why I asked here. At least, Scripting Bridge was certainly not designed with 
>> the Finder in mind. It may work better for other scriptable applications, 
>> though. One more half-baked technology from Apple (as is the new pasteboard 
>> API in its current implementation even if it looks very elegant on the 
>> surface - I guess quite a good deal of people will be bitten by it if it 
>> becomes compulsory, since it prevents you from doing some simple things 
>> possible with the current API; see my inquiry on this list a couple of weeks 
>> ago). It is a shame that appscript can no longer be supported for current 
>> and future OSes. It is/was far superior.
>> 
>> In the end I chose to use NSAppleScrip

Re: Bug in 10.6 NSPasteboard API? (was: Sending a list of path strings to the Finder via Scripting Bridge)

2012-05-26 Thread Peter
Ken,

thank you very much for your enlightening and in-depth explanation! This is 
what I hoped somehow to receive back in February...

Over the next days I will try and put your approach to practice. If it works as 
I hope I will certainly withdraw my comment about the new API being a 
half-baken technology.

Since you are at it ;-), I remember having one more problem back then:

With the old API I could (and still do) put a list of path strings with empty 
elements on the pasteboard, e.g. four paths, the third one empty as in

/path1/item1
/path2/item1

/path2/item2

but since the new API moved to NSURLs I don't see a way to accomplish this. I 
could not find something like an empty NSURL. I use this for copying data from 
a table area to another table or table area, meaning the empty element is a 
valid piece of data. Any ideas?

Thank you!

Am 26.05.2012 um 11:13 schrieb Ken Thomases:

> On May 26, 2012, at 2:42 AM, Peter wrote:
> 
>> One more half-baked technology from Apple (as is the new pasteboard API in 
>> its current implementation even if it looks very elegant on the surface - I 
>> guess quite a good deal of people will be bitten by it if it becomes 
>> compulsory, since it prevents you from doing some simple things possible 
>> with the current API; see my inquiry on this list a couple of weeks ago).
> 
> This led me to look up your earlier messages, quoted below:
> 
> On February 27, 2012, at 2:44 AM, Peter wrote:
> 
>> I am still very much puzzled by the issue I described below, so I still hope 
>> to find a taker for it.
>> 
>> While the OS 10.5 API cleanly separated pasteboard types, the 10.6 API 
>> converts NSURL data to strings and adds it to any existing string data - 
>> i.e. when pasting the data into e.g. a text view in 10.6 I get
>> 
>> file://localhost/Users/peterjhartmann/Desktop/Eigene Bilder/jan.jpg
>> file://localhost/Users/peterjhartmann/Desktop/Eigene Bilder/Nob.jpg
>> jan
>> Nob
>> 
>> instead of
>> 
>> jan
>> Nob
>> 
>> which is the result using the 10.5 API. As described, this happens no matter 
>> wether I use writeObjects: or setString: and no matter wether I write the 
>> URLs before or after the strings.
>> 
>> I consider this to be a bug. Am I wrong? If so, what am I doing wrong?
>> 
>> Does anybody use the 10.6 pasteboard API? Judging from my web searches it 
>> seems that almost nobody does.
>> 
>> One member contacted my privately stating ...
>> 
>>> Not sure if you've fixed this or had any other replies, but in reading it 
>>> through, I notice you're not declaring the pasteboard type ([pb 
>>> declareTypes:...]) within this block.  Does this explain the symptoms?
>> 
>> but declareTypes belongs to the old API. Mixing this with the new API is 
>> discouraged on p. 33 of Apple's PasteboardGuide106.pdf.
>> 
>> I'd be very happy about any pointers into the right direction.
>> 
>> My original post is here:
>> 
>> Am 19.02.2012 um 21:24 schrieb Peter:
>> 
>>> I am using the following code:
>>> 
>>> NSPasteboard *pb = [NSPasteboard generalPasteboard];
>>> 
>>> if (floor(NSAppKitVersionNumber) <= NSAppKitVersionNumber10_5) {
>>>//linesArray contains file paths as NSStrings
>>>//namesArray contains file names as NSStrings
>>>[pb declareTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, 
>>> NSStringPboardType, nil] owner:nil];
>>>[pb setPropertyList:linesArray forType:NSFilenamesPboardType];
>>>[pb setString:[namesArray componentsJoinedByString:@"\n"] 
>>> forType:NSStringPboardType];
>>> }
>>> else { // >= 10.6
>>>//linesArray contains NSURLs
>>>//namesArray contains file names as NSStrings
>>>[pb clearContents];
>>>[pb setString:[namesArray componentsJoinedByString:@"\n"] 
>>> forType:NSPasteboardTypeString];
>>>  //[pb writeObjects:namesArray];
>>>[pb writeObjects:linesArray]; // write the URLs
>>>}
> 
> I think you are failing to understand the nature of the change introduced 
> with 10.6.  Prior to 10.6, there was always a single pasteboard item.  It 
> could have multiple types/representations.
> 
> Since it is clearly sometimes desirable to have multiple things on the 
> pasteboard, there was a hack.  Some of the types were "plural", like 
> NSFilenamesPboardType.  So, with your 10.5 code path, there's a single item.  
> One of its types/representations is an arra

Re: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
In partial rehabilitation of the Scripting Bridge, I should add that it 
certainly makes life A LOT easier than using NSAppleScript when pulling out 
data from a scriptable application: just try to make sense of the 
NSAppleEventDescriptor NSAppleScript returns, even given the flaws I pointed 
out in my previous posts.
___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter

Am 26.05.2012 um 13:07 schrieb Shane Stanley:

> On 26/05/2012, at 8:24 PM, Peter wrote:
> 
>> In partial rehabilitation of the Scripting Bridge, I should add that it 
>> certainly makes life A LOT easier than using NSAppleScript when pulling out 
>> data from a scriptable application: just try to make sense of the 
>> NSAppleEventDescriptor NSAppleScript returns, even given the flaws I pointed 
>> out in my previous posts.
> 
> FWIW, if you didn't have to go back beyond 10.6, AppleScriptObjC also skirts 
> that issue -- and the issue of trying to translate AppleScript back to 
> SBStuff.
> 
> -- 
> Shane Stanley 
> 'AppleScriptObjC Explored' 

Yes, I suppose so. On the other hand I have never seen/never tried to call 
AppleScript from Cocoa in AppleScriptObjC terms - if this wording makes sense 
at all. I don't remember reading about this in your book, which focuses of 
course on accessing Cocoa from AppleScript.

___ Peter Hartmann 

mailto:hphartm...@justmail.de



___

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: Sending a list of path strings to the Finder via Scripting Bridge

2012-05-26 Thread Peter
Thank you! You might want to add this to an appendix of your book some time.

Am 26.05.2012 um 14:58 schrieb Shane Stanley:

> On 26/05/2012, at 10:25 PM, Peter wrote:
> 
>> On the other hand I have never seen/never tried to call AppleScript from 
>> Cocoa in AppleScriptObjC terms - if this wording makes sense at all. I don't 
>> remember reading about this in your book, which focuses of course on 
>> accessing Cocoa from AppleScript.
> 
> It's not in the book, but it's pretty simple. You just need to stick to 
> passing objects of the main classes (NSString, NSArray, NSNumber, 
> NSDictionary, NSData) and coercing them in the receiving handler. So in this 
> case you might have an AS "class" with a handler like this:

Just for clarification:

This AS handler would then live in a .applescript file in my project wrapped in 

script ASClassInstance
> on selectItemsInFinder_(arrayOfPaths)
>   set arrayOfPaths to arrayOfPaths as list -- coerce from pseudo-pointer 
> to AS object
>   set fileList to {}
>   repeat with aPath in arrayOfPaths
>   set end of fileList to aPath as POSIX file
>   end repeat
>   tell application "Finder" to select fileList
> end selectItemsInFinder_
end script

> And you can call it as either a class or instance method:
> 
> NSArray *array = *paths*
> [ASClassInstance selectItemsInFinder:array];
> 
> or:
> 
> [[ASClassName alloc] init] selectItemsInFinder:array];
> 
> or:
> 
> [ASClassName selectItemsInFinder:array];

And on of the above calls would live in a .m file containing

#import  //no need to put this in main.m, I 
guess

in a project with the AppleScriptObjC linked in.

Is this correct? Does this require any special build settings?

Thanks!


___ Peter Hartmann 

mailto:hphartm...@justmail.de



___

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


Moving from popup to text field cell in table view core data binding causes exception

2012-06-27 Thread Peter
Hi,

I am currently working on a quick and dirty CD database-like app using core 
data, very early in the development.
I have two entities with properties and a relationship:

(1) recording
performer
recording date
relationship: recording-work (to-1, i.e. every recording contains one work)
(2)
composer
title
opus number
inverse relationship: work-recording (to-many, i.e. there may be many 
recordings of one single composition/work)

For experimentation with the model I set up a standard master-detail view using 
the assistant.
The work column - as expected - is setup using a popup cell, I made it show the 
work's title as the value, pretty basic, using the absolutely standard array 
controller etc., everything works, no problem.

Now, I'd like to replace the popup cell by a text field cell, to simply show 
the title - but for the life of me, I can't understand why it seems to be 
impossible to setup a binding to the property title (or any other) of the 
entity work.
Binding the recordings controller's arranged objects to the keypath work.title 
does not work, as does any other binding I tried. I always get the exception

"this class is not key value coding-compliant for the key content"

I am sure I am doing something terribly wrong, but I didn't manage to come up 
with an explanation/solution either in the docs or on the web.

How should I solve this problem, with or without bindings?

Thanks a lot for any pointers!

Peter
___

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: Moving from popup to text field cell in table view core data binding causes exception

2012-06-27 Thread Peter
Thank you Fritz (and also for your books on Xcode, BTW),

I found that content in the error message totally cryptic, seemingly unrelated 
to the respective settings in IB.

I have torn everything down again and recreated it in between - and what used 
not to work before works now. I simply got more and more unsure if my 
conceptual understanding lacked somehow fundamentally. I am relieved to realize 
it did not.

This may be a bug in IB 3.2.6 which I am still using.
I sometimes find binding settings not sticking or getting confused if you 
change individual settings without disabling the binding completely before and 
reenabling the binding again after the change. Too much experimenting obviously 
left IB in a somehow confused state.

Anyway - works now - sorry for the noise.

Am 27.06.2012 um 19:42 schrieb Fritz Anderson:

> On 27 Jun 2012, at 10:51 AM, Peter wrote:
> 
>> Now, I'd like to replace the popup cell by a text field cell, to simply show 
>> the title - but for the life of me, I can't understand why it seems to be 
>> impossible to setup a binding to the property title (or any other) of the 
>> entity work.
>> Binding the recordings controller's arranged objects to the keypath 
>> work.title does not work, as does any other binding I tried. I always get 
>> the exception
>> 
>> "this class is not key value coding-compliant for the key content"
> 
> Pop-up cells have a binding named "content." Text fields do not; they have 
> "value." The full error message named the class that didn't have the key; it 
> would clue you in to what kind of object was having the problem, and narrowed 
> your search away from your model objects.
> 
> How did you change the column cell's class? By dragging the new cell into it, 
> or by changing the class in the identity inspector? Don't do the latter 
> (unless you're setting a custom subclass of what's already there).

Yes, I know, this is another kind of IB oddity, since it suggests a possibility 
which won't work in the end.


___

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


How to set a default filter on an NSTableView so that no data is displayed if NSSearchField is empty?

2012-07-07 Thread Peter
Hi,

is there an elegant/easy way to achieve this?

The scenario:
Target 10.5 on OS 10.6 (10.5 may be given up in the future). 
Cell based table view bound to core data.
Controller set to prepares content, so all the data is loaded.
On entering a string into an NSSearchField the data is filtered.
This is pretty default and works.

What I want to see:
The table view comes up empty.
On entering a string, the table view displays the filtered data.
I clear the string and the table view goes blank again.

How could I achieve this?

I guess I could check for an empty string in controlTextDidChange: and set a 
predicate which is tailored not to find any matches, but somehow I'd rather 
find a way to execute a precise fetch using the NSSearchField instead of 
unnecessarily loading a lot of bloat into memory and only to narrow that down 
again for display.

At least this is how I assume the standard controller filter bindings work - or 
does the filtering really execute a fetch on core data behind the scenes? If 
the latter is the case it would eventually suffice to prevent data from being 
displayed for empty filter values.

Any insights?
Has anybody done something like this?

Any pointers are appreciated!

Thanks!

Peter
___

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: Forcing Core Data to save attribute changed behind its back?

2012-07-24 Thread Peter
What do you try to win by changing the attribute bind CD's back?

If you want to take it out of undo you might switch it off temporarily (e.g. 
[undoManager disableUndoRegistration], or store the undo manager in a local, 
set the context's undo to nil, and restore it - which may or may not cause 
trouble depending on whats happening in your object graph. I use GCUndoManager 
to stay away from such trouble.)

Apart from that there is

- (void)refreshObject:(NSManagedObject *)object mergeChanges:(BOOL)flag

as well as the

- (void)setPrimitiveValue:(id)value forKey:(NSString *)key

methods, depending on what you intend to achieve.

Dunno if these might help.

Am 24.07.2012 um 00:03 schrieb Sean McBride:

> Hi all,
> 
> I have a managed object where one of the attributes is quite large and so 
> when I change it, instead of the usual setAttribute:newValue I mutate the 
> object directly.  Of course, Core Data does not know that I've done this.  
> I'm looking for a way to tell it.  (Otherwise, if the thing is mutated after 
> the document is first saved, Core Data cleverly skips updating this 
> attribute.)
> 
> I've tried:
> - setAttribute:sameValue
> - will/didChangeValueForKeyPath: but that's not a sufficient 'kick'
> 
> Any other suggestions?
> 
> Thanks,
> 
> -- 
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com 
> Mac Software Developer  Montréal, Québec, Canada
> 
> 
> 
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___ Peter Hartmann 

mailto:hphartm...@justmail.de



___

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: NSTableView how to sort rows after modify datasource array

2012-10-12 Thread Peter

Am 02.10.2012 um 11:56 schrieb Евсеев Алексей:

> sorry for my english
> 
> I have a form with NSTableView and two button "add" and "remove"
> 
> "Add" button add's item into datasource array. And new row will show only 
> after restart program.
> 
> "Remove" button remove item from array.  While select another rows deleted 
> rows will empty but visible.
> 
> how i may reload table data. I test table.reload that no visible effect.
> 

[myTableView reloadData]

if you are using a data source - which is what your message suggests.
If you switch to an NSArrayController it will do that auto-magically for you.

> Thank you.
> Aleksey.
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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: Get the current displayed NSAlert

2012-12-03 Thread Peter
Do you mean something like

[[self window] attachedSheet]


Am 04.12.2012 um 02:13 schrieb Brad O'Hearne:

> Hello all, 
> 
> Is there a way to get a reference to the currently displayed modal NSAlert, 
> or to be able to globally determine if a modal alert is presently showing in 
> a Cocoa app, though you have no knowledge of where in the app it originated 
> from? 
> 
> Thanks, 
> 
> Brad
> 
> Brad O'Hearne
> Founder/Lead Developer
> Big Hill Software LLC
> http://www.bighillsoftware.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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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: Cococa-Dev : was [coredata count not fulfill fault after object delete]

2013-01-10 Thread Peter

Am 10.01.2013 um 18:06 schrieb Martin Hewitson:

> And I forgot to mention: the persistent store seems to get saved since when I 
> restart the app (it's unusable after the CoreData error) the removed entities 
> are not present. Curiouser and curiouser.
> 
> Martin
> 
> 
> 
> On 10, Jan, 2013, at 06:05 PM, Martin Hewitson  
> wrote:
> 
>> 
>> On 9, Jan, 2013, at 04:26 PM, Mike Abdullah  
>> wrote:
>> 
>>> 
>>> On 8 Jan 2013, at 05:53, Martin Hewitson wrote:
>>> 
 
 On Jan 7, 2013, at 08:44 PM, Mike Abdullah  
 wrote:
 
> 
> On 7 Jan 2013, at 16:35, Martin Hewitson  
> wrote:
> 
>> Hi Francisco,
>> 
>> Thanks for the feedback!
>> 
>> What you suggest sounds like it might fix the problem, but I'm wondering 
>> how best to do this. Currently I'm just calling -remove: on the tree 
>> controller to delete the selected object(s). Of course, if I clear the 
>> selection first, then -remove: doesn't do anything. I can grab an array 
>> of the selected objects before clearing the selection then use 
>> NSManagedObjectContext's -deleteObject:. So something like this:
>> 
>> // get a pointer to the selected items
>> NSArray *items = [self selectedObjects];
>> 
>> // clear selection
>> [self setSelectionIndexPaths:@[]];
>> 
>> // now delete from the MOC
>> for (NSManagedObject *item in items) {
>> [self.managedObjectContext deleteObject:item];
>> [self.managedObjectContext processPendingChanges];
>> }
>> 
>> Does that look sensible to you?
> 
> Why are you calling -processPendingChanges at each iteration of the loop? 
> Calling it yourself is rarely needed, and best done only with 
> justification.
> 
 
 I read in that thread that I referenced (I think) that it may be necessary 
 to do this to avoid/handle objects being deleted twice (if a parent and 
 child are selected, then deleted). To be honest, I'm just trying things to 
 see what works. Since this problem only occurs on 10.6.8, I think I'm 
 looking for a work-around.
>>> 
>>> Hmm. In my case I go to some lengths to figure out which objects don't need 
>>> to be deleted, because an ancestor has already been deleted. It does seem 
>>> simpler your way.
>>> 
>>> I wonder though — I don't believe there is any harm in asking Core Data to 
>>> delete an object that's already been marked for deletion. And indeed, you 
>>> code is doing that. The difference the -processPendingChanges call makes is 
>>> that handling the delete rule will happen during that call, so child 
>>> objects are already marked for deletion.
>>> 
>> 
>> However, I'm still not able to get this to work on 10.6.8.  Having the 
>> -processPendingChanges call seems to make no difference.
>> 
>> The code I currently have in my -remove: method of the NSTreeController 
>> subclass is
>> 
>>   // get a pointer to the selected items
>>   NSArray *items = [self selectedObjects];
>> 
>>   // clear selection
>>   [self.outlineView selectRowIndexes:[NSIndexSet indexSet] 
>> byExtendingSelection:NO];
>>   [self setSelectionIndexPaths:@[]];
>> 
>>   // now from the MOC
>>   for (NSManagedObject *item in items) {
>> [self removeObjectAtArrangedObjectIndexPath:[self 
>> indexPathToObject:item]];
>> [self.managedObjectContext deleteObject:item];
>> [self.managedObjectContext processPendingChanges];
>>   }
>> 
>> (-indexPathToObject: comes from a category NSTreeController_Extensions.h 
>> from Jonathan Dann)
>> 
>> Despite this, I must still have a reference to a deleted object somewhere, 
>> but I've no idea where.

What about the undo manager - if you are using undo?

>> Could there be other reasons for getting the "CodeData could not fulfull a 
>> fault" error?
>> 
>> Best wishes,
>> 
>> Martin
>> 
>> 
>> 
>> 
> 
> 
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___

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: Cococa-Dev : was [coredata count not fulfill fault after object delete]

2013-01-10 Thread Peter

Am 10.01.2013 um 18:38 schrieb Martin Hewitson:

> 
> On 10, Jan, 2013, at 06:25 PM, Peter  wrote:
> 
>> 
>> Am 10.01.2013 um 18:06 schrieb Martin Hewitson:
>> 
>>> And I forgot to mention: the persistent store seems to get saved since when 
>>> I restart the app (it's unusable after the CoreData error) the removed 
>>> entities are not present. Curiouser and curiouser.
>>> 
>>> Martin
>>> 
>>> 
>>> 
>>> On 10, Jan, 2013, at 06:05 PM, Martin Hewitson  
>>> wrote:
>>> 
>>>> 
>>>> On 9, Jan, 2013, at 04:26 PM, Mike Abdullah  
>>>> wrote:
>>>> 
>>>>> 
>>>>> On 8 Jan 2013, at 05:53, Martin Hewitson wrote:
>>>>> 
>>>>>> 
>>>>>> On Jan 7, 2013, at 08:44 PM, Mike Abdullah  
>>>>>> wrote:
>>>>>> 
>>>>>>> 
>>>>>>> On 7 Jan 2013, at 16:35, Martin Hewitson  
>>>>>>> wrote:
>>>>>>> 
>>>>>>>> Hi Francisco,
>>>>>>>> 
>>>>>>>> Thanks for the feedback!
>>>>>>>> 
>>>>>>>> What you suggest sounds like it might fix the problem, but I'm 
>>>>>>>> wondering how best to do this. Currently I'm just calling -remove: on 
>>>>>>>> the tree controller to delete the selected object(s). Of course, if I 
>>>>>>>> clear the selection first, then -remove: doesn't do anything. I can 
>>>>>>>> grab an array of the selected objects before clearing the selection 
>>>>>>>> then use NSManagedObjectContext's -deleteObject:. So something like 
>>>>>>>> this:
>>>>>>>> 
>>>>>>>> // get a pointer to the selected items
>>>>>>>> NSArray *items = [self selectedObjects];
>>>>>>>> 
>>>>>>>> // clear selection
>>>>>>>> [self setSelectionIndexPaths:@[]];
>>>>>>>> 
>>>>>>>> // now delete from the MOC
>>>>>>>> for (NSManagedObject *item in items) {
>>>>>>>> [self.managedObjectContext deleteObject:item];
>>>>>>>> [self.managedObjectContext processPendingChanges];
>>>>>>>> }
>>>>>>>> 
>>>>>>>> Does that look sensible to you?
>>>>>>> 
>>>>>>> Why are you calling -processPendingChanges at each iteration of the 
>>>>>>> loop? Calling it yourself is rarely needed, and best done only with 
>>>>>>> justification.
>>>>>>> 
>>>>>> 
>>>>>> I read in that thread that I referenced (I think) that it may be 
>>>>>> necessary to do this to avoid/handle objects being deleted twice (if a 
>>>>>> parent and child are selected, then deleted). To be honest, I'm just 
>>>>>> trying things to see what works. Since this problem only occurs on 
>>>>>> 10.6.8, I think I'm looking for a work-around.
>>>>> 
>>>>> Hmm. In my case I go to some lengths to figure out which objects don't 
>>>>> need to be deleted, because an ancestor has already been deleted. It does 
>>>>> seem simpler your way.
>>>>> 
>>>>> I wonder though — I don't believe there is any harm in asking Core Data 
>>>>> to delete an object that's already been marked for deletion. And indeed, 
>>>>> you code is doing that. The difference the -processPendingChanges call 
>>>>> makes is that handling the delete rule will happen during that call, so 
>>>>> child objects are already marked for deletion.
>>>>> 
>>>> 
>>>> However, I'm still not able to get this to work on 10.6.8.  Having the 
>>>> -processPendingChanges call seems to make no difference.
>>>> 
>>>> The code I currently have in my -remove: method of the NSTreeController 
>>>> subclass is
>>>> 
>>>> // get a pointer to the selected items
>>>> NSArray *items = [self selectedObjects];
>>>> 
>>>> // clear selection
>>>> [self.outlineView selectRowIndexes:[NSIndexSet indexSet] 
>>>> byExtendingSelection:NO];
>>>> [

Re: Turning off screen shot ability

2013-03-05 Thread Peter

Am 06.03.2013 um 06:13 schrieb Scott Ribe:

> On Mar 5, 2013, at 8:57 PM, Brad O'Hearne wrote:
> 
>> I am working on a security-related Mac app and I need to know the way to 
>> turn off the ability to screen shot or capture the contents of the app's 
>> window.
> 
> No, what you need to do is recognize the fundamental stupidity of the 
> requirement and drop it.

Would you be so kind as to elaborate on your statement, i.e. the "fundamental 
stupidity"?

> -- 
> Scott Ribe
> scott_r...@elevated-dev.com
> http://www.elevated-dev.com/
> (303) 722-0567 voice
> 
> 
> 
> 
> 
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de
> 


___

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


Use of Instruments.app remedies Core Data memory issue (!?)

2013-07-14 Thread Peter
Hi,


on and for OS 10.6.8 I am developing a single threaded Core Data (classical) 
music database.

The model consists of eight (to-many, to-one and inversely) interlinked 
entities around a central "recording" entity. I am using independent managed 
object contexts for viewing and editing data (as well as for import and 
export). After saving from the editing context changes are propagated to the 
viewing context and the editing context is reset and torn down.

The main table for data display shows most (if not all) of the data for each 
recording data set at one glance. The table is hooked up via array controller 
bindings, the controller preparing the total content of the database (currently 
about 38.000 data sets from a 9,3 MB MySQL store), data being filtered on the 
controller level for viewing. You may consider this a bad design decision, but 
please hold on.

The problem is, that each search being executed raises the memory footprint by 
from 15 to as much as 250 MB or even more depending on the search. After a 
couple of searches memory consumption in Activity Monitor reaches GB levels, 
swap file sizes multiply and the system slows down.

Now here comes the interesting part:

While using the out-of-the box Allocations Instrument from Instruments.app, all 
is well. The live bytes size is at around 38 MB, rises to 45-50 MB when a 
search is executed, and sinks back to 38 MB. Activity Monitor at the same time 
shows a physical memory consumption of around 120 MB, which rises a couple of 
MBs according to the size of the results list and then also falls back to the 
standard level. I can execute dozens of searches under this setup with the 
memory footprint staying at a more or less constant level - which is what I 
would expect in the first place.

When executing the identical sequence of searches with Instruments not being 
involved, the memory consumption increases single-mindedly and (depending on 
the number of hits for the query) after a couple of searches reaches the 1 GB 
level, ever growing from there.

On the other hand, Instruments.app's memory footprint increases steadily while 
running but not in the same degree as my app's. Don't know if this is normal. 
Should be.

I tried an approach adapted from code described at

http://stackoverflow.com/questions/3984222/core-data-avoiding-retain-cycles-in-to-many-relationships

to refault. Logging the registered objects from the viewing MO context to the 
console proves that the majority of objects shows the expected faults.

The interesting thing is that using or not using this code does not change 
anything. The same goes for disabling undo for the context in question.

The bottom line is: My app seems to behave very nicely while under surveillance 
of Instruments.app, but not on its own. Memory seems to get released while 
under surveillance, but not when not.

Has anybody seen something like this?
How could I try to debug or work around this phenomenon? The Core Data 
Instrument does not seem to provide anything relevant. The Leaks Instrument 
shows very small leaks here and there but not in my code and not remotely in 
the same size league. Static analysis returns no related result.

Searching the web I found an interesting article about core data memory bugs on 
iOS

http://finalize.com/2013/01/04/core-data-issues-with-memory-allocation/

but I have yet to try any of the techniques described there. I heard about Core 
Data memory handling being especially bad on 10.6 and much improved under 10.8, 
but moving to 10.8 is currently not an option.

I am sure that changing my design, i.e. executing searches as real fetches from 
the store, or reimplementing this with a real database backend should lead to 
better performance, but this is a different issue and I'd rather avoid the 
latter.

Peter



___

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: Use of Instruments.app remedies Core Data memory issue (!?) - SOLVED

2013-07-16 Thread Peter
Fritz,

thanks for your reply.

(It looks like non of your posts made it to the list, I only received your 
private copies. Maybe you are inadvertently sending from an account not 
registered with the list?)

Am 16.07.2013 um 02:43 schrieb Fritz Anderson:

> On 14 Jul 2013, at 5:45 AM, Peter  wrote:
> 
>> When executing the identical sequence of searches with Instruments not being 
>> involved, the memory consumption increases single-mindedly and (depending on 
>> the number of hits for the query) after a couple of searches reaches the 1 
>> GB level, ever growing from there.
>> 
>> On the other hand, Instruments.app's memory footprint increases steadily 
>> while running but not in the same degree as my app's. Don't know if this is 
>> normal. Should be.
> ...
>> The bottom line is: My app seems to behave very nicely while under 
>> surveillance of Instruments.app, but not on its own. Memory seems to get 
>> released while under surveillance, but not when not.
> 
> I'm inferring this from your question, but I want to be sure: How are you 
> determining that your app's memory footprint is increasing when Instruments 
> isn't attached? From Activity Monitor? Don't do that.
> 
> Activity Monitor tells you how much virtual memory your app has touched at 
> one point or another. It says nothing about whether all of that memory is 
> taken up by live objects, nor whether the pages for the former objects' 
> addresses are still in RAM. It also includes the size of shared memory 
> assets, like system libraries, that are going to be in RAM (or paged out) 
> anyway, for other processes to use.
> 
> "Real Private Memory" is the closest thing to what you want, but even that 
> isn't what you mean. Trust Instruments.

You are right and then not quite.

The explanation proved to be simple (and my investigation efforts to be 
insufficient, thus making a fool of myself): I ran my app in the debugger of 
Xcode 3.2.6. This debugger quite obviously has a severe memory handling bug 
when Core Data is involved. The simple difference to running with Instruments 
is that in that case it does not seem to go through the debugger. So - of 
course - Instruments did nothing to remedy an alleged Core Data memory issue, 
but simply prevented my app to fall prey to the memory handling bug in the 
debugger - behind my (ignorant) back. Or so at least it seems to be now. (I am 
in the habit to run all my self-developed apps constantly in the debugger to be 
able to track down problems right when they happen.)

When I run a deploy built from the Finder, the app no longer shows any signs of 
exceeding memory consumption and on top of that it is quite a bit faster.

And yes, I used Activity Monitor do determine the app's memory footprint when 
Instruments was not attached (I had no choice not to, since the problem 
manifested itself only when Instruments was NOT attached - is there any better 
way?). I did in fact know that I should not trust Activity Monitor's memory 
data in terms of quantity. But in this case I had absolutely no doubt to trust 
it in terms of quality: As mentioned in my initial post, running my app as 
single and only user application I could see my swap file sizes double and then 
triple again to multi-GB sizes (on a machine with 12 GB built in memory where I 
normally see swap sizes of a couple of 100 MB) and I could see the memory 
footprint in Activity Monitor increase single-mindedly, never falling a single 
MB, the swapping activity increasing and the machine becoming more and more 
unresponsive. Given these circumstances I felt myself entitled to put some 
confidence into Activity Monitor's data, even if only in terms of quality. The 
problem was manifest and intolerable. Certainly it was not that Activity 
Monitor's bad data seemed to create a non-existant problem.

When launching my app from the Finder, Activity Monitor now presents values 
from between 45 to 120 MB as the physical memory footprint, the value being in 
constant fluctuation depending on the state of the app. For me this proves that 
even if one is not to trust Activity Monitor in terms of quantity, there is no 
reason not to believe it in terms of quality, especially in terms of change 
over time. But Instruments doubtlessly is the tool of choice if you want to get 
exact data.

My bottom line: The debugger in Xcode 3.2.6 under OS 10.6.8 has severe memory 
handling problems related to Cora Data - so luckily this at heart is not a Core 
Data issue but a debugger issue. Beware!

Peter
___

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

Set up an editable view based NSTableView programmatically - how to?

2014-01-07 Thread Peter
Hi,

I’d be very happy if somebody could point me to an example of an editable 
NSTableView set up programmatically.

I searched the web, looked into TableViewPlayground etc. but could not come up 
with anything.

I’d actually prefer to use bindings, but my first column should simply display 
the row numbers, for which I shouldn’t need a „real“ data source, just get the 
info from the table itself. To which I can’t bind in addition to my actual data 
source. Therefore my quest for pointers to a programatical setup.

Thanks a lot,

Peter
___

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

Letting an instance know its own index within a container array - how to?

2014-01-07 Thread Peter
Rethinking the problem of how to display row numbers in a view based 
NSTableView from a different perspective:

I could use bindings if I could manage to make my row entities know their index 
within the table view content array.

As a solution I could device a delegate for my entities and make the entity 
order the delegate to send a query to the array controller about its own index 
in arranged objects.

Does this seem like a sane approach?

Thanks,

Peter
___

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: Set up an editable view based NSTableView programmatically - how to?

2014-01-07 Thread Peter

Am 07.01.2014 um 17:32 schrieb Jens Alfke :

> 
> On Jan 7, 2014, at 7:52 AM, Peter  wrote:
> 
>> I’d be very happy if somebody could point me to an example of an editable 
>> NSTableView set up programmatically.
> 
> It sounds like you just mean using a custom data source rather than relying 
> on bindings to provide the data? That’s very easy to do. Just look at the 
> docs for NSTableViewDataSource — you just need to implement the three methods 
> to provide the row count, get a cell value, and set a cell value.
> 
> —Jens

Oops, sorry, the crucial info is only in the subject line: I meant a view based 
NSTableView. Which as far as I could find out does not make use of the 
NSTableViewDataSource protocol. I seems that you have to have to use delegate 
methods to make it work.
___

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: Set up an editable view based NSTableView programmatically - how to?

2014-01-07 Thread Peter
Thank you for your comment.

Did you really manage to create *editable* view-based table views with data 
sources?
Then I am curious to know how you managed to make them editable.
A data source method channeling data from the table view to the data source is 
nowhere to be seen. 

- (void)tableView:(NSTableView *)tableView setObjectValue:(id)object 
forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row

does not seem to be called.

I have a view based table view working with a data source. But it is not (yet) 
editable.

The only thing I can imagine is to catch textDidEndEditing in a delegate from 
the field editor and get the value via editedRow and editedColumn or something 
similar.
But this is rather awkward.

I wonder why there is nothing relevant in the docs, no example on the web...

Am 07.01.2014 um 18:11 schrieb Keary Suska :

> 
> On Jan 7, 2014, at 9:40 AM, Peter wrote:
> 
>> 
>> Am 07.01.2014 um 17:32 schrieb Jens Alfke :
>> 
>>> 
>>> On Jan 7, 2014, at 7:52 AM, Peter  wrote:
>>> 
>>>> I’d be very happy if somebody could point me to an example of an editable 
>>>> NSTableView set up programmatically.
>>> 
>>> It sounds like you just mean using a custom data source rather than relying 
>>> on bindings to provide the data? That’s very easy to do. Just look at the 
>>> docs for NSTableViewDataSource — you just need to implement the three 
>>> methods to provide the row count, get a cell value, and set a cell value.
>>> 
>>> —Jens
>> 
>> Oops, sorry, the crucial info is only in the subject line: I meant a view 
>> based NSTableView. Which as far as I could find out does not make use of the 
>> NSTableViewDataSource protocol. I seems that you have to have to use 
>> delegate methods to make it work.
> 
> Umm, in the documentation for NSTableCellView it sats:
> 
> objectValue
> 
> The object that represents the cell data.
> 
> @property(retain) id objectValue
> Discussion
> 
> The objectValue is automatically set by the table when using bindings or is 
> the object returned by the NSTableViewDataSource protocol method 
> tableView:objectValueForTableColumn:row:.
> 
> Not to mention that I have used view-based table views with data sources...
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
> 


___

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: Set up an editable view based NSTableView programmatically - how to?

2014-01-07 Thread Peter

Am 07.01.2014 um 23:16 schrieb Keary Suska :

> On Jan 7, 2014, at 1:38 PM, Peter wrote:
> 
>> Thank you for your comment.
>> 
>> Did you really manage to create *editable* view-based table views with data 
>> sources?
> 
> Yes.
> 
>> Then I am curious to know how you managed to make them editable.
> 
> The issue here is simply how to communicate edits to your model object, which 
> I will assume you mean by "making editable".
> 
>> A data source method channeling data from the table view to the data source 
>> is nowhere to be seen. 
>> 
>> - (void)tableView:(NSTableView *)tableView setObjectValue:(id)object 
>> forTableColumn:(NSTableColumn *)tableColumn row:(NSInteger)row
>> 
>> does not seem to be called.
> 
> No, you can't use this method with view-based table views. And it makes 
> sense, as the table view wouldn't how how to apply edits to the model object 
> since it could be arbitrarily complex. 
> 
>> I have a view based table view working with a data source. But it is not 
>> (yet) editable.
>> 
>> The only thing I can imagine is to catch textDidEndEditing in a delegate 
>> from the field editor and get the value via editedRow and editedColumn or 
>> something similar.
>> But this is rather awkward.
>> 
>> I wonder why there is nothing relevant in the docs, no example on the web...
> 
> Did you look at TableViewPlayGround sample code? It might have editable 
> examples (I don't recall).

Yes, I did, but no, sadly it doesn’t.

> There are a number of ways you can do this. My case is a bit specific and 
> complex (every cell in in my table is different), but my basic approach was 
> to designate a set of NSViewControllers that are set as the owners of the 
> views in -tableView:viewForTableColumn:row: (as well as in IB), and in the 
> view I have an NSObjectController bound to the view controller's 
> representedObject, and the editable fields bound to it in turn.

OK, thanks for the pointers. This confirms my suspicion that (a) there is no 
simple way to do it (as in cell based tables) and (b) that view based tables, 
despite some obvious advantages, are not to be considered to be the Holy Grail 
of Table Making - as Apple wants to make us believe.

BTW: The delegate methods I had intended to use in my outline above turned all 
out to be disabled for view based table views.

Thanks a lot for your time and comments!

> HTH,
> 
> Keary Suska
> Esoteritech, Inc.
> "Demystifying technology for your home or business"
> 
> 


___

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: Set up an editable view based NSTableView programmatically - how to?

2014-01-07 Thread Peter
Great! Yes, this helps immensely. Thank you very much!

It didn’t occur to me that it is possible to mix the bindings and data source 
approaches.

In order not to waste more time and get my job done, I took resort to a double 
click method copying the data to be edited to an NSTextField, whose action 
methods feeds the edited value back into the data source. Works very nicely and 
fits my bill even better than inline editing.

Still, your proof of concept is extremely useful!

Am 08.01.2014 um 01:01 schrieb Willeke :

> 
> Op 7 jan 2014, om 16:52 heeft Peter het volgende geschreven:
> 
>> I’d actually prefer to use bindings, but my first column should simply 
>> display the row numbers
> 
> After some experimenting I managed to create a simple editable view based 
> table view with row numbers, using bindings except for the row number. The 
> row number is in a column with identifier "RowNumber". I implemented this 
> delegate method:
> 
> - (NSView *)tableView:(NSTableView *)tableView
>   viewForTableColumn:(NSTableColumn *)tableColumn
>  row:(NSInteger)row
> {
>   NSTableCellView *result = [tableView 
> makeViewWithIdentifier:[tableColumn identifier] owner:self];
>   if ([[tableColumn identifier] isEqualToString:@"RowNumber"])
>   result.textField.objectValue = [NSNumber numberWithInteger:row];
>   return result;
> }
> 
> That's all.
> This is the first time I used a view based table view and it looks too simple 
> but maybe it helps.
> 
> Willeke
> ___
> 
> 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/magnard%40web.de
> 
> This email sent to magn...@web.de


___

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

Bug: Availability bindings on NSTextView cause attached NSNumberFormatter to fail

2014-01-10 Thread Peter
This cost me a couple of hours of sleep.

OS 10.9.1, Xcode 5.0.2

In my app I have an NSTextView with an NSNumberFormatter attached to it. The 
latter limits input to integers of a specified range.

As soon as bind the NSTextView’s enabled or editable properties to a simple 
boolean property in my controller (no other bindings in place), the number 
formatter no longer honors the range constraints and lets values pass 
unfiltered.

Without bindings, the system beeps when trying to enter a prohibited value.
With bindings, range constraints are ignored while non-integer input is 
blocked, but without the system beep.

Changing SDKs, setting the number formatter up in code, binding to the 
encapsulated NSTextViewCell etc. do not fix the issue.

Has anybody seen this?
I have searched radars but could not find anything.

I have a bare bones project exhibiting this bug 100% deterministically, which I 
could send to interested parties (or upload to GitHub).
I have never done that before, but I intend to file a radar, unless somebody 
finds a fundamental flaw in my setup.

Thanks!

Peter
___

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

Corrected: Bug: Availability bindings on NSTextField cause attached NSNumberFormatter to fail

2014-01-10 Thread Peter
Hi Jonathan,

my bad, sorry for the confusion! You are right, it is an NSTextField.
Find the corrected text below.

Am 10.01.2014 um 10:24 schrieb jonat...@mugginsoft.com:

> Hi Peter
> 
> You say NSTextView. Do you mean NSTextField?
> 
> Can we take a look at your demo project?
> 
> Jonathan
> 
> On 10 Jan 2014, at 09:10, Peter  wrote:

This cost me a couple of hours of sleep.

OS 10.9.1, Xcode 5.0.2

In my app I have an NSTextField with an NSNumberFormatter attached to it. The 
latter limits input to integers of a specified range.

As soon as bind the NSTextField enabled or editable properties to a simple 
boolean property in my controller (no other bindings in place), the number 
formatter no longer honors the range constraints and lets values pass 
unfiltered.

Without bindings, the system beeps when trying to enter a prohibited value.
With bindings, range constraints are ignored while non-integer input is 
blocked, but without the system beep.

Changing SDKs, setting the number formatter up in code, binding to the 
encapsulated NSTextViewCell etc. do not fix the issue.

Has anybody seen this?
I have searched radars but could not find anything.

I have a bare bones project exhibiting this bug 100% deterministically, which I 
could send to interested parties (or upload to GitHub).
I have never done that before, but I intend to file a radar, unless somebody 
finds a fundamental flaw in my setup.

Thanks!

Peter

___

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

Odd Crash

2015-09-24 Thread Peter Hudson
Suddenly, after a long period of clean operation, I start to this crash.

I’ve copied the last section of the crash report from the user. 

Any suggestions appreciated.


Peter


Date/Time: 2015-09-24 15:38:49.222 +0100
OS Version:Mac OS X 10.10.4 (14E46)
Report Version:11
Anonymous UUID:899431F1-88F0-529E-0D17-073884EE9FDA

Sleep/Wake UUID:   B8985A4A-CC24-42C6-89F0-32993D38777B

Time Awake Since Boot: 21000 seconds
Time Since Wake:   14000 seconds

Crashed Thread:0  Dispatch queue: com.apple.main-thread

Exception Type:EXC_BAD_ACCESS (SIGSEGV)
Exception Codes:   KERN_INVALID_ADDRESS at 0x06e7a000

VM Regions Near 0x6e7a000:
CG shared images   06e6a000-06e7a000 [   64K] r--/r-- 
SM=SHM  
--> 
CoreAnimation  06e7c000-06e82000 [   24K] rw-/rwx 
SM=SHM  

Application Specific Information:
objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
Performing @selector(runSheetEditPostHeaderPreFooter:) from sender NSMenuItem 
0x7b07ab80

Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0   libobjc.A.dylib   
0x98a840a7 objc_msgSend + 23
1   com.apple.AppKit  
0x980ec80b -[NSTableView preparedCellAtColumn:row:] + 385
2   com.apple.AppKit  
0x9811cba1 -[NSTableView _dirtyVisibleCellsForKeyStateChange] + 878
3   com.apple.AppKit  
0x9811c2ae -[NSTableView _windowChangedKeyState] + 323
4   com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
5   com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
6   com.apple.AppKit  
0x97f9483f -[NSScrollView _windowChangedKeyState] + 50
7   com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
8   com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
9   com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
10  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
11  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
12  com.apple.AppKit  
0x9808223d -[NSSplitView _windowChangedKeyState] + 71
13  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
14  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
15  com.apple.AppKit  
0x9805ca16 -[NSTabView _windowChangedKeyState] + 50
16  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
17  com.apple.AppKit  
0x97f94671 -[NSView _windowChangedKeyState] + 276
18  com.apple.AppKit  
0x97f9450a -[NSFrameView _windowChangedKeyState] + 101
19  com.apple.AppKit  
0x97f94430 -[NSThemeFrame _windowChangedKeyState] + 51
20  com.apple.AppKit  
0x980d90fe -[NSWindow(NSSheets) _orderFrontRelativeToWindow:] + 236
21  com.apple.AppKit  
0x97f9bfe2 -[NSWindow 
_reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 2502
22  com.apple.AppKit  
0x97f9b607 -[NSWindow 
_doOrderWindowWithoutAnimation:relativeTo:findKey:forCounter:force:isModal:] + 
81
23  com.apple.AppKit  
0x97f9b03b -[NSWindow 
_doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 856
24  com.apple.AppKit  
0x980ce205 -[NSApplication _orderFrontModalWindow:relativeToWindow:] + 811
25  com.apple.AppKit  
0x980cdaf1 -[NSApplication 
_commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:]
 + 913
26  com.apple.AppKit  
0x98153b6f -[NSApplication 
beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:] + 154
27  WattWenn  
0x0012956d -[SSScriptDoc(EDIT_POSTHEADER_PREFOOTER_STRIPS_WINDOW_SUPPORT) 
runSheetEditPostHeaderPreFooter:] + 1837
28  libobjc.A.dylib   
0x98a8b853 -[NSObject performSelector:withObject:] + 70
29  com.apple.AppKit  
0x980c8c1e __36-[NSApplication sendAction:to:from:]_block_invoke + 51
30  libsystem_trace.dylib 

___

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: Odd Crash

2015-09-24 Thread Peter Hudson
Thanks for replying Jens. 
Your suggestion is why I thought the crash was odd - the window has not been 
closed and is still there. 
This problem occurs after I have run a sheet - might that be part of the issue? 

Peter

  Original Message  
From: Jens Alfke
Sent: Thursday, 24 September 2015 17:03
To: Peter Hudson
Cc: cocoa-dev@lists.apple.com
Subject: Re: Odd Crash

This is a pretty common type of crash. You’ve got an NSTableView whose 
dataSource has been dealloced, so it tried to call the dataSource and crashed.
If you want to catch this in the debugger, turn Zombie Objects on.
Most likely the problem is that the window got closed but not released, so it 
and its views are still in memory.

—Jens

> On Sep 24, 2015, at 8:23 AM, Peter Hudson  wrote:
> 
> Suddenly, after a long period of clean operation, I start to this crash.
> 
> I’ve copied the last section of the crash report from the user. 
> 
> Any suggestions appreciated.
> 
> 
> Peter
> 
> 
> Date/Time: 2015-09-24 15:38:49.222 +0100
> OS Version: Mac OS X 10.10.4 (14E46)
> Report Version: 11
> Anonymous UUID: 899431F1-88F0-529E-0D17-073884EE9FDA
> 
> Sleep/Wake UUID: B8985A4A-CC24-42C6-89F0-32993D38777B
> 
> Time Awake Since Boot: 21000 seconds
> Time Since Wake: 14000 seconds
> 
> Crashed Thread: 0 Dispatch queue: com.apple.main-thread
> 
> Exception Type: EXC_BAD_ACCESS (SIGSEGV)
> Exception Codes: KERN_INVALID_ADDRESS at 0x06e7a000
> 
> VM Regions Near 0x6e7a000:
> CG shared images 06e6a000-06e7a000 [ 64K] r--/r-- SM=SHM 
> --> 
> CoreAnimation 06e7c000-06e82000 [ 24K] rw-/rwx SM=SHM 
> 
> Application Specific Information:
> objc_msgSend() selector name: tableView:objectValueForTableColumn:row:
> Performing @selector(runSheetEditPostHeaderPreFooter:) from sender NSMenuItem 
> 0x7b07ab80
> 
> Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
> 0 libobjc.A.dylib 
> 0x98a840a7 objc_msgSend + 23
> 1 com.apple.AppKit 
> 0x980ec80b -[NSTableView preparedCellAtColumn:row:] + 385
> 2 com.apple.AppKit 
> 0x9811cba1 -[NSTableView _dirtyVisibleCellsForKeyStateChange] + 878
> 3 com.apple.AppKit 
> 0x9811c2ae -[NSTableView _windowChangedKeyState] + 323
> 4 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 5 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 6 com.apple.AppKit 
> 0x97f9483f -[NSScrollView _windowChangedKeyState] + 50
> 7 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 8 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 9 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 10 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 11 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 12 com.apple.AppKit 
> 0x9808223d -[NSSplitView _windowChangedKeyState] + 71
> 13 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 14 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 15 com.apple.AppKit 
> 0x9805ca16 -[NSTabView _windowChangedKeyState] + 50
> 16 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 17 com.apple.AppKit 
> 0x97f94671 -[NSView _windowChangedKeyState] + 276
> 18 com.apple.AppKit 
> 0x97f9450a -[NSFrameView _windowChangedKeyState] + 101
> 19 com.apple.AppKit 
> 0x97f94430 -[NSThemeFrame _windowChangedKeyState] + 51
> 20 com.apple.AppKit 
> 0x980d90fe -[NSWindow(NSSheets) _orderFrontRelativeToWindow:] + 236
> 21 com.apple.AppKit 
> 0x97f9bfe2 -[NSWindow 
> _reallyDoOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 2502
> 22 com.apple.AppKit 
> 0x97f9b607 -[NSWindow 
> _doOrderWindowWithoutAnimation:relativeTo:findKey:forCounter:force:isModal:] 
> + 81
> 23 com.apple.AppKit 
> 0x97f9b03b -[NSWindow 
> _doOrderWindow:relativeTo:findKey:forCounter:force:isModal:] + 856
> 24 com.apple.AppKit 
> 0x980ce205 -[NSApplication _orderFrontModalWindow:relativeToWindow:] + 811
> 25 com.apple.AppKit 
> 0x980cdaf1 -[NSApplication 
> _commonBeginModalSessionForWindow:relativeToWindow:modalDelegate:didEndSelector:contextInfo:]
>  + 913
> 26 com.apple.AppKit 
> 0x98153b6f -[NSApplication 
> beginSheet:modalForWindow:modalDelegate:didEndSelector:contextInfo:] + 154
> 27 WattWenn 
> 0x0012956d -[SSScriptDoc(EDIT_POSTHEADER_PREFOOTER_STRIPS_WINDOW_SUPPORT) 
> runSheetEditPostHeaderPreFooter:] + 1837
> 28 libobjc.A.dylib 
> 0x98a8b853 -[NSObject performSelector:withObject:] + 70
> 29 com.apple.AppKit 
> 0x980c8c1e __36-[NSApplication sendAction:to:from:]_block_invoke + 51
> 30 libsystem_trace.dylib 
> 
> ___
> 
>

Re: Odd Crash

2015-09-24 Thread Peter Hudson
‎I had a feeling something has changed about the order the OS does things in. 
I'll go hunting !

Many thanks. 

Peter
  Original Message  
From: Scott Ribe
Sent: Thursday, 24 September 2015 17:15
To: Peter Hudson
Cc: Jens Alfke; cocoa-dev@lists.apple.com
Subject: Re: Odd Crash

On Sep 24, 2015, at 10:06 AM, Peter Hudson  wrote:
> 
> This problem occurs after I have run a sheet - might that be part of the 
> issue? 

Definitely turn zombies on. I'd suspect that some of your code might be 
confused about what window is closing when the sheet is dismissed, and is 
dealloc'ing something early.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
https://www.linkedin.com/in/scottribe/
(303) 722-0567 voice






___

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: swift: windowControllerDidLoadNib called twice

2015-09-25 Thread Peter Teeson
FWIW before the nice hardcover books there was a single (as I recall) loose 
leaf binder with documentation for the 128K.

> On Sep 25, 2015, at 1:06 PM, Raglan T. Tiger  wrote:
> 
> 
>> On Sep 23, 2015, at 1:08 PM, Boyd Collier  wrote:
>> 
>> I’ve been writing code for Macs off-and-on for 30 years,
> 
> 
> I still have my original copy of Inside Macintosh !
> 
> IM Fun 1 
> IM Fun 2 
> 
> 
> -rags
> ___
> 
> 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/pteeson%40icloud.com
> 
> This email sent to ptee...@icloud.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

NSTableView update issue

2015-09-26 Thread Peter Hudson
I have an NSTableView in my app which has started to behave differently on 
10.10.

I periodically change the datasource and delegate to the table view ( which is 
on screen )
This has worked perfectly up until recently.


After having changed the datasource/delegate to the table view, I confirm that 
the table view is aware of the change - by use of  delegate and dataSource 
methods.  The result from this indicates that the table view has had its 
datasource and delegate updated as I intended.

I then reloadData and display the table view.  Results are as expected.

A short period after, the app will crash. Zombies tells me that the table view 
is accessing the previously set datasource for data - not the one that I have 
just installed ( and confirmed as being the data source ).


Any suggestions gratefully recieved.

Peter




___

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: NSTableView update issue

2015-09-26 Thread Peter Hudson
Ken,  Thanks for this insight.

Reading through your comments, I suspect the best way to deal with this is to 
switch entire table views in and out (  or, perhaps,  deal with datasources ).  
I’ll probably do it with table view swapping as this avoids setting up the 
views with each change.

Regards

Peter



> On 26 Sep 2015, at 11:43, Ken Thomases  wrote:
> 
> On Sep 26, 2015, at 5:13 AM, Peter Hudson  wrote:
> 
>> I have an NSTableView in my app which has started to behave differently on 
>> 10.10.
>> 
>> I periodically change the datasource and delegate to the table view ( which 
>> is on screen )
>> This has worked perfectly up until recently.
>> 
>> 
>> After having changed the datasource/delegate to the table view, I confirm 
>> that the table view is aware of the change - by use of  delegate and 
>> dataSource methods.  The result from this indicates that the table view has 
>> had its datasource and delegate updated as I intended.
>> 
>> I then reloadData and display the table view.  Results are as expected.
>> 
>> A short period after, the app will crash. Zombies tells me that the table 
>> view is accessing the previously set datasource for data - not the one that 
>> I have just installed ( and confirmed as being the data source ).
> 
> Show the stack trace of the access to the zombie.
> 
> Remember that, normally, a view-based table view's delegate is used as the 
> owner for the NIB for cell views and row views.  Such views persist.  Some 
> are presumably being displayed and others may be in the reuse queue.  I would 
> not expect that changing the table view's delegate would alter that because 
> there's no good way to do so.  The table view can't know what connections may 
> have been established by the NIB when it was loaded.  (Connections to the 
> NIB's owner would be those to the File's Owner placeholder.  If your cell 
> views or row views are designed in the same NIB as the table view itself then 
> you may have been mislead.  It's not obvious but such views are actually in 
> sub-NIBs encoded into the outer NIB.  Connections to the File's Owner 
> placeholder from objects outside of the table columns end up connecting to 
> the owner of the outer NIB.  Connections to the File's Owner placeholder from 
> objects inside the table columns end up connecting to the table view's 
> delegate.)
> 
> Frankly, I don't think it's a good idea to do this switching like you're 
> doing.  Just have the delegate and data source switch their behaviour as 
> appropriate.  Or swap entire table views in and out.
> 
> Regards,
> Ken
> 


___

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: Can't get dynamically sized Collection View cells

2015-09-29 Thread Peter Tomaselli
Hi Doug! Funny you mention this, I was trying and failing to do the same thing 
just tonight. 

Thing is, I’ve done it before and have a toy implementation on GitHub[0] to 
prove it! Not that that was helping me just now, of course, but perhaps a link 
to that repo can help you out?

There are additional layers of complication in the linked project because 1. 
the labels inside the cells are themselves line-wrapping if necessary, so it’s 
quite “inside-out” as far as layout goes, and 2. the flow layout is 
“left-justified” instead of “fully-justified”, so be sure to ignore those 
aspects of the code if you do end up peeking.

Anyway, to be brutally honest I can’t for the life of me remember which of the 
methods and/or properties in this old project are critical for getting your 
scenario to work, and which are related solely to mine, but perhaps it’s a 
decent starting point anyway.

IIRC there also was a gotcha here wherein setting up your cell in IB basically 
meant you were SOL as far getting everything to work went (something about 
subviews not being embedded in the contentView properly?), but I could be wrong 
about that. 

Anyway a truly flowy layout is one of the things I most desire so if you gain 
any insights more, or if anyone else can chime in with better advice, I am very 
interested too.

— Peter

[0] https://github.com/Peterbing/CV-AutoLayout

> On Sep 29, 2015, at 6:29 PM, Doug Hill  wrote:
> 
> I’m trying to implement a collection with dynamically sized cells. The WWDC  
> session from 2014 “What’s New in Table and Collection Views” talks about how 
> to do this by:
> • Use autolayout constraints to set the height of the cell based on the 
> content size of the subviews.
> • Set the estimatedItemSize property of the flow layout object to get the 
> scrollbars to be in close the correct location.
> 
> This doesn’t seem to work as I see the following log message:
> 
> the behavior of the UICollectionViewFlowLayout is not defined because:
> the item width must be less than the width of the UICollectionView minus the 
> section insets left and right values, minus the content insets left and right 
> values.
> Please check the values return by the delegate.
> The relevant UICollectionViewFlowLayout instance is 
> , and it is attached to 
>  autoresize = RM+BM; gestureRecognizers = ; layer = 
> ; contentOffset: {0, 0}; contentSize: {205, 66}> 
> collection view layout: .
> 2015-09-29 14:48:29.255 Chartcube[65578:3340001] Make a symbolic breakpoint 
> at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the 
> debugger.
> 
> also
> the behavior of the UICollectionViewFlowLayout is not defined because:
> the item width must be less than the width of the UICollectionView minus the 
> section insets left and right values.
> Please check the values return by the delegate.
> 
> FWIW I don’t set any other properties of the flow layout.
> 
> Doing a Google search leads me to the following page:
> 
> http://corsarus.com/2015/collection-view-with-self-sizing-cells/
> 
> which discusses this error message and how to add another constraint at 
> runtime to fix it. It sets a fixed width constraint of the cell content view. 
> This “solution” appears to be a bit of a hack since they did some trial and 
> error to figure out how to set it so that it would make things work. This 
> leads me to believe there’s something else going on. Also, it would be great 
> to know why I get the error in the first place. Maybe there’s some other 
> setting in the flow layout that needs to be made?
> 
> Can someone comment on how to implement dynamically-sized collection view 
> cells correctly? Unfortunately, the WWDC session doesn’t go into detail on 
> how they got their collection view to autoresize the cells and there’s isn’t 
> any sample code for the project described in the video. It would be great to 
> know the “approved” way to implement this behavior.
> 
> Thanks!
> 
> Doug Hill
> 
> ___
> 
> 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/vast.grapes%40gmail.com
> 
> This email sent to vast.gra...@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

NSTableView - Detecting when user has finished scrolling

2015-09-30 Thread Peter Hudson
I would like to know when the user has finished scrolling one of my table views.
I can’t see any obvious API to do it. ( I’ve checked the scrollers, views etc 
which are part of an NSTableView)

All suggestions gratefully received.

Peter 
___

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: NSTableView - Detecting when user has finished scrolling

2015-09-30 Thread Peter Hudson
Many thanks for these ideas.

As the user scrolls one of the table views, the system does not render all the 
details in the rows correctly.
The most obvious one :-  I draw my own lines between rows - inserting  
separator lines where appropriate.
Hence, I override drawRect.  The process in here to calculate the placement of 
lines is too long - hence the system, on occasions, will not draw them.

So, what I want to do is watch for when the user has finished scrolling and 
then do a display on the tableview - which works fine.

Thanks for your suggestion - I’ll check them out.

Peter




> On 30 Sep 2015, at 12:19, dangerwillrobinsondan...@gmail.com wrote:
> 
> Check the NSScrollView notifications. 
> However you could try to observe changes to the NSClipView bounds.
> You could also observe scroll events and so forth. 
> But ultimately you will run into semantics. Resting touches, momentum phases, 
> some slight ambiguity on whether the user feels done scrolling vs mentally 
> figuring out if they have scrolled near where the want to go quickly and 
> might stop and slow down and back up a bit. 
> 
> Question to you is, what are you trying to accomplish ?
> 
> Sent from my iPhone
> 
>> On Sep 30, 2015, at 7:45 PM, Peter Hudson  wrote:
>> 
>> I would like to know when the user has finished scrolling one of my table 
>> views.
>> I can’t see any obvious API to do it. ( I’ve checked the scrollers, views 
>> etc which are part of an NSTableView)
>> 
>> All suggestions gratefully received.
>> 
>> Peter 
>> ___
>> 
>> 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/dangerwillrobinsondanger%40gmail.com
>> 
>> This email sent to dangerwillrobinsondan...@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: Can't get dynamically sized Collection View cells

2015-09-30 Thread Peter Tomaselli
Certainly! Just to be clear (ended up revisiting some of my research on this 
today), I don't think it is possible to do this with just estimatedItemSize 
alone. 

So, the analogy with UITableView w/r/t "self sizing", as presented or at least 
strongly implied in that WWDC talk, breaks down here—you also need a "sizing 
cell" or some other way of performing the auto layout measurements yourself and 
then providing them to the delegate. 

I would love to be told otherwise here! But I don't believe I’ve ever seen it 
done.

Peter

> On Sep 30, 2015, at 5:41 PM, Doug Hill  wrote:
> 
> Peter,
> 
> Thanks for the reply and the code sample. It definitely has a lot of cool 
> stuff.
> 
> However, I’m still interested in whether anyone else has info in on 
> dynamically-sized Collection View cells using the ‘estimatedItemSize’ 
> property of the flow layout. Is this a lie from a WWDC presenter? Are there a 
> number of other steps that aren’t documented that one needs to do? Any Apple 
> sample code that implements this?
> 
> Apple experts please chime in!
> 
> Doug Hill
> 
>> On Sep 29, 2015, at 7:12 PM, Peter Tomaselli  wrote:
>> 
>> Hi Doug! Funny you mention this, I was trying and failing to do the same 
>> thing just tonight. 
>> 
>> Thing is, I’ve done it before and have a toy implementation on GitHub[0] to 
>> prove it! Not that that was helping me just now, of course, but perhaps a 
>> link to that repo can help you out?
>> 
>> There are additional layers of complication in the linked project because 1. 
>> the labels inside the cells are themselves line-wrapping if necessary, so 
>> it’s quite “inside-out” as far as layout goes, and 2. the flow layout is 
>> “left-justified” instead of “fully-justified”, so be sure to ignore those 
>> aspects of the code if you do end up peeking.
>> 
>> Anyway, to be brutally honest I can’t for the life of me remember which of 
>> the methods and/or properties in this old project are critical for getting 
>> your scenario to work, and which are related solely to mine, but perhaps 
>> it’s a decent starting point anyway.
>> 
>> IIRC there also was a gotcha here wherein setting up your cell in IB 
>> basically meant you were SOL as far getting everything to work went 
>> (something about subviews not being embedded in the contentView properly?), 
>> but I could be wrong about that. 
>> 
>> Anyway a truly flowy layout is one of the things I most desire so if you 
>> gain any insights more, or if anyone else can chime in with better advice, I 
>> am very interested too.
>> 
>> — Peter
>> 
>> [0] https://github.com/Peterbing/CV-AutoLayout
>> 
>>> On Sep 29, 2015, at 6:29 PM, Doug Hill  wrote:
>>> 
>>> I’m trying to implement a collection with dynamically sized cells. The WWDC 
>>>  session from 2014 “What’s New in Table and Collection Views” talks about 
>>> how to do this by:
>>> • Use autolayout constraints to set the height of the cell based on the 
>>> content size of the subviews.
>>> • Set the estimatedItemSize property of the flow layout object to get the 
>>> scrollbars to be in close the correct location.
>>> 
>>> This doesn’t seem to work as I see the following log message:
>>> 
>>> the behavior of the UICollectionViewFlowLayout is not defined because:
>>> the item width must be less than the width of the UICollectionView minus 
>>> the section insets left and right values, minus the content insets left and 
>>> right values.
>>> Please check the values return by the delegate.
>>> The relevant UICollectionViewFlowLayout instance is 
>>> , and it is attached to 
>>> >> autoresize = RM+BM; gestureRecognizers = ; layer = 
>>> ; contentOffset: {0, 0}; contentSize: {205, 66}> 
>>> collection view layout: .
>>> 2015-09-29 14:48:29.255 Chartcube[65578:3340001] Make a symbolic breakpoint 
>>> at UICollectionViewFlowLayoutBreakForInvalidSizes to catch this in the 
>>> debugger.
>>> 
>>> also
>>> the behavior of the UICollectionViewFlowLayout is not defined because:
>>> the item width must be less than the width of the UICollectionView minus 
>>> the section insets left and right values.
>>> Please check the values return by the delegate.
>>> 
>>> FWIW I don’t set any other properties of the flow layout.
>>> 
>>> Doing a Google search leads me to the following page:
>>> 
>>> http://corsarus.com/2015/collection-view-with-self-sizing-cells/
>>> 
>>

Re: NSTableView - Detecting when user has finished scrolling

2015-10-01 Thread Peter Hudson
Legacy code I’m afraid Graham - written some years ago. 
I simply want it to look better for now while we're getting on with the 
re-write.
The new version indeed uses view-based table views - and works a lot better.

Peter




> On 1 Oct 2015, at 01:11, Graham Cox  wrote:
> 
> 
>> On 30 Sep 2015, at 10:20 pm, Peter Hudson  wrote:
>> 
>> As the user scrolls one of the table views, the system does not render all 
>> the details in the rows correctly.
>> The most obvious one :-  I draw my own lines between rows - inserting  
>> separator lines where appropriate.
>> Hence, I override drawRect.  The process in here to calculate the placement 
>> of lines is too long - hence the system, on occasions, will not draw them.
> 
> 
> Really sounds like you’re Doing It Wrong™. If you’re using a view-based table 
> (as is recommended these days) then the row view should be drawing this 
> separator line (a given row could be flagged to include a separator if it 
> only applies to some of them). NSTableView also supports various kinds of 
> group rows and overlays if that is a better fit. There are also some delegate 
> methods that are intended to be used for drawing the backgrounds of rows 
> which could also be used. Overriding -drawRect: on NSTableView is invariably 
> a no-no.
> 
> If calculating which row is a separator is taking a long time, there’s 
> something seriously fishy about your code, as that sort of calculation should 
> be trivial. For example, if you are adding up the heights of all possible 
> rows above the line, you’re probably doing far too much work - the table 
> already knows which views are visible and where they are, so there should 
> only be a few to consider at most.
> 
> —Graham
> 
> 


___

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: Can't get dynamically sized Collection View cells

2015-10-02 Thread Peter Tomaselli
[re-sending because my last message had size problems]

Nifty way of demoing there, Roland, I’ll have to try that!

I’d still be curious to know if anyone is using this feature “in production”. 
Because those crashes, problems rotating (at least for me), and also this, 
which I definitely ran into circa iOS 8:

http://stackoverflow.com/questions/25573855/vertically-scrolling-uicollectionview-with-self-sizing-cells-only-displays-half

> On Sep 30, 2015, at 9:34 PM, Roland King  wrote:
> 
> [snip]
> 
> Result, 150x150 boxes on the screen neatly laid out. 
> 
> Hooked up a button to iterate the cells on screen, find the embedded 
> randomView and call its randomize function to reset the intrinsic content 
> size, after they were all done, called 
> collectionView.collectionViewLayout.invalidateLayout()
> 
> Result, boxes all showed up in their new randomized sizes and the layout 
> adjusted everything to fit, changed the number of boxes per line and the size 
> of the lines. So just having cells with a fully-specified 
> intrinsicContentSize and setting estimatedSize on the collection view 
> flowlayout is enough to get dynamic cells without having to measure them or 
> do any other work. So I deduce from that that Apple doesn’t lie and it does 
> actually work as the WWDC session says. 
> 
> I did get some quite cool crashes when I set the estimated size far from the 
> actual size, were I actually trying to do this for real I’d probably look 
> into it but .. since I’m not.
___

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 Peter Tomaselli
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)
>>>>> 
>>>>> 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

Re: Self and associated type requirements (yes again!)

2015-11-30 Thread Peter Tomaselli
I have no answer here, but there is a blog post I continually refer to
whenever I get confused about this. In case you haven't already read it
(although I suspect you have) it is called "Swift: Associated Types" by
Russ Bishop [0]. Rob Napier has also had a few nice posts about type
erasure that may be relevant.

I'm a C# dev by day and my first pass at your problem would probably be
quite similar to what you have already, in that the first instinct is to
let all the generic parameters bubble up to the top and trust in your
ability to pivot where you need to go from there. What Russ does a good job
of explaining in that post is that Swift protocols are not really "just [C#
or Java] interfaces" in this way.

Again, apologies if this is obvious stuff but it probably will be
interesting to someone on the list.

Just spitballing here, but it seems like two aspects of your approach here
might be at odds: one, you want a "strongly typed" TimeSeries collection of
some kind, but you also want some degree of implementation hiding, right (I
base this on your desire to be able to just plop one of these into a
tableView and have it work)?

To me that feels like you actually don't want to include a typealias in
your protocol (adopters of the protocol could of course still be generic),
and that the truth is that the view actually doesn't care about the
underlying type in the collection. Instead, contractually, all it cares
about is that TimeSeries can be a dataSource (basically, that it can vend
strings for a given indexPath).

Perhaps what you want are two protocols, one that enforces whether or not a
collection is easily "presentable", and one that enforces that a collection
has some TimeSeries-ish "semantics" (whatever that might mean). Your actual
classes here could conform to both, but the view only need care about the
first one.

If you actually do want _both_ of those things together, that's where (and
I could be way off here; I have only casually read up on this stuff)
techniques of "type erasure" may be relevant?

Peter

[0] http://www.russbishop.net/swift-associated-types

On Mon, Nov 30, 2015 at 7:12 AM, Roland King  wrote:

> I keep running myself into this issue when I try using some of my generic
> classes built on top of Protocols.
>
> [snip]
>


> There’s still no clever way around this right, this is still how Generics
> and Protocols work together, there’s nothing in Swift 2.0 which helps you
> work around this, no way to use Protocol extensions to do it? I thought
> (I’ve tried this before) of making a FloatTimeSeries protocol which only
> deals with Floats and has no Self or associated type issues which basically
> has all the same methods of TimeSeries but with ‘Float’ specifically
> instead of Underlying and then using a protocol extension like this
>
>
___

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: Custom time picker

2015-12-02 Thread Peter Tomaselli
One of the WWDC videos from back when collection views were introduced tackles 
a similar situation (a “flickable” cover-flow-ish collection view layout that 
centers at the end). Sorry that I can't be more specific about which video. 

> On Dec 2, 2015, at 7:22 PM, Eric Dolecki  wrote:
> 
> I need to create a time picker control but don't have much vertical room. So 
> buttons above and below to affect hours, min, am/pm are out. I was thinking 
> swipes up and down. Best to use 3 UIScrollviews? Inertia is there. Only thing 
> is how to get the numbers to "stick" in selection position while still 
> allowing for smooth scrolling with quick flicking. Technique for that?
> Is this a good solution? Anything I might consider?
> ___
> 
> 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/vast.grapes%40gmail.com
> 
> This email sent to vast.gra...@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: Subclassing/Override question

2016-01-04 Thread Peter Tomaselli
Method return types are covariant though, yes? So you should always be able
to return a more-derived type from a method that is declared to return a
less-derived type. If I read your example right, ClassA is "Animal" and
ClassB is "Cat" (in covariance-blog-post lingo). So that is legal, unless
I'm missing something.

Perhaps the issue is that the @interface for your overriding class (the one
that implements the override of "propA") does not redeclare that method as
returning (ClassB *)? I am away from Xcode right now (and as such have
immediately begun to doubt everything I know about programming and the
universe in general), but I reckon if you don't declare that in the
overridden @interface then other public callers are just going to dumbly
see the superclass @interface. But that's not a variance problem (again,
assuming I'm not messing something up here), that's just that you need to
declare it.

Peter



On Mon, Jan 4, 2016 at 11:40 AM, Jeff Kelley  wrote:

> Hi Dave,
>
> For myClassA, you will always have to cast the return value to
> myClassB if you know that’s what will be returned. For a great blog post on
> the subject, I give you Mike Ash:
>
>
> https://mikeash.com/pyblog/friday-qa-2015-11-20-covariance-and-contravariance.html
>
>
> Jeff Kelley
>
> slauncha...@gmail.com | @SlaunchaMan <https://twitter.com/SlaunchaMan> |
> jeffkelley.org <http://jeffkelley.org/>
> > On Jan 4, 2016, at 11:24 AM, Dave  wrote:
> >
> > Hi,
> >
> > In Objective-C, is it possible to override a property and have it return
> a different type to the base class?
> >
> > I have a base class with the following property defined:
> >
> > @property (nonatomic,retain)  ClassA*
>  propA;
> >
> > and the following getter:
> >
> >
> > -(ClassA*) propA
> > {
> > return someValueOfClassA;
> > }
> >
> >
> > I’d like to override this in my subclass, as so:
> >
> > -(ClassB*) propA
> > {
> > ClassA*   myClassA;
> > ClassB*   myClassB;
> >
> > myClassA = super.propA;
> > myClassB = [[ClassB alloc] initWithClassA:myClassA]; //ClassB is a
> subclass of Class A
> >
> > return myClassB;
> > }
> >
> > I can do this ok, but when I access the property:
> >
> > // myClassA is already setup OK
> > ClassB*   myClassB;
> >
> > myClassB = myClassA.propA;//Warning on this line
> saying return type is not ClassB
> >
> > and I have to coerce the value to be ClassB to get rid of the warning.
> Is there any way to avoid this?
> >
> > Thanks a lot
> > Dave
> ___
>
> 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/vast.grapes%40gmail.com
>
> This email sent to vast.gra...@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: UISearchBar covers status bar

2016-02-02 Thread Peter Tomaselli
Isn't this just the thing (apologies, can't actually try it right now)
where the easiest way to keep the status bar tidy when doing a modal
presentation is to actually present your modal controller inside its own
navigation controller, even if you don't plan on pushing anything onto it?

Again, apologies if I'm missing any subtleties here. But the same problem
of the status bar occurs on any modal presentation, right?

On Tue, Feb 2, 2016 at 4:08 PM, Rick Mann  wrote:

>
> > On Feb 2, 2016, at 12:20 , Raglan T. Tiger 
> wrote:
> >
> >
> >
> >> On Feb 2, 2016, at 1:08 PM, Rick Mann  wrote:
> >>
> >> Apple really screwed the pooch with the status bar change in iOS 7;
> I've had nothing but problems with it ever since.
> >
> > Or, did Apple fix a screwed pooch and thus your app needs to be
> unscrewed by refactoring?
>
> Nope. Even brand-new apps still run into problems, as evidenced by this
> search bar issue I'm having.
>
>
>
> --
> Rick Mann
> rm...@latencyzero.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/vast.grapes%40gmail.com
>
> This email sent to vast.gra...@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: PSA: Does your app use Sparkle? Update it, or use an HTTPS server

2016-02-10 Thread Peter Teeson

This worked for me:

find /Applications -path '*Autoupdate.app/Contents/Info.plist' -exec echo {} \; 
-exec grep -A1 CFBundleShortVersionString '{}' \; | grep -v 
CFBundleShortVersionString

and I got it from this link:

<http://arstechnica.com/security/2016/02/huge-number-of-mac-apps-vulnerable-to-hijacking-and-a-fix-is-elusive/?comments=1&post=30615899
 
<http://arstechnica.com/security/2016/02/huge-number-of-mac-apps-vulnerable-to-hijacking-and-a-fix-is-elusive/?comments=1&post=30615899>>

It found 6 apps in Applications….

respect…

Peter
> On Feb 10, 2016, at 10:43 AM, sqwarqDev  wrote:
> 
> OK, I've started adding version numbers to this script now to avoid 
> confusion. :~!
> 
> Latest 'update' is v1.3 (fixed: the 'choose folder' option now works 
> correctly):
> 
> I don't think this is the last version...there's at least one outstanding 
> problem one person's having that I'm waiting to here more about (I can't 
> reproduce it myself, but will post an update if / when needed).

___

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: Two Problems

2016-02-12 Thread Peter Tomaselli
You'll probably need a… what is it nowadays? “@objc”? annotation on that
func? Apologies that I can't be more specific, I am on my Grim Windows Work
Computer atm…

On Fri, Feb 12, 2016 at 11:31 AM, Charles Jenkins  wrote:

> Alex,
>
> The suggestion of changing the graphic’s name is a terrific one. I’ll do
> that tonight, and I expect it will work. I should’ve thought of that
> myself. Thanks!
>
> I’m using Swift, but whether my controller conforms or not is the nature
> of my question. I wasn’t totally clear, but when I said I added
> UISearchBarDelegate to my controller, I meant I added that protocol name to
> the list of protocols implemented by the class. Then I added the one
> optional protocol method I actually need (and I didn’t do something
> terribly stupid like marking it static). But when I set the status bar’s
> delegate to self, I crash anyway, as if I’m not really conforming. Since
> all the methods in the protocol are marked as optional, I don’t know what I
> could be missing.
>
> This is behaving as if my outlet were connected to the wrong kind of
> object. I think tonight I’ll delete it an re-drag from IB again, just to
> make sure my outlet really is getting set to an instance of UISearchBar.
>
> --
>
> Charles
>
> On February 12, 2016 at 11:07:00, Alex Zavatone (z...@mac.com) wrote:
>
> 1. What are you setting the delegate to? Self? If so, have you made sure
> to "conform" to that delegate in your class? Something like @interface
> CharlesViewController : UIViewController  ??
>
> If you don't do that, then the method you need isn't accessible through
> self and BLAMMO! Unrecognized selector sent to instance.
>
>
> 2. Are you including the asset lib in your bundle for the build?
>
> Is the old name the same as the new name? Change the name of the graphic
> and see if it's even in the new build.
>
> GL Charles.
>
> Alex Zavatone.
>
> On Feb 12, 2016, at 8:59 AM, Charles Jenkins wrote:
>
> > PROBLEM 1:
> >
> > Is there anything new/tricky about the UISearchBar? I have placed one in
> my view, and dragged an IBOutlet to the companion source file. The result
> is an @IBOutlet weak var searchBar: UISearchBar!
> >
> > I added UISearchBarDelegate to my ViewController and implemented one
> method: func searchBar(_ searchBar: UISearchBar, textDidChange searchText:
> String)
> >
> > My app works beautifully if I do NOT set searchBar.delegate = self in
> viewDidLoad(). But if I try to set that delegate to make search work, my
> app crashes on launch with an unhandled exception saying that an
> unrecognized selector was called.
> >
> > UISearchDelegate’s methods are all marked “optional," I think, but I’m
> wondering if in the latest version of iOS, one or more of them isn’t really
> optional anymore…?
> >
> > PROBLEM 2:
> >
> > I made a change to my launch image graphic and dragged the new version
> into the assets. The new image shows up there and in my LauchImage UI view,
> but there seems to be nothing I can do to get it onto a device!
> >
> > I performed these steps:
> > Cleaned my project
> > Cleaned my project build directory
> > Quit Xcode
> > Rebooted my computer
> > Deleted the test app from my device—at this point, the old launch screen
> should not exist ANYWHERE
> > Restarted Xcode
> > Reconnected my device
> > Started a debug session, which should have rebuilt and reinstalled a
> fresh, clean copy onto the device
> > But somehow the old launch screen appears every time. Clearly there is a
> cache somewhere that is not cleaned out with the project or its build
> directory.
> >
> > What’s the secret to really getting rid of Xcode’s memory of an old
> launch image?
> >
> > --
> >
> > 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/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/vast.grapes%40gmail.com
>
> This email sent to vast.gra...@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: Storyboard weakness

2016-03-09 Thread Peter Tomaselli
I might be misunderstanding, but why not just use a regular UIViewController 
scene, throw a collection view in it, throw your other view into it too, and 
then conform to UICollectionViewDataSource and -Delegate “manually”?

It’s a few more outlets to connect by hand but isn’t UICollectionViewController 
(itself; as a class) essentially a convenience? Or is there functionality 
obtainable via UICollectionViewController only?

Peter

> On Mar 9, 2016, at 6:04 PM, Rick Mann  wrote:
> 
> There's a severe weakness in Storyboards for which I'm hoping a better 
> solution exists.
> 
> When you create a scene for say, a UICollectionView, the Storyboard makes it 
> very easy, but it also imposes a severe limitation. In my case, my 
> UICollectionViewController subclass lives inside a UINavigationController. It 
> manages the controls in the toolbar and the title, as well as the content.
> 
> But inevitably I want to add additional views beneath the UINavigationBar 
> that are NOT CONTAINED within the UICollectionView (in this case, a 
> UISegmentedControl for sorting the contents). The only way I see how to do 
> this with Storyboards is to create two view controllers, one that embeds the 
> UICollectionViewController subclass. But now its impossible to wire up 
> UINavigationBar items to it. I've been forced to split up view control across 
> two view controllers that really should be one.
> 
> This is solved by having the UICollectionView controller subclass have its 
> view property point to a generic containing view, and its collectionView 
> property point to the collectionView subview. But it's not really designed to 
> work this way, and Storyboards definitely doesn't support this.
> 
> The Apple-provided way imposes a HUGE burden.
> 
> Is there any happy middle ground?
> 
> I've written this bug before, but Apple doesn't care.
> 
> -- 
> Rick Mann
> rm...@latencyzero.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/vast.grapes%40gmail.com
> 
> This email sent to vast.gra...@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

NSFileWrapper

2016-06-04 Thread Peter Hudson
Hi All

Our users have now decided to push the bounds of the system - resulting in file 
sizes that are getting to large for comfort.

It would be possible to fairly easily split the current file format into two 
and store it as two separate units.  This is a particularly interesting 
solution as half the data rarely changes.  It would however be neccessary for 
the two files to be handled transparently, by the user, as one unit.

I have been looking over the docs for NSFileWrapper.  I can’t see if it is 
possible to construct a file wrapper that presents itself to the user as ‘one 
file’ complete with icon - and hides the multiple files in the wrapper. 

Any suggestions / pointers  gratefully recieved !

Peter
___

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: NSFileWrapper

2016-06-04 Thread Peter Hudson
Hi Mike

You're right - I want the behaviour of a package. Do you happen to know how I 
can achieve it?   I had presumed it might be some mix of flag setting at system 
level. If for example i set the extension on an NSFileWrapper to   .bundle i 
get some of what I need - but I cant find out how to ‎get an icon of my 
choosing associated with it. 

Peter

  Original Message  
From: Mike Abdullah
Sent: Saturday, 4 June 2016 17:12
To: Peter Hudson
Cc: cocoa-dev@lists.apple.com List
Subject: Re: NSFileWrapper

It sounds like you want your file format to be what is known as a “package”. 
It’s a directory, but is (mostly) presented as a single file.

NSFileWrapper is an API for working with files, it does not directly control 
whether something is a package or not. It just happens to be the most 
convenient API in Cocoa for working with packages and documents, and so 
NSDocument has built in support for that.

Mike.

> On 4 Jun 2016, at 12:01, Peter Hudson  wrote:
> 
> Hi All
> 
> Our users have now decided to push the bounds of the system - resulting in 
> file sizes that are getting to large for comfort.
> 
> It would be possible to fairly easily split the current file format into two 
> and store it as two separate units. This is a particularly interesting 
> solution as half the data rarely changes. It would however be neccessary for 
> the two files to be handled transparently, by the user, as one unit.
> 
> I have been looking over the docs for NSFileWrapper. I can’t see if it is 
> possible to construct a file wrapper that presents itself to the user as ‘one 
> file’ complete with icon - and hides the multiple files in the wrapper. 
> 
> Any suggestions / pointers gratefully recieved !
> 
> Peter
> ___
> 
> 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

Re: NSFileWrapper

2016-06-04 Thread Peter Hudson
Hi Jens

“If your app’s performance is suffering because of large files, then use 
streams instead, and try to only read the part of the file that’s necessary.”

Could you point me at some material about this technique ?  It sounds very 
interesting.

I will check out the database approach as well.  I have steered clear of using 
databases as our users are mostly individuals with little or no tech support. 
The idea has always been to keep things simple and maintenance free.

Peter








> On 4 Jun 2016, at 17:42, Jens Alfke  wrote:
> 
> LevelDB

___

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: NSFileWrapper

2016-06-04 Thread Peter Hudson
Jens

Thanks for these notes - extremely helpful.
I think I will kick off with Realm and see where I get too.

Peter



> On 4 Jun 2016, at 20:36, Jens Alfke  wrote:
> 
> 
>> On Jun 4, 2016, at 9:51 AM, Peter Hudson > <mailto:peter.hud...@me.com>> wrote:
>> 
>> “If your app’s performance is suffering because of large files, then use 
>> streams instead, and try to only read the part of the file that’s necessary.”
>> Could you point me at some material about this technique ?  It sounds very 
>> interesting.
> 
> At a low level, you can use NSStream to read/write files. Or just use the C 
> standard library (fopen, fread, etc.)
> 
> At a high level, I can’t say that much since I don’t know what your file 
> format is. If it’s something like an NSArchive, there’s no alternative to 
> reading the entire file at once. If it’s an XML property list, you could use 
> NSXMLParser to stream it and pick out just the parts you need, although this 
> also gets expensive if you have to keep parsing the file over and over to 
> read different parts.
> 
>> I will check out the database approach as well.  I have steered clear of 
>> using databases as our users are mostly individuals with little or no tech 
>> support. The idea has always been to keep things simple and maintenance free.
> 
> You’re thinking of a database _server_ like MySQL or MongoDB. Those run as 
> separate processes and require administration.  The databases I mentioned are 
> embedded: they’re just libraries that you link into your app, which read and 
> write a data file (or a directory in LevelDB’s case.) To the end user it’s no 
> different than any other file format. 
> 
> Any Core Data app stores its documents this way, using SQLite by default. 
> There are also zillions more apps that use FMDB (an Objective-C wrapper 
> around SQLite) or just SQLite directly. Going with that does require that you 
> learn about relational databases and SQL syntax, though. Another option is 
> Realm, a very popular mobile database with a nice Obj-C or Swift API.
> 
> (There’s also the project I work on, Couchbase Lite, which fits in this 
> category. It has some more overhead, though, because it also performs full 
> multi-master data sync with servers or peers. This is awesome if you want 
> that feature, but if you’re just getting started with databases it adds to 
> the learning curve.)
> 
> Thinking through all the DB options, I’d suggest you look at Realm 
> (http://realm.io <http://realm.io/>). It’s very easy to understand even if 
> you don’t know databases, and the APIs are easy to use. The drawback is that 
> it will probably require that you rethink and re-implement your data model 
> layer based on its persistent object model.
> 
> If you don’t want to refactor that much, see whether there are any good Cocoa 
> wrappers around LevelDB, LMDB or RocksDB. (I’m skipping over Kyoto Cabinet 
> because I just remembered it’s GPL-licensed, and you probably want to stay 
> away from that.) They’ll provide a simple API that looks like an dictionary 
> that maps strings to binary data. Then you can break your data into small 
> bits and read and write them independently.
> 
> —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: NSFileWrapper

2016-06-04 Thread Peter Hudson
Hi All

Many thanks to everyone who has contributed to this thread on NSFileWrapper.

I have enough insight now  to do some work to see what works.

Again, thanks to everybody !

Peter

___

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: How can I get a single threaded network call in ObjC on iOS?

2016-06-28 Thread Peter Tomaselli
In the past I’ve used NSOperation for this — wrap each request in an async
NSOperation that only signals completion to its queue when its DataTask
completion handler is complete. Then you can blast a bunch of them at a
serial queue and they will come out serially until they are done.

On Tue, Jun 28, 2016 at 4:35 PM, Gary L. Wade 
wrote:

> Try using a mutex on your array of requests, when adding and removing
> them, and only pull a request off the array when you're done with your
> completion handler or when you have nothing in progress such as when you
> first start.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
>
> > On Jun 28, 2016, at 1:16 PM, Jim Adams  wrote:
> >
> > Unfortunately, with a multi threaded system, I cannot figure out a way
> to do that. Ideas appreciated.
> >
> > My network calls could come from any thread. I could see putting the
> request into a queue, but how to I make the completion handler run on that
> same queue so it remains blocked?
> >
> >> On Jun 28, 2016, at 4:11 PM, Gary L. Wade 
> wrote:
> >>
> >> The simplest way to do what you're asking is to not send another
> request until your completion handler finishes.
> >> --
> >> Gary L. Wade (Sent from my iPhone)
> >> http://www.garywade.com/
> >>
> >>> On Jun 28, 2016, at 12:52 PM, Jim Adams  wrote:
> >>>
> >>> I have an application that has the requirement that the accesses to
> the server be single threaded, i.e. the second request cannot go through
> until the first request has completed. I am using NSURLSession and
> NSURLSessionDataTask. I have set the Maximum Concurrent Host number in the
> configuration to 1 but I have seen evidence that there are simultaneous
> requests going up to my servers.
> >>>
> >>> Actually I don’t think they are truly simultaneous, just that the
> completion handler doesn’t finish before the next request goes out. Is
> there a way to make the next request wait until the completion block is
> exited?
> >>>
> >>> My evidence comes from looking in the server logs. I have 3 servers in
> AWS behind an ELB. If I am able to get the cookies back from the server
> before sending the next request then my request will go to the same server
> that the last request went to. If I don’t wait then then the request goes
> to a random server. If I watch the logs I can see the requests come in on
> multiple servers.
> >
>
>
> ___
>
> 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/vast.grapes%40gmail.com
>
> This email sent to vast.gra...@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: How can I get a single threaded network call in ObjC on iOS?

2016-06-28 Thread Peter Tomaselli
I have not a lot of Cocoa experience here, so I am legitimately asking this 
question, no snark intended: what’s the advantage to building a home-made 
“serial” “queue” as opposed to just using an actual serial operation queue? 
Haven’t you just described the first few steps one would take were one to set 
out to reimplement NSOperationQueue?

FWIW (and as I mentioned, I am an eminently ignorable person when it comes to 
Cocoa expertise), I sort of see the essence of the “async” flavor of 
NSOperation as being to provide definitive signaling when an otherwise 
asynchronous operation is really “finished“ — for whatever business definition 
of “finished” one requires. So I don’t completely agree that this would be 
“shoehorning”; seems right on the money to me.

Just one opinion! Cheers,

Peter

On Jun 28, 2016, at 6:50 PM, "Gary L. Wade"  
wrote:

> Based on his desire to do this serially, he would need a serial queue, and 
> he's using asynchronous requests, so succeeding calls from his completion 
> handler with a simple array in queue pattern is simpler than shoehorning it 
> all into dispatch queues.
> --
> Gary L. Wade (Sent from my iPhone)
> http://www.garywade.com/
> 
>> On Jun 28, 2016, at 3:45 PM, Alex Zavatone  wrote:
>> 
>> Would a dispatch queue get what he's looking for?


___

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: Justification of collection cells in sections

2016-08-02 Thread Peter Tomaselli
I’ve been in the same situation too (wanting a “left-justified” flow layout) 
and the only way I am aware of to tackle it is to subclass 
UICollectionViewFlowLayout and tweak the frames yourself. Luckily this is not 
nearly as complicated as handling the whole layout yourself!

Peter

On Aug 2, 2016, at 7:51 PM, Doug Hill  wrote:

> I was hoping to allow the Flow Layout to handle this rather than me handling 
> the layout. Given how the layout works for multiple items in a section, I 
> would presume there is some way to make this work the same for a single item 
> in a section. Am I wrong?
> 
> Doug Hill


___

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: Justification of collection cells in sections

2016-08-03 Thread Peter Tomaselli
I remain a non-expert on this topic, but my assumption has always been that
the current “look” is by design. Ugly, but by design. “Equally distribute
cells across the row” could be taken to mean that in the case of one cell,
it belongs in the middle… [shrug]

This is some of the first Cocoa code I wrote so please forgive… almost
everything about it, but here’s the FlowLayout subclass I mentioned:
https://github.com/Peterbing/CV-AutoLayout/blob/master/TemplateProject/TheFlowLayout.m#L31

This is a completely “left-justified” layout and it works by overriding the
`layoutAttributesFor*` methods to call super, and then squishes everything
over to the left before returning the attributes to the caller.

This is certainly not production-quality code but perhaps it’s a start!
IIRC there is Apple documentation (or perhaps it was a WWDC session) about
creating a simple “tweaked” UICollectionViewFlowLayout subclass — so my
impression is that this approach in general is kosher.

On Wed, Aug 3, 2016 at 3:38 PM, Doug Hill  wrote:

> So, does anyone know if the current behavior I mentioned is a bug? Is the
> behavior of Flow Layout documented? Should I file a bug with Apple?
>
> Also, what would be some quick ways to modify the flow layout behavior to
> handle this case with one item per section?
>
> Doug Hill
___

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: Dynamic-width Collection View

2016-08-10 Thread Peter Tomaselli
Sorry if this is kind of a cheesy reply, but a while ago I believe we were
speaking about “left-justifying” a collection view as well? I think I
replied to that thread with a link to a very unattractive toy repo of mine
on GitHub to illustrate the approach I’d taken with that.

Anyway that repo does in fact implement dynamically sizing collection view
cells and does so with relatively few entanglements. Can’t say that I’ve
used it “in production” anywhere but it might be worth cloning that thing
down and seeing how its approach grabs you.

It’s this thing: https://github.com/Peterbing/CV-AutoLayout

I mention this again because I remember the frustration/bewilderment you
are experiencing right now quite well and also did a bunch of legwork
researching this. We should probably pool our resources here!

Cheers,

Peter
___

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: Dynamic-width Collection View

2016-08-10 Thread Peter Tomaselli
I definitely remember feeling like there was a bit of a mismatch between the 
“declarative” feel of auto layout and the more procedural feel of all the 
necessary collection view layout overrides and whatnot. Bridging that gap was 
the main reason for all the shenanigans in that code (well, that and me only 
being a Cocoa hobbyist).

And you're quite right to perhaps not want to clutter up all your classes with 
that gunk if it can be avoided! Count me as one very interested to hear DTS’s 
suggestions if it's possible for you to share them. 

Cheers,

Peter

> On Aug 10, 2016, at 6:49 PM, Doug Hill  wrote:
> 
> Peter,
> 
> […] I will probably end up using a few of your techniques at some point, but 
> at this point I want to get an official solution from Apple. I created a TSI 
> with DTS and will see if they can offer any additional ideas on how to solve 
> this problem. I'll report anything I find out.
> 
> Doug Hill

___

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

Odd File Truncation

2016-09-07 Thread Peter Hudson
Hi All

One of my apps saves its’ files to an Airport Time Capsule.
Bog standard doc based app - using the usual framework methods to save its data.
This works extremely well.
And then, one day, the file that was saved was 20 bytes long instead of the 
usual 5 MBytes.

I’m sure there are a host of possibilities as to what went wrong.
Wondered if anyone else has experienced something similar… 


Peter
___

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: Odd File Truncation

2016-09-07 Thread Peter Hudson

___

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

Progress Indicator

2016-09-10 Thread Peter Hudson
Hi All

I have a simple view with a progress indicator in it.
Simple circular type - indeterminate.

I start it with   [progInd  startAnimation:self];
I end it with[progInd  stopAnimation:self];

After a couple of years of running just fine, it now simply does not appear 
onscreen at all - or run.

I’ve tried removing the object from the view and dropping in a new one - and 
reconnecting.
Everything looks fine - it appears to be connected up correctly.

Any suggestions gratefully received !

Peter



___

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: Progress Indicator

2016-09-10 Thread Peter Hudson
Hi Michael

Thanks for the suggestion - but I had already checked this.

Peter




> On 10 Sep 2016, at 16:43, Michael Mayer  wrote:
> 
> Peter -
> 
> My apologies for the obvious suggestion but, did you make sure it is plugged 
> in?
> progInd.hidden = false  (automatically converted to swift)
> 
> Regards, Michael
> 
> 
> 
> On Sep 10, 2016, at 10:38 AM, Peter Hudson  <mailto:peter.hud...@me.com>> wrote:
> 
> Hi All
> 
> I have a simple view with a progress indicator in it.
> Simple circular type - indeterminate.
> 
> I start it with   [progInd  startAnimation:self];
> I end it with[progInd  stopAnimation:self];
> 
> After a couple of years of running just fine, it now simply does not appear 
> onscreen at all - or run.
> 
> I’ve tried removing the object from the view and dropping in a new one - and 
> reconnecting.
> Everything looks fine - it appears to be connected up correctly.
> 
> Any suggestions gratefully received !
> 
> Peter
> 
> 
> 
> ___
> 
> 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/m.mayer6%40gmail.com 
> <https://lists.apple.com/mailman/options/cocoa-dev/m.mayer6%40gmail.com>
> 
> This email sent to m.may...@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

Progress Indicator

2016-09-10 Thread Peter Hudson
Hi Steve

I think your suggestion is going the right way.

I have ( unwittingly ) moved the processing about and the calls to the progress 
indicator are now happening while the thread is blocked for processing ( and 
non of the interface is being updated until the processing is done )

Next question, I guess, is how do I get out of this corner ?

Peter
___

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: Progress Indicator

2016-09-11 Thread Peter Hudson
Hi Alex

I have moved the point where I start the progress indicator and, without 
getting into threading, its working again.

Many thanks

Peter




> On 10 Sep 2016, at 21:02, Alex Zavatone  wrote:
> 
> Is it that the animation thread is being blocked or the thread you have to 
> dispatch the request to start?
> 
> On Sep 10, 2016, at 10:16 AM, Peter Hudson wrote:
> 
>> Hi Steve
>> 
>> I think your suggestion is going the right way.
>> 
>> I have ( unwittingly ) moved the processing about and the calls to the 
>> progress indicator are now happening while the thread is blocked for 
>> processing ( and non of the interface is being updated until the processing 
>> is done )
>> 
>> Next question, I guess, is how do I get out of this corner ?
>> 
>> Peter
>> ___
>> 
>> 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: Prioritizing drawing of the important stuff

2016-10-29 Thread Peter Tomaselli
Not at all my area of expertise, but I was going to suggest some sort of 
debounce-style approach as well. That is, there is somewhere an event stream 
that is firing off “please redraw everything” events (I think you said this was 
a KVO subscription) at some potentially excessive rate, right?

So I would debounce that twice into two new streams: once to create a “redraw 
the lightweight stuff” event stream that’s capped at 30 Hz (or whatever), and a 
second time to create a separate “redraw the slow stuff” event stream at 5 Hz 
(or whatever).

So, nothing to do with monkeying about with how the system prioritizes drawing 
internally, instead “sanitizing” your event stream up front based on what you 
know about the drawing performance characteristics downstream.

Apologies if this is way off base, I have very little experience with Cocoa 
drawing itself. :)

Peter

> On Oct 29, 2016, at 7:40 AM, Jonathan Taylor  
> wrote:
> 
> The point, though, is that the slider will happily update pretty much as as 
> often as the CPU allows. The issue is how to control what the OS considers to 
> be "smooth enough" slider updates - there's a point at which I'd much rather 
> have it "only" update the slider and the quick-to-draw image 10 times/sec, 
> and have a bit of time spare to do the low-priority drawing, rather than 
> updating the slider and easy image 60 times/sec.
> 
>> On 29 Oct 2016, at 12:27, Slipp Douglas Thompson 
>>  wrote:
>> 
>> You could just set up a simple debounce timer— reset it back to 0sec elapsed 
>> time whenever the slider is updated, and if it reaches a small delay then 
>> the HQ image is rendered (and remains on-screen until the slider is later 
>> moved and the process repeats).  No need to rely on GCD or threading.
>> 
>> — Slipp

___

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 an NSWindow with utility style in Xcode storyboard?

2016-11-08 Thread Peter Teeson

> On Nov 7, 2016, at 10:58 PM, Quincey Morris 
>  wrote:
> 
> On Nov 7, 2016, at 19:55 , Rick Mann  wrote:
>> 
>> Xcode never gives you controls for setting a class name
> 
> Much like the Spanish Inquisition.
> 
> (Monty Python joke, for those going “Huh?”)

Nobody expects the Spanish Inquisition….


___

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

PDF to Word ( docx) Conversion

2017-01-24 Thread Peter Hudson
Hi All

I have a report that I currently print to PDF.
Its a simple table with text ( varying fonts ) in the table.

I have tried to convert it to docx with a variety of proprietary converters.
One or two of them do a reasonable job.

But the bottom line is, I think, to get a Word doc that really behaves like a 
Word doc ( in word ) I need to export straight to docx format.

I’ve hunted around - but turned up little.
Does anyone know of a library that could do it ?

Peter
___

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   4   5   6   7   8   9   10   >