Re: Representation of strings with special chars

2011-08-25 Thread Andreas Grosam

On Aug 26, 2011, at 2:02 AM, Glenn L. Austin wrote:

> 
> On Aug 25, 2011, at 2:03 PM, Alexander Reichstadt wrote:
> 
>> Hi,
>> 
>> Thank you for your many responses.
>> 
>>>  const char *cstr = [s UTF8String];
>>>  mysql_stmt_prepare(myStatement, cstr, strlen(cstr));
>> 
>> 
>> This fixed the bug. 
>> 
>> Alexander
> 
> Just in case the string has a NULL character, I'd use:

This is an interesting point. However, I would first consult the MySQL 
documentation how it handles UTF-8. 

Unicode NULL (U+) isn't the only Unicode scalar value which should be 
rejected by a database engine when encountered in the command string. For 
instance, any Unicode noncharacter and possibly control characters (U+0001 to 
U+001F) should not be accepted. It may allow Unicode NULL in string data, 
though, but usually not.

Only if the database engine lacks proper handling of Unicode sequences itself 
(which I don't think is true), and which in turn may cause security issues, I 
would preprocess the input and reject it as a whole when something is bogus.




> 
> NSData *data = [s dataUsingEncoding:NSUTF8StringEncoding];
> mysql_stmt_prepare(myStatement, [data bytes], [data length]);
> 
> Of course, if you *did* have a NULL character in your string, then the 
> mysql_stmt_prepare would probably barf at some point.  You could use the 
> comparison of strlen() and [data length] to make sure that you're not passing 
> a NULL.
> 
> -- 
> Glenn L. Austin, Computer Wizard and Race Car Driver <><
> 
> 
___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Mark Munz
The description of what you're trying to do is a bit vague, but
couldn't you just create an NSToolbarItem with a custom view? You
might need to do a few tweaks if it needs to resize with the window,
but that sure seems easier than trying to circumvent the framework as
you are describing. You'd be able to do virtually anything you want in
that custom view and you wouldn't be necessarily fighting the
framework.

Alternatively, you could just create a custom view that is placed at
the top of your content view of the window and just ignore the
NSToolbar class completely.


On Thu, Aug 25, 2011 at 9:46 PM, Indragie Karunaratne
 wrote:
> Is there any other way to do this aside from what I'm doing right now? As far 
> as I know, I have two choices:
>
> a) Use this method and risk something breaking
> b) Write an NSToolbar clone
>
> I know the risks, but if I could get this to pass through Mac App Store 
> submission then I'd rather deal with possibility of something breaking later 
> on that than to rewrite NSToolbar. The one last thing I can think of is to 
> use the ObjC runtime to retain the original implementation, swizzle hitTest: 
> and check whether my view is under the cursor, and if not, just call the 
> original implementation. However, method swizzling always feels like a dirty 
> workaround so I'm not sure if it would be much better than this (and if it 
> would be acceptable in the MAS).
>
> On 2011-08-25, at 10:40 PM, Quincey Morris wrote:
>
>> Ah, well, yes, if IB doesn't expose the class you need, that makes 
>> subclassing impractical. But in that case, replacing the NSToolbarView 
>> method seems even more undesirable.
>>
>>
>> On Aug 25, 2011, at 20:55 , Indragie Karunaratne wrote:
>>
>>> I'm not sure how I would get NSToolbar to use my subclass of NSToolbarView. 
>>> I can't set the class of the toolbar *view* itself in IB (nor 
>>> programatically, as far as I know), because NSToolbarView is a private 
>>> class that NSToolbar uses to implement the UI. I can of course change the 
>>> class of the NSToolbar object itself to a subclass, but this wouldn't help 
>>> me much as there is no public NSToolbar method that allows me to change the 
>>> class of its view.
>>
>>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post 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/unmarked%40gmail.com
>
> This email sent to unmar...@gmail.com
>



-- 
Mark Munz
unmarked software
http://www.unmarked.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: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread Jens Alfke

On Aug 25, 2011, at 10:37 PM, David Dengg wrote:

> I checked the file by hand and found one corrupt  song. The "Name" and 
> "Location" were just garbage strings. I deleted the entry and its fine now.

Oh, interesting — sounds like iTunes isn’t properly escaping some of the 
characters in the name when it writes the file. (iTunes itself never reads that 
file, so it would be pretty easy for Apple’s testers to overlook this.)

> I send the customer the file without the malformed entry to replace hers. But 
> the file gets written a lot so the malformed entry has to be somewhere else. 
> I suggested searching for the entry and deleting it in iTunes. I hope that 
> will prevent that entry form getting written again.

You should file a bug report with Apple, too, since this definitely sounds like 
an iTunes bug.  Attach the library file.

If you want to be able to work around this in your app, you might look at a 
utility called ‘tidy’ — it’s available both as a C library (libTidy) and a 
command-line tool. It reads malformed HTML/XML and converts it into correct 
form that a strict parser can read. It’s used a lot by RSS feed readers. It 
might or might not be able to fix this particular problem, but if it does, it’d 
be fairly easy to embed the tool in your app bundle and call it (and slightly 
more work to call the C library, from what I remember of it.)

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post 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: Persistant reference to file that is not a path?

2011-08-25 Thread Jens Alfke

On Aug 25, 2011, at 9:18 PM, Joar Wingfors wrote:

> Prior to Mac OS X 10.6 you can use "aliases", which have been around since 
> before Mac OS X:
> 
>   
> 

The Alias Manager is a bit awkward to use from Cocoa (you have to translate 
between FSRefs and paths) but I recall that there are a couple of Objective-C 
wrappers people have written over the years. It’d be worth spending a few 
minutes searching.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post 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: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread David Dengg
Thanks I tried that but NSPropertyListSerialization just says the same thing: 
its a malformed plist.
I checked the file by hand and found one corrupt  song. The "Name" and 
"Location" were just garbage strings. I deleted the entry and its fine now.
I send the customer the file without the malformed entry to replace hers. But 
the file gets written a lot so the malformed entry has to be somewhere else. I 
suggested searching for the entry and deleting it in iTunes. I hope that will 
prevent that entry form getting written again.

Thank you for your help.

Am 25.08.2011 um 08:22 schrieb Jens Alfke:

> 
> On Aug 24, 2011, at 4:02 AM, David Dengg wrote:
> 
>> NSDictionary * xmldict = [NSDictionary 
>> dictionaryWithContentsOfFile:libraryXML];
> 
> Try loading it using NSPropertyListSerialization, which will return an 
> NSError telling you what went wrong.
> 
> —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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Is there any other way to do this aside from what I'm doing right now? As far 
as I know, I have two choices:

a) Use this method and risk something breaking
b) Write an NSToolbar clone

I know the risks, but if I could get this to pass through Mac App Store 
submission then I'd rather deal with possibility of something breaking later on 
that than to rewrite NSToolbar. The one last thing I can think of is to use the 
ObjC runtime to retain the original implementation, swizzle hitTest: and check 
whether my view is under the cursor, and if not, just call the original 
implementation. However, method swizzling always feels like a dirty workaround 
so I'm not sure if it would be much better than this (and if it would be 
acceptable in the MAS).

On 2011-08-25, at 10:40 PM, Quincey Morris wrote:

