iTunes 10.4 plugin API

2011-07-21 Thread Jonathan del Strother
Hi,
I've been struggling to find any information on writing visualizers
for iTunes 10.4.  Is there a modern equivalent of the venerable
TN2016?

-Jonathan
___

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: Writing global preferences file into /Library/Preferences (OS X Lion)

2011-07-21 Thread vincent habchi
Le 21 juil. 2011 à 07:24, Peter C a écrit :

> Vincent, I meant changing to write to ~/Library/Preferences, user directory.

Ah, okay. But do not forget to use the proper API to get the ad hoc ROOT 
directory!
Vincent___

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


Subject: Re: Smooth resizing of a text field

2011-07-21 Thread Duncan Champney
On 20 Jul 2011, at 2:30 PM, Gabriel Roth wrote:


> My application displays a non-editable text string in an NSTextField. When
> the user adjusts a slider, the entire window and all its subviews—including
> this text field—should resize smoothly.
> 
> My first thought was to bind the font size of the text field to a property
> and have that property set to a fixed ratio of the window's size, resetting
> it whenever the window size changes. But when I implement this, the text
> jiggles around as it's resized.
> 
> My next thought was to convert the text field into an image (at some large
> font size) and then scale the image up and down as the slider moves. But I
> can't figure out how to create an image from a text field (or otherwise
> generate an image of a string of text in a given font).
> 
> Any thoughts on what avenue to pursue would be much appreciated.
> 
> gr.


This sounds like a perfect fit for Core Animation.

Figure out which field(s) need to be resized.

Then use code like this:

myTextField.wantsLayer = TRUE; //Set up a CA Layer for this field.
myTextField.layer.transform = CATransform3DMakeScale(1.5, 1.5); //Scale the 
text field to 150%

By default, it should grow/shrink from the center of it's bounding rectangle. 
If you want it to grow/shrink (or rotate, or whatever) from a different point, 
set the anchorPoint property of the layer.

If you want to change the duration of the animation from the default (0.25 sec) 
, or change the animation timing from the default of ease in, ease out, put the 
layer changes inside a CATransaction:

myTextField.wantsLayer = TRUE; //Set up a CA Layer for this field.

[CATransaction begin];
[CATransaction setAnimationDuration: 0.1];  //Change the duration to .1 
seconds
[CATransaction setAnimationTimingFunction: kCAMediaTimingFunctionLinear];  
//Change the timing to linear
myTextField.layer.transform = CATransform3DMakeScale(1.5, 1.5); //Scale the 
text field to 150%
[CATransaction commit];


Disclaimer: I don't think I've actually used CATransaction exactly as shown 
above. I pulled this from the documentation, and haven't tested it.

You could also set up an animator proxy to do this, or create a 
CABasicAnimation on the layer.


Regards,

Duncan Champney
WareTo  ___

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

2011-07-21 Thread Gregory Weston
Please point me to another list if there's one more appropriate.

Seems that my iTunes visualizer doesn't work in Lion. Works fine in iTunes 10.4 
under Snow Leopard. Under Lion 64-bit it of course completely fails to load. If 
I start iTunes in 32-bit mode it doesn't complain or log anything but also 
doesn't seem to work. Is there anything like a modern SDK or documentation for 
iTunes visualizers?

Thanks.

Greg
___

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


core data migration - delete old store

2011-07-21 Thread Roland King
I suppose I had to get to core data migration one day … :(

I've read the documentation a couple of times and it says that the default 
migration process finishes by renaming the old store to the same thing with a 
tilde prefix. Does that mean you, the programmer, are responsible for deleting 
it again afterwards or is there a piece I've missed where eventually it does 
get cleaned up? I was thinking that if you use automatic migration, you don't 
even know when the store has been migrated and that you should thus go look for 
a tilde version and remove it. If that's the case I wondered how many apps have 
upgraded their core data stores and left the old one sitting there taking up 
the same amount of space. ___

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

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

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

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


Re: core data migration - delete old store

2011-07-21 Thread Dave Fernandes
Yes, if you want the file deleted you have to do it yourself. There are 
certainly cases where you would not want to delete the file. For example for a 
document, the user may want to keep that archive around in case they need to 
revert to a previous version of the app, or share it with someone else. In that 
case, they should be informed when the file is going to be migrated, and they 
should be the one to delete the old version.

You can check whether the store needs to be migrated using 
-[NSManagedObjectModel isConfiguration:compatibleWithStoreMetadata:]; first get 
the current model and then check whether it is compatible with metadata from 
the store you want to open.

Lightweight migration also cannot handle all types of model changes. So, when 
you start to support multiple model versions, it might be a good idea to check 
if you *can* migrate from version x to version y using +[NSMappingModel 
inferredMappingModelForSourceModel:destinationModel:error:]. You may end up 
with cases where you have to use your own mapping model for some migrations.

Dave

On 2011-07-21, at 8:31 AM, Roland King wrote:

> I suppose I had to get to core data migration one day … :(
> 
> I've read the documentation a couple of times and it says that the default 
> migration process finishes by renaming the old store to the same thing with a 
> tilde prefix. Does that mean you, the programmer, are responsible for 
> deleting it again afterwards or is there a piece I've missed where eventually 
> it does get cleaned up? I was thinking that if you use automatic migration, 
> you don't even know when the store has been migrated and that you should thus 
> go look for a tilde version and remove it. If that's the case I wondered how 
> many apps have upgraded their core data stores and left the old one sitting 
> there taking up the same amount of space. 
> ___
> 
> 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/dave.fernandes%40utoronto.ca
> 
> This email sent to dave.fernan...@utoronto.ca

___

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


Native Cocoa API for iTunes?

2011-07-21 Thread bradgibbs

Hi,

I've been using Scripting Bridge in one of my apps.  Now that iTunes is a 
native Cocoa app, I'm wondering what effect this is going to have on Scripting 
Bridge compatibility, and whether there is or will be a new API for interacting 
with and controlling iTunes?  Google and documentation searches have not borne 
fruit.


Thanks.

Brad___

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


Help with Secondary UINavigationController

2011-07-21 Thread Fluffy D. Bunny
Hi All,

I have an application here that loads (pushes) a view during the users
navigation experience. This new view is split screen like so:



|CONTENT   |
|_|
|  |
|SUBVIEW   |
|_|

I need a new navigation controller to control the subview, but no matter how
I do it the controller takes over the entire screen, even through I have set
it's view to the subview.

Does anyone know how to do this?

Thanks

FdB
___

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


Lion changes

2011-07-21 Thread Leonardo
Hi,
while on MacOs X 10.6 and earlier this piece of code worked properly, on
Lion I get a different result (bug).
I have to take the MacAddress en0. May you please tell me where I do wrong?
 
   NSString *tempFilePath = @"/Users/john/OutCocoa.txt";
   NSString *commandLine = [NSString stringWithFormat:@"/sbin/ifconfig en0 |
grep ether | cut -d' ' -f 2 > \"%@\" 2>&1", tempFilePath];
   sprintf(cmd, "/bin/sh -c %s", [commandLine UTF8String]);
 
On Leopard this code returned the true en0 (good).
On Lion this code returns 3 MacAddresses, where the en0 is the 3rd one
(bug). I have fixed the bug just deleting the "/bin/sh -c " in front of the
command, this way:
   sprintf(cmd, "%s", [commandLine UTF8String]);
 
So now on Lion it works well too. My questions are:
1) Will it work well on any machine?
2) Will it work well on Leopard too?
3) Why do I get the bug on Lion only?
 
Of course I am getting a lot of troubles with machines who are trying to run
my app on Lion today...


