Re: How to tell if file wrapper represents package

2013-07-14 Thread Shane Stanley
On 14/07/2013, at 1:30 PM, Lee Ann Rucker  wrote:

> Haven't tried it, but [NSWorkspace isFilePackageAtPath:] looks like what you 
> want. If that's not sufficient, there are other things in NSWorkspace that 
> test files.

The problem, though, is that a file wrapper doesn't have a path.


-- 
Shane Stanley 
'AppleScriptObjC Explored' 



___

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

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

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

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

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

2013-07-14 Thread Peter
Hi,


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

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

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

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

Now here comes the interesting part:

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

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

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

I tried an approach adapted from code described at

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

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

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

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

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

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

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

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

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

Peter



___

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

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

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

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

Re: How to tell if file wrapper represents package

2013-07-14 Thread Mike Abdullah

On 14 Jul 2013, at 08:40, Shane Stanley  wrote:

> On 14/07/2013, at 1:30 PM, Lee Ann Rucker  wrote:
> 
>> Haven't tried it, but [NSWorkspace isFilePackageAtPath:] looks like what you 
>> want. If that's not sufficient, there are other things in NSWorkspace that 
>> test files.
> 
> The problem, though, is that a file wrapper doesn't have a path.

I think you have a couple of options, neither terribly satisfactory:

A) Use the .filename property to work your way through the wrappers and build 
up the expected URL/path of the file. Then query that to know if it's a package.

B) Grab NSFileSystemFileNumber from the package, and use it to locate the file 
on disk, querying that.
___

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

Please do not post 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 tell if file wrapper represents package

2013-07-14 Thread Kyle Sluder
On Jul 14, 2013, at 9:33 AM, Mike Abdullah  wrote:

> 
> On 14 Jul 2013, at 08:40, Shane Stanley  wrote:
> 
>> On 14/07/2013, at 1:30 PM, Lee Ann Rucker  wrote:
>> 
>>> Haven't tried it, but [NSWorkspace isFilePackageAtPath:] looks like what 
>>> you want. If that's not sufficient, there are other things in NSWorkspace 
>>> that test files.
>> 
>> The problem, though, is that a file wrapper doesn't have a path.
> 
> I think you have a couple of options, neither terribly satisfactory:
> 
> A) Use the .filename property to work your way through the wrappers and build 
> up the expected URL/path of the file. Then query that to know if it's a 
> package.

This sounds like the correct approach to me. Grab the file extension, call 
UTTypeCreatePreferredIdentifierForTag to convert it to a UTI, then call 
UTTypeConformsTo (or -[NSWorkspace type:conformsToType:]) to determine if the 
type confirms to kUTTypePackage.

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

Re: Cocoa-dev Digest, Vol 10, Issue 427

2013-07-14 Thread Pamela Grandt
I will be out of the office Fri. July 12

___

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

Please do not post 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 tell if file wrapper represents package

2013-07-14 Thread Mike Abdullah

On 14 Jul 2013, at 17:59, Kyle Sluder  wrote:

> On Jul 14, 2013, at 9:33 AM, Mike Abdullah  wrote:
> 
>> 
>> On 14 Jul 2013, at 08:40, Shane Stanley  wrote:
>> 
>>> On 14/07/2013, at 1:30 PM, Lee Ann Rucker  wrote:
>>> 
 Haven't tried it, but [NSWorkspace isFilePackageAtPath:] looks like what 
 you want. If that's not sufficient, there are other things in NSWorkspace 
 that test files.
>>> 
>>> The problem, though, is that a file wrapper doesn't have a path.
>> 
>> I think you have a couple of options, neither terribly satisfactory:
>> 
>> A) Use the .filename property to work your way through the wrappers and 
>> build up the expected URL/path of the file. Then query that to know if it's 
>> a package.
> 
> This sounds like the correct approach to me. Grab the file extension, call 
> UTTypeCreatePreferredIdentifierForTag to convert it to a UTI, then call 
> UTTypeConformsTo (or -[NSWorkspace type:conformsToType:]) to determine if the 
> type confirms to kUTTypePackage.

I have to admit, relying on file extension makes me uncomfortable, but maybe 
it's good enough.


___

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

Please do not post 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 tell if file wrapper represents package

2013-07-14 Thread Kyle Sluder
When it's the only information you have about the file, it's the best you can 
do.

Would be neat if there were a “UTI override” file attribute key, though.

--Kyle Sluder
(Sent from the road)

On Jul 14, 2013, at 12:39 PM, Mike Abdullah  wrote:

> 
> On 14 Jul 2013, at 17:59, Kyle Sluder  wrote:
> 
>> On Jul 14, 2013, at 9:33 AM, Mike Abdullah  wrote:
>> 
>>> 
>>> On 14 Jul 2013, at 08:40, Shane Stanley  wrote:
>>> 
 On 14/07/2013, at 1:30 PM, Lee Ann Rucker  wrote:
 
