Re: Download Alert -- Quarantine information removal

2009-12-01 Thread John Joyce

Doh! Sleepiness! Sry

Sent from my iPhone

On Dec 2, 2009, at 12:17 AM, Andrew Farmer  wrote:


On 1 Dec 2009, at 22:04, John Joyce wrote:

Please do not do this.
Please read the documentation on why this is there and what is  
expected behavior.

Code Signing does not prevent this.
Even Apple software that is downloaded internally triggers the  
quarantine message to users on first launch of that software.


No, I think you're conflating two different warnings here - there's  
one warning for "first time you've opened X", and a separate warning  
for "first launch of quarantined app". The former only shows up  
once, but the latter will show up every launch if you don't have  
permissions to clear the quarantined attribute -- which is why it's  
important to clear that up in an automated install. :)

___

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: Download Alert -- Quarantine information removal

2009-12-01 Thread Andrew Farmer
On 1 Dec 2009, at 22:04, John Joyce wrote:
> Please do not do this. 
> Please read the documentation on why this is there and what is expected 
> behavior.
> Code Signing does not prevent this. 
> Even Apple software that is downloaded internally triggers the quarantine 
> message to users on first launch of that software.

No, I think you're conflating two different warnings here - there's one warning 
for "first time you've opened X", and a separate warning for "first launch of 
quarantined app". The former only shows up once, but the latter will show up 
every launch if you don't have permissions to clear the quarantined attribute 
-- which is why it's important to clear that up in an automated install. 
:)___

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: Un-mounting of first DMG is taking 15secs

2009-12-01 Thread John Joyce

On Dec 1, 2009, at 11:03 PM, cocoa-dev-requ...@lists.apple.com wrote:

> Hi all,
> 
> In my application I need to mount and un-mount DMGs, but in one specific
> workflow un-mounting of first DMG is taking 15secs of time.
> 
> I am using Œhdiutil‚ command and NSTask with the following options ...
> Mounting:
> hdiutil  attach  -noverify ˆnoautoopen ˆnobrowse ˆnoautofsck
> ˆreadonly ˆquiet -mountpoint 
> Unmounting:
> hdiutil detach  -quiet
> 
> I am using NSTask, waitUntilExit method for every mount and un-mount. As I
> want mounting, un-mounting to be sync operations.
> 
> Only first un-mounting is taking 15secs time, if I won‚t wait for
> un-mounting and and try mounting the second DMG then the second DMG mount is
> also taking 15secs time. It means either unmounting of first dmg or mounting
> of second dmg is taking time. The same code is not taking time in many other
> workflows.
> 
> In the specific workflow which is taking time, my application is being
> launched by another root privileged process.
> 
> Do any one faced this type of issue ? Or any suggestions ?
> 
> Thanks and Regards,
> -Sra1
Without posting code or more detail on these "workflows" as well as what you 
have tried, it is unlikely you will get much of a response.
Based on "sometimes it takes a long time" then that would indicate something is 
still happening. 
If a process is running from the dmg, then it cannot unmount until that process 
ends.
Example: if you launch an app that is inside of a dmg, or on another volume 
external to the boot volume, you cannot unmount that volume until that app is 
terminated in some fashion.
You may want to try monitoring the processes running (top is a good unix tool 
for this)
or fseventer ... 

___

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


Migrating changed objects between contexts

2009-12-01 Thread Jim Thomason
I'm stumped and hoping that there's some easy solution that I just
haven't dug up yet. Yes, this is another coredata multithreading
question.

Anyway, in my application the user types in data and fills out forms
and such. It's all tied into CoreData via bindings. Nothing exciting.
But - I've also got a separate thread that wakes up when the data is
changed (via notifications) and updates a graphical representation of
what was typed in. So the user types in the values and my separate
thread reformats it into a graph.

Up until tonight, I'd managed to get away with using the same managed
object context in both threads. I was careful to lock and unlock it in
my second thread, and it seemed to work ok. Unfortunately, I've
expanded the graphing that happens in my second thread, and now I
can't get the thing to run without deadlocking. So I'm looking into
doing it the right way and having one context per thread and handing
around objectIDs to determine what to load. This works fine, as long
as the changes have been saved to the store so my secondary thread
picks them up.

But I don't know a good method to migrate any unsaved changes from one
context to another and that's what I'm looking for. Otherwise, I can
just hand along the IDs and load up my objects to graph them. But I
gotta get those changes moved over.

So. First off, is there some way I can just leave the existing code in
there that uses the same context and just locks it in the secondary
thread? The second thread basically consisted of:

-(void) makeGraph {
  NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
  [[document managedObjectContext] lock];
  //big honkin' code to make the graph
  [[document managedObjectContext] unlock];
  [pool release];
}

But since both the second thread and the main thread were trying to
load up the same object at once, it deadlocked. Is there some other
bit of locking magic I can add in to do it?

Otherwise, is there some slick, quick easy way to get the changes from
the first context into the second? Presumably, this needs to be done
from the main thread. So I'd create the secondary context in the main
thread (guaranteed not to be used by anyone else), copy the changes
over, then hand it off to the thread. If I tried copying from the main
context in the secondary thread, I assume I could end up with the main
thread trying to access my main context and another deadlock. I'm
somewhat concerned that this could negate my performance gains by
using a separate thread if I just have to do all of this copying and
initialization in my main thread before handing off to the background
one.

However, to do this right I'm going to need to end up writing a lot of
migration code to move from one context to another. I can do it, but
if there's a better way w/o handrolling my own copying routines,
that's clearly what I'd prefer. The added caveat is that I'm still
trying to target Tiger, so none of the whizbang cool coredata features
added to Leopard will help me. If there's a simple method in Leopard
that lets me do it, though, I'll consider abandoning Tiger.

It seems like this would be a common problem with an easy solution.
Otherwise, all the talk about using multiple contexts seems rather
moot if I can't see unsaved changes, am forced to save in advance, or
have to write my own routines to copy the objects myself.

So am I missing some elegant built-in solution that will Just Work for me?

Many thanks,

-Jim
___

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: Download Alert -- Quarantine information removal

2009-12-01 Thread John Joyce

On Dec 1, 2009, at 11:03 PM, cocoa-dev-requ...@lists.apple.com wrote:

> Hi all,
> 
> If I download a DMG from web and launch an (XYZ) application from it, then
> system will show an alert saying „ XYZ is an application which was
> downloaded from the Internet. Are you sure you want to open it?‰ PFA sample
> screen shot for this.
> 
> Help is saying that if you downloaded from un-trusted source then this error
> will come. I tried codesign-ing and downloading from Œ*https://*‚ server but
> still getting this alert.
> 
> When did some analysis I found that file system keeps Quarantine information
> in the extended attributes along with the files and shows this alert.
> xattr -d com.apple.quarantine  will remove this.
> 
> But I am writing an installer and I am coping files from the downloaded dmg
> to the system and system is keeping this info for all the files I copy.
> Eventually I am getting this alert. I tried different methods to copy files
> but no success.
> 
> I believe apple should provide some method through which I can copy files
> without copying Quarantine information.
> 
> The option left for me is to execute the above command for all the files to
> be copied. But it leads to performance degradation.
> 
> Any suggestions please?
> 
> Thanks,
> 
> Regards,
> -Sra1

Please do not do this. 
Please read the documentation on why this is there and what is expected 
behavior.
Code Signing does not prevent this. 
Even Apple software that is downloaded internally triggers the quarantine 
message to users on first launch of that software.
This is intended to be there.
If you are developing software for an enterprise ( I use the word loosely) 
deployment, you'd do better to examine other ways to deploy software. In such 
cases, you should consider building an image consisting of preconfigured system 
software and apps on OS X Server and deploying that to client systems.

___

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: Key path help for complex binding

2009-12-01 Thread David Hirsch
Well, I found a work-around.  Bindings still fail to work, but I can  
trigger a KVO message to be sent to the NSTableColumn manually by  
calling rearrangeObjects on my intermediary NSArrayController  
(selectedCourseRoomCosts).


I'd still like to make bindings do this without the kludge.

-Dave

On Dec 1, 2009, at 4:19 PM, David Hirsch wrote:


First thanks for all the help to date.  I'm learning a great deal.
The current problem:
I have a model for which I cannot seem to figure out the correct key  
paths for binding.


