Re: NSEntityMigrationPolicy subclass methods not being called

2010-09-08 Thread Ben
Hi Jerry, thanks for the reply. I managed to get the subclass methods to fire 
eventually, I have no idea what I was doing wrong though. I trashed all my 
files and started again and for some reason that fixed it.

But I now have another problem, core data migrates fine without the 
NSEntityMigrationPolicy subclass, however as as soon as I add it it's name in 
the "custom Policy" field  I get the following error, which is perplexing me...


Unresolved error Error Domain=NSCocoaErrorDomain Code=134110 UserInfo=0x1ea4b0 
"Operation could not be completed. (Cocoa error 134110.)", {
NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=256 
UserInfo=0x1ec540 "Operation could not be completed. (Cocoa error 256.)";
reason = "Failed to save new store after first pass of migration.";



My first thought was that maybe I had to call 'super' in 'endEntityMapping', 
but I tried it and it made no difference...

- (BOOL)endEntityMapping:(NSEntityMapping *)mapping manager:(NSMigrationManager 
*)manager error:(NSError **)error
{
NSLog(@"endEntityMapping");
[super endEntityMapping: mapping manager: manager error: error];
return YES;
}




On 8 Sep 2010, at 01:57, Jerry Krinock wrote:

> 
> On 2010 Sep 06, at 05:31, Ben wrote:
> 
>> my NSEntityMigrationPolicy subclass methods are not being called so that I 
>> can run further migration code.
>> 
>> @implementation TestMigrationPolicy
>> 
>> - (BOOL)beginEntityMapping:(NSEntityMapping *)mapping
>>   manager:(NSMigrationManager *)manager  
>> error:(NSError * *)error
> 
> Just made a custom migration yesterday, doing what you said you did, and it 
> worked fine.  However the only method I've ever implemented in my 
> NSEntityMigrationPolicy subclasses is 
> createDestinationInstancesForSourceInstance:entityMapping:manager:error:.  
> I've never had any trouble with it.  That method should be called once for 
> each object in your store.
> 
> Or maybe stick an NSLog() in +initialize.
> 

___

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


Core Data and Managed Object Context Question

2010-09-08 Thread Ajay Sabhaney
Hello list,

I have a Core Data based application with a simple data model.  There is an 
entity 'ItemContainer' which has a to-many relationship with the entity 'Item'. 
 An item model entity corresponds to a Core Animation layer, so when a new Item 
managed object is added to the ItemContainer managed object, a CALayer should 
be added to the view.  Currently, I'm observing (using KVO) the ItemContainer 
managed object.  Each time an item is added to the item container set, I 
receive a notification (change type is NSKeyValueChangeInsertion), and add a 
correspondingly add a Core Animation layer to the layer-hosting view.  A 
similar sort of thing happens when an item is removed from the item container 
set as well.  This all works very nicely - including the free undo and redo 
functionality provided by Core Data and the managed object context.

The problem is I'm not sure the best way to go about implementing document 
loading. 

I know NSArrayController offers the ability to bind to the managed object 
context (which I obtain from my NSPersistentDocument), which makes loading + 
fetching very simple.  However, if I use NSArrayController, and observe the 
arrangedObjects key of the array controller (as opposed to the item container 
set), I cannot get the newly added object (instead of getting 
NSKeyValueChangeInsertion type changes, I would get NSKeyValueChangeSetting 
type changes), which seems to be a problem that others have experienced as 
well.  It is important to get only the newly added/removed items since we would 
like to be able easily and efficiently add/remove only the necessary CALayers 
from the root layer.

As an aside, it seems that if I bind the contentSet property of the 
NSArrayController to the ItemContainer's items set, the loading does not work 
anymore, and arrangedObjects is empty after loading a document (which makes 
sense since the source set is empty).

So I'd like some insights on either how I could completely skip using the 
NSArrayController and automatically do a fetch after a document is loaded so 
that the model items become populated and I get the proper KVO notifications, 
OR, how to make the NSArrayController work in this context.  Or perhaps I am 
missing something altogether?

If possible, I would like to avoid:
1) Using an NSArrayController and on every KVO notification, look at the items 
that existed before the notification, looking at the items that exist after the 
notification, and determine the newly added items given the difference.
2) Using NSArrayController for the sake of loading, then once the 
loading/fetching is complete, continue to observe the item container set and 
disregard the NSArrayController (although this probably would work okay).

Thank you in advance.

Ajay



___

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: NSEntityMigrationPolicy subclass methods not being called

2010-09-08 Thread Jerry Krinock

On 2010 Sep 08, at 01:43, Ben wrote:

> I get the following…
> 
> NSUnderlyingError = Error Domain=NSCocoaErrorDomain Code=256 
> UserInfo=0x1ec540 "Operation could not be completed. (Cocoa error 256.)";
> reason = "Failed to save new store after first pass of migration.";

Nice-looking error, but I've never seen it before either.

> My first thought was that maybe I had to call 'super' in 'endEntityMapping', 
> but I tried it and it made no difference…

My second thought would be to eliminate all methods in your implementation, 
like this:

@implementation TestMigrationPolicy
#if 0
…
#endif
@end

What happens if make that your Custom Migration Policy class?

___

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


delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread slasktrattena...@gmail.com
Hello,

This problem was introduced in Mac OS X 10.6 and has remained unsolved
ever since.

I've got a timer that polls iTunes for its player position every
second. I used to use ScriptingBridge for this task:

if ( [iTunes isRunning] ) {
   if ( [self isPlaying] ) return [iTunes playerPosition];
}
return 0;

After the release of Snow Leopard, it seems that [iTunes isRunning]
returns YES for a short while even after the application has quit (I
believe this applies to all apps, not just iTunes, but I haven't
confirmed this yet). As a result, my app would relaunch iTunes,
assuming it was still running. Not cool.

