Re: proper way to release a static NSMutableDictionary?

2008-12-16 Thread Jean-Daniel Dupas


Le 16 déc. 08 à 05:56, Andy Lee a écrit :


On Dec 15, 2008, at 6:27 PM, John Michael Zorko wrote:
I'm not concerned about the contents per se -- i'm concerned about  
releasing something I declared as static, just to create it again  
later.


Creating and re-creating objects is in itself nothing to be afraid  
of.  It happens all the time.


The main relevant difference between the two approaches -- (1) empty  
the existing dictionary, or (2) release the existing dictionary and  
make a new dictionary -- is that in the latter case, it's  
conceivable that some object or thread might be caching a stale  
reference to the old dictionary.  This might or might not be a real  
concern in your specific app.


Catching a stale reference or accessing a dictionary in a non thead  
safe way. I don't know what is the worst.




I wonder if you are concerned not because 'lookup' is static (which  
has a specific meaning), but because the variable is globally  
visible and is referred to all over the place, and therefore  
possibly at greater risk for the stale-reference problem?  But if  
that's your concern, then you've answered your own question: just go  
with [lookup removeAllObjects].


--Andy

Part of me is saying "just release the dictionary's contents, not  
the dictionary itself".


Regards,

John



___

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: Swap subviews of NSSplitView?

2008-12-16 Thread rajesh


On Dec 16, 2008, at 8:11 AM, Matt wrote:


I have an NSSplitView, divided vertically, with two table views. In a
certain instance I need to have a custom view class appear in place of
the right-hand NSTableView, retaining its auto-resizing and
spilt-view-resizing functionality. I need to be able to swap the
NSTableView (inside of the split view) for this custom view back and
forth as needed.

I searched for the solution but only found references to NSViews
-replaceSubview: with:, and it isn't working for me. Is this the
proper method to be using for such a task or should I be doing
something different?

I did something like this before , but my table was enclosed in a  
scroll view so , replacing 'view' with scroll view was never a problem.

I dint pay much into the details then.

May be you can do the same... even go ahead and hide the scrollers if  
you don't need them



Thanks very much in advance,
-Matt
___

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/rajesh%40vangennep.nl

This email sent to raj...@vangennep.nl


___

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


How to find nearest food courts in iPhone

2008-12-16 Thread SridharRao M
Hi All,
 How we can find out nearest food courts to the current iphone palce
through program.
I think with the CoreLocation Framework we can find out current place of the
iPhone.

Thanks in advance,

Regards,
SRIDHAR.
___

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: What is the default time for a CALayer transform?

2008-12-16 Thread Dimitri Bouniol
The Core Animation Programing Guide — http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/AnimProps.html 
#//apple_ref/doc/uid/TP40005942-SW2 — indicates 0.25 seconds are used  
for an implicit animation.
As for using CABasicAnimation so you could use the delegate calls, set  
the property (or key path) to the final value before adding the  
animation to the layer, and you should get more appropriate results as  
the animation ends. Additionally, you might need to wrap the property  
call in a CATransaction to disable actions, but I don't know if it's  
absolutely necessary.


On Dec 16, 2008, at 1:49 AM, Gustavo Pizano wrote:


Hello

Im rotating a layer, with the following method :

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

but then I want right after the animation ends, to  check the new  
position of the CALayer to align it into the closest grid cell   
which will belong.  I found out I can use the following method to  
try to sync the animation ending time to what I want to do:


[self performSelector:@selector(printSomethinng) withObject:nil  
afterDelay:0.5];


of course  the selector here is something I tried, and the delay I  
started at 1.0 and started to lower it till I get ( at eyes sight )  
that once the animation finishes  I get a message in the console.


I have been reading but I dunno what's the default  time  for an  
animation into a CALayer when you use @"transform.rotation.z" or  
just the transfom property., so I can set the delay exactly at time.


Thanks

Gustavo.

PD I was trying with a CAAnimation and the aplying it to the  
CALayer, so I could use the method  -(void)animationDidStop:  
finished: , but when the animation ended  it returned to the initial  
state, kinda derotated the CALayer, which I don't want such a  
behavior, I was told to set  the autpreverse option to NO, and add a  
group, this last thing I couldn't achieve it. didn't know how to do  
it.


--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Gustavo Pizano
I was thinking about that, I put a 90.0f  but that didn't help let me  
see the M_PI_2 works. nop once it gets to vertical position the  
image its not focused.


:S


Gus.


On 16.12.2008, at 14:48, Dimitri Bouniol wrote:

It's because you are multiplying/dividing a double (M_PI) by and  
int, so you get an int. A 90° angle in radians is defined as π/2,  
so try the constant M_PI_2. Hope that works :3


PS. You can also make an int into a float by appending a "." to the  
number, as such: 90. * M_PI / 180. ; but using M_PI_2 should give  
much more accurate results, and may be slightly faster (pre- 
calculated constant).


On Dec 16, 2008, at 3:31 AM, Gustavo Pizano wrote:

mm no. let me try it.m... nop it didn't work. still the image after  
the transition its blurred.


Gus


On 16.12.2008, at 12:22, Martin Carlberg wrote:


Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I  
click on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its  
kinda blurry I dunno how to rotate the layer without loosing  
quality.


the contents of the layer its .png


Thanks


Gus
___

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/martin%40oops.se

This email sent to mar...@oops.se




___

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/dimitri008%40mac.com

This email sent to dimitri...@mac.com


--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Gustavo Pizano


NSLog(@" %f,%f", nLayer.frame.origin.x, nLayer.frame.origin.y);
generated the following output before rotating the layer.


2008-12-16 15:31:32.513 NavalBattle[392:10b]  100.00,200.00


On 16.12.2008, at 15:19, Dimitri Bouniol wrote:

Perhaps it has something to do with HPS (half-pixel syndrome). Maybe  
as you rotate the layer, the x-coord (which was a y-coord) now lies  
on 0.5 pixels. Try checking the layer.frame.origin point to see if  
it is expressed in whole numbers.


On Dec 16, 2008, at 5:59 AM, Gustavo Pizano wrote:

I was thinking about that, I put a 90.0f  but that didn't help let  
me see the M_PI_2 works. nop once it gets to vertical position  
the image its not focused.


:S


Gus.


On 16.12.2008, at 14:48, Dimitri Bouniol wrote:




___

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: More - Safari Download Security Alerts

2008-12-16 Thread Matt Gough


On 16 Dec 2008, at 15:25, Dave wrote:

In response to this I was advised to use PackageMaker in order to  
create an Installer, which would in turn suppress the Security  
dialogs. So I built an installer but I can't get it to install the  
folder containing file, so far I have only managed to get it to  
install the myApp.app file.


So, my question is:

Is it possible to create an installer with package maker that does  
the same as the AppleScript, e.g. installs a folder in "/ 
Applications" (or anywhere for that matter).


I am sure it is, but Cocoa-dev is not the best place to ask.

http://lists.apple.com/mailman/listinfo/installer-dev

seems more appropriate and more likely to solve your problem.

Good luck

Matt
___

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

2008-12-16 Thread Yvan BARTHÉLEMY

Hi,

For my project, I want to add mouse support in Core Animation views.  
For this, when I create a Core Animation button, I associate to the  
view a NSTrackingArea with the frame of my button. This way I can get  
mouse Up, Down, Entered and Exited events and implement the behavior  
of my button and visual feedback. Until here, this works perfectly.


The problem is that I need to remove the tracking rects when the  
button disappear from the view. That is that event that is painful to  
detect.


For now, I have a working solution, but it looks like dirty code and  
I'm not sure if this is really safe. I remove the tracking rect when  
the bound are updated by subclassing [CALayer setNeedsLayout], which  
is fine, when the view is removed by subclassing [CALayer  
removeFromSublayer] (which is not fine because it's not called when  
you directly remove the superlayer), in the dealloc method (this one  
causes me a problem, as, this is not just memory management and I have  
no guarantee dealloc is called), and the worst one : I registered for  
the notification applicationWillTerminate (I need this, because if  
dealloc is called after the windows's contentView has been  
deallocated, this simply crashes as contentView is not nil).


What do you think I should do with this ?

Best Regards,
Yvan BARTHÉLEMY___

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: What is the default time for a CALayer transform?

2008-12-16 Thread Klaus Backert


On 16.12.2008, at 15:27, Gustavo Pizano wrote:


Hello Dimitri.

CAAnimation* rotateAnimation = [CABasicAnimation  
animationWithKeyPath:@"transform"];
		rotateAnimation.fromValue = [NSValue  
valueWithCATransform3D:nLayer.transform];
		rotateAnimation.toValue = [NSValue  
valueWithCATransform3D:transform];


its gives me an error, Error request for member "fromValue" in  
something  not a structure  or union.
shouldn't it be CABasicAnimation which has the fromValue and toValue  
properties.?


CAAnimation inherits from NSObject and doesn't have fromValue and  
toValue properties, but CABasicAnimation has (which is derived from  
CAPropertyAnimation, which is derived from CAAnimation).


This would be a good time reading the documentation, I think ;-)

Klaus

___

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


Write to file.

2008-12-16 Thread Macarov Anatoli
I have admin rights. But I can't use NSUserDefaults because upon starting  
system in login window I'm not in user account, and there the function doesn't 
work.. After authorization and login in user account the function will work 
because detects what user account you work from.



  
Вы уже с Yahoo!? 
Испытайте обновленную и улучшенную. Yahoo! Почту! http://ru.mail.yahoo.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: How to make NSURLConnection send delegate messages during runModalForWindow

2008-12-16 Thread Michael Babin

On Dec 16, 2008, at 8:30 AM, an0...@gmail.com wrote:

I want to handle the connection events during runModalForWindow, so  
I use
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode: 
[[NSRunLoop currentRunLoop] currentMode]];

in the modal window's windowDidBecomeKey delegate method.

But still my connection's delegate methods are not called until  
stopModal.


Is there anything I misunderstood about NSURLConnection's  
scheduleInRunLoop:forMode: method?


Is there some reason not to pass in NSModalPanelRunLoopMode as the  
forMode argument? What happens if you do?


___

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: batch processing

2008-12-16 Thread Mike Abdullah

NSFileManager has methods for iterating the contents of a directory.

On 16 Dec 2008, at 11:43, 양승준 wrote:

Hi, I would like to write a code to batch process files in a  
directory. I mean I would like to open, process, and store files one- 
by-one. My plan is to read names of files into a nsmutablearray, and  
process them one-by-one. Is there a more or less standard way to do  
a batch processing? 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/cocoadev%40mikeabdullah.net

This email sent to cocoa...@mikeabdullah.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


Re: What is the default time for a CALayer transform?

2008-12-16 Thread Gustavo Pizano

Yes it was CABasicAnimation.

Dimitri made just a typing mistake.

Gustavo


On 16.12.2008, at 16:34, Klaus Backert wrote:



On 16.12.2008, at 15:27, Gustavo Pizano wrote:


Hello Dimitri.

CAAnimation* rotateAnimation = [CABasicAnimation  
animationWithKeyPath:@"transform"];
		rotateAnimation.fromValue = [NSValue  
valueWithCATransform3D:nLayer.transform];
		rotateAnimation.toValue = [NSValue  
valueWithCATransform3D:transform];


its gives me an error, Error request for member "fromValue" in  
something  not a structure  or union.
shouldn't it be CABasicAnimation which has the fromValue and  
toValue properties.?


CAAnimation inherits from NSObject and doesn't have fromValue and  
toValue properties, but CABasicAnimation has (which is derived from  
CAPropertyAnimation, which is derived from CAAnimation).


This would be a good time reading the documentation, I think ;-)

Klaus



___

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: What is the default time for a CALayer transform?

2008-12-16 Thread Gustavo Pizano


Dimitri Hi

using CAAnimation this is what I was doing:

-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {
NSLog(@"%@",[nLayer name]);
CAAnimation* rotateAnimation = [self animateForRotating];   
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self]; 
[nLayer addAnimation:rotateAnimation forKey:@"whatever"];

}

}


-(CAAnimation *)animateForRotating
{
float radians = 90 * M_PI / 180;
CATransform3D transform;
transform = CATransform3DMakeRotation(radians, 0, 0, 1.0);
CABasicAnimation* animation;
animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:transform];
animation.duration = 0.4;
animation.cumulative = NO;
return animation;
}

but hte animation once finished returned the layer  to the initial  
position something undesirable, I then set up a animation.autoreverse  
= NO; but that didn't help either. I can see here, somehow using  
CAAnimation its better, I can have more control on how the rotation  
should look.


What do you think?

Thanks  tons for your help


Gus



On 16.12.2008, at 14:37, Dimitri Bouniol wrote:

The Core Animation Programing Guide — http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/AnimProps.html#/ 
/apple_ref/doc/uid/TP40005942-SW2 — indicates 0.25 seconds are used  
for an implicit animation.
As for using CABasicAnimation so you could use the delegate calls,  
set the property (or key path) to the final value before adding the  
animation to the layer, and you should get more appropriate results  
as the animation ends. Additionally, you might need to wrap the  
property call in a CATransaction to disable actions, but I don't  
know if it's absolutely necessary.



___

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: More - Safari Download Security Alerts

2008-12-16 Thread Dave

Hi,

On 16 Dec 2008, at 13:14, matt.go...@agfa.com wrote:



On 16 Dec 2008, at 13:54, Dave wrote:

I don't install files into that folder, my application writes  
files to that location (by default, the user can change it) once  
installed. From the above document:
"It is important to remember that the user domain (/Users) is  
intended for files created by the user. With the exception of the  
~/Library directory, your application should never ***install***  
files into the user’s home directory. In particular, you should  
never install files into a user’s Documents directory or into the / 
Users/Shared directory. These directories should only be modified  
by the user."


They keyword here is ***install***.