> Ah, well, yes, if IB doesn't expose the class you need, that makes 
> subclassing impractical. But in that case, replacing the NSToolbarView method 
> seems even more undesirable.
> 
> 
> On Aug 25, 2011, at 20:55 , Indragie Karunaratne wrote:
> 
>> I'm not sure how I would get NSToolbar to use my subclass of NSToolbarView. 
>> I can't set the class of the toolbar *view* itself in IB (nor 
>> programatically, as far as I know), because NSToolbarView is a private class 
>> that NSToolbar uses to implement the UI. I can of course change the class of 
>> the NSToolbar object itself to a subclass, but this wouldn't help me much as 
>> there is no public NSToolbar method that allows me to change the class of 
>> its view. 
> 
> 

___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Quincey Morris
Ah, well, yes, if IB doesn't expose the class you need, that makes subclassing 
impractical. But in that case, replacing the NSToolbarView method seems even 
more undesirable.


On Aug 25, 2011, at 20:55 , Indragie Karunaratne wrote:

> I'm not sure how I would get NSToolbar to use my subclass of NSToolbarView. I 
> can't set the class of the toolbar *view* itself in IB (nor programatically, 
> as far as I know), because NSToolbarView is a private class that NSToolbar 
> uses to implement the UI. I can of course change the class of the NSToolbar 
> object itself to a subclass, but this wouldn't help me much as there is no 
> public NSToolbar method that allows me to change the class of its view. 


___

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

Please do not post 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: Persistant reference to file that is not a path?

2011-08-25 Thread Ron Fleckner

On 26/08/2011, at 2:18 PM, Joar Wingfors wrote:

> 
> On 25 aug 2011, at 21:15, Ron Fleckner wrote:
> 
>> Oh I see now that file reference URLs and bookmarks are 10.6 only.  I'm 
>> making a tool for musicians, most of whom aren't too well off and so I 
>> target 10.5.  Might just have to stick with paths.  Thanks anyway.
> 
> 
> Prior to Mac OS X 10.6 you can use "aliases", which have been around since 
> before Mac OS X:
> 
>   
> 
> 
> j o a r
> 
> 

Ah yes, I've experienced the behaviour I want from before OS X, so I was hoping 
that it was still around.  Thanks very much.

Ron

___

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

Please do not post 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: Persistant reference to file that is not a path?

2011-08-25 Thread Joar Wingfors

On 25 aug 2011, at 21:15, Ron Fleckner wrote:

> Oh I see now that file reference URLs and bookmarks are 10.6 only.  I'm 
> making a tool for musicians, most of whom aren't too well off and so I target 
> 10.5.  Might just have to stick with paths.  Thanks anyway.


Prior to Mac OS X 10.6 you can use "aliases", which have been around since 
before Mac OS X:




j o a r


___

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

Please do not post 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: Persistant reference to file that is not a path?

2011-08-25 Thread Ron Fleckner
Oh I see now that file reference URLs and bookmarks are 10.6 only.  I'm making 
a tool for musicians, most of whom aren't too well off and so I target 10.5.  
Might just have to stick with paths.  Thanks anyway.

Ron

On 26/08/2011, at 1:46 PM, Josh Abernathy wrote:

> Check out file reference URLs and bookmarks: 
> http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3-SW5
> 
> 
> On Aug 25, 2011, at 11:37 PM, Ron Fleckner wrote:
> 
>> Hello all,
>> 
>> not even sure where to start looking for this, but is there a way to have a 
>> reference to a file so that one can open it even after it has moved?  That 
>> is, without having to save the path as the key to the file.
>> 
>> I'd like to be able to allow the user to move files if s/he wants and still 
>> have my app find them.
>> 
>> Thanks for any pointers,
>> 
>> Ron
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/joshaber%40gmail.com
>> 
>> This email sent to josha...@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: Persistant reference to file that is not a path?

2011-08-25 Thread Ron Fleckner
Looks like just the thing, thanks v much Josh,

Ron

On 26/08/2011, at 1:46 PM, Josh Abernathy wrote:

> Check out file reference URLs and bookmarks: 
> http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3-SW5
> 
> 
> On Aug 25, 2011, at 11:37 PM, Ron Fleckner wrote:
> 
>> Hello all,
>> 
>> not even sure where to start looking for this, but is there a way to have a 
>> reference to a file so that one can open it even after it has moved?  That 
>> is, without having to save the path as the key to the file.
>> 
>> I'd like to be able to allow the user to move files if s/he wants and still 
>> have my app find them.
>> 
>> Thanks for any pointers,
>> 
>> Ron
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/joshaber%40gmail.com
>> 
>> This email sent to josha...@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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I'm not sure how I would get NSToolbar to use my subclass of NSToolbarView. I 
can't set the class of the toolbar *view* itself in IB (nor programatically, as 
far as I know), because NSToolbarView is a private class that NSToolbar uses to 
implement the UI. I can of course change the class of the NSToolbar object 
itself to a subclass, but this wouldn't help me much as there is no public 
NSToolbar method that allows me to change the class of its view. 

On 2011-08-25, at 9:35 PM, Quincey Morris wrote:

> On Aug 25, 2011, at 19:48 , Indragie Karunaratne wrote:
> 
>> Based on Corbin's tip, I overrode -hitTest: on NSToolbarView to call 
>> NSView's implementation instead and suddenly everything works. I expected 
>> something to break in NSToolbarView from doing this, but I've tested pretty 
>> thoroughly and there seem to be no issues. I don't know exactly how 
>> dangerous this is because I don't know what NSToolbarView's implementation 
>> of hitTest: is, but so far no issues.
>> 
>> @interface NSToolbarView : NSView
>> @end
>> 
>> @interface NSToolbarView (RightMouse)
>> @end
>> 
>> @implementation NSToolbarView (RightMouse)
>> 
>> - (void)hitTest:(NSPoint)aPoint
>> {
>>[super hitTest:aPoint];
>> }
>> 
>> @end
>> 
>> That said, would my application get rejected from the Mac App Store for 
>> overriding *public* methods of a *private* class via a category? I could 
>> achieve the same result by checking the class and swizzling NSView's 
>> implementation of -hitTest:, but if I could get away with this it would be a 
>> lot easier (and cleaner).
> 
> I think it's a misstatement to say that you "overrode" 'hitTest:'. In Obj-C, 
> overriding conventionally means supplying a subclass implementation that 
> takes the place of the superclass implementation. What you actually did was 
> to *replace* 'hitTest:'. However, if you want to treat this as a quibble over 
> usage, that's fine.
> 
> The real problem with your approach is that it's a bit dangerous. You don't 
> *know* that NSToolbarView's own override of 'hitTest:' isn't itself 
> implemented in a category. If it is, then you are competing for the role of 
> replacer, and you might lose.
> 
> A better approach (if it's possible -- which it may not be if IB makes things 
> hard for you) is to subclass NSToolbarView, and change the toolbar's class in 
> IB after adding it to the window. (If you're creating the toolbar entirely 
> programmatically, it's more straightforward, of course.) Then you can 
> *really* override 'hitTest:', in the normal subclass way.
> 
> Finally, although you haven't seen any side effects of throwing away the 
> NSToolbarView implementation of 'hitTest:', which is what the above code 
> does, you don't know what else you might have broken. It would be safer to 
> put code in your override to test directly for your custom toolbar item view, 
> and send the message directly to your view if it's the one under the mouse. 
> If not, call the NSToolbarView method, not the NSToolbarView super method. 
> Again, this is easiest to do if you're actually using a NSToolbarView 
> subclass.
> 
> 

___

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

Please do not post 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: Persistant reference to file that is not a path?

2011-08-25 Thread Josh Abernathy
Check out file reference URLs and bookmarks: 
http://developer.apple.com/library/mac/#documentation/FileManagement/Conceptual/FileSystemProgrammingGUide/AccessingFilesandDirectories/AccessingFilesandDirectories.html#//apple_ref/doc/uid/TP40010672-CH3-SW5


On Aug 25, 2011, at 11:37 PM, Ron Fleckner wrote:

> Hello all,
> 
> not even sure where to start looking for this, but is there a way to have a 
> reference to a file so that one can open it even after it has moved?  That 
> is, without having to save the path as the key to the file.
> 
> I'd like to be able to allow the user to move files if s/he wants and still 
> have my app find them.
> 
> Thanks for any pointers,
> 
> Ron
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/joshaber%40gmail.com
> 
> This email sent to josha...@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


Persistant reference to file that is not a path?

2011-08-25 Thread Ron Fleckner
Hello all,

not even sure where to start looking for this, but is there a way to have a 
reference to a file so that one can open it even after it has moved?  That is, 
without having to save the path as the key to the file.

I'd like to be able to allow the user to move files if s/he wants and still 
have my app find them.

Thanks for any pointers,

Ron


___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Quincey Morris
On Aug 25, 2011, at 19:48 , Indragie Karunaratne wrote:

> Based on Corbin's tip, I overrode -hitTest: on NSToolbarView to call NSView's 
> implementation instead and suddenly everything works. I expected something to 
> break in NSToolbarView from doing this, but I've tested pretty thoroughly and 
> there seem to be no issues. I don't know exactly how dangerous this is 
> because I don't know what NSToolbarView's implementation of hitTest: is, but 
> so far no issues.
> 
> @interface NSToolbarView : NSView
> @end
> 
> @interface NSToolbarView (RightMouse)
> @end
> 
> @implementation NSToolbarView (RightMouse)
> 
> - (void)hitTest:(NSPoint)aPoint
> {
>[super hitTest:aPoint];
> }
> 
> @end
> 
> That said, would my application get rejected from the Mac App Store for 
> overriding *public* methods of a *private* class via a category? I could 
> achieve the same result by checking the class and swizzling NSView's 
> implementation of -hitTest:, but if I could get away with this it would be a 
> lot easier (and cleaner).

I think it's a misstatement to say that you "overrode" 'hitTest:'. In Obj-C, 
overriding conventionally means supplying a subclass implementation that takes 
the place of the superclass implementation. What you actually did was to 
*replace* 'hitTest:'. However, if you want to treat this as a quibble over 
usage, that's fine.

The real problem with your approach is that it's a bit dangerous. You don't 
*know* that NSToolbarView's own override of 'hitTest:' isn't itself implemented 
in a category. If it is, then you are competing for the role of replacer, and 
you might lose.

A better approach (if it's possible -- which it may not be if IB makes things 
hard for you) is to subclass NSToolbarView, and change the toolbar's class in 
IB after adding it to the window. (If you're creating the toolbar entirely 
programmatically, it's more straightforward, of course.) Then you can *really* 
override 'hitTest:', in the normal subclass way.

Finally, although you haven't seen any side effects of throwing away the 
NSToolbarView implementation of 'hitTest:', which is what the above code does, 
you don't know what else you might have broken. It would be safer to put code 
in your override to test directly for your custom toolbar item view, and send 
the message directly to your view if it's the one under the mouse. If not, call 
the NSToolbarView method, not the NSToolbarView super method. Again, this is 
easiest to do if you're actually using a NSToolbarView subclass.


___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Based on Corbin's tip, I overrode -hitTest: on NSToolbarView to call NSView's 
implementation instead and suddenly everything works. I expected something to 
break in NSToolbarView from doing this, but I've tested pretty thoroughly and 
there seem to be no issues. I don't know exactly how dangerous this is because 
I don't know what NSToolbarView's implementation of hitTest: is, but so far no 
issues.

@interface NSToolbarView : NSView
@end

@interface NSToolbarView (RightMouse)
@end

@implementation NSToolbarView (RightMouse)

- (void)hitTest:(NSPoint)aPoint
{
[super hitTest:aPoint];
}

@end

That said, would my application get rejected from the Mac App Store for 
overriding *public* methods of a *private* class via a category? I could 
achieve the same result by checking the class and swizzling NSView's 
implementation of -hitTest:, but if I could get away with this it would be a 
lot easier (and cleaner).

On 2011-08-25, at 4:52 PM, Raleigh Ledet wrote:

> A contextual menu in a toolbar? Lets think about this for a moment.
> 
> A) such a command would be hard to discover. Your customers have other ways 
> to activate the same commands right? If not, why not use a popup button here?
> B) I assume that's because you have an action tied to single click…. why not 
> look for a click and hold, then pop-up a menu a' la Safari's back/forward  
> tool bar buttons. Oh! and users have an alternate way to get to these actions 
> / settings right?
> 
> -raleigh
> 
> On Aug 25, 2011, at 3:39 PM, Indragie Karunaratne wrote:
> 
>> I just need to present a contextual menu from my custom view toolbar item, 
>> but NSToolbarView is not passing the right mouse events down, so 
>> -menuForEvent: is never called.
>> 
>> On 2011-08-25, at 4:27 PM, Corbin Dunn wrote:
>> 
>>> ToolbarView overrides hitTest; to do some magic; that is probably the 
>>> source of your problem.
>>> 
>>> What are you trying to do?
>>> 
>>> corbin
>>> 
>>> On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:
>>> 
 Just realized something interesting, and remembered a key detail that I 
 forgot to mention. The view in question is a custom view inside the 
 toolbar of the window. The NSToolbar by default has a contextual menu that 
 appears when the customizable property is set to YES. However, even though 
 there is no menu when customizable is set to NO, I suspected that it was 
 still trapping right mouse events. So I used a category on the private 
 NSToolbarView class that manages the UI for NSToolbar to check whether it 
 was receiving the events:
 
 @interface NSToolbarView : NSView
 @end
 
 @interface NSToolbarView (RightMouse)
 @end
 
 @implementation NSToolbarView (RightMouse)
 
 - (void)rightMouseDown:(NSEvent*)theEvent
 {
 NSLog(@"right mouse");
 }
 
 @end
 
 And as expected, the method is called. This leaves me wondering how the 
 toolbar view can receive the events when my own view inside the toolbar 
 can not (as the event would have to be forwarded up the responder chain to 
 the toolbar in order for it to receive it). 
 
 On 2011-08-25, at 1:58 PM, Ken Thomases wrote:
 
> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>  wrote:
> 
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called.
> 
> Any chance you simply have a typo or misspelling in your method signature?
> 
> -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:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com
>>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
>> 
>> This email sent to le...@apple.com
> 

___

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

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

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

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


Re: validateMenuItem Not Called for Undo: Menu Item?

2011-08-25 Thread Vik Rubenfeld
Thank you very much, Quincey. That fixed it.


On Aug 25, 2011, at 7:00 PM, Quincey Morris wrote:

> Configuring the Undo menu item with action 'undo:' tells the frameworks that 
> this is *the* undo menu item, so it becomes one element of a standard undo UI 
> mechanism implemented in NSWindow. Under these circumstances, the menu item 
> (and especially its validation) isn't yours to mess with. The proper way to 
> provide an undo manager object to this mechanism is to use the 
> 'windowWillReturnUndoManager:' window delegate method.

___

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

Please do not post 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: validateMenuItem Not Called for Undo: Menu Item?

2011-08-25 Thread Quincey Morris
On Aug 25, 2011, at 18:17 , Vik Rubenfeld wrote:

> Going through these requirements, it appears my app is fulfulling all of 
> them. My undo menu item has its Sent Action set to undo: in First Responder.  
> First Responder at the time of the anomaly is an NSDocument called 
> myQuestionnaireEditor. This can be verified because the Cut and Paste menu 
> items also have their Sent Actions set to First Responder, and 
> validateMenuItem method in myQuestionnaireEditor is called for them as 
> expected.
> 
> myQuestionnaireEditor does have a method for implementing undo:
> 
> -(IBAction)undo:(id) sender {
>[[self undoManager] undo];
> }
> 
> myQuestionnaireEditor does implement validateMenuItem:
> 
> - (BOOL)validateMenuItem:(NSMenuItem *)menuItem {
> 
>NSLog(@"validateMenuItem - %@", [menuItem title]);
>BOOL returnValue = NO;
> 
>if ([menuItem action] == @selector(undo:)) {
>return [[self undoManager] canUndo];
>}
> 
>{..}
>return [super validateMenuItem:menuItem];
> }

Configuring the Undo menu item with action 'undo:' tells the frameworks that 
this is *the* undo menu item, so it becomes one element of a standard undo UI 
mechanism implemented in NSWindow. Under these circumstances, the menu item 
(and especially its validation) isn't yours to mess with. The proper way to 
provide an undo manager object to this mechanism is to use the 
'windowWillReturnUndoManager:' window delegate method.

OTOH, if you want to take implement the entire mechanism yourself, then you 
should use a custom action such as 'myUndo:' for the Undo menu item. That 
means, as far as the frameworks know, you app doesn't have (standard) undo, and 
the action/validation should work in the normal way.

If the above code really is your implementation, then the former technique is 
probably the correct one. (It will, for example, allow you to set Undo action 
names normally, so you won't have to modify the menu item times directly 
yourself). If your code needs to do something more complicated than you're 
showing here, then use the latter technique, and you're on your own for 
implementing every detail of the UI.


___

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

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


validateMenuItem Not Called for Undo: Menu Item?

2011-08-25 Thread Vik Rubenfeld
My validateMenuItem method is never being called for my undo: and redo: menu 
items, leaving them permanently disabled. 

From Apple's doc, "Enabling Menu Items": 
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html#//apple_ref/doc/uid/2261-BAJBFGED

> If the menu item’s target is not set (that is, if it is nil—typically if the 
> menu item is connected to First Responder) and the NSMenu object is not a 
> contextual menu, then NSMenu uses the responder chain (described in About the 
> Responder Chain) to determine the target. If there is no object in the 
> responder chain that implements the item’s action, the item is disabled.
> 
> If there is an object in the responder chain that implements the item’s 
> action, NSMenu then checks to see if that object implements the 
> validateMenuItem: or validateUserInterfaceItem: method. If it does not, then 
> the menu item is enabled. If it does, then the enabled status of the menu 
> item is determined by the return value of the method.

Going through these requirements, it appears my app is fulfulling all of them. 
My undo menu item has its Sent Action set to undo: in First Responder.  First 
Responder at the time of the anomaly is an NSDocument called 
myQuestionnaireEditor. This can be verified because the Cut and Paste menu 
items also have their Sent Actions set to First Responder, and validateMenuItem 
method in myQuestionnaireEditor is called for them as expected.

myQuestionnaireEditor does have a method for implementing undo:

-(IBAction)undo:(id) sender {
[[self undoManager] undo];
}

myQuestionnaireEditor does implement validateMenuItem:

- (BOOL)validateMenuItem:(NSMenuItem *)menuItem {

NSLog(@"validateMenuItem - %@", [menuItem title]);
BOOL returnValue = NO;

if ([menuItem action] == @selector(undo:)) {
return [[self undoManager] canUndo];
}

{..}
return [super validateMenuItem:menuItem];
}

The NSLog output shows that validateMenuItem **is never called** for the undo: 
menu item.

Yet is *is called* for copy:, cut:, paste:, etc.

How can I fix this?

Thanks very much in advance to all for any 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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Autoscrolling when dragging?

2011-08-25 Thread Graham Cox

On 26/08/2011, at 10:48 AM, Rick Mann wrote:

> Hmm. I think I disagree on this point. Two timers makes it very clear what's 
> going on in the code, and I don't have to worry about the math. Moreover, I 
> don't enable a rapid timer until it's actually needed.


0.1 second (or so) is definitely not "rapid". Math? It's one comparison. An 
alternative is to set the timer period to the initial delay and then change its 
rate when the callback is first called.

Anyway, it's your code, do as you like - I just dislike cascading timers like 
that, it seems inelegant. Maybe it's my hardware background - an equivalent 
approach in hardware would always look like a kludge (and be costly - every 
chip saved is well, a chip saved).

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

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


Re: Autoscrolling when dragging?

2011-08-25 Thread Rick Mann

On Aug 25, 2011, at 17:42 , Graham Cox wrote:

> This is no more complicated than having two timers, and will likely be easier 
> to manage - I've found that adding too many timers to a run loop can end up 
> hitting performance, but even if it doesn't, it just seems wrong when one 
> will do.

Hmm. I think I disagree on this point. Two timers makes it very clear what's 
going on in the code, and I don't have to worry about the math. Moreover, I 
don't enable a rapid timer until it's actually needed.

In any case, I did it with two timers, and it all seems to work well. The first 
timer only exists until it fires (or is invalidated because the user left the 
autoscroll area before it fired).

-- 
Rick

___

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

Please do not post 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: Autoscrolling when dragging?

2011-08-25 Thread Graham Cox

On 19/08/2011, at 8:49 AM, Rick Mann wrote:

> If the user enters the auto-sroll area, start a timer
> If they leave the area, invalidate the timer
> If the timer fires, then start another, repeating timer that just adjusts the 
> contentOffset of the scroll view in the appropriate direction
> If they let go, or leave the auto-scroll area, invalidate the second timer
> 
> Am I missing anything?


You don't need two timers. (You never need two timers for one job, which 
applies to another similar idea I saw here recently, though I forget the 
context).

The first timer is fine - set its rate to something like 0.1 second. In its 
callback, decide whether and by how much to scroll. If you want to have a delay 
before the scrolling starts, just measure out the required delay and do nothing 
until it expires.

This is no more complicated than having two timers, and will likely be easier 
to manage - I've found that adding too many timers to a run loop can end up 
hitting performance, but even if it doesn't, it just seems wrong when one will 
do.

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

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


Re: Autoscrolling when dragging?

2011-08-25 Thread Matt Neuburg
On Thu, 18 Aug 2011 15:49:29 -0700, Rick Mann  said:
>Hi,
>
>I'm implementing drag & drop functionality on one of my views, and I'd like to 
>autoscroll the containing view when the user lingers near an edge.

My book, for which the code examples are downloadable from github, demonstrates 
one approach. 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


"iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread George Toledo
>
>
> >> Maybe the file is corrupt. In most cases it can be solved by deleting
> the XML file and then making a slight change in iTunes (e.g. rename a song).
> The file is then written again soon and should be fine.
> >
> > Yeah, it’s a strange problem because this file gets rewritten from
> scratch all the time — not just every time you alter anything in your iTunes
> library, but even after playing songs (because the file includes
> play-counts.) So even if it got corrupted somehow, it would be replaced
> quite soon thereafter, if the user is actually using iTunes.
> Yes. I already had customers were only deleting the XML file solved the
> problem. Maybe the file was locked or write-protected in the damaged stage,
> so it could not be overwritten by iTunes.
> Regards,
> Mani
> --
> http://mani.de - friendly software


