Using the same typedef in multiple files

2011-03-13 Thread Luc Van Bogaert
Hi,

I have what I suppose is a very basic question about the use of a typedef'd 
enumerated data type. I want to use such a definition in multiple 
implementation files in my project, and I'm wondering what would be the best 
place to put the definition, so it is accessible from all these different files?

Thanks in advance.

-- 
Luc Van Bogaert
luc.van.boga...@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


Re: Using the same typedef in multiple files

2011-03-13 Thread Joanna Carter
> I have what I suppose is a very basic question about the use of a typedef'd 
> enumerated data type. I want to use such a definition in multiple 
> implementation files in my project, and I'm wondering what would be the best 
> place to put the definition, so it is accessible from all these different 
> files?

Simply place it in a separate header file, in the project, and #import that 
file into whichever implementation files you need to use it.

Joanna

--
Joanna Carter
Carter Consulting

___

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

Please do not post 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


Problem with NSPredicate in core data fetch request

2011-03-13 Thread Gideon King
I'm seeing a strange thing with a predicate. When I apply the predicate to a 
fetch request, it doesn't return any results, but when I do the fetch without 
the predicate and then use filteredArrayUsingPredicate to filter the results, 
it has the matching row that I expect.

Here are the results of a query without any predicate:

(gdb) po [[topic managedObjectContext] executeFetchRequest:request error:&error]
(
 (entity: Attachment; id: 0x1e095f40 

 ; data: {
displayName = "Import test map (picture)";
fileName = "Import test map.png";
nmObjectId = "72172A92-408D-41FA-AAB6-2132C4641AA5";
resource = "0x1e06b400 
";
topic = "0x1e0953b0 
";
}),
 (entity: Attachment; id: 0x1e08ee10 

 ; data: {
displayName = "example RSS feed opml";
fileName = "rss_sharpreader.opml";
nmObjectId = "DAC4868B-C8BA-41DB-9CC1-6F85193EC7B5";
resource = "0x36f98c0 
";
topic = "0x1e08dbd0 
";
}),
 (entity: Attachment; id: 0x1e091ee0 

 ; data: {
displayName = nil;
fileName = "import test mind map(novamind).png";
nmObjectId = "784A6E81-2EEF-42F5-8D08-05F6B58A8B55";
resource = "0x1e0fa240 
";
topic = "0x1e08d830 
";
})
)


And here's my predicate: 

(gdb) po predicate
nmObjectId == "784A6E81-2EEF-42F5-8D08-05F6B58A8B55"



If I apply that predicate to the results of my fetch request:

(gdb) po [results filteredArrayUsingPredicate:predicate]
(
 (entity: Attachment; id: 0x1e091ee0 

 ; data: {
displayName = nil;
fileName = "import test mind map(novamind).png";
nmObjectId = "784A6E81-2EEF-42F5-8D08-05F6B58A8B55";
resource = "0x1e0fa240 
";
topic = "0x1e08d830 
";
})
)


So all that's as expected, but if I set exactly that predicate on my fetch 
request, no results match:

(gdb) call (void)[request setPredicate:predicate]
(gdb) po [[topic managedObjectContext] executeFetchRequest:request error:&error]
(
)


I am really mystified by this - I can't understand why it would not work when 
applied to a fetch request, but would work when applied to the array of results.

Any suggestions?


Here's my code which returns 0 rows:

NSString *attachmentID = [[url path] lastPathComponent];

NSFetchRequest *request = [[NSFetchRequest alloc] init];
NSError *error = nil;
NSEntityDescription *entity = [NSEntityDescription 
entityForName:kNMAttachmentEntityKey inManagedObjectContext:[topic 
managedObjectContext]];