As a workaround, I tried registering an observer for NSWorkSpace's
NSWorkspaceDidTerminateApplicationNotification. As soon as I received
the notification, I would invalidate the timer to make sure its fire
method wouldn't trigger a relaunch. I also set iTunes timeout delay to
-1, just to be on the safe side.

Unfortunately this had no effect at all. A wild guess is that the
NSWorkspaceDidTerminateApplicationNotification under Snow Leopard is
sent out somewhat later than in earlier versions.

Finally I tried replacing ScriptingBridge with NSAppleScript:

currentTimeScript = [[NSAppleScript alloc] initWithSource:@"try\n\
  if application 
\"iTunes\" is running then\n\
  tell application 
\"iTunes\"\n\
  if player state is 
not stopped then\n\
  return player 
position\n\
  end if\n\
  end tell\n\
  end if\n\
  on error\n\
  return 0\n\
  end try"];

This yielded somewhat better results. iTunes now quits gracefully most
of the time, but is still relaunched every now and then (some users
report it still happens each and every time). Now I'm out of ideas...
What did I miss? Should I file a radar?

Ideally, I'd like a NSWorkspaceWillTerminateApplicationNotification.
But for now I just need to find a workaround. All suggestions are
welcome.

-F
___

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: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread Dave Keck
>
> After the release of Snow Leopard, it seems that [iTunes isRunning]
> returns YES for a short while even after the application has quit (I
> believe this applies to all apps, not just iTunes, but I haven't
> confirmed this yet). As a result, my app would relaunch iTunes,
> assuming it was still running. Not cool.
>

I can't comment decisively on your problem with Scripting Bridge, but I
experienced some relaunching issues with NSAppleScript when attempting to
control an application other than iTunes. Since both NSAppleScript and
Scripting Bridge are based on Apple events, I imagine we experienced the
same underlying problem. Anyway, I ended up using the Process Manager APIs
to check whether the app in question was running before executing an
AppleScript to issue commands to it. (It seems NSRunningApplication is the
modern API for 10.6+.)

In your case, I would try something like this:

==

   BOOL iTunesOpen = NO;
   ProcessSerialNumber currentPSN;

   for (currentPSN.highLongOfPSN = kNoProcess, currentPSN.lowLongOfPSN =
kNoProcess;;)
   {

   OSErr getNextProcessResult = 0;

   getNextProcessResult = GetNextProcess(¤tPSN);

   // For production code we should of course be handling errors
gracefully.
   assert(getNextProcessResult == noErr || getNextProcessResult ==
procNotFound);
   if (getNextProcessResult == procNotFound) break;

   if ([[[(id)ProcessInformationCopyDictionary(¤tPSN,
kProcessDictionaryIncludeAllInformationMask) autorelease]
   objectForKey: (NSString *)kCFBundleIdentifierKey]
isEqualToString: @"com.apple.iTunes"])
   {

   iTunesOpen = YES;
   break;

   }

   }

   // Only if iTunes is open will we attempt to request its player position,
to avoid relaunching it.
   if (iTunesOpen) return [iTunes playerPosition];
   return -1;

==

Finally I tried replacing ScriptingBridge with NSAppleScript:
>
> currentTimeScript = [[NSAppleScript alloc] initWithSource:@"try\n\
>  if application
> \"iTunes\" is running then\n\
>  tell application
> \"iTunes\"\n\
>  if player state is
> not stopped then\n\
>  return player
> position\n\
>  end if\n\
>  end tell\n\
>  end if\n\
>  on error\n\
>  return 0\n\
>  end try"];
>
> This yielded somewhat better results. iTunes now quits gracefully most
> of the time, but is still relaunched every now and then (some users
> report it still happens each and every time). Now I'm out of ideas...
> What did I miss? Should I file a radar?


I only know enough about AppleScript to avoid it, but I believe iTunes is
being launched necessarily for the NSAppleScript to compile. (Meaning that
regardless of what checks you surround your "critical" AppleScript with, I
believe it will still launch iTunes if the script contains "tell application
'iTunes'".) If for some reason you choose the AppleScript route, I got
around this by only allowing the "tell application 'iTunes'" AppleScript to
compile if we're sure iTunes is already running. For example, after checking
iTunes' running state using the code above:

==

   // Only compile/execute the script if iTunes is already running, to
prevent it from relaunching.
   if (iTunesOpen)
   NSAppleScript alloc] initWithSource: @"tell application id
\"com.apple.iTunes\" to play"] autorelease] executeAndReturnError: nil];

==

Of course this technique has a race between the time that we check whether
iTunes is running and the time that we actually tell it to do something, but
I imagine this window is small enough to be acceptable.
___

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: Cocoa-dev Digest, Vol 7, Issue 890

2010-09-08 Thread Chris Tracewell
On Sep 8, 2010, at 10:21 AM, cocoa-dev-requ...@lists.apple.com wrote:

> The message in the 'if' ([theNumOne compare:theNumTwo]) is an invocation of 
> [NSNumber compare:], not [NSDecimalNumber compare:]. It's not absolutely 
> clear what is supposed to happen when the compare parameter is an instance of 
> NSDecimalNumber. Yes, NSDecimalNumber is a subclass of NSNumber, but these 
> are abstract classes. The actual objects are (typically) concrete subclasses 
> of the abstract classes, such as NSCFNumber. It's possible that this muddies 
> the waters enough that the mixed comparison doesn't work as you would expect.
> 
> In any case, why not simply do the comparison between 'self' and 
> '[NSDecimalNumber zero]'?

Quincy thanks for the response... I moved to NSDecimalNumber but am still 
getting strange behavior. I am truly perplexed - the boolean YES is being 
returned as -256. I think my problem is with how BOOL is being passed, cast, 
interpreted... I know it is  typedef, it's as if though something is getting 
"lost in translation. Take a look at the three following code fragments to see 
the strangeness. I should mention that the category this is being called from 
is in a private linked framework, if that makes any difference.

The following are called by an NSDecimalNumber with a value of 192.2