This is a bit indirectly related, but I've noticed in a program of mine that
if iTunes is loading new media, and, for whatever reason has a problem
converting all of what it should be importing and crashes or locks, that
many times, the very next time iTunes is opened that iTunes will give a
message that the library is locked. Opening it a second time usually solves
the problem. In this instance, it's not a problem with my code, merely
iTunes not being able to handle being loaded with a large amount of media
files, that are to be stored on a hard drive over wi-fi (I've reproduced it
multiple ways).
-- 
George Toledo
gtole...@gmail.com
www.georgetoledo.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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
This would make more sense if I explained what the view itself was. Long story 
short, it's a pretty huge (and important) custom control that runs all the way 
across the toolbar. There are other ways to access the commands (via the 
application menus + shortcuts) but I would also like to have a contextual menu.

On 2011-08-25, at 4:52 PM, Raleigh Ledet wrote:

> A contextual menu in a toolbar? Lets think about this for a moment.
> 
> A) such a command would be hard to discover. Your customers have other ways 
> to activate the same commands right? If not, why not use a popup button here?
> B) I assume that's because you have an action tied to single click…. why not 
> look for a click and hold, then pop-up a menu a' la Safari's back/forward  
> tool bar buttons. Oh! and users have an alternate way to get to these actions 
> / settings right?
> 
> -raleigh
> 
> On Aug 25, 2011, at 3:39 PM, Indragie Karunaratne wrote:
> 
>> I just need to present a contextual menu from my custom view toolbar item, 
>> but NSToolbarView is not passing the right mouse events down, so 
>> -menuForEvent: is never called.
>> 
>> On 2011-08-25, at 4:27 PM, Corbin Dunn wrote:
>> 
>>> ToolbarView overrides hitTest; to do some magic; that is probably the 
>>> source of your problem.
>>> 
>>> What are you trying to do?
>>> 
>>> corbin
>>> 
>>> On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:
>>> 
 Just realized something interesting, and remembered a key detail that I 
 forgot to mention. The view in question is a custom view inside the 
 toolbar of the window. The NSToolbar by default has a contextual menu that 
 appears when the customizable property is set to YES. However, even though 
 there is no menu when customizable is set to NO, I suspected that it was 
 still trapping right mouse events. So I used a category on the private 
 NSToolbarView class that manages the UI for NSToolbar to check whether it 
 was receiving the events:
 
 @interface NSToolbarView : NSView
 @end
 
 @interface NSToolbarView (RightMouse)
 @end
 
 @implementation NSToolbarView (RightMouse)
 
 - (void)rightMouseDown:(NSEvent*)theEvent
 {
 NSLog(@"right mouse");
 }
 
 @end
 
 And as expected, the method is called. This leaves me wondering how the 
 toolbar view can receive the events when my own view inside the toolbar 
 can not (as the event would have to be forwarded up the responder chain to 
 the toolbar in order for it to receive it). 
 
 On 2011-08-25, at 1:58 PM, Ken Thomases wrote:
 
> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>  wrote:
> 
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called.
> 
> Any chance you simply have a typo or misspelling in your method signature?
> 
> -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:
 http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
 
 This email sent to corb...@apple.com
>>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
>> 
>> This email sent to le...@apple.com
> 

___

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

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

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

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


Re: Representation of strings with special chars

2011-08-25 Thread Glenn L. Austin

On Aug 25, 2011, at 2:03 PM, Alexander Reichstadt wrote:

> Hi,
> 
> Thank you for your many responses.
> 
>>   const char *cstr = [s UTF8String];
>>   mysql_stmt_prepare(myStatement, cstr, strlen(cstr));
> 
> 
> This fixed the bug. 
> 
> Alexander

Just in case the string has a NULL character, I'd use:

NSData *data = [s dataUsingEncoding:NSUTF8StringEncoding];
mysql_stmt_prepare(myStatement, [data bytes], [data length]);

Of course, if you *did* have a NULL character in your string, then the 
mysql_stmt_prepare would probably barf at some point.  You could use the 
comparison of strlen() and [data length] to make sure that you're not passing a 
NULL.

-- 
Glenn L. Austin, Computer Wizard and Race Car Driver <><




___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Raleigh Ledet
A contextual menu in a toolbar? Lets think about this for a moment.

A) such a command would be hard to discover. Your customers have other ways to 
activate the same commands right? If not, why not use a popup button here?
B) I assume that's because you have an action tied to single click…. why not 
look for a click and hold, then pop-up a menu a' la Safari's back/forward  tool 
bar buttons. Oh! and users have an alternate way to get to these actions / 
settings right?

-raleigh

On Aug 25, 2011, at 3:39 PM, Indragie Karunaratne wrote:

> I just need to present a contextual menu from my custom view toolbar item, 
> but NSToolbarView is not passing the right mouse events down, so 
> -menuForEvent: is never called.
> 
> On 2011-08-25, at 4:27 PM, Corbin Dunn wrote:
> 
>> ToolbarView overrides hitTest; to do some magic; that is probably the source 
>> of your problem.
>> 
>> What are you trying to do?
>> 
>> corbin
>> 
>> On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:
>> 
>>> Just realized something interesting, and remembered a key detail that I 
>>> forgot to mention. The view in question is a custom view inside the toolbar 
>>> of the window. The NSToolbar by default has a contextual menu that appears 
>>> when the customizable property is set to YES. However, even though there is 
>>> no menu when customizable is set to NO, I suspected that it was still 
>>> trapping right mouse events. So I used a category on the private 
>>> NSToolbarView class that manages the UI for NSToolbar to check whether it 
>>> was receiving the events:
>>> 
>>> @interface NSToolbarView : NSView
>>> @end
>>> 
>>> @interface NSToolbarView (RightMouse)
>>> @end
>>> 
>>> @implementation NSToolbarView (RightMouse)
>>> 
>>> - (void)rightMouseDown:(NSEvent*)theEvent
>>> {
>>>  NSLog(@"right mouse");
>>> }
>>> 
>>> @end
>>> 
>>> And as expected, the method is called. This leaves me wondering how the 
>>> toolbar view can receive the events when my own view inside the toolbar can 
>>> not (as the event would have to be forwarded up the responder chain to the 
>>> toolbar in order for it to receive it). 
>>> 
>>> On 2011-08-25, at 1:58 PM, Ken Thomases wrote:
>>> 
 On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
  wrote:
 
> I have an NSView subclass that I'm trying to capture right clicks in. I 
> override the rightMouseDown: method but it is never called.
 
 Any chance you simply have a typo or misspelling in your method signature?
 
 -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:
>>> http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
>>> 
>>> This email sent to corb...@apple.com
>> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/ledet%40apple.com
> 
> This email sent to le...@apple.com

___

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

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

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

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


trying to make mouse cursor changes when hover an NSImageView

2011-08-25 Thread Wilker
Hi guys,

I'm needing to make some linkable images on my software (for my about
window), the part related to click and go to link is working fine, but I
can't make the cursor change to hand (pointer) when mouse is over it, I
tried some approaches like using mouseEntered and mouseExited to handle, but
no luck, and them tried with addCursorRect, but still can't get it to
work...

How can I make it work, so user have a better idea that the images are
clickable?

This is the current code for my custom NSImageView (pretty simple):

@implementation LinkableImageView


@synthesize targetURL;


- (void)mouseDown:(NSEvent *)theEvent

{

[super mouseDown:theEvent];



if (targetURL) {

[[NSWorkspace sharedWorkspace] openURL:[NSURL
URLWithString:targetURL]];

}

}


@end
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600
___

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

Please do not post 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I just need to present a contextual menu from my custom view toolbar item, but 
NSToolbarView is not passing the right mouse events down, so -menuForEvent: is 
never called.

