Re: GC pros and cons

2009-06-25 Thread Chris Idou




From: James Gregurich 

> I have read up on GC, and I don't like the idea of introducing 
> non-deterministic behavior into my code base. 


I would question the assertion that GC introduces non-deterministic behavior, 
unless you consider the time it takes for particular code to execute to be 
"behavior".

In which case standard malloc/free is not deterministic either, since 
algorithms for amalgamating free areas in the heap are not exactly predictable, 
and the time they take will not be constant across different calls.

That's why if you were controlling the space shuttle you wouldn't use 
malloc/free OR GC.


  Access Yahoo!7 Mail on your mobile. Anytime. Anywhere.
Show me how: http://au.mobile.yahoo.com/mail
___

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

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

Help/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: GC pros and cons

2009-06-25 Thread James Gregurich


consistently using the technique pushes the null check to one or two  
placessuch as when the pointer is alloc'ed.


regardless of whether messaging nil is a problem or not, if nil isn't  
a a valid state for a variable, I check it and throw an exception as a  
matter of defensive programming. in particular, if a data member is a  
pointer that is available via accessor, I put the null check in the  
accessor with the accessor returning a reference (rather than a  
pointer) to the type. Client code calling the accessor need not worry  
about the value being in an invalid state. If the value is in an  
invalid state, an exception is thrown and everything cleanly unwinds  
and the system can react and cleanly recover.





On Jun 25, 2009, at 10:13 PM, Stephen J. Butler wrote:

On Fri, Jun 26, 2009 at 12:06 AM, James Gregurich> wrote:
I also take advantage of references in C++ to pass objc objects  
around
without having to do null checks all over the place to keep code  
resilent.


-(void) passMyObject: (NSObject&) theObj
{
  NSLog(@"%@", &theObj);
}

since the function takes a reference, client code knows never to  
pass a null

to the function.


Huh? When you call the function, don't you have to eventually do
[something passMyObject:*anObject]? To me, that doesn't eliminate the
nil check, just move it somewhere else.

Also, messaging nil objects isn't a problem. It's only an issue with
the collections.
___

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

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

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

This email sent to bayoubenga...@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: GC pros and cons

2009-06-25 Thread Stephen J. Butler
On Fri, Jun 26, 2009 at 12:06 AM, James Gregurich wrote:
> I also take advantage of references in C++ to pass objc objects around
> without having to do null checks all over the place to keep code resilent.
>
> -(void) passMyObject: (NSObject&) theObj
> {
>NSLog(@"%@", &theObj);
> }
>
> since the function takes a reference, client code knows never to pass a null
> to the function.

Huh? When you call the function, don't you have to eventually do
[something passMyObject:*anObject]? To me, that doesn't eliminate the
nil check, just move it somewhere else.

Also, messaging nil objects isn't a problem. It's only an issue with
the collections.
___

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

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

Help/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: GC pros and cons

2009-06-25 Thread James Gregurich


I'll speak up and throw a wrinkle into this discussion. I found it  
useful and may some others will also.


I have read up on GC, and I don't like the idea of introducing non- 
deterministic behavior into my code base. However, it is true that  
manually retaining and releasing pointers is inherently error-prone.


Personally, my solution is objc++ with the boost::shared_ptr  
template.  The following code works great...its easy to maintain and  
understand...it makes it easy to share objects across threads  
safelyit automatically manages the memory with a retain count in a  
manner completely compatible with NSAutoreleasePool.




void releaseNSObject(NSObject* theObjPtr)
{
[theObjPtr release];
}




boost::shared_ptr tmpStringSPtr([[NSString alloc] init],  
releaseNSObject);



Yes, it uses an extra int per object keeping an extra retain count,  
but I'll trade that for the reliability and maintainability I get in  
return. For the work I do, what is being pointed to is almost always  
far larger than 4 (or 8) bytes.




I also take advantage of references in C++ to pass objc objects around  
without having to do null checks all over the place to keep code  
resilent.



-(void) passMyObject: (NSObject&) theObj
{
NSLog(@"%@", &theObj);
}

since the function takes a reference, client code knows never to pass  
a null to the function.






On Jun 25, 2009, at 2:00 PM, Peter Ammon wrote:



On Jun 25, 2009, at 1:42 PM, Bill Bumgarner wrote:


On Jun 25, 2009, at 3:14 PM, Peter Ammon wrote:
In any case, it's been my experience that GC makes memory  
management much easier, but precious resource management somewhat  
harder.  It's harder because GC forces more of a divorce between  
the management of memory and precious resources, and the precious  
resource management techniques are about on the level with C circa  
1989.


Really, retain/release requires such a separation, too.  At least,  
it does for relatively complex, often concurrent, piles of code.




I totally agree, which is why I said "more of" a divorce.  Since  
retain/release is more deterministic than GC, it allows you to  
tolerate ordering dependencies  and tying resource lifetime to  
memory lifetime for longer.  But it ultimately breaks down as  
complexity increases, just as you say.


The switch to GC has forced me to redesign a number of classes.  But  
I usually find that the redesigned classes work better under retain/ 
release as well.


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

This email sent to bayoubenga...@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: Amount of Arguments per Method

2009-06-25 Thread Ken Ferry
Not a method, but NSCell.h has a function with 13 arguments.

APPKIT_EXTERN void NSDrawNinePartImage(NSRect frame, NSImage *topLeftCorner,
NSImage *topEdgeFill, NSImage *topRightCorner, NSImage *leftEdgeFill,
NSImage *centerFill, NSImage *rightEdgeFill, NSImage *bottomLeftCorner,
NSImage *bottomEdgeFill, NSImage *bottomRightCorner, NSCompositingOperation
op, CGFloat alphaFraction, BOOL flipped)
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;

-Ken

On Mon, Jun 22, 2009 at 1:03 AM, Roland King  wrote:

> This still the longest one or has Apple outdone themselves since? 11 args,
> you really wouldn't want much more than this.
>
> -(id)initWithBitmapDataPlanes:pixelsWide:pixelsHigh:bitsPerSample:samplesPerPixel:hasAlpha:isPlanar:colorSpaceName:bitmapFormat:bytesPerRow:bitsPerPixel:
>
>
> WT wrote:
>
>> On Jun 22, 2009, at 8:05 AM, Chunk 1978 wrote:
>>
>>  clearly simplicity is important, but i'd like to know if there is a
>>> limit for the amount of arguments which a method can handle?
>>>
>>
>>
>> I don't know if there's an upper limit, but I don't recall ever  writing a
>> method with more than 5 or 6 arguments. When I feel inclined  to do
>> otherwise, it typically means that there's a flaw in my design.
>>
>> Wagner
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> 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/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


[Moderator] Re: Amount of Arguments per Method

2009-06-25 Thread Scott Anguish

This thread is closed.

___

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

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

Help/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: Ideas required on testing an application install

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 11:09 PM, Andy Lee wrote:
* It annoys me to wait for CDs/DVDs to boot, so (like another person  
who posted) I like to have a small bootable partition on a hard  
drive somewhere.  Someone else pointed out you can boot from a thumb  
drive, which is a great idea I will have to try next time I download  
an OS seed.


And the command to blast down a dmg of a system onto said partition  
such that it can be booted is


sudo asr -source /Path/to/SeedDownload.dmg -target /Volumes/ 
MyBootablePartitionThatWillBeNuked -erase -noverify -noprompt


It is every bit as destructive to MyBootablePartitionThatWillBeNuked  
as the paramaters imply.  Once done, you can reboot and hold down the  
 key to select the volume.


It'll be interested to see what kind of performance one achieves when  
booting from an SD card.  Given their price ($40 for a class-6 SDHC  
card), it would be an attractive and convenient option.


Certainly, I know that when I have a moment, I'm going to prep a 16GB  
card with two bootable partitions; one containing an emergency Leopard  
boot image configured to use my user account on the internal drive and  
one that contains DiskWarrior and a couple of other tools.


b.bum

___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin


On 26/06/2009, at 1:24 PM, Quincey Morris wrote:


After all, the non-band-aid way is almost as easy:

- (id) initWithNibName: (NSString*) nibNameOrNil bundle:  
(NSBundle*) nibBundleOrNil {

self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil];
if (!self)
return nil;
numColumns = 8;
return self;
}


(I'm assuming that the view controller is not itself if a nib file.  
If it is, you need to used initWithCoder instead.)


This is definitely the right answer this time. If it isn't the wrong  
answer.



Heh :-)

Ok - I've implemented initWithNibName and set the value there. Works  
great - thanks!


As an aside, this caused another little problem because I then  
immediately called my method to show and hide columns, but at that  
point there was no ref to the tableview. I ended up also having:


- (void)awakeFromNib{
	[self setColumnHidden];  <- tried this in initWithNibName but it was  
too early

}

which fixes that as well.