OK, so if these files are really your apps 'documents' (ie the user- 
driven output of your app) then they should probably go into ~/ 
Documents/MyApp instead of ~/MyApp by default. If they are just  
settings/caches/other things then they belong somewhere in  ~/ 
Library. It is very uncommon for applications to write directly  
into ~/ on the Mac. (Looking on my own home folder, on a machine  
with multiple 3rd Party products in use for 2 years there are no  
(zero, zilch) non-standard folders/files that have been created by  
anything. By all means allow the user to define the default location.


Sorry, yes it does store them in the user's "Documents/myApp" Folder,  
not directly in the User's "Home" folder. I didn't take much care in  
writing that since it really didn't help to solve my problem. I was  
just pointing out that there were not stored in the User section, not  
the System Section.


Please note that the replies you got on this list may seem a bit  
snobby ("Don't put that there", "don't do that", "why do you want  
to do that" etc) if you are coming from another platform. Please  
understand that these are only intended as suggestions to help your  
app feel familiar to Mac users (i.e your potential customers). If  
you deviate too much from what they expect just to fit in with the  
way you do things on other platforms (which these customers have  
probably never used) then you will just confuse/frustrate them.


That's ok, I understand that people are trying to help and I am  
grateful for the discussion, if I do have anything non MacOS X (I  
don't think I do though) I will change it.


The thing is that none of this solves my problem! It really doesn't  
matter a fig if the app is installed "/Applications", or on a USB  
stick or wherever (apart from (maybe) not being 100% MacOSX - that  
can be changed later if deemed necessary). I want it to be able to  
install a folder containing the app and some other files *somewhere*.  
Whether that *somewhere* is the right place or not is another issue  
and one that can be dealt with after I have got this application  
shipped for evaluation by my boss and others. They really don't care  
if the files are in the right place or not they just want it see the  
installer working on 10.5.x.


Thanks a lot for your help
All the Best
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: More - Safari Download Security Alerts

2008-12-16 Thread Dave

Hi,

On 16 Dec 2008, at 11:41, Kyle Sluder wrote:


On Mon, Dec 15, 2008 at 1:26 PM, Dave  wrote:
It doesn't write any user specific data within "/Applications",  
any files it
does create and in the current users "home" folder, in a folder  
for the

Application.


Your files belong in ~/Library/Application Support/YourSubfolder, not
in ~/YourSubfolder.  See the section of the "File System Overview"
document entitled "Don't Pollute User Space":
http://developer.apple.com/documentation/MacOSX/Conceptual/ 
BPFileSystem/Articles/WhereToPutFiles.html#//apple_ref/doc/uid/ 
TP40001411-111946


I don't install files into that folder, my application writes files  
to that location (by default, the user can change it) once installed.  
From the above document:
"It is important to remember that the user domain (/Users) is  
intended for files created by the user. With the exception of the ~/ 
Library directory, your application should never ***install*** files  
into the user’s home directory. In particular, you should never  
install files into a user’s Documents directory or into the /Users/ 
Shared directory. These directories should only be modified by the  
user."


They keyword here is ***install***.


Only admin's are required to install the App.


Just because only admins need to install it doesn't imply that they
don't want to run it from elsewhere.


They can run the app from elsewhere, just not install it. This is the  
way we want it to work for a number of reasons far too long to go  
into now.



--Kyle Sluder


All the Best
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: More - Safari Download Security Alerts

2008-12-16 Thread Dave


On 16 Dec 2008, at 11:37, Kyle Sluder wrote:


On Mon, Dec 15, 2008 at 1:23 PM, Dave  wrote:
But that isn't the requirement, we just want it installed in "/ 
Applications"

and accessible to all users, that's it!


By which do you mean "it's not a requirement that we have thought of?"


No, we have thought of it and the best/only way to use this app is to  
have it installed in "/Applications" by an administrator and to be  
able to run it from any user.


See the HIG: http://developer.apple.com/documentation/ 
userexperience/Conceptual/AppleHIGuidelines/ 
XHIGInstallationsUpdates/chapter_10_section_3.html#//apple_ref/doc/ 
uid/TP40002722-CJACABIA


I couldn't find the page you mention above.


In other words, the default case is for applications to be able to run
from /Applications, ~/Applications, /Network/Applications, or even
/TheDepthsOfSpace.  If your app has no functionality that mandates it
run /Applications, then I should be able to put it on my USB Mass
Storage candy-cane and run it from there.


It wouldn't really make sense to be able to run it from anywhere  
other than "/Applications" on the system drive.


All the Best
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


batch processing

2008-12-16 Thread 양승준
Hi, I would like to write a code to batch process files in a directory. I mean 
I would like to open, process, and store files one-by-one. My plan is to read 
names of files into a nsmutablearray, and process them one-by-one. Is there a 
more or less standard way to do a batch processing? 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: Where is the Computer Image ?

2008-12-16 Thread Gerriet M. Denkmann


On 16 Dec 2008, at 08:43, Brandon Walkin wrote:

The image is in /System/Library/CoreServices/CoreTypes.bundle/ 
Contents/Resources


This works fine:
NSImage *anImage = [ NSImage imageNamed: NSImageNameComputer ];

but how to get an image of a black MacBook? (My computer is white.)

Is hardcoding the name like:
NSImage *anImage = [ [ [ NSImage alloc ] initByReferencingFile: @"/ 
System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ 
com.apple.macbook-black.icns" ] autorelease ];


really the only solution?
Looks kind of fragile to me.


Kind regards,

Gerriet.

___

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

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

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

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


Re: More - Safari Download Security Alerts

2008-12-16 Thread matt . gough


On 16 Dec 2008, at 13:54, Dave wrote:

I don't install files into that folder, my application writes files  
to that location (by default, the user can change it) once  
installed. From the above document:
"It is important to remember that the user domain (/Users) is  
intended for files created by the user. With the exception of the ~/ 
Library directory, your application should never ***install*** files  
into the user’s home directory. In particular, you should never  
install files into a user’s Documents directory or into the /Users/ 
Shared directory. These directories should only be modified by the  
user."


They keyword here is ***install***.



OK, so if these files are really your apps 'documents' (ie the user- 
driven output of your app) then they should probably go into ~/ 
Documents/MyApp instead of ~/MyApp by default. If they are just  
settings/caches/other things then they belong somewhere in  ~/Library.  
It is very uncommon for applications to write directly into ~/ on the  
Mac. (Looking on my own home folder, on a machine with multiple 3rd  
Party products in use for 2 years there are no (zero, zilch) non- 
standard folders/files that have been created by anything. By all  
means allow the user to define the default location.


Please note that the replies you got on this list may seem a bit  
snobby ("Don't put that there", "don't do that", "why do you want to  
do that" etc) if you are coming from another platform. Please  
understand that these are only intended as suggestions to help your  
app feel familiar to Mac users (i.e your potential customers). If you  
deviate too much from what they expect just to fit in with the way you  
do things on other platforms (which these customers have probably  
never used) then you will just confuse/frustrate them.


Matt Gough___

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: How to find nearest food courts in iPhone

2008-12-16 Thread Buddy Kurz
Thanks for posting that link - great article - should be required  
reading here.


On Dec 16, 2008, at 4:31 AM, Glenn Sequeira wrote:

On Tue, Dec 16, 2008 at 2:21 PM, SridharRao M   
wrote:



How we can find out nearest food courts to the current iphone palce
through program.
I think with the CoreLocation Framework we can find out current  
place of the

iPhone.


A solution to a similar problem was posted on the web last week:

http://mattgemmell.com/2008/12/08/what-have-you-tried

~glenn
___

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/buddykurz%40mac.com

This email sent to buddyk...@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: Where is the Computer Image ?

2008-12-16 Thread Benjamin Dobson


On 16 Dec 2008, at 16:45:44, Gerriet M. Denkmann wrote:



On 16 Dec 2008, at 08:43, Brandon Walkin wrote:

The image is in /System/Library/CoreServices/CoreTypes.bundle/ 
Contents/Resources


This works fine:
NSImage *anImage = [ NSImage imageNamed: NSImageNameComputer ];

but how to get an image of a black MacBook? (My computer is white.)


NSImageNameComputer is the icon for the whatever computer is being  
used. In addition, the black MacBook was replaced in October, so do  
you really want to keep the old image? 
___


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: More - Safari Download Security Alerts

2008-12-16 Thread Kyle Sluder
On Tue, Dec 16, 2008 at 8:02 AM, Dave  wrote:
> It wouldn't really make sense to be able to run it from anywhere other than
> "/Applications" on the system drive.

I'm sorry but I find this hard to believe.  What is your application
doing that it's installation location is relevant to its operation?

--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: More - Safari Download Security Alerts

2008-12-16 Thread Geoff Beier
On Tue, Dec 16, 2008 at 9:25 AM, Dave  wrote:
>
> This has worked wonderfully since MacOS X 10.3.x.
>
> There 10.5.x was released and the above still works BUT, we get 4 or 5
> security dialogs.
>
> We just want to suppress all but the first.
>

You were given this advice last week:

On Fri, Dec 12, 2008 at 2:28 PM, Jim Puls  wrote:
> Mike is right - don't roll your own installer - but for the record, if you
> want to bypass the warning for your real app after the user has accepted the
> warning in for your installer, look at the keys and constants in
>  for what you can pass to
> LSSetItemAttribute() in LaunchServices.

I think it should work if you don't feel like PackageMaker works for
you. Did you try it? Did it work?

Geoff
___

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


What is the default time for a CALayer transform?

2008-12-16 Thread Gustavo Pizano

Hello

Im rotating a layer, with the following method :

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

but then I want right after the animation ends, to  check the new  
position of the CALayer to align it into the closest grid cell  which  
will belong.  I found out I can use the following method to try to  
sync the animation ending time to what I want to do:


[self performSelector:@selector(printSomethinng) withObject:nil  
afterDelay:0.5];


of course  the selector here is something I tried, and the delay I  
started at 1.0 and started to lower it till I get ( at eyes sight )  
that once the animation finishes  I get a message in the console.


I have been reading but I dunno what's the default  time  for an  
animation into a CALayer when you use @"transform.rotation.z" or just  
the transfom property., so I can set the delay exactly at time.


Thanks

Gustavo.

PD I was trying with a CAAnimation and the aplying it to the CALayer,  
so I could use the method  -(void)animationDidStop: finished: , but  
when the animation ended  it returned to the initial state, kinda  
derotated the CALayer, which I don't want such a behavior, I was told  
to set  the autpreverse option to NO, and add a group, this last thing  
I couldn't achieve it. didn't know how to do it.



___

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: More - Safari Download Security Alerts

2008-12-16 Thread Dave


On 16 Dec 2008, at 17:17, Geoff Beier wrote:


On Tue, Dec 16, 2008 at 9:25 AM, Dave  wrote:


This has worked wonderfully since MacOS X 10.3.x.

There 10.5.x was released and the above still works BUT, we get 4  
or 5

security dialogs.

We just want to suppress all but the first.



You were given this advice last week:


Yes, I know and I took it! Caused more problems, please see all of  
the email you are copying from.



On Fri, Dec 12, 2008 at 2:28 PM, Jim Puls  
 wrote:
Mike is right - don't roll your own installer - but for the  
record, if you
want to bypass the warning for your real app after the user has  
accepted the

warning in for your installer, look at the keys and constants in
 for what you can pass to
LSSetItemAttribute() in LaunchServices.


I think it should work if you don't feel like PackageMaker works for
you. Did you try it? Did it work?


From the same email the above is from:


 We just want to suppress all but the first.

In response to this I was advised to use PackageMaker in order to  
create an Installer, which would in turn suppress the Security  
dialogs. So I built an installer but I can't get it to install the  
folder containing file, so far I have only managed to get it to  
install the myApp.app file.


So, my question is:

Is it possible to create an installer with package maker that does  
the same as the AppleScript, e.g. installs a folder in "/ 
Applications" (or anywhere for that matter).


All the Best
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


Pressable Button

2008-12-16 Thread Gerriet M. Denkmann
I am trying to build a pressable button: an on-off button (subclass of  
NSButton), which, if pressed for more than 0.3 seconds, displays a  
context menu.


My idea was:
Start a non-repeating timer in mouseDown: and schedule it with  
NSEventTrackingRunLoopMode.


In mouseUp: invalidate the timer.

And in timerFired: display the context menu.

But: mouseUp: is never called. So: where should I invalidate the timer?

And: if I send: [ NSMenu popUpContextMenu: menu withEvent:  
mouseDownEvent  forView: self ]
the button gets all messed up: no more drawRect: on mouse up, no  
action sent.


Obviously I am doing it all wrong.


Kind regards,

Gerriet.

___

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

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

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

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


Re: NSOutlineView assertion failure on collapse

2008-12-16 Thread Corbin Dunn

Hi Roland,
Can you reliable reproduce this problem? If so, can you please log a  
bug, including your test application (or a link to download it). Or,  
ideally, if you have source code that can be compiled that makes  
things even easier to debug.


-corbin

On Dec 15, 2008, at 11:08 AM, Roland Rabien wrote:

I'm having an NSOutlineView Assertion Failure on collapse if the  
selected

item is a child (or child of child, etc) of the item that is being
collapsed. Has anyone else had this problem? I've searched the list  
all the
related posts seem to indicate threading is the cause, but my  
application
isn't using any threads. I'm using XCode 3.1 and targeting 10.5  
(Intel). I
never call reloadData on my NSOutLineView, so it's data should be  
constant.

Any ideas?

 Assertion failure in -[NSOutlineView
_expandItemEntry:expandChildren:startLevel:](),
/SourceCache/AppKit/AppKit-949.35/TableView.subproj/NSOutlineView.m: 
1003*



#0 0x92a42c66 in -[NSException raise]

#1 0x9259ef22 in -[NSOutlineView collapseItem:collapseChildren:]

#2 0x92306c9a in -[NSOutlineView
_doUserExpandOrCollapseOfItem:isExpand:optionKeyWasDown:]

#3 0x9230679e in -[NSOutlineView  
mouseTracker:didStopTrackingWithEvent:]


#4 0x923065ce in -[NSMouseTracker stopTrackingWithEvent:]

#5 0x92278d03 in -[NSMouseTracker trackWithEvent:inView:withDelegate:]

#6 0x921bdb54 in -[NSOutlineView mouseDown:]

#7 0x9216476b in -[NSWindow sendEvent:]

#8 0x92131311 in -[NSApplication sendEvent:]

#9 0x9208ed0f in -[NSApplication run]

#10 0x9205bf14 in NSApplicationMain

#11 0x1c70 in main at main.m:13
___


___

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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Dimitri Bouniol
It's because you are multiplying/dividing a double (M_PI) by and int,  
so you get an int. A 90° angle in radians is defined as π/2, so try  
the constant M_PI_2. Hope that works :3


PS. You can also make an int into a float by appending a "." to the  
number, as such: 90. * M_PI / 180. ; but using M_PI_2 should give much  
more accurate results, and may be slightly faster (pre-calculated  
constant).


On Dec 16, 2008, at 3:31 AM, Gustavo Pizano wrote:

mm no. let me try it.m... nop it didn't work. still the image after  
the transition its blurred.


Gus


On 16.12.2008, at 12:22, Martin Carlberg wrote:


Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I  
click on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its  
kinda blurry I dunno how to rotate the layer without loosing  
quality.


the contents of the layer its .png


Thanks


Gus
___

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/martin%40oops.se

This email sent to mar...@oops.se




___

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/dimitri008%40mac.com

This email sent to dimitri...@mac.com


--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: More - Safari Download Security Alerts

2008-12-16 Thread Geoff Beier
Sorry. I was pointing to a different part of the advice:

>>> you
>>> want to bypass the warning for your real app after the user has accepted
>>> the
>>> warning in for your installer, look at the keys and constants in
>>>  for what you can pass to
>>> LSSetItemAttribute() in LaunchServices.
>>
>> I think it should work if you don't feel like PackageMaker works for
>> you. Did you try it? Did it work?
>

Did you try calling LSSetItemAttribute() on your cleanup bundle and on
your real application? (or shelling out to xattr if that's easier from
the context of your installer?) Did it fix your warnings? What
problems did it cause you? All I saw in your follow-up was discussion
about packagemaker. Did I miss where you talked about trying the
LaunchServices calls?

Regards,

Geoff
___

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


Sublclassing NSThread

2008-12-16 Thread Brad O'Hearne

Hello,

I am trying to create an NSThread subclass which completely wraps the  
desired behavior of the thread execution. Now typically when creating  
a new thread instance, it seems one will use the  
initWithTarget:selector:object initializer to properly direct the  
thread's execution. But what if I want the thread subclass to invoke a  
method within itself? This leaves you with a situation where you have  
to set the target to self within the initializer, but that seems  
problematic, as "self" is not yet defined, i.e.:


- (id)init {
self = [super initWithTarget:self @selector(myMethod) object:nil];
return self;
}

As you can see, the initWithTarget: param is set to self, but the  
purpose of that statement is to set self, and self isn't defined yet  
to my knowledge. I'd otherwise just use the NSThread's init method,  
but I do not see a way to  set the target as a property on the thread  
object once initialized.  So my question is, in Objective C, is the  
typical approach to wrapping behavior entirely within an NSThread  
subclass to override the start method, as such:


- (void) start {
[super start];
[self myMethod];
}

Is this the recommended approach, or is there another way to go about  
this?


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


How to make NSURLConnection send delegate messages during runModalForWindow

2008-12-16 Thread an00na

I want to handle the connection events during runModalForWindow, so I use
[connection scheduleInRunLoop:[NSRunLoop currentRunLoop]  
forMode:[[NSRunLoop currentRunLoop] currentMode]];

in the modal window's windowDidBecomeKey delegate method.

But still my connection's delegate methods are not called until stopModal.

Is there anything I misunderstood about NSURLConnection's  
scheduleInRunLoop:forMode: method?

___

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

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

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

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


Re: Write to file.

2008-12-16 Thread Jean-Daniel Dupas


Le 16 déc. 08 à 13:47, Macarov Anatoli a écrit :

I have admin rights. But I can't use NSUserDefaults because upon  
starting  system in login window I'm not in user account, and there  
the function doesn't work.. After authorization and login in user  
account the function will work because detects what user account you  
work from.




And using CFPreferences API ?
There is options to choose preferences domain (user, machine, …) using  
this API.


___

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: More - Safari Download Security Alerts

2008-12-16 Thread Dave

Hi,

On 16 Dec 2008, at 13:17, Kyle Sluder wrote:


On Tue, Dec 16, 2008 at 8:02 AM, Dave  wrote:
It wouldn't really make sense to be able to run it from anywhere  
other than

"/Applications" on the system drive.


I'm sorry but I find this hard to believe.  What is your application
doing that it's installation location is relevant to its operation?


I can't explain fully because it's propriety and I really don't have  
the time! Basically it can be launched by other applications and we  
need to ensure as much as possible that it is available to be  
launched. If it's on a volume other than the System volume then there  
is less chance that it will be available. There is more to it than  
that, but I can't say much more for the above reasons.


All the Best
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: More - Safari Download Security Alerts

2008-12-16 Thread Dave


On 16 Dec 2008, at 17:46, Geoff Beier wrote:


Sorry. I was pointing to a different part of the advice:


you
want to bypass the warning for your real app after the user has  
accepted

the
warning in for your installer, look at the keys and constants in
 for what you can pass to
LSSetItemAttribute() in LaunchServices.


I think it should work if you don't feel like PackageMaker works for
you. Did you try it? Did it work?




Did you try calling LSSetItemAttribute() on your cleanup bundle and on
your real application? (or shelling out to xattr if that's easier from
the context of your installer?) Did it fix your warnings? What
problems did it cause you? All I saw in your follow-up was discussion
about packagemaker. Did I miss where you talked about trying the
LaunchServices calls?


Sorry, I misunderstood. I haven't used any LaunchServices calls, it  
wouldn't really work anyway, since I'd get still get 2 or 3 security  
dialogs and I just want one (or none).


1.  Download .dmg file.
2.  Mount the Image (Security Dialog).
3.  Launch the Installer AppleScript (Security Dialog).
4.  Launch the CleanUp AppleScript Security Dialog).
5.  Launch the Real App, (Security Dialog after doing the  
LaunchServices magic).



All I have done is to create an Installer with PackageMaker, but I  
can't get it to installer a folder with the files in it.


All the Best
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: What is the default time for a CALayer transform?

2008-12-16 Thread Dimitri Bouniol

-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {
NSLog(@"%@",[nLayer name]);

CATransform3D transform = nLayer.transform;
		transform = CATransform3DRotate(transform, M_PI_2, 0, 0, 1.0); //  
rotate additional 90 degrees


		CAAnimation* rotateAnimation = [CABasicAnimation  
animationWithKeyPath:@"transform"];
		rotateAnimation.fromValue = [NSValue  
valueWithCATransform3D:nLayer.transform];

rotateAnimation.toValue = [NSValue 
valueWithCATransform3D:transform];
rotateAnimation.duration = 0.4;
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self];

[CATransaction begin];
		[CATransaction setValue:(id)bCFBooleanTrue  
forKey:kCATransactionDisableActions];
		nLayer.transform = transform; // set the layers "actual" value  
without the user noticing

[CATransaction commit];

		[nLayer addAnimation:rotateAnimation  
forKey:@"RotationAnimation"]; // set this so it replaces the previous  
rotation if you click before 0.4 sec


}

}

Hope that works :3 (apologies if I forgot a semicolon or something, i  
wrote it directly in mail)


On Dec 16, 2008, at 5:54 AM, Gustavo Pizano wrote:



Dimitri Hi

using CAAnimation this is what I was doing:

-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {
NSLog(@"%@",[nLayer name]);
CAAnimation* rotateAnimation = [self animateForRotating];   
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self]; 
[nLayer addAnimation:rotateAnimation forKey:@"whatever"];

}

}