My doc has a rooms array (of Rooms) and a courses array (with  
NSArrayControllers).  Each course has a roomConstraint, which  
contains a roomCosts array of RoomCosts each of which has a Room*,  
"room" (points to an element of the doc's rooms array) and a  
"cost" (float).


I can easily bind a table column to the rooms array.  I am trying to  
bind two table columns to the RoomCosts data fields (each Room is  
basically a NSMutableString for now).  They change depending on the  
currently selected course in a separate tableview.


Earlier, I could make this work in a kludgy way, by creating an  
intermediary NSArrayController (selectedCourseRoomCosts) whose  
contentArray was bound to  
courseController.selection.roomConstraint.roomCosts, and then  
binding the table columns to selectedCourseRoomCosts.arrangedObjects.room.name 
 and selectedCourseRoomCosts.arrangedObjects.cost


When creating each Course object, I would copy the rooms array into  
the roomConstraint.  Fine.  I have no problem keeping that array in  
sync with the master rooms array.


The problem is, when I add a new Room to the master rooms array, and  
then add that room to the roomCosts array of each Course's  
roomConstraint, the table column doesn't get updated, until I tweak  
it manually (by adding a new course).  It is still bound to the  
existing items in the rooms array - if I alter their name, that get  
observed and reflected in the table, but adding new ones does not  
get observed.


Here is some of the relevant code (note that everything is shown  
here as an ivar, but they are all properties as well):

@interface ClassSchedulerDoc : NSDocument
{
IBOutlet NSArrayController  *courseController;
IBOutlet NSArrayController  *roomController;
NSMutableArray  *rooms;
NSMutableArray  *courses;
}

@implementation RoomArrayController
- (void) addObject:(id) newObject {
[snip]
// Add the object to the rooms array of each course
[courseController addRoom:newObject];
}

@implementation CourseArrayController
- (void) addRoom:(Room *) newRoom {
for (Course *curCourse in [self arrangedObjects]) {
[curCourse addRoom:newRoom];
}
}

@interface CourseRoomConstraint : Constraint {
NSMutableArray * roomCosts; // array of RoomCosts
}

@implementation CourseRoomConstraint
- (void) addRoom:(Room *) newRoom {
[roomCosts addObject:[[RoomCost alloc] initWithRoom:newRoom]];
}

@interface RoomCost : NSObject  {
	Room *room;	// this is a pointer to the real object in the real  
Rooms array - a weak reference

float cost;
}

Thanks in advance,
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/dhirsch%40mac.com

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




Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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: Download Alert -- Quarantine information removal

2009-12-01 Thread Stephen J. Butler
On Tue, Dec 1, 2009 at 9:55 AM, Sravana Kumar  wrote:
> I believe apple should provide some method through which I can copy files
> without copying Quarantine information.
>
> The option left for me is to execute the above command for all the files to
> be copied. But it leads to performance degradation.

Also, the best way to access quarantine information in 10.5 and above
is to use the LaunchServices API. It's worth taking a look at the
comments in

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/LSQuarantine.h

and related files. I think it's highly unlikely that Apple will ever
store quarantine in anything other than extended attributes... but you
never know.
___

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: Download Alert -- Quarantine information removal

2009-12-01 Thread Stephen J. Butler
On Tue, Dec 1, 2009 at 9:55 AM, Sravana Kumar  wrote:
> When did some analysis I found that file system keeps Quarantine information
> in the extended attributes along with the files and shows this alert.
> xattr -d com.apple.quarantine  will remove this.
>
> But I am writing an installer and I am coping files from the downloaded dmg
> to the system and system is keeping this info for all the files I copy.
> Eventually I am getting this alert. I tried different methods to copy files
> but no success.

Your files are inheriting the quarantine attribute from the DMG. So
remove it from the DMG before you attach, and you won't have to remove
it when you copy files.
___

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


Un-mounting of first DMG is taking 15secs

2009-12-01 Thread Sravana Kumar
Hi all,

In my application I need to mount and un-mount DMGs, but in one specific
workflow un-mounting of first DMG is taking 15secs of time.

I am using ‘hdiutil’ command and NSTask with the following options ...
Mounting:
hdiutil  attach  -noverify –noautoopen –nobrowse –noautofsck
–readonly –quiet -mountpoint 
Unmounting:
hdiutil detach  -quiet

I am using NSTask, waitUntilExit method for every mount and un-mount. As I
want mounting, un-mounting to be sync operations.

Only first un-mounting is taking 15secs time, if I won’t wait for
un-mounting and and try mounting the second DMG then the second DMG mount is
also taking 15secs time. It means either unmounting of first dmg or mounting
of second dmg is taking time. The same code is not taking time in many other
workflows.

In the specific workflow which is taking time, my application is being
launched by another root privileged process.

Do any one faced this type of issue ? Or any suggestions ?

Thanks and Regards,
-Sra1
___

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: View sizing issue when using "disclosure view"

2009-12-01 Thread Ron Fleckner

I wrote:

[content addSubview:autoPilotMaxView];


whoops, meant to say:
[content addSubview:myBox];

HTH,
Ron
___

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: View sizing issue when using "disclosure view"

2009-12-01 Thread Ron Fleckner


On 02/12/2009, at 2:14 PM, Bryan Zarnett wrote:

I'm having trouble making sure I have the correct springs and struts  
for my view.


At the top of the view I have a Split View that when the user  
resizes the window in height or length, the split view should  
appropriately resize. At the bottom I have a disclosure dialog which  
shows or hides an NSBox with some additional information.  The  
disclosure triangle changes the height of the window and changes the  
origin.


The problem is that the split view automatically squishes on the  
resize. What I want to happen is that the box should be hidden from  
the window resize and the split views should stay where they are.


Thoughts?

Bryan


Hi Bryan,

I've been able to do this in a perhaps naive way, but it works reliably.

All the objects and widgets in your un-resized window should have  
their struts rigid on the top (and sides if required), leaving the  
bottom strut alone (not rigid).


Then, when the view window needs to grow upon user request,  
programmatically do the resizing and add your box at the correct co- 
ordinates.


For example:

[myWindow setFrame:NSMakeRect() display:YES  
animate:YES];

[myBox setFrameOrigin:NSMakePoint()];
NSView *content = [myWindow contentView];
[content addSubview:autoPilotMaxView];

HTH,
Ron
___

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: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Graham Cox

On 02/12/2009, at 3:42 PM, Shane wrote:

> - (void) appendPoint:(NSPoint) point
> { 
>   if (firstPoint) {
>   [pointsPath moveToPoint:point];
>   
>   firstPoint = NO;
>   }
>   
>   [pointsPath lineToPoint:point];
>   
>   pointCount++;
>   
>   return;
> }


So pointCount is a simple count of the points. That will only be appropriate to 
use if each point you pass to appendPoint: increments by 1.0 in one of its 
coordinates (x, say) each time. Is that the case? If not, pointCount is in no 
way related to the dimensions of the path.

--Graham


___

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

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

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

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


Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Shane
> The problem is that the code you've posted is not the whole story.

Sorry about that, just for clarity, here's how I'm filling the path. I
will try to work with what you posted. Thanks.

- (void) appendPoint:(NSPoint) point
{   
if (firstPoint) {
[pointsPath moveToPoint:point];

firstPoint = NO;
}

[pointsPath lineToPoint:point];

pointCount++;

return;
}
___

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: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Graham Cox

On 02/12/2009, at 3:03 PM, Shane wrote:

> Still trying to make this work right using
> transformUsingAffineTransform. If I add in translateXBy or scaleXBy,
> my wave (pointsPath) show up all wrong, not translated or scaled, but
> if I comment them out (as is below), my wave appears just fine, it's
> just not scaled. Am I not using them correctly?


The problem is that the code you've posted is not the whole story. When you 
create the path, it has some coordinate system within which it is referenced. 
You are using  as some sort of dimensional quality of the path, 
which might be fine, but without seeing how the path is created it's hard to 
say.

When you transform the path, you transform it from its original coordinate 
system into a new coordinate system - therefore the original coordinate system 
matters greatly. In terms of scale, you should probably use [destination 
bounds].width / [path bounds].width for x, and [destination bounds].height / 
[path bounds].height for y scale factors, as I originally suggested. That way 
the actual size of the source coordinates is factored in whatever it is. That 
then just leaves you with the translation to deal with, for positioning the 
scaled path where you want it.

--Graham


___

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

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

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

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


Re: NSAffineTransform scaleBy not scaling

2009-12-01 Thread Shane
Still trying to make this work right using
transformUsingAffineTransform. If I add in translateXBy or scaleXBy,
my wave (pointsPath) show up all wrong, not translated or scaled, but
if I comment them out (as is below), my wave appears just fine, it's
just not scaled. Am I not using them correctly?

- (void) drawRect:(NSRect) rect
{
NSRect bounds = [self bounds];

[[NSColor blackColor] setFill];
[NSBezierPath fillRect:bounds];

//[self drawAxes];
[self drawError];

return;
}

- (void) drawError
{
float realBoundFactor = 0.9;

NSRect bounds = [self bounds];

float xFactor = (bounds.size.width * realBoundFactor) / (pointCount);
float yFactor = (bounds.size.height * realBoundFactor) / (pointCount);

NSAffineTransform *transform = [NSAffineTransform transform];
//[transform translateXBy:20.0 yBy:20.0];
//[transform scaleXBy:xFactor yBy:yFactor];

[pointsPath transformUsingAffineTransform: transform];

[[NSColor whiteColor] setStroke];

[pointsPath setLineCapStyle:NSSquareLineCapStyle];
[pointsPath stroke];

return;
}
___

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


View sizing issue when using "disclosure view"

2009-12-01 Thread Bryan Zarnett
I'm having trouble making sure I have the correct springs and struts  
for my view.


At the top of the view I have a Split View that when the user resizes  
the window in height or length, the split view should appropriately  
resize. At the bottom I have a disclosure dialog which shows or hides  
an NSBox with some additional information.  The disclosure triangle  
changes the height of the window and changes the origin.


The problem is that the split view automatically squishes on the  
resize. What I want to happen is that the box should be hidden from  
the window resize and the split views should stay where they are.


Thoughts?

Bryan
___

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: dynamic NSPointArray allocation

2009-12-01 Thread Andrew Farmer
On 1 Dec 2009, at 05:27, Jonathan Dann wrote:
> Just use NSPointerArray...

Just as is the case with an array of NSValue objects, NSPointerArray doesn't 
help here -- it makes no guarantees about how the objects will be arranged in 
memory, and NSBezierPath needs them to be 
contiguous.___

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: Use of preprocessor macros

2009-12-01 Thread Rob Keniger

On 02/12/2009, at 11:35 AM, Graham Cox wrote:

> To be honest it's very confusing as to which settings you're supposed to use 
> for what, and where they apply, since they're all identical. If the project 
> settings are not used, why have them there at all?


The project settings apply to all targets, but you can override them in 
individual targets. I agree that it can be confusing where certain settings are 
located, especially if you have multiple targets.

If you have changed a target's settings but want a target to inherit the 
project settings for a particular option, you can highlight the option and then 
choose "delete definition at this level" from the action popup in the 
bottom-left of the window.

This is probably drifting off into Xcode-users territory now though...

--
Rob Keniger



___

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: Use of preprocessor macros

2009-12-01 Thread Graham Cox

On 02/12/2009, at 12:23 PM, Rob Keniger wrote:

> This works fine for me. Are you sure you are compiling the build 
> configuration you think you're compiling? Are you changing the preprocessor 
> setting on the right target? Probably worth double checking.


Okaaay... I got it.

I'd set this in the (Project) > Get Info > Build settings, not (Target) > Get 
Info > Build settings.

Putting it in the target settings works as expected.

To be honest it's very confusing as to which settings you're supposed to use 
for what, and where they apply, since they're all identical. If the project 
settings are not used, why have them there at all?

Thanks though, I can get on now!

--Graham


___

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

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

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

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


Re: Use of preprocessor macros

2009-12-01 Thread Rob Keniger

On 02/12/2009, at 10:59 AM, Graham Cox wrote:

> I'm defining a preprocessor macro in the 'GCC 4.2 - Preprocessing / 
> preprocessor macros' section of my project's build properties, e.g. foo=1. 
> This is set only in the debug version.
> 
> But when I try and use it in the source code, as in #if foo ...  #endif I get 
> 'foo is not defined'.
> 
> What should I be doing? I need to conditionally compile in some code in the 
> debug version and leave it out in the release version.


This works fine for me. Are you sure you are compiling the build configuration 
you think you're compiling? Are you changing the preprocessor setting on the 
right target? Probably worth double checking.

--
Rob Keniger



___

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: Use of preprocessor macros

2009-12-01 Thread Marco S Hyman
> I'm defining a preprocessor macro in the 'GCC 4.2 - Preprocessing / 
> preprocessor macros' section of my project's build properties, e.g. foo=1. 
> This is set only in the debug version.

I'm pretty sure that worked with 4.2.   Currently I've a
project using CLANG and "GCC_PREPROCESSOR_DEFINITIONS = FOO=1"
in the Debug configuration works.  In the code I'm testing..

#if FOO == 0
...
#endif

/\/\arc

___

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: Use of preprocessor macros

2009-12-01 Thread Graham Cox

On 02/12/2009, at 12:04 PM, Luke the Hiesterman wrote:

> Don't you mean #ifdef foo rather than #if foo?


No, because foo=1 (In other builds foo=0)

But either way, the symbol itself is 'not defined'. I take that to mean that 
the compiler can't even see it, even though it was added to preprocessor macros.

--Graham


___

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

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

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

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


Re: Use of preprocessor macros

2009-12-01 Thread Luke the Hiesterman
Don't you mean #ifdef foo rather than #if foo?

Luke

On Dec 1, 2009, at 4:59 PM, Graham Cox wrote:

> Just a quickie.
> 
> I'm defining a preprocessor macro in the 'GCC 4.2 - Preprocessing / 
> preprocessor macros' section of my project's build properties, e.g. foo=1. 
> This is set only in the debug version.
> 
> But when I try and use it in the source code, as in #if foo ...  #endif I get 
> 'foo is not defined'.
> 
> What should I be doing? I need to conditionally compile in some code in the 
> debug version and leave it out in the release version.
> 
> 
> --Graham
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/luketheh%40apple.com
> 
> This email sent to luket...@apple.com

___

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

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

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

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


Re: How do I bind ManagedObject's relationships to a view?

2009-12-01 Thread John Pannell
Hi Daniel-

I just happened to be knocking out a prototype for something I'm working on 
with a similar structure to your example.  It consists of "steps" that can have 
many "ports", or step <->> port.  The example is pretty much code free; I was 
just trying to display and edit steps and ports using table views to manage 
both.  I use generic controllers in the .xib bound to the MOC, and UI elements 
bound to the proper controller.  I'd poke around and examine the model and xib 
files; you could even rename the pieces to match your situation.  You could add 
some more attributes to the ports (and more columns to the table) to model your 
transactions that you mentioned.

Download: http://www.positivespinmedia.com/dev/StepEdit.zip

Hope this helps... I know bindings can be one of those "picture worth a 
thousand words" things :-)

John

Positive Spin Media
http://www.positivespinmedia.com

On Dec 1, 2009, at 12:44 PM, Daniel Wambold wrote:

> Hello, List. I am a novice with CoreData and bindings and I've stumped myself 
> with this problem. I have created an xcdatamodel that contains 3 objects: an 
> Account object with a relationship property authorizedUsers, which is a 
> to-many relationship with a Person object. The Person object has a reciprocal 
> to-one relationship ("account") with the Account object. I have a table view 
> that shows all the accounts, and which, when I click on a given account, 
> should show, in a separate table view,  all the authorized users for that 
> account. The Person object has a read-only variable, nameAndID that 
> concatenates the first name, last name, and ID of the person entity. I feel 
> like I've tried every combination of bind to: and paths already. Right now, 
> I've only been successful by pushing a string into a scroll view with:
> 
> (from the Account.m file)
> -(NSMutableString *)authorizedUsersNameID
> {
>   NSMutableString *myString = [[[NSMutableString alloc] init] 
> autorelease];
>   NSSet *mySetOfAuthorizedUsers = [self valueForKey:authorizedUsersKey];
>   int i=0;
>   for (Person *aPerson in mySetOfAuthorizedUsers)
>   {
>   ++i;
>   [myString appendFormat:@"%i: %...@\n",i, [aPerson 
> valueForKey:nameAndIDKey]];
>   }
>   return myString;
> }
> 
> And in the view controller object:
> ...
>   NSEntityDescription *personEntityDescription = [NSEntityDescription 
> entityForName:PersonEntity inManagedObjectContext:moc];
>   NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
>   [request setEntity:personEntityDescription];
>   
>   // Set predicate and sort orderings...
>   NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account == 
> %@)", mySelectedAccount];
>   [request setPredicate:predicate];
>   NSError *error;
>   NSArray *myAuthorizedUsers = [moc executeFetchRequest:request 
> error:&error];
>   if (myAuthorizedUsers == nil || [myAuthorizedUsers count] == 0)
>   {
>   // This is an error situation, as we should always have at 
> least the account owner as an authorized user.
>   NSLog (@"Search error: Authorized account users failed to match 
> any account.");
>   }
>   else
>   {
>   [myAccountUserTextView setString:@""];  // Clear out 
> the text view.
>   for (NSManagedObject *anAuthorizedUser in myAuthorizedUsers)
>   {
>   [myAccountUserTextView insertText:[anAuthorizedUser 
> valueForKey:nameAndIDKey]];
>   [myAccountUserTextView insertText:@"\n"];
>   }
>   }
> 
> The problem is that, I also want to bind Transaction objects (same 
> relationships as Person) but they have more information such as dates, 
> amounts, and so forth. I'd much rather do this with bindings than to create 
> strings if it can be done. If you know what sort of settings I need to 
> establish in IB to set this up (such as which bindings and what paths), 
> please take a moment to set me straight. The CoreData test model in IB 
> doesn't do this for me, so I can't crib those settings. I have working, 
> subclassed controllers for each managed entity type, and the data are clearly 
> appearing in the managed object (viz. the above code), so I suspect it's just 
> my binding settings that I've got wrong.
> Thanks for your insight!
> -Dan
> ___
> 
> 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/john%40positivespinmedia.com
> 
> This email sent to j...@positivespinmedia.com

___

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

Please do not post admin requests or moder

Use of preprocessor macros

2009-12-01 Thread Graham Cox
Just a quickie.

I'm defining a preprocessor macro in the 'GCC 4.2 - Preprocessing / 
preprocessor macros' section of my project's build properties, e.g. foo=1. This 
is set only in the debug version.

But when I try and use it in the source code, as in #if foo ...  #endif I get 
'foo is not defined'.

What should I be doing? I need to conditionally compile in some code in the 
debug version and leave it out in the release version.


--Graham



___

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

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

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

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


Re: [NSWindow document]?

2009-12-01 Thread Mike Abdullah

On 2 Dec 2009, at 00:07, Andy Lee wrote:

> On Tuesday, December 01, 2009, at 06:36PM, "Kyle Sluder" 
>  wrote:
>> On Tue, Dec 1, 2009 at 3:27 PM, Andy Lee  wrote:
>>> Is there documentation that confirms window.document as a property I'm 
>>> allowed to use?  Should I file a documentation bug, and/or should I file a 
>>> request that window.document be made officially public?
>> 
>> You should probably stick to going through the window controller
>> instead.  That sounds like the safest bet to me.
> 
> Makes sense.  For some reason I thought window.document was buying us 
> something, but it turns out window.windowController.document works fine, 
> which makes sense since I would naively expect -[NSWindow document] to simply 
> return [[self windowController] document] anyway.

Even if that is how it's implemented, bear in mind that it would probably not 
be key-value compliant.___

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


Key path help for complex binding

2009-12-01 Thread David Hirsch

First thanks for all the help to date.  I'm learning a great deal.
The current problem:
I have a model for which I cannot seem to figure out the correct key  
paths for binding.


My doc has a rooms array (of Rooms) and a courses array (with  
NSArrayControllers).  Each course has a roomConstraint, which contains  
a roomCosts array of RoomCosts each of which has a Room*,  
"room" (points to an element of the doc's rooms array) and a  
"cost" (float).


I can easily bind a table column to the rooms array.  I am trying to  
bind two table columns to the RoomCosts data fields (each Room is  
basically a NSMutableString for now).  They change depending on the  
currently selected course in a separate tableview.


Earlier, I could make this work in a kludgy way, by creating an  
intermediary NSArrayController (selectedCourseRoomCosts) whose  
contentArray was bound to  
courseController.selection.roomConstraint.roomCosts, and then binding  
the table columns to selectedCourseRoomCosts.arrangedObjects.room.name  
and selectedCourseRoomCosts.arrangedObjects.cost


When creating each Course object, I would copy the rooms array into  
the roomConstraint.  Fine.  I have no problem keeping that array in  
sync with the master rooms array.


The problem is, when I add a new Room to the master rooms array, and  
then add that room to the roomCosts array of each Course's  
roomConstraint, the table column doesn't get updated, until I tweak it  
manually (by adding a new course).  It is still bound to the existing  
items in the rooms array - if I alter their name, that get observed  
and reflected in the table, but adding new ones does not get observed.


Here is some of the relevant code (note that everything is shown here  
as an ivar, but they are all properties as well):

@interface ClassSchedulerDoc : NSDocument
{
IBOutlet NSArrayController  *courseController;
IBOutlet NSArrayController  *roomController;
NSMutableArray  *rooms;
NSMutableArray  *courses;
}

@implementation RoomArrayController
- (void) addObject:(id) newObject {
[snip]
// Add the object to the rooms array of each course
[courseController addRoom:newObject];
}

@implementation CourseArrayController
- (void) addRoom:(Room *) newRoom {
for (Course *curCourse in [self arrangedObjects]) {
[curCourse addRoom:newRoom];
}
}

@interface CourseRoomConstraint : Constraint {
NSMutableArray * roomCosts; // array of RoomCosts
}

@implementation CourseRoomConstraint
- (void) addRoom:(Room *) newRoom {
[roomCosts addObject:[[RoomCost alloc] initWithRoom:newRoom]];
}

@interface RoomCost : NSObject  {
	Room *room;	// this is a pointer to the real object in the real Rooms  
array - a weak reference

float cost;
}

Thanks in advance,
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: [NSWindow document]?

2009-12-01 Thread Andy Lee
On Tuesday, December 01, 2009, at 06:36PM, "Kyle Sluder" 
 wrote:
>On Tue, Dec 1, 2009 at 3:27 PM, Andy Lee  wrote:
>> Is there documentation that confirms window.document as a property I'm 
>> allowed to use?  Should I file a documentation bug, and/or should I file a 
>> request that window.document be made officially public?
>
>You should probably stick to going through the window controller
>instead.  That sounds like the safest bet to me.

Makes sense.  For some reason I thought window.document was buying us 
something, but it turns out window.windowController.document works fine, which 
makes sense since I would naively expect -[NSWindow document] to simply return 
[[self windowController] document] anyway.

--Andy

___

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: [NSWindow document]?

2009-12-01 Thread Kyle Sluder
On Tue, Dec 1, 2009 at 3:27 PM, Andy Lee  wrote:
> Is there documentation that confirms window.document as a property I'm 
> allowed to use?  Should I file a documentation bug, and/or should I file a 
> request that window.document be made officially public?

You should probably stick to going through the window controller
instead.  That sounds like the safest bet to me.

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


NSHTTPCookieStorage to implement "Sign Out" functionality

2009-12-01 Thread Jesse Grosjean
My desktop app connects to a web application that's hosted on Google
App engine. Once it authenticates it gets a cookie that it passes
along for all future requests. That all works.

But now I want to add "Sign out". That feature code looks like this:

- (void)signOut {
NSHTTPCookieStorage *cookieStorage = [NSHTTPCookieStorage
sharedHTTPCookieStorage];
for (NSHTTPCookie *each in [[[cookieStorage cookiesForURL:[NSURL
URLWithString:self.serviceRootURLString]] copy] autorelease]) {
[cookieStorage deleteCookie:each];
}
}

But it only seems to work the first time. For instance I can open my
app. Sign in. Make some requests. Sign out. Then next time I make a
request I'm asked to authenticate again. Good!

But after I authenticate the second time the problem happens. The
authentication works. I get the cookie. I can make requests. But then
when I try to log out for the second time (without restarting my app)
the cookies don't seem to get deleted. They do seem deleted from my
apps perspective... ie I ask the cookie store for the cookies that it
has for that URL and it returns none. But if I try to make another
request (that should require a cookie) the request just works, I'm
never asked to authenticate again.

So if I'm understanding things correctly it seems that the cookies are
deleted from my perspective, but they are not deleted from the
underlying URL loading frameworks prespective.

Of possible interest:

- Could the problem be related to:
http://www.macworld.com/article/143343/2009/10/safaricookieproblems.html

Does anyone know how to consistently implement "log out" functionality
in an app that interacts with a web service?

Thanks,
Jesse
___

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


[NSWindow document]?

2009-12-01 Thread Andy Lee
I've stumbled onto the fact that NSWindow responds to the -document message, 
but I can't find any documentation for this.  Normally I'd ignore this as I 
would any undocumented API, but (a) the method name does not begin with an 
underscore, (b) it seems like a reasonable property for NSWindow to have, and 
(c) "window.document" is part of a key path in some code I'm looking at, and 
I'm wondering if the author knew something I don't.

Is there documentation that confirms window.document as a property I'm allowed 
to use?  Should I file a documentation bug, and/or should I file a request that 
window.document be made officially public?

--Andy

___

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: totally baffled by "odoc" apple event failing on launch

2009-12-01 Thread David M. Cotter
i've "fixed" this by installing an AE handler before startup, trapping the 
dropped events, then re-sending them to the NSApp after startup has completed 
(and removing the intrim handler, since NSApp is up and handling them by then)

On Dec 1, 2009, at 12:25 PM, M Pulis wrote:

> Tried AE Monitor (Oxalyn Software)?
> 
> Oxalyn Software > Æ Monitor
> 
> 
> Gary
> 
> On Dec 1, 2009, at 11:31 AM, David M. Cotter wrote:
> 
 recently our app has stopped responding to "odoc" apple events on startup.
 that is, if the user double clicks a document of our app, and this causes 
 the
 app to launch, then the document is not opened. (cnr when app is already
 launched).  same story dropping the doc icon onto the app icon (same code 
 path).
>> 
>>> Apparently this problem is widespread, as reported in this Macfixit article:
>>> 
>>> http://reviews.cnet.com/8301-13727_7-10401605-263.html
>> 
>> this is not the issue i'm having.  double clicking the document always 
>> launches my application.  so it is "bound" correctly.  the problem is that 
>> on startup my app is not receiving the "odoc" apple event, or it is being 
>> eaten at an inopportune time.  if the app is already running, then i do 
>> receive the event and the document opens.
>> 
>>> Are you certain that odoc events are even being sent?
>> no i am not
>> 
>>> It's pretty easy to find out using Apple event debugging.
>> and how do you do that?
>> 
>> i have run with AEDebug / Send / Receives set to 1 and i see the log of the 
>> events.  but i can only do that when launching from the command line (no 
>> double click) or from Xcode (again no double click) so there is no way to 
>> test my problem with these debug vars 
>> set.___
>> 
>> 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/toothpic%40fastq.com
>> 
>> This email sent to tooth...@fastq.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


Control Appearance on Textured Window Sheet

2009-12-01 Thread Mazen M. Abdel-Rahman
Hi All,

First of all - I want to thank everyone for helping me with my previous 
questions.

Now for my next question -

I have an application where I place the window in a separate *.xib (I called 
"MyWindow.xib")  file from the Main Menu.  I deleted the window that's in 
MainMenu.xib.  When the application loads -  my app delegate takes care of 
loading the window through a subclassed window controller (which I named 
"MyWindowController".  

"MyWindow.xib" also contains another window  - with the textured style - that 
is hidden when the application first starts - but appears as a sheet in 
response to an action.

On the sheet there is a tabview - with 2 tabs.  My problem is that the last 
tabs controls always show through.  So for example - when the sheet first comes 
down - you can can the controls for the user to enter in first name and last 
name.  If you click on the inactive tab - the user will see the controls for 
city and state - but they will see in the background the controls for first 
name and last name - though they will not be able to select them at all.   If 
the user goes back to the first tab the controls on the second tab will be in 
the background.

One more important thing - if I minimize the window - and then show it again - 
the "background" controls disappear and everything appears as it should be.

Any idea what I might be doing wrong? 

I made a small sample program to demonstrate this problem that I would be happy 
to send to anyone interested.

Thank you,
Mazen Abdel-Rahman
___

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 to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread Kyle Sluder
On Tue, Dec 1, 2009 at 2:05 PM, Sean McBride  wrote:
> NSArrayController is a model-controller, seems a little odd to me that
> you would want it to be aware of NSView instances.  Not that MVC must be
> followed religiously, but still.

Don't know if I agree with this.  It's a controller object, and can be
expected to have knowledge of the model and the view.  After all,
NSArrayController is an NSEditor and conforms to NSEditorRegistration.

--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: Keyword @defs

2009-12-01 Thread Ben Haller

On 1-Dec-09, at 3:21 PM, Kyle Sluder wrote:


On Mon, Nov 30, 2009 at 1:33 PM, Ben Haller wrote:
 This is interesting to me, since I am in fact using @public and ->  
with
some ivars to allow faster use of one of my classes.  (Yes, I've  
confirmed

that this is significant in Sampler; it is, in fact, quite a large
percentage of the total time of my app, which has runtimes measured  
in days,
so I do care :->).  I understand the concept of the fragile base  
class
problem and so forth; I just didn't realize Apple had done  
something to fix

it that might affect the performance of my app.  :->


Are you talking about an improvement over using accessor methods, or
over using non-fragile instance variables?  Even though, as Greg
noted, it takes more work to do a non-fragile ivar access because of
the indirection, that is insignificant compared to the time that would
be spent in objc_msgSend.  Especially if the ivars are used so often
that their symbols stick around in the cache.


  Currently I'm using @public and accessing ivars directly (because,  
as you say, objc_msgSend is slow).  Apparently even direct ivar access  
is slower than it used to be, due to non-fragile ivars glue emitted by  
the compiler, as Greg pointed out.  I'm looking for a way to win back  
some or all of that speed.  The previous suggestion of providing  
access to a struct inside the class is a good idea, I'm going to  
pursue that eventually.


Ben Haller
Stick Software


___

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 to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread David Hirsch
Here is the solution I've found to work: subclassing  
NSArrayController's addObject.  It does violate MVC in knowing about  
the view, but for me that is a reasonable trade-off to avoid having a  
bunch of different custom add: methods in my document subclass for  
each table I have to deal with.


- (void) addObject:(id) newObject {
[super addObject:newObject];
	//Retrieve an array of the objects in your array controller and  
calculate

//which row your new object is in
NSArray *array = [self arrangedObjects];
int row = [array indexOfObjectIdenticalTo:newObject];

//Begin editing of the cell containing the new object
//  NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:row];
//  [myTable selectRowIndexes:indexes byExtendingSelection:NO];
[myTable editColumn:0 row:row withEvent:nil select:YES];
}

The second- and third-from-last lines that are commented out are  
intended to select the correct row prior to editing, as supposedly  
required in the docs.  They do not seem to actually be required,  
whether or not "Select Inserted Objects" is checked in IB.  I'll  
probably leave them in for the sake of docs-obedience anyhow.


Thanks for the help.
-Dave

On Dec 1, 2009, at 2:05 PM, Sean McBride wrote:


On 12/1/09 1:51 PM, David Hirsch said:


Well, that is a nice bit of code to have, but it doesn't really
address the issue.  As I wrote in my original post, there are a  
number

of published methods for handing this in (for example) the NSDocument
subclass.  What *I* want to do is handle it in my NSArrayController
subclass, for encapsulation purposes - I have a number of different
tables for which I want to enable this, and I'd like to keep the
functionality separate.  I am looking into the suggestion of
subclassing NSArrayController's addObject: method, which seems likely
to work.


NSArrayController is a model-controller, seems a little odd to me that
you would want it to be aware of NSView instances.  Not that MVC  
must be

followed religiously, but still.




Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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 to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread Sean McBride
On 12/1/09 1:51 PM, David Hirsch said:

>Well, that is a nice bit of code to have, but it doesn't really
>address the issue.  As I wrote in my original post, there are a number
>of published methods for handing this in (for example) the NSDocument
>subclass.  What *I* want to do is handle it in my NSArrayController
>subclass, for encapsulation purposes - I have a number of different
>tables for which I want to enable this, and I'd like to keep the
>functionality separate.  I am looking into the suggestion of
>subclassing NSArrayController's addObject: method, which seems likely
>to work.

NSArrayController is a model-controller, seems a little odd to me that
you would want it to be aware of NSView instances.  Not that MVC must be
followed religiously, but still.

Personally, I have found NSObjectController's add: to be generally
useless, since you do not get access to the newly created model object.
I've found I almost always need my own action method.  From it, I create
a new model object, customize it, and make it the selected object.  The
table updated by KVO.  It's only one more line to edit the table's
cell.  True, you copy-paste that line everywhere, but oh well.

>Also, the scrollRowToVisible call is superfluous, since the
>editColumn:row:withEvent:select: method is documented to do the
>scrolling for you already.

So it is..., thanks.  The scrolling code predates by auto editing code.

--

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


___

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

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

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

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


Re: What to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread David Hirsch
Well, that is a nice bit of code to have, but it doesn't really  
address the issue.  As I wrote in my original post, there are a number  
of published methods for handing this in (for example) the NSDocument   
subclass.  What *I* want to do is handle it in my NSArrayController  
subclass, for encapsulation purposes - I have a number of different  
tables for which I want to enable this, and I'd like to keep the  
functionality separate.  I am looking into the suggestion of  
subclassing NSArrayController's addObject: method, which seems likely  
to work.


Also, the scrollRowToVisible call is superfluous, since the  
editColumn:row:withEvent:select: method is documented to do the  
scrolling for you already.  And, I think the setSelectedObjects can be  
replaced by a checkbox in IB, right?  (Although perhaps under some  
circumstances you would not like the added row to be selected?)

-Dave

On Dec 1, 2009, at 1:44 PM, Sean McBride wrote:


On 11/30/09 7:57 PM, David Hirsch said:


I'm trying to have my table immediately enable editing of added
items.


I have a handy NSTableView category to do that:

- (void)makeEditableSelectedCellOfColumnIdentifier:(NSString*)
inColumnIdentifier
{
	NSTableColumn* column = [self  
tableColumnWithIdentifier:inColumnIdentifier];

if (column && ![column isHidden])
{
if ([self numberOfSelectedRows] == 1)
{
			NSInteger columnIndex = [self  
columnWithIdentifier:inColumnIdentifier];

NSInteger selectRowIndex = [self selectedRow];
if ((columnIndex != -1) && (selectRowIndex != -1))
{
[self editColumn:columnIndex row:selectRowIndex withEvent:nil  
select:YES];

}
}
}
}

So in response to some "add" button in the UI, I have an action method
that does:

foo = [arrayController newObject]
[arrayController setSelectedObjects:[NSArray arrayWithObject:foo]]
[tableView scrollRowToVisible:[tableView selectedRow]];
[tableView makeEditableSelectedCellOfColumnIdentifier:@"bar"];

hth,

--

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






Dave Hirsch
Associate Professor
Department of Geology
Western Washington University
persistent email: dhir...@mac.com
http://www.davehirsch.com
voice: (360) 389-3583
aim: dhir...@mac.com
vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf




___

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 to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread Sean McBride
On 11/30/09 7:57 PM, David Hirsch said:

>I'm trying to have my table immediately enable editing of added
>items.

I have a handy NSTableView category to do that:

- (void)makeEditableSelectedCellOfColumnIdentifier:(NSString*)
inColumnIdentifier
{
NSTableColumn* column = [self 
tableColumnWithIdentifier:inColumnIdentifier];
if (column && ![column isHidden])
{
if ([self numberOfSelectedRows] == 1)
{
NSInteger columnIndex = [self 
columnWithIdentifier:inColumnIdentifier];
NSInteger selectRowIndex = [self selectedRow];
if ((columnIndex != -1) && (selectRowIndex != -1))
{
[self editColumn:columnIndex row:selectRowIndex 
withEvent:nil select:YES];
}
}
}
}

So in response to some "add" button in the UI, I have an action method
that does:

foo = [arrayController newObject]
[arrayController setSelectedObjects:[NSArray arrayWithObject:foo]]
[tableView scrollRowToVisible:[tableView selectedRow]];
[tableView makeEditableSelectedCellOfColumnIdentifier:@"bar"];

hth,

--

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


___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
Okay, I got everything working using the NSData objects. I'll try encoding the 
bytes again with the unint8_t* cast. I don't know why I didn't try that... I'm 
really not very comfortable when it gets down to this low-level stuff. I'm a 
musician, and my programming experience came from MaxMSP, to Java, to 
Objective-C, and now to this basic C stuff. In other words, totally backwards! 
;-)

But I can make stuff work most of the time (really, I swear!).

thanks again.

J.



On 2009-12-01, at 12:25 PM, Greg Guerin wrote:

> James Maxwell wrote:
> 
>> erm... actually, just using:
>> 
>> [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];
>> 
>> fails with a complaint about getting a float* when it expects a uint8_t 
>> const.
>> In fact, I know remember that's why I used the NSData in the first place... 
>> any thoughts?
> 
> 
> Type-casting is a basic language feature.  (const uint8_t *)coincidences
> 
> It's NOT expecting a uint8_t const.  It's expecting a pointer to const 
> uint8_t.
> 
>  -- GG
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jbmaxwell%40rubato-music.com
> 
> This email sent to jbmaxw...@rubato-music.com

___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Jens Alfke


On Dec 1, 2009, at 12:03 PM, James Maxwell wrote:


erm... actually, just using:

[aCoder encodeBytes:coincidences length:coincsSize  
forKey:@"coincidences"];


fails with a complaint about getting a float* when it expects a  
uint8_t const.
In fact, I know remember that's why I used the NSData in the first  
place... any thoughts?


aCoder encodeBytes:(uint8_t*)coincidences length:coincsSize  
forKey:@"coincidences"];