Regards
-- Leonardo


___

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

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

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

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


Re: Lion changes

2011-07-21 Thread Gary L. Wade
Rather than using other processes, look into the System Configuration framework.

- Gary L. Wade (Sent from my iPhone)

On Jul 21, 2011, at 8:28 AM, Leonardo  wrote:

> Hi,
> while on MacOs X 10.6 and earlier this piece of code worked properly, on
> Lion I get a different result (bug).
> I have to take the MacAddress en0. May you please tell me where I do wrong?
> 
>   NSString *tempFilePath = @"/Users/john/OutCocoa.txt";
>   NSString *commandLine = [NSString stringWithFormat:@"/sbin/ifconfig en0 |
> grep ether | cut -d' ' -f 2 > \"%@\" 2>&1", tempFilePath];
>   sprintf(cmd, "/bin/sh -c %s", [commandLine UTF8String]);
> 
> On Leopard this code returned the true en0 (good).
> On Lion this code returns 3 MacAddresses, where the en0 is the 3rd one
> (bug). I have fixed the bug just deleting the "/bin/sh -c " in front of the
> command, this way:
>   sprintf(cmd, "%s", [commandLine UTF8String]);
> 
> So now on Lion it works well too. My questions are:
> 1) Will it work well on any machine?
> 2) Will it work well on Leopard too?
> 3) Why do I get the bug on Lion only?
> 
> Of course I am getting a lot of troubles with machines who are trying to run
> my app on Lion today...
> 
> 
> Regards
> -- Leonardo
___

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

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

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

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


Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Chris Tracewell
I have a private framework that is included in a project. Many of the project 
classes descend from a class in the framework. All of these descendent classes 
implement copyWithZone, encodeWithCoder and initWithCoder and thus respectively 
calls each on super. I get warnings stating that "MySuperClass may not respond 
to -copyWithZone" and so on. I do declare each of these methods in super's 
header file, so why might these errors be getting triggered?

Thanks


--Chris___

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

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

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

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


Re: core data migration - delete old store

2011-07-21 Thread Roland King
Great - thanks for this - gets me started, I've found the documentation quite 
dense and soon I have to pitch in and just give it a go (I have a model I need 
to update in my test app and I really don't want to toss the data). 

I need to hunt around the NSManagedObjectModel class a bit more, clearly, there 
are methods there I don't know enough about. I assume there are ways to 
enumerate the models in the bundle, figure out which one is the 'current' one 
and which one may match the store, will go read the class docs when they've 
finished d/l'ing. I saw some of the methods for making an on-the-fly migration, 
I'll try those out too see if they work. 

I think lightweight is going to do it for this change. One attribute deleted, 
one entity added, one mapping added, one attribute added (with a  default). 
It's not a bad way to get my feet wet with migration actually, I can afford to 
bungle it up, I can save the sqlite file before I start and give it few cracks. 
Ok that's the weekend!

On Jul 21, 2011, at 9:35 PM, Dave Fernandes wrote:

> Yes, if you want the file deleted you have to do it yourself. There are 
> certainly cases where you would not want to delete the file. For example for 
> a document, the user may want to keep that archive around in case they need 
> to revert to a previous version of the app, or share it with someone else. In 
> that case, they should be informed when the file is going to be migrated, and 
> they should be the one to delete the old version.
> 
> You can check whether the store needs to be migrated using 
> -[NSManagedObjectModel isConfiguration:compatibleWithStoreMetadata:]; first 
> get the current model and then check whether it is compatible with metadata 
> from the store you want to open.
> 
> Lightweight migration also cannot handle all types of model changes. So, when 
> you start to support multiple model versions, it might be a good idea to 
> check if you *can* migrate from version x to version y using +[NSMappingModel 
> inferredMappingModelForSourceModel:destinationModel:error:]. You may end up 
> with cases where you have to use your own mapping model for some migrations.
> 
> Dave
> 
> On 2011-07-21, at 8:31 AM, Roland King wrote:
> 
>> I suppose I had to get to core data migration one day … :(
>> 
>> I've read the documentation a couple of times and it says that the default 
>> migration process finishes by renaming the old store to the same thing with 
>> a tilde prefix. Does that mean you, the programmer, are responsible for 
>> deleting it again afterwards or is there a piece I've missed where 
>> eventually it does get cleaned up? I was thinking that if you use automatic 
>> migration, you don't even know when the store has been migrated and that you 
>> should thus go look for a tilde version and remove it. If that's the case I 
>> wondered how many apps have upgraded their core data stores and left the old 
>> one sitting there taking up the same amount of space. 
>> ___
>> 
>> 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/dave.fernandes%40utoronto.ca
>> 
>> This email sent to dave.fernan...@utoronto.ca
> 
> ___
> 
> 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/rols%40rols.org
> 
> This email sent to r...@rols.org

___

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


Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Ross Carter
I'm looking for ideas on what might cause this behavior: an existing app that 
was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
document windows (and their window controllers and NSDocuments) do not get 
released when the window is closed.

All thoughts appreciated.
___

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: Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Nick Zitzmann

On Jul 21, 2011, at 9:51 AM, Chris Tracewell wrote:

> I have a private framework that is included in a project. Many of the project 
> classes descend from a class in the framework. All of these descendent 
> classes implement copyWithZone, encodeWithCoder and initWithCoder and thus 
> respectively calls each on super. I get warnings stating that "MySuperClass 
> may not respond to -copyWithZone" and so on. I do declare each of these 
> methods in super's header file, so why might these errors be getting 
> triggered?


I don't know whether it will make a difference or not, but one thing you ought 
to try is instead of declaring the methods in the header file, you should 
declare the class's compliance with the proper protocols (NSCopying and 
NSCoding in this case). That's the proper way of declaring support for copying 
and coding. It's a little different from C++, you see.

Nick Zitzmann


___

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: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Joanna Carter
Le 21 juil. 2011 à 17:29, Ross Carter a écrit :

> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.
> 
> All thoughts appreciated.

Just a long shot, but does this have anything to do with the new ARC (Automatic 
Reference Counting)?

Joanna

--
Joanna Carter
Carter Consulting

___

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

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

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

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


Re: Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Philip Dow
NSCopying is a protocol, likewise NSCoding. Have you declared that your class 
implements the protocol in the header file, for example:

@interface MySuperClass : NSObject  {
...
}
...
@end

~Phil

On Jul 21, 2011, at 10:51 AM, Chris Tracewell wrote:

> I have a private framework that is included in a project. Many of the project 
> classes descend from a class in the framework. All of these descendent 
> classes implement copyWithZone, encodeWithCoder and initWithCoder and thus 
> respectively calls each on super. I get warnings stating that "MySuperClass 
> may not respond to -copyWithZone" and so on. I do declare each of these 
> methods in super's header file, so why might these errors be getting 
> triggered?
> 
> Thanks
> 
> 
> --Chris___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/dev%40getsprouted.com
> 
> This email sent to d...@getsprouted.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: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Nick Zitzmann

On Jul 21, 2011, at 10:29 AM, Ross Carter wrote:

> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.
> 
> All thoughts appreciated.

Have you used Instruments to find out why? If not, then use the object alloc 
instrument with reference counting turned on. Then look at your window objects 
and try and figure out where the extra retain is happening.

Nick Zitzmann


___

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: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread vincent habchi
> I'm looking for ideas on what might cause this behavior: an existing app that 
> was compiled with 10.6 SDK runs fine on 10.6 and 10.5. When run on 10.7, 
> document windows (and their window controllers and NSDocuments) do not get 
> released when the window is closed.

NSDocuments on 10.7 are supposed to be restorable (beyond automatic saving of 
documents). Could it be linked to that?

Vincent___

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: Dismissing a Popover Internally

2011-07-21 Thread Gordon Apple
After running into difficulties in the second method I proposed, I decided
that the best universal solution was to subclass UIViewController
(POViewController), add an ivar for the popover, and add methods to dismiss
and change height (mainly for dynamically matching table content and for
rotation).  Then subclass any root popover viewController from
POViewController.  Then I can always get access from
(POViewController*)[self.navigationController.viewControllers
objectAtIndex:0].  Because I have a lot of popovers and only need access in
a few places, I felt this was a better solution than passing the reference
down the line to everyone.


On 7/20/11 2:30 PM, "Matt Neuburg"  wrote:

> On Wed, 20 Jul 2011 12:32:07 -0500, Gordon Apple  said:
>> UIPopoverController has a UINavigationController.  Is there any decent way
>> to access the UIPopoverController inside a popover view to dismiss it?
> 
> If I understand the question, then basically, no - and it's maddening. On the
> one hand you're told that only one popover should be showing at any one
> moment. On the other hand you don't automatically get a reference to that
> popover. Thus it is up to you to store a reference, manually, to the current
> popover controller at the time it shows its popover, so that you can talk to
> it later in order to dismiss it. Popover controller management can thus get
> really elaborate and clumsy; you're doing all kinds of work that the system
> should just be doing for you.
> 
> iOS is funny this way. I'm reminded of how there's no call in iOS 4 that tells
> you current first responder. Obviously the system knows what the first
> responder is, so why won't it tell you? It's kind of dumb. This is similar;
> the system clearly knows useful stuff it won't share with you. 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


Re: Lion changes

2011-07-21 Thread vincent habchi
Hi,

>   NSString *tempFilePath = @"/Users/john/OutCocoa.txt";
>   NSString *commandLine = [NSString stringWithFormat:@"/sbin/ifconfig en0 |
> grep ether | cut -d' ' -f 2 > \"%@\" 2>&1", tempFilePath];
>   sprintf(cmd, "/bin/sh -c %s", [commandLine UTF8String]);

Quote the command. 
sprintf (cmd, "/bin/sh -c \"%s\"", [commandLine UTF8String]);

But anyhow, as somebody pointed out, there are far better ways to get the MAC 
address of the en0 port than executing BSD commands in a subprocess.

Vincent___

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: Dismissing a Popover Internally

2011-07-21 Thread Matt Neuburg

On Jul 21, 2011, at 10:23 AM, Gordon Apple wrote:

> After running into difficulties in the second method I proposed, I decided
> that the best universal solution was to subclass UIViewController
> (POViewController), add an ivar for the popover

Right, that's the sort of thing I meant by "store a reference".

Another trick I use is to subclass UIPopoverController just so as to have a way 
to distinguish one popover from another.

As I said, in my view none of this should be necessary. m.

> 
> 
> On 7/20/11 2:30 PM, "Matt Neuburg"  wrote:
> 
>> On Wed, 20 Jul 2011 12:32:07 -0500, Gordon Apple  said:
>>> UIPopoverController has a UINavigationController.  Is there any decent way
>>> to access the UIPopoverController inside a popover view to dismiss it?
>> 
>> If I understand the question, then basically, no - and it's maddening. On the
>> one hand you're told that only one popover should be showing at any one
>> moment. On the other hand you don't automatically get a reference to that
>> popover. Thus it is up to you to store a reference, manually, to the current
>> popover controller at the time it shows its popover, so that you can talk to
>> it later in order to dismiss it. Popover controller management can thus get
>> really elaborate and clumsy; you're doing all kinds of work that the system
>> should just be doing for you.
>> 
>> iOS is funny this way. I'm reminded of how there's no call in iOS 4 that 
>> tells
>> you current first responder. Obviously the system knows what the first
>> responder is, so why won't it tell you? It's kind of dumb. This is similar;
>> the system clearly knows useful stuff it won't share with you. m.

___

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


Timing some code execution outside Instruments

2011-07-21 Thread Eric E. Dolecki
I'm curious if there is a way to NSLog how long some code takes to execute
(outside of using Instruments).

In Flash one can use getTimer and see how much time passed inline. Is there
a way to do this in Obj-C?

Would one use a NSDate object?




  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net
___

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

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

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

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


problem with dataWithContentsOfFile on Lion

2011-07-21 Thread Wilker
Hi guys,

I updated to Lion yesterday, but I'm having an issue now with [NSData
dataWithContentsOfFile]