On 2011-08-25, at 4:27 PM, Corbin Dunn wrote:

> ToolbarView overrides hitTest; to do some magic; that is probably the source 
> of your problem.
> 
> What are you trying to do?
> 
> corbin
> 
> On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:
> 
>> Just realized something interesting, and remembered a key detail that I 
>> forgot to mention. The view in question is a custom view inside the toolbar 
>> of the window. The NSToolbar by default has a contextual menu that appears 
>> when the customizable property is set to YES. However, even though there is 
>> no menu when customizable is set to NO, I suspected that it was still 
>> trapping right mouse events. So I used a category on the private 
>> NSToolbarView class that manages the UI for NSToolbar to check whether it 
>> was receiving the events:
>> 
>> @interface NSToolbarView : NSView
>> @end
>> 
>> @interface NSToolbarView (RightMouse)
>> @end
>> 
>> @implementation NSToolbarView (RightMouse)
>> 
>> - (void)rightMouseDown:(NSEvent*)theEvent
>> {
>>   NSLog(@"right mouse");
>> }
>> 
>> @end
>> 
>> And as expected, the method is called. This leaves me wondering how the 
>> toolbar view can receive the events when my own view inside the toolbar can 
>> not (as the event would have to be forwarded up the responder chain to the 
>> toolbar in order for it to receive it). 
>> 
>> On 2011-08-25, at 1:58 PM, Ken Thomases wrote:
>> 
>>> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>>>  wrote:
>>> 
 I have an NSView subclass that I'm trying to capture right clicks in. I 
 override the rightMouseDown: method but it is never called.
>>> 
>>> Any chance you simply have a typo or misspelling in your method signature?
>>> 
>>> -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:
>> http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
>> 
>> This email sent to corb...@apple.com
> 

___

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

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

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

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


Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Corbin Dunn
ToolbarView overrides hitTest; to do some magic; that is probably the source of 
your problem.

What are you trying to do?

corbin

On Aug 25, 2011, at 3:14 PM, Indragie Karunaratne wrote:

> Just realized something interesting, and remembered a key detail that I 
> forgot to mention. The view in question is a custom view inside the toolbar 
> of the window. The NSToolbar by default has a contextual menu that appears 
> when the customizable property is set to YES. However, even though there is 
> no menu when customizable is set to NO, I suspected that it was still 
> trapping right mouse events. So I used a category on the private 
> NSToolbarView class that manages the UI for NSToolbar to check whether it was 
> receiving the events:
> 
> @interface NSToolbarView : NSView
> @end
> 
> @interface NSToolbarView (RightMouse)
> @end
> 
> @implementation NSToolbarView (RightMouse)
> 
> - (void)rightMouseDown:(NSEvent*)theEvent
> {
>NSLog(@"right mouse");
> }
> 
> @end
> 
> And as expected, the method is called. This leaves me wondering how the 
> toolbar view can receive the events when my own view inside the toolbar can 
> not (as the event would have to be forwarded up the responder chain to the 
> toolbar in order for it to receive it). 
> 
> On 2011-08-25, at 1:58 PM, Ken Thomases wrote:
> 
>> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>>  wrote:
>> 
>>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>>> override the rightMouseDown: method but it is never called.
>> 
>> Any chance you simply have a typo or misspelling in your method signature?
>> 
>> -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:
> http://lists.apple.com/mailman/options/cocoa-dev/corbind%40apple.com
> 
> This email sent to corb...@apple.com

___

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

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

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

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


Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Just realized something interesting, and remembered a key detail that I forgot 
to mention. The view in question is a custom view inside the toolbar of the 
window. The NSToolbar by default has a contextual menu that appears when the 
customizable property is set to YES. However, even though there is no menu when 
customizable is set to NO, I suspected that it was still trapping right mouse 
events. So I used a category on the private NSToolbarView class that manages 
the UI for NSToolbar to check whether it was receiving the events:

@interface NSToolbarView : NSView
@end

@interface NSToolbarView (RightMouse)
@end

@implementation NSToolbarView (RightMouse)

- (void)rightMouseDown:(NSEvent*)theEvent
{
NSLog(@"right mouse");
}

@end

And as expected, the method is called. This leaves me wondering how the toolbar 
view can receive the events when my own view inside the toolbar can not (as the 
event would have to be forwarded up the responder chain to the toolbar in order 
for it to receive it). 

On 2011-08-25, at 1:58 PM, Ken Thomases wrote:

> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>  wrote:
> 
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called.
> 
> Any chance you simply have a typo or misspelling in your method signature?
> 
> -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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread Manfred Schwind
>> Maybe the file is corrupt. In most cases it can be solved by deleting the 
>> XML file and then making a slight change in iTunes (e.g. rename a song). The 
>> file is then written again soon and should be fine.
> 
> Yeah, it’s a strange problem because this file gets rewritten from scratch 
> all the time — not just every time you alter anything in your iTunes library, 
> but even after playing songs (because the file includes play-counts.) So even 
> if it got corrupted somehow, it would be replaced quite soon thereafter, if 
> the user is actually using iTunes.

Yes. I already had customers were only deleting the XML file solved the 
problem. Maybe the file was locked or write-protected in the damaged stage, so 
it could not be overwritten by iTunes.

Regards,
Mani
--
http://mani.de - friendly software

___

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

Please do not post 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: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread Jens Alfke

On Aug 25, 2011, at 2:18 PM, Manfred Schwind wrote:

> Maybe the file is corrupt. In most cases it can be solved by deleting the XML 
> file and then making a slight change in iTunes (e.g. rename a song). The file 
> is then written again soon and should be fine.

Yeah, it’s a strange problem because this file gets rewritten from scratch all 
the time — not just every time you alter anything in your iTunes library, but 
even after playing songs (because the file includes play-counts.) So even if it 
got corrupted somehow, it would be replaced quite soon thereafter, if the user 
is actually using iTunes.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post 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: Sharing a persistent store between iOS and Mac

2011-08-25 Thread Jens Alfke

On Aug 25, 2011, at 1:30 PM, Fritz Anderson wrote:

> My iOS app has to initialize a large, read-only dataset — a 12,000-word 
> vocabulary with definitions. In my early drafts, with 6000 words, I had it 
> parse a text file, but that took alarmingly long, and the watchdog timer 
> would probably kill it if I attempted the full dictionary.

I’m not qualified to answer the CoreData question, but it shouldn’t take that 
long to read 12,000 words out of a text file. A fraction of a second. You may 
have been doing it using some technique that added a lot of extra overhead, 
perhaps for memory management.

It sounds like you’re going down a different path now, but if you do decide to 
go back to the text file approach, the collective wisdom of this list should be 
able to help you figure out why it’s slow and how to speed it up.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post 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: "iTunes Music Library.xml" won't load with dictionaryWithContentsOfFile:

2011-08-25 Thread Manfred Schwind
> one of my customers is reporting that my app does not find the "iTunes Music 
> Library.xml" file. Its there and its filled with data. His iTunes runs fine. 
> He send me the file and to my eyes it looks fine. The way i load it is with:
> 
> NSDictionary * xmldict = [NSDictionary 
> dictionaryWithContentsOfFile:libraryXML];
> 
> This returns nil for this file. The path is correct. For every other file I 
> encountered this worked fine. Is there a way to find out whats causing this 
> error? Or is there a known problem with loading this file that way?

Maybe the file is corrupt. In most cases it can be solved by deleting the XML 
file and then making a slight change in iTunes (e.g. rename a song). The file 
is then written again soon and should be fine.