I have no idea why they typed encodeBytes: as a const uint8_t* instead  
of just const void*, but they did, so you almost always have to cast.


—Jens___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Greg Guerin

James Maxwell wrote:


erm... actually, just using:

[aCoder encodeBytes:coincidences length:coincsSize  
forKey:@"coincidences"];


fails with a complaint about getting a float* when it expects a  
uint8_t const.
In fact, I know remember that's why I used the NSData in the first  
place... any thoughts?



Type-casting is a basic language feature.  (const uint8_t *)coincidences

It's NOT expecting a uint8_t const.  It's expecting a pointer to  
const uint8_t.


  -- GG

___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Quincey Morris
On Dec 1, 2009, at 12:03, James Maxwell wrote:

> [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];
> 
> fails with a complaint about getting a float* when it expects a uint8_t 
> const. 
> In fact, I know remember that's why I used the NSData in the first place... 
> any thoughts? 

[aCoder encodeBytes:(uint8_t*)coincidences length:coincsSize 
forKey:@"coincidences"];


___

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: removing all sublayers from a layer with fast enumeration

2009-12-01 Thread Kyle Sluder
On Mon, Nov 30, 2009 at 11:40 AM, Matt Neuburg  wrote:
> NSArray* arr = [NSArray arrayWithArray: myview.layer.sublayers];