This code is to generate a hash based on 64kb of start and 64kb of end from
a file:

   + (NSString *)generateHashFromPath:(NSString *)path

{

const NSUInteger CHUNK_SIZE = 65536;



NSError *error = nil;

NSData *fileData = [NSData dataWithContentsOfFile:path options:
NSDataReadingMapped | NSDataReadingUncached error:&error];



if (error) {

return nil;

}



const uint8_t* buffer = [fileData bytes];



NSUInteger byteLength = [fileData length];

NSUInteger byteOffset = 0;



if (byteLength > CHUNK_SIZE) {

byteOffset = byteLength - CHUNK_SIZE;

byteLength = CHUNK_SIZE;

}



CC_MD5_CTX md5;

CC_MD5_Init(&md5);



CC_MD5_Update(&md5, buffer, (CC_LONG) byteLength);

CC_MD5_Update(&md5, buffer + byteOffset, (CC_LONG) byteLength);



unsigned char digest[CC_MD5_DIGEST_LENGTH];



CC_MD5_Final(digest, &md5);



NSMutableString *hexDigest = [NSMutableString stringWithCapacity:
CC_MD5_DIGEST_LENGTH * 2];



for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {

[hexDigest appendFormat:@"%02x", digest[i]];

}



return [hexDigest lowercaseString];

}

Before Lion, it really works well and fast, even on Wifi external drive
(through Airport Extreme), but now it get's really slow... I did some
checks, and now its reading the entire file... instead of just read 128kb
(start and end). Anyone have an ideia on why its happening now? And how to
make it works as before on Snow Leopard?
---
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: Timing some code execution outside Instruments

2011-07-21 Thread Howard Siegel
Yes

On Thu, Jul 21, 2011 at 10:59, Eric E. Dolecki  wrote:

> I'm curious if there is a way to NSLog how long some code takes to execute
> (outside of using Instruments).
>
> In Flash one can use getTimer and see how much time passed inline. Is there
> a way to do this in Obj-C?
>
> Would one use a NSDate object?
>
>
___

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: problem with dataWithContentsOfFile on Lion

2011-07-21 Thread Kevin Perry
Please check the NSData.h header and Foundation release notes for Lion.

