Intercepting user changes to table cells using bindings

2009-09-10 Thread BareFeet

Hi all,

I have a table view with columns bound to an NSArrayController. The  
user can edit the values that appear and it's all working fine.


I have a class called DataRow for each row in the table/controller.  
Each DataRow is essentially an NSMutableDictionary with a key for each  
column name. The column names (and therefore dictionary keys) are  
dynamically built according to imported data.


What is the best way to intercept user changes to cells in the table?  
I might want to just record the changes or allow/disallow them.


One way, I figure, is to use this method in my DataRow class:

- (void) setValue:(id)value forKeyPath:(NSString*)keyPath
{
NSLog(@DataRow setValue:forKeyPath:%@, keyPath);
return [super setValue:(id)value forKeyPath:(NSString*)keyPath];
}

This gives the keyPath as: dataRow.The Column Name of the Edited Cell

Is there a built in way to extract the column name (same at the  
dictionary key), or should I just parse out based on the delimiting  
. and hope there are no . in the name?


Or is there a better way altogether to intercept data entry changes?

Thanks,
Tom
BareFeet

___

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

Please do not post admin requests or moderator comments to the list.
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: NSArray EXEC_BAD_ACCESS when initalized with strings

2009-09-10 Thread Jeff Schilling

How are you determining which call fails?  Is there a back trace?

Your code compiles and runs fine here (10.6).

It will help if you provide some additional details, e.g. version,  
backtrace, some additional context around the failure.


On Sep 8, 2009, at 11:13 PM, Devraj Mukherjee wrote:


Hi all,

I have two arrays initalized as follows, the first works fine and I
can work with elements in the Array

NSArray *majorScaleQuestions = [[NSArray alloc] initWithObjects:@1,
@2, @b3, @3, @4, @5, @b6, @6, @7, nil];

the second throws up an EXEC_BAD_ACCESS and the application  
obviously stops


NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#,
@D, @D#, @E, @F, @F#, @G, @G#, @A, @A#, @B, nil];

if the same array is initalized as

NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#,
@D, nil];

the applications starts up, but if I add @D# and initalize it as  
follows