-(CAAnimation *)animateForRotating
{
float radians = 90 * M_PI / 180;
CATransform3D transform;
transform = CATransform3DMakeRotation(radians, 0, 0, 1.0);
CABasicAnimation* animation;
   animation = [CABasicAnimation animationWithKeyPath:@"transform"];
animation.toValue = [NSValue valueWithCATransform3D:transform];
animation.duration = 0.4;
   animation.cumulative = NO;
return animation;
}

but hte animation once finished returned the layer  to the initial  
position something undesirable, I then set up a  
animation.autoreverse = NO; but that didn't help either. I can see  
here, somehow using CAAnimation its better, I can have more control  
on how the rotation should look.


What do you think?

Thanks  tons for your help


Gus



On 16.12.2008, at 14:37, Dimitri Bouniol wrote:

The Core Animation Programing Guide — http://developer.apple.com/documentation/Cocoa/Conceptual/CoreAnimation_guide/Articles/AnimProps.html 
#//apple_ref/doc/uid/TP40005942-SW2 — indicates 0.25 seconds are  
used for an implicit animation.
As for using CABasicAnimation so you could use the delegate calls,  
set the property (or key path) to the final value before adding the  
animation to the layer, and you should get more appropriate results  
as the animation ends. Additionally, you might need to wrap the  
property call in a CATransaction to disable actions, but I don't  
know if it's absolutely necessary.




--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: More - Safari Download Security Alerts

2008-12-16 Thread Dave

Hi All,

This thread seems have to have wondered about a bit. This is an  
attempt to simplify what I am trying to achieve. Before 10.5.x we had  
the following:


1.  A .dmg file containing an Installer AppleScript Application  
(called "Double Click to Install & Launch".app) and a Folder. The  
Installer  copies the folder from the image to "/Applications" on the  
system volume.


2.  Once the folder had been copied, it launches another AppleScript  
App (called "CleanUp.app"). This ejects the image and launches the  
main application.


This has worked wonderfully since MacOS X 10.3.x.

There 10.5.x was released and the above still works BUT, we get 4 or  
5 security dialogs.


We just want to suppress all but the first.

In response to this I was advised to use PackageMaker in order to  
create an Installer, which would in turn suppress the Security  
dialogs. So I built an installer but I can't get it to install the  
folder containing file, so far I have only managed to get it to  
install the myApp.app file.


So, my question is:

Is it possible to create an installer with package maker that does  
the same as the AppleScript, e.g. installs a folder in "/ 
Applications" (or anywhere for that matter).


Thanks a lot
All the Best
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: Pressable Button

2008-12-16 Thread Stéphane Sudre


On Dec 16, 2008, at 4:02 PM, Gerriet M. Denkmann wrote:

I am trying to build a pressable button: an on-off button (subclass  
of NSButton), which, if pressed for more than 0.3 seconds, displays  
a context menu.


My idea was:
Start a non-repeating timer in mouseDown: and schedule it with  
NSEventTrackingRunLoopMode.


In mouseUp: invalidate the timer.

And in timerFired: display the context menu.

But: mouseUp: is never called. So: where should I invalidate the  
timer?


And: if I send: [ NSMenu popUpContextMenu: menu withEvent:  
mouseDownEvent  forView: self ]
the button gets all messed up: no more drawRect: on mouse up, no  
action sent.


Obviously I am doing it all wrong.


I have a button like this.

I use performSelector:withObject:afterDelay: in the mouseDown:, cancel  
the delayed perform in mouseDragged: if the mouse cursor is outside  
the button frame, put back the delayed perform if the mouse cursor  
comes back in the button frame.


On mouseUp: I cancel the delayed perform if needed.


___

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: Sublclassing NSThread

2008-12-16 Thread j o a r


On Dec 16, 2008, at 9:29 AM, Brad O'Hearne wrote:

Is this the recommended approach, or is there another way to go  
about this?



Have you considered using NSOperation / NSOperationQueue? From what  
you're saying I think that would be the preferred building block for  
this type of thing starting with Mac OS X 10.5 Leopard.


j o a r


___

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

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

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

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


Re: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Dimitri Bouniol
Perhaps it has something to do with HPS (half-pixel syndrome). Maybe  
as you rotate the layer, the x-coord (which was a y-coord) now lies on  
0.5 pixels. Try checking the layer.frame.origin point to see if it is  
expressed in whole numbers.


On Dec 16, 2008, at 5:59 AM, Gustavo Pizano wrote:

I was thinking about that, I put a 90.0f  but that didn't help let  
me see the M_PI_2 works. nop once it gets to vertical position  
the image its not focused.


:S


Gus.


On 16.12.2008, at 14:48, Dimitri Bouniol wrote:

It's because you are multiplying/dividing a double (M_PI) by and  
int, so you get an int. A 90° angle in radians is defined as π/2,  
so try the constant M_PI_2. Hope that works :3


PS. You can also make an int into a float by appending a "." to the  
number, as such: 90. * M_PI / 180. ; but using M_PI_2 should give  
much more accurate results, and may be slightly faster (pre- 
calculated constant).


On Dec 16, 2008, at 3:31 AM, Gustavo Pizano wrote:

mm no. let me try it.m... nop it didn't work. still the image  
after the transition its blurred.


Gus