// == WORKS :: returns 0

-(BOOL)isLessThanZero
{   
if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
return [[NSDecimalNumber zero] compare:self] == 
NSOrderedDescending;
}

return NO;
}

// == DOES NOT WORK :: returns -256

-(BOOL)isLessThanZero
{   
if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
return YES;
}

return NO;
}


// == DOES NOT WORK :: returns -256

-(BOOL)isLessThanZero
{
return [[NSDecimalNumber zero] compare:self] == NSOrderedDescending;
}


Any ideas?___

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


NSTableView/NSOutlineView variable row height code has detected re-entry.

2010-09-08 Thread Keith Blount
Hello,

I have an NSOutlineView with variable row heights, as determined in 
my -outlineView:heightOfRowByItem: delegate method. This has always seemed to 
work fine, and the code of this delegate method hasn't changed much in the past 
three years, but I have had a user report a case whereby his outline view 
appeared completely blank and this message appeared on the console:

NSTableView/NSOutlineView variable row height code has detected re-entry. 
Avoiding a crash

After restarting the program, he hasn't seen the problem since, so I haven't 
been able to reproduce it. But I did see it myself during testing once last 
year 
and then, too, I wasn't able to reproduce it a second time. I've Googled for 
this message and can only find a couple of other posts referencing it, with no 
solution. One problem is that I don't know exactly what the message means by 
"re-entry", so I'm not sure whether the problem is with the variable row height 
code itself (which seems fine), or because the row height code is somehow 
getting called twice during layout, or something else entirely. I've gone 
through the code but can find no obvious culprit (which is probably not 
surprising given the rarity of the error).

Has anybody else seen this error, or does anybody know what it means?

Many thanks in advance and all the best,
Keith


  
___

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: NSTableView/NSOutlineView variable row height code has detected re-entry.

2010-09-08 Thread Clark Cox
On Wed, Sep 8, 2010 at 11:11 AM, Keith Blount  wrote:
> Hello,
>
> I have an NSOutlineView with variable row heights, as determined in
> my -outlineView:heightOfRowByItem: delegate method. This has always seemed to
> work fine, and the code of this delegate method hasn't changed much in the 
> past
> three years, but I have had a user report a case whereby his outline view
> appeared completely blank and this message appeared on the console:
>
> NSTableView/NSOutlineView variable row height code has detected re-entry.
> Avoiding a crash
>
> After restarting the program, he hasn't seen the problem since, so I haven't
> been able to reproduce it. But I did see it myself during testing once last 
> year
> and then, too, I wasn't able to reproduce it a second time. I've Googled for
> this message and can only find a couple of other posts referencing it, with no
> solution. One problem is that I don't know exactly what the message means by
> "re-entry", so I'm not sure whether the problem is with the variable row 
> height
> code itself (which seems fine), or because the row height code is somehow
> getting called twice during layout, or something else entirely. I've gone
> through the code but can find no obvious culprit (which is probably not
> surprising given the rarity of the error).
>
> Has anybody else seen this error, or does anybody know what it means?

Essentially, it means just what it says. Something has called into the
code responsible for recording the row heights for a table view, while
that same code was already running.

Some potential causes:
- Recursion: Your -tableView:heightOfRow: delegate method is doing
something that is calling -reloadData, or
-noteHeightOfRowsWithIndexesChanged: (or something else that causes
recalculation of row heights)
- Concurrency: You're accessing the table, its delegate, or its data
source from multiple threads.

-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Re: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 10:21 AM, cocoa-dev-requ...@lists.apple.com wrote:

> The message in the 'if' ([theNumOne compare:theNumTwo]) is an invocation of 
> [NSNumber compare:], not [NSDecimalNumber compare:]. It's not absolutely 
> clear what is supposed to happen when the compare parameter is an instance of 
> NSDecimalNumber. Yes, NSDecimalNumber is a subclass of NSNumber, but these 
> are abstract classes. The actual objects are (typically) concrete subclasses 
> of the abstract classes, such as NSCFNumber. It's possible that this muddies 
> the waters enough that the mixed comparison doesn't work as you would expect.
> 
> In any case, why not simply do the comparison between 'self' and 
> '[NSDecimalNumber zero]'?

Sorry for the last reply - I had the wrong subject line. I have nailed down 
that it seems that the BOOL is being returned as something other than char 1 || 
char 0 from the private framework where the category exists. The following 
works though, I know it's bad to use NSInteger values instead of BOOL but at 
this point I am at a dead end


//=== WORKS

-(BOOL)isLessThanZero
{
NSInteger theInteger = 0;

if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
{
theInteger = 1;
}

return theInteger;
}

--chris___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Kyle Sluder
On Tue, Sep 7, 2010 at 5:58 PM, Chris Tracewell  wrote:
> I have a category on NSDecimalNumber that seems very straight forward - yet 
> is producing odd results. The code below shows my logging and everything 
> outputs as expected - but the final evaluation does not work. Am I 
> misunderstanding something?

Well, your entire method could be replaced with a oneliner:

- (BOOL)isLessThanZero; {
return [self compare:[NSNumber zero]] == NSOrderedDescending;
}

--Kyle Sluder
___

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: Cocoa-dev Digest, Vol 7, Issue 890

2010-09-08 Thread Quincey Morris
On Sep 8, 2010, at 11:07, Chris Tracewell wrote:

> I am truly perplexed - the boolean YES is being returned as -256. I think my 
> problem is with how BOOL is being passed, cast, interpreted... I know it is  
> typedef, it's as if though something is getting "lost in translation. Take a 
> look at the three following code fragments to see the strangeness. I should 
> mention that the category this is being called from is in a private linked 
> framework, if that makes any difference.
> 
> The following are called by an NSDecimalNumber with a value of 192.2
> 
> // == WORKS :: returns 0
> 
> -(BOOL)isLessThanZero
>   {   
>   if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
>   {
>   return [[NSDecimalNumber zero] compare:self] == 
> NSOrderedDescending;
>   }
>   
>   return NO;
>   }
> 
> // == DOES NOT WORK :: returns -256
> 
> -(BOOL)isLessThanZero
>   {   
>   if ([[NSDecimalNumber zero] compare:self] == NSOrderedDescending)
>   {
>   return YES;
>   }
>   
>   return NO;
>   }
> 
> 
> // == DOES NOT WORK :: returns -256
> 
> -(BOOL)isLessThanZero
>   {
>   return [[NSDecimalNumber zero] compare:self] == NSOrderedDescending;
>   }

It's not YES that's being "returned as" -256, but NO. (The answer is NO in all 
3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) 0) is 
being correctly returned in the low order byte, with trash in the high order 
bytes that's left over from earlier code.

So, the problem is not your 'isLessThanZero' method, but the calling code, 
which is treating the returned value as an int (or something). Presumably the 
calling code was compiled with an incompatible declaration of your method, or 
of the BOOL type.





___

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: NSTableView/NSOutlineView variable row height code has detected re-entry.

2010-09-08 Thread Kevin Wojniak
That usually means drawRect: is being called while the table is already inside 
its own drawRect: method.

I've had to deal with this recently. One possible way to find out where it's 
happening is to subclass your table view and override drawRect:, then setup a 
counter to check to see if the re-entry is occurring, something like this 
(untested):

static int c = 0;

- (void)drawRect:(NSRect)rect
{
if (c > 0) {
// re-entry, set a breakpoint here
}
c++;
[super drawRect:rect];
c--;
}

The problem in my code was we were manually running the run loop which 
continued to process events, causing the drawRect: to be called multiple times 
(often in recursion, leading to a crash), so check to see if you're doing 
anything like this. We've noticed on 10.6 it's much less prone to crash in 
these situations, but 10.5/10.4 aren't as forgivable.

Kevin


On Sep 8, 2010, at 11:11 AM, Keith Blount wrote:

> Hello,
> 
> I have an NSOutlineView with variable row heights, as determined in 
> my -outlineView:heightOfRowByItem: delegate method. This has always seemed to 
> work fine, and the code of this delegate method hasn't changed much in the 
> past 
> three years, but I have had a user report a case whereby his outline view 
> appeared completely blank and this message appeared on the console:
> 
> NSTableView/NSOutlineView variable row height code has detected re-entry. 
> Avoiding a crash
> 
> After restarting the program, he hasn't seen the problem since, so I haven't 
> been able to reproduce it. But I did see it myself during testing once last 
> year 
> and then, too, I wasn't able to reproduce it a second time. I've Googled for 
> this message and can only find a couple of other posts referencing it, with 
> no 
> solution. One problem is that I don't know exactly what the message means by 
> "re-entry", so I'm not sure whether the problem is with the variable row 
> height 
> code itself (which seems fine), or because the row height code is somehow 
> getting called twice during layout, or something else entirely. I've gone 
> through the code but can find no obvious culprit (which is probably not 
> surprising given the rarity of the error).
> 
> Has anybody else seen this error, or does anybody know what it means?
> 
> Many thanks in advance and all the best,
> Keith
> 
> 
> 
> ___
> 
> 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/kainjow%40kainjow.com
> 
> This email sent to kain...@kainjow.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


missing features in iOS 4 block-based UIView animation

2010-09-08 Thread Matt Neuburg
The iOS 4 syntax for using Objective-C blocks with UIView animation (instead
of the old-style UIView "animation block", love the confusing terminology
here) is delightful, but some features are missing:

* You can't designate a delegate, so you can't get a notification when the
animation is about to start.

* You can't specify a fixed number of repetitions. I have code that relies
on this feature (e.g. a view that shakes its head by vibrating back and
forth three times).

What are folks doing to compensate? Thx - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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


NSView alphaValue animation on 10.5

2010-09-08 Thread Alexander Cohen
Hi,

I've got a lot of code that depends on 10.6's use of NSView's animator and 
setAlphaValue for showing and hiding animations. Now, i need to bring this to 
10.5. On 10.5, to animate the alphaValue, i learnt that the NSView needs to be 
backed by a layer. I tried doing that and it created mayhem, so i don't think i 
can go that route. I could use NSViewAnimation but that would create 2 sets of 
code and i'd rather just stick with [[view animator] setAlphaValue:val]. Does 
anyone have any idea how to get something working without having to if/else all 
these calls?

thx

AC___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:

> It's not YES that's being "returned as" -256, but NO. (The answer is NO in 
> all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) 
> 0) is being correctly returned in the low order byte, with trash in the high 
> order bytes that's left over from earlier code.
> 
> So, the problem is not your 'isLessThanZero' method, but the calling code, 
> which is treating the returned value as an int (or something). Presumably the 
> calling code was compiled with an incompatible declaration of your method, or 
> of the BOOL type.

Thanks Quincey, your suggestion got me looking at the calling model and I got 
it working by first assigning the result as a BOOL rather than just using the 
result inside of an if logic statement like so...


// == Did NOT Work =//

if ([theDecimalNumber isLessThanZero])
{
... do something
}

// == DID Work =//

BOOL theResult = [theDecimalNumber isLessThanZero];
if (theResult)
{
... do something
}

I must admit that I do not understand why this is so. I can for example use if 
([someButton isEnabled])  and it returns a BOOL and the if statement works 
fine. If you have any pointers or docs that explains this further I would 
really appreciate it as right now I feel scared about how I have been 
evaluating BOOL's returned in all of my own custom methods.

--chris___

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: Cocoa-dev Digest, Vol 7, Issue 890

2010-09-08 Thread Kyle Sluder
On Wed, Sep 8, 2010 at 11:50 AM, Quincey Morris
 wrote:
> So, the problem is not your 'isLessThanZero' method, but the calling code, 
> which is treating the returned value as an int (or something). Presumably the 
> calling code was compiled with an incompatible declaration of your method, or 
> of the BOOL type.