Because mapping files on non-local drives (which may be disconnected or removed 
at any moment, resulting in a crash if you attempt to access parts of the file 
that haven't been faulted in) is unsafe, NSData on Lion has changed the meaning 
of NSDataReadingMapped to be a "hint" (see NSDataReadingMappedIfSafe). It will 
only map the file if it detects that doing so is safe.

If you are willing to accept the risk of mapping "unsafe" files, simply pass 
NSDataReadingMappedAlways instead of NSDataReadingMapped.

-KP

On Jul 21, 2011, at 11:01 AM, Wilker wrote:

> Hi guys,
> 
> I updated to Lion yesterday, but I'm having an issue now with [NSData
> dataWithContentsOfFile]
> 
> This code is to generate a hash based on 64kb of start and 64kb of end from
> a file:
> 
>   + (NSString *)generateHashFromPath:(NSString *)path
> 
> {
> 
>const NSUInteger CHUNK_SIZE = 65536;
> 
> 
> 
>NSError *error = nil;
> 
>NSData *fileData = [NSData dataWithContentsOfFile:path options:
> NSDataReadingMapped | NSDataReadingUncached error:&error];
> 
> 
> 
>if (error) {
> 
>return nil;
> 
>}
> 
> 
> 
>const uint8_t* buffer = [fileData bytes];
> 
> 
> 
>NSUInteger byteLength = [fileData length];
> 
>NSUInteger byteOffset = 0;
> 
> 
> 
>if (byteLength > CHUNK_SIZE) {
> 
>byteOffset = byteLength - CHUNK_SIZE;
> 
>byteLength = CHUNK_SIZE;
> 
>}
> 
> 
> 
>CC_MD5_CTX md5;
> 
>CC_MD5_Init(&md5);
> 
> 
> 
>CC_MD5_Update(&md5, buffer, (CC_LONG) byteLength);
> 
>CC_MD5_Update(&md5, buffer + byteOffset, (CC_LONG) byteLength);
> 
> 
> 
>unsigned char digest[CC_MD5_DIGEST_LENGTH];
> 
> 
> 
>CC_MD5_Final(digest, &md5);
> 
> 
> 
>NSMutableString *hexDigest = [NSMutableString stringWithCapacity:
> CC_MD5_DIGEST_LENGTH * 2];
> 
> 
> 
>for (int i = 0; i < CC_MD5_DIGEST_LENGTH; i++) {
> 
>[hexDigest appendFormat:@"%02x", digest[i]];
> 
>}
> 
> 
> 
>return [hexDigest lowercaseString];
> 
> }
> 
> Before Lion, it really works well and fast, even on Wifi external drive
> (through Airport Extreme), but now it get's really slow... I did some
> checks, and now its reading the entire file... instead of just read 128kb
> (start and end). Anyone have an ideia on why its happening now? And how to
> make it works as before on Snow Leopard?
> ---
> 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/kperry%40apple.com
> 
> This email sent to kpe...@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: problem with dataWithContentsOfFile on Lion

2011-07-21 Thread Ken Thomases
On Jul 21, 2011, at 1:01 PM, Wilker wrote:

> I updated to Lion yesterday, but I'm having an issue now with [NSData
> dataWithContentsOfFile]

> Before Lion, it really works well and fast, even on Wifi external drive
> (through Airport Extreme), but now it get's really slow... I did some
> checks, and now its reading the entire file... instead of just read 128kb
> (start and end). Anyone have an ideia on why its happening now? And how to
> make it works as before on Snow Leopard?

>From the Foundation release notes 
>:

> Safe File Mapping for NSData
> Before Mac OS 10.7, specifying NSDataReadingMapped (or NSMappedRead) for 
> -initWithContentsOfFile:options:error: would cause NSData to always attempt 
> to map in the specified file. However, in some situations, mapping a file can 
> be dangerous. For example, when NSData maps a file from a USB device or over 
> the network the existence of said file can't be guaranteed for the lifetime 
> of the object. Accessing the NSData's bytes after the mapped file disappears 
> will likely cause unpredictable crashes in your application.
> 
> For applications linked on Mac OS 10.7 or later, NSDataReadingMapped will now 
> only map the requested file if it can determine that mapping the file will be 
> relatively safe. To reflect this change, NSDataReadingMapped has been 
> deprecated and is now an alias for NSDataReadingMappedIfSafe.
> 
> The methods -dataWithContentsOfMappedFile: and -initWithContentsOfMappedFile: 
> have been deprecated. In the very rare event that your application needs to 
> map a file regardless of safety, you may use the NSDataReadingMappedAlways 
> option.

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

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


Re: Timing some code execution outside Instruments

2011-07-21 Thread vincent habchi
> I'm curious if there is a way to NSLog how long some code takes to execute
> (outside of using Instruments).
> 
> In Flash one can use getTimer and see how much time passed inline. Is there
> a way to do this in Obj-C?

You can use the basic old std C routines like clock ().

Vincent
___

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


Can keypaths contain array indexes?

2011-07-21 Thread Jens Alfke
I’ve got a data model that looks sort of like this (expressed as JSON):
[{“uuid": “abcdef”, “name": [“Fred”, “Smith”]} … ]
I want to bind an array of these to an NSTableView, with the first and last 
name in different columns. So I need to create a keypath that refers to the 
first or second element of the array value of the “name” property.

Is this possible? I’ve looked through the docs and can’t find anything about 
it. I’ve guessed at paths like
name.0
or
name[0]
but they throw exceptions at runtime.

(And no, I can’t change the schema to avoid having an array. It’s part of the 
way the data comes back from the server.)

—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: Lion changes

2011-07-21 Thread Richard Somers
On Jul 21, 2011, at 11:33 AM, vincent habchi wrote:

> But anyhow, as somebody pointed out, there are far better ways to get the MAC 
> address of the en0 port than executing BSD commands in a subprocess.


Apple sample code GetPrimaryMACAddress works well with Lion.

 http://developer.apple.com/library/mac/#samplecode/GetPrimaryMACAddress/

--Richard

___

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: Can keypaths contain array indexes?

2011-07-21 Thread Kyle Sluder
On Thu, Jul 21, 2011 at 12:08 PM, Jens Alfke  wrote:
> I’ve got a data model that looks sort of like this (expressed as JSON):
>        [{“uuid": “abcdef”, “name": [“Fred”, “Smith”]} … ]
> I want to bind an array of these to an NSTableView, with the first and last 
> name in different columns. So I need to create a keypath that refers to the 
> first or second element of the array value of the “name” property.
>
> Is this possible? I’ve looked through the docs and can’t find anything about 
> it. I’ve guessed at paths like
>        name.0
> or
>        name[0]
> but they throw exceptions at runtime.

Think about this for a second: this would involve creating an observer
on [someArray valueForKeyPath:@"0"]. We know that NSArray is not KVO
compliant, since its implementation of -addObserver:… is documented to
raise an exception. Therefore this can't work. :)

> (And no, I can’t change the schema to avoid having an array. It’s part of the 
> way the data comes back from the server.)

Can you bind the entire "name" property and use a value transformer
that extracts the desired component from the array?

--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: Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Chris Tracewell
On Jul 21, 2011, at 9:33 AM, Nick Zitzmann wrote:

> 
> On Jul 21, 2011, at 9:51 AM, Chris Tracewell wrote:
> 
>> I have a private framework that is included in a project. Many of the 
>> project classes descend from a class in the framework. All of these 
>> descendent classes implement copyWithZone, encodeWithCoder and initWithCoder 
>> and thus respectively calls each on super. I get warnings stating that 
>> "MySuperClass may not respond to -copyWithZone" and so on. I do declare each 
>> of these methods in super's header file, so why might these errors be 
>> getting triggered?
> 
> 
> I don't know whether it will make a difference or not, but one thing you 
> ought to try is instead of declaring the methods in the header file, you 
> should declare the class's compliance with the proper protocols (NSCopying 
> and NSCoding in this case). That's the proper way of declaring support for 
> copying and coding. It's a little different from C++, you see.
> 
> Nick Zitzmann
> 

Nick,

Thanks, that did it. Added the protocol declarations in the interface and it 
cleared things up. For future reference you need to add the declaration of 
protocol conformity like so...

@interface MyClass : NSObject 

You can comma separate multiple protocols.


--Chris___

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

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

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

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


Re: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Ross Carter
> Just a long shot, but does this have anything to do with the new ARC 
> (Automatic Reference Counting)?

Joanna: The app uses GC, and was built long before ARC was announced. 
Everything gets collected on 10.6. I'm puzzled how ARC could affect GC.