I wouldn't be surprised if -[CALayer sublayers] returns some funky KVO
proxy array object that -arrayWithArray: returns unmodified.

--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: totally baffled by "odoc" apple event failing on launch

2009-12-01 Thread M Pulis

Tried AE Monitor (Oxalyn Software)?

Oxalyn Software > Æ Monitor


Gary

On Dec 1, 2009, at 11:31 AM, David M. Cotter wrote:

recently our app has stopped responding to "odoc" apple events on  
startup.
that is, if the user double clicks a document of our app, and this  
causes the
app to launch, then the document is not opened. (cnr when app is  
already
launched).  same story dropping the doc icon onto the app icon  
(same code path).


Apparently this problem is widespread, as reported in this Macfixit  
article:


http://reviews.cnet.com/8301-13727_7-10401605-263.html


this is not the issue i'm having.  double clicking the document  
always launches my application.  so it is "bound" correctly.  the  
problem is that on startup my app is not receiving the "odoc" apple  
event, or it is being eaten at an inopportune time.  if the app is  
already running, then i do receive the event and the document opens.



Are you certain that odoc events are even being sent?

no i am not


It's pretty easy to find out using Apple event debugging.

and how do you do that?

i have run with AEDebug / Send / Receives set to 1 and i see the log  
of the events.  but i can only do that when launching from the  
command line (no double click) or from Xcode (again no double click)  
so there is no way to test my problem with these debug vars  
set.___


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/toothpic%40fastq.com

This email sent to tooth...@fastq.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: Keyword @defs

2009-12-01 Thread Kyle Sluder
On Mon, Nov 30, 2009 at 1:33 PM, Ben Haller
 wrote:
>  This is interesting to me, since I am in fact using @public and -> with
> some ivars to allow faster use of one of my classes.  (Yes, I've confirmed
> that this is significant in Sampler; it is, in fact, quite a large
> percentage of the total time of my app, which has runtimes measured in days,
> so I do care :->).  I understand the concept of the fragile base class
> problem and so forth; I just didn't realize Apple had done something to fix
> it that might affect the performance of my app.  :->