thanks everyone,

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: GC pros and cons

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 10:32 PM, Adam R. Maxwell wrote:
Interesting.  I found the Xcode editor to be unusably slow on a  
PowerBook G4 when Leopard was released; in fact, contrary to Bill's  
statement, I found that it grew worse in the last few months of  
Leopard seeding.  I'm still sore about having to buy a MacBook Pro  
just to avoid beachballs while typing (rdar://problem/5572897).   
Even said MacBook Pro needs 4 GB of RAM to avoid hanging when  
switching to Xcode, since the collector thread evidently causes  
paging in to scan memory (which caused a beachball and hiccups  
switching apps in Spaces).



The specific issue of Xcode typing performance has been optimized  
significantly with each successive release.  The underlying problem  
for #5572897 was that the parser used to color the code and do a bunch  
of other stuff was both inefficient and tickled the collector in just  
the wrong way.


Bringing this back to cocoa-dev specific issues.

Yes, the collector will keep more memory "hot" in an application than  
using retain/release.   Where this comes into play is when you (a)  
hide an application and (b) do enough stuff in other applications that  
it causes the hidden app's pages to be paged out.


When reactivated, the app will have to pagein anything it needs to  
touch.   GC can cause more stuff to be paged in.


However, in a complex application (like Xcode) that manages lots of  
stuff for which "is it up to date" checks must be performed semi- 
regularly, there will be a lot of page-thrash on reactivation  
regardless of GC or Non-.


Example;   try using Aperture for a while and really build up a good  
sized working set.  Hide it and beat on Xcode.  Then activate  
Aperture.   It can take a long time before the app is responsive again.


The bottom line is that you want to reduce the footprint of your  
application as much as you can as early as you can.   Ditch objects.   
Prune caches.  Optimize your undo stack to have a semi-minimal  
representation of the items within the stack.   It'll lead to better  
overall system performance and make your app feel more snappy as your  
user activates/deactivates it.


b.bum
___

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

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

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

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


Re: Ideas required on testing an application install

2009-06-25 Thread Andy Lee
Just the other day Bill Bumgarner posted how he does it over on the  
xcode-users list:




Although not as convenient as running a virtual machine this sounds  
like a very good system.  A couple of notes:


* After booting from the Beta partition, I would unmount the  
Production partition, and vice versa, to avoid accidentally using or  
modifying something on the wrong partition.


* It annoys me to wait for CDs/DVDs to boot, so (like another person  
who posted) I like to have a small bootable partition on a hard drive  
somewhere.  Someone else pointed out you can boot from a thumb drive,  
which is a great idea I will have to try next time I download an OS  
seed.


--Andy


On Jun 25, 2009, at 2:04 PM, Ramakrishna Vavilala wrote:


I just finished converting (rewriting) a windows application to work
on Mac OSX. I made a package for my application. Now I want to test it
on a clean machine. In Windows I would normally create a clean Virtual
Machine and install the application to make sure that everything is
working properly on a clean machine.

What kind of strategy should I use to do same level of testing on a
Mac? Is buying another Mac just for testing the only other option? I
know that I don't need to worry about component dependencies/registry
settings like I do on Windows. But I don't want to use my dev machine
for testing. Are there any tricks involved in creating a test
environment?

___

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

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

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

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


validModesForFontPanel woes

2009-06-25 Thread David Reitter

Hello,

I'm trying to configure a font panel using validModesForFontPanel:.   
Unfortunately I can't get this to work right.  I can influence the  
visibility of some of the elements, except that it doesn't do what it  
is told to do...


For instance, the following gives me options for document color and  
underline:


- (unsigned int) validModesForFontPanel:(NSFontPanel *)fontPanel
{
  return (NSFontPanelFaceModeMask |
  NSFontPanelSizeModeMask |
  NSFontPanelCollectionModeMask  |
  NSFontPanelTextColorEffectModeMask  |
  NSFontPanelDocumentColorEffectModeMask);
}

What's wrong?  I would like to have document and text colors, face,  
size and collection, and nothing else.


In case somebody else got it to work - thanks for shedding light on it. 
___


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

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

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

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


Re: GC pros and cons

2009-06-25 Thread Chris Idou


I guess the necessity to scan and page in memory is a legitimate downside for 
VM systems. It's possible I've seen xcode pause when switching apps, but never 
thought about it being related to GC scans, but just paging in the app. I'd 
probably forgotten that XCode is GC.

...of course, the iPhone does not have virtual memory, so its not an issue 
there.





From: Adam R. Maxwell 
To: cocoa-dev Dev 
Sent: Friday, 26 June, 2009 1:32:51 PM
Subject: Re: GC pros and cons


On Jun 25, 2009, at 8:19 PM, Chris Idou wrote:

> I still use XCode in one location where I work on a core-solo Mini. 
> Performance is good. No problems at all, no pauses.

Interesting.  I found the Xcode editor to be unusably slow on a PowerBook G4 
when Leopard was released; in fact, contrary to Bill's statement, I found that 
it grew worse in the last few months of Leopard seeding.  I'm still sore about 
having to buy a MacBook Pro just to avoid beachballs while typing 
(rdar://problem/5572897).  Even said MacBook Pro needs 4 GB of RAM to avoid 
hanging when switching to Xcode, since the collector thread evidently causes 
paging in to scan memory (which caused a beachball and hiccups switching apps 
in Spaces).


  Access Yahoo!7 Mail on your mobile. Anytime. Anywhere.
Show me how: http://au.mobile.yahoo.com/mail
___

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

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

Help/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: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Graham Cox


On 26/06/2009, at 1:24 PM, Quincey Morris wrote:


After all, the non-band-aid way is almost as easy:



I wholeheartedly agree - this was me just not taking the trouble to  
understand the real issue.


However, in my defence I'd say that any time you perform a division by  
a value that something else can change, protecting yourself against  
silly values (in this case 0) is usually wise unless you can  
absolutely guarantee that the value is always sensible.


--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: GC pros and cons

2009-06-25 Thread Adam R. Maxwell


On Jun 25, 2009, at 8:19 PM, Chris Idou wrote:

I still use XCode in one location where I work on a core-solo Mini.  
Performance is good. No problems at all, no pauses.


Interesting.  I found the Xcode editor to be unusably slow on a  
PowerBook G4 when Leopard was released; in fact, contrary to Bill's  
statement, I found that it grew worse in the last few months of  
Leopard seeding.  I'm still sore about having to buy a MacBook Pro  
just to avoid beachballs while typing (rdar://problem/5572897).  Even  
said MacBook Pro needs 4 GB of RAM to avoid hanging when switching to  
Xcode, since the collector thread evidently causes paging in to scan  
memory (which caused a beachball and hiccups switching apps in Spaces).





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

Re: GC pros and cons

2009-06-25 Thread Michael Ash
On Thu, Jun 25, 2009 at 4:14 PM, Peter Ammon wrote:
> 2) Require that malloc be robust against multiple free()s on the same
> pointer
>
> The second solution is a lot easier to implement.

Can you elaborate on this? Thinking about how to accomplish this, it
seems like an extremely difficult problem. The only thing I've been
able to come up with that would work would be to make all pointers be
implemented as an address plus a counter. Then when you call free, it
checks your pointer's counter against the latest one allocated there,
and if your counter is stale, it does nothing. This would be a massive
change to the language that would break binary compatibility with
everything and bloat pointer sizes hugely, since it would really
require at least 64 bits for the counter to be properly robust.

Is there some easy solution to this that I'm overlooking? Silently
returning if you pass a freed block is not sufficient, because that
block could have been reused by the time the second free() happens,
causing a chunk of memory owned by someone else to be spontaneously
destroyed.

Mike
___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Quincey Morris

On Jun 25, 2009, at 20:02, Peter Zegelin wrote:

Go easy on me here - but I just have a regular NSTableView - no  
subclass.  The NSViewController  - which is subclassed -is the  
delegate and handles numberOfRowsInTableView/ 
objectValueForTableColumn. So why didn't my question make sense?


Eek! I confused myself. What I said would have been the right answer  
if it wasn't the wrong answer.


Actually, the answer is pretty much the same -- you should set a valid  
number of columns in the view controller's initializer, not in its  
awakeFromNib. That means you're actually going to have to give it an  
initializer if it doesn't have one already.


The only problem with Graham's band-aid approach is that now you've  
baked the concept of "numColumns == 0 means the view controller hasn't  
been initialized yet" into your implementation. What if, in the  
future, something else that references numColumns gets called before  
awakeFromNib?


After all, the non-band-aid way is almost as easy:

- (id) initWithNibName: (NSString*) nibNameOrNil bundle: (NSBundle*)  
nibBundleOrNil {

self = [super initWithNibName: nibNameOrNil bundle: nibBundleOrNil];
if (!self)
return nil;
numColumns = 8;
return self;
}


(I'm assuming that the view controller is not itself if a nib file. If  
it is, you need to used initWithCoder instead.)


This is definitely the right answer this time. If it isn't the wrong  
answer.



___

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

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

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

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


Open Position at IRCAM: MacOSX GUI Developper (C++/Objective-C)

2009-06-25 Thread axel roebel
JOB TITLE: MacOS X User Interface Developer (C++/Objective-C)

INSTITUTE:

IRCAM is a leading non-profit organization dedicated to musical
production, R&D and education in acoustics and music. The organization
is located in the center of Paris (France), next to the Pompidou
Center. It hosts composers, researchers and students from many
countries cooperating in contemporary music production, scientific and
applied research. The main topics addressed in its R&D department are
acoustics, psychoacoustics, audio synthesis and processing, computer
aided composition, user interfaces, real time systems. Detailed
activities of IRCAM and its groups are presented on our WWW server,
http://www.ircam.fr/recherche.html

The development position is immediately available in the analysis/synthesis 
team.
The analysis/synthesis team is researching and developing new and
advanced algorithms for sound signal analysis, synthesis and
transformation.

JOB DESCRIPTION:

A full time position for the development of user interfaces for state
of the art signal processing algorithms. The main target application
is AudioSculpt (http://forumnet.ircam.fr/691.html) a graphical user
interface for command line applications and signal processing
libraries. The main task is the design and implementation of the user
interfaces that provide ergonomic and intuitive access to state of the
signal processing algorithms that are developed by the researchers of
the team. The responsibilities include the communication with the
user base at IRCAM and in the IRCAM Forum, the creative design of new
approaches to sound manipulation and the integration of user feedback.

The target environment of the application is Mac OS X and the
programming languages are C/C++ and objective-C.


DEVELOPMENT TASKS:

The candidate will perform the following tasks:

o design, implement and continually improve the graphical user interface
 for the signal processing algorithms
o integrate new algorithms into AudioSculpt and implement a new kernel 
interface
o continue the modernization of the internal code base
o communicate with users, propose creative solutions for sound design problems
o ensure communication with the researchers and Phd students and implement 
o set up automated testing procedures
o participate in the long term software planning process
o prepare software releases

REQUIRED EXPERIENCE AND COMPETENCE:

o Excellent knowledge of C++ and Objective C programming language.
o Excellent skills and several years of experience as MacOSX developer 
including graphical interfaces.
o Experience with design of user interfaces.
o Experience with STL.
o Basic understanding of digital signal processing algorithms.
o Interest for music.
o High productivity, methodical and autonomous work, creativity, good
communication skills, and excellent programming style.
o knowledge of Max/MSP is desirable

AVAILABILITY:

 - The position is available in the "Analysis/Synthesis" team in the R&D
department starting as soon as possible.

DURATION

The initial contract is for 1 year, an extension is intended.

LOCATION: 

IRCAM is located in the center of Paris, next to the
  the George Pompidou Museum for Modern Art at 1,
  pl. Igor-Stravinsky, 75004 Paris, France

EEC WORKING PAPERS:

 - In order to start immediately, the candidate should preferably have EEC
citizenship or already own valid EEC working papers.

SALARY:

 - According to background and experience.

TO APPLY:

 - Please send your resume with qualifications and other pertinent information
 preferably useing the web interface  http://www.ircam.fr/71.html?L=1#job_64
-- 
Axel Roebel
IRCAM Analysis/Synthesis Team
Phone: ++33-1-4478 4845 | Fax: ++33-1-4478 1540

___

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

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

Help/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: GC pros and cons

2009-06-25 Thread Chris Idou



I still use XCode in one location where I work on a core-solo Mini. Performance 
is good. No problems at all, no pauses.





From: Rob Keniger 
To: cocoa-dev Dev 
Sent: Friday, 26 June, 2009 12:20:48 PM
Subject: Re: GC pros and cons


On 26/06/2009, at 10:58 AM, Chris Idou wrote:

> Bill I don't know if this was discussed before, but could you discuss the 
> lack of GC on the iPhone?


I suspect it is for performance reasons. The Objective-C garbage collector is 
designed to run in a separate thread on the Mac, which means it can run on its 
own CPU core separate to the main thread.

In single-core systems, even on the Mac, performance of Garbage Collected code 
is very poor because the collector has to share CPU time with the main thread. 
When Xcode 3 (a GC app) was first released in the Leopard betas there were 
still quite a few people with single-CPU PowerPC laptops who found that Xcode 
could barely keep up with their typing. On dual-core machines it was fine.

The iPhone has a single-core CPU and a slow one at that, so while I am sure 
that GC could be turned on, it would probably make developers very unhappy.

--
Rob Keniger



___

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

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

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

This email sent to idou...@yahoo.com



  Access Yahoo!7 Mail on your mobile. Anytime. Anywhere.
Show me how: http://au.mobile.yahoo.com/mail
___

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

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

Help/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: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin


On 26/06/2009, at 12:40 PM, Quincey Morris wrote:


On Jun 25, 2009, at 19:14, Peter Zegelin wrote:


Well I guess the question then becomes 'where is earlier'!

I tried overloading NSViewController::loadView and it also gets  
called 'after' the first call to numberOfRowsInTableView.
If I have the 3 methods awakeFromNib, numberOfRowsInTableView and  
loadView this is the calling sequence I get:


numberOfRowsInTableView
awakeFromNib
loadView
numberOfRowsInTableView
numberOfRowsInTableView
objectValueForTableColumn  <- drawing will start here I guess

Grahams suggestion is a good workaround (thanks!) but I still don't  
quite get it.



Your situation requires a little care because you (presumably,  
otherwise your question wouldn't make sense) have a NSTableView  
subclass,


Go easy on me here - but I just have a regular NSTableView - no  
subclass.  The NSViewController  - which is subclassed -is the  
delegate and handles numberOfRowsInTableView/ 
objectValueForTableColumn. So why didn't my question make sense?


(Alternatively, follow Graham's approach, which in effect makes  
initialization unnecessary.)


Yes this works 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: Quick DO endian question

2009-06-25 Thread Michael Vannorsdel
Thanks for the confirmation.  I did some testing using Rosetta and  
didn't see endian problems but I wanted to make sure this was intended  
and reliable on actual PPC and not just an anomaly leading me to  
believe the byte swapping was automatic for explicit types.



On Jun 24, 2009, at 10:54 PM, Michael Ash wrote:


This is the sort of thing that would be trivial to test if you have an
Intel machine on hand

In any case, the answer is no, you do not need to worry about
endianness in any data whose types that DO can see. DO gets full type
information about arguments and return values from the ObjC runtime,
and uses this to do any necessary conversions. Not just endianness,
but also size conversion (and potentially format conversion for
floating-point values, although everything Mac OS X runs on or
conceivably will run on uses IEEE754 format floats) will be done for
you.

Note the qualifier "whose types that DO can see". If you're shipping
around, say, raw data inside an NSData object, then DO can't know what
kind of stuff is in there and it will not do the conversion for you.
This is a pretty rare occurrence, of course, so normally you won't
have to worry about it.

___

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

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

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

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


Re: Ideas required on testing an application install

2009-06-25 Thread Peter N Lewis

On 26/06/2009, at 2:04 , Ramakrishna Vavilala wrote:


I just finished converting (rewriting) a windows application to work
on Mac OSX. I made a package for my application. Now I want to test it
on a clean machine. In Windows I would normally create a clean Virtual
Machine and install the application to make sure that everything is
working properly on a clean machine.

What kind of strategy should I use to do same level of testing on a
Mac? Is buying another Mac just for testing the only other option? I
know that I don't need to worry about component dependencies/registry
settings like I do on Windows. But I don't want to use my dev machine
for testing. Are there any tricks involved in creating a test
environment?



If your application doesn't do anything funky with the system (ie, its  
just a plain application, without making system level changes), then  
one option is to just create a new user and use fast user switching to  
test.  You can create/delete new users as needed to test a clean  
install - the only thing you'd need to do is remove it from the  
Applications folder.


Otherwise, as suggested, a separate partition or separate harddisk or  
separate Mac would be options if you need a really clean Mac.  You may  
need multiple partitions to test multiple OS versions (eg 10.5  
and10.6).  I keep around an old Mac that the kids use running the  
previous OS for this purpose.

   Peter.

--
 Clipboard Switching and Macros with Keyboard Maestro

Keyboard Maestro  Macros for your Mac
   



___

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

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

Help/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: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Quincey Morris

On Jun 25, 2009, at 19:14, Peter Zegelin wrote:


Well I guess the question then becomes 'where is earlier'!

I tried overloading NSViewController::loadView and it also gets  
called 'after' the first call to numberOfRowsInTableView.
If I have the 3 methods awakeFromNib, numberOfRowsInTableView and  
loadView this is the calling sequence I get:


numberOfRowsInTableView
awakeFromNib
loadView
numberOfRowsInTableView
numberOfRowsInTableView
objectValueForTableColumn  <- drawing will start here I guess

Grahams suggestion is a good workaround (thanks!) but I still don't  
quite get it.


Specifically, the first thing that's going be called is either  
initWithCoder: or init:


	http://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/CocoaNibs/CocoaNibs.html#/ 
/apple_ref/doc/uid/1051i-CH4-SW18


After that, the object is potentially available to other objects --  
and itself, of course -- before its awakeFromNib is called. As Keary  
said, there's no basis for believing that awakeFromNib is the *first*  
method that can possibly be called on a just-unarchived object.


Your situation requires a little care because you (presumably,  
otherwise your question wouldn't make sense) have a NSTableView  
subclass, but what's archived is actually a NSTableView (according to  
the above document, if you dragged a table view into your XIB file in  
IB and then changed its class). It gets transmogrified into your  
subclass as/after it's unarchived (it says), so you'd better set your  
initial state in initWithCoder. If you think about it, your  
NSTableView subclass never finished its initialization before it was  
archived, and if you create one programatically it will fail in  
exactly the same way as when it's being loaded from the nib, for the  
same reason. (So you'll have to implement its designated initializer  
too, if you might ever create one programatically.) (Alternatively,  
follow Graham's approach, which in effect makes initialization  
unnecessary.)


If you really want to know what's calling 'numberOfRowsInTableView'  
early, set a breakpoint there and look. Could well be the table view  
itself.



___

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

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

Help/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: GC pros and cons

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 9:20 PM, Rob Keniger wrote:
In single-core systems, even on the Mac, performance of Garbage  
Collected code is very poor because the collector has to share CPU  
time with the main thread. When Xcode 3 (a GC app) was first  
released in the Leopard betas there were still quite a few people  
with single-CPU PowerPC laptops who found that Xcode could barely  
keep up with their typing. On dual-core machines it was fine.


I won't comment on anything iPhone related regarding GC and I would  
ask that we keep the speculation off of the cocoa-dev list as it is  
off-topic and unproductive.


To the above;   When Xcode was first released in the Leopard betas,  
Garbage Collection actually *didn't* run in a separate thread.  That  
wasn't ready yet and it was far more critical to get Xcode up and  
running with GC on so as to shake out the entire system than it was to  
optimize GC.


Thus, you are correct that the initial seeds of Xcode were pretty  
darned slow, but they were pretty darned slow on multi-core systems,  
too!   The were doubleplus slow on single core systems, though, more  
because of Xcodes use of thread and the lack of appropriate throttling  
than because of GC.


By the time Leopard shipped, the collector had become significantly  
more efficient and had been moved off to a separate thread.   As well,  
Xcode had also been tuned, along with a bunch of system frameworks,  
and the overall performance was vastly improved.


Obviously, discussing details of Snow Leopard on cocoa-dev isn't yet  
possible.  If you want to know more about Snow Leopard specific  
optimizations and have access, ask away in http://devforums.apple.com/.


b.bum

___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin


On 26/06/2009, at 11:55 AM, Kyle Sluder wrote:


On Thu, Jun 25, 2009 at 6:33 PM, Peter
Zegelin wrote:

Unfortunately my numberOfRowsInTableView is being called 'before'
awakeFromNib, so initially numColumns = 0 and I get an error
(myDataSize/numColumns will be infinite).


So set a flag in -awakeFromNib.  Check this flag in
-numberOfRowsInTableView: and return 0 if this flag isn't set.

I always thought awakeFromNib would get called first. But in this  
case not

so. So can anyone suggest why, and a workaround?


The order of -awakeFromNib calls is not guaranteed.  In fact, you
probably have an outlet from your tree controller to your table view,
so the table view must necessarily be awoken first, since all outlets
are guaranteed to be set up before -awakeFromNib is called.
NSTableView's -awakeFromNib probably causes it to probe its delegate.

--Kyle Sluder


Yes, that makes sense - there is an outlet.

At least I know its not my code.

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


Re: GC pros and cons

2009-06-25 Thread Rob Keniger


On 26/06/2009, at 10:58 AM, Chris Idou wrote:

Bill I don't know if this was discussed before, but could you  
discuss the lack of GC on the iPhone?



I suspect it is for performance reasons. The Objective-C garbage  
collector is designed to run in a separate thread on the Mac, which  
means it can run on its own CPU core separate to the main thread.


In single-core systems, even on the Mac, performance of Garbage  
Collected code is very poor because the collector has to share CPU  
time with the main thread. When Xcode 3 (a GC app) was first released  
in the Leopard betas there were still quite a few people with single- 
CPU PowerPC laptops who found that Xcode could barely keep up with  
their typing. On dual-core machines it was fine.


The iPhone has a single-core CPU and a slow one at that, so while I am  
sure that GC could be turned on, it would probably make developers  
very unhappy.


--
Rob Keniger



___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin


On 26/06/2009, at 11:54 AM, Keary Suska wrote:



On Jun 25, 2009, at 7:33 PM, Peter Zegelin wrote:

	I have come across what seems to be a weird situation and can't  
really think of a good solution. I'm relatively new to Cocoa so its  
probably just a simple misunderstanding.


I have a subclass of NSViewController that also acts as the  
delegate for the NSTableView that it controls. This tableview is  
loaded into my main window. I want to be able to hide some columns  
in the tableview and as a result, the number of rows in the  
tableview will vary according to numColumns. ie:


-(int)numberOfRowsInTableView:(NSTableView *)tableView{

return myDataSize/numColumns;
}

Now, I haven't got around to actually varying the number of columns  
in the table yet, but I do have  a property 'numColumns' that I set  
to a reasonable value in awakeFromNib:


- (void)awakeFromNib{

numColumns = 8;
}


Unfortunately my numberOfRowsInTableView is being called 'before'  
awakeFromNib, so initially numColumns = 0 and I get an error  
(myDataSize/numColumns will be infinite).


I always thought awakeFromNib would get called first. But in this  
case not so. So can anyone suggest why, and a workaround?


There is no such guarantee for -awakeFromNib. You either need to set  
the value earlier, or call -reloadData on the table.




Well I guess the question then becomes 'where is earlier'!

I tried overloading NSViewController::loadView and it also gets called  
'after' the first call to numberOfRowsInTableView.
If I have the 3 methods awakeFromNib, numberOfRowsInTableView and  
loadView this is the calling sequence I get:


numberOfRowsInTableView
awakeFromNib
loadView
numberOfRowsInTableView
numberOfRowsInTableView
objectValueForTableColumn  <- drawing will start here I guess

Grahams suggestion is a good workaround (thanks!) but I still don't  
quite get it.

___

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

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

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

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


Re: Substituting characters in a UITextField

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 7:03 PM, DKJ wrote:
> It never showed up in my inbox. All I got was a message saying it was being
> moderated.

Aha.  Sorry for sniping at you.  (As you might be aware, there are
occasionally instances where people repeatedly post to the mailing
list, knowing full well that their messages are getting through.)

If you're subject to moderation and want to confirm that your mail has
gone through, cocoabuilder.com is a good place to check.  It's
independent from Apple's servers, so it shows up there at the same
time it shows up everywhere else.

Still don't have any ideas for you though, I'm afraid.  :)

--Kyle Sluder
[not the moderator]
___

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

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

Help/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: NSDate scope

2009-06-25 Thread John Baldwin
I've gone back to my code and tried to reproduce the error. Now I  
can't. So I was doing something else stupid that I've since changed.


Now if I do the usual [[NSDate alloc] init] it seems to be behaving as  
expected. [NSDate date] can generate the error, but that doesn't  
surprise me.


John

On Sunday Jun 21  2:09 PM, at 2:09 PM, Kyle Sluder wrote:

On Sat, Jun 20, 2009 at 4:52 PM, John Baldwin> wrote:

I declared a (NSDate *) in my .h file.


Where?  Inside an @implementation, or as a global variable?  If it's a
global variable, you are aware that for every translation unit that
imports your header, you will wind up with a different variable?


Then in my init method, I initialized it to the current date. I tried
various methods, all with the same result:


You're mixing owning methods (alloc, retain) with non-owning methods
(+date).  This indicates that you do not understand Cocoa memory
management.

Then, in a method that was called by an NSTimer object, I tried to  
use that
date as a reference point. But the debugger showed the variable as  
"out of

scope."


Where is this method defined?  What object was it being invoked on?

Sounds like you need to do a bit of reading.  If you go through the
conceptual docs and still have trouble understanding, post your code
here and we can help you out a bit.

--Kyle Sluder


___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 6:33 PM, Peter
Zegelin wrote:
> Unfortunately my numberOfRowsInTableView is being called 'before'
> awakeFromNib, so initially numColumns = 0 and I get an error
> (myDataSize/numColumns will be infinite).

So set a flag in -awakeFromNib.  Check this flag in
-numberOfRowsInTableView: and return 0 if this flag isn't set.

> I always thought awakeFromNib would get called first. But in this case not
> so. So can anyone suggest why, and a workaround?

The order of -awakeFromNib calls is not guaranteed.  In fact, you
probably have an outlet from your tree controller to your table view,
so the table view must necessarily be awoken first, since all outlets
are guaranteed to be set up before -awakeFromNib is called.
NSTableView's -awakeFromNib probably causes it to probe its delegate.

--Kyle Sluder
___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Graham Cox


On 26/06/2009, at 11:33 AM, Peter Zegelin wrote:

I always thought awakeFromNib would get called first. But in this  
case not so. So can anyone suggest why, and a workaround?



This sounds a bit odd, and I can't say why. But I can offer a  
workaround:


-(int)numberOfRowsInTableView:(NSTableView *)tableView{

if( numColumns == 0 )
return myDataSize / 8;
else
return myDataSize/numColumns;
}


;-)

--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: Substituting characters in a UITextField

2009-06-25 Thread Kyle Sluder
You asked this question *this morning.*  Please don't spam the list.
If someone has an idea and feels like responding, they will.  At the
moment, I lack the former and am becoming far more disinclined towards
the latter.

--Kyle Sluder
___

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

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

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

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


Re: NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Keary Suska


On Jun 25, 2009, at 7:33 PM, Peter Zegelin wrote:

	I have come across what seems to be a weird situation and can't  
really think of a good solution. I'm relatively new to Cocoa so its  
probably just a simple misunderstanding.


I have a subclass of NSViewController that also acts as the delegate  
for the NSTableView that it controls. This tableview is loaded into  
my main window. I want to be able to hide some columns in the  
tableview and as a result, the number of rows in the tableview will  
vary according to numColumns. ie:


-(int)numberOfRowsInTableView:(NSTableView *)tableView{

return myDataSize/numColumns;
}

Now, I haven't got around to actually varying the number of columns  
in the table yet, but I do have  a property 'numColumns' that I set  
to a reasonable value in awakeFromNib:


- (void)awakeFromNib{

numColumns = 8;
}


Unfortunately my numberOfRowsInTableView is being called 'before'  
awakeFromNib, so initially numColumns = 0 and I get an error  
(myDataSize/numColumns will be infinite).


I always thought awakeFromNib would get called first. But in this  
case not so. So can anyone suggest why, and a workaround?


There is no such guarantee for -awakeFromNib. You either need to set  
the value earlier, or call -reloadData on the table.


Best,

Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"

___

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

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

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

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


Substituting characters in a UITextField

2009-06-25 Thread DKJ
I'd like to make some character substitutions in a UITextField while  
the user is typing.


For example, when the user types "C", I'd like an arrow (\u2192) to  
appear in the textfield instead.


I've been playing with the textField:shouldChangeCharactersInRange  
delegate method. But I don't see how to get it to do what I want.


Any ideas?

dkj
___

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

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

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

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


NSViewController awakeFromNib and NSTableView numberOfRowsInTableView

2009-06-25 Thread Peter Zegelin

Hello,

	I have come across what seems to be a weird situation and can't  
really think of a good solution. I'm relatively new to Cocoa so its  
probably just a simple misunderstanding.


I have a subclass of NSViewController that also acts as the delegate  
for the NSTableView that it controls. This tableview is loaded into my  
main window. I want to be able to hide some columns in the tableview  
and as a result, the number of rows in the tableview will vary  
according to numColumns. ie:


-(int)numberOfRowsInTableView:(NSTableView *)tableView{

return myDataSize/numColumns;
}

Now, I haven't got around to actually varying the number of columns in  
the table yet, but I do have  a property 'numColumns' that I set to a  
reasonable value in awakeFromNib:


- (void)awakeFromNib{

numColumns = 8;
}


Unfortunately my numberOfRowsInTableView is being called 'before'  
awakeFromNib, so initially numColumns = 0 and I get an error  
(myDataSize/numColumns will be infinite).


I always thought awakeFromNib would get called first. But in this case  
not so. So can anyone suggest why, and a workaround?


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


Re: GC pros and cons

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 7:58 PM, Chris Idou wrote:
Bill I don't know if this was discussed before, but could you  
discuss the lack of GC on the iPhone?


Not enough hours in the day to get everything done

(No, I can't speculate about things that don't exist).

b.bum

___

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

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

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

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


Re: NSOutlineView selection disable

2009-06-25 Thread Graham Cox


On 26/06/2009, at 5:38 AM, Arun wrote:


I have an application in which i use NSOutlineView Control. I need to
disable selection of items in the outlineview when the mouse is down  
and

select only on mouse up like in iTunes. Any ideas?



You asked the same question yesterday - if you didn't get an answer  
it's probably because nobody knows, not that they didn't see your  
message.


I don't know why you'd want the selection behaviour you describe -  
it's a bit weird and less usable. Xcode does it too, though most  
implementations of NSOutlineView don't seem to by default. This  
suggests it's possible to change if you really insist - maybe Corbin  
can tell you.




--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: IKImageBrowserView setSelectionIndex not selecting

2009-06-25 Thread Graham Cox


On 26/06/2009, at 2:19 AM, Richard Gutierrez wrote:


 NSArray* path = [NSArray arrayWithObject:url];
   if (path) {
   [NSThread  
detachNewThreadSelector:@selector(addImagesWithPaths:) toTarget:self  
withObject:path];

   }
   [imageBrowser setSelectionIndexes:[NSIndexSet indexSetWithIndex: 
0] byExtendingSelection:NO];



My guess is that there's nothing to select, because you are loading  
images in a second thread, and at the time setSelectionIndexes is  
called, the thread hasn't managed to load even the first image yet.


You'll need to arrange for the thread to tell the main thread when it  
has done some work so that the first thread can perform the selection.


--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: GC pros and cons

2009-06-25 Thread Chris Idou






From: Bill Bumgarner 
..


Bill I don't know if this was discussed before, but could you discuss the 
lack of GC on the iPhone?



  Access Yahoo!7 Mail on your mobile. Anytime. Anywhere.
Show me how: http://au.mobile.yahoo.com/mail
___

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

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

Help/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: document specific "as-you-type" spell checking

2009-06-25 Thread Douglas Davidson


On Jun 25, 2009, at 5:00 PM, kvic...@pobox.com wrote:

is it possible to do document specific (ie, use a document  
dictionary) "as-you-type" spell checking? ie, using NSTextFields and  
NSTextFieldCells, is it somehow possible to specify the spell  
document tag to be used by the field editor?


If you provide a custom field editor, you can override - 
spellCheckerDocumentTag.


Douglas Davidson

___

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

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

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

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


document specific "as-you-type" spell checking

2009-06-25 Thread kvic...@pobox.com
is it possible to do document specific (ie, use a document 
dictionary) "as-you-type" spell checking? ie, using NSTextFields and 
NSTextFieldCells, is it somehow possible to specify the spell 
document tag to be used by the field editor?


thanx,
ken

ps. i know i've asked this question before in slightly different 
"flavors", but i've yet to receive any replies. i'm hoping perhaps by 
re-wording, someone will take pity and reply, and either put me out 
of my misery (of trying to figure out how it should be done), or 
point me to some documentation/sample code that shows how to do it! 
:-(

___

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

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

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

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


Re: Request assistance with GCC Warnings

2009-06-25 Thread Dave Carrigan


On Jun 25, 2009, at 4:13 PM, Eric Hermanson wrote:

I realize this is really a GCC question, and not a Cocoa question,  
but I can't seem to find an adequate answer on the web.  Considering  
I'm from a strictly Java background, I was hoping someone could clue  
me in to what the following two GCC warnings mean, if I should worry  
about them, how to fix them (or how to silence the warnings):


It has to do with GCC's stack-smashing protection extensions. It's  
basically telling you that it is unable to protect the stack for those  
functions for the reasons provided in the error. It doesn't mean that  
there's a bug, it just means that those particular functions won't be  
able to benefit from the protection mechanisms.


You can either turn off stack protection -fno-stack-protection or turn  
of the warnings -Wno-stack-protector.


As far as I know, there is no pragma yet to disable either protection  
or the warning for a single function.


--
Dave Carrigan
d...@rudedog.org
Seattle, WA, USA



PGP.sig
Description: This is a digitally signed message part
___

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

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

Help/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: Number of images in main bundle folder (iPhone)

2009-06-25 Thread Eric E. Dolecki
Many thanks.

On Thu, Jun 25, 2009 at 6:55 PM, Steve Christensen  wrote:

> You mean that quick perusal of NSBundle.h didn't turn up anything? Maybe my
> headers are different from yours, but it was really easy to come up with
> that line myself:
>
> NSUInteger jpegCount = [[[NSBundle mainBundle] pathsForResourcesOfType:@"jpg"
> inDirectory:subDirName] count];
>
>
>
> On Jun 25, 2009, at 2:28 PM, Eric E. Dolecki wrote:
>
>  iPhone:
>> I saw someplace online where a guy got the count for the number of JPGs in
>> a
>> folder in the main bundle but I can't find that again.
>> Can anyone supply the line of code that would return something like that?
>> I'm googling now too and haven't found it yet.
>>
>
>


-- 
http://ericd.net
Interactive design and development
___

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

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

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

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


Request assistance with GCC Warnings

2009-06-25 Thread Eric Hermanson

Hello,

I realize this is really a GCC question, and not a Cocoa question, but  
I can't seem to find an adequate answer on the web.  Considering I'm  
from a strictly Java background, I was hoping someone could clue me in  
to what the following two GCC warnings mean, if I should worry about  
them, how to fix them (or how to silence the warnings):



#1 Not protecting function: no buffer at least 8 bytes long

Does the first warning have to do with the required memory boundaries  
at runtime, such that variables need to be of a power-of-two length,  
or something like that?


example problem code:   uint8_t bytes[] = {'a', 'b', 'c'};


#2: Not protecting local variables: variable length buffer

As for the second warning, I thought one could define a local buffer  
with a length that is calculated and stored into a local variable, but  
maybe not?


i.e.:  uint8_t dataBytes[count];

Thank You,
Eric


___

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

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

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

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


Re: Number of images in main bundle folder (iPhone)

2009-06-25 Thread Steve Christensen
You mean that quick perusal of NSBundle.h didn't turn up anything?  
Maybe my headers are different from yours, but it was really easy to  
come up with that line myself:


NSUInteger jpegCount = [[[NSBundle mainBundle]  
pathsForResourcesOfType:@"jpg" inDirectory:subDirName] count];



On Jun 25, 2009, at 2:28 PM, Eric E. Dolecki wrote:


iPhone:
I saw someplace online where a guy got the count for the number of  
JPGs in a

folder in the main bundle but I can't find that again.
Can anyone supply the line of code that would return something like  
that?

I'm googling now too and haven't found it yet.


___

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

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

Help/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: NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error

2009-06-25 Thread Steve Steinitz

Hi Tristan

On 25/6/09, cocoa-dev-requ...@lists.apple.com wrote:

Is there something I must do with CoreData to ensure KVO 
compliance  when using auto rearrange content? I have a small 
project I've created  to demonstrate this issue if anyone would 
care to take a look...


I've moaned about this several times on this list.  The biggest 
problem is not the exception itself (which I now handle by 
forcing a relaunch of the app) but the fact that once the 
exception occurs the app doesn't work properly: selections don't 
work etc.


You can look for KVO transgressions until your eyes bleed and 
still not prevent the exception.  One thing that's given me some 
relief is to enhance the default setters for many-to-one 
relationships like this one where a Sale sets its Customer:


- (void)
setCustomer: (Customer*) customer
{
Customer * oldCustomer = [self customer];
if (nil != oldCustomer && [customer isNotEqualTo: oldCustomer])
{
[oldCustomer removeSalesObject: self];
}
[super setCustomer: customer];
}

Good luck.  You might want to leverage the work you've already 
done on your test project by submitting it with a bug report.  
Word is Apple knows about the grief this is causing but another 
report can only help.


Best regards,

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: Debugging NSService

2009-06-25 Thread Peter Ammon

Hi Laurent,

There are a number of reasons why your Service may not appear in the  
menu.  Off the top of my head:


1) Your send and receive types may not be handleable by anything in  
the app.  In particular, NSFilenamesPboardType is not vended by  
NSTextView, so I would expect your Service to appear in the Finder,  
but not other places.  Did you check in the Finder?


2) Your Info.plist may be malformed.  On Leopard, I don't think  
there's any indication of this - it will just silently fail.  plutil  
can check for syntax errors, but I don't think there's any way to look  
for e.g. a dictionary where there should be an array, on Leopard.