On 16.12.2008, at 12:22, Martin Carlberg wrote:


Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I  
click on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] +  
[[nLayer valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its  
kinda blurry I dunno how to rotate the layer without loosing  
quality.


the contents of the layer its .png


Thanks


Gus
___

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/martin%40oops.se

This email sent to mar...@oops.se


--
定魅刀利
Dimitri Bouniol
dimitri...@mac.com
http://www.appkainime.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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Gustavo Pizano
mm no. let me try it.m... nop it didn't work. still the image after  
the transition its blurred.


Gus


On 16.12.2008, at 12:22, Martin Carlberg wrote:


Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I click  
on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its kinda  
blurry I dunno how to rotate the layer without loosing quality.


the contents of the layer its .png


Thanks


Gus
___

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/martin%40oops.se

This email sent to mar...@oops.se




___

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


Solved - sorta (Was: NSURLConnection & NSInputStream issue)

2008-12-16 Thread David LeBer


On 15-Dec-08, at 4:45 PM, David LeBer wrote:


Hello all,

I have a requirement where I need to send a chunked file (about 2MB  
at a time) to a server. Each chunk is embedded as a base64 encoded  
string in the body of an HTML POST request.


I'm working on a proof of concept dev spike and I've got this code  
which fails:


- (void) callUploadAssetChunk
{
  NSString *contentString = [[NSString alloc]  
initWithFormat:@"contactInfoXML=%@&mediaValueID=%@&hash= 
%@&chunkIndex=%d&chunk=%@",

 [self contactInfoXML],
 [[self currentAsset] mediaValueId],
 [[[self currentAsset]  
currentUploadChunk] chunkHash],
 [[[self currentAsset]  
currentUploadChunk] chunkIndex],
 [[[self currentAsset]  
currentUploadChunk] encodedChunkData]];


  NSData *contentData = [ NSData dataWithBytes: [ contentString  
UTF8String ] length: [ contentString length ] ];


  NSString *path = [NSString stringWithFormat:@"%@/ 
UploadAssetChunk", kWebMethodsFull];


  NSURL *url = [[NSURL alloc] initWithScheme:kURLScheme host: 
[uploadUrl stringValue] path:path];


  NSMutableURLRequest *request = [[NSMutableURLRequest alloc]  
initWithURL:url];


  [request setHTTPMethod: @"POST"];

  NSInputStream *dataStream = [NSInputStream  
inputStreamWithData:contentData];


  [request setHTTPBodyStream:dataStream];

  [self setChunkUploadConnection:[NSURLConnection  
connectionWithRequest:request delegate:self]];


  [url release];
  [request release];
}

In looking at the wire, I see the HTTP headers go by, but there is  
no body content. If I bypass the NSInputStream with the NSData and  
replace:


[request setHTTPBodyStream:dataStream];

With:

[request setHTTPBody:contentData];

Everything works fine.

I am testing with an NSInputStream because I'd like to be able to  
query it to get an upload progress for the user. So, it looks like I  
am either misreading the NSURL* API (possible) or missing something  
obvious in creating the NSInputStream (also possible). If anyone has  
any suggestions, I'd love to hear it.


It is so frustratingly close. If it weren't for those darn needy  
users and their dislike of not knowing what was going on, I'd be  
done now :-)



I still don't know why this wasn't working but after mucho reading I  
came to the conclusion that even if it did, there was no guarantee I'd  
be able to get the progress info I needed from the NSInputStream so I  
decided to punt. I ended up using Dave Dribin's very nice DDCurl*  
libcurl wrapper.


It already has DDCurlConnection and DDMutableCurlRequest which are  
very similar in API to the NSURL*, I just had to modify  
DDMutableCurlRequest to add the HTTPBody attribute and I was off to  
the races.


Progress indicator progressing and everything.

*< http://www.dribin.org/dave/software/>

;david

--
David LeBer
Codeferous Software
'co-def-er-ous' adj. Literally 'code-bearing'
site:   http://codeferous.com
blog:   http://davidleber.net
profile:http://www.linkedin.com/in/davidleber
twitter:http://twitter.com/rebeld
--
Toronto Area Cocoa / WebObjects developers group:
http://tacow.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


Re: How to find nearest food courts in iPhone

2008-12-16 Thread Andrew Farmer

On 16 Dec 08, at 03:21, SridharRao M wrote:

How we can find out nearest food courts to the current iphone palce
through program.

I think with the CoreLocation Framework we can find out current  
place of the

iPhone.



+[NSFoodCourt nearestFoodCourts], of course. :P

But seriously: this is an application-domain problem which you will  
need to solve yourself.  Core Location will tell you (to a reasonable  
degree of accuracy) where you are, but figuring out where that is in  
relation to points of interest is your responsibility. There are a  
number of mapping services available online which may be able to solve  
this problem for you, but they're completely outside the scope of  
Cocoa programming.

___

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: Sublclassing NSThread

2008-12-16 Thread Ken Thomases

On Dec 16, 2008, at 11:29 AM, Brad O'Hearne wrote:

I am trying to create an NSThread subclass which completely wraps  
the desired behavior of the thread execution.


I don't understand what you're trying to say here.

Why is overriding the -main method not sufficient?  That's what's  
suggested in the NSThread documentation.


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: More - Safari Download Security Alerts

2008-12-16 Thread Geoff Beier
I see. I didn't catch the dialog on the disk image itself. While
diving into package maker is the right thing to do, you should be able
to fix your installer so that your workflow looks like:

1. Download the .dmg file.
2. Mount the image. (security dialog? i don't think i get these)
3. Launch the installer script (security dialog. no way around this one)
Then the installer:
a. creates your directory
b. copies your cleanup app, real app, etc. to your directory
c. uses either the launch servcies calls (actually xattr probably
makes more sense from an applescript) to clear the quarantine
attributes from the cleanup app and real app
4. cleanup app (no security dialog thanks to the above)
5. real app (ditto)

If that's a good enough workflow to get your demo out the door and buy
you some time to learn packagemaker, clearing those attributes ought
to be an easy addition to your install script.


HTH,

Geoff

On Tue, Dec 16, 2008 at 12:55 PM, Dave  wrote:
>
> On 16 Dec 2008, at 17:46, Geoff Beier wrote:
>
>> Sorry. I was pointing to a different part of the advice:
>>
> you
> want to bypass the warning for your real app after the user has
> accepted
> the
> warning in for your installer, look at the keys and constants in
>  for what you can pass to
> LSSetItemAttribute() in LaunchServices.

 I think it should work if you don't feel like PackageMaker works for
 you. Did you try it? Did it work?
>>>
>>
>> Did you try calling LSSetItemAttribute() on your cleanup bundle and on
>> your real application? (or shelling out to xattr if that's easier from
>> the context of your installer?) Did it fix your warnings? What
>> problems did it cause you? All I saw in your follow-up was discussion
>> about packagemaker. Did I miss where you talked about trying the
>> LaunchServices calls?
>
> Sorry, I misunderstood. I haven't used any LaunchServices calls, it wouldn't
> really work anyway, since I'd get still get 2 or 3 security dialogs and I
> just want one (or none).
>
> 1.  Download .dmg file.
> 2.  Mount the Image (Security Dialog).
> 3.  Launch the Installer AppleScript (Security Dialog).
> 4.  Launch the CleanUp AppleScript Security Dialog).
> 5.  Launch the Real App, (Security Dialog after doing the LaunchServices
> magic).
>
>
> All I have done is to create an Installer with PackageMaker, but I can't get
> it to installer a folder with the files in it.
>
> All the Best
> 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: More - Safari Download Security Alerts

2008-12-16 Thread Kyle Sluder
On Mon, Dec 15, 2008 at 1:26 PM, Dave  wrote:
> It doesn't write any user specific data within "/Applications", any files it
> does create and in the current users "home" folder, in a folder for the
> Application.

Your files belong in ~/Library/Application Support/YourSubfolder, not
in ~/YourSubfolder.  See the section of the "File System Overview"
document entitled "Don't Pollute User Space":
http://developer.apple.com/documentation/MacOSX/Conceptual/BPFileSystem/Articles/WhereToPutFiles.html#//apple_ref/doc/uid/TP40001411-111946

> Only admin's are required to install the App.

Just because only admins need to install it doesn't imply that they
don't want to run it from elsewhere.

--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: More - Safari Download Security Alerts

2008-12-16 Thread Graham Lee
On 15/12/2008 17:41, "Dave"  wrote:

> Hi,
>
> I looked at the Man page below, I can't see anything that says
> "udifrez". Is this meant for me? I'm not sure what I am supposed to
> do with it.
>

Hi Dave, on my system (10.5.6):

 udifrez [options] image
Attaches resources (software license agreements, for
example)
to a disk image.

Hope that helps,
Graham.

--
Graham Lee
Senior Macintosh Software Engineer, Sophos Plc.
+44 1235 540266
http://www.sophos.com/


Sophos Plc, The Pentagon, Abingdon Science Park, Abingdon, OX14 3YP, United 
Kingdom.
Company Reg No 2096520. VAT Reg No GB 348 3873 20.
___

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: How to find nearest food courts in iPhone

2008-12-16 Thread Glenn Sequeira
On Tue, Dec 16, 2008 at 2:21 PM, SridharRao M  wrote:

>  How we can find out nearest food courts to the current iphone palce
> through program.
> I think with the CoreLocation Framework we can find out current place of the
> iPhone.

A solution to a similar problem was posted on the web last week:

http://mattgemmell.com/2008/12/08/what-have-you-tried

~glenn
___

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


[moderator] Re: How to find nearest food courts in iPhone

2008-12-16 Thread Scott Anguish


On 16-Dec-08, at 6:21 AM, SridharRao M wrote:


Hi All,
How we can find out nearest food courts to the current iphone palce
through program.
I think with the CoreLocation Framework we can find out current  
place of the


This is an application area question, not a Cocoa or Cocoa Touch  
question.


BTW, do not crosspost between cocoa-dev and other lists.



___

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: Pressable Button

2008-12-16 Thread Peter Ammon


On Dec 16, 2008, at 7:02 AM, Gerriet M. Denkmann wrote:

I am trying to build a pressable button: an on-off button (subclass  
of NSButton), which, if pressed for more than 0.3 seconds, displays  
a context menu.


Consider using a single-segment NSSegmentedControl.  It has this  
behavior built-in.


-Peter

___

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

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

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

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


Re: More - Safari Download Security Alerts

2008-12-16 Thread Kyle Sluder
On Mon, Dec 15, 2008 at 1:23 PM, Dave  wrote:
> But that isn't the requirement, we just want it installed in "/Applications"
> and accessible to all users, that's it!

By which do you mean "it's not a requirement that we have thought of?"

See the HIG: 
http://developer.apple.com/documentation/userexperience/Conceptual/AppleHIGuidelines/XHIGInstallationsUpdates/chapter_10_section_3.html#//apple_ref/doc/uid/TP40002722-CJACABIA

In other words, the default case is for applications to be able to run
from /Applications, ~/Applications, /Network/Applications, or even
/TheDepthsOfSpace.  If your app has no functionality that mandates it
run /Applications, then I should be able to put it on my USB Mass
Storage candy-cane and run it from there.

--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: What is the default time for a CALayer transform?

2008-12-16 Thread Gustavo Pizano

Hello Dimitri.

CAAnimation* rotateAnimation = [CABasicAnimation  
animationWithKeyPath:@"transform"];
		rotateAnimation.fromValue = [NSValue  
valueWithCATransform3D:nLayer.transform];
		rotateAnimation.toValue = [NSValue  
valueWithCATransform3D:transform];


its gives me an error, Error request for member "fromValue" in  
something  not a structure  or union.
shouldn't it be CABasicAnimation which has the fromValue and toValue  
properties.?



On 16.12.2008, at 15:13, Dimitri Bouniol wrote:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {
NSLog(@"%@",[nLayer name]);

CATransform3D transform = nLayer.transform;
		transform = CATransform3DRotate(transform, M_PI_2, 0, 0, 1.0); //  
rotate additional 90 degrees


		CAAnimation* rotateAnimation = [CABasicAnimation  
animationWithKeyPath:@"transform"];
		rotateAnimation.fromValue = [NSValue  
valueWithCATransform3D:nLayer.transform];
		rotateAnimation.toValue = [NSValue  
valueWithCATransform3D:transform];

rotateAnimation.duration = 0.4;
[rotateAnimation setValue:nLayer forKey:@"rotatedLayer"];
[rotateAnimation setDelegate:self];

[CATransaction begin];
		[CATransaction setValue:(id)bCFBooleanTrue  
forKey:kCATransactionDisableActions];
		nLayer.transform = transform; // set the layers "actual" value  
without the user noticing

[CATransaction commit];

		[nLayer addAnimation:rotateAnimation  
forKey:@"RotationAnimation"]; // set this so it replaces the  
previous rotation if you click before 0.4 sec


}

}

Hope that works :3 (apologies if I forgot a semicolon or something,  
i wrote it directly in mail)


On Dec 16, 2008, at 5:54 AM, Gustavo Pizano wrote:


___

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: Where is the Computer Image ?

2008-12-16 Thread Klaus Backert


On 16.12.2008, at 17:45, Gerriet M. Denkmann wrote:



On 16 Dec 2008, at 08:43, Brandon Walkin wrote:

The image is in /System/Library/CoreServices/CoreTypes.bundle/ 
Contents/Resources


This works fine:
NSImage *anImage = [ NSImage imageNamed: NSImageNameComputer ];

but how to get an image of a black MacBook? (My computer is white.)

Is hardcoding the name like:
NSImage *anImage = [ [ [ NSImage alloc ] initByReferencingFile: @"/ 
System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ 
com.apple.macbook-black.icns" ] autorelease ];


really the only solution?
Looks kind of fragile to me.



Well, I don't know why you want a black MacBook image. On my white  
MacBook the correct – white – image is shown, which is just what I  
want. But, as they usually say on these mailing lists, YMMV – young  
man ... no ... your mileage may vary :-))


Kind regards
Klaus

___

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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Martin Carlberg

Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I click  
on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its kinda  
blurry I dunno how to rotate the layer without loosing quality.


the contents of the layer its .png


Thanks


Gus
___

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/martin%40oops.se

This email sent to mar...@oops.se


___

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: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-16 Thread Thomas Clement

On Dec 15, 2008, at 10:50 PM, David Duncan wrote:


On Dec 15, 2008, at 12:47 PM, Thomas Clement wrote:



Alright but how am I suppose to draw a part of the image without  
loading the whole image from disk first?
Creating a NSBitmapImageRep requires creating a NSData with the  
whole image.
I tried using CGBitmapContextCreate but I got a malloc error again  
when calling CGContextDrawImage (passing a small rect to draw).



If you use the bitmap context method, then you create a context that  
is the size of the image data that you want (so if you want a 20x20  
section of the image, you create a 20x20 context) then draw the  
whole image to it. If you use ImageIO to load the image, then it  
will only load portion of the image required to draw that area. In  
order to get the correct part of the image, you would need to  
translate the context (via CGContextTranslateCTM for example) to  
position the image correctly.


That's right, I was not doing it correctly, this is now working.
Also I noticed I can call CGImageCreateWithImageInRect to create a new  
CGImage which is a smaller area of the original image and then call  
CGImageGetDataProvider and CGDataProviderCopyData to get the pixel data.
Seem easier and faster too. However CGDataProviderCopyData is 10.5  
minimum.



Thanks!
Thomas

___

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: Text track in QTMovie

2008-12-16 Thread Joe Turner

Sorry for taking so long.

Okay, what I am looking for is the contents of the text track. Like,  
for a movie, it would be the chapter names and times.


The issue is that I am making this for someone who is using  
AppleScript, and is just using a call method on my method to do this.  
So, the Debugger will not stop at my breakpoints (I thought it did,  
even if it is being called by a call method).


Anyways, I guess what I am looking for is an error in the code I have  
created. Like, am I passing something wrong? Am I trying to parse  
something as a different format than it is? I can create a new project  
and do this and tell you the debugger contents too though, if needed.


I am used to objective-c, and some of these C calls can confuse me  
sometimes. Like, is chars[] the same thing as a UInt8?


Thanks for your help,

Joe
On Dec 14, 2008, at 8:54 PM, douglas welton wrote:


when you say it won't show you the "track names" do you mean:

a) your NSLog() function is failing and nothing is printed
b) NSLog() prints something, but the value of string appears to be  
either nil or empty (which one?)
c)  you really want the name of the track (i.e., the thing displayed  
in the QT Player) and not the text in each sample. If this is the  
case then we have to do something entirely different ;^}
d) all of the function calls succeed and when examined in the  
debugger you can see the values for size and chars[] are valid but  
your NSString cannot be properly constructed.