Are you talking about an improvement over using accessor methods, or
over using non-fragile instance variables?  Even though, as Greg
noted, it takes more work to do a non-fragile ivar access because of
the indirection, that is insignificant compared to the time that would
be spent in objc_msgSend.  Especially if the ivars are used so often
that their symbols stick around in the cache.

--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: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
> 
> As far as the NSData goes, I'm glad you pointed the redundancy of it out. 
> I'll just encode the bytes themselves. 
> 

erm... actually, just using:

[aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];

fails with a complaint about getting a float* when it expects a uint8_t const. 
In fact, I know remember that's why I used the NSData in the first place... any 
thoughts? 
This is on 10.6.2, if that means anything.

J.



> Just a note to Sherm that coincidences is malloced as (maxCoincs * inputSize 
> * sizeof(float)), because it's a 2D float array with dimensions maxCoincs x 
> inputSize. 
> 
> The software is just a research project, for now, so no worries about 
> portability (I'll cross that bridge if I ever get there!).
> 
> Now onto the crash that's happening when I try to actually *use* the app 
> after loading from a saved file! ugh... ;-)
> 
> thanks all,
> 
> J.
> 
> 
> On 2009-12-01, at 11:40 AM, Sherm Pendley wrote:
> 
>> On Tue, Dec 1, 2009 at 1:47 PM, James Maxwell
>>  wrote:
>>> I'm trying to save the state of my app. It chews up a lot of memory, most 
>>> of which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error 
>>> in -encodeBytes:length:forKey: and I'm just wondering what might be 
>>> happening. The float* "coincidences" is a malloced array.
>>> 
>>> NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
>> 
>> This looks suspicious to me. Based on the variable names, it looks
>> like you malloc(maxCoincs * sizeof(float)), then store the actual
>> number of floats in the buffer in inputSize. If that's what you're
>> doing, you only need to multiply by maxCoincs (to get the size of the
>> whole buffer) or by inputSize (to find out how much of the buffer is
>> actually in use) - not by both of them.
>> 
>>> NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
>>> length:coincsSize];
>>> [aCoder encodeBytes:[coincData bytes] length:coincsSize 
>>> forKey:@"coincidences"];
>> 
>> As someone else said, if you created the buffer with "coincidences =
>> malloc(...)", then you don't need to dereference it here; doing so
>> will give you the address of the pointer variable, not the address of
>> the buffer to which it points.
>> 
>> What's the point of creating the NSData object here? Wouldn't this be
>> just as good?
>> 
>>   [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];
>> 
>> sherm--
>> 
>> -- 
>> Cocoa programming in Perl:
>> http://www.camelbones.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/jbmaxwell%40rubato-music.com
> 
> This email sent to jbmaxw...@rubato-music.com

___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread James Maxwell
Wow! I'd forgotten how helpful this list is - and how quickly!

Everyone pointing out my use of &coincidences is obviously right. I figured it 
out soon after getting my first reply. I already made an @property accessor for 
coincidences, so I just used that and the crashes went away. 

As far as the NSData goes, I'm glad you pointed the redundancy of it out. I'll 
just encode the bytes themselves. 

Just a note to Sherm that coincidences is malloced as (maxCoincs * inputSize * 
sizeof(float)), because it's a 2D float array with dimensions maxCoincs x 
inputSize. 

The software is just a research project, for now, so no worries about 
portability (I'll cross that bridge if I ever get there!).

Now onto the crash that's happening when I try to actually *use* the app after 
loading from a saved file! ugh... ;-)

thanks all,

J.


On 2009-12-01, at 11:40 AM, Sherm Pendley wrote:

> On Tue, Dec 1, 2009 at 1:47 PM, James Maxwell
>  wrote:
>> I'm trying to save the state of my app. It chews up a lot of memory, most of 
>> which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in 
>> -encodeBytes:length:forKey: and I'm just wondering what might be happening. 
>> The float* "coincidences" is a malloced array.
>> 
>> NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
> 
> This looks suspicious to me. Based on the variable names, it looks
> like you malloc(maxCoincs * sizeof(float)), then store the actual
> number of floats in the buffer in inputSize. If that's what you're
> doing, you only need to multiply by maxCoincs (to get the size of the
> whole buffer) or by inputSize (to find out how much of the buffer is
> actually in use) - not by both of them.
> 
>> NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
>> length:coincsSize];
>> [aCoder encodeBytes:[coincData bytes] length:coincsSize 
>> forKey:@"coincidences"];
> 
> As someone else said, if you created the buffer with "coincidences =
> malloc(...)", then you don't need to dereference it here; doing so
> will give you the address of the pointer variable, not the address of
> the buffer to which it points.
> 
> What's the point of creating the NSData object here? Wouldn't this be
> just as good?
> 
>[aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];
> 
> sherm--
> 
> -- 
> Cocoa programming in Perl:
> http://www.camelbones.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: Hightlight on mouseover a NSTextFieldCell inside a TableView

2009-12-01 Thread Gustavo Pizano
Cobrin hi.

Thanks for the example name. Im checkin it... mmm too many information for my 
knowledge, well I understand what they do, no wI need to implement it in y 
app.. but honestly speaking, I dunno if im ready to face that beast.

I will give it a try tough.

g..


On Dec 1, 2009, at 7:42 PM, Corbin Dunn wrote:

> 
> On Dec 1, 2009, at 2:06 AM, Gustavo Pizano wrote:
> 
>> Hello, I have been searching how to achieve this. 
>> I have a NSTableView and the NSTableCells are a subclass I made.
>> Now I want to change the backgorund color of the table row when mouse over.  
>> In my SubClass of NSTextFieldCell I tried overriding these methods
>> - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
>>  NSLog(@"tracking.. %@",[self stringValue]);
>>  return YES;
>> }
>> 
>> 
>> - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame 
>> ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp{
>>  NSLog(@"here");
>>  return YES;
>> }
>> 
>> 
>> off course I see nothing of the logs.. it was just a tryout. .. now i dunno 
>> how to make NSTextFieldCell respond to mouse events, i.e a mouse entered, 
>> this for NSResponder class and subclasses, so  I was thinking in defining a 
>> NSTrackingArea, but because of NSTextField don't accept mouseEntered method 
>> then  I dunno.
>> 
>> I thought then maybe to subclass NSTableView, and do something with the 
>> point f the mouse, and then get the row at point, form the NSTableView, but 
>> this method returns me a integer,  so then I will multiply by the row height 
>> and create a NSREct and draw a background in that rect, but I dunno if this 
>> is a good approach.
>> 
>> Any ideas?
> 
> Look at the PhotoSearch example for how to do mouse over animations. You'll 
> have to extend it to do something for a given row.
> 
> corbin
> 
> 

___

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

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

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

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


How do I bind ManagedObject's relationships to a view?

2009-12-01 Thread Daniel Wambold
Hello, List. I am a novice with CoreData and bindings and I've stumped  
myself with this problem. I have created an xcdatamodel that contains  
3 objects: an Account object with a relationship property  
authorizedUsers, which is a to-many relationship with a Person object.  
The Person object has a reciprocal to-one relationship ("account")  
with the Account object. I have a table view that shows all the  
accounts, and which, when I click on a given account, should show, in  
a separate table view,  all the authorized users for that account. The  
Person object has a read-only variable, nameAndID that concatenates  
the first name, last name, and ID of the person entity. I feel like  
I've tried every combination of bind to: and paths already. Right now,  
I've only been successful by pushing a string into a scroll view with:


(from the Account.m file)
-(NSMutableString *)authorizedUsersNameID
{
	NSMutableString *myString = [[[NSMutableString alloc] init]  
autorelease];

NSSet *mySetOfAuthorizedUsers = [self valueForKey:authorizedUsersKey];
int i=0;
for (Person *aPerson in mySetOfAuthorizedUsers)
{
++i;
		[myString appendFormat:@"%i: %...@\n",i, [aPerson  
valueForKey:nameAndIDKey]];

}
return myString;
}

And in the view controller object:
...
	NSEntityDescription *personEntityDescription = [NSEntityDescription  
entityForName:PersonEntity inManagedObjectContext:moc];

NSFetchRequest *request = [[[NSFetchRequest alloc] init] autorelease];
[request setEntity:personEntityDescription];

// Set predicate and sort orderings...
	NSPredicate *predicate = [NSPredicate predicateWithFormat:@"(account  
== %@)", mySelectedAccount];

[request setPredicate:predicate];
NSError *error;
	NSArray *myAuthorizedUsers = [moc executeFetchRequest:request  
error:&error];

if (myAuthorizedUsers == nil || [myAuthorizedUsers count] == 0)
{
		// This is an error situation, as we should always have at least the  
account owner as an authorized user.
		NSLog (@"Search error: Authorized account users failed to match any  
account.");

}
else
{
[myAccountUserTextView setString:@""];// Clear 
out the text view.
for (NSManagedObject *anAuthorizedUser in myAuthorizedUsers)
{
			[myAccountUserTextView insertText:[anAuthorizedUser  
valueForKey:nameAndIDKey]];

[myAccountUserTextView insertText:@"\n"];
}
}

The problem is that, I also want to bind Transaction objects (same  
relationships as Person) but they have more information such as dates,  
amounts, and so forth. I'd much rather do this with bindings than to  
create strings if it can be done. If you know what sort of settings I  
need to establish in IB to set this up (such as which bindings and  
what paths), please take a moment to set me straight. The CoreData  
test model in IB doesn't do this for me, so I can't crib those  
settings. I have working, subclassed controllers for each managed  
entity type, and the data are clearly appearing in the managed object  
(viz. the above code), so I suspect it's just my binding settings that  
I've got wrong.

Thanks for your insight!
-Dan
___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Sherm Pendley
On Tue, Dec 1, 2009 at 1:47 PM, James Maxwell
 wrote:
> I'm trying to save the state of my app. It chews up a lot of memory, most of 
> which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in 
> -encodeBytes:length:forKey: and I'm just wondering what might be happening. 
> The float* "coincidences" is a malloced array.
>
> NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);

This looks suspicious to me. Based on the variable names, it looks
like you malloc(maxCoincs * sizeof(float)), then store the actual
number of floats in the buffer in inputSize. If that's what you're
doing, you only need to multiply by maxCoincs (to get the size of the
whole buffer) or by inputSize (to find out how much of the buffer is
actually in use) - not by both of them.

> NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
> length:coincsSize];
> [aCoder encodeBytes:[coincData bytes] length:coincsSize 
> forKey:@"coincidences"];

As someone else said, if you created the buffer with "coincidences =
malloc(...)", then you don't need to dereference it here; doing so
will give you the address of the pointer variable, not the address of
the buffer to which it points.

What's the point of creating the NSData object here? Wouldn't this be
just as good?

[aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];

sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.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: problem encoding large float* matrix

2009-12-01 Thread Greg Guerin

James Maxwell wrote:


NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences  
length:coincsSize];
[aCoder encodeBytes:[coincData bytes] length:coincsSize  
forKey:@"coincidences"];


It makes no sense to go through an NSData object.  You could just as  
easily cast coincidences to a byte-pointer.


Besides, if coincidences is defined as type float*, then your use of  
&coincidences to make the NSData is almost certainly wrong, and quite  
likely the cause of the crash.


  -- GG

___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Quincey Morris
On Dec 1, 2009, at 10:47, James Maxwell wrote:

> I'm trying to save the state of my app. It chews up a lot of memory, most of 
> which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in 
> -encodeBytes:length:forKey: and I'm just wondering what might be happening. 
> The float* "coincidences" is a malloced array.
> 
> NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
> NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
> length:coincsSize];
> [aCoder encodeBytes:[coincData bytes] length:coincsSize 
> forKey:@"coincidences"];
> 
> The app runs fine, but when I try to save, boom... EXC_BAD_ACCESS.
> 
> Is this a decent way to save a float* array?

Not really. :)

You don't show the declaration of 'coincidences', but if that's a pointer to a 
malloc'ed array, then '&coincidences' isn't where you want to copy the data 
from. That's likely why you're getting a big boom. I think you meant:

> NSData* coincData = [NSData dataWithBytesNoCopy:coincidences 
> length:coincsSize];

Nick already pointed out that 'dataWithBytesNoCopy:length:' probably isn't the 
correct method to use here, and (even if it was) putting the data "into" a 
NSData object, then immediately encoding it with 'encodeBytes:length:forKey:' 
is unnecessary. What's wrong with just:

> [aCoder encodeBytes:coincidences length:coincsSize forKey:@"coincidences"];

? (But remember this is architecture-specific as regards to endianness.)


___

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: NSString out of scope

2009-12-01 Thread Pierre Berloquin
Thanks. I'm travelling, I'll try that on Friday.
Pierre