3) LaunchServices may be picking up a different version of your app  
than you expect.  If multiple apps with the same bundle ID all try to  
vend Services, only one will win.  Ensure there's no other copies of  
your app on the boot volume.


4) Your app may not have been found by LaunchServices at all.   
Launching it from the Finder will ensure it gets registered.


5) pbs may not have run.  Logging out and back in should make it run  
again.


As Malcolm says, if you have access to the SnowLeopard seed, you'll  
find that Services easier to debug, with the 10.6 version of Services  
documentation describing debugging techniques.



On Jun 25, 2009, at 11:49 AM, Laurent Cerveau wrote:

Simply retrying to see if there could be any idea on this one as I  
still have trouble getting success


Thanks for the help

laurent



___

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

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

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

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


Number of images in main bundle folder (iPhone)

2009-06-25 Thread Eric E. Dolecki
iPhone:
I saw someplace online where a guy got the count for the number of JPGs in a
folder in the main bundle but I can't find that again.
Can anyone supply the line of code that would return something like that?
I'm googling now too and haven't found it yet.

Thanks,
Eric
___

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

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

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

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


Re: GC pros and cons

2009-06-25 Thread Peter Ammon


On Jun 25, 2009, at 1:42 PM, Bill Bumgarner wrote:


On Jun 25, 2009, at 3:14 PM, Peter Ammon wrote:
In any case, it's been my experience that GC makes memory  
management much easier, but precious resource management somewhat  
harder.  It's harder because GC forces more of a divorce between  
the management of memory and precious resources, and the precious  
resource management techniques are about on the level with C circa  
1989.