Can you clarify?  BTW, what values are you seeing in the debugger?

On Dec 14, 2008, at 8:33 PM, Joe Turner wrote:

Okay, so I did what you said, but yet, it still won't show me the  
track names. Here is my code:


Media media = [movieView movie]  
tracksOfMediaType:QTMediaTypeText] objectAtIndex:0] media]  
quickTimeMedia];


TimeValue64 timeValue = 0;
TimeValue64 duration = 0;
	GetMediaNextInterestingDecodeTime(media, nextTimeMediaSample +  
nextTimeEdgeOK, timeValue, fixed1, &timeValue, &duration);


ByteCount size;
	GetMediaSample2(media, NULL, 0, &size, timeValue, NULL, NULL,  
NULL, nil, nil, 1, NULL, NULL);


char chars[size];

	GetMediaSample2(media, &chars, size, NULL, timeValue, NULL, NULL,  
NULL, nil, nil, 1, NULL, NULL);
	NSString *string = [[NSString alloc] initWithBytes:chars  
length:size encoding:NSUTF8StringEncoding];

NSLog(@"String: %@", string);

Thanks,

Joe
On Dec 14, 2008, at 7:03 PM, douglas welton wrote:


Hi Joe,

Since you didn't define "easy" or tell me what you'd tried, then  
I'll have to make some assumptions about what you know.  I will  
assume that you have read the documentation on QT media samples.


The basic steps:

Get the text track.
Get the track media.
	loop thru the media samples using a function like  
GetMediaNextInterestingDecodeTime() with the parameters of your  
choice
		Use GetMediaSample2() to get the data/length associated with the  
text sample.
		Create an NSString with the bytes/length returned in the  
previous call


regards,

douglas

On Dec 14, 2008, at 7:26 PM, Joe Turner wrote:

I have a QTMovie (that is valid), and it has a text track. I am  
wondering if there is any easy way to get the contents of the  
text track into an NSString.


Thanks,

Joe






___

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


Consistent scroll-to-visible of text view?

2008-12-16 Thread Randall Meadows
I have a table that contains representations of various types of  
data.  As a row is selected another view changes to show details of  
that data.  For instance, some display images and some display text in  
an NSTextView.


As I change from one row to the next, I populate the detail display  
area with the relevant detail data.  When I populate the text view, it  
was always displaying the text view scrolled to the bottom, presumably  
because that's where the insert point was left after I inserted the  
text into the view.


Fine, I'll just stick [notesView scrollRangeToVisible:NSMakeRange(0,  
0)]; in there, after I insert the text, before it gets displayed.


BOOL wasEditable = [notesView isEditable];
[notesView setEditable:YES];
[notesView selectAll:nil];
[notesView insertText:textToDisplay];
[notesView setEditable:wasEditable];
[notesView scrollRangeToVisible:NSMakeRange(0, 0)];

Well, now it alternates between being scrolled to the beginning of the  
text and being scrolled to the end of the text on subsequent row  
selections.  It'll keep alternating as long as I keep changing the  
selection.  And, it seems to be sensitive to manual scrolling as well:  
If, when it's scrolled to the top, I manually scroll it to the bottom,  
change the selection and then come back, the alternating now picks up  
with it being scrolled to the top again, in an opposite phase.


What am I missing to always start the display of this newly-unhidden  
text view with it scrolled to the top such that the start of the text  
is always visible?



Thanks!
randy
___

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: Sublclassing NSThread

2008-12-16 Thread Jean-Daniel Dupas


Le 16 déc. 08 à 18:29, Brad O'Hearne a écrit :


Hello,

I am trying to create an NSThread subclass which completely wraps  
the desired behavior of the thread execution. Now typically when  
creating a new thread instance, it seems one will use the  
initWithTarget:selector:object initializer to properly direct the  
thread's execution. But what if I want the thread subclass to invoke  
a method within itself? This leaves you with a situation where you  
have to set the target to self within the initializer, but that  
seems problematic, as "self" is not yet defined, i.e.:


- (id)init {
self = [super initWithTarget:self @selector(myMethod) object:nil];
return self;
}

As you can see, the initWithTarget: param is set to self, but the  
purpose of that statement is to set self, and self isn't defined yet  
to my knowledge. I'd otherwise just use the NSThread's init method,  
but I do not see a way to  set the target as a property on the  
thread object once initialized.  So my question is, in Objective C,  
is the typical approach to wrapping behavior entirely within an  
NSThread subclass to override the start method, as such:


- (void) start {
[super start];
[self myMethod];
}

Is this the recommended approach, or is there another way to go  
about this?


No. In Cocoa you never subclass NSThread. Instead of overriding start,  
you implement you own start wherever you want (and with the name you  
want) and you pass it as parameter (SEL + target).



___

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: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-16 Thread David Duncan

On Dec 16, 2008, at 10:39 AM, Thomas Clement wrote:


That's right, I was not doing it correctly, this is now working.
Also I noticed I can call CGImageCreateWithImageInRect to create a  
new CGImage which is a smaller area of the original image and then  
call CGImageGetDataProvider and CGDataProviderCopyData to get the  
pixel data.
Seem easier and faster too. However CGDataProviderCopyData is 10.5  
minimum.



Unfortunately due to a bug that doesn't always work correctly. If you  
file a bug, reference bug 5889934.

--
David Duncan
Apple DTS Animation and Printing

___

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: More - Safari Download Security Alerts

2008-12-16 Thread Dave

Hi,

I looked at xattr but can't find a man page and couldn't seem to find  
much about it anywhere. I did a xattr -l CleanUp.App, and it produced  
a dump of the data and resource forks. I can't see any attribute  
names. Is there any docs on xattr? Or better still, what is the  
command I would need to remove the quarantine status of the file?


One other thing, is xattr guaranteed to be on the user's system? Oh,  
and will this work on Version of MacOS X < 10.5 ?


Thanks a lot
All the Best
Dave

On 16 Dec 2008, at 18:23, Geoff Beier wrote:


I see. I didn't catch the dialog on the disk image itself. While
diving into package maker is the right thing to do, you should be able
to fix your installer so that your workflow looks like:

1. Download the .dmg file.
2. Mount the image. (security dialog? i don't think i get these)
3. Launch the installer script (security dialog. no way around this  
one)

Then the installer:
a. creates your directory
b. copies your cleanup app, real app, etc. to your directory
c. uses either the launch servcies calls (actually xattr probably
makes more sense from an applescript) to clear the quarantine
attributes from the cleanup app and real app
4. cleanup app (no security dialog thanks to the above)
5. real app (ditto)

If that's a good enough workflow to get your demo out the door and buy
you some time to learn packagemaker, clearing those attributes ought
to be an easy addition to your install script.


HTH,

Geoff

On Tue, Dec 16, 2008 at 12:55 PM, Dave   
wrote:


On 16 Dec 2008, at 17:46, Geoff Beier wrote:


Sorry. I was pointing to a different part of the advice:


you
want to bypass the warning for your real app after the user has
accepted
the
warning in for your installer, look at the keys and constants in
 for what you can pass to
LSSetItemAttribute() in LaunchServices.


I think it should work if you don't feel like PackageMaker  
works for

you. Did you try it? Did it work?




Did you try calling LSSetItemAttribute() on your cleanup bundle  
and on
your real application? (or shelling out to xattr if that's easier  
from

the context of your installer?) Did it fix your warnings? What
problems did it cause you? All I saw in your follow-up was  
discussion

about packagemaker. Did I miss where you talked about trying the
LaunchServices calls?


Sorry, I misunderstood. I haven't used any LaunchServices calls,  
it wouldn't
really work anyway, since I'd get still get 2 or 3 security  
dialogs and I

just want one (or none).

1.  Download .dmg file.
2.  Mount the Image (Security Dialog).
3.  Launch the Installer AppleScript (Security Dialog).
4.  Launch the CleanUp AppleScript Security Dialog).
5.  Launch the Real App, (Security Dialog after doing the  
LaunchServices

magic).


All I have done is to create an Installer with PackageMaker, but I  
can't get

it to installer a folder with the files in it.

All the Best
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: Sublclassing NSThread

2008-12-16 Thread Shawn Erickson
On Tue, Dec 16, 2008 at 10:49 AM, Jean-Daniel Dupas
 wrote:

> No. In Cocoa you never subclass NSThread. Instead of overriding start, you
> implement you own start wherever you want (and with the name you want) and
> you pass it as parameter (SEL + target).

Pre-Leopard that we true, as of Leopard NSThread was enhanced to also
support subclassing (if you find the need to do so).

"Prior to Mac OS X v10.5, the only way to start a new thread is to use
the detachNewThreadSelector:toTarget:withObject: method. In Mac OS X
v10.5 and later, you can create instances of NSThread and start them
at a later time using the start method.
...
In Mac OS X v10.5 and later, you can subclass NSThread and override
the main method to implement your thread's main entry point. If you
override main, you do not need to invoke the inherited behavior by
calling super."

-Shawn
___

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: Text track in QTMovie

2008-12-16 Thread douglas welton

Hi Joe,

My suggestions:

1)  write a small application that test your routine before you give  
it someone else to use.  given the code you already have doing this  
should take all of 5 minutes.  Once you do this, you can use the  
debugger and find your boo-boos.  I suspect they will be quite obvious.


2) GetMediaSample2 returns an error code.  However, the code in your  
email does not check the returned value.  Making an assumption that  
the function has completed without an error may not be in your term  
best interest ;^}


3) chars[] is not a C function call.  K&R is your friend!

regards,

douglas


On Dec 16, 2008, at 1:40 PM, Joe Turner wrote:


Sorry for taking so long.

Okay, what I am looking for is the contents of the text track. Like,  
for a movie, it would be the chapter names and times.


The issue is that I am making this for someone who is using  
AppleScript, and is just using a call method on my method to do  
this. So, the Debugger will not stop at my breakpoints (I thought it  
did, even if it is being called by a call method).


Anyways, I guess what I am looking for is an error in the code I  
have created. Like, am I passing something wrong? Am I trying to  
parse something as a different format than it is? I can create a new  
project and do this and tell you the debugger contents too though,  
if needed.


I am used to objective-c, and some of these C calls can confuse me  
sometimes. Like, is chars[] the same thing as a UInt8?


Thanks for your help,

Joe
On Dec 14, 2008, at 8:54 PM, douglas welton wrote:


when you say it won't show you the "track names" do you mean:

a) your NSLog() function is failing and nothing is printed
b) NSLog() prints something, but the value of string appears to be  
either nil or empty (which one?)
c)  you really want the name of the track (i.e., the thing  
displayed in the QT Player) and not the text in each sample. If  
this is the case then we have to do something entirely different ;^}
d) all of the function calls succeed and when examined in the  
debugger you can see the values for size and chars[] are valid but  
your NSString cannot be properly constructed.


Can you clarify?  BTW, what values are you seeing in the debugger?

On Dec 14, 2008, at 8:33 PM, Joe Turner wrote:

Okay, so I did what you said, but yet, it still won't show me the  
track names. Here is my code:


Media media = [movieView movie]  
tracksOfMediaType:QTMediaTypeText] objectAtIndex:0] media]  
quickTimeMedia];


TimeValue64 timeValue = 0;
TimeValue64 duration = 0;
	GetMediaNextInterestingDecodeTime(media, nextTimeMediaSample +  
nextTimeEdgeOK, timeValue, fixed1, &timeValue, &duration);