NSArray *newToneNotes = [[NSArray alloc] initWithObjects:@C, @C#,
@D, @D#, nil];

it fails. Can anyone see what I might be doing wrong?

Thanks.

--
The secret impresses no-one, the trick you use it for is everything
- Alfred Borden (The Prestiege)
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jeff.schilling%40gmail.com

This email sent to jeff.schill...@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: How to remove the Special Characters... menu item?

2009-09-10 Thread H David Goering

Graham,

Yes, that works.

Oh, I can run.  I'm just learning my way around a new set of tripping  
hazards.


Thanks,

David

On Sep 8, 2009, at 11:43 PM, Graham Cox wrote:


Look up NSUserDefaults in the documentation. That's where you need  
to add this setting.


I find it surprising that you are new to Xcode/Cocoa and yet the  
first thing you think you need to do is strip out this menu. Isn't  
this trying to run before you can walk?


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


Looking for Cocoa developer in NYC

2009-09-10 Thread Josh Distler

Hello.

We are in need of a talented developer for a very exciting project  
application development project in NYC.


A slightly more detailed description follows.

Please contact joshdist...@mac.com if interested.

Best.
/Josh



---
We are looking for a talented programmer to work closely with us on a  
challenging and exciting new kind of graphics application for the Mac  
platform.


Candidate should have at least a BA degree in computer science most  
preferably with math as a double major. He/She should have experience  
in programming user interfaces (Mac OS X Cocoa) and graphics or  
geometry, including knowledge in Open-GL and possibly GPU programming.  
Have knowledge in vision or graphics, for instance by taking courses  
such as computer-graphics, computer-vision, or image-processing. He/ 
She should demonstrate the ability to implement mathematical  
algorithms and concepts in C++, C# or Java.

___

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

Please do not post admin requests or moderator comments to the list.
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


NSImage - drawInRect SnowLeopard issue

2009-09-10 Thread tresa
Hello,
I seem to be running into an issue on Snow Leopard with NSImage.
Basically , I have a thumbnail kind of view , shown as a sheet , to
which I render the images read from the disk. The problem is that on
Snow Leopard the image shows up as blank whereas it renders fine on
Leopard and Tiger. My app is a Cocoa universal app running on an Intel
MacMini.The code goes like this ..

- (void)drawRect:(NSRect)rect {

[_timg drawInRect:imageRect fromRect:NSZeroRect
operation:NSCompositeSourceOver fraction:1.0f]; // _timg is an NSImage
/* Debug Code to see if the data in _timg is ok */
NSData* tiffData = [_timg TIFFRepresentation];
[tiffData writeToFile:[NSString stringWithFormat:@Debug.tiff]
atomically:NO];
}

What I have noticed :
- If I comment the drawInRect call... the debug code to write to a file
generates a properly rendered image on disk.This implies that the data is
not messed up due to any program issues
- If the call to drawInRect is included , the file rendered as well as the
rendered image on screen is white..so the source image seems to be getting
modified.
- Similar calls to drawInRect elsewhere in the app does not seem to have
this issue. The only noticeable difference seems to be that the code which
is not working is invoked as a sheet.
- Changing the operation arguments to NSCompositeCopy etc does not make
any difference.

Please let me know any workarounds or possible solutions for this problem.
Thanks in advance,
Tresa

___

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

Please do not post admin requests or moderator comments to the list.
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


Passing variables between .m files

2009-09-10 Thread Aaron Robinson
I have been struggling over this one for a while now, and what frustrates me
the most is the feeling that it should be relatively simple to do.

Let's say I have File1.m and File2.m, and I would like to access a variable
in File2.m from File1.

My previous programming experience is in Java, so my first impression was to
do this (in the File1 implementation file):

File2.outletVariable = varFile1;

I tried reorganizing it to fit Object C in this manner:

[File2.outletVariable setFloatValue:varFile1];

It would give me the error syntax error before . token, which I take to
mean it doesn't support identifying variables in this manner.

I have been through dozens of blogs, tutorials, and sample projects in the
hopes of finding one that did this kind of thing, but I so far I haven't
found blogs or tutorials that go over it, and the sample code that did have
something like it was too difficult for me to understand, since it usually
involved some other process that I wasn't familiar with.

Some of what I read lead me to believe that the answer possibly lies in
created another method and calling it from the other file.  I haven't been
able to get this to work for me either, however; the closest I got, it
wouldn't let me pass a float variable through it.  And it seemed like that
was more work than necessary to pass variables in this manner.

The reason I can't just put all the variables I want access to in the same
file is because I'm developing an Audio Unit with the Cocoa View, and using
Interface Builder, and the place I can get the variables are in a different
file than the outlets for my textfields and sliders.

I would really appreciate any suggestions.  Other than a few little things
like this, I have greatly enjoyed developing via Xcode and Interface
builder.

Best,

Aaron
___

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

Please do not post admin requests or moderator comments to the list.
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


Show/Hide file extension issue in savePanel

2009-09-10 Thread Paul Figgiani
Prior to installing Snow Leopard the following  code worked with no problem,
It runs a savePanel for exporting an rtf doc with the contents of a
textVIew. Under 10.6 it still works. However the option to show/hide the
output file extension stopped working. The savePanel checkbox toggles the
visibility of the file extension in the output file name textField. However
the output file displays the extension regardless of the state of the
checkbox.
Note: The NSSavePanel Class References states that setRequiredFileType has
been depreciated in 10.6 and should be replaced with setAllowedFileTypes. I
tried this with no luck. In fact it breaks exporting.

How can I edit my code to fix the show/hide file extension issue?

thanks.

-paul.


-(IBAction)exportRTF:(id)sender

{
 int index =[sender indexOfSelectedItem];
 if (index==1){

 NSSavePanel *panel = [NSSavePanel savePanel];
[panel setRequiredFileType:@rtf];
[panel setCanSelectHiddenExtension:YES];
[panel setTitle:NSLocalizedString(@Export RTF Document, @)];
[panel setNameFieldLabel:NSLocalizedString(@Save As:, @)];
  if ([panel runModal] == NSOKButton) {
 [[notes RTFFromRange:
NSMakeRange(0, [[mTextEditor string] length])]
 writeToFile:[panel filename] atomically:YES];
 }
 }
___

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

Please do not post admin requests or moderator comments to the list.
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: NSArray EXEC_BAD_ACCESS when initalized with strings

2009-09-10 Thread Dave Keck
If you enable the -Wformat warning, the compiler will warn you if you
omit the trailing nil. Never understood why it's not enabled by
default...
___

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

Please do not post admin requests or moderator comments to the list.
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


Table cell: how show blue when tapped only while editing is true?

2009-09-10 Thread Steve Fogel

Hi, all...

I've got a table view for which users must tap an Edit button before  
they can make changes. This button puts the table view in editing mode.


How can I make the cell show blue (it's selected) only while editing  
is true?


The scenario I want:

When editing = NO

1. User taps a cell (with default white background) and holds down  
finger. No reaction, no blue

2. User lifts finger, nothing happens.

When editing = YES

1. User taps cell and holds down finger. Cell turns blue.
2. User lifts finger. Cell goes white again and is processed by  
didSelectRowAtIndexPath. (didSelectRowAtIndexPath deselects cell, then  
processes.)


I have #2 under control in each case, but can't figure out how to do  
#1.  In cellForRowAtIndexPath, I tried setting selectionStyle to  
UITableViewCellSelectionStyleBlue if editing is true and to  
UITableViewCellSelectionStyleNone if editing is false, but, during the  
transition from not-editing to editing, unless I run reloadData, or  
slide the cell out of view and then back in again, the selection style  
change doesn't occur. I don't want to reload data when the user clicks  
Edit, because I have some animations going (I remove a section while  
editing), and reloadData fouls up the animation.


Any ideas?

Thx

Steve
___

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

Please do not post admin requests or moderator comments to the list.
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: Passing variables between .m files

2009-09-10 Thread Graham Cox

Hi Aaron,

You seem to be conflating several unrelated concepts here.

First, a file is not an object or class, and an object or class is not  
a file. A file is just a container for some text which can be  
compiled. A file might contain the definitions for several objects, or  
a single object might be spread across several files.


Taking your request at face value, accessing variables across files. A  
variable accessible from multiple files is a global variable, and  
globals are by and large to be discouraged, so unless you have very  
unusual needs, you don't want to do that.


However, I think what you're really asking is how one object can  
access the properties of another.


So, there's another conflation - variables are not properties and  
properties are not variables, though often properties might be  
implemented in terms of instance variables. For one object to get a  
property value from another, it simply messages it. To do that it  
needs a reference to the other object, and I believe this is the crux  
of your question - how to get a reference to another object.


Object references come from many, many different places, so there's no  
one answer. One way is, if both of your objects are instantiated in a  
nib, for them to declare IBOutlets to the other object, and for them  
to be connected in IB. Then in your code, you can reference the other  
object using the outlet.


I think one reason you didn't find anything on the topic (apart from  
searching for the wrong terms) is that messaging objects is so  
fundamental to the way OO programming works that it's likely to be  
taken for granted. Reviewing some of the very basic Cocoa concepts  
should help you out here.


--Graham



On 10/09/2009, at 7:09 AM, Aaron Robinson wrote:

I have been struggling over this one for a while now, and what  
frustrates me

the most is the feeling that it should be relatively simple to do.

Let's say I have File1.m and File2.m, and I would like to access a  
variable

in File2.m from File1.

My previous programming experience is in Java, so my first  
impression was to

do this (in the File1 implementation file):

File2.outletVariable = varFile1;

I tried reorganizing it to fit Object C in this manner:

[File2.outletVariable setFloatValue:varFile1];

It would give me the error syntax error before . token, which I  
take to

mean it doesn't support identifying variables in this manner.

I have been through dozens of blogs, tutorials, and sample projects  
in the
hopes of finding one that did this kind of thing, but I so far I  
haven't
found blogs or tutorials that go over it, and the sample code that  
did have
something like it was too difficult for me to understand, since it  
usually

involved some other process that I wasn't familiar with.

Some of what I read lead me to believe that the answer possibly lies  
in
created another method and calling it from the other file.  I  
haven't been

able to get this to work for me either, however; the closest I got, it
wouldn't let me pass a float variable through it.  And it seemed  
like that

was more work than necessary to pass variables in this manner.

The reason I can't just put all the variables I want access to in  
the same
file is because I'm developing an Audio Unit with the Cocoa View,  
and using
Interface Builder, and the place I can get the variables are in a  
different

file than the outlets for my textfields and sliders.

I would really appreciate any suggestions.  Other than a few little  
things

like this, I have greatly enjoyed developing via Xcode and Interface
builder.


___

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

Please do not post admin requests or moderator comments to the list.
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: NSImage - drawInRect SnowLeopard issue

2009-09-10 Thread Ken Ferry
Hi Tresa,
This isn't enough information to tell what might be going wrong.

Please file a bug, and give steps to reproduce in your app.  (Or a
reduction, but it sounds like you don't know how to make a reduction here.)

I'm not aware of any problem that would cause this.

You might try replacing your image drawing with NSRectFill of a color to
make sure the drawing is targeted where you think it is.

-ken

On Wed, Sep 9, 2009 at 10:51 AM, tr...@atheeva.com wrote:

 Hello,
I seem to be running into an issue on Snow Leopard with NSImage.
 Basically , I have a thumbnail kind of view , shown as a sheet , to
 which I render the images read from the disk. The problem is that on
 Snow Leopard the image shows up as blank whereas it renders fine on
 Leopard and Tiger. My app is a Cocoa universal app running on an Intel
 MacMini.The code goes like this ..

 - (void)drawRect:(NSRect)rect {

[_timg drawInRect:imageRect fromRect:NSZeroRect
 operation:NSCompositeSourceOver fraction:1.0f]; // _timg is an NSImage
/* Debug Code to see if the data in _timg is ok */
NSData* tiffData = [_timg TIFFRepresentation];
[tiffData writeToFile:[NSString stringWithFormat:@Debug.tiff]
 atomically:NO];
 }

 What I have noticed :
 - If I comment the drawInRect call... the debug code to write to a file
 generates a properly rendered image on disk.This implies that the data is
 not messed up due to any program issues
 - If the call to drawInRect is included , the file rendered as well as the
 rendered image on screen is white..so the source image seems to be getting
 modified.
 - Similar calls to drawInRect elsewhere in the app does not seem to have
 this issue. The only noticeable difference seems to be that the code which
 is not working is invoked as a sheet.
 - Changing the operation arguments to NSCompositeCopy etc does not make
 any difference.

 Please let me know any workarounds or possible solutions for this problem.
 Thanks in advance,
 Tresa

 ___

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

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

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

 This email sent to kenfe...@gmail.com

___

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

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

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

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


XC IB 3.2 overlapping siblings

2009-09-10 Thread Steve Cronin

Folks;

I know I'm late to the game here but I just took my app for a compile  
under XC3.2 for the first time…


A few NSString encoding loose ends OK  but WHAMO my .xib files are  
hammered with ~100 errors (not warnings!)


.. This view overlaps one of its siblings. Overlapping sibling views  
are not supported on Mac OS X versions prior to 10.5. …


My base SDK is set to 10.6 and a deployment of 10.4.
Everything was peachy under 10.5 and XC3.1 no such warnings or errors.

Sooo does this mean I cannot use XC3.2 unless I fix all these issues?

Some are buttons that lie on top of each other and are hidden or shown  
based on data.

How does one avoid the overlapping error in this circumstance?
Is there a compiler setting that might be helpful here?

This is certainly not what I expected….

Thanks for all input!
Steve

___

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

Please do not post admin requests or moderator comments to the list.
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


QTMovie and audio stream

2009-09-10 Thread Massimiliano Gargani


Hi all,

I'm developing a little music player. It works fine with file but it  
doesn't work with audio streaming.


my code is:

	NSURL* theFilePath = [[NSURL alloc] initWithString:[[theTable  
objectAtIndex:sx] objectForKey:@Location]];

NSLog(@the file path %@, theFilePath);
movie = [[QTMovie movieWithURL:theFilePath error:qtError] retain];

as you can see from log below it wants to open the stream as a file:

2009-09-10 10:47:04.221 Primafila[511:10b] the file path 
http://cast.voxcdn.net:8000/2917-MP3-RadioIO-Smooth-Jazz-128
2009-09-10 10:47:04.284 Primafila[511:10b] Can not open file 
:http://cast.voxcdn.net:8000/2917-MP3-RadioIO-Smooth-Jazz-128
2009-09-10 10:47:04.285 Primafila[511:10b] Could not open file handle  
for file:http://cast.voxcdn.net:8000/2917-MP3-RadioIO-Smooth-Jazz-128

2009-09-10 10:47:04.286 Primafila[511:10b] Can not open file 
:http://cast.voxcdn.net:8000/2917-MP3-RadioIO-Smooth-Jazz-128

How can I make it works?

Thanks for help.

Max



___

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

Please do not post admin requests or moderator comments to the list.
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 can we draw a horizontal line with embossing effect?

2009-09-10 Thread Arun
Hi All
How can we draw a horizontal line with embossing effect?  The attached
picture describes more clearly.

Thanks
Arun KA
attachment: Picture 2.png___

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

Please do not post admin requests or moderator comments to the list.
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 can we draw a horizontal line with embossing effect?

2009-09-10 Thread Graham Cox


On 10/09/2009, at 7:15 PM, Arun wrote:


How can we draw a horizontal line with embossing effect?  The attached
picture describes more clearly.



Why not try zooming in on that image and see how it's drawn. It's  
trivially easy.


--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: Passing variables between .m files

2009-09-10 Thread BareFeet

Hi Aaron,

I have been struggling over this one for a while now, and what  
frustrates me

the most is the feeling that it should be relatively simple to do.

Let's say I have File1.m and File2.m, and I would like to access a  
variable

in File2.m from File1.

My previous programming experience is in Java, so my first  
impression was to

do this (in the File1 implementation file):

File2.outletVariable = varFile1;


I asked a similar question a few days ago, and was helped out by the  
same Graham who answered you. I feel your pain and confusion.


The answer is pretty simple, assuming we're talking about the same  
thing.


I'm assuming you have two classes, depicted in your File1.m and  
File2.m files, and you have an object of each class in your nib file.  
You need to add an outlet in File1.h that you can link to the File2  
object, like this:


// File1.h

@class File2;

@interface File1 : NSObject
{
IBOutlet File2* linkToFile2;
}

Once that is saved in XCode, switch over to Interface Builder, control- 
drag from your File1 object to your File2 object. The popup menu  
should show linkToFile2, select it.


Now you can call any method in File2 from File1. If you want to access  
an instance variable in the File2 object, such as (NSString*)  
myVariable, then you will need to create an accessor method for it in  
File2, such as:


- (NSString*) myVariable
{
return myVariable;
}

Then you can refer to it from File1 via:

[linkToFile2 myVariable];

Hope this helps you as much as Graham helped me. If not, flip back to  
his answers to my question about a week ago.


Tom
BareFeet

___

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

Please do not post admin requests or moderator comments to the list.
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


[iPhone] How to sense the duration of touch on iPhone button.

2009-09-10 Thread Dan Ribe
Hi All,



I am trying to implement a phone pad for my application. For key with title
'0' I want the same behavior as the iPhone phone application :


1. If user touches, it should immediately display a 0.

2. If user holds down the button for some time, it should display a '+' (I
mean 0 should be replaced with a '+').



Can anyone help me with the second part of this? What kind of handling is
required for this. I mean how i can find out that user is holding that
button for sometime ?



Thanks for help !
___

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

Please do not post admin requests or moderator comments to the list.
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: [iPhone] How to sense the duration of touch on iPhone button.

2009-09-10 Thread Roland King
start a timer when the button goes down and queue it. If it fires  
before the button goes up, you have your '+', if the finger goes up  
first, cancel the timer.


On 10-Sep-2009, at 8:35 PM, Dan Ribe wrote:


Hi All,



I am trying to implement a phone pad for my application. For key  
with title

'0' I want the same behavior as the iPhone phone application :


1. If user touches, it should immediately display a 0.

2. If user holds down the button for some time, it should display a  
'+' (I

mean 0 should be replaced with a '+').



Can anyone help me with the second part of this? What kind of  
handling is

required for this. I mean how i can find out that user is holding that
button for sometime ?



Thanks for help !
___

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

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

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

This email sent to r...@rols.org


___

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

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

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

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


Custom NSActionCell subclass + table column binding

2009-09-10 Thread Stamenkovic Florijan

Hi all,

I've made an NSActionCell subclass for indicating the priority of an  
object, similar to the rating column in iTunes. The visual aspects of  
it are working fine, as well as displaying the correct priority for  
table rows that have a priority value set.


The problem is setting the new priority when the user clicks on the  
column. I've tried two approaches:


1) Setting the target of the cell to self, and in the action message  
set the objectValue of the cell to the desired priority (which I have  
no problem determining from the location of the mouse click). Somehow  
that does not affect the bound NSManagedObject at all.


2) Using the mouse tracking approach that I copied from:
http://code.google.com/p/fskit/source/browse/trunk/FSKit/Sample%20Apps/FSSearchDemo/SFHFRatingCell.m?r=37

This didn't work either (it also sets the objectValue of the cell)...

I guess I am missing something fairly obvious, but I've been searching  
through the docs for it, and I can't find it. Any help would be  
greatly appreciated...


In IB I bound the table column to the arrangedObjects.priority of the  
array controller of the table. I have a coordinating controller that  
initializes and sets the custom cell on the column in it's awakeFromNib.


Reading the binding reference for NSTableColumn seems to indicate to  
me that the cell's objectValue is what gets bound to the managed  
object's property, so it seems what I am doing should just work, and  
it just does not.


TIA,
F


___

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

Please do not post admin requests or moderator comments to the list.
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: Custom NSActionCell subclass + table column binding

2009-09-10 Thread BareFeet

Hi Florijan,

I've made an NSActionCell subclass for indicating the priority of an  
object, similar to the rating column in iTunes. The visual aspects  
of it are working fine, as well as displaying the correct priority  
for table rows that have a priority value set.


The problem is setting the new priority when the user clicks on the  
column. I've tried two approaches:


1) Setting the target of the cell to self, and in the action message  
set the objectValue of the cell to the desired priority (which I  
have no problem determining from the location of the mouse click).  
Somehow that does not affect the bound NSManagedObject at all.