Hope that helps,
Mani
--
http://mani.de - friendly software
iVolume - listen to music hands-free
Lullaby - wicked awesome shutdown timer
Secrets - secure information storage
LittleSecrets - the encrypted notepad
Watchdog - baffle the curious
Sahara - sand in your pocket

___

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

Please do not post 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: Representation of strings with special chars

2011-08-25 Thread Alexander Reichstadt
Hi,

Thank you for your many responses.

>const char *cstr = [s UTF8String];
>mysql_stmt_prepare(myStatement, cstr, strlen(cstr));


This fixed the bug. 

Alexander


Am 24.08.2011 um 22:37 schrieb Greg Parker:

> On Aug 24, 2011, at 1:24 PM, Alexander Reichstadt wrote:
>> Actually it's a couple of wrapper-classes to MYSQL c-calls by Karl Kraft.
>> 
>> In the sqlfetch-class, eventually it arrives at
>> 
>> mysql_stmt_prepare(myStatement, [s UTF8String],[s length])
>> 
>> where s is the NSString instance containing the SELECT-statement, such as 
>> SELECT field="someÜberthing".
>> 
>> From there it goes on to
>> 
>> int STDCALL mysql_stmt_prepare(MYSQL_STMT *stmt, const char *query,
>>  unsigned long length);
>> 
>> and at this point it fails.
> 
> First, [s length] is the wrong value to pass as the length of [s UTF8String]. 
> Try this instead:
>const char *cstr = [s UTF8String];
>mysql_stmt_prepare(myStatement, cstr, strlen(cstr));
> 
> Second, this code is sending UTF-8 encoded character data to MySQL. Make sure 
> that your MySQL environment is configured to accept UTF-8 data.
>
> http://rentzsch.tumblr.com/post/9133498042/howto-use-utf-8-throughout-your-web-stack
> If your MySQL system instead expects some other encoding like ISO Latin-1, 
> you can tell NSString to output that instead.
>[myString cStringUsingEncoding:NSISOLatin1StringEncoding];
> 
> 
> -- 
> 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: Sharing a persistent store between iOS and Mac

2011-08-25 Thread Gerd Knops

On Aug 25, 2011, at 3:30 PM, Fritz Anderson wrote:

> iOS 4.3 Simulator, Xcode 4.1, Lion 10.7.1
> 
> I'm having trouble generating a Core Data store and opening it in an iOS app 
> (in the Simulator so far).
> 
> My iOS app has to initialize a large, read-only dataset — a 12,000-word 
> vocabulary with definitions. In my early drafts, with 6000 words, I had it 
> parse a text file, but that took alarmingly long, and the watchdog timer 
> would probably kill it if I attempted the full dictionary.
> 
Can't comment on the actual question, but as a side node: the fastest way I 
could find to parse large text files on iOS is plain old fscanf. Everything 
else was substantially slower.

Gerd


___

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

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


Sharing a persistent store between iOS and Mac

2011-08-25 Thread Fritz Anderson
iOS 4.3 Simulator, Xcode 4.1, Lion 10.7.1

I'm having trouble generating a Core Data store and opening it in an iOS app 
(in the Simulator so far).

My iOS app has to initialize a large, read-only dataset — a 12,000-word 
vocabulary with definitions. In my early drafts, with 6000 words, I had it 
parse a text file, but that took alarmingly long, and the watchdog timer would 
probably kill it if I attempted the full dictionary.

So if I'm initializing an SQLite Core Data store anyway, why not do so at build 
time, with a command-line tool on the Mac side?

So I have two targets. They share one managed-object class and a data model. 
The builds for both compile the data model into a .momd. It's not the same 
momd, but VersionInfo.plist in both is identical. The command-line tool takes 
the .momd and the vocabulary text, and produces vocab.sqlite in SRCROOT. Using 
Navicat for SQLite Lite, I verified that the contents of the file are (as far 
as I can tell) what I expect.

The iOS target copies vocab.sqlite as a resource. I verified (by eye and by an 
assertion in code) that it is in the .app bundle. I reviewed the build logs and 
verified that the .sqlite file came from the place to which the command-line 
tool wrote.

I get "The model used to open the store is incompatible with the one used to 
create the store" when the iOS app tries to add vocab.sqlite to the persistent 
store coordinator.

There is only one .momd in the .app bundle. The command-line tool takes a .momd 
as an argument; I've tried pointing it at the .momd inside the bundle; still 
"incompatible."

From everything I know to check, I'm doing this right. I've found nothing to 
suggest you can't put a Mac-generated store into an iOS app, and much to 
suggest that you should. I'm stymied. What should I try next?

— 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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
Triple checked, I even copy/pasted the method directly from the docs to make 
sure:

- (void)rightMouseDown:(NSEvent *)theEvent
{
NSLog(@"right mouse");
[super rightMouseDown:theEvent];
}

Could it be something to do with the fact that it's a layer hosting view? I 
don't see how that would make a difference in the responder chain but that's 
all I can think of.

On 2011-08-25, at 1:58 PM, Ken Thomases wrote:

> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne 
>  wrote:
> 
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called.
> 
> Any chance you simply have a typo or misspelling in your method signature?
> 
> -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:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Ken Thomases
On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne  
wrote:

> I have an NSView subclass that I'm trying to capture right clicks in. I 
> override the rightMouseDown: method but it is never called.

Any chance you simply have a typo or misspelling in your method signature?

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

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


Re: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I'm on Lion, and I did find this bit in the AppKit Release Notes:
NSView now passes unhandled -rightMouseDown: events up the responder chain

Prior to 10.7, NSView did not pass unhandled -rightMouseDown: events up the 
responder chain. On 10.7, NSView passes -rightMouseDown: up the responder 
chain, if AppKit doesn’t find an associated context menu to display for the 
view. To avoid binary compatibility issues, this new behavior is enabled only 
for applications linked on 10.7 or later.

I'm not sure how this would cause my issue though, because I'm overriding 
-rightMouseDown:.

On 2011-08-25, at 12:56 PM, Kyle Sluder wrote:

> On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne
>  wrote:
>> I have an NSView subclass that I'm trying to capture right clicks in. I 
>> override the rightMouseDown: method but it is never called. This is the 
>> first time I've come across this issue as it has always worked fine for me 
>> before. All of the other mouse event methods (mouseDown:, mouseUp:, 
>> mouseDragged: etc.) work just fine. The view itself is a CALayer-hosting 
>> view embedded inside an NSScrollView (unless I'm screwing up something 
>> really obvious, I'm pretty sure the issue is related to this).
> 
> There's something in the release notes about this… what OS are you 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: New allowsExternalBinaryDataStorage in Core Data

2011-08-25 Thread Frédéric Testuz
Thanks,

Then for application where the user can choose the location of document, you 
can use it safely only if the store is in a package. If the document is 
moved/copied, the extern data are also moved/copied.

I had made some test with stores in the Desktop and after your reply I had 
found many hidden folder for each of my test.


And, in the video I talked about, they speak about a new example for Lion that 
will be available in some weeks. Some weeks have passed since the WWDC and I 
can't find this example. Is it available only for Xcode 4.2 ?

Frédéric


Le 25 août 2011 à 20:20, Steven Vandeweghe a écrit :

> It seems that when the image (or data in general) is larger than 1MB, it's 
> stored in a hidden folder in the same place as your main database. For 
> example, if the application is called MyLionApp and its persistent store is 
> located in the ~/Library/MyLionApp folder, the external files would be stored 
> in ~/Library/MyLionApp/.MyLionApp_SUPPORT/_EXTERNAL_DATA/.
> 
> The documentation is indeed very sparse, so I've investigated a bit myself 
> and posted the results here :
> 
> http://bluecrowbar.com/blog/2011/08/coredata-external.html
> 
> Steven
> 
> 
> On Aug 3, 2011, at 10:29 PM, Frédéric Testuz wrote:
> 
>> Hello,
>> 
>> I looked at the Core Data release notes of Lion, I also looked the "What's 
>> new in Core Data on Mac OS X" video of the WWDC 2011. And I have a question 
>> about the new allowsExternalBinaryDataStorage option for binary attribute.
>> 
>> I did some test with an attribute for images. I can see that when I put an 
>> big image in the data, the file did not grow.
>> 
>> But where the external file/data is put? If the file is moved or copied, 
>> what about theses external data? I tried to find info, but the documentation 
>> is very sparse.
>> 
>> Frédéric___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post 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/steven%40bluecrowbar.com
>> 
>> This email sent to ste...@bluecrowbar.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: rightMouseDown: never called in NSView subclass

2011-08-25 Thread Kyle Sluder
On Thu, Aug 25, 2011 at 11:45 AM, Indragie Karunaratne
 wrote:
> I have an NSView subclass that I'm trying to capture right clicks in. I 
> override the rightMouseDown: method but it is never called. This is the first 
> time I've come across this issue as it has always worked fine for me before. 
> All of the other mouse event methods (mouseDown:, mouseUp:, mouseDragged: 
> etc.) work just fine. The view itself is a CALayer-hosting view embedded 
> inside an NSScrollView (unless I'm screwing up something really obvious, I'm 
> pretty sure the issue is related to this).

There's something in the release notes about this… what OS are you 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


rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I have an NSView subclass that I'm trying to capture right clicks in. I 
override the rightMouseDown: method but it is never called. This is the first 
time I've come across this issue as it has always worked fine for me before. 
All of the other mouse event methods (mouseDown:, mouseUp:, mouseDragged: etc.) 
work just fine. The view itself is a CALayer-hosting view embedded inside an 
NSScrollView (unless I'm screwing up something really obvious, I'm pretty sure 
the issue is related to this).

Any help is appreciated,
Thanks___

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

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


rightMouseDown: never called in NSView subclass

2011-08-25 Thread Indragie Karunaratne
I have an NSView subclass that I'm trying to capture right clicks in. I 
override the rightMouseDown: method but it is never called. This is the first 
time I've come across this issue as it has always worked fine for me before. 
All of the other mouse event methods (mouseDown:, mouseUp:, mouseDragged: etc.) 
work just fine. The view itself is a CALayer-hosting view embedded inside an 
NSScrollView (unless I'm screwing up something really obvious, I'm pretty sure 
the issue is related to this).

Any help is appreciated,
Thanks___

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

Please do not post 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: New allowsExternalBinaryDataStorage in Core Data

2011-08-25 Thread Steven Vandeweghe
It seems that when the image (or data in general) is larger than 1MB, it's 
stored in a hidden folder in the same place as your main database. For example, 
if the application is called MyLionApp and its persistent store is located in 
the ~/Library/MyLionApp folder, the external files would be stored in 
~/Library/MyLionApp/.MyLionApp_SUPPORT/_EXTERNAL_DATA/.

The documentation is indeed very sparse, so I've investigated a bit myself and 
posted the results here :

http://bluecrowbar.com/blog/2011/08/coredata-external.html

Steven


On Aug 3, 2011, at 10:29 PM, Frédéric Testuz wrote:

> Hello,
> 
> I looked at the Core Data release notes of Lion, I also looked the "What's 
> new in Core Data on Mac OS X" video of the WWDC 2011. And I have a question 
> about the new allowsExternalBinaryDataStorage option for binary attribute.
> 
> I did some test with an attribute for images. I can see that when I put an 
> big image in the data, the file did not grow.
> 
> But where the external file/data is put? If the file is moved or copied, what 
> about theses external data? I tried to find info, but the documentation is 
> very sparse.
> 
> Frédéric___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/steven%40bluecrowbar.com
> 
> This email sent to ste...@bluecrowbar.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: Crash using NSOpenPanel TFSVolumeInfo::GetSyncGCDQueue[SOLVED]

2011-08-25 Thread jonat...@mugginsoft.com

On 22 Aug 2011, at 08:30, jonat...@mugginsoft.com wrote:

> From time to time I experience the following crash when displaying 
> NSOpenPanel on Lion in a GC app.
> It has prior form according to 
> http://www.cocoabuilder.com/archive/cocoa/283840-odd-crash.html
> 
> Does anyone have any recent insight into this one?
> 
> Thread 5 Crashed:: Dispatch queue: TFSVolumeInfo::GetSyncGCDQueue
> 0   ???   0xfefff000 0 + 4278185984
> 1   com.apple.DesktopServices 0x985c2f6e TFSInfo::Initialize(unsigned 
> char, OpaqueLSSharedFileListItemRef*) + 770
> 2   com.apple.DesktopServices 0x9854a666 
> TFSInfoSynchronizer::FetchChildren() + 652
> 3   com.apple.DesktopServices 0x98536947 
> TNode::SynchronizeChildren(unsigned long, TNodeEventPtrSet&) + 169
> 4   com.apple.DesktopServices 0x985363f4 TNode::HandleSync(unsigned 
> long) + 2176
> 5   com.apple.DesktopServices 0x98535b47 
> TNode::HandleSync(TCountedPtr const&, TNodePtr const&) + 55
> 6   com.apple.DesktopServices 0x985836e8 
> TNode::HandleNodeRequest(TCountedPtr const&, 
> TCountedPtr const&) + 978
> 7   com.apple.DesktopServices 0x985a6135 
> __PostNodeTaskRequest_block_invoke_08 + 87
> 8   com.apple.DesktopServices 0x985b8589 ExceptionSafeBlock(void ( 
> block_pointer)()) + 55
> 9   com.apple.DesktopServices 0x985a60d8 
> __PostNodeTaskRequest_block_invoke_0 + 86
> 10  libdispatch.dylib 0x9a003e85 
> _dispatch_call_block_and_release + 15
> 11  libdispatch.dylib 0x9a00580b _dispatch_queue_drain + 224
> 12  libdispatch.dylib 0x9a0056b0 _dispatch_queue_invoke + 47
> 13  libdispatch.dylib 0x9a004eb8 _dispatch_worker_thread2 + 
> 187
> 14  libsystem_c.dylib 0x9a070b24 _pthread_wqthread + 346
> 15  libsystem_c.dylib 0x9a0726fe start_wqthread + 30
> Regards
> 

This was a real problem as I subsequently found out that ANY time my app called 
NSSavePanel I encountered the same crash.
This was 100% reproducible on my development machine.
A clean install did not exhibit the problem.

I deliberately crashed the clean install and compared the list of binary images.
As the two machines were running the same build of the app on the same OS 
version I could only presume that code was being executed in one that wasn't on 
the other.
This made a loadable bundle a likely candidate.

Comparing the crash logs I noted a couple of bundles that were only loaded on 
the development machine.
Trial and error revealed the culprit.

0xc7a3000 -  0xc7a6fff +org.tigris.scfinderplugin (1.0 - 169) 
<8DE3E188-4EF3-B390-1B61-DBF71CD800CF> /Library/Contextual Menu 
Items/SCFinderPlugin.plugin/Contents/MacOS/SCFinderPlugin

This was an out of date and no longer relevant copy of the Subversion SCPlugin.

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.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