ByteCount size;
	GetMediaSample2(media, NULL, 0, &size, timeValue, NULL, NULL,  
NULL, nil, nil, 1, NULL, NULL);


char chars[size];

	GetMediaSample2(media, &chars, size, NULL, timeValue, NULL, NULL,  
NULL, nil, nil, 1, NULL, NULL);
	NSString *string = [[NSString alloc] initWithBytes:chars  
length:size encoding:NSUTF8StringEncoding];

NSLog(@"String: %@", string);

Thanks,

Joe
On Dec 14, 2008, at 7:03 PM, douglas welton wrote:


Hi Joe,

Since you didn't define "easy" or tell me what you'd tried, then  
I'll have to make some assumptions about what you know.  I will  
assume that you have read the documentation on QT media samples.


The basic steps:

Get the text track.
Get the track media.
	loop thru the media samples using a function like  
GetMediaNextInterestingDecodeTime() with the parameters of your  
choice
		Use GetMediaSample2() to get the data/length associated with  
the text sample.
		Create an NSString with the bytes/length returned in the  
previous call


regards,

douglas

On Dec 14, 2008, at 7:26 PM, Joe Turner wrote:

I have a QTMovie (that is valid), and it has a text track. I am  
wondering if there is any easy way to get the contents of the  
text track into an NSString.


Thanks,

Joe








___

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: Sublclassing NSThread

2008-12-16 Thread Shawn Erickson
On Tue, Dec 16, 2008 at 9:29 AM, Brad O'Hearne
 wrote:
> Hello,
>
> I am trying to create an NSThread subclass which completely wraps the
> desired behavior of the thread execution.

I am sorry but what you described isn't making sense to me so I really
don't know how to answer your question. Can you restate it?

> As you can see, the initWithTarget: param is set to self, but the purpose of 
> that statement is to set
> self, and self isn't defined yet to my knowledge

Inside of any instance method "self" exists (hidden parameter to the
method call) and points to the instance that received the message. In
"init" methods you do the self = [super initXxxx]; to deal with the
super implementation possibly swapping the original instance out for
another instance (see Cocoa does on initializers).

If you sub-class NSThread you override -main to provide the
implementation for the code that will run in the thread context. I am
not sure why you want/think you need to override -start.

-Shawn
___

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: More - Safari Download Security Alerts

2008-12-16 Thread Jean-Daniel Dupas


Le 16 déc. 08 à 20:02, Dave a écrit :


Hi,

I looked at xattr but can't find a man page and couldn't seem to  
find much about it anywhere. I did a xattr -l CleanUp.App, and it  
produced a dump of the data and resource forks. I can't see any  
attribute names. Is there any docs on xattr? Or better still, what  
is the command I would need to remove the quarantine status of the  
file?




xattr -d com.apple.quarantine myFile

The problem is that the fact OS X uses an extended attribute to store  
this flag is an implementation details (and may change). That's why  
you should use Launch Services.


One other thing, is xattr guaranteed to be on the user's system? Oh,  
and will this work on Version of MacOS X < 10.5 ?


Yes, it's garantee on Mac OS 10.5, and this attribute is not supported  
on previous versions, so you don't have to care (if xattr does not  
exists, just skip this step in your installer).




Thanks a lot
All the Best
Dave

On 16 Dec 2008, at 18:23, Geoff Beier wrote:


I see. I didn't catch the dialog on the disk image itself. While
diving into package maker is the right thing to do, you should be  
able

to fix your installer so that your workflow looks like:

1. Download the .dmg file.
2. Mount the image. (security dialog? i don't think i get these)
3. Launch the installer script (security dialog. no way around this  
one)

Then the installer:
a. creates your directory
b. copies your cleanup app, real app, etc. to your directory
c. uses either the launch servcies calls (actually xattr probably
makes more sense from an applescript) to clear the quarantine
attributes from the cleanup app and real app
4. cleanup app (no security dialog thanks to the above)
5. real app (ditto)

If that's a good enough workflow to get your demo out the door and  
buy

you some time to learn packagemaker, clearing those attributes ought
to be an easy addition to your install script.


HTH,

Geoff

On Tue, Dec 16, 2008 at 12:55 PM, Dave   
wrote:


On 16 Dec 2008, at 17:46, Geoff Beier wrote:


Sorry. I was pointing to a different part of the advice:


you
want to bypass the warning for your real app after the user has
accepted
the
warning in for your installer, look at the keys and constants in
 for what you can pass to
LSSetItemAttribute() in LaunchServices.


I think it should work if you don't feel like PackageMaker  
works for

you. Did you try it? Did it work?




Did you try calling LSSetItemAttribute() on your cleanup bundle  
and on
your real application? (or shelling out to xattr if that's easier  
from

the context of your installer?) Did it fix your warnings? What
problems did it cause you? All I saw in your follow-up was  
discussion

about packagemaker. Did I miss where you talked about trying the
LaunchServices calls?


Sorry, I misunderstood. I haven't used any LaunchServices calls,  
it wouldn't
really work anyway, since I'd get still get 2 or 3 security  
dialogs and I

just want one (or none).

1.  Download .dmg file.
2.  Mount the Image (Security Dialog).
3.  Launch the Installer AppleScript (Security Dialog).
4.  Launch the CleanUp AppleScript Security Dialog).
5.  Launch the Real App, (Security Dialog after doing the  
LaunchServices

magic).


All I have done is to create an Installer with PackageMaker, but I  
can't get

it to installer a folder with the files in it.

All the Best
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/devlists%40shadowlab.org

This email sent to devli...@shadowlab.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


NSTextField and NSTextCell problem

2008-12-16 Thread Arun
Hi,

I have a NSTextField and inside which i have a NSTextFieldCell.
I have sub classed the NSTextField cell and overriden drawInteriorWithFrame
to allign the text cell frame center.
Once i put some text field in the NSTextFieldCell, the background on the top
of text field changes the colour.
Any idea?

Thanks
Arun KA
___

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: CoreData: "Unacceptable type of value for to-one relationship"

2008-12-16 Thread Pavel Kapinos


On 15-Oct-08, at 10:02 PM, Pavel Kapinos wrote:

I am using an abstract entity as a destination for to-one  
relationship but assign an instance of its concrete subentity and it  
worked just fine in Tiger and even in early 10.5, but I am getting  
now this nasty "Unacceptable type of value for to-one relationship"  
runtime messages in 10.5.5 and have no clue why would this be  
happening. I would very much appreciate any enlightening  
suggestions. Thank you.


The problem was caused by "mixing-up" two CoreData stacks though both  
were created using the same NSManagedDataModel. So I was using  
NSEntityDescription from one stack and tried to instantiate that  
entity in another stack, which apparently doesn't work this way.


___

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: More - Safari Download Security Alerts

2008-12-16 Thread Tommy Nordgren


On Dec 15, 2008, at 6:41 PM, Dave wrote:


Hi,

I looked at the Man page below, I can't see anything that says  
"udifrez". Is this meant for me? I'm not sure what I am supposed to  
do with it.


All the Best
Dave


I also looked at the hdiutil manpage:
For the verb udifrez it states:
 udifrez [options] image
Attaches resources (software license agreements, for  
example)

to a disk image.

That is you invoke it something like this:
hdiutil udifrez   

--
"Home is not where you are born, but where your heart finds peace" -
Tommy Nordgren, "The dying old crone"
tommy.nordg...@comhem.se


___

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


NSAttributedString -> XHTML 1.1

2008-12-16 Thread Keith Blount
Hi,

I'm building an .epub eBook exporter from my app and thus need to generate 
XHTML 1.1 files from my text. I am using NSAttributedString's 
-dataFromRange:documentAttribributes:error: to generate the XHTML, and by 
playing with the different combinations of documentAttributes that are used in 
the TextEdit example, I can generate an XHTML 1.0 strict file, but haven't been 
able to figure out how to generate an XHTML 1.1 file (perhaps it isn't possible 
via NSAttributedString as yet?). These are my document attributes to build an 
XHTML 1.1 file:

- (NSDictionary *)ePubXHTMLAttributes
{
// Excluded elements tell exporter to use use XHTML 1.0 Strict -
// by not including XML in this list, XHTML will be generated; by 
excluding the
// other elements, 1.0 Strict will be generated rather than 1.0 
Transitional.
NSArray *excludedElements = [NSArray arrayWithObjects:
 // *NOT* 
TRANSITIONAL TYPE
 @"APPLET",
 @"BASEFONT",
 @"CENTER",
 @"DIR",
 @"FONT",
 @"ISINDEX",
 @"MENU",
 @"S",
 @"STRIKE",
 @"U",
 nil];

return [NSDictionary dictionaryWithObjectsAndKeys:
NSHTMLTextDocumentType, NSDocumentTypeDocumentOption,
[NSNumber numberWithInt:NSUTF8StringEncoding], 
NSCharacterEncodingDocumentAttribute,
[NSNumber numberWithInt:2], 
NSPrefixSpacesDocumentAttribute,
excludedElements, NSExcludedElementsDocumentAttribute,
[self title], NSTitleDocumentAttribute,
nil];
}

This generates an XHTML file with the following header declaration:


http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd";>

i.e. 1.0 Strict. However, what I need is this:


  http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd";>

As I understand it the differences between 1.0 Strict and 1.1 are few - in 
fact, they are only the following:

1. On every element, the lang attribute has been removed in favor of the 
xml:lang attribute (as defined in [XHTMLMOD]).
2. On the a and map elements, the name attribute has been removed in favor of 
the id attribute (as defined in [XHTMLMOD]).
3. The "ruby" collection of elements has been added (as defined in [RUBY]).

So, what is the correct way to generate XHTML 1.1 data from NSAttributedString 
(if it is possible). I could exclude "DOCTYPE" and insert the 1.1 declaration 
for myself, but that would be cheating as it may not be correct 1.1.

Thanks in advance and all the best,
Keith


  
___

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: NSAttributedString -> XHTML 1.1

2008-12-16 Thread Douglas Davidson


On Dec 16, 2008, at 12:56 PM, Keith Blount wrote:

I'm building an .epub eBook exporter from my app and thus need to  
generate XHTML 1.1 files from my text. I am using  
NSAttributedString's -dataFromRange:documentAttribributes:error: to  
generate the XHTML, and by playing with the different combinations  
of documentAttributes that are used in the TextEdit example, I can  
generate an XHTML 1.0 strict file, but haven't been able to figure  
out how to generate an XHTML 1.1 file (perhaps it isn't possible via  
NSAttributedString as yet?).


NSAttributedString's HTML generation has not been configured or tested  
for the generation of XHMTL 1.1.  It does not currently make use of  
the lang attribute or map element, or the name attribute on a  
elements, and it is unlikely to do so in the future, but I'm not  
prepared to make further guarantees.


Douglas Davidson
 
___


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: - [NSBitmapImageRep tiffRepresentation] malloc error

2008-12-16 Thread Thomas Clement

On Dec 16, 2008, at 8:00 PM, David Duncan wrote:


On Dec 16, 2008, at 10:39 AM, Thomas Clement wrote:


That's right, I was not doing it correctly, this is now working.
Also I noticed I can call CGImageCreateWithImageInRect to create a  
new CGImage which is a smaller area of the original image and then  
call CGImageGetDataProvider and CGDataProviderCopyData to get the  
pixel data.
Seem easier and faster too. However CGDataProviderCopyData is 10.5  
minimum.



Unfortunately due to a bug that doesn't always work correctly. If  
you file a bug, reference bug 5889934.


That's unfortunate.
As suggested, I filed a bug report rdar://6449952


Thanks again for your help!
Thomas

___

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: Sublclassing NSThread

2008-12-16 Thread Bradley S. O'Hearne

All,

Thanks to everyone for the replies. In my code, I made an error --  
overrode the start method rather than the main method. After I  
overrode the start method, everything worked great. Without trying to  
get too specific on the actual issue, the more general thrust of my  
original question was getting at encapsulating a piece of  
functionality that needs asynchronous execution (i.e. within a  
separate thread from the main thread) within an NSThread subclass. The  
reason this is useful is that rather than have this code scattered  
within an application which needs it, I can instead make a generic  
utility class out of it (which I've now done) and can reuse it  
anywhere. In my case, I was creating code to asynchronously load a  
large number of remote images (located on a server) within my  
application.


Thanks again,

Brad


On Dec 16, 2008, at 12:29 PM, Shawn Erickson wrote:


On Tue, Dec 16, 2008 at 9:29 AM, Brad O'Hearne
 wrote:

Hello,

I am trying to create an NSThread subclass which completely wraps the
desired behavior of the thread execution.


I am sorry but what you described isn't making sense to me so I really
don't know how to answer your question. Can you restate it?

As you can see, the initWithTarget: param is set to self, but the  
purpose of that statement is to set

self, and self isn't defined yet to my knowledge


Inside of any instance method "self" exists (hidden parameter to the
method call) and points to the instance that received the message. In
"init" methods you do the self = [super initXxxx]; to deal with the
super implementation possibly swapping the original instance out for
another instance (see Cocoa does on initializers).

If you sub-class NSThread you override -main to provide the
implementation for the code that will run in the thread context. I am
not sure why you want/think you need to override -start.

-Shawn


___

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: Main Thread autorelease pool, memory usage question?

2008-12-16 Thread Chad Podoski
Thank you very much Mike and Ken, spot on.  Amazing this issue hasn't  
gotten more attention, seems like a pretty big issue.


On Dec 15, 2008, at 5:46 PM, Ken Ferry wrote:

No, you're on target.

The thing to understand is that the implementation of the main event
loop is basically this:

while (1) {
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   NSEvent *event = [self nextEventMatchingMask…];
   [self sendEvent:event];
   [pool drain];
}

The key part is the call to next_EVENT_matchingMask.  That means that
if there are no literal NSEvents to process, that call will never
return, and the autorelease pool will never drain.  An NSTimer firing
does not involve a literal NSEvent, and that method won't return.

You can work around it by posting an application defined event at the
end of whatever code you have that you'd expect to behave like an
event with respect to pool draining.  You should also consider filing
a bug that something or other ought to be making an autorelease pool
if you can figure out what 'something' is.

For example, someone filed a bug like that for timer firing, and as of
(I believe) 10.5, there's an explicit autorelease pool in the
timer-firing code.  So timers shouldn't be a problem.  But there may
be other kinds of run loop sources that don't have explicit pools,
particularly if you start using CF stuff since CF is below the concept
of autorelease pools.

-Ken

On Mon, Dec 15, 2008 at 6:53 PM, Chad Podoski   
wrote:
I have a process that is uploading images.  My issue is as  
following, when
uploading a large number of images and my application does not have  
focus,
memory usage continues to climb until it is maxed out, causing the  
app to
hang/crash.  On the other hand, if the app has focus and the user  
clicks
anywhere in the app, memory is released and memory usage stays low.   
While
this is occurring in the main thread, the actually connection work  
is being

done in a separate thread (via ConnectionKit).  The action of the user
clicking in the app appears to trigger an interrupt, allowing memory  
to be

released or the main thread to manage its autorelease pools. Couple of
questions:

1) Why is the main thread not managing the autorelease pool(s)  
without this