If I understand you correctly, you have bound your table column to an  
array controller, and are trying to change the data by changing the  
table column. As far as I understand bindings (which isn't much), you  
aren't supposed to (because it won't work) change the data by  
programmatically adjusting the view (ie the table column cell).


You should instead direct any programmatic changes to the data itself,  
through the controller in a key-value compliant way. Then the view  
will automatically reflect those changes.


I hope this helps. If ou need more detail, I'll try to follow up.

Tom
BareFeet

___

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

Please do not post admin requests or moderator comments to the list.
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


Scrolling NSScrollView by fractional amounts - why would values get rounded?

2009-09-10 Thread Martin Redington
I've got two NSScrollView's in separate windows, that I'm trying to
scroll programmatically in synchrony.

I'm calling

[[scrollView contentView] scrollToPoint:theNewPoint];

This works fine when the new y value is a whole integer, but I'm
seeing some strange behaviour when trying to scroll by fractional
amount (e.g. .25 or .5 of a pixel).

In one window, the fractional pixel values are respected. If I scroll
the origin from 50.0 to 50.25, its 50.25 when I come to scroll again.

However, in the other window, values seem to get rounded. e.g. If I
scroll from 50.0 to 50.25, the y origin is still 50.0 when I come
round to scroll again. If I scroll from 50.0 to 50.5, then the y
origin actually moves to 51.0

There are a few minor differences in how I'm setting up the windows
(one is extracted fully set up from a nib, while the other has a
manually created NSTextView added to it after it's unarchived), but
inspection of the view hierarchy shows no obvious differences between
the two setups.

Hopefully this is something dumb that I've just overlooked, but if
anyone can point me in the right direction, that would be great ...

   cheers,
Martin


-- 
http://www.mildmanneredindustries.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: Show/Hide file extension issue in savePanel

2009-09-10 Thread Sean McBride
On 9/9/09 5:40 PM, Paul Figgiani said:

Prior to installing Snow Leopard the following  code worked with no problem,
It runs a savePanel for exporting an rtf doc with the contents of a
textVIew. Under 10.6 it still works. However the option to show/hide the
output file extension stopped working. The savePanel checkbox toggles the
visibility of the file extension in the output file name textField. However
the output file displays the extension regardless of the state of the
checkbox.

Have you read the AppKit Release Notes?

http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKit.html

It says:

The save panel now respects the Finder option for Show all file
extensions. If it is set, then the Hide Extension checkbox will be
hidden and the extension will always be shown by always returning YES
from -isExtensionHidden

Perhaps that's what you're experiencing?

[panel setCanSelectHiddenExtension:YES];

The docs for this method should obviously be updated.  Alas, this never
seems to happen.  Even stuff from the 10.5 Release Notes are not in the
real docs (yet?).

--

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


CGWindowListCreateImage fails on Snow Leopard with kCGNullWindowID

2009-09-10 Thread Jason Foreman


I am attempting to use the CGWindowListCreateImage function to capture  
a desktop screenshot.  The following code (taken straight from the  
SonOfGrab sample) works on Leopard, but is failing on Snow Leopard:


CGImageRef screenShot = CGWindowListCreateImage(CGRectInfinite,  
kCGWindowListOptionOnScreenOnly, kCGNullWindowID,  
kCGWindowImageDefault);


On Leopard, the returned CGImageRef is what I expect: an image of the  
desktop and all on-screen windows.


On Snow Leopard, the CGImageRef is NULL and the following message is  
printed to the console:


Error: CGImageCreate: invalid image bits/pixel or bytes/row.


I have filed a bug (7212104), but wonder if there is a workaround that  
I can use in the meantime, or if I should just use another method of  
capturing the desktop.  Has anyone else encountered this issue?



Thanks,

Jason



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

[SOLVED] Re: Custom NSActionCell subclass + table column binding

2009-09-10 Thread Stamenkovic Florijan


On Sep 10, 2009, at 09:40, BareFeet wrote:


Hi Florijan,

I've made an NSActionCell subclass for indicating the priority of  
an object, similar to the rating column in iTunes. The visual  
aspects of it are working fine, as well as displaying the correct  
priority for table rows that have a priority value set.


The problem is setting the new priority when the user clicks on the  
column. I've tried two approaches:


1) Setting the target of the cell to self, and in the action  
message set the objectValue of the cell to the desired priority  
(which I have no problem determining from the location of the mouse  
click). Somehow that does not affect the bound NSManagedObject at  
all.


If I understand you correctly, you have bound your table column to  
an array controller, and are trying to change the data by changing  
the table column. As far as I understand bindings (which isn't  
much), you aren't supposed to (because it won't work) change the  
data by programmatically adjusting the view (ie the table column  
cell).


This makes sense, though it is unfortunate. I was hoping to somehow be  
able to do it this way so that virtually all of the logic would be  
encapsulated in my cell class, without the need for it to know much  
about objects outside of it.


I suppose the other example that I found of this type of a table  
column cell was not used with bindings, and consequently this approach  
worked...


You should instead direct any programmatic changes to the data  
itself, through the controller in a key-value compliant way. Then  
the view will automatically reflect those changes.


I hope this helps. If ou need more detail, I'll try to follow up.


I am able to do this. I am not sure it is flawless, but it works as  
far as I have tested it. I am not too happy about it as it scatters  
the logic a bit, but it works.


Thanks for your help,
F
___

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

Please do not post admin requests or moderator comments to the list.
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 can we draw a horizontal line with embossing effect?

2009-09-10 Thread Steven Degutis
Arun,
It's just two lines drawn on top of one another, with the top one darker
than the background and the bottom one lighter. I use it in my Preference
panels all the time.

-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/

On Thu, Sep 10, 2009 at 4:15 AM, Arun arun...@gmail.com wrote:

 Hi All
 How can we draw a horizontal line with embossing effect?  The attached
 picture describes more clearly.

 Thanks
 Arun KA

 ___

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

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

 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com

 This email sent to steven.degu...@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


UIImagePickerController problem

2009-09-10 Thread Development
I'm working on an app that is in landscapeleft mode most of the time.  
I need to be able to pick an image but even after subclassing the  
imagepickercontroller and returning yes for the -(BOOL) 
shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) 
toInterfaceOrientation
when the orientation is landscape the imagePicker is displayed in  
portrait.
I have attempted to maunally rotate the view but I get unpredictable  
image selection results. This is my rotation code:


-(void)rotateView:(UIView*)theView
{
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];

[UIView beginAnimations:@View Flip context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
if (self.interfaceOrientation == UIInterfaceOrientationLandscapeLeft) {
theView.transform = CGAffineTransformIdentity;
theView.transform = CGAffineTransformMakeRotation 
(degreesToRadian(270));

theView.bounds = CGRectMake(0.0, 0.0, 480, 320);
}

theView.center = CGPointMake(160.0f, 240.0f);
[UIView commitAnimations];
}
___

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

Please do not post admin requests or moderator comments to the list.
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: XC IB 3.2 overlapping siblings

2009-09-10 Thread Nick Zitzmann


On Sep 10, 2009, at 2:51 AM, Steve Cronin wrote:


My base SDK is set to 10.6 and a deployment of 10.4.
Everything was peachy under 10.5 and XC3.1 no such warnings or errors.

Sooo does this mean I cannot use XC3.2 unless I fix all these issues?


Nib deployment targets are actually set in the nibs, not the project.  
If you still want to target Tiger, you should fix the errors, since  
overlapping views are hit-and-miss on Tiger. Alternately, if you want  
to switch to targeting Leopard, then you can do it by clicking on the  
info toolbar button in IB and switching the deployment target there.


Nick Zitzmann
http://www.chronosnet.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: Table cell: how show blue when tapped only while editing is true?

2009-09-10 Thread Luke the Hiesterman
When you want nothing to happen, cell.selectionStyle =  
UITableViewCellSelectionStyleNone;


When you want blue, cell.selectionStyle =  
UITableViewCellSelectionStyleBlue;


Luke


On Sep 9, 2009, at 11:42 PM, Steve Fogel wrote:


Hi, all...

I've got a table view for which users must tap an Edit button before  
they can make changes. This button puts the table view in editing  
mode.


How can I make the cell show blue (it's selected) only while editing  
is true?


The scenario I want:

When editing = NO

1. User taps a cell (with default white background) and holds down  
finger. No reaction, no blue

2. User lifts finger, nothing happens.

When editing = YES

1. User taps cell and holds down finger. Cell turns blue.
2. User lifts finger. Cell goes white again and is processed by  
didSelectRowAtIndexPath. (didSelectRowAtIndexPath deselects cell,  
then processes.)


I have #2 under control in each case, but can't figure out how to do  
#1.  In cellForRowAtIndexPath, I tried setting selectionStyle to  
UITableViewCellSelectionStyleBlue if editing is true and to  
UITableViewCellSelectionStyleNone if editing is false, but, during  
the transition from not-editing to editing, unless I run reloadData,  
or slide the cell out of view and then back in again, the selection  
style change doesn't occur. I don't want to reload data when the  
user clicks Edit, because I have some animations going (I remove a  
section while editing), and reloadData fouls up the animation.


Any ideas?

Thx

Steve
___

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

Please do not post admin requests or moderator comments to the list.
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


Adding an observer is memory expensive

2009-09-10 Thread Torsten Radtke

Hi,

I observed excessive memory usage (working in a garbage-collected  
environment under 10.6) if I add an observer to a KVO-compliant  
object. So if I add an observer to say 10 objects, Instruments  
shows that 10 2KB blocks of memory are allocated (additionaly  
there are another 10 48B blocks and 20 32B blocks). The stack  
trace for the 2KB blocks looks like this:


[NSObject(NSKeyValueObserverRegistration)  
addObserver:forKeyPath:options:context:]
[NSObject(NSKeyValueObserverRegistration)  
_addObserver:forProperty:options:context:]

NSKeyValueReplaceObservationInfoForObject
Auto::Zone::set_associative_ref(void*, void*, void*)
std::vector__gnu_cxx::_Hashtable_nodestd::pairvoid* const, void*  
*, Auto::AuxAllocator__gnu_cxx::_Hashtable_nodestd::pairvoid*  
const, void* * ::reserve(unsigned long)


If I overwrite the observationInfo and setObservationInfo: methods and  
add an instance variable to the observed object, everything is fine. I  
filed this under rdar://7212101, but would like to know the opinion of  
this list, too.


Additionaly, if I remove the observer only 10 32B blocks are  
released and collected. This also does not seem right to me.


Thanks,
Torsten
___

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

Please do not post admin requests or moderator comments to the list.
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: UIImagePickerController problem

2009-09-10 Thread Luke the Hiesterman
You're better off filing a feature request for a landscape image  
picker. Honestly, though, I don't see landscape as an orientation that  
makes sense for picking images on the phone.


Luke

On Sep 10, 2009, at 8:10 AM, Development wrote:

I'm working on an app that is in landscapeleft mode most of the  
time. I need to be able to pick an image but even after subclassing  
the imagepickercontroller and returning yes for the -(BOOL) 
shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) 
toInterfaceOrientation
when the orientation is landscape the imagePicker is displayed in  
portrait.
I have attempted to maunally rotate the view but I get unpredictable  
image selection results. This is my rotation code:


-(void)rotateView:(UIView*)theView
{
	[[UIApplication sharedApplication] setStatusBarHidden:NO  
animated:NO];


[UIView beginAnimations:@View Flip context:nil];
[UIView setAnimationDuration:.5];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];

	[[UIApplication sharedApplication] setStatusBarHidden:NO  
animated:NO];
	if (self.interfaceOrientation ==  
UIInterfaceOrientationLandscapeLeft) {

theView.transform = CGAffineTransformIdentity;
   theView.transform = CGAffineTransformMakeRotation 
(degreesToRadian(270));

theView.bounds = CGRectMake(0.0, 0.0, 480, 320);
}

theView.center = CGPointMake(160.0f, 240.0f);
[UIView commitAnimations];
}
___

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

Please do not post admin requests or moderator comments to the list.
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: IKSlideshow reloadData should reload, yes?

2009-09-10 Thread Adam Knight
Is there a better forum to ask this question?  I filed a bug report  
months ago and have heard nothing on that, either (as usual, which is  
rather depressing overall).


On Aug 31, 2009, at 4:50 PM, Adam Knight wrote:

I'm using IKSlideshow to display images that I'm fetching from a  
server in the background.  There is a thumbnail and a full-size  
version of each image.  When IKSlideshow asks for an item at an  
index, if the full-size image is there, I give it the path to that  
cache file.  If it is not there, I give it the path to the thumbnail  
and then initiate the download for the FS version.


That latter part is tricky here because I get a notification that  
the download is complete and then I call -reloadData and/or - 
reloadSlideshowItemAtIndex on the IKSlideshow object and ... nothing  
happens.  In 10.5, I get -numberOfSlideshowItems called again on the  
data source, and in 10.6 absolutely nothing is called on my data  
source.


So ... what is it reloading?

More to the point: how can I get it to reload the image?  Or any way  
of changing the image after it's been displayed?


Regression: in 10.5, I could go next/prev and then the larger image  
would display as it called -slideshowItemAtIndex again.  In 10.6  
it's caching that so I have to rely on the reload methods that don't  
appear to work...


Help?


___

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

Please do not post admin requests or moderator comments to the list.
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: Scripting Bridge link error

2009-09-10 Thread Randall Meadows

On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote:

You don't actually instantiate ScriptingBridge objects directly like  
that.  The interface header is generated so you can get type  
checking when you call methods, but the actual class is acquired  
dynamically at runtime.  See the documentation for - 
classForScriptingClass: in SBApplication.  You'll need to do  
something more like:


AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp  
classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new];


DOH!  Totally missed the line Do not use a class name in the sdp- 
generated header file as the receiver of the alloc method.  I'm sure  
that wasn't there the first time I read the docs! ;)


Thanks, Jason.
___

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

Please do not post admin requests or moderator comments to the list.
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: XC IB 3.2 overlapping siblings

2009-09-10 Thread Steve Cronin

Nick;

Hey thanks for the reply!
Yes, I'm aware of the IB target setting.

If you still want to target Tiger this is a BIG surprise that these  
are now treated as errors.


The really big question for me is how do you deal with 2 buttons that  
lie one on top of the other but are never drawn at the same time  
(setHidden)
Do you have to re-jigger everything because IB can't fathom that they  
might not be visible at the same time?
Could you comment on this please - this is a potential real quagmire  
for me…


Steve


On Sep 10, 2009, at 10:15 AM, Nick Zitzmann wrote:



On Sep 10, 2009, at 2:51 AM, Steve Cronin wrote:


My base SDK is set to 10.6 and a deployment of 10.4.
Everything was peachy under 10.5 and XC3.1 no such warnings or  
errors.


Sooo does this mean I cannot use XC3.2 unless I fix all these issues?


Nib deployment targets are actually set in the nibs, not the  
project. If you still want to target Tiger, you should fix the  
errors, since overlapping views are hit-and-miss on Tiger.  
Alternately, if you want to switch to targeting Leopard, then you  
can do it by clicking on the info toolbar button in IB and switching  
the deployment target there.


Nick Zitzmann
http://www.chronosnet.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 can we draw a horizontal line with embossing effect?

2009-09-10 Thread Joar Wingfors


On 10 sep 2009, at 02.15, Arun wrote:


How can we draw a horizontal line with embossing effect?  The attached
picture describes more clearly.



I'd probably use NSShadow.

j o a r


___

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

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

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

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


Re: XC IB 3.2 overlapping siblings

2009-09-10 Thread Nick Zitzmann


On Sep 10, 2009, at 9:39 AM, Steve Cronin wrote:

Do you have to re-jigger everything because IB can't fathom that  
they might not be visible at the same time?


Probably. Can you combine those buttons and then change them as you  
go? That would also conserve memory, disk space,  loading times. Or  
can you move them and then set their frames in code?


Nick Zitzmann
http://www.chronosnet.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: NSImage - drawInRect SnowLeopard issue

2009-09-10 Thread tresa
Hi Ken,

The targeted rectangle area is correct so I don't think it is an issue
with that.I have filed Bug ID# 7212266 and am trying to build a sample to
show the issue.

Thanks for your response,
Tresa

 Hi Tresa,
 This isn't enough information to tell what might be going wrong.

 Please file a bug, and give steps to reproduce in your app.  (Or a
 reduction, but it sounds like you don't know how to make a reduction
 here.)

 I'm not aware of any problem that would cause this.

 You might try replacing your image drawing with NSRectFill of a color to
 make sure the drawing is targeted where you think it is.

 -ken

 On Wed, Sep 9, 2009 at 10:51 AM, tr...@atheeva.com wrote:

 Hello,
I seem to be running into an issue on Snow Leopard with NSImage.
 Basically , I have a thumbnail kind of view , shown as a sheet , to
 which I render the images read from the disk. The problem is that on
 Snow Leopard the image shows up as blank whereas it renders fine on
 Leopard and Tiger. My app is a Cocoa universal app running on an Intel
 MacMini.The code goes like this ..

 - (void)drawRect:(NSRect)rect {

[_timg drawInRect:imageRect fromRect:NSZeroRect
 operation:NSCompositeSourceOver fraction:1.0f]; // _timg is an NSImage
/* Debug Code to see if the data in _timg is ok */
NSData* tiffData = [_timg TIFFRepresentation];
[tiffData writeToFile:[NSString stringWithFormat:@Debug.tiff]
 atomically:NO];
 }

 What I have noticed :
 - If I comment the drawInRect call... the debug code to write to a file
 generates a properly rendered image on disk.This implies that the data
 is
 not messed up due to any program issues
 - If the call to drawInRect is included , the file rendered as well as
 the
 rendered image on screen is white..so the source image seems to be
 getting
 modified.
 - Similar calls to drawInRect elsewhere in the app does not seem to have
 this issue. The only noticeable difference seems to be that the code
 which
 is not working is invoked as a sheet.
 - Changing the operation arguments to NSCompositeCopy etc does not
 make
 any difference.

 Please let me know any workarounds or possible solutions for this
 problem.
 Thanks in advance,
 Tresa

 ___

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

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

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

 This email sent to kenfe...@gmail.com




___

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

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

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

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


NSServiceCategory

2009-09-10 Thread Nick Zitzmann
I have a service that can apply to multiple categories due to the  
pasteboard types it accepts. In Snow Leopard, for some reason, the  
service always shows up under the Pictures category even though it  
also accepts text. I want it to show up in the General category.


I'm aware of an apparently undocumented NSRequiredContext key called  
NSServiceCategory that manually sets the service category in the  
Keyboard preference pane, which is useful when the pane does not  
correctly categorize the service, which I'm guessing it does based on  
the name and pasteboard type. I know that you can use a UTI here to  
set the category, but what's the UTI for the general category? I  
tried searching for NSServiceCategory and found nothing, and searching  
for UTIs gives me results for a different meaning of UTI...


Nick Zitzmann
http://www.chronosnet.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: CGWindowListCreateImage fails on Snow Leopard with kCGNullWindowID

2009-09-10 Thread David Duncan

On Sep 10, 2009, at 7:32 AM, Jason Foreman wrote:

I am attempting to use the CGWindowListCreateImage function to  
capture a desktop screenshot.  The following code (taken straight  
from the SonOfGrab sample) works on Leopard, but is failing on Snow  
Leopard:


CGImageRef screenShot = CGWindowListCreateImage(CGRectInfinite,  
kCGWindowListOptionOnScreenOnly, kCGNullWindowID,  
kCGWindowImageDefault);


On Leopard, the returned CGImageRef is what I expect: an image of  
the desktop and all on-screen windows.


On Snow Leopard, the CGImageRef is NULL and the following message is  
printed to the console:


Error: CGImageCreate: invalid image bits/pixel or bytes/row.

I have filed a bug (7212104), but wonder if there is a workaround  
that I can use in the meantime, or if I should just use another  
method of capturing the desktop.  Has anyone else encountered this  
issue?



Your bug will end up dup'd to rdar://problem/7022171. The basic  
problem is using CGRectInfinite from a 32-bit process when the Window  
Server is running as a 64-bit process – when the rect comes out at the  
other end it is no longer interpreted as infinite but rather as  
very very large. Since you can't create an image that large, the  
creation code fails and you get back a NULL CGImageRef instead.


The current best work around is to determine a proper bounding box for  
the desktop and pass it for the given rect.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: UIImagePickerController problem

2009-09-10 Thread David Duncan
To add to Luke's comment, changing the supported orientations as  
reported by -shouldAutorotateToInterfaceOrientation: is not enough to  
actually provide support for different orientations. Doing this to the  
view controllers that we provide is generally not going to do what you  
want (as you've already discovered).


On Sep 10, 2009, at 8:32 AM, Luke the Hiesterman wrote:

You're better off filing a feature request for a landscape image  
picker. Honestly, though, I don't see landscape as an orientation  
that makes sense for picking images on the phone.


On Sep 10, 2009, at 8:10 AM, Development wrote:

I'm working on an app that is in landscapeleft mode most of the  
time. I need to be able to pick an image but even after subclassing  
the imagepickercontroller and returning yes for the -(BOOL) 
shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation) 
toInterfaceOrientation
when the orientation is landscape the imagePicker is displayed in  
portrait.
I have attempted to maunally rotate the view but I get  
unpredictable image selection results. This is my rotation code:


--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: NSArray EXEC_BAD_ACCESS when initalized with strings

2009-09-10 Thread Jens Alfke


On Sep 9, 2009, at 11:39 PM, Dave Keck wrote:


If you enable the -Wformat warning, the compiler will warn you if you
omit the trailing nil. Never understood why it's not enabled by
default...


The first thing I do in a new Xcode project is, in the project build  
settings, add -Wall to other warning flags. This turns on pretty  
much all warnings. (I don't know why there isn't a checkbox for this.)  
I also turn on Treat warnings as errors to make sure none of them  
slip by — this is pretty essential for Obj-C development, as some very  
common coding mistakes (like misspelling a message name) are reported  
as warnings instead of errors.


—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: QTMovie and audio stream

2009-09-10 Thread Jens Alfke


On Sep 10, 2009, at 1:54 AM, Massimiliano Gargani wrote:

I'm developing a little music player. It works fine with file but it  
doesn't work with audio streaming.

as you can see from log below it wants to open the stream as a file:

2009-09-10 10:47:04.221 Primafila[511:10b] the file path 
http://cast.voxcdn.net:8000/2917-MP3-RadioIO-Smooth-Jazz-128


There are a lot of APIs in the system that take a URL but only accept  
file: URLs. Basically it was decided that URLs are a good abstraction  
for passing filesystem paths. So if you see a URL as a parameter,  
don't immediately assume that it supports http: (or ftp: or ssh: or  
whatever) without reading the docs.


So I don't believe QTMovie directly supports loading movies over HTTP,  
much less Shoutcast-style MP3 streaming. IIRC you can open a movie  
view directly on a URL, and that supports fetching the contents over  
HTTP. I've used that to play remote .mp3 files, but I suspect it won't  
work for Shoutcast streams. For those you may need to roll your own  
implementation using CoreAudio APIs.


(Is there a QuickTime developer mailing list? If so, you should ask  
there, in case my QTKit knowledge is out of date.)


—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: XC IB 3.2 overlapping siblings

2009-09-10 Thread Erik Buck
Don't overlap sibling views.  Even though it works reliably now, it is still a 
poor practice for controls and has a definite user interface smell.

If you must use the same area of the user interface for different purposes at 
different times, consider using a tab view with no visible tabs and 
programmatically changing which  subview of the tabview is visible.

However, you should reconsider your user interface design.  When the user 
interface changes based on application mode and buttons appear, disappear, 
change size or title, etc., users are confused.  Such interfaces are not 
discoverable.  How is a user supposed to know that a different button will 
appear in some circumstances?  How does the user know what options are 
sometimes available but aren't available now?  Users are frustrated when they 
remember that there used to be a handy button and now it isn't there.

User interface elements that are not currently applicable should be disabled 
but not hidden.  If different interfaces are needed for different application 
modes, use established conventions like tab views and disclosure areas.  
Instead of changing a button to reflect application mode, allow the user to 
control the change of application mode by deliberately selecting a different 
tab or expanding a disclosure area or pressing a next button.  Users should 
be in control, and every user interface change should have a cause that is 
obvious to the user.

___

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

Please do not post admin requests or moderator comments to the list.
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


Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind
I have an application that manages two kinds of data: A singular file  
that contains a large amount of rarely changed (but not invariant)  
data, and documents that contain one root object's worth of  
information that connects to the singular data set in a very large  
number of places; the documents are in fact little more than a chosen  
list of references into the singular data set, plus some small bits of  
independant data. The documents are modified quite often.


Originally I thought Core Data must surely be ideal for this sort of  
application; the object graph management alone should have been very  
helpful, to say nothing of the management of stores and the abilty to  
integrate with bindings and NSDocument. I got as far as reading all  
the basic (and some of the not so basic) Core Data documentation and  
began wondering whether or not my data would fit into its model after  
all. For example, in the large singular data set, there are a large  
number of what SQL would call lookup tables, data that's used only  
to avoid duplicating a set of constant values that are used elsewhere.


To use the Employee/Department example from the Core Data docs,  
sometime in the future an Employee might have a planetOfOrigin  
attribute. Assuming one limits one's self to the restriction of the  
speed of light (so, not TOO far in the future), the resulting Planet  
entity would only ever have a small number of possible values. Such an  
attribute might be better modeled in the Employee entity by something  
like SQL's ENUM or SET types. If the set of possible values is Earth  
and Not Earth, a Boolean might make more sense. If the set of  
possible values is Earth, Mars, Venus, etc., an ENUM would be a  
reasonably obvious choice; after all, how often does the solar system  
gain or lose a planet (cough Pluto cough)? With such a small data set,  
a lookup table would only be the obvious choice if the set of possible  
values was expected to change with any frequency. But Core Data has no  
support for such a thing; I would either have to write a custom  
property type or model it by creating the Planet entity and giving it  
a relationship from Employee.


Let's pretend the lookup table *was* the obvious choice for some  
reason; the speed of light barrier has been broken and now there's a  
whole mess of planets. So in Core Data parlance, the Employee entity  
has a one-to-one relationship to the Planet entity. The inverse  
relationship from Planet to Employee, all employees from this planet  
is technically feasible, even easy, to model, but it's almost  
certainly a waste of time and effort. But the Core Data documentation  
offers a long list of very dire warnings about one-way relationships  
between entities.


Worse, the list of possible Planets certainly doesn't belong in the  
same document file that holds a single Employee's data; you'd end up  
duplicating that data across every single Employee. So the list of  
Planets would instead be in a global store. But oops, Core Data can't  
model cross-store relationships, so you use a fetched property, which  
is one-way. Inverse relationship problem solved, unless you actually  
had a use for that relationship. But fetched properties need a fetch  
request, and what do you put in the predicate? Now you need some kind  
of identifier in the Employee for the fetch to operate on, and now you  
have two fields (the planetOfOriginName string for the predicate and  
planetOfOrigin as the fetched property) to model a single  
relationship. How to maintain referential integrity? And what if you  
DID want the inverse relationship - do you model another fetched  
property in the other direction? What's the predicate there,  
planetOfOriginName LIKE [c] $FETCH_SOURCE.name? Now your Planet  
entity has intimate knowledge of the structure of your Employee  
entity; that can't be good.


It seems to me that Core Data really is intended to deal with lists of  
root objects, i.e. the entire list of Employees in one store, rather  
than one Employee per store. The Core Data documentation mentions  
attaching multiple stores to a persistent store coordinator, but I  
can't make any sense of how interrelationships between the stores are  
handled.


Is Core Data really more appropriate to my dataset than an SQLite  
database and a simple Employee object that fetches from that database?  
If so, I'd appreciate some help in understanding how.


(Let me take this opportunity to say that for all the warnings that  
Core Data is not and never has been a database, almost every concept I  
see in it makes me think O/R mapper for SQLite.)


-- Gwynne

___

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

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

Help/Unsubscribe/Update your Subscription:

Re: Scrolling NSScrollView by fractional amounts - why would values get rounded?

2009-09-10 Thread Jens Alfke


On Sep 10, 2009, at 7:01 AM, Martin Redington wrote:


This works fine when the new y value is a whole integer, but I'm
seeing some strange behaviour when trying to scroll by fractional
amount (e.g. .25 or .5 of a pixel).


Are you sure you want to scroll by fractional pixels? It will be  
slower, because the view has to re-render from scratch, instead of  
letting the video card scroll the pixels. And a lot of things don't  
render very well at non-integer coordinates unless they've been tuned  
to do so (the most common problems are that lines that are supposed to  
be one pixel wide get smeared across two pixels, and images get  
blurred because every image pixel gets interpolated between four  
screen pixels.)


—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


setwantslayer:yes = rendering problem scaling subviews

2009-09-10 Thread Joshua Strickon
I have finally narrowed down my subview scaling problem to the  
setwantslayer.  If that is set to YES for an nsview, changing the  
frame and bounds of a subview can produce arbitrary results.  Leaving  
it off seems to work.  My only issue is that I will no longer be able  
to use core animation layers and effects.  It seems that this is  
somewhat of a major problem.  Is there any way to make this work?   
Does this work in SL?  I am about to upgrade anyway.


To confirm this, I created a simple test app with a three test cases.
In my window NIb I have the following
1) standalone button
2) box with subview of button
3) NSView with subview of button.

I am scaling each button by changing the frame and then calling  
scaleUnitSquareTosize.


If I setwantslayer on the nsview, strange effects start to happen and  
the button doesn't scale right.  You get clipped portions, and strange  
bounds settings.  It setwantslayer set to NO, it all works properly.


Is there a way to make this work?

Thanks


Josh
___

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

Please do not post admin requests or moderator comments to the list.
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: CGWindowListCreateImage fails on Snow Leopard with kCGNullWindowID

2009-09-10 Thread Jason Foreman

On Sep 10, 2009, at 12:34 PM, David Duncan wrote:


On Sep 10, 2009, at 7:32 AM, Jason Foreman wrote:

CGImageRef screenShot = CGWindowListCreateImage(CGRectInfinite,  
kCGWindowListOptionOnScreenOnly, kCGNullWindowID,  
kCGWindowImageDefault);





On Snow Leopard, the CGImageRef is NULL and the following message  
is printed to the console:


Error: CGImageCreate: invalid image bits/pixel or bytes/row.




Your bug will end up dup'd to rdar://problem/7022171. The basic  
problem is using CGRectInfinite from a 32-bit process when the  
Window Server is running as a 64-bit process – when the rect comes  
out at the other end it is no longer interpreted as infinite but  
rather as very very large. Since you can't create an image that  
large, the creation code fails and you get back a NULL CGImageRef  
instead.


The current best work around is to determine a proper bounding box  
for the desktop and pass it for the given rect.


Thanks David, your suggestion works great.  I appreciate the quick  
response.


For the benefit of the archives and anyone else having a similar  
issue, here is how I calculate the bounding box:


NSRect desktopRect = NSZeroRect;
for (NSScreen *screen in [NSScreen screens])
{
desktopRect = NSUnionRect(desktopRect, [screen frame]);
}


This seems to give me exactly what I want when passed to  
CGWindowListCreateImage.





smime.p7s
Description: S/MIME cryptographic signature
___

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

Please do not post admin requests or moderator comments to the list.
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

[MEET] Reminder : LA CocoaHeads TONIGHT 9/10/09 at 7:30pm

2009-09-10 Thread Rob Ross

Greetings LA CocoaHeads.

Tonight, Ron will be demoing his iPhone app “The DVD Bit Budget
Assistant”, and showing some of the facets that went into creating it.

More info on the app itself at http://www.editgroove.com/


We meet at the offices of E! Entertainment at 7:30pm.

Our meeting location is

5750 Wilshire Blvd
Los Angeles, CA 90036.

Here's a google map of the location:

http://www.google.com/maps?f=qhl=enq=5750+Wilshire+Blvd,+Los+Angeles+CA+90036ie=UTF8z=15om=1iwloc=addr

Free street parking is available after 8pm - FEED THE METER UP TO 8PM
OR YOU MIGHT GET A TICKET!

I'd suggest trying Masselin Ave, which is one block East of Courtyard
Place.

We meet near the lobby of the West building at 5750 Wilshire Blvd, on
the West side of Courtyard Place. There are picknick tables in front
of the lobby and we'll gather there starting at 7:20pm. From there we
go inside and up to conference room 3A at around 7:45pm .

If you arrive late, please ask the building security personnel in the
lobby to direct you to the E! Security office, and they will be able
to contact the group in conference room 3A and send someone down to
meet you.

Rob___

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

Please do not post admin requests or moderator comments to the list.
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: NSServiceCategory

2009-09-10 Thread Nick Zitzmann


On Sep 10, 2009, at 11:30 AM, Nick Zitzmann wrote:

I'm aware of an apparently undocumented NSRequiredContext key called  
NSServiceCategory that manually sets the service category in the  
Keyboard preference pane, which is useful when the pane does not  
correctly categorize the service, which I'm guessing it does based  
on the name and pasteboard type. I know that you can use a UTI here  
to set the category, but what's the UTI for the general category?


Never mind! I didn't expect it to work, but just setting the key value  
to General solved the problem.


Nick Zitzmann
http://www.chronosnet.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: NSServiceCategory

2009-09-10 Thread Peter Ammon


On Sep 10, 2009, at 10:30 AM, Nick Zitzmann wrote:

I have a service that can apply to multiple categories due to the  
pasteboard types it accepts. In Snow Leopard, for some reason, the  
service always shows up under the Pictures category even though it  
also accepts text. I want it to show up in the General category.


I'm aware of an apparently undocumented NSRequiredContext key called  
NSServiceCategory that manually sets the service category in the  
Keyboard preference pane, which is useful when the pane does not  
correctly categorize the service, which I'm guessing it does based  
on the name and pasteboard type. I know that you can use a UTI here  
to set the category, but what's the UTI for the general category?  
I tried searching for NSServiceCategory and found nothing, and  
searching for UTIs gives me results for a different meaning of UTI...


Nick Zitzmann
http://www.chronosnet.com/


Hi Nick,

You should try to pick a UTI that represents your Service accurately.   
If the UTI you pick does not conform to any category, then it will  
wind up in General.  But if later Apple adds a new category, and your  
Service's UTI conforms to the new category's UTI, your Service will  
show up in the new category.


If your Service really can't be categorized, just writing General is  
fine.


-Peter


___

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

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

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

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


Re: NSServiceCategory

2009-09-10 Thread Nick Zitzmann


On Sep 10, 2009, at 1:08 PM, Peter Ammon wrote:

You should try to pick a UTI that represents your Service  
accurately.  If the UTI you pick does not conform to any category,  
then it will wind up in General.  But if later Apple adds a new  
category, and your Service's UTI conforms to the new category's UTI,  
your Service will show up in the new category.


OK, but what if the service has a category but no real UTI? For  
example, there's a Searching category. What's the UTI for searching?  
I've looked at the list of system-declared UTIs and there's nothing  
with search in its name.


I'd also better file a bug report about the lack of documentation for  
NSServiceCategory...


Nick Zitzmann
http://www.chronosnet.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: Adding an observer is memory expensive

2009-09-10 Thread Greg Guerin

Torsten Radtke wrote:

I observed excessive memory usage (working in a garbage-collected  
environment under 10.6) if I add an observer to a KVO-compliant  
object. So if I add an observer to say 10 objects, Instruments  
shows that 10 2KB blocks of memory are allocated (additionaly  
there are another 10 48B blocks and 20 32B blocks).

Is this when the first observer is added to each of the 100k objects?

Additionaly, if I remove the observer only 10 32B blocks are  
released and collected. This also does not seem right to me.


Suppose that each observed object is doing lazy instantiation of the  
internal objects needed for managing its observers.  What would you  
expect to see?


The first thing I'd expect is that the cost of adding the first  
observer would be much higher than adding a 2nd or 3rd observer.  The  
second thing I'd expect is that removing all observers would leave  
the internal objects in place, because the observed class can't know  
you won't add another observer in the future.


In other words, the baseline cost of managing observers is paid once,  
when the 1st observer is added.  After that, only the marginal cost  
of each observer is added or removed as each observer is added or  
removed.


If you are unhappy about the memory costs of managing observers, then  
you should probably investigate alternatives.  Depending on the class  
of the observed object, you may be able to save memory, but you have  
to weigh that against the cost of developing and maintaining your own  
code, and whether it has or needs the same generality as KVO- 
compliance.  That may or may not be a good engineering tradeoff.  YMMV.


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

2009-09-10 Thread Peter Ammon


On Sep 10, 2009, at 12:15 PM, Nick Zitzmann wrote:



On Sep 10, 2009, at 1:08 PM, Peter Ammon wrote:

You should try to pick a UTI that represents your Service  
accurately.  If the UTI you pick does not conform to any category,  
then it will wind up in General.  But if later Apple adds a new  
category, and your Service's UTI conforms to the new category's  
UTI, your Service will show up in the new category.


OK, but what if the service has a category but no real UTI? For  
example, there's a Searching category. What's the UTI for  
searching? I've looked at the list of system-declared UTIs and  
there's nothing with search in its name.


Yes, Searching unfortunately does not have an associated UTI - as you  
discovered you can specify the category name explicitly in that case.


I'd also better file a bug report about the lack of documentation  
for NSServiceCategory...


Thanks!

___

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

Please do not post admin requests or moderator comments to the list.
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: NSServiceCategory

2009-09-10 Thread Nick Zitzmann


On Sep 10, 2009, at 1:30 PM, Peter Ammon wrote:

Yes, Searching unfortunately does not have an associated UTI - as  
you discovered you can specify the category name explicitly in that  
case.


That's what I thought. And if Scott or Mmalc or any other  
documentation writers are reading this, the radar # is 7213062.


Nick Zitzmann
http://www.chronosnet.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: Scripting Bridge link error

2009-09-10 Thread Randall Meadows

On Sep 9, 2009, at 8:12 PM, Jason Foreman wrote:

You don't actually instantiate ScriptingBridge objects directly  
like that.  The interface header is generated so you can get type  
checking when you call methods, but the actual class is acquired  
dynamically at runtime.  See the documentation for - 
classForScriptingClass: in SBApplication.  You'll need to do  
something more like:


AdobePhotoshopCS3JPEGSaveOptions *options = [[psApp  
classForScriptingClass:@AdobePhotoshopCS3JPEGSaveOptions] new];


OK, now that I've successfully created this options object...what  
the heck do I do with it?!  I create the object in the first place in  
order to pass it as the past argument to a document's - 
saveIn:as:copying:appending:withOptions: method.  It doesn't really  
belong to a container object (AFAICT), so when the doc says  
Immediately after creating the object, insert it in the appropriate  
element array. The object is not “viable” in the application until it  
has been added to its container. Consequently, you cannot set or  
access its properties until it’s been added., I'm at a loss figuring  
out which container it is supposed to be added to before I can even  
do options.quality=12; in order to pass it to that method.


I'd love to be able to query the document to get this (so that I can  
do this only if the quality is not already 12), but I've found no way  
via AppleScript to find this out.  Currently, I'm using do shell  
script to run the command line tool 'exiftool' to query the image  
file for the PhotoshopQuality EXIF value, but I'd like to avoid this  
if possible.


Any tips would be greatly appreciated!  Thanks!
randy___

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

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

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

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


Re: Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind

On Sep 10, 2009, at 3:21 PM, Erik Buck wrote:
Yes.  Use Core Data.  Your application is exactly what Core data is  
intended to support.


Create a planet entity.
Create a one to many relationship so that each employee has one  
planet, but each planet has an unlimited number of employees.


This is exactly what lookup tables in sql produce.  There is no  
need for fancy fetched properties.  There is no problem with having  
planet entity instances in the same store with employee entity  
instances.  It is a good design that makes your data stores self  
sufficient.  There will only be one instance of the planet entity  
for each planet that you define.  Right now, you would never have  
more than 8 or 9 planet entity instances no matter how many employee  
instances you have.


You could also just have a planet of origin string property in  
each Employee entity.  The property could default to Earth.  There  
is no need for a custom Enum type when strings work perfectly  
well.  You can even validate the strings whenever they change to  
restrict the set of valid strings.  Constant strings will tend to  
have the same pointer, so you won't even have the cost of separate  
string copies for each Employee instance.



I don't see this as being equivelant at all.

Extending the example, let's say the company with these Employees has  
as its directors several discriminating unfair people, and thus an  
Employee from any given Planet gets a salary adjustment based on that  
Planet. The obvious place for this data is the Planets table, or in  
Core Data's case, the Planet entity. A salaryAdj column (attribute)  
is added to the Planets table (Planet entity) and filled in with the  
(in)appropriate numbers.


Now suddenly the company is taken over by far more benevolent and  
considerate people, whose only flaw is that they don't want to break a  
system that works by removing an entire column from a database table  
(a schema change is much more difficult than a data update, after  
all), so they just UPDATE Planets SET salaryAdj=0.


So someone loads up an Employee whose Planet instances are in the same  
store with that Employee, and the old salary adjustment is still  
sitting there in the saved data. I sense unhappy Employees in this  
company's future. If only the coder who wrote the payroll system had  
put the Planet data in some global store where changes to it would  
propogate correctly to all Employees.


Does Core Data still solve the problem? Is there some reason that  
using Core Data for everything would be better than storing the global  
rarely-updated data in a real database and using Core Data only for  
the Employee entity, which is the only part which really talks to the  
UI anyway? (Something tells me the key point is right there...) For  
that matter, if Core Data is only managing one entity, what's the use  
of Core Data at all? With all the data being referential between the  
database and the entity, just define a simple NSObject subclass which  
contains a few instance variables and implements NSCoding.


-- Gwynne

___

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

Please do not post admin requests or moderator comments to the list.
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: Is Core Data appropriate to my task?

2009-09-10 Thread Ben Trumbull

Gwynne,


I have an application that manages two kinds of data: A singular file
that contains a large amount of rarely changed (but not invariant)
data, and documents that contain one root object's worth of
information that connects to the singular data set in a very large
number of places; the documents are in fact little more than a chosen
list of references into the singular data set, plus some small bits of
independant data. The documents are modified quite often.

Originally I thought Core Data must surely be ideal for this sort of
application; the object graph management alone should have been very
helpful, to say nothing of the management of stores and the abilty to
integrate with bindings and NSDocument. I got as far as reading all
the basic (and some of the not so basic) Core Data documentation and
began wondering whether or not my data would fit into its model after
all. For example, in the large singular data set, there are a large
number of what SQL would call lookup tables, data that's used only
to avoid duplicating a set of constant values that are used elsewhere.