Really, retain/release requires such a separation, too.  At least,  
it does for relatively complex, often concurrent, piles of code.




I totally agree, which is why I said "more of" a divorce.  Since  
retain/release is more deterministic than GC, it allows you to  
tolerate ordering dependencies  and tying resource lifetime to memory  
lifetime for longer.  But it ultimately breaks down as complexity  
increases, just as you say.


The switch to GC has forced me to redesign a number of classes.  But I  
usually find that the redesigned classes work better under retain/ 
release as well.


-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: GC pros and cons

2009-06-25 Thread Peter Ammon


On Jun 25, 2009, at 1:16 PM, Peter Duniho wrote:


On Jun 25, 2009, at 12:11 PM, Kyle Sluder wrote:


[...] .NET users often call Dispose()
explicitly, because it is useful in situations other than inside  
using

blocks.


Though, to be clear (lest the tendency to want to put down the other  
be allowed to go too far)...


The requirement in .NET that Dispose() be safe to call multiple  
times has very little to do with how _client_ code is expected to  
use it, and more to do with the GC system.  In particular, the order  
of finalizer execution is indeterminate, and the usual job of a  
finalizer is to call Dispose() on the object in which it's  
implemented, which in turn may call Dispose() on other objects  
referenced by that object.


Without a requirement that Dispose() be safe to call multiple times,  
the caller of Dispose() would have to always check to see whether  
the object has been disposed yet, because an object that is being  
disposed by some other object being finalized might already have  
been disposed by the first object's finalizer.


Certainly it would be unusual, and generally a sign of sloppy  
programming, for _client_ code to call Dispose() on an object more  
than once (or for the finalizer to be executed, for that matter).   
The rules are there to make the system more robust, not to encourage  
sloppy programming (though of course, unfortunately, the former does  
sometimes lead to the latter).


Thanks for that explanation!  That makes sense.  I'm happy that the  
idempotence of Dispose() has a sane justification.

___

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

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

Help/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: GC pros and cons

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 3:14 PM, Peter Ammon wrote:
In any case, it's been my experience that GC makes memory management  
much easier, but precious resource management somewhat harder.  It's  
harder because GC forces more of a divorce between the management of  
memory and precious resources, and the precious resource management  
techniques are about on the level with C circa 1989.


Really, retain/release requires such a separation, too.  At least, it  
does for relatively complex, often concurrent, piles of code.


I'll speak anecdotally instead of making broad claims.  I have had to  
track down and fix more than a dozen bugs over the years that have all  
boiled down to exhaustion of some scarce resource such as a file  
descriptor, server connection or the like.


While the cause was sometimes simply a leak, it has often been caused  
by unexpectedly long delays until the autorelease pool was drained.


Even with leaks, a small leak is something that should be fixed, but  
is also something that you can live with for a while -- leaking 300  
allocation nodes of 48 bytes each, say, every time a document is  
closed is only 14k per document and, thus, the user is gonna have to  
open/close an awful lot of documents to cause a problem.


However, if even a subset of those 300 nodes also contains some scarce  
resource, what is a minor problem will then be a major, possibly  
catastrophic, problem.


As well, if there are any kind of ordering dependencies when tearing  
down stuff, your code's fragility will be greatly reduced by moving  
the dependencies outside of memory reclamation.  Otherwise, one stray - 
autorelease will cause the house of cards to crumble.


b.bum
___

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

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

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

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


Re: Programmatically Picking Elements

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 1:20 PM, Pierce
Freeman wrote:
> While there may be a more official name for them (outlets, maybe?), I
> consider an "element" to be any element that goes on the screen.  For
> instance a NSTextField or a NSImageView.

Ah.  Please do re-read the documentation, as it will at the very least
better inform your vocabulary.  An "outlet" is a property or instance
variable that has been tagged with the IBOutlet macro and as such is
available for wiring in Interface Builder.  For example, the
nextResponder outlet on instance of NSResponder.  Objects themselves
cannot be outlets.

The term you're looking for is "View."  Read the View Programming
Guide, especially the section on the View Hierarchy.  Everything
contained in a window is a view.  Views draw themselves in response to
-drawRect: (sometimes using helper objects like instances of NSCell).
Views can also contain other views.

> I am more going for creating a UI on the server and then displaying it on
> the client side.  Does this still fall under the category of "View
> Programming", or something different entirely?

First off, only tackle this if you are incredibly comfortable with the
view hierarchy and Cocoa in general.  You're going to need to
understand a lot about how views work, much more than just playing
around with IB will tell you.

Secondly, you're going to need a very sharp delineation between your
business-side concept of a user interface and the Cocoa concept of a
user interface.  Your business terms, for example, might include
things such as "List of People" or "Expense Report."  Your Cocoa terms
are things like NSTableView and NSTextFieldCell.  Your biggest
challenge is going to be drawing the line between these two things,
and sometimes it's very difficult to say what is a business
requirement and what is an implementation detail.  You're only ready
to make these distinctions when you've had quite a bit of experience
with the framework.

Third, don't expect to implement a web-based Interface Builder.  You
will set yourself up for failure quite quickly.  Resist the temptation
to offer your users a generic table in which they can create columns,
bind controls to business objects, etc.  There's a tool that does that
already, and its name is Interface Builder.  It sounds like you're
developing an internal application -- despite the fact that this setup
allows for greater communication and faster turnaround between the
developers and the customers, too often developers (myself included)
have taken a very release-oriented attitude.  You don't need to make a
super-generic tool that your customers can use to implement their
dream interface.  You have the convenience of proximity, which means
the customer can walk down the hall and say: "We need a window that
looks like X so we can do Y."  Those of us in the consumer software
market would kill for this kind of customer interactivity.  Besides,
do your customers really want to learn how to make an interface?
They've got more important things to do!

In short, don't try to obsolete yourself.  You will wind up with
happier customers if you accept your limitations and they accept
theirs.  Take advantage of your situation: iterate frequently, be
responsive to customer needs, and don't be afraid to say "no" to crazy
requirements proposals -- including your own.

Read the docs and play around with Cocoa a bit more before attempting
a project of such a scale as the one you've described.  Remember the
tenet of "Make One To Throw Away," and have fun while doing it.

--Kyle Sluder
___

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

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

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

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


Re: IBPlugin embedding question

2009-06-25 Thread Shawn Erickson
On Thu, Jun 25, 2009 at 11:33 AM, Doug Scott wrote:

> Perhaps there is something basically wrong in the way I'm making IBPlugin 
> projects...

That was essentially my point. I think you are trying to use them in a
way that doesn't give you much benefit and possibly ignoring another
way that may be more aligned to what you want. Step back from the
plugins... consider creating xib 1, xib 2, and xib 3 that together get
what you want at runtime. This could be shared across projects. As you
modify the nib all project feel the effects since xib is what you use
at runtime while the plugin is essentially a template/tool extension
used when modifying xibs.

Anyway it is hard to fully grasp/express all of the nuances of what
you are doing, what you want to do, and what I am trying say in
email... so I am just trying to point out a different way to think
about it and see if helps you get closer to what you want.

Also do you know that you can drag a set of objects into a xib,
configure them, wire them up, etc. and then drag a parent (assuming
view containment, etc.) back into the object library. This then become
a template that you can use in future.

-Shawn
___

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

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

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

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


Re: icns to Icon\r

2009-06-25 Thread Michael Hanna
Hi Mike, no actually, I got it working from the command-line. The
icnsConverter tool makes a .rsrc file(not Icon\r as previously stated)
which I can use at the command line. Using ditto to copy the rsrc into
the target pkg and then SetFile -a C on it creates the custom icon.

Michael

On Thu, Jun 25, 2009 at 10:38 AM, Michael Ash wrote:
> On Thu, Jun 25, 2009 at 9:52 AM, Michael Hanna wrote:
>> I forgot to mention that I would like to do this from the command-line in
>> order to automate the process. I found a solution: someone suggested I use
>> icnsConverter and that seems to generate an Icon\r. Have not tested it yet
>> though.
>
> Is there some reason you're unable to use the method in question to
> build a custom command-line tool?
>
> Mike
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/taomailings%40gmail.com
>
> This email sent to taomaili...@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: Recalculating NSTableView row sizes during a live column resize

2009-06-25 Thread Keith Blount

Thanks for your reply. I'm not so sure, though - I've tried overriding 
-inLiveResize to return NO no matter what, I've tried overriding -drawRect: and 
passing [self visibleRect] to super's -drawRect, and I've tried calling 
-display, -setNeedsDisplay: and -displayIfNeeded in various places, immediately 
upon resize, to try to force an entire redraw, but nothing has any effect - 
except, as I say, on the columns that are actually being resized. I wish I 
could find that thread which seemed to indicate some private view was used in 
the drawing during live resize, but I can't find it anywhere... Perhaps I did 
imagine it.

Thanks again,
All the best,
Keith

--- On Thu, 6/25/09, Kyle Sluder  wrote:

> From: Kyle Sluder 
> Subject: Re: Recalculating NSTableView row sizes during a live column resize
> To: "Keith Blount" 
> Cc: cocoa-dev@lists.apple.com
> Date: Thursday, June 25, 2009, 8:10 PM
> On Thu, Jun 25, 2009 at 11:10 AM,
> Keith Blount
> wrote:
> > ...Except. Only the columns that are getting resized
> (the column the user is dragging and the last auto-sized
> column in this case) get drawn correctly with the new
> heights. All of the columns in-between - the columns whose
> widths *aren't* changing - refuse to redraw no matter what I
> try (I've tried forcing display and reloading the data from
> numerous places), and instead draw using the old row heights
> until column resizing ends and they snap to where they
> should be. My wild guess (well, not exactly - I'm sure I saw
> something on Google about this earlier but now cannot find
> it) is that during live column resizing, either the table
> header view or the table view itself cache an image of the
> columns that aren't being resized as they are at the
> beginning of the drag, and show that cached image rather
> than drawing the columns live using their NSCells. At least,
> that's the only reason I can think of for these columns not
> changing their row heights when the ones
> >  being resized around them do.
> 
> I don't think they're caching any image.  Rather, the
> table view is
> probably using some sort of live resize flag to optimize
> redraw.
> Don't forget that update coalescing causes redraw not to be
> performed
> immediately.
> 
> --Kyle Sluder
> 



___

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

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

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

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


Re: Programmatically Picking Elements

2009-06-25 Thread Pierce Freeman
Hi Kyle:

While there may be a more official name for them (outlets, maybe?), I
consider an "element" to be any element that goes on the screen.  For
instance a NSTextField or a NSImageView.

I am more going for creating a UI on the server and then displaying it on
the client side.  Does this still fall under the category of "View
Programming", or something different entirely?


Thanks for your help.


On 6/25/09 1:09 PM, "Kyle Sluder"  wrote:

> What is an "element"?
> 
> Sounds like you want to show/hide portions of your user interface
> based on the data you receive from the server.  Or do you want the
> user to be able to create whatever UI they want on the server and show
> it on the client?
> 
> You're going to have to write code to do it either way.  It sounds
> like you should review the documentation, specifically the View
> Programming Guide:
> http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Intr
> oduction/Introduction.html
> 
> --Kyle Sluder