> Have you used Instruments to find out why? If not, then use the object alloc 
> instrument with reference counting turned on. Then look at your window 
> objects and try and figure out where the extra retain is happening.


Nick: It's a GC app, so -retain is a no-op. My Instruments foo is not strong. 
What tool will show why an object is not getting collected?


> NSDocuments on 10.7 are supposed to be restorable (beyond automatic saving of 
> documents). Could it be linked to that?


vincent: Good idea, but I would expect that restorable documents are saved on 
disk and not retained in memory. 

Ross
___

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: Writing global preferences file into /Library/Preferences (OS X Lion)

2011-07-21 Thread Greg Guerin

Peter C wrote:

Graham, I used to store serial number codes for all users, in this  
directory.


Looks like I have change it to save it user library directory.



The /Users/Shared/ directory is public-writable, with sticky-bit set  
(unless that changed in Lion, too).  See 'man sticky' for an  
explanation of the sticky-bit.  See the sample code CFPrefTopScores  
for example code.


The convention is to create a sub-directory there, not write files  
directly into /Users/Shared/.  If you put a globally readable file  
there, and you want any user to be able to modify it, be sure to  
apply the correct permissions to the sub-dir and to the prefs file  
itself.


  -- GG

___

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: problem with dataWithContentsOfFile on Lion

2011-07-21 Thread Greg Guerin

Wilker wrote:

Before Lion, it really works well and fast, even on Wifi external  
drive

(through Airport Extreme), but now it get's really slow... I did some
checks, and now its reading the entire file... instead of just read  
128kb
(start and end). Anyone have an ideia on why its happening now? And  
how to

make it works as before on Snow Leopard?



You could use fopen(), fseek(), fread(), fclose().

Who knows, it might even be faster, since it doesn't have to call mmap 
().  Worst case, you call mmap() yourself.


  -- GG
___

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: Printing options

2011-07-21 Thread davelist

On Jul 19, 2011, at 3:25 PM, Amy Gibbs wrote:

> Hi,
> 
> I've read everything that says printing is easy...but I'm struggling with it!
> 
> I have googled, but nothing quite seems to fit my situation, I just want a 
> single page.
> 
> In my app I have customer orders, and I just want to print out a copy. I 
> can't work out what the best option would be. I can probably create an html 
> file (and have css to format it) and save it to disk, but then I'd still have 
> to print it, either within my app, or with a browser, or I could create a PDF 
> and try and print that? or I could lay it all out on a view and print that? 
> Some orders have more than 1 item though, and tableviews don't seem to print 
> properly so how should I lay out a list of products? It should easily fit on 
> 1 page, just a name address and a couple of lines of product details.
> 
> It's all in a CoreData app,
> 
> I'd appreciate any help, Thanks,
> 
> Amy

If you want to print something different than what is on the screen, the best 
example of this I've seen is in the Hillegas book (Cocoa Programming for Mac OS 
X, 3rd Ed).

HTH,
Dave

___

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


standardDefaults