2009/12/1 Eddie Aguirre 

> Try printing the variable through gcc at the breakpoint.  "po
> langueChoisie"
>
> I've had similar issues but usually printing from gcc will display the
> contents.
>
> --
> Eddie Aguirre
>
> On Dec 1, 2009, at 4:14 AM, Graham Cox wrote:
>
> >
> > On 01/12/2009, at 10:52 PM, Pierre Berloquin wrote:
> >
> >> When I want to test the content of the string I can't and the debugger
> displays "out of scope".
> >
> >
> > Ah, the debugger! Now we are getting somewhere. I see that fairly
> frequently. It's not necessarily indicative of a code error, since as far as
> I can tell from what you've posted, there isn't one.
> >
> > I'm not sure exactly what it is really trying to say, but it typically
> occurs for me when browsing through a stack frame and looking at values that
> are in frames well away from where the debugger has actually stopped. Could
> that be the case? In other words, does it work when you stop immediately
> after allocating the object? It might be indicative of trying to display a
> register value that has been reused or no longer in the cache (guessing).
> >
> > --Graham
> >
> >
> > ___
> >
> > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> >
> > Please do not post admin requests or moderator comments to the list.
> > Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> >
> > Help/Unsubscribe/Update your Subscription:
> > http://lists.apple.com/mailman/options/cocoa-dev/eddie%40markzware.com
> >
> > This email sent to ed...@markzware.com
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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

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

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

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


Re: problem encoding large float* matrix

2009-12-01 Thread Nick Zitzmann

On Dec 1, 2009, at 11:47 AM, James Maxwell wrote:

> NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
> NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
> length:coincsSize];
> [aCoder encodeBytes:[coincData bytes] length:coincsSize 
> forKey:@"coincidences"];
> 
> The app runs fine, but when I try to save, boom... EXC_BAD_ACCESS.
> 
> Is this a decent way to save a float* array?

Are you really sure you want to use -dataWithBytesNoCopy:? That method makes 
the data object take ownership of the bytes, so when the data is freed, your 
malloc'd pointer goes away, and accessing it afterwards will cause a crash. So 
unless you really know what you're doing, you ought to use -dataWithBytes: 
instead.

Also, you might want to consider just encoding the NSData object unless you 
have a really good reason for doing what you're doing. Also, if your file 
format is portable across architectures, don't forget to store & retrieve the 
floats in a consistent format (meaning big-endian or little-endian).

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


problem encoding large float* matrix

2009-12-01 Thread James Maxwell
I'm trying to save the state of my app. It chews up a lot of memory, most of 
which is in large float* matrices. I'm getting an EXC_BAD_ACCESS error in 
-encodeBytes:length:forKey: and I'm just wondering what might be happening. The 
float* "coincidences" is a malloced array.

NSUInteger coincsSize = maxCoincs * inputSize * sizeof(float);
NSData* coincData = [NSData dataWithBytesNoCopy:&coincidences 
length:coincsSize];
[aCoder encodeBytes:[coincData bytes] length:coincsSize forKey:@"coincidences"];

The app runs fine, but when I try to save, boom... EXC_BAD_ACCESS.

Is this a decent way to save a float* array?

J.___

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: Hightlight on mouseover a NSTextFieldCell inside a TableView

2009-12-01 Thread Corbin Dunn

On Dec 1, 2009, at 2:06 AM, Gustavo Pizano wrote:

> Hello, I have been searching how to achieve this. 
> I have a NSTableView and the NSTableCells are a subclass I made.
> Now I want to change the backgorund color of the table row when mouse over.  
> In my SubClass of NSTextFieldCell I tried overriding these methods
> - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
>   NSLog(@"tracking.. %@",[self stringValue]);
>   return YES;
> }
> 
> 
> - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame 
> ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp{
>   NSLog(@"here");
>   return YES;
> }
> 
> 
> off course I see nothing of the logs.. it was just a tryout. .. now i dunno 
> how to make NSTextFieldCell respond to mouse events, i.e a mouse entered, 
> this for NSResponder class and subclasses, so  I was thinking in defining a 
> NSTrackingArea, but because of NSTextField don't accept mouseEntered method 
> then  I dunno.
> 
> I thought then maybe to subclass NSTableView, and do something with the point 
> f the mouse, and then get the row at point, form the NSTableView, but this 
> method returns me a integer,  so then I will multiply by the row height and 
> create a NSREct and draw a background in that rect, but I dunno if this is a 
> good approach.
> 
> Any ideas?

Look at the PhotoSearch example for how to do mouse over animations. You'll 
have to extend it to do something for a given row.

corbin


___

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

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

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

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


Re: totally baffled by "odoc" apple event failing on launch

2009-12-01 Thread Dave Keck
> i have run with AEDebug / Send / Receives set to 1 and i see the log
> of the events. but i can only do that when launching from the command
> line (no double click) or from Xcode (again no double click) so there is
> no way to test my problem with these debug vars set.

http://developer.apple.com/mac/library/qa/qa2001/qa1255.html
___

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: Carbon menus in Cocoa app

2009-12-01 Thread Eric Schlegel

On Nov 30, 2009, at 5:03 AM, Vikram Sethi wrote:

> Though the menu bar appears and the individual menu items get created and
> get added to the hierarchy (verified it while debugging), the menus do not
> open when I click on the menu bar. The menus are also Carbon based. They are
> defined as a ‘MBAR’ resource and the menu bar gets created using the
> GetNewMBar() API. This API has been marked ‘Not recommended’ though it is
> not deprecated. Documentation says use NIB files instead.
> 
> I tried similar changes in another Carbon based app. This app opened fine
> and I was able to access the menus also. Unlike my app, this ref app defines
> the menus in a NIB file and creates the menu bar using the NIB file.

I would not actually expect that there would be any difference in the behavior 
of the two applications based solely on how the menus are created. Regardless 
of whether you create your menus from an 'MBAR' or from a nib, once the menus 
are created, they should behave the same at runtime. It sounds to me that there 
is some other difference in the event-handling process of the two applications, 
which probably could be fixed in your real application without needing to move 
to nib files.

Can you send me copies of both the working and non-working applications and 
I'll see what the difference is?

-eric

___

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: NSString out of scope

2009-12-01 Thread Eddie Aguirre
Try printing the variable through gcc at the breakpoint.  "po langueChoisie"

I've had similar issues but usually printing from gcc will display the contents.

--
Eddie Aguirre

On Dec 1, 2009, at 4:14 AM, Graham Cox wrote:

> 
> On 01/12/2009, at 10:52 PM, Pierre Berloquin wrote:
> 
>> When I want to test the content of the string I can't and the debugger 
>> displays "out of scope".
> 
> 
> Ah, the debugger! Now we are getting somewhere. I see that fairly frequently. 
> It's not necessarily indicative of a code error, since as far as I can tell 
> from what you've posted, there isn't one.
> 
> I'm not sure exactly what it is really trying to say, but it typically occurs 
> for me when browsing through a stack frame and looking at values that are in 
> frames well away from where the debugger has actually stopped. Could that be 
> the case? In other words, does it work when you stop immediately after 
> allocating the object? It might be indicative of trying to display a register 
> value that has been reused or no longer in the cache (guessing).
> 
> --Graham
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/eddie%40markzware.com
> 
> This email sent to ed...@markzware.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: totally baffled by "odoc" apple event failing on launch

2009-12-01 Thread David M. Cotter
>> recently our app has stopped responding to "odoc" apple events on startup.
>> that is, if the user double clicks a document of our app, and this causes the
>> app to launch, then the document is not opened. (cnr when app is already
>> launched).  same story dropping the doc icon onto the app icon (same code 
>> path).

> Apparently this problem is widespread, as reported in this Macfixit article:
> 
> http://reviews.cnet.com/8301-13727_7-10401605-263.html

this is not the issue i'm having.  double clicking the document always launches 
my application.  so it is "bound" correctly.  the problem is that on startup my 
app is not receiving the "odoc" apple event, or it is being eaten at an 
inopportune time.  if the app is already running, then i do receive the event 
and the document opens.

> Are you certain that odoc events are even being sent?
no i am not

> It's pretty easy to find out using Apple event debugging.
and how do you do that?

i have run with AEDebug / Send / Receives set to 1 and i see the log of the 
events.  but i can only do that when launching from the command line (no double 
click) or from Xcode (again no double click) so there is no way to test my 
problem with these debug vars 
set.___

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: Some questions/problems regarding CALayers

2009-12-01 Thread Matt Neuburg
On Tue, 1 Dec 2009 03:35:57 +0200, Henri H?kkinen 
said:
>Hello.
>
>I'm trying to implement my custom NSView derived class to draw a chessboard
with chess pieces on it. I'm using Core Animation's CALayer classes since I want
to use animation with other effects later on.
>
>Currently I have have Board and Piece classes, which both derive from CALayer.
Board overrides resizeWithSuperlayerSize which resizes bounds to always keep the
layer's aspect ratio fixed (since chessboards are always square) and it's
position centered relative to the superlayer's frame, and in drawInContext I
draw the chess squares with two alternating colors. Piece class likewise
overrides drawInContext to draw NSImage on it, which represents piece's vector
image loaded from a PDF file. Board layer is added as a sublayer of the NSView's
root layer and Piece layers are added as a sublayer of the Board layer and so
forth.
>
>My problem now is, however, that I am not sure how do I keep the position and
size of a Piece layer fixed to a specific square in the Board layer. Board's
bounding rectangle can be any size and it changes dynamically as the view gets
resized. Piece layer does not know it's square coordinates on the chessboard,
except by the bounds rectangle.

Maybe I'm misunderstanding, but it seems to me from what you say that the
Board knows how the chessboard is laid out, and it knows where each Piece
is, so it knows which "square" a given Piece is in. So as the Board redraws
/ resizes, it redraws the squares and resizes / repositions each Piece
accordingly. (Or if you want each Piece to resize / reposition itself,
provide a method so that it can ask the Board where it needs to be.)

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: totally baffled by "odoc" apple event failing on launch

2009-12-01 Thread Matt Neuburg
On Mon, 30 Nov 2009 17:33:49 -0800, "David M. Cotter" 
said:
>recently our app has stopped responding to "odoc" apple events on startup.
that is, if the user double clicks a document of our app, and this causes the
app to launch, then the document is not opened. (cnr when app is already
launched).  same story dropping the doc icon onto the app icon (same code path).

Apparently this problem is widespread, as reported in this Macfixit article:

http://reviews.cnet.com/8301-13727_7-10401605-263.html

I do not agree with Macfixit's suggestion that this problem has to do with
Snow Leopard's ignoring of document creator codes; I merely point out the
article to show that something widespread is going on here - something that
is probably not a Cocoa issue.

Are you certain that odoc events are even being sent? It's pretty easy to
find out using Apple event debugging. I'm guessing that they are not, and
that this is the problem. But I don't know *why* not.

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

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: Carbon menus in Cocoa app

2009-12-01 Thread Charles Srstka
On Nov 30, 2009, at 7:03 AM, Vikram Sethi wrote:

> -  I understand that we should move our menu handling to Cocoa and
> that would resolve the problem. We will do that, however, we plan to
> modernize our app incrementally, taking one step at a time. Is there a low
> cost tweak/hack that we can put in for now to make the menus work so that we
> can revamp the menu handling a little later?

My expectation would be that just making a simple NIB file with a menu bar in 
it would take a lot less time than trying to figure out some hack to get the 
ancient menu APIs to work.

Charles___

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

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

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

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


Re: Controller does not contain associated window after initialization

2009-12-01 Thread Bryan Zarnett

Thanks Graham

On 1-Dec-09, at 9:48 AM, Graham Cox wrote:



On 02/12/2009, at 1:31 AM, Bryan Zarnett wrote:

I am creating an application with multiple NIB files.  I created an  
empty NIB, put down a new window and  added an Object for the  
controller. I wired the controller object to the window and the nib  
as well as a few actions.


In my controller class I have added the following:

if (self = [super init])
{
[NSBundle loadNibNamed:@"CreateSheets.xib" owner:self];
NSLog(@"The sheet is %@",[self sheet]);
}

The sheet is always null. Are there any specific steps I need to  
do, when working with multiple NIBS to:


1) Load the controller for a specific NIB.
2) Set the window in the NIB to the controller
3) Use the new controller in another controller.

For reference, I have my "MainController" which instantiates the  
"SecondController" and uses the window.


Thoughts?



Do it the conventional way. Subclass NSWindowController and make  
that File's Owner for the nib. It will deal with instantiating and  
loading the window lazily for you. If there are aspects of a  
controller that you want to reuse but don't fit with  
NSWindowController, make that a subcontroller of the  
NSWindowController.