___

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

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

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

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


Re: Search in ABPeoplePickerView not working

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 2:58 AM, Nikhil
Khandelwal wrote:
> In my application i am running a Modal for a window and in that window there 
> is a button which calls another Panel (Modal is still running). In that Panel 
> i include ABPeoplePickerView to show the address. AbPeoplePickerView is 
> working but the search field in ABPeoplPickerView is not working.
> I use [adressPanel setWorksWhenModal:YES] to make the panel works but 
> searching on that Pickerview is not working :(

My guess is that the ABPeoplePickerView is written in such a way that
it performs a background search only during the normal run loop modes.

> If i bind the panel to shared User default controller, search field is 
> working but in that case execution is not continuing from where i started the 
> Modal.

This doesn't make sense to me.  Execution doesn't jump around willy-nilly.

> Its an urgent project requirement so help me ASAP.

If it's an "urgent project requirement," your best solution is not to
come to the list asking for help.  Your best solution is to know how
to implement the requirements before you begin and to build into the
schedule enough slack to compensate for unexpected obstacles like
this.  You also need to be willing to go back to your project
stakeholders and say "We need more time."  The mailing list is not
your emergency 24-hour tech support; do not come here demanding we
"help you ASAP."  If you want that, pay for a DTS incident:
http://developer.apple.com/products/support.html  I don't know of any
guarantee made about turnaround time.  What you've done is incredibly
rude.

--Kyle Sluder
___

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

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

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

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


Re: GC pros and cons

2009-06-25 Thread Peter Duniho

On Jun 25, 2009, at 12:11 PM, Kyle Sluder wrote:


[...] .NET users often call Dispose()
explicitly, because it is useful in situations other than inside using
blocks.


Though, to be clear (lest the tendency to want to put down the other  
be allowed to go too far)...


The requirement in .NET that Dispose() be safe to call multiple times  
has very little to do with how _client_ code is expected to use it,  
and more to do with the GC system.  In particular, the order of  
finalizer execution is indeterminate, and the usual job of a finalizer  
is to call Dispose() on the object in which it's implemented, which in  
turn may call Dispose() on other objects referenced by that object.


Without a requirement that Dispose() be safe to call multiple times,  
the caller of Dispose() would have to always check to see whether the  
object has been disposed yet, because an object that is being disposed  
by some other object being finalized might already have been disposed  
by the first object's finalizer.


Certainly it would be unusual, and generally a sign of sloppy  
programming, for _client_ code to call Dispose() on an object more  
than once (or for the finalizer to be executed, for that matter).  The  
rules are there to make the system more robust, not to encourage  
sloppy programming (though of course, unfortunately, the former does  
sometimes lead to the latter).


I admit, I'm not well-versed on what the equivalent paradigm in Obj-C/ 
Cocoa is.  But, surely it's useful even in Obj-C/Cocoa to provide  
protections within the language and framework against sloppy  
programming, even as it should be clear that sloppy programming isn't  
to be tolerated.


Pete
___

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

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

Help/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: GC pros and cons

2009-06-25 Thread Peter Ammon


On Jun 25, 2009, at 12:11 PM, Kyle Sluder wrote:


On Thu, Jun 25, 2009 at 11:39 AM, Peter Ammon wrote:
Are you saying that it's not sloppy to close a file twice, unlock a  
lock

twice, etc.?


It sounds to me like you were originally referring to language
implementation sloppiness, which has nothing to do with closing a file
twice, unlocking locks multiple times, etc. (client sloppiness).


Well, I can make my point with an analogy.

Anyone who has written C or C++ has committed a double free() at some  
point.  This usually indicates that parts of the program aren't  
coordinating properly.  We can apply ad-hoc fixes, but this is a  
common-enough error that it's worth coming up with a general  
solution.  Two possible solutions are:


1) Improve coordination techniques, such by adding garbage collection,  
reference counting, etc.
2) Require that malloc be robust against multiple free()s on the same  
pointer


The second solution is a lot easier to implement.  But it's really  
just papering over the problem, because double free()s are found with  
other bugs, such as deference-after-free or race conditions.


So when I see that Dispose() is required to be robust against multiple  
calls on the same object, it makes me think they encountered the same  
problem as double free(), but chose the second solution.  Client  
sloppiness thus informed the framework design.


In any case, it's been my experience that GC makes memory management  
much easier, but precious resource management somewhat harder.  It's  
harder because GC forces more of a divorce between the management of  
memory and precious resources, and the precious resource management  
techniques are about on the level with C circa 1989.


I mean, C# has the using statement, which works well as long as your  
precious resource's lifetime is tied to some scope.  And we have the  
explicit Dispose() call, which works well as long as you have some  
external way to coordinate between multiple clients of the object.   
There's an obvious analogy to stack allocation and free(), respectively.


-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: Recalculating NSTableView row sizes during a live column resize

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 11:10 AM, Keith Blount wrote:
> ...Except. Only the columns that are getting resized (the column the user is 
> dragging and the last auto-sized column in this case) get drawn correctly 
> with the new heights. All of the columns in-between - the columns whose 
> widths *aren't* changing - refuse to redraw no matter what I try (I've tried 
> forcing display and reloading the data from numerous places), and instead 
> draw using the old row heights until column resizing ends and they snap to 
> where they should be. My wild guess (well, not exactly - I'm sure I saw 
> something on Google about this earlier but now cannot find it) is that during 
> live column resizing, either the table header view or the table view itself 
> cache an image of the columns that aren't being resized as they are at the 
> beginning of the drag, and show that cached image rather than drawing the 
> columns live using their NSCells. At least, that's the only reason I can 
> think of for these columns not changing their row heights when the ones
>  being resized around them do.

I don't think they're caching any image.  Rather, the table view is
probably using some sort of live resize flag to optimize redraw.
Don't forget that update coalescing causes redraw not to be performed
immediately.

--Kyle Sluder
___

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

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

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

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


Re: Application Support Folder

2009-06-25 Thread Anthony Smith
Sorry, I didn't see that it came though. I'm new to the list so I kept  
getting the moderator bounce back and assumed it didn't go through.  
I've actually submitted this question several times.


Also, thanks for the feedback. I thought it was weird they implemented  
it using NSTemporaryDirectory for the reason you noted which is what  
made me ask the question in the first place.


On Jun 25, 2009, at 12:37 AM, Kyle Sluder wrote:

On Tue, Jun 23, 2009 at 9:02 PM, Anthony Smith> wrote:
If count is not greater than 0 then it returns an  
NSTemporaryDirectory.
What's the point? Is that check really necessary? Will there ever  
be an
instance where NSSearchPathForDirectoriesInDomains will not return  
the
NSApplicationSupportDirectory when asked for? If so, why and what  
would be

the appropriate way to handle this?


Yes.  When the user has deleted the Application Support directory.

At which point the application should probably complain and warn the
user, rather than allowing them to go on and do a whole bunch of work
only to lose it when the temp dir is flushed.  But that's your
responsibility to implement.

--Kyle Sluder




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

Re: Programmatically Picking Elements

2009-06-25 Thread Kyle Sluder
What is an "element"?

Sounds like you want to show/hide portions of your user interface
based on the data you receive from the server.  Or do you want the
user to be able to create whatever UI they want on the server and show
it on the client?

You're going to have to write code to do it either way.  It sounds
like you should review the documentation, specifically the View
Programming Guide:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaViewsGuide/Introduction/Introduction.html

--Kyle Sluder
___

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

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

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

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


copyfile missing spotlight comments?

2009-06-25 Thread John McLaughlin
Hi All,
I've got a need to get all of the Attributes of a file (including EA's) --
At wwdc I talked with some of the filesystems guys and they (very helpfully)
pointed me at a few ideas including copyfile (
http://developer.apple.com/documentation/Darwin/Reference/Manpages/man3/copyfile.3.html
)

What I can do is a copyfile with the flags COPYFILE_METADATA | COPYFILE_PACK
| COPYFILE_VERBOSE and it does a great job of picking up what appears to be
all of the various attributes -- The exact call I use is

copyfile(ifname, ofname, 0,   COPYFILE_METADATA | COPYFILE_PACK |
COPYFILE_VERBOSE);


 If I then try to unpack if using the 'reverse' command it almost works perf
ectly:


 copyfile(ofname, ifname, 0,  COPYFILE_UNPACK | COPYFILE_VERBOSE |
COPYFILE_METADATA);


Permissions, responsible app, 'finder color', all seem to unpack and get
applied to the file properly (even third party EA's seem to work properly)
-- The one thing that doesn't seem to survive is spotlight comments.


If I look in the packed file (ofname in this case) I can see the finder
comments there so I know they are being serialized properly but it doesn't
seem to transfer them when I unpack the file.


Is this expected behaviour or am I missing something?


-John
___

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

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

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

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


Re: IBPlugin embedding question

2009-06-25 Thread Quincey Morris

On Jun 25, 2009, at 11:33, Doug Scott wrote:

Perhaps there is something basically wrong in the way I'm making  
IBPlugin projects


TBH, I think that there is. Two things:

1. You're insisting (as is your right) on using IBPlugin-based access  
to your A-view in your development project for IBPlugin-B, and using  
IBPlugin-based access to your B-view in your development project for  
IBPlugin-C. That has superficial advantages, as you've stated, but  
also has the immense drawback that you must develop 3 different but  
overlapping plugins.


Consider the source code analogy. If you wanted to use class A in  
project 1, subclass B of A in project 2, and subclass C of B in  
project 3, but you *refused* to let the projects share source files,  
then you'd have to duplicate source file A (for example) in each  
project. Any changes you made to A, you'd have to make in 3 places.  
The analogy is not exact, but I think it's instructive as to why you  
seem to have too much updating to do.


2. The usefulness of IB plugins is greatest when you can develop the  
plugin and use it in many projects (or even, have others use your  
plugins in their many projects). If the plugins themselves are being  
updated as often as the projects, there's no real value in using the  
plugins at all. You're better off just copying and pasting, or just  
configuring what you want directly in IB. With your setup, the plugins  
and the projects are being updated about as often as each other.


Again, there's a superficial advantage to your current approach in  
that when you do need to place an object via IB it's easy. Again, the  
drawback is that you end up spending more time updating the plugins  
than it's worth, relative to the time spent updating the projects that  
use the plugin.


This is similar to the case with bindings. There's no point in  
developing a binding to be used once -- it's far simpler just to write  
code to observe whatever you want to observe. It's generally only  
worth providing bindings when the bindings are going to be used many,  
many times in IB.


If you place all of your views in a single plugin, all you'll lose is  
the ability to drag an A-view or a B-view into the plugin project via  
the IB palette, when building the B-view or C-view respectively.  
Creating all the views "manually" in the plugin projects may be more  
work than you want to do, but it sounds like it might be less work  
than maintaining this IBPlugin hierarchy -- which clearly annoys you  
enough to have caused you to post about it.


FWIW.

___

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

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

Help/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: Debugging NSService

2009-06-25 Thread mmalc Crawford


On Jun 23, 2009, at 7:34 AM, Laurent Cerveau wrote:

I want to add a service to my application. So I created the service  
entry in the plist, implemented the methods with proper signature,  
register the service at Application Did Finish launching time but  
unfortunately I never see my service appearing in the Services menu  
(after login and all).

How can I debug this?


Is your application in a location where it can be found?
See 


Also: There was a WWDC session this year on pasteboards and services  
which suggests there may be improvements in that area for Snow  
Leopard.  If you have access to the seeds, it would probably be worth  
checking the 10.6 version of that document for any changes.


mmalc

___

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

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

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

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


NSOutlineView selection disable

2009-06-25 Thread Arun
Hi All,

I have an application in which i use NSOutlineView Control. I need to
disable selection of items in the outlineview when the mouse is down and
select only on mouse up like in iTunes. Any ideas?

Thanks
Arun
___

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

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

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

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


Programmatically Picking Elements

2009-06-25 Thread Pierce Freeman
Hi Everyone:

I am wondering if there is some way to pick the element type (and amount of
them) shown in a xib file.  I am working on an application that needs to
take data from the server, and there are usually differing amounts of it.
For example, User A chooses on the web for there to be 10 NSTextFields.
User B chooses on the web for there to be 3 NSTextFields and 4 NSTableViews.
Is there some way to display these elements for the user using Cocoa once
the system gets the elements that you want.


Thanks for any 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: Application Support Directory Questions

2009-06-25 Thread Kyle Sluder
Did you not get my reply to the message you sent yesterday?  If you
did, please don't keep reposting to the list; we have high enough
traffic as it is.  If you didn't, check your spam folder or the list
archives at either lists.apple.com or cocoabuilder.com to make sure
your messages have gotten through.  There have been occasions where
the listserv has hiccuped and failed to send messages to every
subscriber.

--Kyle Sluder
___

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

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

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

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


Re: GC pros and cons

2009-06-25 Thread Kyle Sluder
On Thu, Jun 25, 2009 at 11:39 AM, Peter Ammon wrote:
> Are you saying that it's not sloppy to close a file twice, unlock a lock
> twice, etc.?

It sounds to me like you were originally referring to language
implementation sloppiness, which has nothing to do with closing a file
twice, unlocking locks multiple times, etc. (client sloppiness).

> Python doesn't require that its contexts be robust against multiple calls to
> __exit__ (its answer to Dispose()).

Now we're back to implementation sloppiness.  I see no guarantee that
__exit__ will only be called once.  Python users don't typically call
__enter__ and __exit__ explicitly; .NET users often call Dispose()
explicitly, because it is useful in situations other than inside using
blocks.

--Kyle Sluder
___

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

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

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

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


Re: Debugging NSService

2009-06-25 Thread Greg Guerin

Laurent Cerveau wrote:

Simply retrying to see if there could be any idea on this one as I  
still have trouble getting success



Obtain a working example of a service.
Carefully compare what it does with what yours does.
Revise as necessary.

It's usually a lot simpler to start with something that works than to  
start with something that doesn't work.  Especially if you don't know  
why the non-working thing doesn't work.


You also might find something useful here:
  http://developer.apple.com/technotes/tn2004/tn2124.html

  -- 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: GC pros and cons

2009-06-25 Thread Bill Bumgarner

On Jun 25, 2009, at 11:41 AM, Peter Duniho wrote:
Well, as far as I'm concerned that's a bug then, and a somewhat  
silly one at that.  There should be no reason they couldn't easily  
address that scenario, simply by using the thread attempting to do  
the allocation to run the collection code (with the usual  
synchronization/execution management that you'd need in any  
collection/compaction scenario).


Heh-- yes, problems always seems silly and trivial when you haven't  
studied them thoroughly.  :)


I made the assumption that this should be an easy bug to address and,  
not much research later, realized it is both very tough and not really  
that important.


The first problem is that by the time allocation failures start  
happening, the app and/or system is already so far into the weeds that  
recovery isn't really going to be possible.   For almost all  
applications, an allocation failure is only caused by other bugs in  
the app and no amount of exhaustive collection is going help.