2011-07-21 Thread John Cate
I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
hiding application pLists in Lion (searching for them doesn't find any).

Tony
3CAAM
___

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

2011-07-21 Thread Joanna Carter
Le 21 juil. 2011 à 21:34, John Cate a écrit :

> I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
> hiding application pLists in Lion (searching for them doesn't find any).

The folder is there, just hidden. Use Finder - Go to folder and type it in.

Joanna

--
Joanna Carter
Carter Consulting

___

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

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

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

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


Re: standardDefaults

2011-07-21 Thread Bill Cheeseman
They've hidden the user library from casual users. Probably a good thing.

You can open it by going to the Go menu in Finder, choosing Go to Folder..., 
and typing "~/Library". It's probably pretty easy to make it a Favorite or to 
write an AppleScript script, but I haven't gotten that far yet.


On Jul 21, 2011, at 4:34 PM, John Cate wrote:

> I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
> hiding application pLists in Lion (searching for them doesn't find any).

-- 

Bill Cheeseman - b...@cheeseman.name

___

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

2011-07-21 Thread Kevin Callahan

On Jul 21, 2011, at 1:46 PM, Bill Cheeseman wrote:

> They've hidden the user library from casual users. Probably a good thing.
> 
> You can open it by going to the Go menu in Finder, choosing Go to Folder..., 
> and typing "~/Library". It's probably pretty easy to make it a Favorite or to 
> write an AppleScript script, but I haven't gotten that far yet.

I used the Go to Folder, then dragged the Library folder to my Finder's sidebar 
for easy access.

-Kevin Callahan
http://www.kevincallahan.org/software/accessorizer.html

> 
> 
> On Jul 21, 2011, at 4:34 PM, John Cate wrote:
> 
>> I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
>> hiding application pLists in Lion (searching for them doesn't find any).
> 
> -- 
> 
> Bill Cheeseman - b...@cheeseman.name
> 
> ___
> 
> 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/kcall%40mac.com
> 
> This email sent to kc...@mac.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: standardDefaults

2011-07-21 Thread Nick Zitzmann

On Jul 21, 2011, at 2:46 PM, Bill Cheeseman wrote:

> They've hidden the user library from casual users. Probably a good thing.
> 
> You can open it by going to the Go menu in Finder, choosing Go to Folder..., 
> and typing "~/Library". It's probably pretty easy to make it a Favorite or to 
> write an AppleScript script, but I haven't gotten that far yet.

In addition to what Bill said, holding down the Option key while visiting the 
Go menu makes the library folder appear as a menu option.

Nick Zitzmann


___

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

2011-07-21 Thread Tom Hohensee
Terminal commands to unhide user/Library in Lion

chflags nohidden ~/Library/   

chflags hidden ~/Library

Tom Hohensee


> I'm not seeing a user/library/Preferences folder on Lion.  Where are they 
> hiding application pLists in Lion (searching for them doesn't find any).
> 
> Tony
> 3CAAM
> ___
> 
> 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/tom.hohensee%40gmail.com
> 
> This email sent to tom.hohen...@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


CGEventRef with function key

2011-07-21 Thread Joe Turner
Hey,

So I've been having some issues with posting a CGEvent with a function key as a 
modifier (or flag). If I call CGEventSetFlags(eventDown, 
kCGEventFlagMaskSecondaryFn), and then post the event, all I get is the keyCode 
posting (as in maybe the left arrow is pressed), but the function key is not 
virtually pressed. As far as I can tell kCGEventFlagMaskSecondaryFn is for the 
function key modifier, so I'm not sure why this isn't working. Any help would 
be appreciated!

Thanks,

Joe Turner
___

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: Why am I getting May Not Respond warnings for Super

2011-07-21 Thread Jens Alfke

On Jul 21, 2011, at 8:51 AM, Chris Tracewell wrote:

> I have a private framework that is included in a project. Many of the project 
> classes descend from a class in the framework. All of these descendent 
> classes implement copyWithZone, encodeWithCoder and initWithCoder and thus 
> respectively calls each on super. I get warnings stating that "MySuperClass 
> may not respond to -copyWithZone" and so on. I do declare each of these 
> methods in super's header file, so why might these errors be getting 
> triggered?

This sounds as though it should work. Could you show us some code?

—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: Native Cocoa API for iTunes?

2011-07-21 Thread Jens Alfke

On Jul 21, 2011, at 7:12 AM, bradgibbs wrote:

> I've been using Scripting Bridge in one of my apps.  Now that iTunes is a 
> native Cocoa app, I'm wondering what effect this is going to have on 
> Scripting Bridge compatibility,

Why would it have any effect? Scripting interfaces don’t depend on whether the 
app is written in C++ or Objective-C or Python or Pascal.

—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: CGEventRef with function key

2011-07-21 Thread Bill Cheeseman

On Jul 21, 2011, at 5:22 PM, Joe Turner wrote:

> So I've been having some issues with posting a CGEvent with a function key as 
> a modifier (or flag). If I call CGEventSetFlags(eventDown, 
> kCGEventFlagMaskSecondaryFn), and then post the event, all I get is the 
> keyCode posting (as in maybe the left arrow is pressed), but the function key 
> is not virtually pressed. As far as I can tell kCGEventFlagMaskSecondaryFn is 
> for the function key modifier, so I'm not sure why this isn't working. Any 
> help would be appreciated!


The Mac responds to sequences of keyboard events, such as key-down followed by 
key-up, or modifier-key-down followed by key-down followed by key-up followed 
by modifier-key-up. So you have to post all of the relevant key-down and key-up 
events before you can expect the target application to respond. As I recall, 
the set flags command isn't meant to be used as part of that sequence; instead, 
you need to send key-down and key-up events for the specified modifier key. I 
believe there are examples of how to do this somewhere in the Quartz Event 
Services Reference document.

You might also find it useful to experiment with my free Event Taps Testbench 
utility at .

You will get more focused responses to inquiries about this on Apple's 
accessibility-dev mailing list, where Apple's accessibility engineers hang out.

-- 

Bill Cheeseman - b...@cheeseman.name

___

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: problem with dataWithContentsOfFile on Lion

2011-07-21 Thread Wilker
Thanks guys, I changed to NSDataReadingMappedAlways, since I will read just
a little piece of data (which is generally really fast) is that ok, the
crash risk is really low, so, I mean my software can live with that.
---
Wilker Lúcio
http://about.me/wilkerlucio/bio
Kajabi Consultant
+55 81 82556600



On Thu, Jul 21, 2011 at 5:30 PM, Greg Guerin  wrote:

> Wilker wrote:
>
>  Before Lion, it really works well and fast, even on Wifi external drive
>> (through Airport Extreme), but now it get's really slow... I did some
>> checks, and now its reading the entire file... instead of just read 128kb
>> (start and end). Anyone have an ideia on why its happening now? And how to
>> make it works as before on Snow Leopard?
>>
>
>
> You could use fopen(), fseek(), fread(), fclose().
>
> Who knows, it might even be faster, since it doesn't have to call mmap().
>  Worst case, you call mmap() yourself.
>
>  -- GG
>
> __**_
>
> 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/**
> wilkerlucio%40gmail.com
>
> This email sent to wilkerlu...@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: Windows get released on 10.6, leak on 10.7

2011-07-21 Thread Corbin Dunn

On Jul 21, 2011, at 1:16 PM, Ross Carter wrote:

>> Just a long shot, but does this have anything to do with the new ARC 
>> (Automatic Reference Counting)?
> 
> Joanna: The app uses GC, and was built long before ARC was announced. 
> Everything gets collected on 10.6. I'm puzzled how ARC could affect GC.
> 
> 
>> Have you used Instruments to find out why? If not, then use the object alloc 
>> instrument with reference counting turned on. Then look at your window 
>> objects and try and figure out where the extra retain is happening.
> 
> 
> Nick: It's a GC app, so -retain is a no-op. My Instruments foo is not strong. 
> What tool will show why an object is not getting collected?
> 

Log the address of your object. Then, break in gdb and do:

info gc-roots 

Then see what is rooting it. also, try gc-references in it to see what 
references it, but roots are more important.

corbin

___

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


CocoaHeads Silicon Valley tonight!

2011-07-21 Thread Dave DeLong
Hi everyone,

I haven't seen a posting about this yet, so I thought I'd throw it out there.

CocoaHeads Silicon Valley is meeting TONIGHT at 7pm in the "Bodega Bay" tech 
talk room  at Google in Mountain View.

More information, including the physical address, are available here:  
http://cocoaheads.org/us/SiliconValleyCalifornia/index.html  (The map is 
pointing to the wrong spot, but the address is correct)

A big thanks to Tedd Fox (@teddfox) for getting things running again.

Cheers,

Dave
___

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

2011-07-21 Thread Gregory Weston
Yesterday I wrote:

> Please point me to another list if there's one more appropriate.
> 
> Seems that my iTunes visualizer doesn't work in Lion. Works fine in iTunes 
> 10.4 under Snow Leopard. Under Lion 64-bit it of course completely fails to 
> load. If I start iTunes in 32-bit mode it doesn't complain or log anything 
> but also doesn't seem to work. Is there anything like a modern SDK or 
> documentation for iTunes visualizers?

Found my own answer and since a couple of other people asked yesterday: There's 
an updated SDK in the member center under the Applications category of the 
Downloads section.

Greg
___

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: Native Cocoa API for iTunes?

2011-07-21 Thread bradgibbs

I worded my post poorly.  My point was, if Apple has re-written iTunes in 
Obj-C, they didn't necessarily re-implement the same scripting interface  They 
may have added, removed or fixed from 10.3 and earlier, or they may have dumped 
scriptability completely.  Based on the posts in this group, visualization and 
other plug-ins are broken with 10.4 so I don't think it's unreasonable to 
wonder whether the scripting interface has changed.  What I was hoping for was 
a link to an article I missed on a wonderful new native Cocoa API.

On Jul 21, 2011, at 02:40 PM, Jens Alfke  wrote:


On Jul 21, 2011, at 7:12 AM, bradgibbs wrote:

I've been using Scripting Bridge in one of my apps.  Now that iTunes is a 
native Cocoa app, I'm wondering what effect this is going to have on Scripting 
Bridge compatibility,

Why would it have any effect? Scripting interfaces don’t depend on whether the 
app is written in C++ or Objective-C or Python or Pascal.

—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: Native Cocoa API for iTunes?

2011-07-21 Thread Graham Cox
If the scripting interface has changed, the scripting dictionary will have been 
updated - browse it in the Script Editor.

There isn't a 'native Objective-C' interface to iTunes and there never will be. 
Apple don't even let you run iTunes in a debugger in case you could use that to 
reverse-engineer encryption, etc (at least I assume that's the thinking). It 
makes debugging plug-ins a bit tricky. The visualizer plug-in API only exposes 
a single entry point back into iTunes that follows a classic funnelling-point 
design with strictly limited messages, so basically there's no back door and no 
API.

--Graham





On 22/07/2011, at 11:14 AM, bradgibbs wrote:

> I worded my post poorly.  My point was, if Apple has re-written iTunes in 
> Obj-C, they didn't necessarily re-implement the same scripting interface  
> They may have added, removed or fixed from 10.3 and earlier, or they may have 
> dumped scriptability completely.  Based on the posts in this group, 
> visualization and other plug-ins are broken with 10.4 so I don't think it's 
> unreasonable to wonder whether the scripting interface has changed.  What I 
> was hoping for was a link to an article I missed on a wonderful new native 
> Cocoa API.
> 
> On Jul 21, 2011, at 02:40 PM, Jens Alfke  wrote:
> 
> 
> On Jul 21, 2011, at 7:12 AM, bradgibbs wrote:
> 
> I've been using Scripting Bridge in one of my apps.  Now that iTunes is a 
> native Cocoa app, I'm wondering what effect this is going to have on 
> Scripting Bridge compatibility,
> 
> Why would it have any effect? Scripting interfaces don’t depend on whether 
> the app is written in C++ or Objective-C or Python or Pascal.
> 
> —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/graham.cox%40bigpond.com
> 
> This email sent to graham@bigpond.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: Native Cocoa API for iTunes?

2011-07-21 Thread Jens Alfke

On Jul 21, 2011, at 6:14 PM, bradgibbs wrote:

> My point was, if Apple has re-written iTunes in Obj-C, they didn't 
> necessarily re-implement the same scripting interface.  They may have added, 
> removed or fixed from 10.3 and earlier, or they may have dumped scriptability 
> completely.

Oh boy, if they had, they’d have had a bunch of 3rd party app developers 
descending on them with pitchforks and torches. There are a lot of apps that 
use AppleEvents to drive iTunes. And Apple takes backward compatibility pretty 
seriously.

> What I was hoping for was a link to an article I missed on a wonderful new 
> native Cocoa API.

That doesn’t really make sense. A native Cocoa API would still have to be a 
wrapper around to some other IPC mechanism, in order to talk to an external 
process. And that IPC mechanism is AppleEvents. (Yes, it’s conceivable that an 
app could expose a Distributed Objects interface, but DO is way, way too 
fragile to expose to outside developers that way.)

—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


"Nested" runloops

2011-07-21 Thread Eric Matecki

Hello,

I have to port a software to take advantage of 64 bits adressing.
The software was originally written for Windows...
So there isn't any real runloop, but there are GetMsg() function calls
spread all around the source code (in about 200 files out of the 1000+ !!).

In Carbon, I used the trick described in Q&A 1061.
(http://developer.apple.com/qa/qa2001/qa1061.html seems dead)

It sent an 'artificial' event to itself, started the mainrunloop,
caught the event and from there on used ReceiveNextEvent() to get and process
the message.  This ensured all default event handlers where installed.

Now I want to do something more or less like that in Cocoa,
because there is no (reasonable) way the software can be modified to use a 
runloop.
There is also no NIB file, as we do all our GUI stuff ourself.
We just open a window and draw inside !

So here is what I have tested :

I create a NSWindow and put a subclass of NSOpenGLView as contentView:
In that view I override all event processing methods, "decode" the event
into our own event structure, and append it to our event queue.

In this 'append to queue' method, after appending the event, if it is the first 
time it is called,
I call the working function of the software, which will call GetMsg() from 
everywhere.

GetMsg(), if our event queue is empty, tries to get new 'native' events and 
decodes and append them to the queue.

Thats where my problems really start.

I tried all of these :
NSRunLoop*  runloop = [NSRunLoop currentRunLoop];
assert(runloop);
[runloop acceptInputForMode: NSModalPanelRunLoopMode beforeDate: [NSDate 
dateWithTimeIntervalSinceNow: 1];
//[runloop acceptInputForMode: NSDefaultRunLoopMode beforeDate: [NSDate 
dateWithTimeIntervalSinceNow: 1]];
//[runloop runMode: NSDefaultRunLoopMode beforeDate: [NSDate 
dateWithTimeIntervalSinceNow: 1]];
//[runloop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];

The 'timeout' of 1 second is so I have time to read the traces in the console.

What happens is:
- when I do nothing with the window, the timeout 'fires' and GetMsg() returns 
nil after one second.
- when I 'draw' with the mouse (down,drag,up), the method I call on runloop 
returns
  (almost) instantly, thus the event has been processed somehow, but the event 
methods
  in my view AREN'T called !!

Anything I'm doing wrong ? (beside the fact I really should be using the runloop
as it was meant to, but can't ...)

Thanks for your help.

Eric M.

--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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


Smooth resizing of a text field

2011-07-21 Thread Craig Mason-Jones
Don't fiddle with the individual properties of the subviews in the window.
Rather, just apply a scaling transform to the entire window, and let Core
Graphics take care of the rest. i.e. do what you really mean to do: scale
everything.

Unfortunately I've just upgraded to Lion ( :-) ) so I'm now busy installing
the upgraded XCode, so I can't write a quick demo. You need to look at the
NSView's layer property, which gives a CALayer, which has a
-(void)setAffineTransform:(CGAffineTransform) method.

Create the transform using the CGAffineTransformScale(CGFloat sx, CGFloat
sy) method.

Good luck!
C
___

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


Cocoaheads- Silicon Valley July Meeting

2011-07-21 Thread teddfox

Thursday, July 21, 2011 19:00 at Bodega Bay Tech Talk Room 1950 Amphitheater 
Parkway Mountain View, California

Thanks AGAIN to David Oster and Google, Inc., Silicon Valley - Cocoaheads 2.0! 
When: July 21, 2011 7-9PM Where: Bodega Bay Tech Talk Room 1950 Amphitheater 
Parkway Mountain View, California Directions are here: 
http://www.svmug.org/groups/svmug/wiki/6def0/BODEGA_BAY_ROOM.html We still need 
people for speakers. Possible topics so far: We have to discuss SOMETHING open 
source every meeting. If you have any questions, suggestions, anything, let me 
know. #awesome Tedd Fox
___

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: Timing some code execution outside Instruments

2011-07-21 Thread Eric E. Dolecki
I found this.

NSDate *methodStart = [NSDate date];


/* ... Do whatever you need to do ... */

NSDate *methodFinish = [NSDate date];

NSTimeInterval executionTime = [methodFinish timeIntervalSinceDate:
methodStart];

  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Thu, Jul 21, 2011 at 2:11 PM, Howard Siegel  wrote:

> Yes
>
>
> On Thu, Jul 21, 2011 at 10:59, Eric E. Dolecki  wrote:
>
>> I'm curious if there is a way to NSLog how long some code takes to execute
>> (outside of using Instruments).
>>
>> In Flash one can use getTimer and see how much time passed inline. Is
>> there
>> a way to do this in Obj-C?
>>
>> Would one use a NSDate object?
>>
>>
___

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: Native Cocoa API for iTunes?

2011-07-21 Thread Matt Neuburg
On Thu, 21 Jul 2011 14:12:53 + (GMT), bradgibbs  said:

>I've been using Scripting Bridge in one of my apps.  Now that iTunes is a 
>native Cocoa app, I'm wondering what effect this is going to have on Scripting 
>Bridge compatibility

There's no such thing as "scripting bridge compatibility". An application is 
scriptable via Apple events or it isn't. If it is, it doesn't care (or even 
know) what method *you* are using to send it those Apple events.

So your only question is what iTunes's scriptability is like, and you can 
easily find that out just by looking (for example, by generating a scripting 
bridge glue file, or in many other ways). You don't need to ask. Just *look*. 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


Re: Help with Secondary UINavigationController

2011-07-21 Thread Matt Neuburg
On Thu, 21 Jul 2011 10:04:53 -0500, "Fluffy D. Bunny" 
 said:
>Hi All,
>
>I have an application here that loads (pushes) a view during the users
>navigation experience. This new view is split screen like so:
>
>
>
>|CONTENT   |
>|_|
>|  |
>|SUBVIEW   |
>|_|
>
>I need a new navigation controller to control the subview, but no matter how
>I do it the controller takes over the entire screen, even through I have set
>it's view to the subview.

You may be misunderstanding what a view controller is. You need a new view 
controller to push onto the main navigation controller's stack; that view 
controller's view should occupy the *whole* screen, i.e. both the content and 
the subview in your chart above. Now, you may *also* like to control the 
subview somehow, but you must *not* do it with a UINavigationController; that 
would be a misuse of this class. You should simply write your own code to 
manipulate the subview. 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


Re: Printing options

2011-07-21 Thread Matt Neuburg
On Thu, 21 Jul 2011 16:34:07 -0400, davel...@mac.com said:

> On Jul 19, 2011, at 3:25 PM, Amy Gibbs wrote:

>> In my app I have customer orders, and I just want to print out a copy. ... I 
>> could lay it all out on a view and print that?

Yup, I've written an application that prints out customer orders in nice 
columnar fashion with a header, columns, prices, total at the bottom, etc., and 
it does exactly that. Printing is just drawing, it isn't hard. Just draw lines 
in the places where you want lines, text in the places where you want text, 
etc. 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


Re: CGEventRef with function key

2011-07-21 Thread Joe Turner
Hey,

I understand how events are supposed to be posted, but for command, option, 
control and shift, you can easily used the CGEventFlags to specify that part 
(and it works). So what you're saying is that for function, you do have to do 
it separately? I just don't understand why they would make it any different for 
Fn.

Thanks,

Joe


> On Jul 21, 2011, at 5:22 PM, Joe Turner wrote:
> 
>> So I've been having some issues with posting a CGEvent with a function key 
>> as a modifier (or flag). If I call CGEventSetFlags(eventDown, 
>> kCGEventFlagMaskSecondaryFn), and then post the event, all I get is the 
>> keyCode posting (as in maybe the left arrow is pressed), but the function 
>> key is not virtually pressed. As far as I can tell 
>> kCGEventFlagMaskSecondaryFn is for the function key modifier, so I'm not 
>> sure why this isn't working. Any help would be appreciated!
> 
> 
> The Mac responds to sequences of keyboard events, such as key-down followed 
> by key-up, or modifier-key-down followed by key-down followed by key-up 
> followed by modifier-key-up. So you have to post all of the relevant key-down 
> and key-up events before you can expect the target application to respond. As 
> I recall, the set flags command isn't meant to be used as part of that 
> sequence; instead, you need to send key-down and key-up events for the 
> specified modifier key. I believe there are examples of how to do this 
> somewhere in the Quartz Event Services Reference document.
> 
> You might also find it useful to experiment with my free Event Taps Testbench 
> utility at .
> 
> You will get more focused responses to inquiries about this on Apple's 
> accessibility-dev mailing list, where Apple's accessibility engineers hang 
> out.
> 
> -- 
> 
> Bill Cheeseman - b...@cheeseman.name
___

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

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

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

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


Re: core data migration - delete old store

2011-07-21 Thread Dave Fernandes

On 2011-07-21, at 12:16 PM, Roland King wrote:

> Great - thanks for this - gets me started, I've found the documentation quite 
> dense and soon I have to pitch in and just give it a go (I have a model I 
> need to update in my test app and I really don't want to toss the data). 
> 
> I need to hunt around the NSManagedObjectModel class a bit more, clearly, 
> there are methods there I don't know enough about. I assume there are ways to 
> enumerate the models in the bundle, figure out which one is the 'current'

+[NSManagedObjectModel mergedModelFromBundles:]

> one and which one may match the store

+[NSManagedObjectModel mergedModelFromBundles:forStoreMetadata:]

> , will go read the class docs when they've finished d/l'ing. I saw some of 
> the methods for making an on-the-fly migration, I'll try those out too see if 
> they work. 
> 
> I think lightweight is going to do it for this change. One attribute deleted, 
> one entity added, one mapping added, one attribute added (with a  default). 
> It's not a bad way to get my feet wet with migration actually, I can afford 
> to bungle it up, I can save the sqlite file before I start and give it few 
> cracks. Ok that's the weekend!

___

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


Determine architecture of a running application

2011-07-21 Thread danchik

Hello, how can one determine if the currently running app is 32bit or 64

Specifically:

I have a 32 bit plugin compiled for 10.5+ and it needs to know if it was 
loaded by 32bit or 64bit Safari


I am aware of the [[NSRunningApplication currentApplication] 
executableArchitecture], unfortunately it is a 10.6+ class and will not 
compile under 10.5


Prior to the latest safari release it the bundle identifier for [NSBundle 
mainBundle] was always com.apple.Safari if it was 32bit and 
com.apple.WebKit.PluginHost if it was 64bit


Thank You



___

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: "Nested" runloops

2011-07-21 Thread Ken Thomases
On Jul 20, 2011, at 8:01 AM, Eric Matecki wrote:

> I have to port a software to take advantage of 64 bits adressing.
> The software was originally written for Windows...
> So there isn't any real runloop, but there are GetMsg() function calls
> spread all around the source code (in about 200 files out of the 1000+ !!).

My condolences.  :)

> I create a NSWindow and put a subclass of NSOpenGLView as contentView:
> In that view I override all event processing methods, "decode" the event
> into our own event structure, and append it to our event queue.
> 
> In this 'append to queue' method, after appending the event, if it is the 
> first time it is called,
> I call the working function of the software, which will call GetMsg() from 
> everywhere.

You should probably call the working function from 
-applicationDidFinishLaunching: or the like.  Or maybe an override of 
-[NSApplication run] (see below).

> 
> GetMsg(), if our event queue is empty, tries to get new 'native' events and 
> decodes and append them to the queue.
> 
> Thats where my problems really start.
> 
> I tried all of these :
>NSRunLoop*  runloop = [NSRunLoop currentRunLoop];
>assert(runloop);
>[runloop acceptInputForMode: NSModalPanelRunLoopMode beforeDate: [NSDate 
> dateWithTimeIntervalSinceNow: 1];
> //[runloop acceptInputForMode: NSDefaultRunLoopMode beforeDate: [NSDate 
> dateWithTimeIntervalSinceNow: 1]];
> //[runloop runMode: NSDefaultRunLoopMode beforeDate: [NSDate 
> dateWithTimeIntervalSinceNow: 1]];
> //[runloop runUntilDate: [NSDate dateWithTimeIntervalSinceNow: 1]];
> 
> The 'timeout' of 1 second is so I have time to read the traces in the console.
> 
> What happens is:
> - when I do nothing with the window, the timeout 'fires' and GetMsg() returns 
> nil after one second.
> - when I 'draw' with the mouse (down,drag,up), the method I call on runloop 
> returns
>  (almost) instantly, thus the event has been processed somehow, but the event 
> methods
>  in my view AREN'T called !!
> 
> Anything I'm doing wrong ? (beside the fact I really should be using the 
> runloop
> as it was meant to, but can't ...)

The connection to the window server for receiving events is a run loop source, 
but that source's handler merely queues the event internally.  It doesn't 
dispatch the event.  The event is dequeued by -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] and dispatched via 
-[NSApplication sendEvent:].  It is -[NSApplication run] which normally does 
this.  Review the class overview for NSApplication.  Also, see the GLUT sample 
code linked to from the documentation for -[NSApplication run].  That sample 
re-implements -run, which will give you some idea of how to do the same.
http://developer.apple.com/library/mac/#samplecode/glut/Listings/GLUTApplication_m.html

You'll need to turn that run method inside out for your GetMsg() implementation.

Good luck,
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: Determine architecture of a running application

2011-07-21 Thread Ken Thomases
On Jul 21, 2011, at 11:34 PM, danchik wrote:

> Hello, how can one determine if the currently running app is 32bit or 64
> 
> Specifically:
> 
> I have a 32 bit plugin compiled for 10.5+ and it needs to know if it was 
> loaded by 32bit or 64bit Safari

You can move this test to compile time.  After all, only that variant of your 
universal binary that was compiled as 64-bit will be loaded by a 64-bit 
process, and ditto for 32-bit.

So, in your code do:

#ifdef __LP64__
// 64-bit code
#else
// 32-bit code
#endif

If you really want, you can embody this in a function like:

static inline BOOL is64Bit(void)
{
#ifdef __LP64__
return TRUE;
#else
return FALSE;
#endif
}

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