Re: Bookmark alias files v. Finder alias files

2012-04-14 Thread Shane Stanley
On 15/04/2012, at 3:26 AM, Charles Srstka wrote:

> the Finder has *two* such ‘icns’ resources; one with ID -16496 and one with 
> ID -16455. The two ‘icns’ resources appear to be identical, and if I subtract 
> the size of one of them from the Finder alias’s size, I get the size of the 
> NSURL-created alias. So I’d guess that the duplicate icon resources are the 
> reason for the discrepancy you’re seeing, and the alias files you’re creating 
> with NSURL aren’t lacking any important information.

Thanks, Charles. I guess that makes it arguably a Finder bug.

-- 
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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Sean McBride
On Sat, 14 Apr 2012 08:28:20 -0500, Michael Hall said:

>I did a quick google out of curiosity and there doesn't appear to be
>much available anymore to handle actually looking at or working with
>resource forks.

There's this:


-- 

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com 
Mac Software Developer  Montréal, Québec, Canada



___

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: Watching a variable in Xcode 4.3

2012-04-14 Thread Evadne Wu
That’s too bad.  Would you please post a minimal test case that crashes Xcode? 
-ev

On Apr 14, 2012, at 10:26 PM, Pascal Harris <45rpmli...@googlemail.com> wrote:

> Evadne,
> 
> I saw that before - sadly, it doesn't seem to work for me.  For a start, 
> Xcode (4.3.2) always crashes when I try this - and it doesn't matter whether 
> I try on my MacBook Air or my Mac Pro (with a fresh, clean, install of Xcode).
> 
> Most perplexing.
> 
> On 12 Apr 2012, at 20:50, Evadne Wu wrote:
> 
>> http://stackoverflow.com/questions/5632477/where-is-the-expression-window-in-xcode-4
>>  might help.
>> 
>> On Apr 13, 2012, at 3:02 AM, Pascal Harris <45rpmli...@googlemail.com> wrote:
>> 
>>> I've got the weirdest bug.  I have a matrix of views (iOS development, by 
>>> the way) and all of them work correctly except for the object at 0, 0.
>>> 
>>> The 0,0 view is initialised correctly, but loses its settings at some point 
>>> (although methods that don't rely on those settings still work - the view 
>>> hasn't been deallocated).
>>> 
>>> There is nothing in my code designed to alter these settings after 
>>> initialisation.  Clearly there's a bug - in order to hunt the bug down I 
>>> thought it'd be a good idea to set a break point when one of the variables 
>>> changes and then see what made the change.  My question is, how do I do 
>>> this in Xcode 4.3?  I'm sure I've done this in the past - but I can't 
>>> remember how!
>>> ___
>>> 
>>> 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/ev%40monoceroi.com
>>> 
>>> This email sent to e...@monoceroi.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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Charles Srstka
On Apr 13, 2012, at 6:54 PM, Shane Stanley wrote:

> I'm creating alias files using bookmark data, as in the docs:
> 
> NSData *bookmarkData = [url 
> bookmarkDataWithOptions:NSURLBookmarkCreationSuitableForBookmarkFile
>includingResourceValuesForKeys:nil
>relativeToURL:nil
>error:&error];
> 
> [NSURL writeBookmarkData:bookmarkData toURL:bookmarkURL options:0 
> error:&error];
> 
> When I look in the Finder, a Finder-created alias of the same file is listed 
> as 144KB, while the one I saved is 96KB. I'm curious about what's in that 
> extra 48KB.

I decided to have a look at this, so I created a couple of aliases to an empty 
folder, one from the Finder and one from NSURL. Just as you found, the Finder 
alias’s resource fork is larger than the NSURL alias’s. The ‘alis’ resources 
for both are the same size; however, the NSURL-created alias contains an ‘icns’ 
resource with ID -16496 storing the icon of the file to which the alias points, 
and the Finder has *two* such ‘icns’ resources; one with ID -16496 and one with 
ID -16455. The two ‘icns’ resources appear to be identical, and if I subtract 
the size of one of them from the Finder alias’s size, I get the size of the 
NSURL-created alias. So I’d guess that the duplicate icon resources are the 
reason for the discrepancy you’re seeing, and the alias files you’re creating 
with NSURL aren’t lacking any important information.

Charles

___

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: Xcode warns about missing protocol definition, even though @protocol is used

2012-04-14 Thread Kyle Sluder
On Apr 14, 2012, at 5:55 AM, Florian Pilz wrote:

> NewFooController.h:
>#import 
>@protocol NewFooControllerDelegate;
>@interface NewFooController : UITableViewController
>@property (nonatomic, weak) id delegate;
>@end
> 
>@protocol NewFooControllerDelegate
>@end
> 
> HomeTableViewController.h:
>#import 
>// warning points to line below
>@interface HomeTableViewController : UITableViewController 
> 
>@end


You never imported NewFooController.h here, so when the compiler is compiling 
something that imported HomeTableViewController.h, it can't find the @protocol 
definition.

--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: Opening a gap in NSTableView during drag and drop

2012-04-14 Thread Andrew Madsen

On Apr 14, 2012, at 1:31 AM, Quincey Morris wrote:

> On Apr 13, 2012, at 08:02 , Andrew Madsen wrote:
> 
>> I've got a simple, single-column, view-based NSTableView with items in it 
>> that can be dragged to reorder them. During drag and drop, I'd like to make 
>> it so that a gap for the item-to-be-dropped opens up at the location under 
>> the mouse. GarageBand does something like this when you drag to reorder 
>> tracks (video here: http://www.screencast.com/t/OmUVHcCNSl). As far as I can 
>> tell, there's no built in support for this in NSTableView.
> 
> I believe there is in fact support for this in Lion's table view. See, for 
> example, the NSTableView class reference for a description of the 
> 'NSTableViewAnimationEffectGap' constant.
> 
> I'd also recommend you watch the 2011 WWDC video on this topic. IIRC there 
> was a demo of this particular animation, and if you're lucky there will be 
> some sample code in the slides that you can plunder.
> 
> 

Thanks for the reply, Quincey. Indeed there is an NSTableViewAnimationEffectGap 
constant, and I use it in my current implementation. However, unless I've 
missed something, it is only used to create a animated gap after the mouse 
button is released to complete the drag, while the dragged item "flies" into 
place. Instead, I'm hoping to make it so that the gap opens up during the drag, 
and that its position changes as the user moves the dragged item around (as 
shown in the GarageBand video I linked to).

Thanks,
Andrew
___

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: Watching a variable in Xcode 4.3

2012-04-14 Thread Pascal Harris
Evadne,

I saw that before - sadly, it doesn't seem to work for me.  For a start, Xcode 
(4.3.2) always crashes when I try this - and it doesn't matter whether I try on 
my MacBook Air or my Mac Pro (with a fresh, clean, install of Xcode).

Most perplexing.

On 12 Apr 2012, at 20:50, Evadne Wu wrote:

> http://stackoverflow.com/questions/5632477/where-is-the-expression-window-in-xcode-4
>  might help.
> 
> On Apr 13, 2012, at 3:02 AM, Pascal Harris <45rpmli...@googlemail.com> wrote:
> 
>> I've got the weirdest bug.  I have a matrix of views (iOS development, by 
>> the way) and all of them work correctly except for the object at 0, 0.
>> 
>> The 0,0 view is initialised correctly, but loses its settings at some point 
>> (although methods that don't rely on those settings still work - the view 
>> hasn't been deallocated).
>> 
>> There is nothing in my code designed to alter these settings after 
>> initialisation.  Clearly there's a bug - in order to hunt the bug down I 
>> thought it'd be a good idea to set a break point when one of the variables 
>> changes and then see what made the change.  My question is, how do I do this 
>> in Xcode 4.3?  I'm sure I've done this in the past - but I can't remember 
>> how!
>> ___
>> 
>> 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/ev%40monoceroi.com
>> 
>> This email sent to e...@monoceroi.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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Shane Stanley
On 14/04/2012, at 11:28 PM, Michael Hall wrote:

> I did a quick google out of curiosity and there doesn't appear to be much 
> available anymore to handle actually looking at or working with resource 
> forks. If you can examine contents you could scan for the AppleEvent id's 
> 'alis' or 'bmrk'. You should of course also see a file name in there 
> somewhere. I'm not sure what other overhead there might be, length's maybe? 

The overwhelming bulk of the data seems to be repeated.

> If I had to guess the Finder is writing copies to both the resource and data 
> forks. Are you sure the ~96KB isn't both forks? 

Yes:

Shanes-iMac:~ shane$ ls -@l /Users/shane/Desktop/untitled\ folder 
total 480
-rw-r--r--@ 1 shane  shane  48296 14 Apr 21:55 key path samples copy.scpt alias 
5
com.apple.FinderInfo   32 
com.apple.ResourceFork  95212 
-rw-r--r--@ 1 shane  shane  48360 13 Apr 22:31 key path samples copy.scpt alias 
6
com.apple.FinderInfo   32 
com.apple.ResourceFork  47976 


-- 
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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Michael Hall

On Apr 14, 2012, at 7:11 AM, Shane Stanley wrote:

> Thanks Ken and Michael. So the Finder-generated alias has a ~96KB resource 
> fork, and the bookmark-generated one has a 48KB resource fork. On comparing 
> them, it looks like the first ~48KB are identical apart from the first and 
> last few bytes -- and the second 48KB of the Finder-generated one is also the 
> same as the first 48KB except for small sections at the beginning and end.

I did a quick google out of curiosity and there doesn't appear to be much 
available anymore to handle actually looking at or working with resource forks. 
If you can examine contents you could scan for the AppleEvent id's 'alis' or 
'bmrk'. You should of course also see a file name in there somewhere. I'm not 
sure what other overhead there might be, length's maybe? 
If I had to guess the Finder is writing copies to both the resource and data 
forks. Are you sure the ~96KB isn't both forks? I can't think of a reason to 
write it twice to the same fork. But I don't think that I ever dissected one.


___

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


Xcode warns about missing protocol definition, even though @protocol is used

2012-04-14 Thread Florian Pilz
Since I had a import-cycle recently, I'm moving all #import statements 
(concerning my own files) from the header into the corresponding .m-file. I 
also added @class and @protocol forward-declarations to soothe the compiler. 
However, I still get he following warning:

Cannot find the protocol definition for 'MyCustomDelegate'.

As I said, there is an @protocol MyCustomDelegate before I use it in the 
@interface-Block. Interestingly this warning only occurs if the corresponding 
delegate is declared in another file (whose header is imported in the .m-file).

I read that one solution is to declare the delegate in a separate header file 
and import that file directly in the header of the class that implements the 
delegate. Is this really the way to go? Are there any other solutions? I think 
those delegates already bloated our code enough, now I should go on and even 
declare an own file for it?

Small sample code to better illustrate the problem:

NewFooController.h:
#import 
@protocol NewFooControllerDelegate;
@interface NewFooController : UITableViewController
@property (nonatomic, weak) id delegate;
@end

@protocol NewFooControllerDelegate
@end

HomeTableViewController.h:
#import 
// warning points to line below
@interface HomeTableViewController : UITableViewController 

@end

HomeTableViewController.m:
#import "HomeTableViewController.h"
#import "NewFooController.h"
@implementation HomeTableViewController
@end


___

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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Shane Stanley
Thanks Ken and Michael. So the Finder-generated alias has a ~96KB resource 
fork, and the bookmark-generated one has a 48KB resource fork. On comparing 
them, it looks like the first ~48KB are identical apart from the first and last 
few bytes -- and the second 48KB of the Finder-generated one is also the same 
as the first 48KB except for small sections at the beginning and end.


-- 
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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Michael Hall

On Apr 14, 2012, at 5:05 AM, Ken Thomases wrote:

> You can also access the resource fork as a file by appending 
> "/..namedfork/rsrc" to the path.

Ken beat me to it after I found this...
Work with resource forks in the Terminal 
http://hints.macworld.com/article.php?story=2002022409532098

Ken could very well be right that it is using the resource fork in one instance 
and not the other.

I think for file alias's it actually stuck a 'alis' AppleEvent in the resource 
fork?
For example from http://en.wikipedia.org/wiki/Resource_fork

Name of resource type (actual name) Description
alis (alias)Stores an alias 
to another file, in a resource fork of a file whose "alias" attribute bit is set

One thing I was wondering about was that I remembered working on this code for 
open document handling...

if ( dirObjType == typeAlias) { // 'alis' ) {// open one 
file

  } else if ( dirObjType == typeAEList) {   // 'list' ) { // open 
many files
aliasHandle = (AliasHandle)NewHandle( 0L ); // get a real Handle; we'll 
resize as needed.
if ( NULL != aliasHandle ) {
int numItems = [dirObj numberOfItems];
docs = [[NSMutableArray alloc] initWithCapacity:numItems];
for ( i = 1; i <= numItems; i++ ) {
NSAppleEventDescriptor *thisAlias = [dirObj 
descriptorAtIndex:i];
if ([thisAlias descriptorType] != typeAlias)
// 10.6 bmrk?
thisAlias = [thisAlias 
coerceToDescriptorType:typeAlias];

At 10.6 I found that multiple open files started using the bmrk AppleEvent type 
that I coerced to typeAlias 'alis'.
while a single file still used the 'old' typeAlias.

Seeing yours I wondered if that might apply somehow. Yours using the 'bmrk' 
type written to either the data or resource fork while the Finder still uses 
'alis' to the resource fork?

___

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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Ken Thomases
On Apr 14, 2012, at 4:40 AM, Shane Stanley wrote:

> On 14/04/2012, at 6:23 PM, Ken Thomases wrote:
> 
>> The Finder-created one probably has a resource fork with additional data.  
>> That accounts for the size difference that isn't visible using "ls".  
>> Off-hand, I don't know what the resource fork data holds.
> 
> How do I see the resource forks, if not with ls?

You can see the names and sizes of extended attributes, of which the resource 
fork is one, using "ls -@".  You can read the extended attribute using "xattr".

You can also access the resource fork as a file by appending 
"/..namedfork/rsrc" to the path.

"du -h" shows me the total file size.  That includes the resource fork and it 
also accounts for the block size.  That is, it's really showing the disk space 
used, the physical size, not just the logical size of the file.

Also, keep in mind that Apple switched some time ago to using powers of 10 for 
disk space units.  So, in the Finder, KB == 1,000 bytes, not 1,024 bytes.  Some 
of the command line tools still powers of 2, depending on options.

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

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


Re: Bookmark alias files v. Finder alias files

2012-04-14 Thread Shane Stanley
On 14/04/2012, at 6:23 PM, Ken Thomases wrote:

> The Finder-created one probably has a resource fork with additional data.  
> That accounts for the size difference that isn't visible using "ls".  
> Off-hand, I don't know what the resource fork data holds.

How do I see the resource forks, if not with ls? 

And that still leaves 48KB unaccounted for, in that Terminal shows them both as 
~48KB, whereas Finder says one is 96KB and the other is 144KB. So if it is a 
resource fork issue, one has a 48KB resource fork, and the other 96KB. Seems 
odd to me.

And the original file was only about 10KB...

-- 
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: Bookmark alias files v. Finder alias files

2012-04-14 Thread Ken Thomases
On Apr 13, 2012, at 6:54 PM, Shane Stanley wrote:

> When I look in the Finder, a Finder-created alias of the same file is listed 
> as 144KB, while the one I saved is 96KB. I'm curious about what's in that 
> extra 48KB.
> 
> I had a look in Terminal and got this:
> 
> Shanes-iMac:~ shane$ ls -laoO /Users/shane/Desktop/untitled\ folder
> total 496
> drwxr-xr-x5 shane  -   170 14 Apr 08:44 .
> drwx--@ 310 shane  - 10540 14 Apr 08:44 ..
> -rw-r--r--@   1 shane  -  6148 14 Apr 08:44 .DS_Store
> -rw-r--r--@   1 shane  - 48296 13 Apr 22:16 key path samples copy.scpt alias 5
> -rw-r--r--@   1 shane  - 48360 13 Apr 22:31 key path samples copy.scpt alias 6
> 
> IOW, there's only 64 bytes difference between them -- meanwhile another 48KB 
> seems unaccounted for.
> 
> Does anyone have an explanation?

The Finder-created one probably has a resource fork with additional data.  That 
accounts for the size difference that isn't visible using "ls".  Off-hand, I 
don't know what the resource fork data holds.

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

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


Re: Opening a gap in NSTableView during drag and drop

2012-04-14 Thread Quincey Morris
On Apr 13, 2012, at 08:02 , Andrew Madsen wrote:

> I've got a simple, single-column, view-based NSTableView with items in it 
> that can be dragged to reorder them. During drag and drop, I'd like to make 
> it so that a gap for the item-to-be-dropped opens up at the location under 
> the mouse. GarageBand does something like this when you drag to reorder 
> tracks (video here: http://www.screencast.com/t/OmUVHcCNSl). As far as I can 
> tell, there's no built in support for this in NSTableView.

I believe there is in fact support for this in Lion's table view. See, for 
example, the NSTableView class reference for a description of the 
'NSTableViewAnimationEffectGap' constant.

I'd also recommend you watch the 2011 WWDC video on this topic. IIRC there was 
a demo of this particular animation, and if you're lucky there will be some 
sample code in the slides that you can plunder.


___

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