To use the Employee/Department example from the Core Data docs,
sometime in the future an Employee might have a planetOfOrigin
attribute. Assuming one limits one's self to the restriction of the
speed of light (so, not TOO far in the future), the resulting Planet
entity would only ever have a small number of possible values. Such an
attribute might be better modeled in the Employee entity by something
like SQL's ENUM or SET types. If the set of possible values is Earth
and Not Earth, a Boolean might make more sense. If the set of
possible values is Earth, Mars, Venus, etc., an ENUM would be a
reasonably obvious choice; after all, how often does the solar system
gain or lose a planet (cough Pluto cough)? With such a small data set,
a lookup table would only be the obvious choice if the set of possible
values was expected to change with any frequency. But Core Data has no
support for such a thing; I would either have to write a custom
property type or model it by creating the Planet entity and giving it
a relationship from Employee.


Correct.  You can write a custom NSValueTransformer with the  
Transformable property type to implement an ENUM, or normalize the  
data into a separate table as a formally modeled entity.  Which is  
better depends on how big the data values are, how many of them there  
are, and how frequently they change.


Is that really so bad ?  The alternative is to do ALL the work yourself.


Let's pretend the lookup table *was* the obvious choice for some
reason; the speed of light barrier has been broken and now there's a
whole mess of planets. So in Core Data parlance, the Employee entity
has a one-to-one relationship to the Planet entity.


A lonely planet.  That's either going to be one-to-many or a no  
inverse to-one.



The inverse
relationship from Planet to Employee, all employees from this planet
is technically feasible, even easy, to model, but it's almost
certainly a waste of time and effort. But the Core Data documentation
offers a long list of very dire warnings about one-way relationships
between entities.


Yes, and for most situations those warnings are there for very good  
reasons.  But if there were no reasons for such relationships, then it  
wouldn't be a warning, it simply wouldn't exist.



Worse, the list of possible Planets certainly doesn't belong in the
same document file that holds a single Employee's data; you'd end up
duplicating that data across every single Employee. So the list of
Planets would instead be in a global store.


There are lots of ways to model that, but, yes, this would be the most  
natural.



But oops, Core Data can't
model cross-store relationships, so you use a fetched property, which
is one-way.


You could use a fetched property, or handle this in code by storing a  
URI for the destination object in a different store, and fetching the  
matching objectID either lazily in in -awakeFromFetch.  We've  
generally recommended using a custom accessor method for this instead  
of fetched properties.



Inverse relationship problem solved, unless you actually
had a use for that relationship. But fetched properties need a fetch
request, and what do you put in the predicate? Now you need some kind
of identifier in the Employee for the fetch to operate on,


Yes, but this isn't any different than the problem would be without  
Core Data for managing values in two different databases.


and now you  have two fields (the planetOfOriginName string for  
the predicate and

planetOfOrigin as the fetched property) to model a single
relationship. How to maintain referential integrity?


Again, no different than the problem would be without Core Data.  This  
is why the modeling tool recommends using inverse relationships.   
Maintaining the integrity by oneself is tedious and error prone.


And what if you DID want the inverse relationship - do you model  
another fetched

Snow Leopard and Exchange access using ABAddressBook

2009-09-10 Thread Steve Cronin

Folks;

I am trying to understand whether ABAddressBook will permit  
interaction with Exchange.

I don't see anything in the documentation specifically on this point.

Can anyone comment on this?
Am I missing a resource?
Is it currently not supported?

Thanks for any thoughts!
Steve

___

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

Please do not post admin requests or moderator comments to the list.
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: Is Core Data appropriate to my task?

2009-09-10 Thread Gwynne Raskind
Before anything else, let me say thank you for a clear, concise, and  
very helpful set of answers to my questions; I was expecting rather  
more of a struggle for understanding :).


On Sep 10, 2009, at 5:04 PM, Ben Trumbull wrote:

support for such a thing; I would either have to write a custom
property type or model it by creating the Planet entity and giving it
a relationship from Employee.
Correct.  You can write a custom NSValueTransformer with the  
Transformable property type to implement an ENUM, or normalize the  
data into a separate table as a formally modeled entity.  Which is  
better depends on how big the data values are, how many of them  
there are, and how frequently they change.


Is that really so bad ?  The alternative is to do ALL the work  
yourself.


Mostly I just wanted to be certain that there was nothing obvious I  
was missing :).



The inverse
relationship from Planet to Employee, all employees from this  
planet

is technically feasible, even easy, to model, but it's almost
certainly a waste of time and effort. But the Core Data documentation
offers a long list of very dire warnings about one-way relationships
between entities.
Yes, and for most situations those warnings are there for very good  
reasons.  But if there were no reasons for such relationships, then  
it wouldn't be a warning, it simply wouldn't exist.


The manual isn't at all clear about this, but if I understand  
correctly, you're basically saying, Though it is almost always  
technically possible to model an inverse to any relationship, there  
are sometimes circumstances in which it is correct not to do so. Is  
that accurate, and if so, should I file a documentation bug requesting  
clarification on that and the circumstances in which it's true?



Worse, the list of possible Planets certainly doesn't belong in the
same document file that holds a single Employee's data; you'd end up
duplicating that data across every single Employee. So the list of
Planets would instead be in a global store.
There are lots of ways to model that, but, yes, this would be the  
most natural.


I can't think of any others offhand, but I haven't worked with this  
sort of data before; could you give some examples?



But oops, Core Data can't
model cross-store relationships, so you use a fetched property, which
is one-way.
You could use a fetched property, or handle this in code by storing  
a URI for the destination object in a different store, and fetching  
the matching objectID either lazily in in -awakeFromFetch.  We've  
generally recommended using a custom accessor method for this  
instead of fetched properties.


Is there any particular reason for that recommendation? The  
documentation explicitly recommends fetched properties for cross-store  
relationships (one instance of several is in the Core Data Programming  
Guide, Relationships and Fetched Properties chapter, Fetched  
Properties section, first paragraph, where it says  In general,  
fetched properties are best suited to modeling cross-store  
relationships...)


Also, if you do in code or fetched properties, this hand made cross  
store relationship, you should prefer numeric keys to text strings  
for your joins.  Creating a de facto join through a LIKE query is  
pretty crazy.  That's a case insensitive, local aware, Unicode regex  
there.  String operations are much more expensive than integer  
comparisons.  At the very least, use == for your string compares.


Don't worry, I already had the experience of having to work with a  
codebase that used string keys as its only cross-table links in mSQL.  
Eventually we had to recreate the whole system from scratch.


It seems to me that Core Data really is intended to deal with lists  
of

root objects, i.e. the entire list of Employees in one store, rather
than one Employee per store.
One document per Employee is a bit unusual.  But it's feasible if  
that's your requirement.


Employee was just the example I yanked out of the Core Data docs :). A  
better analogy would be the Picture example. If you use Core Data  
entities to store the various elements of a vector graphic, you would  
certainly want to be able to store one graphic per document.



(Let me take this opportunity to say that for all the warnings that
Core Data is not and never has been a database, almost every  
concept I

see in it makes me think O/R mapper for SQLite.)
Core Data is an O/R mapping framework, among other things.  But O/R  
frameworks are not SQL databases.  Modeling your data in any O/R  
framework as if you were writing SQL directly is inefficient and  
mistaken.


Saying that Core Data is a database is like saying your compiler is  
an assembler.  Well, the compiler suite uses an assembler, sure, and  
they both output object code in the end, but that does not mean the  
best way to use your compiler is to write in assembly.



Nonetheless, Core Data does manage the data stored on disk as well as  
the representation of 

Re: How can we draw a horizontal line with embossing effect?

2009-09-10 Thread Nathan Day

You could also try one of the draw bezel functions

NSDrawDarkBezel
NSDrawGrayBezel
NSDrawLightBezel
NSDrawWhiteBezel

with a height of 2, and a y value with a .5 decimal

On 11/09/2009, at 12:12 AM, Steven Degutis wrote:


Arun,
It's just two lines drawn on top of one another, with the top one  
darker
than the background and the bottom one lighter. I use it in my  
Preference

panels all the time.

--
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/

On Thu, Sep 10, 2009 at 4:15 AM, Arun arun...@gmail.com wrote:


Hi All
How can we draw a horizontal line with embossing effect?  The  
attached

picture describes more clearly.

Thanks
Arun KA

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com

This email sent to steven.degu...@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/nathan_day%40mac.com

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


___

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

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

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

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


Re: XC IB 3.2 overlapping siblings

2009-09-10 Thread Sean McBride
On 9/10/09 3:51 AM, Steve Cronin said:

I know I'm late to the game here but I just took my app for a compile
under XC3.2 for the first time...

A few NSString encoding loose ends OK  but WHAMO my .xib files are
hammered with ~100 errors (not warnings!)

.. This view overlaps one of its siblings. Overlapping sibling views
are not supported on Mac OS X versions prior to 10.5. ...

My base SDK is set to 10.6 and a deployment of 10.4.
Everything was peachy under 10.5 and XC3.1 no such warnings or errors.

Sooo does this mean I cannot use XC3.2 unless I fix all these issues?

This is an IB question, so should probably be on the Xcode list.

But anyway, have you looked at Preferences  Alerts?

--

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


CAShapeLayer for Drawing Lines; Animations Skewed

2009-09-10 Thread Christopher J Kemsley

Hi all,

In my current development project, I have numerous dots that will be  
moved around periodically, each connected by a line.


The dots are represented as CALayers, with the contents set to a  
simple 20x20 dot, and they are moved around by animating the  
position property.


The connecting lines will be drawn between the centers of two dots,  
and will be moved via an animations whenever the dots change position.


This is where I'm running into trouble. Any suggestions on how to fix  
what I've done so far or suggestions for a different, easier approach  
are more than welcome.



What I've tried:

CALayer with 50x1 Square as Contents

In this method, I used a 50x1 square. For every animation, I set the  
bounds to:


CGRectMake ( 0 , 0 , absoluteDistanceBetweenPoints , 1 ) ;

and the transform to

CATransform3DMakeRotation ( angleBetweenPoints , 0 , 0 , 1 ) ;

