lengthOfBytesUsingEncoding not correct

2013-02-15 Thread Gerriet M. Denkmann
This program:

NSString *s = @"หัวหิน";
NSUInteger l3 = [ s lengthOfBytesUsingEncoding: NSUTF16StringEncoding ];
NSLog(@"%s NSUTF16StringEncoding length %lu", __FUNCTION__, l3);
 

NSData *d9 = [ s dataUsingEncoding: NSUTF16StringEncoding ];
NSLog(@"%s NSUTF16StringEncoding data %lu %@", __FUNCTION__, [d9 
length], d9);

prints: 
 NSUTF16StringEncoding length 12
 NSUTF16StringEncoding data 14 

Why is the number of bytes first 12, then 14? 

(NSUTF16StringEncoding data has 2 leading byte order bytes - but why does 
lengthOfBytesUsingEncoding not take this into it's count?)

OS X 10.8.2, Xcode 4.6

Gerriet.


___

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

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

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

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

Re: lengthOfBytesUsingEncoding not correct

2013-02-15 Thread Markus Spoettl

On 2/15/13 9:13 AM, Gerriet M. Denkmann wrote:

This program:

NSString *s = @"หัวหิน";  
NSUInteger l3 = [ s lengthOfBytesUsingEncoding: NSUTF16StringEncoding ];
NSLog(@"%s NSUTF16StringEncoding length %lu", __FUNCTION__, l3);  

NSData *d9 = [ s dataUsingEncoding: NSUTF16StringEncoding ];
NSLog(@"%s NSUTF16StringEncoding data %lu %@", __FUNCTION__, [d9 
length], d9);

prints:
  NSUTF16StringEncoding length 12
  NSUTF16StringEncoding data 14 

Why is the number of bytes first 12, then 14?

(NSUTF16StringEncoding data has 2 leading byte order bytes - but why does 
lengthOfBytesUsingEncoding not take this into it's count?)


The data includes the Byte Order Mark (BOM) 0xfffe (see 
http://en.wikipedia.org/wiki/Byte_order_mark).


Documentation on -dataUsingEncoding:allowLossyConversion: explains that it is 
doing that.


Regards
Markus
--
__
Markus Spoettl
___

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

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

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

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

Dynamic Object, How to implement B-Tree in Objective-c, Archiving on each B-Tree node

2013-02-15 Thread Christ Levesque
Hello

How to create dynamic object based on user request and then how to insert it in 
a B-Tree and then how to archive/unarchive this tree.
___

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

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

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

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


How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject

2013-02-15 Thread Christ Levesque
Hello

I want to use these classes in my app but I don't want to use it in Core Data.
___

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

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

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

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


Re: Recursive file copy with good progress data?

2013-02-15 Thread Mike Abdullah

On 15 Feb 2013, at 05:22, Graham Cox  wrote:

> 
> On 15/02/2013, at 1:55 PM, Jim Zajkowski  wrote:
> 
>> s there anything that provides the level of progress that FSCopyObjectAsync 
>> does but gives the callback more control like copyfile() does?
> 
> 
> You could look into NSFileManager's -copyItemAtURL:toURL:error: method which, 
> in conjunction with a delegate implementing appropriate methods, gives you 
> both progress feedback as well as a mechanism for error recovery. Not sure 
> what performance will be like though.

The glaring flaw in NSFileManager for this is it can't give progress callbacks 
for individual files; something that becomes quite important when copying a GB 
of data! It might be interesting to use NSFileManager's directory enumeration 
features to drive the copying of individual files though.


___

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

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

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

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


Re: Dynamic Object, How to implement B-Tree in Objective-c, Archiving on each B-Tree node

2013-02-15 Thread Graham Cox

On 15/02/2013, at 8:01 PM, Christ Levesque  wrote:

> How to create dynamic object based on user request and then how to insert it 
> in a B-Tree and then how to archive/unarchive this tree.


How indeed?

How about studying CS for a few years, getting a degree, working in industry 
for a further twenty or so, writing millions of lines of code to gain 
experience, and then perhaps you'll at least know how to frame the question 
smartly.

You seem to expect those of us who have done these things to help you skip 
straight to the answer. Why would we do that? We did the hard yards, bud, so 
you'll have to as well. In the meantime, this is a great resource:

http://www.catb.org/esr/faqs/smart-questions.html


--Graham


___

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

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

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

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


Re: How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject

2013-02-15 Thread Dave Keck
> NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, 
> NSManagedObject
>
> I want to use these classes in my app but I don't want to use it in Core Data.

These classes *are* Core Data; I'm afraid you're not making much sense.
___

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

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

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

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


Observing changes user did in Print&Scan tab in System Preferences.

2013-02-15 Thread Dmitriy Balakirev
Hi all,

How can i observe changes( like renaming printer, set another default printer, 
delete printer, add printer) user did in Print&Scan tab in System Preferences?

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

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


Binding a NSArrayController to a NSPopupButtonn & NSTextField

2013-02-15 Thread Eric Gorr
What I want to accomplish seems like it should be fairly straightforward. I 
have placed a sample project at 
https://github.com/ericgorr/arraycontrollerbindings.

I have a NSArrayController filled with an array of NSDictionaries.

[[self controller] addObject:@{ @"name" : @"itemA", @"part" : @"partA" }];
[[self controller] addObject:@{ @"name" : @"itemB", @"part" : @"partB" }];
[[self controller] addObject:@{ @"name" : @"itemC", @"part" : @"partC" }];

I am populating a NSPopupButton with the items in this array based on the 
'name' key. This is easily accomplished with the following bindings.

Content Array binding - 
bound to: Array Controller
controller key: arrangedObjects

Content Values binding
bound to: array controller
controller key: arrangedObjects
model key path: name

I would then like to populate a NSTextField with the text in the 'part' key 
based on the current selection of the NSPopupButton. I have setup the following 
binding:

Value binding
bound to: array controller
controller key: selection
model key path: part

With these bindings alone, the text field does display 'partC'.

However, if I change the value of the NSPopupMenu, what the text field shows 
does not change.

I thought this would simply be a matter of setting up the 'Selected Object' 
binding on the NSPopupButton with the controller key 'selection', but that 
isn't working. I end up with the proxy object in my menu for some strange 
reason (providing the reason why would be a bonus).

What am I missing to make this work?




___

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

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

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

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


Re: How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject

2013-02-15 Thread Keary Suska
On Feb 15, 2013, at 2:06 AM, Christ Levesque wrote:

> I want to use these classes in my app but I don't want to use it in Core Data.

You can use all of these *except* NSManagedObjectContext for your own purposes. 
I know because I have a significant project where I do exactly that. 
NSManagedObjectContext is basically the heart of Core Data, and doesn't extend 
well. Its inner workings are opaque and undocumented. If what you are looking 
for are the benefits of Core Data but with your own database back-end, you 
pretty much will have to write your own database coordination methods, as well 
as change tracking and undo management0--essentially everything that 
NSManagedObjectContext does.

HTH,

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


___

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

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

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

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


Re: Binding a NSArrayController to a NSPopupButtonn & NSTextField

2013-02-15 Thread Keary Suska
On Feb 15, 2013, at 5:41 AM, Eric Gorr wrote:

> I have a NSArrayController filled with an array of NSDictionaries.
> 
> [[self controller] addObject:@{ @"name" : @"itemA", @"part" : @"partA" }];
> [[self controller] addObject:@{ @"name" : @"itemB", @"part" : @"partB" }];
> [[self controller] addObject:@{ @"name" : @"itemC", @"part" : @"partC" }];
> 
> I am populating a NSPopupButton with the items in this array based on the 
> 'name' key. This is easily accomplished with the following bindings.
> 
> Content Array binding - 
>   bound to: Array Controller
>   controller key: arrangedObjects
> 
> Content Values binding
>   bound to: array controller
>   controller key: arrangedObjects
>   model key path: name
> 
> I would then like to populate a NSTextField with the text in the 'part' key 
> based on the current selection of the NSPopupButton. I have setup the 
> following binding:
> 
> Value binding
>   bound to: array controller
>   controller key: selection
>   model key path: part
> 
> With these bindings alone, the text field does display 'partC'.
> 
> However, if I change the value of the NSPopupMenu, what the text field shows 
> does not change.

It is useful to note that even though an object will bind to an 
NSArrayController, it does not mean that it will employ the controller's 
selection semantics. NSPopupButton is one of them, I believe. The "proper" way 
to do this is bind the NSPopupButton's selectedObject/Value to a controller 
that maintains the value (*not* the array controller), and then bind the 
NSTextField to that other controller. You may be able to use an 
NSObjectController in the xib to act as the "proxy" for the value, however 
kludgey.

HTH,

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


___

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

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

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

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


[solved] Re: NSImage leaks open file in 10.8.2?

2013-02-15 Thread norbert
Thanks a lot for your comments. I have tried to set 
setCacheMode:NSImageCacheNever, but that still left the file open.

But I have changed my code to use this now:

NSImage *result = [[NSImage alloc] 
initByReferencingFile:[[NSBundle mainBundle] pathForResource:[theName 
stringByDeletingPathExtension] ofType:@"png"]];
[result autorelease];

And this works!!! No more image files left open. That is definitely a bug in 
Mac OS X 10.8.2, I can't believe this is intended behavior…

Yours,


> while testing the latest version of my software in 10.8.2, I noticed that 
> there are a lot of open files, more than in 10.6.8. 
> 
> I tracked it down to an animation I use, and the png files I load for that.
> 
> In Mac OS X 10.6.8, it works fine, and closes the image files after use. But 
> in 10.8.2, it keeps every single one of them open.
> 
> Here is the code I use:
> 
>   NSImage *nextImage = [NSImage 
> imageNamed:@"Animator1.png"];
>   if (nextImage != NULL)
>   [myImageView setImage:nextImage];
> 
> myImageView is a regular NSImageView. The app is non GC, and non ARC.
> 
> Is that a new "feature" of Mountain Lion?
> 
> The problem is that my software deals with a LOT of files, and so it would be 
> nice to keep the number of open files as small as possible at any time.
> 
> And ideas?

Norbert M. Doerner
ndoer...@wfs-apps.de

CEO, West-Forest-Systems
In der Trift 13
56459 Langenhahn, Germany
Fon: +49 (2663) 91 70 128   (Central European Time Zone...)
Fax: +49 (2663) 91 70 126
AIM (iChat), Skype: cdfinderceo
Twitter: http://www.twitter.com/neofinder
Facebook: http://www.facebook.com/NeoFinder
---
NeoFinder - The Search Is Over!  http://www.neofinder.de/
Catalog and organize your photos, music, videos, disks, data, anything...
NEW:  NeoFinder 6.0.1 for Mac (was CDFinder)
---
___

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

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

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

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

Re: [solved] Re: NSImage leaks open file in 10.8.2?

2013-02-15 Thread Kyle Sluder
On Fri, Feb 15, 2013, at 09:30 AM, norbert wrote:
> Thanks a lot for your comments. I have tried to set
> setCacheMode:NSImageCacheNever, but that still left the file open.
> 
> But I have changed my code to use this now:
> 
>   NSImage *result = [[NSImage alloc] 
> initByReferencingFile:[[NSBundle mainBundle] pathForResource:[theName 
> stringByDeletingPathExtension] ofType:@"png"]];
>   [result autorelease];

This will not deal with @2x images correctly, though that might not be
an issue for you.

> 
> And this works!!! No more image files left open. That is definitely a bug
> in Mac OS X 10.8.2, I can't believe this is intended behavior…

If you're certain of this, you should definitely file a Radar with a
small demo project that reproduces the issue. It would also be nice if
you could share that demo project with us.

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

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

Custom control with 4 vertical sliders

2013-02-15 Thread Steve Mills
What's the easiest way to create a custom control that contains a matrix of 4 
custom vertical sliders, like a mini graphic EQ? The sliders will not draw the 
slot, only the knob. First I started with a subclass of NSMatrix and a subclass 
of NSCell. No matter what I've tried, the cells always end up drawing at the 
wrong size, as if they were the cell for a simple text matrix, about 100 pixels 
wide and the height of a regular size text label. I create it thusly:

MyMatrix*   blView = [[MyMatrix alloc] 
initWithFrame:NSMakeRect(100, 100, 200, 80) mode:NSTrackModeMatrix 
cellClass:[MyCell class] numberOfRows:1 numberOfColumns:4];

I've tried overriding all sorts of methods in the 2 subclasses; cellSize, 
cellFrameAtRow:column, even returning a cellSize of 1,1 as suggested in 
the docs for cells that aren't text or image cells.

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



___

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

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

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

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


Re: Custom control with 4 vertical sliders

2013-02-15 Thread Steve Mills
On Feb 15, 2013, at 13:35:38, Steve Mills  wrote:

> What's the easiest way to create a custom control that contains a matrix of 4 
> custom vertical sliders, like a mini graphic EQ? The sliders will not draw 
> the slot, only the knob. First I started with a subclass of NSMatrix and a 
> subclass of NSCell. No matter what I've tried, the cells always end up 
> drawing at the wrong size, as if they were the cell for a simple text matrix, 
> about 100 pixels wide and the height of a regular size text label. I create 
> it thusly:
> 
>   MyMatrix*   blView = [[MyMatrix alloc] 
> initWithFrame:NSMakeRect(100, 100, 200, 80) mode:NSTrackModeMatrix 
> cellClass:[MyCell class] numberOfRows:1 numberOfColumns:4];
> 
> I've tried overriding all sorts of methods in the 2 subclasses; cellSize, 
> cellFrameAtRow:column, even returning a cellSize of 1,1 as suggested 
> in the docs for cells that aren't text or image cells.


Addendum:

If any of the sliders is dragged past the top of bottom of the containing 
control, the containing control's bounds will be expanded live in that 
direction, thereby keeping the mouse within the containing control. I'm 
starting to think that doing with this a matrix of cells won't be the best way 
to do this, but rather just create a custom control and tracks the 4 "sliders" 
internally. Thoughts?

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157




___

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

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

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

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


Re: iOS Document Interaction Technology

2013-02-15 Thread koko
This was an interesting problem, well to me anyway.

I copied CFBundleDocumentTypes and UTExportedTypeDeclarations from an OSX 
project to an iOS project.

The OSX app is recognized as the app to open files of types specified in these 
keys so I assumed the key values were constructed properly.

Well, the UTExportedTypeDeclarations was malformed and it is the key that iOS 
apparently looks to for registering documents.

Which leads me to believe that OSX does not use this key but uses 
CFBundleDocumentTypes OR OSX overlooks minimal malformations and interprets 
UTExportedTypeDeclarations regardless.

So, which is it … if anyone can answer.

BTW the UTExportedTypeDeclarations malformation was that the array of 
dictionaries was in an array.  Removing the outer array tags made it all good.

-koko

On Feb 14, 2013, at 12:33 PM, David E Blanton  wrote:

> 
> On Feb 14, 2013, at 12:12 PM, Damian Carrillo  wrote:
> 
>> You may be missing UTExportedTypeDeclarations.
> 
> I have both CFBundleDocumentTypes and UTExportedTypeDeclarations in my 
> info.plist.
> 
> UTExportedTypeDeclarations has a UTTypeConformsTo key for each item in the 
> LSItemContentTypes array.
> 
> 
> -koko

___

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

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

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

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

OS X Collection Views videos?

2013-02-15 Thread Rick Mann
Are there any WWDC videos covering Cocoa Collection Views (not iOS Collection 
Views)? I just looked through the titles online, but it's hard to discern, and 
doesn't look like there are any expressly dedicated to the topic.


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

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


Re: OS X Collection Views videos?

2013-02-15 Thread Jean Suisse
Well, there are session 205 & 219 of WWDC2012, but I think both are exclusively 
about IOS6. Might be worth fast forwarding through them, thought.
Jean


On 15 févr. 2013, at 22:46, Rick Mann  wrote:

> Are there any WWDC videos covering Cocoa Collection Views (not iOS Collection 
> Views)? I just looked through the titles online, but it's hard to discern, 
> and doesn't look like there are any expressly dedicated to the topic.
> 
> 
> -- 
> 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:
> https://lists.apple.com/mailman/options/cocoa-dev/jean.lists%40gmail.com
> 
> This email sent to jean.li...@gmail.com


___

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

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

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

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

Re: OS X Collection Views videos?

2013-02-15 Thread Rick Mann
Yeah, I saw those, but figured they wouldn't have much applicable. Maybe I'll 
skim through them.

On Feb 15, 2013, at 13:51 , Jean Suisse  wrote:

> Well, there are session 205 & 219 of WWDC2012, but I think both are 
> exclusively about IOS6. Might be worth fast forwarding through them, thought.
> Jean
> 
> 
> On 15 févr. 2013, at 22:46, Rick Mann  wrote:
> 
>> Are there any WWDC videos covering Cocoa Collection Views (not iOS 
>> Collection Views)? I just looked through the titles online, but it's hard to 
>> discern, and doesn't look like there are any expressly dedicated to the 
>> topic.
>> 
>> 
>> -- 
>> 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:
>> https://lists.apple.com/mailman/options/cocoa-dev/jean.lists%40gmail.com
>> 
>> This email sent to jean.li...@gmail.com
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> https://lists.apple.com/mailman/options/cocoa-dev/rmann%40latencyzero.com
> 
> This email sent to rm...@latencyzero.com


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

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

Re: How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject

2013-02-15 Thread Jens Alfke

On Feb 15, 2013, at 8:11 AM, Keary Suska  wrote:

> If what you are looking for are the benefits of Core Data but with your own 
> database back-end, you pretty much will have to write your own database 
> coordination methods, as well as change tracking and undo 
> management0--essentially everything that NSManagedObjectContext does.

Isn’t this what subclassing NSIncrementalStore is for? Creating your own 
back-ends for CoreData?

—Jens
___

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

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

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

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

Re: Custom control with 4 vertical sliders

2013-02-15 Thread Graham Cox
I sometimes find that trying to subclass existing classes such as NSCell is 
more trouble that it's worth, unless you really need your custom cell to be 
used anywhere a cell can be used, e.g. buttons, matrices, list rows, etc. 

If you just want a particular custom control that doesn't need that degree of 
reusability, subclassing NSView or NSControl is always a lot easier. In this 
case, if NSSlider isn't suitable, just make a custom view for your custom 
slider, then add it four times to another custom view that handles the "set" of 
sliders as needed.


--Graham





On 16/02/2013, at 7:30 AM, Steve Mills  wrote:

> On Feb 15, 2013, at 13:35:38, Steve Mills  wrote:
> 
>> What's the easiest way to create a custom control that contains a matrix of 
>> 4 custom vertical sliders, like a mini graphic EQ? The sliders will not draw 
>> the slot, only the knob. First I started with a subclass of NSMatrix and a 
>> subclass of NSCell. No matter what I've tried, the cells always end up 
>> drawing at the wrong size, as if they were the cell for a simple text 
>> matrix, about 100 pixels wide and the height of a regular size text label. I 
>> create it thusly:
>> 
>>  MyMatrix*   blView = [[MyMatrix alloc] 
>> initWithFrame:NSMakeRect(100, 100, 200, 80) mode:NSTrackModeMatrix 
>> cellClass:[MyCell class] numberOfRows:1 numberOfColumns:4];
>> 
>> I've tried overriding all sorts of methods in the 2 subclasses; cellSize, 
>> cellFrameAtRow:column, even returning a cellSize of 1,1 as suggested 
>> in the docs for cells that aren't text or image cells.
> 
> 
> Addendum:
> 
> If any of the sliders is dragged past the top of bottom of the containing 
> control, the containing control's bounds will be expanded live in that 
> direction, thereby keeping the mouse within the containing control. I'm 
> starting to think that doing with this a matrix of cells won't be the best 
> way to do this, but rather just create a custom control and tracks the 4 
> "sliders" internally. Thoughts?


___

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

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

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

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


Re: How to use NSManagedObjectContext, NSManagedObjectModel, NSEntityDescription, NSManagedObject

2013-02-15 Thread Keary Suska
On Feb 15, 2013, at 4:21 PM, Jens Alfke wrote:

> On Feb 15, 2013, at 8:11 AM, Keary Suska  wrote:
> 
>> If what you are looking for are the benefits of Core Data but with your own 
>> database back-end, you pretty much will have to write your own database 
>> coordination methods, as well as change tracking and undo 
>> management0--essentially everything that NSManagedObjectContext does.
> 
> Isn’t this what subclassing NSIncrementalStore is for? Creating your own 
> back-ends for CoreData?

I forgot about that. I didn't take that approach for  number of reasons, mostly 
due to when the system was mostly written and the OSes I had to target, but it 
will work except for issues that are the continuing limitations of Core Data, 
in particular ACID compliance of any kind. In my case I am working with a 
multi-user back-end and a complex schema so I need predictable locking and 
transactional semantics (especially nested transactions).

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


___

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

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

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

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

Problem with NSPersistentStore

2013-02-15 Thread Laurent Daudelin
I got a few crash reports from users that have a problem with my CoreData app.

Given the following code:

/*
 Returns the persistent store coordinator for the application.
 If the coordinator doesn't already exist, it is created and the application's 
store added to it.
 */
- (NSPersistentStoreCoordinator *)persistentStoreCoordinator
{
if (_persistentStoreCoordinator == nil) {
NSURL *storeUrl = [NSURL fileURLWithPath:self.persistentStorePath];
_persistentStoreCoordinator = [[NSPersistentStoreCoordinator alloc] 
initWithManagedObjectModel:[NSManagedObjectModel mergedModelFromBundles:nil]];
NSError *error = nil;
NSPersistentStore *persistentStore = [_persistentStoreCoordinator 
addPersistentStoreWithType:NSSQLiteStoreType configuration:nil URL:storeUrl 
options:nil error:&error];
NSAssert3(persistentStore != nil, @"%s at %d: Unhandled error adding 
persistent store: %@", __FUNCTION__, __LINE__, [error localizedDescription]);
NSLog(@"Created persistent store '%@' at URL %@", 
persistentStore, storeUrl);
}
return _persistentStoreCoordinator;
}

When the MOC tries to perform a save, an exception is generated:

Exception reason

This NSPersistentStoreCoordinator has no persistent stores. It cannot perform a 
save operation.

Stacktrace

PRIMARY THREAD THREAD 0

• 0 CoreFoundation 0x356212a3 __exceptionPreprocess + 163
• 1 libobjc.A.dylib 0x3393197f objc_exception_throw + 31
• 2 CoreData 0x36f2dfef -[NSPersistentStoreCoordinator 
executeRequest:withContext:error:] + 299
• 3 CoreData 0x36f862d3 -[NSManagedObjectContext save:] + 731

How can the persistent store not being existing? 

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.com

___

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

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

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

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