user interrupt?
2) Is there a way to trigger the main thread to cleanup its  
autorelease

pools?
3) If not, is there a way to simulate the user click or trigger the  
same

underlying reaction to it, programmatically?
4) Am I completely off base with my hypothesis?

Thanks,
Chad
___

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/kenferry%40gmail.com

This email sent to kenfe...@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: NSAttributedString -> XHTML 1.1

2008-12-16 Thread Keith Blount
Many thanks for your reply, much appreciated.

> NSAttributedString's HTML generation has not been
> configured or tested for the generation of XHMTL 1.1.  It
> does not currently make use of the lang attribute or map
> element, or the name attribute on a elements, and it is
> unlikely to do so in the future, but I'm not prepared to
> make further guarantees.

Does this mean that I should be able to just change the header declaration to 
1.1 and it *should* work? (Having tested generating .epub files, Digital 
Editions and the other readers I have tried accept the XHTML 1.0 Strict files I 
have generated using the NSAttributedString methods, but the specs do say 1.1.) 
I know you can't guarantee that this won't break in the future, but in the 
current iteration is this assumption correct?

Thanks again and all the best,
Keith


  
___

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: NSOutlineView assertion failure on collapse

2008-12-16 Thread Roland Rabien
In building a small app that reproduces the problem I found the cause of the
assertion. It's caused by me being stupid.
The following code reproduces the assertion:

- (void)outlineViewItemWillCollapse:(NSNotification *)notification
{
id itm = [[notification userInfo] objectForKey:@"NSObject"];
[tree expandItem:itm];
}

Is this a bug? Or is the assertion valid.

What my code was supposed to do is select the item being collapsed if a
child was selected. I used my standard select item  function which selects
an item an expands it, causing the assertion.

Thanks,
Roland

On Tue, Dec 16, 2008 at 9:36 AM, Corbin Dunn  wrote:

> Hi Roland,
> Can you reliable reproduce this problem? If so, can you please log a bug,
> including your test application (or a link to download it). Or, ideally, if
> you have source code that can be compiled that makes things even easier to
> debug.
>
> -corbin
>
>
> On Dec 15, 2008, at 11:08 AM, Roland Rabien wrote:
>
>  I'm having an NSOutlineView Assertion Failure on collapse if the selected
>> item is a child (or child of child, etc) of the item that is being
>> collapsed. Has anyone else had this problem? I've searched the list all
>> the
>> related posts seem to indicate threading is the cause, but my application
>> isn't using any threads. I'm using XCode 3.1 and targeting 10.5 (Intel). I
>> never call reloadData on my NSOutLineView, so it's data should be
>> constant.
>> Any ideas?
>>
>>  Assertion failure in -[NSOutlineView
>> _expandItemEntry:expandChildren:startLevel:](),
>> /SourceCache/AppKit/AppKit-949.35/TableView.subproj/NSOutlineView.m:1003*
>>
>>
>> #0 0x92a42c66 in -[NSException raise]
>>
>> #1 0x9259ef22 in -[NSOutlineView collapseItem:collapseChildren:]
>>
>> #2 0x92306c9a in -[NSOutlineView
>> _doUserExpandOrCollapseOfItem:isExpand:optionKeyWasDown:]
>>
>> #3 0x9230679e in -[NSOutlineView mouseTracker:didStopTrackingWithEvent:]
>>
>> #4 0x923065ce in -[NSMouseTracker stopTrackingWithEvent:]
>>
>> #5 0x92278d03 in -[NSMouseTracker trackWithEvent:inView:withDelegate:]
>>
>> #6 0x921bdb54 in -[NSOutlineView mouseDown:]
>>
>> #7 0x9216476b in -[NSWindow sendEvent:]
>>
>> #8 0x92131311 in -[NSApplication sendEvent:]
>>
>> #9 0x9208ed0f in -[NSApplication run]
>>
>> #10 0x9205bf14 in NSApplicationMain
>>
>> #11 0x1c70 in main at main.m:13
>> ___
>>
>
>
___

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: NSOutlineView assertion failure on collapse

2008-12-16 Thread Corbin Dunn


On Dec 16, 2008, at 3:54 PM, Roland Rabien wrote:

In building a small app that reproduces the problem I found the  
cause of the assertion. It's caused by me being stupid.


The following code reproduces the assertion:

- (void)outlineViewItemWillCollapse:(NSNotification *)notification
{
id itm = [[notification userInfo] objectForKey:@"NSObject"];
[tree expandItem:itm];
}

Is this a bug? Or is the assertion valid.


I think the assertion is valid, but it may be possible for us to  
provide a better assertion. Something along the lines of "expanding  
item X while it was being collapsed". If you do have a test case,  
please log it into a bug, so we can either add a better assertion, or  
document the behavior.


Thank you for taking the time to simplify the problem.
-corbin




What my code was supposed to do is select the item being collapsed  
if a child was selected. I used my standard select item  function  
which selects an item an expands it, causing the assertion.


Thanks,
Roland


___

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


UNIX signals

2008-12-16 Thread Chris Idou
Is there any Cocoa and/or Carbon interface to UNIX signals?


  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
___

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: Swap subviews of NSSplitView?

2008-12-16 Thread Kevin Gessner

On Dec 16, 2008, at 2:11 AM, Matt wrote:


I have an NSSplitView, divided vertically, with two table views. In a
certain instance I need to have a custom view class appear in place of
the right-hand NSTableView, retaining its auto-resizing and
spilt-view-resizing functionality. I need to be able to swap the
NSTableView (inside of the split view) for this custom view back and
forth as needed.

I searched for the solution but only found references to NSViews
-replaceSubview: with:, and it isn't working for me. Is this the
proper method to be using for such a task or should I be doing
something different?


I think the 'standard' way of swapping views is to place them both  
into a tabless NSTabView, then switch the current tab  
programmatically. In your case, the tabview would be the subview of  
your splitview, and the custom view and table view would be tabs in  
the tabview.


HTH,
-- Kevin

Kevin Gessner
http://kevingessner.com
ke...@kevingessner.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: More - Safari Download Security Alerts

2008-12-16 Thread Mark Allan

On 16 Dec 2008, at 17:55, Dave wrote:
All I have done is to create an Installer with PackageMaker, but I  
can't get it to installer a folder with the files in it.


Have you tried using the version of PackageMaker which comes with  
Xcode 2.5?  I'm probably in the minority here, but I find it much  
easier to work with than the current version.  You can download Xcode  
2.5 DevTools from the ADC website and then opt to install it in a  
different directory from the current Dev Tools.  You won't be able to  
make use of 10.5 specific things like flat packages and signed  
packages etc. but if you're also targeting previous versions of OS X,  
then that's maybe not an issue anyway.


Mark

___

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: UNIX signals

2008-12-16 Thread Andrew Farmer

On 16 Dec 08, at 17:02, Chris Idou wrote:

Is there any Cocoa and/or Carbon interface to UNIX signals?


Not that I'm aware of. In general, any signal you're likely to receive  
in a Cocoa application should either be ignored (CHLD, WINCH, etc) or  
cause your application to terminate immediately (HUP, INT, SEGV, etc).

___

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: How to make NSURLConnection send delegate messages during runModalForWindow

2008-12-16 Thread an0
Actually, I tried NSModalPanelRunLoopMode first, but it didn't work; and I
was not sure whether NSModalPanelRunLoopMode is exactly the mode of model
panel's run loop. Then I thought  since the modal panel's delegate method
windowDidBecomeKey is called during runModalForWindow,  the currentRunLoop
must be modal panel's run loop, and currentMode of it must be the mode in
which I wanted my connection's delegate methods called.

But it turned out that I still missed something here.

On Tue, Dec 16, 2008 at 11:49 PM, Michael Babin wrote:

> On Dec 16, 2008, at 8:30 AM, an0...@gmail.com wrote:
>
>  I want to handle the connection events during runModalForWindow, so I use
>> [connection scheduleInRunLoop:[NSRunLoop currentRunLoop]
>> forMode:[[NSRunLoop currentRunLoop] currentMode]];
>> in the modal window's windowDidBecomeKey delegate method.
>>
>> But still my connection's delegate methods are not called until stopModal.
>>
>> Is there anything I misunderstood about NSURLConnection's
>> scheduleInRunLoop:forMode: method?
>>
>
> Is there some reason not to pass in NSModalPanelRunLoopMode as the forMode
> argument? What happens if you do?
>
>
___

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: Sublclassing NSThread

2008-12-16 Thread Chris Hanson

On Dec 16, 2008, at 2:19 PM, Bradley S. O'Hearne wrote:

The reason this is useful is that rather than have this code  
scattered within an application which needs it, I can instead make a  
generic utility class out of it (which I've now done) and can reuse  
it anywhere. In my case, I was creating code to asynchronously load  
a large number of remote images (located on a server) within my  
application.


This is definitely the sort of thing NSOperation and NSOperationQueue  
are designed for.  Threads are a useful substrate on which to  
implement asynchronous behavior, but having an abstraction layer atop  
them lets your code stay isolated from things like how many threads to  
schedule.


For example, you can have an NSOperation subclass that downloads a  
single image and is run by an NSOperationQueue.  Then your code can  
create an operation for each image to download, put it on the queue,  
and the NSOperationQueue itself will figure out how many operations to  
run concurrently based on a variety of criteria.


If you have work that depends on specific images, you can also  
encapsulate *that* as additional kinds of operations, and have those  
operations depend on the operations that download the associated  
images.  And, again, NSOperaitonQueue will do the heavy lifting of  
figuring out what to run when for you.


  -- 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: UNIX signals

2008-12-16 Thread Chris Idou

Ok. BTW, what happens exactly when you try and shut down a Mac? On a UNIX 
system all the processes are sent SIGINT or something, at which point they 
should enter a controlled shutdown procedure.


--- On Tue, 16/12/08, Andrew Farmer  wrote:

> From: Andrew Farmer 
> Subject: Re: UNIX signals
> To: "Chris Idou" 
> Cc: cocoa-dev@lists.apple.com
> Received: Tuesday, 16 December, 2008, 5:49 PM
> On 16 Dec 08, at 17:02, Chris Idou
> wrote:
> > Is there any Cocoa and/or Carbon interface to UNIX
> signals?
> 
> Not that I'm aware of. In general, any signal you're likely
> to receive in a Cocoa application should either be ignored
> (CHLD, WINCH, etc) or cause your application to terminate
> immediately (HUP, INT, SEGV, etc).
> 


  Start your day with Yahoo!7 and win a Sony Bravia TV. Enter now 
http://au.docs.yahoo.com/homepageset/?p1=other&p2=au&p3=tagline
___

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: UNIX signals

2008-12-16 Thread Andrew Farmer

On 16 Dec 08, at 18:40, Chris Idou wrote:
Ok. BTW, what happens exactly when you try and shut down a Mac? On a  
UNIX system all the processes are sent SIGINT or something, at which  
point they should enter a controlled shutdown procedure.


The OS X desktop uses Apple Events to send shutdown requests to  
applications - unlike signals, these can be responded to in-band. In a  
Cocoa application, this shows up as an applicationShouldTerminate:  
message to the NSApplication delegate.

___

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: UNIX signals

2008-12-16 Thread Michael Ash
On Tue, Dec 16, 2008 at 8:02 PM, Chris Idou  wrote:
> Is there any Cocoa and/or Carbon interface to UNIX signals?

Nope. It's pretty easy to set up a signal handler that can call back
to a Cocoa/CoreFoundation runloop though, by having it write to a pipe
or mach port which the runloop monitors.

However it's rarely useful to monitor signals in GUI apps, so you may
not want to actually do this.

Mike
___

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


NSPredicateEditor and aggregate operations

2008-12-16 Thread Tom

Hi everyone,

I'm trying to implement a find window using an NSPredicateEditor, but  
can't get it to do aggregate operations like "ANY tags == 'some tag'  
". As far as I can see, Interface Builder doesn't cater for aggregate  
operations like "ANY".


I assume I have to subclass NSPrdicateEditorRowTemplate to do what I  
want, but I can't figure out how to subclass it properly based on the  
documentation.


Is there a way to do it in IB? If not, are there any examples or  
tutorials regarding subclassing NSPredicateEditorRowTemplate? I can't  
find anything in google.


Kind Regards,


Tom Dalling
___

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: UNIX signals

2008-12-16 Thread Jonathan Prescott
For everything else other than Cocoa and Carbon applications that  
receive AppleEvents, when the computer is shutdown, everything else is  
sent a SIGKILL by launchd, just like any other Unix system (launchd  
takes the place of the init daemon seen on other Unix systems).   
Semantics for BSD signals are described in the man pages (kill,  
signal, etc.).   SIGINT is like hitting Ctrl-C at the terminal to stop  
a shell process.  Processes can ignore a Ctrl-C.  SIGKILL is non- 
ignorable.


How much of the process is a controlled shutdown is another matter :)!