I can't quite follow what you've done above. It appears as if you  
are trying to load the nib that contains the object that is trying  
to load the nib. Cart before horse?


--Graham


___

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

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

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

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


Please ask clearer questions [Re: NSString out of scope]

2009-12-01 Thread Jens Alfke

On Dec 1, 2009, at 12:39 AM, Pierre Berloquin wrote:

> How come an NSString or NSMutableString I declare in the view controler .h
> interface [...]
> is "out of scope" even before I do anything with it in the .m implementation

... [skipping four intervening posts] ...

On Dec 1, 2009, at 4:14 AM, Graham Cox wrote:

> Ah, the debugger! Now we are getting somewhere. I see that fairly frequently. 
> It's not necessarily indicative of a code error, since as far as I can tell 
> from what you've posted, there isn't one.



Could people asking questions (Pierre in this case) please INCLUDE THE RELEVANT 
DETAILS of what they're asking about in the original post, so we don't have to 
play guessing games? In this thread it took five messages, three from the 
original poster, to reveal the crucial fact that this is about the debugger, 
not the compiler. 

I don't know how many thousand people read this list, but that's a lot of 
person-hours wasted reading through the thread. (Which shouldn't even have been 
asked on this list; it properly belongs on xcode-users.)

I don't mean to pick on you in particular, Pierre; lots of people make this 
mistake and this time it just happened to trigger the flame-bot.

Worth a read: How To Ask Good Questions.

—Jens___

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

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

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

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


Re: Controller does not contain associated window after initialization

2009-12-01 Thread Graham Cox

On 02/12/2009, at 1:31 AM, Bryan Zarnett wrote:

> I am creating an application with multiple NIB files.  I created an empty 
> NIB, put down a new window and  added an Object for the controller. I wired 
> the controller object to the window and the nib as well as a few actions.
> 
> In my controller class I have added the following:
> 
> if (self = [super init])
> {
>  [NSBundle loadNibNamed:@"CreateSheets.xib" owner:self];
>  NSLog(@"The sheet is %@",[self sheet]);
> }
> 
> The sheet is always null. Are there any specific steps I need to do, when 
> working with multiple NIBS to:
> 
> 1) Load the controller for a specific NIB.
> 2) Set the window in the NIB to the controller
> 3) Use the new controller in another controller.
> 
> For reference, I have my "MainController" which instantiates the 
> "SecondController" and uses the window.
> 
> Thoughts?


Do it the conventional way. Subclass NSWindowController and make that File's 
Owner for the nib. It will deal with instantiating and loading the window 
lazily for you. If there are aspects of a controller that you want to reuse but 
don't fit with NSWindowController, make that a subcontroller of the 
NSWindowController.

I can't quite follow what you've done above. It appears as if you are trying to 
load the nib that contains the object that is trying to load the nib. Cart 
before horse?

--Graham___

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

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

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

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


Controller does not contain associated window after initialization

2009-12-01 Thread Bryan Zarnett
I am creating an application with multiple NIB files.  I created an  
empty NIB, put down a new window and  added an Object for the  
controller. I wired the controller object to the window and the nib as  
well as a few actions.


In my controller class I have added the following:

if (self = [super init])
{
  [NSBundle loadNibNamed:@"CreateSheets.xib" owner:self];
  NSLog(@"The sheet is %@",[self sheet]);
}

The sheet is always null. Are there any specific steps I need to do,  
when working with multiple NIBS to:


1) Load the controller for a specific NIB.
2) Set the window in the NIB to the controller
3) Use the new controller in another controller.

For reference, I have my "MainController" which instantiates the  
"SecondController" and uses the window.


Thoughts?

Bryan
___

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: dynamic NSPointArray allocation

2009-12-01 Thread Jonathan Dann
Just use NSPointerArray:

@implementation NSPointerFunctions (Additions)

static NSUInteger _PointerFunctionsCGPointStructSize(const void *item)
{
return sizeof(CGPoint);
}

+ (NSPointerFunctions *)pointerFunctionsForCGPoint;
{
NSPointerFunctions *aPointerFunctions = [NSPointerFunctions 
pointerFunctionsWithOptions:(NSPointerFunctionsStructPersonality|NSPointerFunctionsMallocMemory|NSPointerFunctionsCopyIn)];
[aPointerFunctions setSizeFunction:&_PointerFunctionsCGPointStructSize];
return aPointerFunctions;
}
@end

@implementation NSPointerArray (Additions)
+ (id)pointPointerArray;
{
return [[[self alloc] initWithPointerFunctions:[NSPointerFunctions 
pointerFunctionsForCGPoint]] autorelease];
}

- (CGPoint)pointAtIndex:(NSUInteger)theIndex;
{
return *(CGPoint *)[self pointerAtIndex:theIndex];
}

- (void)addPoint:(CGPoint)thePoint;
{
[self addPointer:&thePoint];
}

@end

Jonathan

http://madebysofa.com

On 27 Nov 2009, at 21:46, Shane wrote:

> I don't know how large my NSPointArray size needs to be so I'd like to
> know how I would dynamically allocate NSPoints to populate an
> NSPointArray? I think I can do it with NSMutableArray, but
> NSBezierPath takes an NSPointArray (which is what my end result is for
> the points) and it just seems cleaner and more efficient if I can stay
> with that instead of converting between point arrays and mutable
> arrays.
> ___
> 
> 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/j.p.dann%40gmail.com
> 
> This email sent to j.p.d...@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: NSString out of scope

2009-12-01 Thread Roland King
you could also (and I'd sort of recommend it) post over on the XCode list and 
ask about this, there's some very knowledgeable people over there who know all 
there is to know about the toolchain and may well be able to help you. 


On 01-Dec-2009, at 8:14 PM, Graham Cox wrote:

> 
> On 01/12/2009, at 10:52 PM, Pierre Berloquin wrote:
> 
>> When I want to test the content of the string I can't and the debugger 
>> displays "out of scope".
> 
> 
> Ah, the debugger! Now we are getting somewhere. I see that fairly frequently. 
> It's not necessarily indicative of a code error, since as far as I can tell 
> from what you've posted, there isn't one.
> 
> I'm not sure exactly what it is really trying to say, but it typically occurs 
> for me when browsing through a stack frame and looking at values that are in 
> frames well away from where the debugger has actually stopped. Could that be 
> the case? In other words, does it work when you stop immediately after 
> allocating the object? It might be indicative of trying to display a register 
> value that has been reused or no longer in the cache (guessing).
> 
> --Graham
> 
> 

___

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

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

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

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


Re: NSString out of scope

2009-12-01 Thread Graham Cox

On 01/12/2009, at 10:52 PM, Pierre Berloquin wrote:

> When I want to test the content of the string I can't and the debugger 
> displays "out of scope".


Ah, the debugger! Now we are getting somewhere. I see that fairly frequently. 
It's not necessarily indicative of a code error, since as far as I can tell 
from what you've posted, there isn't one.

I'm not sure exactly what it is really trying to say, but it typically occurs 
for me when browsing through a stack frame and looking at values that are in 
frames well away from where the debugger has actually stopped. Could that be 
the case? In other words, does it work when you stop immediately after 
allocating the object? It might be indicative of trying to display a register 
value that has been reused or no longer in the cache (guessing).

--Graham


___

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

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

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

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


Re: NSString out of scope

2009-12-01 Thread Pierre Berloquin
When I want to test the content of the string I can't and the debugger
displays "out of scope".

2009/12/1 Roland King 

>
> On 01-Dec-2009, at 7:07 PM, Pierre Berloquin wrote:
>
> >
> > I have no problem with lesImagesVues but langueChoisie is out of scope.
> > This remains so even if I initialize in viewDidLoad, even if I make it a
> > @property, and through out the code, etc.
> >
>
> What does 'out of scope' mean? What is the actual error you are getting and
> where are you getting it?
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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: iterating and removing objects from a collection

2009-12-01 Thread Jeremy Pereira

On 30 Nov 2009, at 21:21, Ken Thomases wrote:

> On Nov 30, 2009, at 2:45 PM, Dennis Munsie wrote:
> 
>> I run into this all the time where I need to iterate through an
>> NSMutableArray (or set, etc, etc) and remove some of the items.  My normal
>> pattern has been this:
>> 
>> NSMutableSet *removeSet = [[NSMutableSet alloc] init];
>> for(NSObject *foo in myArray) {
>>  if(needToRemoveFoo) {
>> [removeSet addObject:foo];
>>  }
>> }
>> for(NSObject *foo in removeSet) {
>>  [myArray removeObject:foo];
>> }
>> [removeSet release];
> 
> Some alternatives:
> 
> * Iterate over the array just using an index, rather than fast enumeration 
> (or NSEnumerator).  Then, you can mutate the array as you go, so long as 
> you're careful about the index.  (If you remove an item on a given pass 
> through the loop, then you shouldn't increment the index on that pass.)
> 
> * Collect the items to be removed by index into an NSMutableIndexSet and then 
> use -removeObjectsAtIndexes: to remove them.
> 
> * Use -filterUsingPredicate:, if it's a good match for what you're trying to 
> do

Another alternative

NSMutableArray* newArray = [[NSMutableArray alloc] init];
for (NSObject* foo in myArray)
{
if (!needToRemoveFoo)
{
[newArray addObject: foo];
}
}
[self setMyArray: newArray];

Might be better if the assumption that adding objects to the end of an array is 
faster than removing them from the middle holds and the app can take the memory 
overhead of two possibly identical arrays for a brief period of time. 


> 
> Cheers,
> Ken
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
> 
> This email sent to a...@jeremyp.net


__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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: NSString out of scope

2009-12-01 Thread Roland King

On 01-Dec-2009, at 7:07 PM, Pierre Berloquin wrote:

> 
> I have no problem with lesImagesVues but langueChoisie is out of scope.
> This remains so even if I initialize in viewDidLoad, even if I make it a
> @property, and through out the code, etc.
> 

What does 'out of scope' mean? What is the actual error you are getting and 
where are you getting 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: NSString out of scope

2009-12-01 Thread Pierre Berloquin
Graham:

Here is the whole sad truth about it :

My .h begins with

//  The_Paris_PuzzlesViewController.h



#import 

#import 

#import "Affiche.h"

#import "VagPiece.h"


@protocol UIActionSheetDelegate;

@interface The_Paris_PuzzlesViewController : UIViewController
 {

NSMutableArray *lesImagesVues;

NSMutableString *langueChoisie;
...

and my .m begins with

//  The_Paris_PuzzlesViewController.m



#import "The_Paris_PuzzlesViewController.h"

#import 

#import 

#import 


#define kFilename @"data.plist"


@implementation The_Paris_PuzzlesViewController



// Implement loadView to create a view hierarchy programmatically, without
using a nib.

- (void)loadView {

lesImagesVues = [[NSMutableArray alloc] init];

langueChoisie = [[NSMutableString alloc] init];

I have no problem with lesImagesVues but langueChoisie is out of scope.
This remains so even if I initialize in viewDidLoad, even if I make it a
@property, and through out the code, etc.

Why ?

Thanks for your help
Pierre

2009/12/1 Graham Cox 

>
> On 01/12/2009, at 7:39 PM, Pierre Berloquin wrote:
>
> > How come an NSString or NSMutableString I declare in the view controler
> .h
> > interface
> >
> > NSMutableString *language;
> >
> >
> > is "out of scope" even before I do anything with it in the .m
> implementation
> >
> >
> > language = [[NSMutableString alloc] init];
>
>
> Good game, but can you supply some surrounding context?
>
> Is 'language' an ivar of a class or just sitting there as a global? Where
> is the alloc/init being called from? What is giving the error - the
> compiler? Debugger?
>
> Or have I already used up my 20 questions?
>
> --Graham
>
>
>


-- 
Blogs : http://bibliobs.nouvelobs.com/blog/jeux-litteraires
   http://pierre-berloquin.blogspot.com/

Développement durable des neurones par le jeu de réflexion
www.crealude.net

Sustainable development of neurones through mind games
www.crealude.net/us

Que fait-on pour les mal-codants ?
___

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: Hightlight on mouseover a NSTextFieldCell inside a TableView

2009-12-01 Thread Gustavo Pizano
Graham... tanks for the reply I will take a lookt at the method, and see... 
maybe you are right, this may be against all.. ... 

Thanks for the help once again you were of great aid.


Gustavo

On Dec 1, 2009, at 11:41 AM, Graham Cox wrote:

> 
> On 01/12/2009, at 9:06 PM, Gustavo Pizano wrote:
> 
>> Hello, I have been searching how to achieve this. 
> 
> OK, usual blather about mouseovers being untypical UI on the Mac that is not 
> encouraged by the HIG.
> 
>> I have a NSTableView and the NSTableCells are a subclass I made.
>> Now I want to change the backgorund color of the table row when mouse over.  
>> In my SubClass of NSTextFieldCell I tried overriding these methods
>> - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
>>  NSLog(@"tracking.. %@",[self stringValue]);
>>  return YES;
>> }
>> 
>> 
>> - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame 
>> ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp{
>>  NSLog(@"here");
>>  return YES;
>> }
>> 
>> 
>> off course I see nothing of the logs.. it was just a tryout. .. now i dunno 
>> how to make NSTextFieldCell respond to mouse events, i.e a mouse entered, 
>> this for NSResponder class and subclasses, so  I was thinking in defining a 
>> NSTrackingArea, but because of NSTextField don't accept mouseEntered method 
>> then  I dunno.
> 
> Those methods are there to deal with mouse down tracking.
> 
>> I thought then maybe to subclass NSTableView, and do something with the 
>> point f the mouse, and then get the row at point, form the NSTableView, but 
>> this method returns me a integer,  so then I will multiply by the row height 
>> and create a NSREct and draw a background in that rect, but I dunno if this 
>> is a good approach.
> 
> Well, -rectOfRow: does all this for you, and presumably also deals with 
> variable height rows.
> 
> NSTrackingArea is the standard approach for this, but for a table view might 
> be tricky, because you'd need one per row and with that many and the 
> likelihood of having to recompute them, might be a performance problem.
> 
> You can do it the manual way (but with rectOfRow:) if you enable mouseMoved 
> events for the table view's window, and override mouseMOved: in your table 
> subclass. Mouse moved events are not enabled by default because a) 
> performance and b) the HIG doesn't encourage mouseovers.
> 
> --Graham
> 
> 