Secondly, this problem goes away in the move to 64 bit.  More or less,  
anyway, as the collector has a limit to the total size of the GC zone.  
Given the emphasis on 64 bit in Snow Leopard and that all Macs run 64  
bit applications and have done so for quite a long time (the Mac Mini  
being the last to be updated), there were better uses of the limited  
engineering resource available.


As well, any solution that responds to rampant memory consumption by  
spinning up the CPU(s) is held as suspect by default.  It doesn't  
benefit the user experience to have an application start sucking down  
even more system resources in response to having already sucked down  
too many system resources to start with!


The one allocation failure that is terribly relevant is when  
allocation/free events outrun the collector.  That is, when there is  
so much temporary stuff being created and destroyed that the collector  
can't keep up.   This is a known issue in Leopard and has been largely  
addressed in Snow Leopard, but it is still possible to trigger said  
failure mode.


However, it is equally as often the case that such a failure mode is  
better addressed by refactoring the application to recycle objects  
instead of dealloc/alloc'ing them.


But then, that just reinforces the point that the Obj-C/Cocoa  
garbage collection implementation has some refinement left to  
accomplish.  I'm glad to hear there've been bugs submitted on the  
issue; I expect Apple will address them eventually.  Until they do,  
people who say that GC-managed memory in Cocoa isn't quite fully  
baked yet will actually have a good point.  ;)


Not really.

As noted above, allocation failures are generally a symptom and not a  
problem in and of themselves.  An application failing due to  
allocation failures is most likely suffering from one or more of a  
handful of things, none of which are specific to GC:


- leaks (Yes, you can write leaky GC code)
- poor design
- a user patient enough to throw a quantity of data at the app that  
the developer never thought possible


b.bum

___

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

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

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

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


Re: IBPlugin embedding question

2009-06-25 Thread Doug Scott


On Jun 25, 2009, at 10:56 AM, Alexander Spohr wrote:



Am 25.06.2009 um 19:20 schrieb Doug Scott:

It is just like dragging out a complex Apple provided object which  
contains embedded scrollers and such. I don't have to connect the  
Apple supplied scrollers to the Apple supplied scrolling view,  
Apple did it with embedding ( or could have if they chose to do it  
that way, I don't really know how Apple's stuff is built ).


No, Apple did it with a class that does the layout by itself.  
NSScrollView is configuring its subviews itself and on its own. It  
is not composed in IB - you know why now. IB just gives you an  
inspector and some drag'n'drop for this class.


And now you know why IB should be dynamic too. You had to code it up  
the hard way. Not good. Perfectly functional, but not good.
But I now get your point. You would like to compose some views into  
a new (super)view and have this act like a dynamic template. If you  
change the template, all users should change as well.


So you could write a view class that sets up the views you want the  
way you want them. Put that view on a palette and give it an  
inspector. If you change the implementation of your class all apps  
will pick that up on the next compile with your framework that  
contains the class. You can do pretty complex stuff then, but you  
have to do it in code.
Been there, done that, sort of. The 'do it in code' makes IB partially  
pointless. You can do it all in code if IB isn't what you like and you  
are willing to pay that particular price. Make IB dynamic and Apple  
will have something to show at the developer conference that could  
blow the crowd away. At least those of us who make IBPlugins.


Hope that gives some helping ideas,

atze

And now I have done it with embedding, and the power is awesome. I  
hope that gives Apple some ideas as to why IB should become dynamic  
and balance out the Xcode build system.



___

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

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

Help/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: Debugging NSService

2009-06-25 Thread Laurent Cerveau
Simply retrying to see if there could be any idea on this one as I  
still have trouble getting success


Thanks for the help

laurent

On Jun 23, 2009, at 5:45 PM, Laurent Cerveau wrote:

I realize I did not provide a lot of information. So the Plist of my  
apps looks like :


NSServices


NSMenuItem

default
EnclickTo

NSMessage
ec2Encrypt
NSPortName
EnclickToService
NSSendTypes

Apple URL pasteboard type
NSFilenamesPboardType




However this is more my particular case and what I would more be  
looking for is (if there is ) a method to debug this (like enabling  
a default for service verbose if there is one)


Thanks

laurent


On Jun 23, 2009, at 4:34 PM, Laurent Cerveau wrote:



Hi

I want to add a service to my application. So I created the service  
entry in the plist, implemented the methods with proper signature,  
register the service at Application Did Finish launching time but  
unfortunately I never see my service appearing in the Services menu  
(after login and all).


How can I debug this?

thanks

laurent
___

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

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

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

This email sent to lcerv...@me.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/lcerveau%40me.com

This email sent to lcerv...@me.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: GC pros and cons

2009-06-25 Thread Marcel Weiher


On Jun 25, 2009, at 0:54 , Peter Duniho wrote:


Furthermore, it is more typical that there _is_ space already  
available on the heap to satisfy an allocation request, and in a  
typical GC system allocations are much faster than for the alloc/ 
free paradigm.  I admit, I don't know the specifics of the Obj-C  
system, but in other systems an allocation is simply a matter of  
updating a _single_ pointer and of course there are no explicit  
deallocations at all.


This is true for those other systems.  It is not true for Apple's GC.   
It does not use bump-pointer allocation, and because it is not a  
copying collector, it actually does have to explicitly deallocate  
memory.  Maybe this will change in the future, but I wouldn't exactly  
hold my breath, because introducing a copying collector into a  
language with unrestricted pointers (and pointer arithmetic!) is not  
exactly trivial.




Its not reasonable to say "but virtual memory will solve that  
problem" because it just won't.


Nobody's said that.  A GC system really has practically the same  
relationship with the virtual memory manager as the retain/release  
system.


That's not entirely true:  scanning GC systems have a tendency to, as  
the name implies, scan all memory that's in use, potentially causing  
paging that an RC system will not have.  Of course, they also try to  
optimize this, and copying collectors can often do a good job of  
keeping young-space in the caches.  Alas, we don't have a copying  
collector.


As has been pointed out, this isn't a .NET list, and I don't care  
strongly about this topic, except in as much as I was expressing an  
opinion about "the things that certain people with certain mindsets  
worry about and why GC upsets them".


You're right, it's not a .NET list.  But, Java and .NET programmers  
have been working in an environment very similar to that found in  
Cocoa, except that they've been exposed to garbage collection a lot  
longer than Cocoa-only programmers have been.  While this mailing  
list is for Cocoa topics, it's useful to take advantage of lessons  
learned in other frameworks when applicable, and it's definitely  
applicable here.


The problem with that is that those lessons do not apply to the Apple  
GC!   Fast generation-scavenging copying collectors achieve very  
different performance characteristics, they can allocate objects  
order(s) of magnitude faster and incur no cost for deallocating young  
objects.  All that does not apply.


Cheers,

Marcel

___

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

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

Help/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: Ideas required on testing an application install

2009-06-25 Thread syntonica

If an new internal drive is not an option, partition and format an external USB 
and/or Firewire drive.  Make one partition for each of your target OSes and 
install them, one per partition.  Reboot and hold down the Option key.  Select 
the desired startup partition.  Enjoy.

Basically, any modern Mac can boot from either USB or Firewire.  The only 
limitation being that drive access times may be a bit sluggish, but they are 
generally acceptable. 

Kevin

~Syntonica
[kraken release];


--- On Thu, 6/25/09, Ramakrishna Vavilala  wrote:

> From: Ramakrishna Vavilala 
> Subject: Ideas required on testing an application install
> To: "Cocoa Developers" 
> Date: Thursday, June 25, 2009, 11:04 AM
> I just finished converting
> (rewriting) a windows application to work
> on Mac OSX. I made a package for my application. Now I want
> to test it
> on a clean machine. In Windows I would normally create a
> clean Virtual
> Machine and install the application to make sure that
> everything is
> working properly on a clean machine.
> 
> What kind of strategy should I use to do same level of
> testing on a
> Mac? Is buying another Mac just for testing the only other
> option? I
> know that I don't need to worry about component
> dependencies/registry
> settings like I do on Windows. But I don't want to use my
> dev machine
> for testing. Are there any tricks involved in creating a
> test
> environment?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to
> the list.
> Contact the moderators at
> cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/syntonica%40yahoo.com
> 
> This email sent to synton...@yahoo.com
> 




___

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

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

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

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


Re: Ideas required on testing an application install

2009-06-25 Thread Nick Zitzmann


On Jun 25, 2009, at 12:04 PM, Ramakrishna Vavilala wrote:


In Windows I would normally create a clean Virtual
Machine and install the application to make sure that everything is
working properly on a clean machine.

What kind of strategy should I use to do same level of testing on a
Mac?



In addition to what Michael suggested, you can also run Mac OS X  
Server in a virtual machine, starting with Leopard Server.


Nick Zitzmann


___

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

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

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

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


Re: GC pros and cons

2009-06-25 Thread Marcel Weiher


On Jun 24, 2009, at 22:49 , Greg Titus wrote:



...whereas this part talks specifically about the collector.  Is  
there a downside in SnowLeopard to CFRetain/CFRelease when not  
using the collector?


There's no _new_ downside to CFRetain/CFRelease. It's just the  
existing downside (collected process or not) that CFRetain/CFRelease  
are function calls that need to be made and code that needs to be  
executed,


You do realize that assignments under GC generate function calls?  So  
while you don't see them in your code, they still do get executed.   
And if you use accessors and let your accessors be generated (by  
@synthesize or accessor macros), the difference is negligible.


and, what's more, retain/release needs to be thread-safe, which adds  
a bit more to the expense.


Yep.

The important word in what Bill was saying is "concurrently". The  
garbage collector can work concurrently in another thread, so your  
tight loops in your compute thread(s) do less work (no CFRetain/ 
CFRelease)


My tight loops tend not to have retains/releases, because I tend to  
lift expensive operations out of performance-sensitive inner loops.   
But that's just me.


, and you get a performance advantage because your code is able to  
take more advantage of multiple cores, since memory is reclaimed in  
a separate thread, rather than that work being interleaved in your  
code in the compute thread(s).


That is a theoretical advantage (unless you are concerned about power  
consumption).  To be practical, the overhead of running the extra  
thread and the overhead of the in-thread GC code must be less than the  
overhead of RC.  Measurement helps answer that question.


Marcel

___

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

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

Help/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: GC pros and cons

2009-06-25 Thread Peter Ammon

On Jun 24, 2009, at 8:11 PM, Kyle Sluder wrote:


On Wed, Jun 24, 2009 at 7:55 PM, Peter Ammon wrote:
Microsoft even says that all objects must be robust against being  
Dispose()d
multiple times, which smacks of sloppiness.  If your program  
disposes of an
object twice, then it is structured so that independent usages of  
the object
are not coordinated, and so it is likely that one part of your  
program uses

an object after it has been disposed by another part.


It's not really sloppiness.  Python behaves the same way with its
contexts; both Python contexts and Dispose() are intended to be used
on objects that hold on to finite resources.  Similarly to Dispose(),
you can't reopen a closed NSStream.

IOW, Dispose() isn't a memory management technique, it's a
limited-resource-management technique.

--Kyle Sluder



Are you saying that it's not sloppy to close a file twice, unlock a  
lock twice, etc.?


Python doesn't require that its contexts be robust against multiple  
calls to __exit__ (its answer to Dispose()).


___

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

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

Help/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: IBPlugin embedding question

2009-06-25 Thread Doug Scott


On Jun 25, 2009, at 10:37 AM, Kevin Cathey wrote:

You should not under any circumstances modify a XIB file outside of  
IB.
I don't even build the darned things. When they first came out they  
messed up the build in ways I really didn't have time to figure out. I  
just set things to build the old way only. Problem solved. Haven't  
needed to revisit the issue. When it stops being broke I stop fixing it.


Kevin

On 24 Jun 2009, at 16:10, WT wrote:


Hi Doug,

I don't have any experience in designing and implementing IB  
plugins, but I thought I'd pass along an observation that has  
served me well on occasions when I needed to make error-prone  
changes to many similar nib files (well, xib files, actually): xib  
files are xml files, so they're amenable to text-editing.


If the changes you find yourself making are reasonably structured,  
you could write a script that processes your plugin xib files and  
add a run-script phase to your build system.


Wagner

On Jun 25, 2009, at 12:46 AM, Doug Scott wrote:


Question: How can I automate the maintenance of embedded IBPlugins.

Xcode Version 3.1.3
Interface Builder Version 3.1.2 (677)

I have developed a small series of custom IBPlugin framework  
projects, two of which include other custom IBPlugin objects. Here  
is a quick overview of the hierarchy.

- IBPlugin-A: A view with a custom API.
- IBPlugin-B: A view which adds a set of controls to manipulate  
the embedded IBPlugin-A view via its API.

- IBPlugin-C: A view which embeds two IBPlugin-B views side by side.
- Application-D: Contains a nib with a view which contains an  
IBPlugin-C view.
- Problem:  Change is pure drudgery. When I make even the most  
trivial change to IBPlugin-B I have a long string of manual 'fix- 
ups' I must do to make everything once again function correctly in  
Application-D.
- Solution of the moment: Think thrice before I make a change and  
if it is 'worth it' go ahead and change it - then pay the price.
- The price: Details withheld for brevity. Suffice it to say there  
is a lot of manual dragging and dropping and outlet connection  
repairs and terminal install builds at each level up the chain of  
IBPlugin frameworks and IBPlugin Librarys and nib views as old  
custom view objects are deleted and new ones dropped into their  
place and reconnected to their outlets. Miss one step somewhere  
and nothing works - start over dude!


Although I'm quite happy with the end results of being able to  
utilize nested IBPlugins of ever encreasing complexity I'm not at  
all happy with the ever increasing complexity needed to manually  
repair everything up the chain when I make a simple tweak to a  
lower level custom IBPlugin. This problem appears to make future  
expansion of embedded IBPlugins almost impossible to maintain as  
I'd have to do the manual fix-ups to every future IBPlugin and  
every application and every nib that used an IBPlugin that is  
modified. This way lies madness.


In the realm of compiled code I simply 'include' a framework or  
'import' external sources and it all gets picked up  
'automagically' by all code that uses external code. But in the  
'visual' world of Interface Builder it seems to require human  
intervention at every step of the way. I do not see any way for  
the different views to 'include' other views indirectly, only by  
manually adding the objects via drag and drop can an IBPlugin be  
upgraded to utilize another custom IBPlugin's visual elements. Nib  
files seem to be only a static 'snapshot' of a point in time  
during the development processes, and not really part of a modern  
dynamic build system.


I'm hoping that I missed the point somewhere along the long and  
painful journey I've travelled in my quest to pound IBPlugins into  
submission and that wiser heads will be able to lead me to wisdom.


-Doug Scott

___

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

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

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

This email sent to cat...@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: IBPlugin embedding question

2009-06-25 Thread Doug Scott


On Jun 25, 2009, at 10:36 AM, Kevin Cathey wrote:


Doug,


Normally IB plugins are intended to
provide ways to add custom views (objects) and matching inspectors to
configure those views (objects) not so much intended to do what I
think you are trying to use it for.