> Haven't tried it, but [NSWorkspace isFilePackageAtPath:] looks like what 
> you want. If that's not sufficient, there are other things in NSWorkspace 
> that test files.
 
 The problem, though, is that a file wrapper doesn't have a path.
>>> 
>>> I think you have a couple of options, neither terribly satisfactory:
>>> 
>>> A) Use the .filename property to work your way through the wrappers and 
>>> build up the expected URL/path of the file. Then query that to know if it's 
>>> a package.
>> 
>> This sounds like the correct approach to me. Grab the file extension, call 
>> UTTypeCreatePreferredIdentifierForTag to convert it to a UTI, then call 
>> UTTypeConformsTo (or -[NSWorkspace type:conformsToType:]) to determine if 
>> the type confirms to kUTTypePackage.
> 
> I have to admit, relying on file extension makes me uncomfortable, but maybe 
> it's good enough.
> 

___

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

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

To 'Pinch' or 'Rotate'

2013-07-14 Thread koko
Having just submitted my fist iPad app I am moving on to enhancements via 
Gestures.

 In making a sample app to get a handle on gestures I added Tap, Pinch and 
Rotate to a View.

Tap - works
Pinch - works
Rotate - calls Pinch … now I can understand  this since pinch is two fingers 
down as is rotate.

The Apple Simple Gesture example uses Swipe and Rrotate, no Pinch.  

So what is the proper approach to have Pinch and Rotate in the same view?

Oh, I better answer the obligatory "What is it you really want to do?" question.

Given a shape in the view I want to Pinch to resize it and Rotate to rotate it.

-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

Re: To 'Pinch' or 'Rotate'

2013-07-14 Thread Michael Crawford
I don't have the answer to your question, however I will point out
that gestures are hard to roll yourself because of "Switch Bounce".

That is, with my own two finger gesture, the number of finger contacts
is reported as 2,1,1,2,1,1,2,2,2,2,1,1,2 and so on.  When just one
finger contact is reported, which of my two fingers is contacting
alternates randomly.

I'll be posting some "debounce" source but first I have to factor it
out from the rest of my app.

Mike Crawford
mdcrawf...@gmail.com
Michael David Crawford
mdcrawf...@gmail.com
http://www.warplife.com/mdc/

   Available for Mobile Development in the Portland, Oregon Metropolitan Area.


On Sun, Jul 14, 2013 at 1:46 PM, koko  wrote:
> Having just submitted my fist iPad app I am moving on to enhancements via 
> Gestures.
>
>  In making a sample app to get a handle on gestures I added Tap, Pinch and 
> Rotate to a View.
>
> Tap - works
> Pinch - works
> Rotate - calls Pinch … now I can understand  this since pinch is two fingers 
> down as is rotate.
>
> The Apple Simple Gesture example uses Swipe and Rrotate, no Pinch.
>
> So what is the proper approach to have Pinch and Rotate in the same view?
>
> Oh, I better answer the obligatory "What is it you really want to do?" 
> question.
>
> Given a shape in the view I want to Pinch to resize it and Rotate to rotate 
> it.
>
> -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/mdcrawford%40gmail.com
>
> This email sent to mdcrawf...@gmail.com

___

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

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

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

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

Re: How to tell if file wrapper represents package

2013-07-14 Thread Shane Stanley
On 15/07/2013, at 2:59 AM, Kyle Sluder  wrote:

> This sounds like the correct approach to me. Grab the file extension, call 
> UTTypeCreatePreferredIdentifierForTag to convert it to a UTI, then call 
> UTTypeConformsTo (or -[NSWorkspace type:conformsToType:]) to determine if the 
> type confirms to kUTTypePackage.

Thanks -- that does the job nicely.

I'm curious about how I'd use Mike's Plan B, working back from 
NSFileSystemFileNumber, though.

-- 
Shane Stanley 
'AppleScriptObjC Explored' 


___

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

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

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

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

Re: To 'Pinch' or 'Rotate'

2013-07-14 Thread koko

On Jul 14, 2013, at 4:19 PM, Michael Crawford  wrote:

>  gestures are hard to roll yourself

Hmm, I am not rolling my own … I drag them to the view in IB and them make 
outlets and actions.

___

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

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

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

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

NSTableView don't show content

2013-07-14 Thread Folami Nguyen
Dear All,
In MAC OS 10.6.8, I use NSTableView with CALayer enabled.
Everything OK. However, sometime, all NSTableView in my application doesn't
show data. I can click on the row but I cannot see it.
Please help me how to fix it.
Thanks you very much.
Best regards,
___

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

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