___

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

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

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

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


Re: Does NSData rearrange the order of bits?

2009-12-01 Thread Jeremy Pereira

On 30 Nov 2009, at 20:32, Brad Gibbs wrote:

> Another list member mailed me an explanation offline, causing me to look for 
> and find the real problem preventing my code from running.

Any chance of posting the off list response back to the list?  It would improve 
the usefulness of the list archives (unless the person replied off list because 
the reply was off topic) to have a complete record of all the answers to your 
query.

__
This email has been scanned by the MessageLabs Email Security System.
For more information please visit http://www.messagelabs.com/email 
__
___

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: Hightlight on mouseover a NSTextFieldCell inside a TableView

2009-12-01 Thread Graham Cox

On 01/12/2009, at 9:06 PM, Gustavo Pizano wrote:

> Hello, I have been searching how to achieve this. 

OK, usual blather about mouseovers being untypical UI on the Mac that is not 
encouraged by the HIG.

> I have a NSTableView and the NSTableCells are a subclass I made.
> Now I want to change the backgorund color of the table row when mouse over.  
> In my SubClass of NSTextFieldCell I tried overriding these methods
> - (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
>   NSLog(@"tracking.. %@",[self stringValue]);
>   return YES;
> }
> 
> 
> - (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame 
> ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp{
>   NSLog(@"here");
>   return YES;
> }
> 
> 
> off course I see nothing of the logs.. it was just a tryout. .. now i dunno 
> how to make NSTextFieldCell respond to mouse events, i.e a mouse entered, 
> this for NSResponder class and subclasses, so  I was thinking in defining a 
> NSTrackingArea, but because of NSTextField don't accept mouseEntered method 
> then  I dunno.

Those methods are there to deal with mouse down tracking.

> I thought then maybe to subclass NSTableView, and do something with the point 
> f the mouse, and then get the row at point, form the NSTableView, but this 
> method returns me a integer,  so then I will multiply by the row height and 
> create a NSREct and draw a background in that rect, but I dunno if this is a 
> good approach.

Well, -rectOfRow: does all this for you, and presumably also deals with 
variable height rows.

NSTrackingArea is the standard approach for this, but for a table view might be 
tricky, because you'd need one per row and with that many and the likelihood of 
having to recompute them, might be a performance problem.

You can do it the manual way (but with rectOfRow:) if you enable mouseMoved 
events for the table view's window, and override mouseMOved: in your table 
subclass. Mouse moved events are not enabled by default because a) performance 
and b) the HIG doesn't encourage mouseovers.

--Graham


___

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

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

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

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


Re: NSString out of scope

2009-12-01 Thread Graham Cox

On 01/12/2009, at 7:39 PM, Pierre Berloquin wrote:

> How come an NSString or NSMutableString I declare in the view controler .h
> interface
> 
> NSMutableString *language;
> 
> 
> is "out of scope" even before I do anything with it in the .m implementation
> 
> 
> language = [[NSMutableString alloc] init];


Good game, but can you supply some surrounding context?

Is 'language' an ivar of a class or just sitting there as a global? Where is 
the alloc/init being called from? What is giving the error - the compiler? 
Debugger?

Or have I already used up my 20 questions?

--Graham


___

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

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

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

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


Re: copyWithZone - if anyone could explain this to me ?

2009-12-01 Thread Graham Cox

On 01/12/2009, at 6:06 PM, Clark Cox wrote:

> True, but history is a powerful force. This is also why the
> documentation on NSCopyObject states:
> 
> "This function is dangerous and very difficult to use correctly. It's
> use as part of copyWithZone: by any class that can be subclassed, is
> highly error prone. Under GC or when using Objective-C 2.0, the zone
> is completely ignored.
> 
> This function is likely to be deprecated after Mac OS X 10.6."


That's interesting. When I earlier stated I though this function was dangerous, 
I hadn't actually read that - I'd just arrived at that conclusion. Nice to know 
I occasionally get something right ;-)

--Graham


___

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

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

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

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


Hightlight on mouseover a NSTextFieldCell inside a TableView

2009-12-01 Thread Gustavo Pizano
Hello, I have been searching how to achieve this. 
I have a NSTableView and the NSTableCells are a subclass I made.
Now I want to change the backgorund color of the table row when mouse over.  In 
my SubClass of NSTextFieldCell I tried overriding these methods
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView{
NSLog(@"tracking.. %@",[self stringValue]);
return YES;
}


- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView:(NSView 
*)controlView untilMouseUp:(BOOL)untilMouseUp{
NSLog(@"here");
return YES;
}


off course I see nothing of the logs.. it was just a tryout. .. now i dunno how 
to make NSTextFieldCell respond to mouse events, i.e a mouse entered, this for 
NSResponder class and subclasses, so  I was thinking in defining a 
NSTrackingArea, but because of NSTextField don't accept mouseEntered method 
then  I dunno.

I thought then maybe to subclass NSTableView, and do something with the point f 
the mouse, and then get the row at point, form the NSTableView, but this method 
returns me a integer,  so then I will multiply by the row height and create a 
NSREct and draw a background in that rect, but I dunno if this is a good 
approach.

Any ideas?


Thanks


Gustavo

___

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 to subclass in NSArrayController to enable immediate editing of added rows?

2009-12-01 Thread Mike Abdullah

On 1 Dec 2009, at 03:57, David Hirsch wrote:

> I have read about this online, but I can't find a solution that (a) works and 
> (b) seems wise.
> I'm trying to have my table immediately enable editing of added items.  The 
> NSTableView is bound to an NSArrayController.  I've subclassed 
> NSArrayController, and tried this first:
> 
> - (void)add:(id)sender {
>   [super add:sender];
>   NSInteger numRows = [myTable numberOfRows];
>   NSIndexSet *indexes = [NSIndexSet indexSetWithIndex:numRows-1];
>   [myTable selectRowIndexes:indexes byExtendingSelection:NO];
>   [myTable editColumn:0 row:numRows-1 withEvent: nil select:YES];
> }

Read the documentation on -add: The result of the method is delayed until the 
next runloop, so no insert has yet been made at the point your custom code is 
called.

Easiest option is just to override -addObkect: instead.
> 
> Now, leaving aside the issues surrounding sorting of the arrays, and possibly 
> getting the WRONG item selected for editing, this fails because, as the docs 
> state, the results of the add: method are delayed until the next runloop.  So 
> a cell starts editing for an instant, but then as soon as the next runloop 
> occurs, the new cell really gets added, and then is not enabled for editing.
> 
> Here is what I tried next.  It works, but I don't like it, because it doesn't 
> call [super add], which seems like a bad idea - what if new functionality 
> gets put into that method in the future?
> - (void)add:(id)sender {
>   // Adapted from 
> http://stackoverflow.com/questions/844933/move-focus-to-newly-added-record-in-an-nstableview
>   //Try to end any editing that is taking place in the table view
>   NSWindow *w = [myTable window];
>   BOOL endEdit = [w makeFirstResponder:w];
>   if(!endEdit)
>   return;
> 
>   //Create a new object to add to your NSTableView; replace NSString with
>   //whatever type the objects in your array controller are
>   Room *new = [self newObject];
> 
>   //Add the object to your array controller
>   [self addObject:new];
>   [new release];
> 
>   //Rearrange the objects if there is a sort on any of the columns
>   [self rearrangeObjects];
> 
>   //Retrieve an array of the objects in your array controller and 
> calculate
>   //which row your new object is in
>   NSArray *array = [self arrangedObjects];
>   int row = [array indexOfObjectIdenticalTo:new];
> 
>   //Begin editing of the cell containing the new object
>   [myTable editColumn:0 row:row withEvent:nil select:YES];
> }
> 
> I've read methods of handling this (e.g., the link from which the above code 
> was adapted, 
> http://www.friday.com/bbum/2006/05/18/core-data-array-controller-edit-on-insert/)
>  that rely on actions in the document subclass, but I have to do this for a 
> number of different tables/controllers in my document and I'd like to 
> encapsulate the functionality in the NSArrayController subclass instead of 
> the document.
> 
> Should I be subclassing a different method that is not delayed?  addObject?  
> Is there a better strategy altogether?
> 
> Thanks,
> Dave
> 
> 
> 
> Dave Hirsch
> Associate Professor
> Department of Geology
> Western Washington University
> persistent email: dhir...@mac.com
> http://www.davehirsch.com
> voice: (360) 389-3583
> aim: dhir...@mac.com
> vCard: http://almandine.geol.wwu.edu/~dave/personal/DaveHirsch.vcf
> 
> 
> 
> 
> ___
> 
> 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


NSString out of scope

2009-12-01 Thread Pierre Berloquin
Hi

How come an NSString or NSMutableString I declare in the view controler .h
interface

NSMutableString *language;


is "out of scope" even before I do anything with it in the .m implementation


language = [[NSMutableString alloc] init];


Thanks


Pierre
___

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 draw text to bitmap (array) with pre 10.5 libs

2009-12-01 Thread John Horigan
>> 
>> Indeed, the initWithBitmapDataPlanes method treats the supplied buffer as 
>> immutable and creates its own internal copy.
> 
> This is not correct.  From the docs [1]:
> 
> "If planes is not NULL and the array contains at least one data pointer, the 
> returned object will only reference the image data; it will not copy it. The 
> object treats the image data in the buffers as immutable and will not attempt 
> to alter it. When the object itself is freed, it will not attempt to free the 
> buffers."
> 
> Because of this, it's generally easier to let NSBitmapImageRep create the 
> buffer for you, at least if you're going to be keeping it around.
> 
>> You must request the bitmap back from the NSBitmapImageRep using the 
>> bitmapData method. Prior to 10.6 the data backing up the NSBitmapImageRep 
>> was a bitmap plane but in 10.6 the cocoa team changed the backing data for 
>> NSBitmapImageRep to a CGImage. Either way, you should treat the data 
>> returned by bitmapData as read-only (in case you were thinking of modifying 
>> it). 
> 
> My understanding is that this only applies if you create the bitmap rep with 
> initWithCGImage: (which is an odd limitation to keep track of).  You can 
> still modify bitmap data from ordinary NSBitmapImageRep instances, but it 
> will be slow since NSBitmapImageRep has to recache.  Of course, this is just 
> my interpretation of the release notes [2] so I'd be interested in 
> information to the contrary.
> 

The docs may still say that the object references your bitmap without copying 
it, but my experience is that this is not true in 10.6. NSBitmapImageReps are 
backed by CGImages in 10.6 even if you create them with 
initWithBitmapDataPlanes. I don't know if the CGImage is created right away or 
lazily but I don't think that the statement that the reference bitmap is not 
copied is true in 10.6. If you draw into a NSBitmapImageRep then it must copy 
the reference bitmap as the docs promise that the reference bitmap will not be 
modified.

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