This worked, but had the unfortunate side-effect of, during some of  
the moves, rotating too far around in the wrong direction, making the  
endpoints come out from under the points.  (For example, instead of  
rotating 90º, it would rotate 270º in the wrong direction. This, in  
theory, is easy to fix, but isn't as easy as it sounds.



CAShapeLayer with Path from PointA to PointB

In this method, I used a CAShapeLayer with the correct color and a 1px  
width. I made a path between the two points.


For moves, I created another path representing the new position and  
used a CABasicAnimation to animate the path property.


This also 'works,' but also has a side-effect: A line, instead of  
animating from (oldPointA,oldPointB) to (newPointA,newPointB) would  
animate to (oldPointA,oldPointB) to (randomPoint,randomPoint) to  
(newPointA,newPointB)   (Note:  (aPoint,bPoint) represents a line/ 
path from aPoint to bPoint)




Any suggestions for improving these methods (especially fixing the  
CAShapeLayer, which would be optimal) would be greatly appreciated!


Thanks,
-Christopher___

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

Please do not post admin requests or moderator comments to the list.
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: Is Core Data appropriate to my task?

2009-09-10 Thread Ben Trumbull

I don't see this as being equivelant at all.

Extending the example, let's say the company with these Employees has
as its directors several discriminating unfair people, and thus an
Employee from any given Planet gets a salary adjustment based on that
Planet. The obvious place for this data is the Planets table, or in
Core Data's case, the Planet entity. A salaryAdj column (attribute)
is added to the Planets table (Planet entity) and filled in with the
(in)appropriate numbers.

Now suddenly the company is taken over by far more benevolent and
considerate people, whose only flaw is that they don't want to break a
system that works by removing an entire column from a database table
(a schema change is much more difficult than a data update, after
all), so they just UPDATE Planets SET salaryAdj=0.


Now you're conflating other issues.  This is why I recommend not  
treating O/R systems as perfectly equivalent to databases.  They're  
not.  On Snow Leopard  iPhone OS, you can make modest alterations to  
the Core Data schema easily.  Just keep a copy of the old model, and  
pass the 2 keys to the options dictionary when you add the store to  
the PSC to leverage light weight migration.  Core Data will infer the  
appropriate schema changes and adjust the schema in place (alter table  
style).


http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CoreDataVersioning/Articles/vmLightweight.html#//apple_ref/doc/uid/TP40008426-SW1 



If you do make some unusual and radical modifications (split tables  
into multiple new tables, compose old tables into a single new table,  
etc), you can use the full mapping model migration.  While it won't  
perform as well as light weight migration, at least you'll have tools  
support in handling the schema migration.



So someone loads up an Employee whose Planet instances are in the same
store with that Employee, and the old salary adjustment is still
sitting there in the saved data. I sense unhappy Employees in this
company's future. If only the coder who wrote the payroll system had
put the Planet data in some global store where changes to it would
propogate correctly to all Employees.


If this is important, than you can use multiple persistent stores.

I suspect Erik's point, though, is many apps don't have a significant  
issue with a small amount of duplication in the individual documents.   
Disk space is usually cheap.  And being completely self contained has  
its advantages (perhaps not relevant to you, but still existent).   
global mutations is a double edged sword.  What if your documents  
are loaded in a newer version of the app, but have some implicit data  
dependency on the older global data ?  That can get messy.



Does Core Data still solve the problem? Is there some reason that
using Core Data for everything would be better than storing the global
rarely-updated data in a real database and using Core Data only for
the Employee entity, which is the only part which really talks to the
UI anyway? (Something tells me the key point is right there...) For
that matter, if Core Data is only managing one entity, what's the use
of Core Data at all? With all the data being referential between the
database and the entity, just define a simple NSObject subclass which
contains a few instance variables and implements NSCoding.



Then why not use Core Data for the database and for the entity  
implement a simple NSObject subclass with a few instances  
variables ... ?


Although, it seems a little silly to not use Core Data for the simple  
part when you'll get persistence, change tracking and Cocoa Bindings  
integration for free.  Most people find NOT maintaining backward  
compatible initWithCoder methods in perpetuity quite refreshing.  I  
know one developer seriously considering rewriting their iPhone app  
for no other reason than to use Core Data's light weight migration and  
never hand roll another database schema upgrade again.


Here's an excerpt from a post regarding when to use Core Data on the  
iPhone:


I suppose I could tell you how great an addition to Cocoa it is, or  
how much TLC its performance tuning gets.  But what I've seen our most  
sophisticated clients decide is that it saves them from writing a lot  
of code.  The model code with Core Data is usually 50% to 70% smaller  
as measured by lines of code.  Why reinvent that ?


App developers don't get paid to write database code.  Can you learn  
SQL ?  Sure.  Do your customers care ?  No.


App developers get paid for novel functionality that addresses a real  
customer need with good UI.


- Ben

Here's a more traditional reply:

- Full KVC, KVO support out of box
- Relationship maintenance (inverses, delete propagation)
- Change tracking

- Sophisticated SQL compilation
 - NSPredicate objects instead of SQL
 - NSPredicate support for correlated subqueries, basic  
functions, and other advanced SQL

 - Proper Unicode, local aware searching, sorting, regex
   

Re: Is Core Data appropriate to my task?

2009-09-10 Thread Ben Trumbull

Before anything else, let me say thank you for a clear, concise, and
very helpful set of answers to my questions; I was expecting rather
more of a struggle for understanding :).


my pleasure.


On Sep 10, 2009, at 5:04 PM, Ben Trumbull wrote:

The inverse
relationship from Planet to Employee, all employees from this
planet
is technically feasible, even easy, to model, but it's almost
certainly a waste of time and effort. But the Core Data  
documentation

offers a long list of very dire warnings about one-way relationships
between entities.

Yes, and for most situations those warnings are there for very good
reasons.  But if there were no reasons for such relationships, then
it wouldn't be a warning, it simply wouldn't exist.


The manual isn't at all clear about this, but if I understand
correctly, you're basically saying, Though it is almost always
technically possible to model an inverse to any relationship, there
are sometimes circumstances in which it is correct not to do so. Is
that accurate, and if so, should I file a documentation bug requesting
clarification on that and the circumstances in which it's true?


Sure.  It's a challenge to document some of this material in a way  
that steers most developers down the typically optimal path while  
still keeping advanced options open.  We have many developers with  
little or no database experience, and we want to encourage them to use  
inverses until they have a compelling reason not to.  The  
documentation was more open about no inverse relationships in 10.4,  
and we learned the hard way that was less than ideal.  The modeling  
tool now issues warnings for this due to the frequency and severity of  
bugs from developers incorrectly and over eagerly using no inverse  
relationships.



But oops, Core Data can't
model cross-store relationships, so you use a fetched property,  
which

is one-way.

You could use a fetched property, or handle this in code by storing
a URI for the destination object in a different store, and fetching
the matching objectID either lazily in in -awakeFromFetch.  We've
generally recommended using a custom accessor method for this
instead of fetched properties.


Is there any particular reason for that recommendation? The
documentation explicitly recommends fetched properties for cross-store
relationships (one instance of several is in the Core Data Programming
Guide, Relationships and Fetched Properties chapter, Fetched
Properties section, first paragraph, where it says  In general,
fetched properties are best suited to modeling cross-store
relationships...)


First, custom accessor methods and -awakeFromFetch offer a vast amount  
of flexibility, and can be easier to tune for performance.  Fetched  
properties are a fine alternative.  But I like to also reinforce the  
understanding that not all your custom behavior needs to be  
encapsulated in your Core Data schema.  You have full Objective-C  
objects and very powerful runtime support.  Use it liberally.



(Let me take this opportunity to say that for all the warnings that
Core Data is not and never has been a database, almost every
concept I
see in it makes me think O/R mapper for SQLite.)

Core Data is an O/R mapping framework, among other things.  But O/R
frameworks are not SQL databases.  Modeling your data in any O/R
framework as if you were writing SQL directly is inefficient and
mistaken.

Saying that Core Data is a database is like saying your compiler is
an assembler.  Well, the compiler suite uses an assembler, sure, and
they both output object code in the end, but that does not mean the
best way to use your compiler is to write in assembly.



Nonetheless, Core Data does manage the data stored on disk as well as
the representation of that data in memory; I don't see a tremendous
difference between that and what SQLite does, other than Core Data
providing a much effective organization of and means of access to that
data.


Core Data implements a lot of functionality on top of SQLite.  From an  
API perspective, that it uses SQLite at all is an implementation detail.


In any event, O/R systems present an OO view of your data, and have  
their own idioms closer to OOP.  They are providing an abstraction  
layer and perform transformations on both your queries and result  
sets.  Relational databases can support that, but in every O/R system,  
the ideal way of using the system is somewhat different from how one  
would write SQL directly against the database.


- Ben


___

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

Please do not post admin requests or moderator comments to the list.
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: Scrolling NSScrollView by fractional amounts - why would values get rounded?

2009-09-10 Thread Graham Cox


On 11/09/2009, at 4:41 AM, Jens Alfke wrote:


This works fine when the new y value is a whole integer, but I'm
seeing some strange behaviour when trying to scroll by fractional
amount (e.g. .25 or .5 of a pixel).


Are you sure you want to scroll by fractional pixels? It will be  
slower, because the view has to re-render from scratch, instead of  
letting the video card scroll the pixels.


Is one set to copy on scroll and the other not?

But yes, it's a bad idea, IMO.

--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: XC IB 3.2 overlapping siblings

2009-09-10 Thread Graham Cox


On 11/09/2009, at 4:40 AM, Erik Buck wrote:

Don't overlap sibling views.  Even though it works reliably now, it  
is still a poor practice for controls and has a definite user  
interface smell.



There are exceptions though. For example, two square buttons placed  
side by side such that they share a 1 pixel frame border. That flags  
an overlap warning, but it's the right placement for the best look for  
the buttons.


--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: CAShapeLayer for Drawing Lines; Animations Skewed

2009-09-10 Thread John Harper


On Sep 10, 2009, at 7:20 PM, Christopher J Kemsley wrote:


CAShapeLayer with Path from PointA to PointB

In this method, I used a CAShapeLayer with the correct color and a  
1px width. I made a path between the two points.


For moves, I created another path representing the new position and  
used a CABasicAnimation to animate the path property.


This also 'works,' but also has a side-effect: A line, instead of  
animating from (oldPointA,oldPointB) to (newPointA,newPointB) would  
animate to (oldPointA,oldPointB) to (randomPoint,randomPoint) to  
(newPointA,newPointB)   (Note:  (aPoint,bPoint) represents a  
line/path from aPoint to bPoint)


yes, that looks like a bug, please file a radar so we can track it. (bugreport.apple.com 
)


for now I think you can get the right result by giving each line three  
points instead of two, the easiest way to do that is just add an extra  
point with the same coordinates as the end point.


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


iTunes/iPhoto like Database using CoreData?

2009-09-10 Thread Peter Zegelin

Hi,

My carbon application has an iTunes like database to store MIDI files.  
It uses SQLlite as the database.  I am thinking that I might converts  
the whole thing to CoreData when I rewrite the app in Cocoa so I was  
wondering if there are any examples that would be a suitable starting  
point for something like this.


What I currently have is a  database with 3 main tables:

LibraryItems stores info about each MIDI file such as name, file  
alias, date added, date modified, number of tracks in the file, play  
count etc.
Playlists stores info about each playlist (but not items in the  
playlist) such as name, its parent in the sourcelist, horizontal and  
vertical scroll positions, column types and widths (as comma delimited  
strings)
CatItems uses the uniqueID of each LibraryItem and Playlist to keep a  
list of what MIDI files are in each Playlist and their position in  
that Playlist.


I have looked around a bit but not seen anything that looks like it  
would fit the bill but that may be due to my lack of familiarity with  
the terminology, so any pointers would be much appreciated!


Thanks!

Peter


___

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

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

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

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