Ooh, excellent point. Maybe you're missing an #import? Remember that
methods without prototypes are assumed to return id, which is a
pointer, and thus 4- or 8-bytes wide depending on platform, whereas
BOOL is a char and therefore only one byte wide.

Make sure you're building with "Treat Warnings As Errors" on.

--Kyle Sluder
___

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: NSTableView/NSOutlineView variable row height code has detected re-entry.

2010-09-08 Thread Keith Blount
Hello Clark,

Many thanks for the reply, much appreciated. I figured the "re-entry" probably 
meant something along those lines, but I wasn't sure, so thank you for 
clarifying it. I'm not calling anything explicitly in my 
-outlineView:heightOfRowByItem: method, and there are no other threads 
operating 
on it, but that said, the row resizing code is rather complicated as it live 
resizes the rows during editing (by checking row heights, ending editing, 
reloading data and then carrying on editing - it's not pretty) and based on 
various column content, so there's a lot going on. At least your explanation 
gives me something to look for in the absence of a reproducible case.

Thanks again and all the best,
Keith


- Original Message 
From: Clark Cox 
To: Keith Blount 
Cc: cocoa-dev@lists.apple.com
Sent: Wed, September 8, 2010 7:42:55 PM
Subject: Re: NSTableView/NSOutlineView variable row height code has detected 
re-entry.

On Wed, Sep 8, 2010 at 11:11 AM, Keith Blount  wrote:
> Hello,
>
> I have an NSOutlineView with variable row heights, as determined in
> my -outlineView:heightOfRowByItem: delegate method. This has always seemed to
> work fine, and the code of this delegate method hasn't changed much in the 
past
> three years, but I have had a user report a case whereby his outline view
> appeared completely blank and this message appeared on the console:
>
> NSTableView/NSOutlineView variable row height code has detected re-entry.
> Avoiding a crash
>
> After restarting the program, he hasn't seen the problem since, so I haven't
> been able to reproduce it. But I did see it myself during testing once last 
>year
> and then, too, I wasn't able to reproduce it a second time. I've Googled for
> this message and can only find a couple of other posts referencing it, with no
> solution. One problem is that I don't know exactly what the message means by
> "re-entry", so I'm not sure whether the problem is with the variable row 
height
> code itself (which seems fine), or because the row height code is somehow
> getting called twice during layout, or something else entirely. I've gone
> through the code but can find no obvious culprit (which is probably not
> surprising given the rarity of the error).
>
> Has anybody else seen this error, or does anybody know what it means?

Essentially, it means just what it says. Something has called into the
code responsible for recording the row heights for a table view, while
that same code was already running.

Some potential causes:
- Recursion: Your -tableView:heightOfRow: delegate method is doing
something that is calling -reloadData, or
-noteHeightOfRowsWithIndexesChanged: (or something else that causes
recalculation of row heights)
- Concurrency: You're accessing the table, its delegate, or its data
source from multiple threads.

-- 
Clark S. Cox III
clarkc...@gmail.com



  
___

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

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

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

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


Re: NSView alphaValue animation on 10.5

2010-09-08 Thread Kyle Sluder
On Wed, Sep 8, 2010 at 12:32 PM, Alexander Cohen  wrote:
> I've got a lot of code that depends on 10.6's use of NSView's animator and 
> setAlphaValue for showing and hiding animations. Now, i need to bring this to 
> 10.5. On 10.5, to animate the alphaValue, i learnt that the NSView needs to 
> be backed by a layer. I tried doing that and it created mayhem, so i don't 
> think i can go that route. I could use NSViewAnimation but that would create 
> 2 sets of code and i'd rather just stick with [[view animator] 
> setAlphaValue:val]. Does anyone have any idea how to get something working 
> without having to if/else all these calls?

NSViewAnimation is still supported on 10.6, though it doesn't do
everything the -animator proxy does. So you can port your code to use
NSViewAnimation, remove the use of -animator, and only maintain one
codebase.

--Kyle Sluder
___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Quincey Morris
On Sep 8, 2010, at 12:40, Chris Tracewell wrote:

> I must admit that I do not understand why this is so. I can for example use 
> if ([someButton isEnabled])  and it returns a BOOL and the if statement works 
> fine. If you have any pointers or docs that explains this further I would 
> really appreciate it as right now I feel scared about how I have been 
> evaluating BOOL's returned in all of my own custom methods.

You need to find the header file that declares 'isLessThanZero' in the 
compilation unit where it's called. Perhaps the return type is missing or wrong 
there. If it correctly says BOOL, then you need to find which declaration of 
BOOL is being used and check that it's the correct one. Also, check the build 
settings for both the application and the framework to make sure there isn't a 
setting that causes BOOL/char values to be handled differently. It's possible 
that Xcode's Build | Preprocess may produce something useful.



___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Greg Parker
On Sep 8, 2010, at 12:40 PM, Chris Tracewell wrote:
> On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:
>> It's not YES that's being "returned as" -256, but NO. (The answer is NO in 
>> all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed char) 
>> 0) is being correctly returned in the low order byte, with trash in the high 
>> order bytes that's left over from earlier code.
>> 
>> So, the problem is not your 'isLessThanZero' method, but the calling code, 
>> which is treating the returned value as an int (or something). Presumably 
>> the calling code was compiled with an incompatible declaration of your 
>> method, or of the BOOL type.
> 
> Thanks Quincey, your suggestion got me looking at the calling model and I got 
> it working by first assigning the result as a BOOL rather than just using the 
> result inside of an if logic statement like so...
> 
> 
> // == Did NOT Work =//
> 
> if ([theDecimalNumber isLessThanZero])
>   {
>   ... do something
>   }
> 
> // == DID Work =//
> 
> BOOL theResult = [theDecimalNumber isLessThanZero];
> if (theResult)
>   {
>   ... do something
>   }
> 
> I must admit that I do not understand why this is so. I can for example use 
> if ([someButton isEnabled])  and it returns a BOOL and the if statement works 
> fine. If you have any pointers or docs that explains this further I would 
> really appreciate it as right now I feel scared about how I have been 
> evaluating BOOL's returned in all of my own custom methods.