It sounds like you should instead create a xib/nid that contains the
shared objects with a well defined file owner that can be shared
across your applications. When you modify this xib/nib it will affect
all applications that include the xib/nib. It is trivial to load nibs
in code and stitch them into your runtime object graph.
Shawn makes a good point here. IBPlugins exist to allow you to  
create a custom view or object, write inspectors to make changes to  
your objects and views in IB in real-time, and not have to write a  
bunch of configuration code in awakeFromNib or windowDidLoad, etc.  
In some cases, this is a much preferable workflow to dragging out a  
generic NSView and setting its custom class to be your class, which  
would not warrant the ability to manipulate your class directly in IB.
Each of my IBPlugins contain an inspector, currently with no or only  
limited functionality, but adequate to my current configuration needs.



In the scenario you have described (with Plugin's A, B, and C), you  
can certainly put all of that into a single plugin. In fact, much of  
the Interface Builder library is a single plugin. This would  
probably solve many of the problems you are seeing with the "changes  
not getting updated" across plugins. I wouldn't worry too much about  
having a plugin that is used in multiple applications. For example,  
the IB library contains all of the buttons you might ever want to  
add to your application, not just the ones you might use in a single  
application. When you nib files get archived, only the controls you  
use will get archived, not the contents of the entire plugin.


Perhaps, but even within a single IBPlugin if I change the primary  
framework view object I have to manually drag it into the Library view  
and fix up all the connections which are broken when I removed the  
previous version of the Library view to make room for the new one. It  
seems that I'd just be moving the ripple problem into a single  
IBPlugin complex for little or no gain. Not good. If I don't do this  
copy of the view object from the framework nib to the Library view the  
Library object still contains the old version of the framework object  
and the resulting build and install of the IBPlugin object in the IB  
Library panel is unchanged and I have to go back and fix it and  
rebuild it. Not good.


Perhaps there is something basically wrong in the way I'm making  
IBPlugin projects, but based on the very few IBPlugin samples I have  
seen and the fact that it all does eventually work fine in my  
application I have maintained the same pattern. I couldn't get  
anything to work until I had a framework view that the framework code  
outlets deal with and this framework is what gets installed into the  
applications bundle. It is the framework view that has to be manually  
dragged into the Library view for it to appear correctly in the IB  
Library panel. If I don't do it this way all I get is a rectangle  
representing the view and no visual contents. Not good. My initial  
query to the list was in the hope that perhaps someone might be able  
to point me to the 'correct' way of building an IBPlugin if it turns  
out that my way of doing it is silly. But at the end of the day it all  
works fine, so I at least have found what I consider to be a valid way  
to beat this thing into submission, silly or not.



and not really part of a modern dynamic build system.
Interface Builder and nib files are actually more dynamic than you  
might think. For example, when you load a nib file created 3 years  
ago in a running application, the controls all have the behavior of  
the current version of the OS. In addition, you can set the custom  
class of any object in IB, and at runtime, that object assumes the  
custom class you've set. A nib file simply stores the classes that  
your objects will be at runtime, and the properties those objects  
wish to archive for loading later on as key-value pairs. I think the  
reason you are seeing issues across your plugins is that you are  
changing the properties that get archived. For example, if you  
change a button's title in Plugin B, you would have to update nibs  
in Plugin C because Plugin C had archived that button's title to be  
something else. Again, I believe making this all one plugin and  
framework would solve these problems.


Over the years I've played around with several ways of dealing with  
this and the way I now have it working is exactly the way I wanted it  
to work years ago when I started out with IB palettes. Many moons ago  
I was trying to deal with this embedding issue by using a place holder  
view and loading the nib objects via code and swapping

Re: Ideas required on testing an application install

2009-06-25 Thread Michael Dautermann
 
On Thursday, June 25, 2009, at 11:04AM, "Ramakrishna Vavilala" 
 wrote:
>I just finished converting (rewriting) a windows application to work
>on Mac OSX. I made a package for my application. Now I want to test it
>on a clean machine. 

>What kind of strategy should I use to do same level of testing on a
>Mac? Is buying another Mac just for testing the only other option? 

One thing you could do is add a new hard drive to your configuration, partition 
that hard drive into a number of volumes (onto which you can install different 
versions of MacOS), and then you can do your testing on those partitions 
without having to worry about spoiling your development hard drive.

And once you're done testing, you can wipe the partition and reinstall a new 
copy of the OS again.

Hope that suggestion helps...


___

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

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

Help/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: Fixing logged error that doesn't throw exception

2009-06-25 Thread Quincey Morris

On Jun 25, 2009, at 02:34, Tristan Celder wrote:

I'm extremely new to Cocoa programming but have come across a  
problem where I am getting a [NSConcreteAttributedString  
initWithString:] called with nil string argument. pop up in my  
console. I have had it once before and managed to track it down to a  
NumberFormatter with no symbols set for nil/null values. This  
problem was the cause of a far more serious problem which was a very  
bizarre error which breaks my core data bindings for any table view  
displaying exactly one row of an attribute fetched via a  
relationship when a document is reopened after save.


Unfortunately the console warnings have begun popping up again, and  
this time I have absolutely no idea where/who/what could be causing  
them in my interface. (It's only when I do a clean build that they  
show up in the first place). So... what I would really like to know  
is how I can find the source of these messages. A previous post I  
dug up, simply mentions that one can "test the location on the stack  
which holds the parameter." which can be done using the syntax  
"*(id*)($ebp + 16)".


Now, as I'm new to cocoa development (And C in general), my  
knowledge of gdb is limited. How would I set this breakpoint from  
xcode?


When you ask questions about errors logged on the console, you'll get  
a much more helpful response if you paste the exact text of the  
message in your post. :)


It sounds like the "console warnings" you're seeing are in fact  
exceptions -- which are very far from being warnings. When you see an  
exception logged, your application has pretty much shot itself in the  
foot, and you can't expect execution to continue correctly.


To stop in the debugger at an exception, set a symbolic breakpoint at  
(if you're using 10.5) 'objc_exception_throw' -- open the breakpoint  
window (Command-Option-B, probably), double-click where it says  
"Double-click for symbol', type in that symbol name and press Return.  
(Leave that breakpoint in, um, forever.)


Run your application with "Build and Debug" (instead of "Build and  
Run"), and it'll stop in the debugger when the exception occurs. You  
can then examine the backtrace in the debugger window to see where in  
your code the exception occurred, and how you got there.



___

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

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

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

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


Recalculating NSTableView row sizes during a live column resize

2009-06-25 Thread Keith Blount

Hello,

I have a table view that has variable row heights based on the text in one of 
the columns. These row heights get recalculated at various times, and for the 
most part, all is good. Right now I'm trying to refine things a little, though, 
and one of the things that has always bugged me slightly about the way my table 
view currently works is the way it handles column resizing. The first problem 
is that NSTableViewColumnDidResizeNotification only ever gets sent after 
columns have *finished* resizing. What this means is that when the user resizes 
a column, the row heights don't get updated until after the resize is finished 
and the user releases the mouse. So the user resizes a column, lets go of the 
mouse button, and then the rows snap to their new heights. I would prefer the 
rows to resize "live" as the column is resized.

After digging around through these lists and Googling a lot (you know you're 
hitting a brick wall when you Google something and some of the most relevant 
results are your own questions from years ago :) ), I managed to get live 
resize notifications by subclassing NSTableColumn and telling my data source to 
recalculate the row heights in -setWidth: This enables me to call the row 
resizing code during a column resize so that the rows resize live as I had 
hoped...

...Except. Only the columns that are getting resized (the column the user is 
dragging and the last auto-sized column in this case) get drawn correctly with 
the new heights. All of the columns in-between - the columns whose widths 
*aren't* changing - refuse to redraw no matter what I try (I've tried forcing 
display and reloading the data from numerous places), and instead draw using 
the old row heights until column resizing ends and they snap to where they 
should be. My wild guess (well, not exactly - I'm sure I saw something on 
Google about this earlier but now cannot find it) is that during live column 
resizing, either the table header view or the table view itself cache an image 
of the columns that aren't being resized as they are at the beginning of the 
drag, and show that cached image rather than drawing the columns live using 
their NSCells. At least, that's the only reason I can think of for these 
columns not changing their row heights when the ones
 being resized around them do.

Has anyone come across this problem or found a solution? Is there anyway of 
overriding that custom image, if that is indeed what it is?

Many thanks in advance and all the best,
Keith


  
___

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

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

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

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


Ideas required on testing an application install

2009-06-25 Thread Ramakrishna Vavilala
I just finished converting (rewriting) a windows application to work
on Mac OSX. I made a package for my application. Now I want to test it
on a clean machine. In Windows I would normally create a clean Virtual
Machine and install the application to make sure that everything is
working properly on a clean machine.

What kind of strategy should I use to do same level of testing on a
Mac? Is buying another Mac just for testing the only other option? I
know that I don't need to worry about component dependencies/registry
settings like I do on Windows. But I don't want to use my dev machine
for testing. Are there any tricks involved in creating a test
environment?
___

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

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

Help/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: Which drawing tool for a simple task

2009-06-25 Thread Steve Christensen
I can think of at least a couple of ways of doing that without  
creating a custom view:


1. Create a new image that is a composite of the original image and  
the border image, then set the view's image to the composite.


2. Create two image views that occupy the same space and put the  
border image in the back view and the original image in the front. I  
believe that if you set the image view style to be borderless that  
the view's background is not drawn so it would look like a single image.


steve


On Jun 25, 2009, at 8:30 AM, M.S. Hrishikesh wrote:

I want to display an image with a border around it. The border may  
be a simple coloured box or another image (like a wooden frame  
around an image). Can  I do this using just a ImageView?


I read parts of the Graphics and drawing guide. I am not sure if I  
need to use a custom view for this task. Could someone point me in  
the right direction ?


Thanks
Hrishi


___

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

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

Help/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: IBPlugin embedding question

2009-06-25 Thread Alexander Spohr


Am 25.06.2009 um 19:20 schrieb Doug Scott:

It is just like dragging out a complex Apple provided object which  
contains embedded scrollers and such. I don't have to connect the  
Apple supplied scrollers to the Apple supplied scrolling view, Apple  
did it with embedding ( or could have if they chose to do it that  
way, I don't really know how Apple's stuff is built ).


No, Apple did it with a class that does the layout by itself.  
NSScrollView is configuring its subviews itself and on its own. It is  
not composed in IB - you know why now. IB just gives you an inspector  
and some drag'n'drop for this class.


But I now get your point. You would like to compose some views into a  
new (super)view and have this act like a dynamic template. If you  
change the template, all users should change as well.


So you could write a view class that sets up the views you want the  
way you want them. Put that view on a palette and give it an  
inspector. If you change the implementation of your class all apps  
will pick that up on the next compile with your framework that  
contains the class. You can do pretty complex stuff then, but you have  
to do it in code.


Hope that gives some helping ideas,

atze

___

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

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

Help/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: IKImageBrowserView setSelectionIndex not selecting

2009-06-25 Thread Ramakrishna Vavilala
You need to call [imageBrowser reloadData]. When you call
setSelectionIndexes there need to be items in the list calling
reloadData will ensure that there are items.

On Thu, Jun 25, 2009 at 12:19 PM, Richard
Gutierrez wrote:
> I did place this in the awakeFromNib... I also tried placing it in 
> "updateDatasource",  "addImagesWithPath", and "addImagesWithPaths". All of 
> the calls do not work. Here is my awakeFromNib code:
>
> - (void)awakeFromNib {
>    images = [[NSMutableArray alloc] init];
>    importedImages = [[NSMutableArray alloc] init];
>
>    [imageBrowser setAllowsReordering:YES];
>    [imageBrowser setAnimates:YES];
>    [imageBrowser setDraggingDestinationDelegate:self];
>    [imageBrowser setCellsStyleMask:IKCellsStyleOutlined | 
> IKCellsStyleShadowed | IKCellsStyleTitled];
>    [imageBrowser setAllowsMultipleSelection:NO];
>    [imageBrowser setAllowsEmptySelection:NO];
>    [self populatePUB:nil];
>
>    NSDictionary *dict = [[NSBundle mainBundle] infoDictionary];
>    NSString *url = [dict objectForKey:@"MPStockImagesURL"];
>    NSArray* path = [NSArray arrayWithObject:url];
>    if (path) {
>        [NSThread detachNewThreadSelector:@selector(addImagesWithPaths:) 
> toTarget:self withObject:path];
>    }
>    [imageBrowser setSelectionIndexes:[NSIndexSet indexSetWithIndex:0] 
> byExtendingSelection:NO];
> }
>
> Any ideas??
>
> On 6/22/09 7:51 PM, "Graham Cox"  wrote:
>
>
>
> On 23/06/2009, at 10:08 AM, Richard Gutierrez wrote:
>
>> I have been researching extensively on how to set an
>> IKImageBrowserView's initial selection upon load to 0 index. Here is
>> the call I am making:
>>
>> [imageBrowser setSelectionIndexes:[NSIndexSet indexSetWithIndex:0]
>> byExtendingSelection:NO];
>>
>> Seems like the IKImageBrowserView is not fully loaded when the call
>> is made, however, I do have an IKImageView which is selecting and
>> loading the first object in the ImageBrowserView's object list
>> correctly mat the same time I am calling the same time. Here is the
>> entire call:
>>
>> - (void)updateDatasource
>
>
> Where do you call this from?
>
> You'll need to call it from -awakeFromNib to ensure the view is loaded.
>
> --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/vrk.lists%40gmail.com
>
> This email sent to vrk.li...@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: Which drawing tool for a simple task

2009-06-25 Thread I. Savant

On Jun 25, 2009, at 11:30 AM, M.S. Hrishikesh wrote:

I want to display an image with a border around it. The border may  
be a simple coloured box or another image (like a wooden frame  
around an image). Can  I do this using just a ImageView?


I read parts of the Graphics and drawing guide. I am not sure if I  
need to use a custom view for this task. Could someone point me in  
the right direction ?



  You can answer your own question by reading the NSImageView class  
reference. Hint: look at the Tasks section.


http://developer.apple.com/documentation/Cocoa/Reference/ApplicationKit/Classes/NSImageView_Class/Reference/Reference.html

--
I.S.



___

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

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

Help/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: Fixing logged error that doesn't throw exception

2009-06-25 Thread Jesper Storm Bache

You should be able to set a break point on asl_send
Jesper

On Jun 25, 2009, at 2:34 AM, Tristan Celder wrote:


Hi,

I'm extremely new to Cocoa programming but have come across a problem
where I am getting a [NSConcreteAttributedString initWithString:]
called with nil string argument. pop up in my console. I have had it
once before and managed to track it down to a NumberFormatter with no
symbols set for nil/null values. This problem was the cause of a far
more serious problem which was a very bizarre error which breaks my
core data bindings for any table view displaying exactly one row of an
attribute fetched via a relationship when a document is reopened after
save.