[request setEntity:entity];
NSPredicate *predicate = [NSPredicate predicateWithFormat:@"nmObjectId 
== %@", attachmentID];
[request setPredicate:predicate];

NSArray *results = [[topic managedObjectContext] 
executeFetchRequest:request error:&error];
[request release];






Regards

Gideon






___

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

Please do not post 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: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-13 Thread Matt Neuburg
On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen  said:
>The setup has a MPMoviePlayerController instance that is playing a local audio 
>file. There is also a UIWebView whose HTML contains an  tag. When the 
>play control is tapped, I see a MPMoviePlayerPlaybackDidFinishNotification 
>notification with a reason of MPMovieFinishReasonPlaybackEnded, then gdb shows 
>the assertion failure and exception and dumps the backtrace (below).

What was the outcome on this? Thx - m.

--
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

Please do not post 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


kqueue and kevent

2011-03-13 Thread Abhinav Tyagi
Hi,

I have used kqueue and kevents for event triggering. However i am not sure
if it is possible to send events to a kqueue? Googling didnt  helped. I was
thinking as its "kernel" que and kernel notifies. Does it mean that users
can not send events
to a queue other than signals?

Abhi
___

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

Please do not post 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: kqueue and kevent

2011-03-13 Thread Dave Keck
> I have used kqueue and kevents for event triggering. However i am not sure
> if it is possible to send events to a kqueue? Googling didnt  helped. I was
> thinking as its "kernel" que and kernel notifies. Does it mean that users
> can not send events
> to a queue other than signals?

The kernel is the only entity that can generate events. You can easily
cause an event to be generated though by, for example, writing to a
pipe for which the respective read end has a EVFILT_READ filter
monitoring it.

BTW, this question is better suited for darwin-dev.
___

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

Please do not post 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: Core Data Intermittently Blocked Over AFP? (Steve Steinitz)

2011-03-13 Thread Steve Steinitz

I wrote:


The machines appear to become "blocked", i.e. fetches that usually
take a few hundredths of a second begin take 15 to 40.  It happens
after another machine saves to the database.  Only relaunching the App
fixes it - until another machine saves.


Increasing SQLite's cache_size solved the problem.

___

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

Please do not post 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


Animating window content border

2011-03-13 Thread Quincey Morris
I don't seem to be able to find a way of animating a window's bottom edge 
content border size ('contentBorderThicknessForEdge:') when resizing a window. 

Specifically, I have a window with a normal bottom border of (say) 20 points. I 
want to increase the window height by (say) 30 points, and at the same time 
increase the bottom border by the same amount. The catch is that I would like 
both these changes to animate smoothly.

I thought -[NSWindow setFrame:display:YES animate:YES] would allow me to change 
the bottom border in delegate method 'window:willResize:toSize:', but that 
doesn't get called during the animation. I don't think I can use [window 
animator] to do it, because it's not a KVC compliant property I'm changing.

Am I missing an obvious way of getting the border animation effect?


___

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

Please do not post 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: Assertion failure in -[MPMoviePlayerControllerNew _moviePlayerDidBecomeActiveNotification:]

2011-03-13 Thread Steve Christensen
On Mar 13, 2011, at 11:05 AM, Matt Neuburg wrote:

> On Tue, 08 Mar 2011 17:01:33 -0800, Steve Christensen  said:
>> The setup has a MPMoviePlayerController instance that is playing a local 
>> audio file. There is also a UIWebView whose HTML contains an  tag. 
>> When the play control is tapped, I see a 
>> MPMoviePlayerPlaybackDidFinishNotification notification with a reason of 
>> MPMovieFinishReasonPlaybackEnded, then gdb shows the assertion failure and 
>> exception and dumps the backtrace (below).
> 
> What was the outcome on this? Thx - m.

Well, I'm still not sure of the exact "why" for the assertion, but I figured 
out what I was doing that it didn't like.

My MPMoviePlayerPlaybackDidFinishNotification handler is designed to queue up 
another audio file to play after the current one finishes. I NSLog'd the player 
initialization and all the notification handlers so I could watch the process 
more in realtime, and found that the next audio file was loaded and then very 
soon after got a MPMoviePlayerPlaybackDidFinishNotification. A bit after that 
is when the assertion failure and exception come along.

After playing with it for a bit, I found that the player's loadState property 
is set to (MPMovieLoadStatePlayable | MPMovieLoadStatePlaythroughOK) when 
playback finishes normally or MPMovieLoadStateUnknown when it's stopped because 
another player instance has grabbed control. I've added a test that prevents 
the queueing if the loadState is MPMovieLoadStateUnknown and that seems to work 
just fine.

I may have missed something in the docs that talks about this situation, but 
it's also probably true that I'm not using the player class in the most 
"standard" manner.

steve

___

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

Please do not post 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


SDK 10.6 with Target 10.5

2011-03-13 Thread Leonardo
Hi,
on Xcode 4.0, I have noticed, just accidentally, that when the Base SDK is
set to Mac OS X 10.6 and the deployment target to 10.5, I don't get any
alert about the use of not-available-APIs. In facts I have used
[NSNumberFormatter localizedStringFromNumber:...
which is available on 10.6 and later, and I didn't get any advise.
Instead if I set Base SDK to 10.5 I properly get a yellow alert issue.
Is that correct?
Or should I never user this combination because it makes no sense?

With this I send my best congratulations to the engineers who worked on the
new Xcode 4.0. It's a great improvement.

Last, which API should I use instead of localizedStringFromNumber when
compiling for Mac OS X 10.5?


Regards
-- Leonardo


___

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

Please do not post 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: kqueue and kevent

2011-03-13 Thread Jeffrey Walton
On Sun, Mar 13, 2011 at 3:15 PM, Dave Keck  wrote:
>> I have used kqueue and kevents for event triggering. However i am not sure
>> if it is possible to send events to a kqueue? Googling didnt  helped. I was
>> thinking as its "kernel" que and kernel notifies. Does it mean that users
>> can not send events
>> to a queue other than signals?
>
> The kernel is the only entity that can generate events. You can easily
> cause an event to be generated though by, for example, writing to a
> pipe for which the respective read end has a EVFILT_READ filter
> monitoring it.
>
Be careful of this sort of functionality, especially when an adversary
controls the event. In essence, the event should be consider
"untrusted user input".

Jeff
___

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

Please do not post 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: kqueue and kevent

2011-03-13 Thread Kyle Sluder
On Sun, Mar 13, 2011 at 4:48 PM, Jeffrey Walton  wrote:
> Be careful of this sort of functionality, especially when an adversary
> controls the event. In essence, the event should be consider
> "untrusted user input".

Unless I'm missing something, I don't see how this is any more
dangerous than calling select(2).

I mean, yes, if someone writes to a pipe, and you read from it, then
you'll read what they wrote. The same caution applies to any external
data: sockets, files on disk, shared memory…

--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: SDK 10.6 with Target 10.5

2011-03-13 Thread Chris Hanson
On Mar 13, 2011, at 4:19 PM, Leonardo wrote:

> on Xcode 4.0, I have noticed, just accidentally, that when the Base SDK is
> set to Mac OS X 10.6 and the deployment target to 10.5, I don't get any
> alert about the use of not-available-APIs.

This is how the Base SDK and Deployment Target build settings have worked since 
their introduction.  The availability macros to which they’re an input don’t 
issue any warnings for new API that isn’t present on an older OS because that 
would potentially obscure other warnings.

Their intent is to enable you to write software that takes advantage of 
features of the most recent operating system while still being able to write 
code that runs on the latest operating system; you’re using them correctly.  
You simply need to be aware of when you’re using newer-OS features and wrap 
them in runtime checks.

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


CALayer drawing efficiency

2011-03-13 Thread Martin Hewitson
Dear list,

I'm working on an app which will show a grid of CALayers (a few hundred in 
total), each layer is constrained so that its size scales up and down with the 
super layer. The super layer is then hosted by a view and resizes with the 
view. Each of the grid layers then has sublayers showing text. The problem is 
that resizing the main window is very slow due to the resizing of all the small 
layers. I was wondering if anyone has any hints or tips for dealing with large 
numbers of layers and making it faster to draw?

Many thanks,

Martin




Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

Please do not post 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