I bet you have a compiler warning at this call site that says "warning: 
'NSDecimalNumber' may not respond to '-isLessThanZero'". That means the 
compiler can't see the method declaration for -isLessThanZero at the call site. 
In that case, the compiler guesses that the method returns `int`, which is 
wrong and will cause incorrect handling of the BOOL value on some architectures.

You need to (1) put your category's @interface in a header file, and (2) import 
that header file here.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread slasktrattena...@gmail.com
Hi Dave,

Thanks for your reply.

On Wed, Sep 8, 2010 at 7:18 PM, Dave Keck  wrote:
>> After the release of Snow Leopard, it seems that [iTunes isRunning]
>> returns YES for a short while even after the application has quit (I
>> believe this applies to all apps, not just iTunes, but I haven't
>> confirmed this yet). As a result, my app would relaunch iTunes,
>> assuming it was still running. Not cool.
>
> I can't comment decisively on your problem with Scripting Bridge, but I
> experienced some relaunching issues with NSAppleScript when attempting to
> control an application other than iTunes. Since both NSAppleScript and
> Scripting Bridge are based on Apple events, I imagine we experienced the
> same underlying problem.

I believe you are right. Funny though that the NSAppleScript route
seems to cause fewer relaunches than ScriptingBridge.

> Anyway, I ended up using the Process Manager APIs
> to check whether the app in question was running before executing an
> AppleScript to issue commands to it.

It's worth a try. But I'm afraid it will put a heavy load on the CPU
for a timer firing every second, no?

> (It seems NSRunningApplication is the
> modern API for 10.6+.)

Do we know if this is faster than using Process Manager? Unfortunately
I need to target Mac OS X 10.5 as well (where this is not a problem),
but I suppose I could use NSSelectorFromString() to get it to compile
under the 10.5 SDK.

> /snip.../
>
> I only know enough about AppleScript to avoid it, but I believe iTunes is
> being launched necessarily for the NSAppleScript to compile.

No, this is not correct. You can compile a script without launching
the target - at least on Snow Leopard.

-F
___

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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Chris Tracewell

On Sep 8, 2010, at 1:29 PM, Greg Parker wrote:

> On Sep 8, 2010, at 12:40 PM, Chris Tracewell wrote:
>> On Sep 8, 2010, at 12:02 PM, cocoa-dev-requ...@lists.apple.com wrote:
>>> It's not YES that's being "returned as" -256, but NO. (The answer is NO in 
>>> all 3 cases.) -256 is 0xFF00, so you can see that NO (i.e. (signed 
>>> char) 0) is being correctly returned in the low order byte, with trash in 
>>> the high order bytes that's left over from earlier code.
>>> 
>>> So, the problem is not your 'isLessThanZero' method, but the calling code, 
>>> which is treating the returned value as an int (or something). Presumably 
>>> the calling code was compiled with an incompatible declaration of your 
>>> method, or of the BOOL type.
>> 
>> Thanks Quincey, your suggestion got me looking at the calling model and I 
>> got it working by first assigning the result as a BOOL rather than just 
>> using the result inside of an if logic statement like so...
>> 
>> 
>> // == Did NOT Work =//
>> 
>> if ([theDecimalNumber isLessThanZero])
>>  {
>>  ... do something
>>  }
>> 
>> // == DID Work =//
>> 
>> BOOL theResult = [theDecimalNumber isLessThanZero];
>> if (theResult)
>>  {
>>  ... do something
>>  }
>> 
>> I must admit that I do not understand why this is so. I can for example use 
>> if ([someButton isEnabled])  and it returns a BOOL and the if statement 
>> works fine. If you have any pointers or docs that explains this further I 
>> would really appreciate it as right now I feel scared about how I have been 
>> evaluating BOOL's returned in all of my own custom methods.
> 
> I bet you have a compiler warning at this call site that says "warning: 
> 'NSDecimalNumber' may not respond to '-isLessThanZero'". That means the 
> compiler can't see the method declaration for -isLessThanZero at the call 
> site. In that case, the compiler guesses that the method returns `int`, which 
> is wrong and will cause incorrect handling of the BOOL value on some 
> architectures.
> 
> You need to (1) put your category's @interface in a header file, and (2) 
> import that header file here.
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler



Greg,

That was it :-) I had not imported ANY category headers in my framework - 
"most" had worked anyway in my linking project so I figured it was some 
framework magic behind the scenes recognizing them and making them work. After 
linking them my warning count went way down and I am getting syntax coloring 
now too - bonus!

I wanted to sneak in one last question - is it safe to compare an 
NSDecimalNumber to an NSNumber  and visa versa?

Thanks for taking the time to respond.

-chris___

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: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread Dave Keck
> > Anyway, I ended up using the Process Manager APIs
> > to check whether the app in question was running before executing an
> > AppleScript to issue commands to it.
>
> It's worth a try. But I'm afraid it will put a heavy load on the CPU
> for a timer firing every second, no?

You'll have to profile it and see. Of course, you should try to
minimize the amount of polling.

> > (It seems NSRunningApplication is the
> > modern API for 10.6+.)
>
> Do we know if this is faster than using Process Manager? Unfortunately
> I need to target Mac OS X 10.5 as well (where this is not a problem),
> but I suppose I could use NSSelectorFromString() to get it to compile
> under the 10.5 SDK.

I don't think performance is going to be a big issue with the process
APIs; at any given time a user probably isn't going to have over 20 or
30 foreground+background apps running, so even iterating over each one
shouldn't be much an issue. But no need to speculate – might as well
just profile the different techniques and choose the best one.