Jonathan

On Dec 16, 2008, at 9:48 PM, Andrew Farmer wrote:


On 16 Dec 08, at 18:40, Chris Idou wrote:
Ok. BTW, what happens exactly when you try and shut down a Mac? On  
a UNIX system all the processes are sent SIGINT or something, at  
which point they should enter a controlled shutdown procedure.


The OS X desktop uses Apple Events to send shutdown requests to  
applications - unlike signals, these can be responded to in-band. In  
a Cocoa application, this shows up as an applicationShouldTerminate:  
message to the NSApplication delegate.

___

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/jprescott12%40comcast.net

This email sent to jprescot...@comcast.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


Re: Sublclassing NSThread

2008-12-16 Thread Michael Ash
On Tue, Dec 16, 2008 at 5:19 PM, Bradley S. O'Hearne
 wrote:
> All,
>
> Thanks to everyone for the replies. In my code, I made an error -- overrode
> the start method rather than the main method. After I overrode the start
> method, everything worked great. Without trying to get too specific on the
> actual issue, the more general thrust of my original question was getting at
> encapsulating a piece of functionality that needs asynchronous execution
> (i.e. within a separate thread from the main thread) within an NSThread
> subclass. The reason this is useful is that rather than have this code
> scattered within an application which needs it, I can instead make a generic
> utility class out of it (which I've now done) and can reuse it anywhere. In
> my case, I was creating code to asynchronously load a large number of remote
> images (located on a server) within my application.

This design does not make sense to me. By subclassing NSThread you're
making it part of your public interface; in essence, you declare "I am
a thread!" to the world. But threadedness should be an implementation
detail, not part of the interface. The interface you present should
simply be "I am asynchronous." That you achieve this using a thread
doesn't matter to the outside world.

So instead of subclassing NSThread, subclass NSObject, then simply use
NSThread in your code to invoke a method from your object on a
separate thread. This gives you a clean design with maximum separation
of concerns. If you should decide to change how it works later on, for
example by using NSOperationQueue or asynchronous URL loading, you can
easily do so without fear of breaking your clients.

And before you go off using NSOperationQueue, you should be aware that
it's broken on Leopard, as described in this thread:

http://www.cocoabuilder.com/archive/message/cocoa/2008/10/30/221452

If you still like the idea of NSOperationQueue but don't want to use
it because of that, you may be interested in this replacement (which,
in the interest of full disclosure, I should tell you that I wrote):

http://www.rogueamoeba.com/utm/2008/12/01/raoperationqueue-an-open-source-replacement-for-nsoperationqueue/

Mike
___

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: Consistent scroll-to-visible of text view?

2008-12-16 Thread Ashley Clark

On Dec 16, 2008, at 12:46 PM, Randall Meadows wrote:

I have a table that contains representations of various types of  
data.  As a row is selected another view changes to show details of  
that data.  For instance, some display images and some display text  
in an NSTextView.


As I change from one row to the next, I populate the detail display  
area with the relevant detail data.  When I populate the text view,  
it was always displaying the text view scrolled to the bottom,  
presumably because that's where the insert point was left after I  
inserted the text into the view.


Fine, I'll just stick [notesView scrollRangeToVisible:NSMakeRange(0,  
0)]; in there, after I insert the text, before it gets displayed.


BOOL wasEditable = [notesView isEditable];
[notesView setEditable:YES];
[notesView selectAll:nil];
[notesView insertText:textToDisplay];
[notesView setEditable:wasEditable];
[notesView scrollRangeToVisible:NSMakeRange(0, 0)];

Well, now it alternates between being scrolled to the beginning of  
the text and being scrolled to the end of the text on subsequent row  
selections.  It'll keep alternating as long as I keep changing the  
selection.  And, it seems to be sensitive to manual scrolling as  
well: If, when it's scrolled to the top, I manually scroll it to the  
bottom, change the selection and then come back, the alternating now  
picks up with it being scrolled to the top again, in an opposite  
phase.


What am I missing to always start the display of this newly-unhidden  
text view with it scrolled to the top such that the start of the  
text is always visible?


Try setting the selected range also. For instance, [notesView  
setSelectedRange:NSMakeRange(0, 0)], that sets the position of the  
insertion point and should keep it scrolled to the top I think.



Ashley
___

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: nib loading / displaying question.

2008-12-16 Thread aaron smith
Hey bill, yeah I came to that same comclusiong. It's probably not
worth leaving that in memory. Thanks -A

On Sun, Dec 14, 2008 at 9:43 AM, Bill Bumgarner  wrote:
> On Dec 13, 2008, at 11:56 PM, aaron smith wrote:
>>
>> Ah, yeah that was it. And I had the "release when closed" box checked
>> in IB, which was causing it to crash. Unchecked that and we're all
>> good.
>
> Sort of.
>
> How many times will the user display the about panel in an average session
> of working with your app?
>
> Most likely, the answer is once.
>
> Given that, do you really want to cash the about panel and all related
> objects?   CPU wise, it costs nothing.  Memory wise, it is a bunch of
> objects.   As well, there is the window server's bit of bookkeeping related
> to the window.
>
> b.bum
>
___

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: NSPredicateEditor and aggregate operations

2008-12-16 Thread Tom
I've got around it by implementing a kind of "man in the middle"  
subclass of NSPredicateEditorRowTemplate. I set the class of the row  
template to my subclass in IB and it automatically adds the "ANY"  
modifier to whatever is already configured. It removes the "ANY"  
modifier from the predicate before calling superclass function, and  
puts it back on the return values of super class functions. I've  
included the overridden functions below.


It would be much easier if there was an option called "Predicate  
Modifier" in IB for row templates.



-(NSComparisonPredicate*)copyPredicate: 
(NSComparisonPredicate*)aPredicate andChangeModifierTo: 
(NSComparisonPredicateModifier)aMod

{
NSComparisonPredicate* aCopy = nil;
	aCopy = (NSComparisonPredicate*)[NSComparisonPredicate  
predicateWithLeftExpression:[aPredicate leftExpression]


rightExpression:[aPredicate rightExpression]

modifier:aMod

type:[aPredicate predicateOperatorType]

options:[aPredicate options]];
return aCopy;
}

- (double)matchForPredicate:(NSPredicate *)predicate
{
//if the modifier is "ANY", then strip it off and pass it to super
if([predicate isKindOfClass:[NSComparisonPredicate class]]){
NSComparisonPredicate* p = (NSComparisonPredicate*)predicate;
if([p comparisonPredicateModifier] == NSAnyPredicateModifier){
			return [super matchForPredicate:[self copyPredicate:p  
andChangeModifierTo:NSDirectPredicateModifier]];

}
}

//else, don't handle it
return 0.0;
}

- (void)setPredicate:(NSPredicate *)predicate
{
//strip off "ANY" modifier and pass it to super
NSComparisonPredicate* p = (NSComparisonPredicate*)predicate;
	[super setPredicate:[self copyPredicate:p  
andChangeModifierTo:NSDirectPredicateModifier]];

}

- (NSPredicate *)predicateWithSubpredicates:(NSArray *)subpredicates
{
//add the "ANY" modifier back onto the predicate
	NSComparisonPredicate* ret = (NSComparisonPredicate*)[super  
predicateWithSubpredicates:subpredicates];
	return [self copyPredicate:ret  
andChangeModifierTo:NSAnyPredicateModifier];

}
___

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: nib loading / displaying question.

2008-12-16 Thread Jeff Laing
> > How many times will the user display the about panel in an average
session
> > of working with your app?
> >
> > Most likely, the answer is once.

At the risk of being provocative, I'd say the answer is closer to zero.

As such, it's a premature optimisation to worry about it, and we all
know Apple's mantra on premature optimisation.
___

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: nib loading / displaying question.

2008-12-16 Thread aaron smith
good point!

On Tue, Dec 16, 2008 at 8:49 PM, Jeff Laing  wrote:
>> > How many times will the user display the about panel in an average
> session
>> > of working with your app?
>> >
>> > Most likely, the answer is once.
>
> At the risk of being provocative, I'd say the answer is closer to zero.
>
> As such, it's a premature optimisation to worry about it, and we all
> know Apple's mantra on premature optimisation.
>
___

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: Pressable Button

2008-12-16 Thread Gerriet M. Denkmann


On 17 Dec 2008, at 00:56, Stéphane Sudre wrote:



On Dec 16, 2008, at 4:02 PM, Gerriet M. Denkmann wrote:

I am trying to build a pressable button: an on-off button (subclass  
of NSButton), which, if pressed for more than 0.3 seconds, displays  
a context menu.


My idea was:
Start a non-repeating timer in mouseDown: and schedule it with  
NSEventTrackingRunLoopMode.


In mouseUp: invalidate the timer.

And in timerFired: display the context menu.

But: mouseUp: is never called. So: where should I invalidate the  
timer?


And: if I send: [ NSMenu popUpContextMenu: menu withEvent:  
mouseDownEvent  forView: self ]
the button gets all messed up: no more drawRect: on mouse up, no  
action sent.


Obviously I am doing it all wrong.


I have a button like this.

I use performSelector:withObject:afterDelay: in the mouseDown:,  
cancel the delayed perform in mouseDragged: if the mouse cursor is  
outside the button frame, put back the delayed perform if the mouse  
cursor comes back in the button frame.


On mouseUp: I cancel the delayed perform if needed.


I tried your solution, but when I press the button for several seconds  
still no menu comes up.
When I finally release the button in disgust, then suddenly the menu  
is shown and I feel cheated for having wasted my time in pressing so  
long.


I did not like this behaviour very much. Did I do something wrong?


Then I followed Peters advice:
Consider using a single-segment NSSegmentedControl.  It has this  
behavior built-in.


But again, I am not completely satisfied: I want the NSOnState shown  
as done in an NSButton with buttonType = NSOnOffButton and bezelStyle  
= NSTexturedSquareBezelStyle.


Specifially: the NSOnState should look indented with a black background.
And there should be almost no space wasted left and right of the image  
or titel.

NSButton with a 20 x 20 image has a size of 24 x 24.
NSSegmentedControl with a 22 x 22 image reports a size of 44 x 24, but  
the hight looks more like 22.
(When I supply it with an 24 x 24 image, part of the images get drawn  
outside the button).


Also: a segmented control with an image has a lower height than one  
with text. Which also reports a height of 24, but looks definitely  
higher.


I tried messing around with [ [segmentedControl cell]  
setCellAttribute:to] but this did not seem to do anything at all.


I could live with the hightlight in blue or with the wasted space  
width-wise, but having different heights for image and text controls  
looks extremely silly.


But maybe I am doing something silly?


Kind regards,

Gerriet.





___

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

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

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

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


Re: Sublclassing NSThread

2008-12-16 Thread Nick Zitzmann


On Dec 16, 2008, at 8:27 PM, Michael Ash wrote:


And before you go off using NSOperationQueue, you should be aware that
it's broken on Leopard, as described in this thread:

http://www.cocoabuilder.com/archive/message/cocoa/2008/10/30/221452



And if anyone wants a second opinion, we've been using  
NSOperationQueue in some products with no problems. However, we  
enqueue everything on the main thread only. If that won't be a  
problem, then NSOperationQueue ought to be fine.


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: How to make a CALayer dont get blur when rotating.

2008-12-16 Thread Martin Carlberg
There are some bugs in CALayer that will give you blurred images. But  
you have to tell us more about your layer hierarchy and what kind of  
transformations you have on the different layers?


Have you tried to rotate your layer in a simple test application?
Have you tried to use another image?

- Martin Carlberg

16 dec 2008 kl. 12.31 skrev Gustavo Pizano:

mm no. let me try it.m... nop it didn't work. still the image after  
the transition its blurred.


Gus


On 16.12.2008, at 12:22, Martin Carlberg wrote:


Have you tried to add the following line?

[nLayer setValue:[NSNumber numberWithFloat:.]  
forKeyPath:@"transform.scale"];


- Martin Carlberg


13 dec 2008 kl. 19.49 skrev Gustavo Pizano:

Hello well finally I manage to rotate the CALayer each time I  
click on it. what I did was the following:


-(void)mouseDown:(NSEvent *)event
{
[event retain];
[mouseDownEvent  release];
mouseDownEvent = event;
NSPoint p2 = [event locationInWindow];
NSPoint p3 = [self convertPoint:p2 fromView:nil];
CGPoint p = NSPointToCGPoint(p3);
CALayer * nLayer = [_gameboardLayer hitTest:p];

if (nLayer.name != nil) {

NSNumber* value = [NSNumber numberWithFloat:PERP()];
		value = [NSNumber numberWithFloat:[value floatValue] + [[nLayer  
valueForKeyPath:@"transform.rotation.z"] floatValue]];

[nLayer setValue:value forKeyPath:@"transform.rotation.z"];

}

}

#define PERP () (90 * M_PI / 180)

but I realize that each time the images its perpendicular its  
kinda blurry I dunno how to rotate the layer without loosing  
quality.


the contents of the layer its .png


Thanks


Gus

___

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


Thread ID in crash log

2008-12-16 Thread radj
Hello List,

I've been googling and searching for this but to no joy. How do you get a
thread ID of the current thread that will be similar with the one that shows
up on a crash log? This is pretty helpful for debugging multi-threaded
applications.

Thanks,

Radj
___

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