Unfortunately the console warnings have begun popping up again, and
this time I have absolutely no idea where/who/what could be causing
them in my interface. (It's only when I do a clean build that they
show up in the first place). So... what I would really like to know is
how I can find the source of these messages. A previous post I dug up,
simply mentions that one can "test the location on the stack which
holds the parameter." which can be done using the syntax "*(id*)($ebp
+ 16)".

Now, as I'm new to cocoa development (And C in general), my knowledge
of gdb is limited. How would I set this breakpoint from xcode?

Thank you in advance, T.
___

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

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

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

This email sent to jsba...@adobe.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: Hide Interface Builder Object?

2009-06-25 Thread Kevin Cathey
Any of Peter's solutions is what I would recommend as well. There is  
no built-in way to just "hide" an object from IB's design canvas while  
still having be in the document. If you feel this should not be the  
case, please file a bug.


Kevin

On 25 Jun 2009, at 01:21, Peter N Lewis wrote:



Some easy solutions would be:

* Create the view programatically - presumably it covers an entire  
view (or the content view), so creating the view and sizing it to  
the other view would be trivial and not need to be positioned/ 
adjusted in Interface Builder.


* Move the view to the back in Interface Builder (ie, drag it to the  
top of the list in the outline view).  Then programatically move it  
to the front.


* Offset it by 1000 pixels, and then offset it back programatically.

Enjoy,
  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: IBPlugin embedding question

2009-06-25 Thread Kevin Cathey

You should not under any circumstances modify a XIB file outside of IB.

Kevin

On 24 Jun 2009, at 16:10, WT wrote:


Hi Doug,

I don't have any experience in designing and implementing IB  
plugins, but I thought I'd pass along an observation that has served  
me well on occasions when I needed to make error-prone changes to  
many similar nib files (well, xib files, actually): xib files are  
xml files, so they're amenable to text-editing.


If the changes you find yourself making are reasonably structured,  
you could write a script that processes your plugin xib files and  
add a run-script phase to your build system.


Wagner

On Jun 25, 2009, at 12:46 AM, Doug Scott wrote:


Question: How can I automate the maintenance of embedded IBPlugins.

Xcode Version 3.1.3
Interface Builder Version 3.1.2 (677)

I have developed a small series of custom IBPlugin framework  
projects, two of which include other custom IBPlugin objects. Here  
is a quick overview of the hierarchy.

- IBPlugin-A: A view with a custom API.
- IBPlugin-B: A view which adds a set of controls to manipulate the  
embedded IBPlugin-A view via its API.

- IBPlugin-C: A view which embeds two IBPlugin-B views side by side.
- Application-D: Contains a nib with a view which contains an  
IBPlugin-C view.
- Problem:  Change is pure drudgery. When I make even the most  
trivial change to IBPlugin-B I have a long string of manual 'fix- 
ups' I must do to make everything once again function correctly in  
Application-D.
- Solution of the moment: Think thrice before I make a change and  
if it is 'worth it' go ahead and change it - then pay the price.
- The price: Details withheld for brevity. Suffice it to say there  
is a lot of manual dragging and dropping and outlet connection  
repairs and terminal install builds at each level up the chain of  
IBPlugin frameworks and IBPlugin Librarys and nib views as old  
custom view objects are deleted and new ones dropped into their  
place and reconnected to their outlets. Miss one step somewhere and  
nothing works - start over dude!


Although I'm quite happy with the end results of being able to  
utilize nested IBPlugins of ever encreasing complexity I'm not at  
all happy with the ever increasing complexity needed to manually  
repair everything up the chain when I make a simple tweak to a  
lower level custom IBPlugin. This problem appears to make future  
expansion of embedded IBPlugins almost impossible to maintain as  
I'd have to do the manual fix-ups to every future IBPlugin and  
every application and every nib that used an IBPlugin that is  
modified. This way lies madness.


In the realm of compiled code I simply 'include' a framework or  
'import' external sources and it all gets picked up 'automagically'  
by all code that uses external code. But in the 'visual' world of  
Interface Builder it seems to require human intervention at every  
step of the way. I do not see any way for the different views to  
'include' other views indirectly, only by manually adding the  
objects via drag and drop can an IBPlugin be upgraded to utilize  
another custom IBPlugin's visual elements. Nib files seem to be  
only a static 'snapshot' of a point in time during the development  
processes, and not really part of a modern dynamic build system.


I'm hoping that I missed the point somewhere along the long and  
painful journey I've travelled in my quest to pound IBPlugins into  
submission and that wiser heads will be able to lead me to wisdom.


-Doug Scott

___

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

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

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

This email sent to cat...@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: IBPlugin embedding question

2009-06-25 Thread Kevin Cathey

Doug,


Normally IB plugins are intended to
provide ways to add custom views (objects) and matching inspectors to
configure those views (objects) not so much intended to do what I
think you are trying to use it for.

It sounds like you should instead create a xib/nid that contains the
shared objects with a well defined file owner that can be shared
across your applications. When you modify this xib/nib it will affect
all applications that include the xib/nib. It is trivial to load nibs
in code and stitch them into your runtime object graph.
Shawn makes a good point here. IBPlugins exist to allow you to create  
a custom view or object, write inspectors to make changes to your  
objects and views in IB in real-time, and not have to write a bunch of  
configuration code in awakeFromNib or windowDidLoad, etc. In some  
cases, this is a much preferable workflow to dragging out a generic  
NSView and setting its custom class to be your class, which would not  
warrant the ability to manipulate your class directly in IB.


In the scenario you have described (with Plugin's A, B, and C), you  
can certainly put all of that into a single plugin. In fact, much of  
the Interface Builder library is a single plugin. This would probably  
solve many of the problems you are seeing with the "changes not  
getting updated" across plugins. I wouldn't worry too much about  
having a plugin that is used in multiple applications. For example,  
the IB library contains all of the buttons you might ever want to add  
to your application, not just the ones you might use in a single  
application. When you nib files get archived, only the controls you  
use will get archived, not the contents of the entire plugin.




and not really part of a modern dynamic build system.
Interface Builder and nib files are actually more dynamic than you  
might think. For example, when you load a nib file created 3 years ago  
in a running application, the controls all have the behavior of the  
current version of the OS. In addition, you can set the custom class  
of any object in IB, and at runtime, that object assumes the custom  
class you've set. A nib file simply stores the classes that your  
objects will be at runtime, and the properties those objects wish to  
archive for loading later on as key-value pairs. I think the reason  
you are seeing issues across your plugins is that you are changing the  
properties that get archived. For example, if you change a button's  
title in Plugin B, you would have to update nibs in Plugin C because  
Plugin C had archived that button's title to be something else. Again,  
I believe making this all one plugin and framework would solve these  
problems.



Kevin

___

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

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

Help/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: NSArrayController's add: swaps entire content array when array is accessed via keypath

2009-06-25 Thread Quincey Morris

On Jun 25, 2009, at 07:31, Rick Hoge wrote:

I recently tried a design where a certain object had an  
NSMutableDictionary instance variable, which in turn contained an  
NSMutableArray entry.  After initializing this setup (in -init) as  
shown here:


 topLevelDictionary = [NSMutableDictionary dictionary]; // An  
instance variable - I'm using GC
 [topLevelDictionary setValue:[NSMutableArray array]  
forKey:@"subArray"];


I then proceeded to add an NSTableView and NSArrayController to the  
nib file, binding the controller's content array to the keypath  
"topLevelDictionary.subArray"


...

All worked fine, except that, when the new dictionaries are added by  
clicking the add: button, the mutable array managed by the  
controller is replaced with a new array (rather than inserting the  
new dictionary in the original array).  The new array has the  
correct content, apparently having copied all the pre-existing  
dictionaries from the old array.


This is correct. NSMutableDictionary implements 'setValue:forKey:' (as  
a convenience, to provide very basic KVC compliance) but it doesn't  
implement any indexed accessors, so the array is updated via this  
'setValue:forKey:', which means that the array is completely replaced.


If you look at:

	http://developer.apple.com/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/SearchImplementation.html#/ 
/apple_ref/doc/uid/2955-SW2


you'll see that case (1) doesn't apply, but case (2) does.

I confirmed that if subArray is promoted to an instance variable,  
then add: will perform an insertion rather than creating a new array  
(in fact I've used this a lot in the past).  It seems that having  
the array be part of a mutable compound object results in creation  
of a new, copied array instead of an insertion.


Presumably you haven't overridden 'accessInstanceVariablesDirectly:'  
to return NO in your "certain object", so now case (3) applies, and  
that results in the array being updated instead of replaced.


The problem you've got is that you want "subArray" to behave like a  
fully KVO compliant indexed property, but you haven't implemented it  
as such.



___

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

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

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

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


Application Support Directory Questions

2009-06-25 Thread Anthony Smith
I'm beginning to delve into Core Data and I've been looking at the  
generated code for the Xcode Core Data project. I'm finding their  
implementation of -applicationSupportFolder interesting. They grab the  
NSApplicationSupportDirectory using  
NSSearchPathForDirectoriesInDomains, which makes sense, but then they  
go on to do a check to make sure the directory was retrieved looking  
at the item count in the returned NSArray. If count is not greater  
than 0 then it returns an NSTemporaryDirectory. What's the point? Is  
that check really necessary? Will there ever be an instance where  
NSSearchPathForDirectoriesInDomains will not return the  
NSApplicationSupportDirectory when asked for? If so, why and what  
would be the appropriate way to handle this?


Anthony

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

Which drawing tool for a simple task

2009-06-25 Thread M.S. Hrishikesh

Hi

I want to display an image with a border around it. The border may be a 
simple coloured box or another image (like a wooden frame around an 
image). Can  I do this using just a ImageView?


I read parts of the Graphics and drawing guide. I am not sure if I need 
to use a custom view for this task. Could someone point me in the right 
direction ?


Thanks
Hrishi
___

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

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

Help/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: Cocoa and email (SMTP/POP3) (thanks)

2009-06-25 Thread Isaac Alston
Hi,

I just want to say thank you to everyone who responded to my question.

-- 
Isaac
___

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

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

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

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


NSArrayController "Auto Rearrange Content" causes "Cannot remove an observer for key path" error

2009-06-25 Thread Tristan Celder

Hi,

I've been fighting an issue for some time now which seems to rear its  
head when I set Auto Rearrange Content to true on an  
NSArrayController. Whenever I do this it seems to throw a 'Can't  
remove an observer  for key path "x". It always occurs when I am  
trying to access a relationship of the entity I am managing within an  
array controller, yielding the following kind of error Cannot remove  
an observer  for the key path "person.name"  
from , most likely because the value for the  
key "person" has changed without an appropriate KVO notification being  
sent. Check the KVO-compliance of the NSManagedObject class.


Also, this only happens with a specific scenario: when I re-open a  
saved document with exactly one row of the entity being managed by the  
auto rearranged array controller.


Is there something I must do with CoreData to ensure KVO compliance  
when using auto rearrange content? I have a small project I've created  
to demonstrate this issue if anyone would care to take a look...


Any help, greatly appreciated...
___

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

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

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

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


Badge color in Leopard

2009-06-25 Thread Mika Kuuskankare

Hi,

I'm a newbie on this list so hello everybody.

I was wondering if somebody could tell me if it is possible to set/ 
change the background color of the badge (dockTile) in Leopard? The  
default seems to be red. I'm now calling this through a FFI but the  
call translates to something like this:


NSDockTile *badge = [[NSApplication sharedApplication] dockTile];
[badge setBadgeLabel:@"1"];


best,

Dr. Mika Kuuskankare
Researcher
Centre for Music & Technology
Sibelius Academy

Henkilökohtainen postiosoite/Personal post address
PL 342 - PO Box 342
FIN-00121 Helsinki, FINLAND
Mobile: +358 (0)40 5415 233 (Finland)
Skype: mkuuskan
personal home page: www.siba.fi/~mkuuskan
project home page: www.siba.fi/PWGL






___

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

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

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

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


Fixing logged error that doesn't throw exception

2009-06-25 Thread Tristan Celder

Hi,

I'm extremely new to Cocoa programming but have come across a problem  
where I am getting a [NSConcreteAttributedString initWithString:]  
called with nil string argument. pop up in my console. I have had it  
once before and managed to track it down to a NumberFormatter with no  
symbols set for nil/null values. This problem was the cause of a far  
more serious problem which was a very bizarre error which breaks my  
core data bindings for any table view displaying exactly one row of an  
attribute fetched via a relationship when a document is reopened after  
save.


Unfortunately the console warnings have begun popping up again, and  
this time I have absolutely no idea where/who/what could be causing  
them in my interface. (It's only when I do a clean build that they  
show up in the first place). So... what I would really like to know is  
how I can find the source of these messages. A previous post I dug up,  
simply mentions that one can "test the location on the stack which  
holds the parameter." which can be done using the syntax "*(id*)($ebp  
+ 16)".


Now, as I'm new to cocoa development (And C in general), my knowledge  
of gdb is limited. How would I set this breakpoint from xcode?


Thank you in advance, T.
___

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

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

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

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


Replacing chars in UITextField

2009-06-25 Thread DKJ
I'd like to make some character substitutions in a UITextField while  
the user is typing. For example, when the user types "C", I'd like an  
arrow (\u2192) to appear in the textfield instead.


I've been playing with the textField:shouldChangeCharactersInRange  
delegate method. But I don't see how to get it to do what I want.


Any ideas?

dkj
___

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

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

Help/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: IBPlugin embedding question

2009-06-25 Thread Doug Scott


On Jun 25, 2009, at 9:52 AM, Shawn Erickson wrote:

On Thu, Jun 25, 2009 at 9:35 AM, Doug Scott  
wrote:


The point is that the way IB seems to work today is static when it  
must
become dynamic if developers are to be able to embed IBPlugins  
within each
other in the way I've done, which I've found to be incredibly  
powerful and
useful. It is just that in my own relatively simple experiments I  
have found
this technique to be incredibly difficult to maintain during  
development due
to its manual nature. Once I stop fiddling with things and my  
IBPlugins

becomes static again everything is fine, but during development it is
anything but static. Thus my query in the hopes that I missed  
something that
IB could do for me that I'm currently dealing with manually ( the  
hard way )

and at great expense of time and sanity.


Humm you appear to be using IB plugins to bag up pre-configured
objects that you want shared across applications in a dynamic fashion
(not what they are designed for). Normally IB plugins are intended to
provide ways to add custom views (objects) and matching inspectors to
configure those views (objects) not so much intended to do what I
think you are trying to use it for.

It sounds like you should instead create a xib/nid that contains the
shared objects with a well defined file owner that can be shared
across your applications. When you modify this xib/nib it will affect
all applications that include the xib/nib. It is trivial to load nibs
in code and stitch them into your runtime object graph.

-Shawn
I'm using them just the way I want and they work just the way I want.  
Happy, happy, joy, joy! It is the problem of maintaining the embedding  
chain that is the only issue.


I feel like Apple has provide me with a wonderful nice shiny new chain- 
saw and I've finally figured out how to use it to knock over huge  
trees, but the forest is large and I just wish my shiny new chain-saw  
had an engine.


-Doug
___

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

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

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

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


  1   2   >