> > /snip.../
> >
> > I only know enough about AppleScript to avoid it, but I believe iTunes is
> > being launched necessarily for the NSAppleScript to compile.
>
> No, this is not correct. You can compile a script without launching
> the target - at least on Snow Leopard.

I'm afraid my testing shows otherwise; on my system, the following
code always launches Safari on both 10.5 and 10.6:

NSAppleScript alloc] initWithSource: @"tell application id
\"com.apple.Safari\" to activate"] autorelease] compileAndReturnError:
nil];

(Note it's -compileAndReturnError:, not executeAndReturnError:.) The
launching behavior seems to vary by application, though. For me, this
code launches iSync, Safari and System Preferences, but doesn't seem
to launch iTunes.

Such unpredictability is the nature of AppleScript and why I try to
avoid it. But I imagine this (or some related reason) is why you're
having relaunching issues, though I bet it depends on the system.

... So to workaround the problem, check whether iTunes is running, and
only if it is, perform some Scripting Bridge/AppleScript action.
___

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: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread slasktrattena...@gmail.com
On Thu, Sep 9, 2010 at 12:13 AM, Dave Keck  wrote:
> I don't think performance is going to be a big issue with the process
> APIs; at any given time a user probably isn't going to have over 20 or
> 30 foreground+background apps running, so even iterating over each one
> shouldn't be much an issue. But no need to speculate – might as well
> just profile the different techniques and choose the best one.

Will do. Thanks!

>> > I only know enough about AppleScript to avoid it, but I believe iTunes is
>> > being launched necessarily for the NSAppleScript to compile.
>>
>> No, this is not correct. You can compile a script without launching
>> the target - at least on Snow Leopard.
>
> I'm afraid my testing shows otherwise; on my system, the following
> code always launches Safari on both 10.5 and 10.6:

Sorry, my bad. I only tried with iTunes.
___

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: delayed NSWorkspaceDidTerminateApplicationNotification under 10.6?

2010-09-08 Thread Shane Stanley
On 9/9/10 8:13 AM, "Dave Keck"  wrote:

>> No, this is not correct. You can compile a script without launching
>> the target - at least on Snow Leopard.
> 
> I'm afraid my testing shows otherwise; on my system, the following
> code always launches Safari on both 10.5 and 10.6:
> 
> NSAppleScript alloc] initWithSource: @"tell application id
> \"com.apple.Safari\" to activate"] autorelease] compileAndReturnError:
> nil];
> 
> (Note it's -compileAndReturnError:, not executeAndReturnError:.) The
> launching behavior seems to vary by application, though. For me, this
> code launches iSync, Safari and System Preferences, but doesn't seem
> to launch iTunes.
> 
> Such unpredictability is the nature of AppleScript

It's only unpredictable if you don't look for the reason.

It's a consequence of the fact that compilation requires an app's scripting
dictionary. For some apps the dictionary is fixed, but for others (for
example, those that support plug-ins) it can vary, in which case launching
the app is unavoidable.

-- 
Shane Stanley 



___

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


some no-op animation options?

2010-09-08 Thread Matt Neuburg
I have been experimenting with the new iOS 4 block-based UIView animation,
and I cannot find any situation where the option
UIViewAnimationOptionAllowAnimatedContent makes any difference. What I
expect from the documentation is that this should cause drawRect: to be
called repeatedly, but it doesn't. However, it may be that I'm not guessing
correctly at what the (rather coy) documentation means by "the views", so
maybe I'm not putting my custom UIView in the right place in the interface.

Similarly, I'm not finding any situation where the option
UIViewAnimationOptionLayoutSubviews makes any difference.

If anyone has actual examples to show, I'd appreciate it. Thx - m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
pantes anthropoi tou eidenai oregontai phusei
Among the 2007 MacTech Top 25, http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide, 2nd edition
http://www.tidbits.com/matt/default.html#applescriptthings
Take Control of Exploring & Customizing Snow Leopard
http://tinyurl.com/kufyy8
RubyFrontier! http://www.apeth.com/RubyFrontierDocs/default.html
TidBITS, Mac news and reviews since 1990, http://www.tidbits.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: NSNumber compare: Giving Unexpected Results

2010-09-08 Thread Darren Minifie
"After linking them my warning count went way down"

Chris this is a GREAT line haha.  Seriously though, treat all warnings as
errors.  Fix em' up, as they are usually the cause of strange behavior.

On Wed, Sep 8, 2010 at 2:28 PM, Chris Tracewell  wrote:

> After linking them my warning count went way down
___

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


why textFieldShouldBeginEditing is called twice in iOS4?

2010-09-08 Thread Rufat A. Abdullayev
Hi All

Sorry if that topic is already there in the mailing list (actually I could not 
find it)

I noted that textFieldShouldBeginEditing of an UITextField called twice in 
iOS4. This is probably bug in iOS4 b/c I have this event called one in prev 
versions of iOS

Though I found work-around (just setting and checking some BOOL variable to 
avoid code execution twice) this work-around is not so smart for me.

Are there any other smart solutions to avoid textFieldShouldBeginEditing 
execution twice in iOS4?

Cheers,
Rufat

___

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


First trials in Cocoa app

2010-09-08 Thread Remco Poelstra
Hi all,

I'm very new to Cocoa and I'm trying to build my first app after reading and 
doing tutorials.
I've a view with a UITextView on it and a button. When I press the button I 
want to call a third party C library which sends out and UDP packet searching 
for devices on the network. The responses of the devices are reported back with 
a callback that I've to supply.
In the callback I want to store the string information in a NSMutableString and 
then update the UITextView with that string.
I've a few problems: How can I pass a method from an object to the C library as 
callback? I'm currently using the NSViewController to define the 
method/callback.
If that's not possible, how can I define a function that can reach the objects 
of my application? The ViewController is stored in the ApplicationDeletegate, 
but I can't find any reference to that object.
I've defined the NSMutableString as a global in the viewcontroller header file, 
is that a good idea given the MVC design pattern?
Hope someone can get me started on this one.

Kind regards,

Remco Poelstra

___

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


Compress/decompress NSStrings or NSData

2010-09-08 Thread Rufat A. Abdullayev
Hello All

Sorry if that topic already is in the list. I just could not find it

I need simple solution for compressing/decompressing NSData or NSString using 
only standard tools and libs

I'm planning to compress JSON data on web server side and decompress it on 
iphone side

I googled for solution but nothing found really valuable


Thank you in advice,
Rufat


___

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: Lake Forest Cocoaheads meeting 9/8 - design patterns, Cocoa and other

2010-09-08 Thread Shawn Bakhtiar

Since were posting

"This month [they] are incredibly pleased to have @upsidedowndog, aka Niilo 
Tippler, talking about the development and release of his iOS app, The Home 
Gene-Splicing Kit."

http://www.cocoaheadsla.org/2010/09/next-meeting-september-9-2010/

Which sounds REAL REAL cool. I'm there :)



> Date: Tue, 7 Sep 2010 22:27:58 -0700
> From: scott_ellswo...@alumni.hmc.edu
> To: cocoa-dev@lists.apple.com; cocoaheads-disc...@lists.sourceforge.net; 
> cocoaheadslakefor...@googlegroups.com
> CC: 
> Subject: Lake Forest Cocoaheads meeting 9/8 - design patterns,Cocoa 
> and other
> 
> CocoaHeads Lake Forest will be meeting on the second Wednesday of the month.
>  We will be meeting at the Orange County Public Library (El Toro) community
> room, 24672 Raymond Way, Lake Forest, CA 92630
> 
> Please join us from 7pm to 9pm on Wednesday, 9/8.
> 
> We will be discussing common design patterns, Cocoa and otherwise.
> 
> Thanks go to O'Reilly Media for providing our door prize.
> 
> Bring your comments, your books, and your bugs, and we will leap right in.
> 
> As always, details and the upcoming meeting calendar can be found at the
> cocoaheads web site, www.cocoaheads.org.
> ___
> 
> 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/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.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: Compress/decompress NSStrings or NSData

2010-09-08 Thread Kyle Sluder
On Sep 8, 2010, at 2:28 AM, "Rufat A. Abdullayev"  wrote:

> Hello All
> 
> Sorry if that topic already is in the list. I just could not find it
> 
> I need simple solution for compressing/decompressing NSData or NSString using 
> only standard tools and libs
> 
> I'm planning to compress JSON data on web server side and decompress it on 
> iphone side

There isn't going to be a drop-in solution to your problem. The pieces are 
already there, but depending on your architecture you will need to connect them 
differently.

First I'd ask if you can use Content-Encoding: gzip on your HTTP connection. If 
so, NSURLDownload will take care of decompressing the data for you, and you 
need only worry about compressing the connection on the server side.

If you can't do this for some strange reason, or if the data you need to 
decompress is contained within your JSON data structure, zlib is included in 
iOS and you can use it to decompress your data.

Either way, when working with data, it is important to use NSData, *not* 
NSString.

Hopefully you are prepared to answer your own architectural questions and now 
have the pieces to implement your solution.

--Kyle Sluder___

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: First trials in Cocoa app

2010-09-08 Thread Dave Carrigan
You can't pass a method so you'll have to write a C function as your callback 
function. If the library allows you to pass a parameter to the function which 
will be in turn passed to the callback, then you would pass your view 
controller to the function and then call the method from the function. Your 
callback function would look something like

void callback(void* context)
{
  [(MyViewController*) handleCallback];
}

If the library doesn't let you provide a context then you're probably stuck 
with saving your VC's address in a global variable that your callback can use.  

Dave Carrigan
Seattle, WA

On Sep 8, 2010, at 1:21 AM, Remco Poelstra  wrote:

> Hi all,
> 
> I'm very new to Cocoa and I'm trying to build my first app after reading and 
> doing tutorials.
> I've a view with a UITextView on it and a button. When I press the button I 
> want to call a third party C library which sends out and UDP packet searching 
> for devices on the network. The responses of the devices are reported back 
> with a callback that I've to supply.
> In the callback I want to store the string information in a NSMutableString 
> and then update the UITextView with that string.
> I've a few problems: How can I pass a method from an object to the C library 
> as callback? I'm currently using the NSViewController to define the 
> method/callback.
> If that's not possible, how can I define a function that can reach the 
> objects of my application? The ViewController is stored in the 
> ApplicationDeletegate, but I can't find any reference to that object.
> I've defined the NSMutableString as a global in the viewcontroller header 
> file, is that a good idea given the MVC design pattern?
> Hope someone can get me started on this one.
> 
> Kind regards,
> 
> Remco Poelstra
> 
> ___
> 
> 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/dave%40rudedog.org
> 
> This email sent to d...@rudedog.org
___

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: First trials in Cocoa app

2010-09-08 Thread Jeff Laing
> > If that's not possible, how can I define a function that can reach the
> objects of my application? The ViewController is stored in the
> ApplicationDeletegate, but I can't find any reference to that object.

Ummm, is this really hard?

id MyAppDelegate = [[UIApplication sharedApplication] delegate];

Am I missing some subtlety here?
___

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: First trials in Cocoa app

2010-09-08 Thread Dave Carrigan

On Sep 8, 2010, at 9:40 PM, Jeff Laing wrote:

>>> If that's not possible, how can I define a function that can reach the
>> objects of my application? The ViewController is stored in the
>> ApplicationDeletegate, but I can't find any reference to that object.
> 
> Ummm, is this really hard?
> 
> id MyAppDelegate = [[UIApplication sharedApplication] delegate];
> 
> Am I missing some subtlety here?

No, I missed that part about his VC being stored in the app delegate. So, yeah, 
if he isn't able to pass context to the C library, he can easily get to the VC 
in that way rather than resorting to a 
global.___

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