Capture video from core animation (QC)

2009-01-14 Thread Jonathan Selander

Hi,

I've made a funny cuartz composition with a couple of video filters,  
webcam, and so on, and now i'd like to record it to a video file (like  
quicktime). Question is, do i need to use OpenGL and render each frame  
or whatever, or is there an easier way to accomplish this?


Thanks
___

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

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

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

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


non scrolling table view header...

2009-01-14 Thread Oscar Alejandro Alvarado Prieto
Hi, I'm trying to obtain a table header that doesn't disappear when
scrolling rows. tableHeader/Footer properties support custom views that
scroll with rows and so disappear.
Please, anyone knows how to do this?

Thanks in advance

-- 
Oscar A. Alvarado
___

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

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

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

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


KVC error from bound SortDescriptor

2009-01-14 Thread Steven Hamilton

Hi folks,
I have a customer WindowController class and within it I have a method  
that returns a NSSortDescriptor. Like this;


-(NSArray *)nameSortDescriptors
{
NSSortDescriptor *sorter;
sorter = [[[NSSortDescriptor alloc]
   initWithKey: @name
   ascending: YES] autorelease];
return ([NSArray arrayWithObject: sorter]);
}

In my NIB I have an NSArrayController serving a Core Data entity  
called Account. I've bound this entity to the SortDescriptor above  
and the data is displayed in a bound NSTableview.


I'm getting the following error whenever I click the column header to  
re-order the tableView and I can't understand why the array controller  
is trying to set the sortdescriptor method or what to do to surpress it.


Error setting value for key path nameSortDescriptors of object  
MLAccountController: 0x58ae390 (from bound object  
NSArrayController: 0x589d1a0[entity: Account, number of selected  
objects: 1](null)): [MLAccountController 0x58ae390  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key nameSortDescriptors.



___

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

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

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

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


Service request fails if provider has not yet launched

2009-01-14 Thread an00na
My app provides a System Service, which works well if it is running when  
the request arrives;
however, if the request rises and my app has not yet launched, the Service  
is failed to be served,

even though my app can be launched normally by the Service request.

Here is the corresponding Console log message:
PM Safari[368] Application XXX never opened its Services port before the  
timeout.


But I'm sure that my app has been ready before the timeout which is the  
default 30s, since I register
the Service provider in my applicationDidFinishLaunching:(NSNotification *)  
after
all the preparation work is done, and the time needed to get to that point  
is no more than 15s.


I can't figure out what is missed after perusing the System Service section  
of Dev Doc.


Any hint will be appreciated, and any further info will be supplemented if  
needed.


Thanks in advance.
___

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

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

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

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


Re: Service request fails if provider has not yet launched

2009-01-14 Thread Kevin Gessner

On Jan 14, 2009, at 8:56 AM, an0...@gmail.com wrote:

My app provides a System Service, which works well if it is running  
when the request arrives;
however, if the request rises and my app has not yet launched, the  
Service is failed to be served,

even though my app can be launched normally by the Service request.

Here is the corresponding Console log message:
PM Safari[368] Application XXX never opened its Services port before  
the timeout.


But I'm sure that my app has been ready before the timeout which is  
the default 30s, since I register
the Service provider in my applicationDidFinishLaunching: 
(NSNotification *) after
all the preparation work is done, and the time needed to get to that  
point is no more than 15s.


I can't figure out what is missed after perusing the System Service  
section of Dev Doc.


Any hint will be appreciated, and any further info will be  
supplemented if needed.


Without seeing some code, I can only offer a couple general ideas:

1. Are you sure that applicationDidFinishLaunching:(NSNotification *)  
is being called? If you've got your app delegate wired up wrong, then  
you'd never receive this notification.
2. Are you passing the right object to -[NSApplication  
setServicesProvider:]?
3. Do you implement the proper service method? A typo could be  
preventing the service from being found.


HTH
-- Kevin

Kevin Gessner
http://kevingessner.com
ke...@kevingessner.com






___

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

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

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

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


Re: File association

2009-01-14 Thread Benjamin Stiglitz
 I saved the project using NSArchiver with an extension say .myExtension. And
 also I opened the saved project by unachieved it from menu. Now I need to
 open the saved project when double clicking on it.
 
 How can I do this file association?

See the Runtime Configuration Guidelines:
http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/PListKeys.html#//apple_ref/doc/uid/20001431-101685

 Where I need to write code for unarchiving its content ?

You should read about the Cocoa document architecture:
http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/Documents/Documents.html

-Ben
___

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

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

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

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


Re: How to center a custom NSView in a NSScrollView

2009-01-14 Thread Benjamin Stiglitz
 I've already tried with a custom NSClipView, as explained here:

 http://www.bergdesign.com/missing_cocoa_docs/nsclipview.html

This is the standard way to do this.

 The question is, how can I center a custom NSView in a NSScrollView, if 
 the visible width and/or height is greater than the fixed size of the 
 NSScrollView?

What does centering mean if the view’s size is larger than that of the
scroll view?

-Ben
___

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

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

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

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


Re: Constructing class names dynamically

2009-01-14 Thread Adam Venturella
The output is the same, but there is also:
#import objc/runtime.h
objc_getClass([myString UTF8String]);

I am going to guess that NSClassFromString(myString) is probably using
objc_getClass(), maybe not.  I didn't know NSClassFromString existed
though, so I am switching to that instead of using the runtime.h
function.




On Tue, Jan 13, 2009 at 8:45 PM, Mohan Parthasarathy surut...@gmail.com wrote:
 On Tue, Jan 13, 2009 at 8:06 PM, Ken Thomases k...@codeweavers.com wrote:

 On Jan 13, 2009, at 3:33 PM, Jean-Daniel Dupas wrote:

  he is just talking about class name, not class.

 NSClassFromString() is probably what you're looking for.

 NSMutableString *clsName = derive class name from the entry.

 Class cls = NSClassFromString(clsName);

 idYouProtocol instance = [[cls alloc] init];


 I'll just add the following:

 If you don't need such complete flexibility -- for example, if you're
 selecting from a fixed set of classes by some tag -- then you don't need to
 compute a class name and look up the class that way.

 Classes are objects and so they can be stored in collections.  For example,
 you could have a lookup dictionary that mapped from keys to class objects.
  You would construct the dictionary like this:

[NSDictionary dictionaryWithObjectsAndKeys:
[SomeClass class], key1,
[OtherClass class], key2,
[ThirdClass class], key3,
// ... etc.
nil];

 This adds a small amount of safety in the same way that
 statically-specified stuff generally does.  For example, the compiler will
 catch typos in class names.


 Thanks for this suggestion. This looks fairly clean except that the space is
 allocated at the beginning. This may not be a big deal in some cases. In the
 other way, you allocate space and insert in the dictionary only when needed.
 Also, eventually i need the real object instances inserted in the
 dictionary.

 -mohan


 -mohan



 Cheers,
 Ken


 ___

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

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

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

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

___

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

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

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

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


Re: How font size managed without affecting the font? Please help

2009-01-14 Thread Benjamin Stiglitz
 I use this code to change the fontsize:
 
 NSFont *font1 = [NSFont fontWithName:[pop1 titleOfSelectedItem] size:[[pop2
 titleOfSelectedItem] doubleValue]];

In the second popup’s action method, you should be invoking
-[NSFontManager convertFont:toSize:] to convert the fonts to the right
size. (And, in the first popup, -[NSFontManager convertFont:toFace:].)

http://developer.apple.com/DOCUMENTATION/Cocoa/Reference/ApplicationKit/Classes/NSFontManager_Class/Reference/Reference.html#//apple_ref/occ/instm/NSFontManager/convertFont:toSize:

-Ben
___

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

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

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

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


Re: Seamlessly converting any type of document to PDF?

2009-01-14 Thread Scott Ribe
If you can direct the application via AppleScript to print the document to
the default printer, then you can set up a printer that prints to a PDF
file, and switch the printer programmatically. (Combination of lpadmin 
defaults write commands.)

-- 
Scott Ribe
scott_r...@killerbytes.com
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

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


Re: Capture video from core animation (QC)

2009-01-14 Thread Jonathan Selander
Okay, so if I understood correctly, i need to set up an OpenGL context  
(in order to capture frames) which I use with a QCRenderer, and then  
render each frame manually? Am I on the right track?



14 jan 2009 kl. 16.25 skrev douglas welton:

If you just want to record your composition, try something like  
QuartzCrystal by Kineme.  If you want to add recording functionality  
to your application take a look at the QCTV sample code.


On Jan 14, 2009, at 5:38 AM, Jonathan Selander wrote:

I've made a funny cuartz composition with a couple of video  
filters, webcam, and so on, and now i'd like to record it to a  
video file (like quicktime). Question is, do i need to use OpenGL  
and render each frame or whatever, or is there an easier way to  
accomplish this?




___

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

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

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

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


Re: Relaunch App (Quit, Relaunch If Quit)?

2009-01-14 Thread Chunk 1978
thanks!  your way seems much easier :)

On Wed, Jan 14, 2009 at 10:36 AM, Jean-Daniel Dupas
devli...@shadowlab.org wrote:
 The proper way to do it is probably to listen for Finder death using a
 timeout, not polling the process list.

 You can either use the NSWorkspaceDidTerminateApplicationNotification or use
 the low level kqueue function which provide such facility.

 Le 14 janv. 09 à 16:25, Chunk 1978 a écrit :

 my goal is to quit an app, check to see if it has quit, and then
 relaunch the app if it has quit successfully.  i'm sending
 quit/relaunch commands with applescripts (tell application Finder |
 quit | end tell, tell application Finder | launch | end tell), and
 i'm attempting to make this code work without using any type of delay
 mechanism but i'm lost.

 the following code works very well on quitting and relaunching the
 Finder, except if the Finder is busy (copying a file, or something),
 the program will continuously try to quit the finder while the finder
 prompts that it's busy - it's a continuous loop... a bad scene...

 essentially i need to somehow figure out how to have this loop quit
 the finder, but stop the loop if it's busy...

 -=-=-=-

 - (IBAction)restartFinder:(id)sender
{
//Quit Finder
NSDictionary* errorDict = nil;
NSAppleEventDescriptor *returnDescriptor = nil;
returnDescriptor = [quitFinderScriptObject
 executeAndReturnError:errorDict];

//Check To See If Finder Has Quit
NSWorkspace *ws = [NSWorkspace sharedWorkspace];
NSArray *runningAppDictionaries = [ws launchedApplications];
NSDictionary *aDictionary;

for (aDictionary in runningAppDictionaries)
{
//If Finder Hasn't Quit Then Return
if ([[aDictionary
 valueForKey:@NSApplicationBundleIdentifier]
 isEqualToString:@com.apple.finder])
{
[self restartFinder:nil];
return;
break;
}
}

//If Finder Has Quit Then Continue To Relaunch Finder
NSDictionary* errorDict = nil;
NSAppleEventDescriptor *returnDescriptor = nil;
returnDescriptor = [startFinderScriptObject
 executeAndReturnError:errorDict];
}

 -=-=-=-
 ___

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

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

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

 This email sent to devli...@shadowlab.org



___

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

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

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

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


Re: KVC error from bound SortDescriptor

2009-01-14 Thread Keary Suska


On Jan 14, 2009, at 4:54 AM, Steven Hamilton wrote:

I have a customer WindowController class and within it I have a  
method that returns a NSSortDescriptor. Like this;


-(NSArray *)nameSortDescriptors
{
NSSortDescriptor *sorter;
sorter = [[[NSSortDescriptor alloc]
   initWithKey: @name
   ascending: YES] autorelease];
return ([NSArray arrayWithObject: sorter]);
}

In my NIB I have an NSArrayController serving a Core Data entity  
called Account. I've bound this entity to the SortDescriptor above  
and the data is displayed in a bound NSTableview.


I'm getting the following error whenever I click the column header  
to re-order the tableView and I can't understand why the array  
controller is trying to set the sortdescriptor method or what to do  
to surpress it.


Error setting value for key path nameSortDescriptors of object  
MLAccountController: 0x58ae390 (from bound object  
NSArrayController: 0x589d1a0[entity: Account, number of selected  
objects: 1](null)): [MLAccountController 0x58ae390  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key nameSortDescriptors.


The sortDescriptors binding is just like any other binding. Just like  
when binding to a text field, when you edit the text field, the  
binding causes your model's bound value to change as well. So, when  
you try to reorder the tableview, you are altering the sort  
descriptors, so the binding tries to change your model's bound  
property. You have two choice: 1) don't allow the table to be re- 
sorted; or 2) make nameSortDescriptors key value coding compliant.


HTH,

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


Re: UTIs and type codes and extensions

2009-01-14 Thread Randall Meadows

On Jan 14, 2009, at 7:48 AM, Sean McBride wrote:


On 1/14/09 2:31 AM, Julien Jalon said:


I'm just making sure I'm not missing something...

There's no system-defined way to go from a UTI to an old-style  
file type
code (which the UTI docs seem to refer to as a tag) and back  
again, am I

correct?



extern CFStringRef
UTTypeCopyPreferredTagWithClass(
CFStringRef   inUTI,
CFStringRef   inTagClass)
AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;


Note that none of the 'UT...' functions are documented in Xcode's  
built-
in viewer, but browsing through the .h's reveals good header  
documentation.


Whew.  So I'm not losing it.  (Well, not in this particular case,  
anyway...)



Thanks!
randy
___

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

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

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

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


Re: Strange Webview Problem

2009-01-14 Thread Michael Ash
On Tue, Jan 13, 2009 at 6:11 PM, Diez B. Roggisch de...@web.de wrote:
 Nick Zitzmann schrieb:

 On Jan 13, 2009, at 3:45 PM, Diez B. Roggisch wrote:

 Just for the record - the timoutInterval of 0 is the culprit. I don't
 have the slightest idea why it stopped working, but I don't care either. It
 might be worth mentioning in the docs though that passing 0 actually
 terminates the request immediatly, instead of setting the timeout to
 unlimited.


 That makes sense, actually. If you want the timeout interval to be
 unlimited, then you should pass in DBL_MAX, which will cause it to time out
 ~300 million years from now, by which point I assume your computer will no
 longer be around (or at least you won't be using it)... 0 usually means do
 it now when it comes to time intervals.

 But it doesn't mean do it now, it means don't do it at all...

Well no, it means do it unless it takes longer than the time I
specify, in which case give up. Of course if you specify 0 time, it
has to give up instantaneously, unless it can somehow do the work
instantaneously. Practically speaking, a 0 timeout might (might!) mean
to return cached data but not attempt to get fresh data.

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: runModalForWindow, best solution to modal session

2009-01-14 Thread Keary Suska


On Jan 13, 2009, at 12:21 PM, Alexander Reichstadt wrote:

If so, do you override -initWithWindowNibName:? The implementation  
may matter.


No, I only override initWithWindow. Should I override it, and if so  
should I call on NSBundle to load my nib there then?


I recommend that you allow NSWindoController to manage the nib, which  
it will if you override -initWithWindowNibName: instead. That alone  
may very well solve your problem. Note that you will *not*  manually  
load the nib in this override. NSWindoController will do that  
automatically, although lazily (that's why you call -window, which  
forces the nib to load).


HTH,

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


NSTableView

2009-01-14 Thread David Blanton

I thought I had this solved but I need help.

Looking at iTunes with 130 songs the table scrolls quick and resizing  
the window is snappy.


When I resize a window or split view containing a table of 30 rows or  
scroll the table  it is slow.


I have read Cocoa Performance Guidelines.  I cannot get a call to  
preservesContentDuringLiveResize for my table view.


So, how can I make my users happy with a snappy table view during  
resize operations?


David Blanton





___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Corbin Dunn


On Jan 14, 2009, at 9:14 AM, David Blanton wrote:


I thought I had this solved but I need help.

Looking at iTunes with 130 songs the table scrolls quick and  
resizing the window is snappy.


When I resize a window or split view containing a table of 30 rows  
or scroll the table  it is slow.


I have read Cocoa Performance Guidelines.  I cannot get a call to  
preservesContentDuringLiveResize for my table view.


So, how can I make my users happy with a snappy table view during  
resize operations?


For any performance problem, I highly recommend finding out what is  
slow. Use Shark to sample your program and find out what it is. Then  
post the relevant information to the list saying why is X slow?  
There isn't much that people can recommend until then.


corbin


___

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

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

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

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


Re: Enable Scripting Failing - Missing something? Based on SimpleScripingVerbs sample

2009-01-14 Thread Matt Neuburg
On Tue, 13 Jan 2009 13:17:11 -0800, Adam Venturella
aventure...@gmail.com said:

keyOSAScriptingDefinition/key
stringMyScriptingDef.def/string

(1) Why do you call it .def when the example so clearly calls it .sdef?

(2) There are lots of tutorials (including mine online, plus my book) on
getting started with scriptability.

m.
-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119



___

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

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

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

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


Re: Enable Scripting Failing - Missing something? Based on SimpleScripingVerbs sample

2009-01-14 Thread Adam Venturella
the .def was a typo on my part when writing the e-mail.

Anyway I managed to get it working, I must have been doing something
wrong, as I built 2 test apps for the sole purpose of testing
scripting and everything was fine. So the problem was me =)


On Wed, Jan 14, 2009 at 9:24 AM, Matt Neuburg m...@tidbits.com wrote:
 On Tue, 13 Jan 2009 13:17:11 -0800, Adam Venturella
 aventure...@gmail.com said:

keyOSAScriptingDefinition/key
stringMyScriptingDef.def/string

 (1) Why do you call it .def when the example so clearly calls it .sdef?

 (2) There are lots of tutorials (including mine online, plus my book) on
 getting started with scriptability.

 m.
 --
 matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
 A fool + a tool + an autorelease pool = cool!
 One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf
 AppleScript: the Definitive Guide - Second Edition!
 http://www.amazon.com/gp/product/0596102119




___

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

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

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

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


Re: NSTableView

2009-01-14 Thread David Blanton
I understand what you are saying but it seems to me that if I could  
preserve content during live resize all would be well.


My table view subclass implements preservesContentDuringLiveResize  
but it is not called. Is preservesContentDuringLiveResize a valid  
method for a table view subclass?


On Jan 14, 2009, at 10:21 AM, Corbin Dunn wrote:



On Jan 14, 2009, at 9:14 AM, David Blanton wrote:


I thought I had this solved but I need help.

Looking at iTunes with 130 songs the table scrolls quick and  
resizing the window is snappy.


When I resize a window or split view containing a table of 30 rows  
or scroll the table  it is slow.


I have read Cocoa Performance Guidelines.  I cannot get a call to  
preservesContentDuringLiveResize for my table view.


So, how can I make my users happy with a snappy table view during  
resize operations?


For any performance problem, I highly recommend finding out what is  
slow. Use Shark to sample your program and find out what it is.  
Then post the relevant information to the list saying why is X  
slow? There isn't much that people can recommend until then.


corbin






David Blanton





___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Corbin Dunn


On Jan 14, 2009, at 9:41 AM, David Blanton wrote:

I understand what you are saying but it seems to me that if I could  
preserve content during live resize all would be well.


My table view subclass implements preservesContentDuringLiveResize  
but it is not called. Is preservesContentDuringLiveResize a valid  
method for a table view subclass?


Yes, it is a valid method, but there are many caveats to having it  
work with NSTableView, due to the way things autoresize.


As I said before, you should really Shark/Sample your program first.

corbin



On Jan 14, 2009, at 10:21 AM, Corbin Dunn wrote:



On Jan 14, 2009, at 9:14 AM, David Blanton wrote:


I thought I had this solved but I need help.

Looking at iTunes with 130 songs the table scrolls quick and  
resizing the window is snappy.


When I resize a window or split view containing a table of 30 rows  
or scroll the table  it is slow.


I have read Cocoa Performance Guidelines.  I cannot get a call to  
preservesContentDuringLiveResize for my table view.


So, how can I make my users happy with a snappy table view during  
resize operations?


For any performance problem, I highly recommend finding out what is  
slow. Use Shark to sample your program and find out what it is.  
Then post the relevant information to the list saying why is X  
slow? There isn't much that people can recommend until then.




___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Andy Lee


On Jan 14, 2009, at 12:14 PM, David Blanton wrote:


I thought I had this solved but I need help.

Looking at iTunes with 130 songs the table scrolls quick and  
resizing the window is snappy.


When I resize a window or split view containing a table of 30 rows  
or scroll the table  it is slow.


I have read Cocoa Performance Guidelines.  I cannot get a call to  
preservesContentDuringLiveResize for my table view.


What do you mean cannot get a call?

In any case, if you get the problem while scrolling then I would guess  
resizing is not the problem.  And it's adding complexity prematurely  
if you don't know where the actual time is being spent.


I forget if you said whether you're using bindings or a data source.   
If you're using a data source, how about posting your code for  
numberOfRowsInTableView: and  
tableView:objectValueForTableColumn:row:?  The docs for these two  
methods say they need to be very efficient.  If you're using bindings,  
maybe you have a model class with a slow getter method.


If nothing leaps out from a look at these areas, then you really  
should profile as Corbin suggested rather than assume you know what  
the problem is.


--Andy





So, how can I make my users happy with a snappy table view during  
resize operations?


David Blanton





___

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

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

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

This email sent to ag...@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: KVC error from bound SortDescriptor

2009-01-14 Thread Quincey Morris

On Jan 14, 2009, at 08:35, Keary Suska wrote:


On Jan 14, 2009, at 4:54 AM, Steven Hamilton wrote:

I have a customer WindowController class and within it I have a  
method that returns a NSSortDescriptor. Like this;


-(NSArray *)nameSortDescriptors
{
NSSortDescriptor *sorter;
sorter = [[[NSSortDescriptor alloc]
   initWithKey: @name
   ascending: YES] autorelease];
return ([NSArray arrayWithObject: sorter]);
}

...

Error setting value for key path nameSortDescriptors of object  
MLAccountController: 0x58ae390 (from bound object  
NSArrayController: 0x589d1a0[entity: Account, number of selected  
objects: 1](null)): [MLAccountController 0x58ae390  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key nameSortDescriptors.


... 2) make nameSortDescriptors key value coding compliant.


Jumping in with a quibble ...

The OP's window controller class *is* KVC-compliant for the  
'nameSortDescriptors' property, but it's an immutable property. The  
sortable column needs it to be a mutable property. The error message  
is slightly at fault here.


So the solution is to put the array of sort descriptors in an instance  
variable and write a setter for the property, which is, I think, what  
you were implying the OP should do.



___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Andy Lee

On Jan 14, 2009, at 1:06 PM, Andy Lee wrote:
I forget if you said whether you're using bindings or a data  
source.  If you're using a data source, how about posting your code  
for numberOfRowsInTableView: and  
tableView:objectValueForTableColumn:row:?  The docs for these two  
methods say they need to be very efficient.


I found your earlier post.  It sounds like you already know  
tableView:objectValueForTableColumn:row: is slow.  *Why* is it slow?   
Is it making some kind of network or database call?  If your table  
only has 30 rows or so, why not cache the objects in an NSArray?   
Again, posting code might help.


--Andy

___

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

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

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

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


Debugging objc_msg errors

2009-01-14 Thread John Nairn
I occasionally get difficult-to-debug crashes where that last thing in  
the crash log is a message being sent, which ends up being a message  
sent to an object that has been released (I think it is objc_msg, but  
I am not looking at a crash log now). These happen much more often in  
Leopard than in Tiger.


Since I have many messages going to many objects, it can take me a  
long time to track these problems down (in one case several weeks). I  
am fairly certain it is not a notification message because I also  
remove objects as observers before they are deallocated. Is there a  
debugging tool that can provide more information about what message  
was sent to what object at the time of the crash?


---
John Nairn
GEDitCOM - Genealogy Software for the Macintosh
http://www.geditcom.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: Debugging objc_msg errors

2009-01-14 Thread Jeff Johnson

John,

See the following for a good tutorial:

http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html

-Jeff


On Jan 14, 2009, at 1:04 PM, John Nairn wrote:

I occasionally get difficult-to-debug crashes where that last thing  
in the crash log is a message being sent, which ends up being a  
message sent to an object that has been released (I think it is  
objc_msg, but I am not looking at a crash log now). These happen  
much more often in Leopard than in Tiger.


Since I have many messages going to many objects, it can take me a  
long time to track these problems down (in one case several weeks).  
I am fairly certain it is not a notification message because I also  
remove objects as observers before they are deallocated. Is there a  
debugging tool that can provide more information about what message  
was sent to what object at the time of the crash?


---
John Nairn
GEDitCOM - Genealogy Software for the Macintosh
http://www.geditcom.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: NSTableView

2009-01-14 Thread David Blanton

Here is the code. Some notes,

_browserView is an NSMatrix of NSImageCells
Str is form a portable string library
there are a few C++ classes used

Once a cell value is computed it is stored.

When moving a split view divider and covering the table that action  
is jerky.  I thought storing the cell values would improve that but no.


Any and all comments please.

Oh, Shark said 16% objc-msgsend.

Thanks in advance!


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

if(_browserView != nil)
{
int count =  _browserView-fileList.GetCount();
[_browserView selectAll:self];
[_browserCells release];
_browserCells = [_browserView selectedCells];
[_browserCells retain]; 
return count;
}
else return 0;
}

/* tableViewobjectValueForTableColumn:row */
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn *)aTableColumn row:(int)rowIndex {


DTVCell* cell = [aTableColumn dataCell];
NSString* colID = [aTableColumn identifier];
[self setupCell:cell forRow:rowIndex column:colID];
return cell;
}

/* setupCell */
- (void)setupCell:(DTVCell*)cell forRow:(int)rowIndex column: 
(NSString*)colID {


BMatrixCell *xcell = [_browserCells objectAtIndex:rowIndex];
BEUtil beu;
if(xcell-_haveDesign == NO)
{
BEDesign design;
xcell-m_Design.SetFilename(xcell-mBFilename);
beu.GetFile(xcell-m_Design);
xcell-m_StitchCount = xcell-m_Design.StitchCount();
BEColorList becl;
xcell-m_Design.GetColorList(becl);
xcell-m_ColorCount = becl.GetCount();
		if(xcell-m_ColorCount0) xcell-m_StitchCount -= (xcell- 
m_ColorCount-1);

xcell-_haveDesign = YES;
}

if([colID compare:@NAME] == NSOrderedSame)
{
if(xcell-_name == nil)
{
Str s((const 
STRCHAR*)xcell-mBFilename.StripExtension());
			xcell-_name = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_name retain];
}
cell-_value = xcell-_name;  
return;
}

if([colID compare:@EXTENSION] == NSOrderedSame)
{
if(xcell-_extension == nil)
{
Str s((const STRCHAR*)xcell-mBFilename.GetExtension());
			xcell-_extension = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_extension retain];
}
cell-_value = xcell-_extension; 
return;
}

if([colID compare:@COLORS] == NSOrderedSame)
{
if(xcell-_colors == nil)
{
			xcell-_colors = [NSString stringWithFormat:@%d,xcell- 
m_ColorCount];

[xcell-_colors retain];
}
cell-_value = xcell-_colors;
return;
}

if([colID compare:@STITCHES] == NSOrderedSame)
{
if(xcell-_stitches == nil)
{
			xcell-_stitches = [NSString stringWithFormat:@%d,xcell- 
m_StitchCount];

[xcell-_stitches retain];
}
cell-_value = xcell-_stitches;  
return;
}

if([colID compare:@JUMPS] == NSOrderedSame)
{
if(xcell-m_jumps == 0)
{
BEObj *obj;
POSITION pos = xcell-m_Design.GetHeadPosition();
while(pos)
{
obj = xcell-m_Design.GetNext(pos);
obj-SetStitchCounts();
int jmp;
obj-m_data.GetData(CIMJUMPS,jmp);
xcell-m_jumps += jmp;
}
xcell-_jumps = [NSString 
stringWithFormat:@%d,xcell-m_jumps];
[xcell-_jumps retain];

}
cell-_value = xcell-_jumps; 
return;
}

if([colID compare:@SIZE] == NSOrderedSame)
{
if(xcell-_size == nil)
{
			Str measure((const STRCHAR *)beu.GetMeasureString(1,xcell- 
m_Design));
			NSString *nsMeasure = [NSString stringWithCString:(const STRCHAR*) 
measure encoding:NSASCIIStringEncoding];

NSRange range = [nsMeasure rangeOfString:@:];
NSString *sz = [nsMeasure 

auto garbage collection race condition?

2009-01-14 Thread Michael Link
I'm running into a scenario where it appears the application is  
allocating memory faster than it can be reclaimed by garbage  
collection. I believe this is how it happens.


There are a pool of threads that are used to collect some data as it  
is collected (by using NSXML* objects, XQuery). In the beginning the  
generational collections seem to keep up well since almost all of the  
NSXML* objects become garbage very quickly. After a small bit of time  
though no garbage collection takes place and memory is consumed to the  
point of exhaustion. (I have AUTO_LOG_COLLECTIONS=YES set to see when  
collections take place).


Some analysis during the period that no collections are taking place  
actually reveals that the collector thread is at this point:


#0  0x001d3a37 in Auto::Bitmap::bit at AutoBitmap.h:131
#1  0x001dca84 in Auto::Region::is_pending at AutoRegion.h:209
#2  0x001db587 in Auto::Admin::is_pending at AutoAdmin.cpp:415
#3  0x001ee3cd in Auto::Subzone::is_pending at AutoSubzone.h:472
#4	0x001eec1e in Auto::scan_pending_blocks_visitor::visit at  
AutoMemoryScanner.cpp:631


#5	0x001eed55 in  
Auto::visitAllocatedBlocksAuto::scan_pending_blocks_visitor at  
AutoBlockIterator.h:53
#6	0x001eddb4 in Auto::MemoryScanner::scan_pending_blocks at  
AutoMemoryScanner.cpp:658
#7	0x001ede0e in Auto::MemoryScanner::scan_pending_until_done at  
AutoMemoryScanner.cpp:680

#8  0x001edfb5 in Auto::MemoryScanner::scan at AutoMemoryScanner.cpp:731
#9  0x001e8c31 in Auto::Collector::collect at AutoCollector.cpp:64
#10 0x001e0f89 in Auto::Zone::collect at AutoZone.cpp:1324
#11 0x001d20c7 in auto_collect_internal at auto_zone.cpp:258
#12 0x001d282c in auto_collect_with_mode at auto_zone.cpp:375
#13 0x001d28c2 in auto_collection_thread at auto_zone.cpp:397
#14 0x91dc3095 in _pthread_start
#15 0x91dc2f52 in thread_start

Whenever I break into gdb to see where it's at during this point  
Auto::visitAllocatedBlocksAuto::scan_pending_blocks_visitor has  
always been in the stack trace. My guess would be that pending  
blocks are being added faster than they are scanned...


To get around this problem I've tried making each thread call

objc_collect(OBJC_EXHAUSTIVE_COLLECTION|OBJC_WAIT_UNTIL_DONE);

after it's done with its task, but it doesn't actually seem to wait at  
all. Since there already seems to be a collection taking place the  
call returns and the thread continues.


Is there anyway to truly block execution until collection has  
finished? Are there any callbacks that could notify when collection  
has started and ended?


I wouldn't mind moving the temporary objects allocation to an  
unscanned zone, but there doesn't seem to be an equivalent  
CoreFoundation way to use XQuery as there is in NSXMLNode.


--
Michael
___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Corbin Dunn
I still reiterate that you need a Shark sample to really find the  
source of the problem. A complete backtrace during the slowdown is  
really what we would need to see, not that it is slow in objc_msgSend.


Overall, the code can/should be improved. Specifically:


/* tableViewobjectValueForTableColumn:row */
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn *)aTableColumn row:(int)rowIndex {


DTVCell* cell = [aTableColumn dataCell];
NSString* colID = [aTableColumn identifier];
[self setupCell:cell forRow:rowIndex column:colID];
return cell;
}


You should not return a cell from this method; you should return the  
object value for the cell. This method shouldn't do anything with a  
cell; instead, you should setup the cell's properties in - 
willDisplayCell. That alone may help you with performance...but, as I  
said..a Shark trace would be needed to see the real issue. If you need  
steps for getting a good trace, let us know..


corbin




/* setupCell */
- (void)setupCell:(DTVCell*)cell forRow:(int)rowIndex column: 
(NSString*)colID {


BMatrixCell *xcell = [_browserCells objectAtIndex:rowIndex];
BEUtil beu;
if(xcell-_haveDesign == NO)
{
BEDesign design;
xcell-m_Design.SetFilename(xcell-mBFilename);
beu.GetFile(xcell-m_Design);
xcell-m_StitchCount = xcell-m_Design.StitchCount();
BEColorList becl;
xcell-m_Design.GetColorList(becl);
xcell-m_ColorCount = becl.GetCount();
		if(xcell-m_ColorCount0) xcell-m_StitchCount -= (xcell- 
m_ColorCount-1);

xcell-_haveDesign = YES;
}

if([colID compare:@NAME] == NSOrderedSame)
{
if(xcell-_name == nil)
{
Str s((const 
STRCHAR*)xcell-mBFilename.StripExtension());
			xcell-_name = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_name retain];
}
cell-_value = xcell-_name;  
return;
}

if([colID compare:@EXTENSION] == NSOrderedSame)
{
if(xcell-_extension == nil)
{
Str s((const STRCHAR*)xcell-mBFilename.GetExtension());
			xcell-_extension = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_extension retain];
}
cell-_value = xcell-_extension; 
return;
}

if([colID compare:@COLORS] == NSOrderedSame)
{
if(xcell-_colors == nil)
{
			xcell-_colors = [NSString stringWithFormat:@%d,xcell- 
m_ColorCount];

[xcell-_colors retain];
}
cell-_value = xcell-_colors;
return;
}

if([colID compare:@STITCHES] == NSOrderedSame)
{
if(xcell-_stitches == nil)
{
			xcell-_stitches = [NSString stringWithFormat:@%d,xcell- 
m_StitchCount];

[xcell-_stitches retain];
}
cell-_value = xcell-_stitches;  
return;
}

if([colID compare:@JUMPS] == NSOrderedSame)
{
if(xcell-m_jumps == 0)
{
BEObj *obj;
POSITION pos = xcell-m_Design.GetHeadPosition();
while(pos)
{
obj = xcell-m_Design.GetNext(pos);
obj-SetStitchCounts();
int jmp;
obj-m_data.GetData(CIMJUMPS,jmp);
xcell-m_jumps += jmp;
}
xcell-_jumps = [NSString 
stringWithFormat:@%d,xcell-m_jumps];
[xcell-_jumps retain];

}
cell-_value = xcell-_jumps; 
return;
}

if([colID compare:@SIZE] == NSOrderedSame)
{
if(xcell-_size == nil)
{
			Str measure((const STRCHAR *)beu.GetMeasureString(1,xcell- 
m_Design));
			NSString *nsMeasure = [NSString stringWithCString:(const STRCHAR*) 
measure encoding:NSASCIIStringEncoding];

NSRange range = [nsMeasure rangeOfString:@:];
NSString *sz = [nsMeasure 
substringToIndex:range.location];
range = [sz rangeOfString:@mm];
NSString *w = [sz substringToIndex:range.location];
NSString *h = [sz substringFromIndex:range.location + 

Re: NSTableView

2009-01-14 Thread Andy Lee

On Jan 14, 2009, at 2:01 PM, David Blanton wrote:
- (id)tableView:(NSTableView *)aTableView objectValueForTableColumn: 
(NSTableColumn *)aTableColumn row:(int)rowIndex {


DTVCell* cell = [aTableColumn dataCell];
NSString* colID = [aTableColumn identifier];
[self setupCell:cell forRow:rowIndex column:colID];
return cell;
}


Typically this method does not return a cell -- it returns a simple  
object like an NSString or NSNumber.  I glanced (only very quickly) at  
your Shark profile and noticed a lot of calls to -[NSCell  
copyWithZone:], which I'm *guessing* is because the cell you're  
returning from this method is getting copied unnecessarily.  If you  
returned a string, it would get copied too, but that would probably be  
a lot cheaper than copying a cell.


- (void)setupCell:(DTVCell*)cell forRow:(int)rowIndex column: 
(NSString*)colID {


I haven't looked closely at the code for this method, but it seems to  
be doing a lot of work.  I don't know if that work involves loading  
large files or hitting a network connection, but I assume *you* do.   
If it's doing something you ALREADY KNOW is expensive, you shouldn't  
be calling it every time tableView:objectValueForTableColumn:row: is  
called. Again, I refer to the doc for  
tableView:objectValueForTableColumn:row:


Note:  tableView:objectValueForTableColumn:row: is called each time  
the table cell needs to be redisplayed, so it must be efficient.


(Technically, being efficient is not the same as running in a very  
short amount of time, but that's obviously what they meant.)


A common pattern for a table view's data source is for it to have an  
array of objects that you want to display, one object for each row of  
the table.  numberOfRowsInTableView: returns the size of the array.   
For a single-column table, tableView:objectValueForTableColumn:row:  
returns the nth element of the array.  For a multi-column table, it  
gets the nth element and asks it for the value to display in the  
specified column.  I suspect you will get better results if you take  
this approach.


If you *don't* know why tableView:objectValueForTableColumn:row: is  
slow (if you expect it to be almost instantaneous), then you're back  
to analyzing the Shark profile, and your problem has nothing to do  
with your table view per se.


As a side note, you shouldn't use direct ivar access as in cell- 
_value = xcell-_date.  This violates not only encapsulation but  
memory management rules.


--Andy

___

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

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

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

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


Re: NSTableView

2009-01-14 Thread David Blanton

Holy Joker Batman!

Changing

return cell;

to
return cell-_value

gives the performance I am looking for!

Corbin, u 2 cool!

Thanks.

On Jan 14, 2009, at 12:38 PM, Corbin Dunn wrote:

I still reiterate that you need a Shark sample to really find the  
source of the problem. A complete backtrace during the slowdown is  
really what we would need to see, not that it is slow in objc_msgSend.


Overall, the code can/should be improved. Specifically:


/* tableViewobjectValueForTableColumn:row */
- (id)tableView:(NSTableView *)aTableView  
objectValueForTableColumn:(NSTableColumn *)aTableColumn row:(int) 
rowIndex {


DTVCell* cell = [aTableColumn dataCell];
NSString* colID = [aTableColumn identifier];
[self setupCell:cell forRow:rowIndex column:colID];
return cell;
}


You should not return a cell from this method; you should return  
the object value for the cell. This method shouldn't do anything  
with a cell; instead, you should setup the cell's properties in - 
willDisplayCell. That alone may help you with performance...but, as  
I said..a Shark trace would be needed to see the real issue. If you  
need steps for getting a good trace, let us know..


corbin




/* setupCell */
- (void)setupCell:(DTVCell*)cell forRow:(int)rowIndex column: 
(NSString*)colID {


BMatrixCell *xcell = [_browserCells objectAtIndex:rowIndex];
BEUtil beu;
if(xcell-_haveDesign == NO)
{
BEDesign design;
xcell-m_Design.SetFilename(xcell-mBFilename);
beu.GetFile(xcell-m_Design);
xcell-m_StitchCount = xcell-m_Design.StitchCount();
BEColorList becl;
xcell-m_Design.GetColorList(becl);
xcell-m_ColorCount = becl.GetCount();
		if(xcell-m_ColorCount0) xcell-m_StitchCount -= (xcell- 
m_ColorCount-1);

xcell-_haveDesign = YES;
}

if([colID compare:@NAME] == NSOrderedSame)
{
if(xcell-_name == nil)
{
Str s((const 
STRCHAR*)xcell-mBFilename.StripExtension());
			xcell-_name = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_name retain];
}
cell-_value = xcell-_name;  
return;
}

if([colID compare:@EXTENSION] == NSOrderedSame)
{
if(xcell-_extension == nil)
{
Str s((const STRCHAR*)xcell-mBFilename.GetExtension());
			xcell-_extension = [NSString stringWithCString:(const char *)s  
encoding:NSASCIIStringEncoding];

[xcell-_extension retain];
}
cell-_value = xcell-_extension; 
return;
}

if([colID compare:@COLORS] == NSOrderedSame)
{
if(xcell-_colors == nil)
{
			xcell-_colors = [NSString stringWithFormat:@%d,xcell- 
m_ColorCount];

[xcell-_colors retain];
}
cell-_value = xcell-_colors;
return;
}

if([colID compare:@STITCHES] == NSOrderedSame)
{
if(xcell-_stitches == nil)
{
			xcell-_stitches = [NSString stringWithFormat:@%d,xcell- 
m_StitchCount];

[xcell-_stitches retain];
}
cell-_value = xcell-_stitches;  
return;
}

if([colID compare:@JUMPS] == NSOrderedSame)
{
if(xcell-m_jumps == 0)
{
BEObj *obj;
POSITION pos = xcell-m_Design.GetHeadPosition();
while(pos)
{
obj = xcell-m_Design.GetNext(pos);
obj-SetStitchCounts();
int jmp;
obj-m_data.GetData(CIMJUMPS,jmp);
xcell-m_jumps += jmp;
}
xcell-_jumps = [NSString 
stringWithFormat:@%d,xcell-m_jumps];
[xcell-_jumps retain];

}
cell-_value = xcell-_jumps; 
return;
}

if([colID compare:@SIZE] == NSOrderedSame)
{
if(xcell-_size == nil)
{
			Str measure((const STRCHAR *)beu.GetMeasureString(1,xcell- 
m_Design));
			NSString *nsMeasure = [NSString stringWithCString:(const  
STRCHAR*)measure encoding:NSASCIIStringEncoding];

NSRange range = [nsMeasure rangeOfString:@:];
NSString *sz = [nsMeasure 
substringToIndex:range.location];
   

Report writer for Cocoa?

2009-01-14 Thread Jon C. Munson II
Namaste!

I could be missing the obvious, however, my question is whether a report
writer tool (like Crystal Reports or MS Access, by way of example) exists
for Cocoa?

I Googled around for a bit tyring to find something (other than ReportMill).

I've looked at (and read) the printing-relevant Apple dox.  I've read the
relevant chapter in Hillegass' book too.  I can see how much work writing
pretty reports is going to be.

Unless...

I missed a point concerning an NSView - it knows about PDF, etc.

The dox don't really go into this much, so here's a follow-on question to
the first:

If I take the time to draw out a view in IB with all my fields, etc., will
that print as-is?  This, then, would become the report writer, right?

I'm looking for good, solid advice on creating reports.  I do have some
graphics I'd like to include in my reports, but most are lists, and some are
lists with child details too.

Many thanks in advance (and I hope this isn't a Help Vampire question)!!!

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

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

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

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


Re: Report writer for Cocoa?

2009-01-14 Thread Sherm Pendley

On Jan 14, 2009, at 3:01 PM, Jon C. Munson II wrote:

I could be missing the obvious, however, my question is whether a  
report
writer tool (like Crystal Reports or MS Access, by way of example)  
exists

for Cocoa?


I think what a lot of folks are doing is just generating HTML and  
printing it with WebView.


sherm--

___

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

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

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

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


Re: Report writer for Cocoa?

2009-01-14 Thread Jim Thomason
A lot of people tend to link in webkit and layout a printed report using
html and css. It's somewhat eqasier than standard web dev since you know
that only webkit will be displaying your layout. No need for cross browser
compatability.

I use that aqpproach for one of my apps and it works well enough. Don't get
me wrong - it still feels like a major hack, but thre results are decent and
it was pretty quick and easy to implement.

-jim..

sent from my G1

On Jan 14, 2009 2:13 PM, Jon C. Munson II jmun...@his.com wrote:

Namaste!

I could be missing the obvious, however, my question is whether a report
writer tool (like Crystal Reports or MS Access, by way of example) exists
for Cocoa?

I Googled around for a bit tyring to find something (other than ReportMill).

I've looked at (and read) the printing-relevant Apple dox.  I've read the
relevant chapter in Hillegass' book too.  I can see how much work writing
pretty reports is going to be.

Unless...

I missed a point concerning an NSView - it knows about PDF, etc.

The dox don't really go into this much, so here's a follow-on question to
the first:

If I take the time to draw out a view in IB with all my fields, etc., will
that print as-is?  This, then, would become the report writer, right?

I'm looking for good, solid advice on creating reports.  I do have some
graphics I'd like to include in my reports, but most are lists, and some are
lists with child details too.

Many thanks in advance (and I hope this isn't a Help Vampire question)!!!

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

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

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

This email sent to j...@jimandkoka.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


UITableViewController with dynamic data

2009-01-14 Thread Mohan Parthasarathy
Hi,

I am using a UITableViewController and the data for the table view is
generated dynamically (fetched from the network). The data is normally
fetched based on some search. But when the Controller is loaded and i don't
have the data ready, i want to return something back sane and later reload
the data when it becomes ready. What is the best way to do this ?

-numberOfSectionsinRow : Is it safe to assume that this function is called
always *first* before constructing the table ? At least i want to be able to
initiate the fetch (if it is not already done before) here.
-As i can't return 0 for numberOfSectionsInRow, i still have to return 1
there and in numberOfRowsInSection, return zero till the data becomes
available

The problem  is that i need to initiate the fetch somewhere during the table
construction and i don't want to put hooks into all of the tableView
delegate methods. As the data for the tableview is dynamic, i need to tell
the framework not to call the other delegate methods till i return something
valid in numberOfSectionsInRow/numberOfRowsInSection. Is this a safe
assumption ?

thanks
mohan
___

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

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

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

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


Re: NSTableView

2009-01-14 Thread Erik Buck
The code provided looks very unusual and clearly does not follow the 
Model-View-Controller design.  It is almost always a bad idea to store 
information in the user interface.  
 
The following line is extremely suspect:
int count =  _browserView-fileList.GetCount();
 
Why doesn't your tableView's data source have its own direct reference to 
fileList ?
 
I suggest the following:
 
- (int)numberOfRowsInTableView:(NSTableView *)tableView {
   int count = 0;

   if(_fileList != NULL)
   {
   count = _fileList.GetCount();
   }
   
   return count;
}

 
What is going on with the following?
   [_browserView selectAll:self];
       [_browserCells release];
       _browserCells = [_browserView selectedCells];
       [_browserCells retain];

Don't select stuff in - (int)numberOfRowsInTableView:
 
Even if you wanted the cells from the matrix for some reason, why not
[_browserCells release];
_browserCells = [[_browserView cells] copy];
 
But using the cells of a matrix outside the matrix is extremely suspect.  The 
cells should not contain any information that you can't get from some other 
source like _fileList.
 
The rest of teh code that copies information out of cells in a matrix in order 
to set information in cells used by a tableView  is so horrific that I won't 
comment any more.  Please read about Model-View-Controller.
 
___

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

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

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

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


Re: UITableViewController with dynamic data

2009-01-14 Thread Luke the Hiesterman
I assume you meant numberOfSectionsInTableView:anyway, a good  
strategy might be to just go ahead and return 0 initially, and then  
whenever you have successfully pulled your data from the network, do  
[tableView reloadData] and then you can return the appropriate numbers  
at that time, since they will be ready.


Luke

On Jan 14, 2009, at 12:24 PM, Mohan Parthasarathy wrote:


Hi,

I am using a UITableViewController and the data for the table view is
generated dynamically (fetched from the network). The data is normally
fetched based on some search. But when the Controller is loaded and  
i don't
have the data ready, i want to return something back sane and later  
reload

the data when it becomes ready. What is the best way to do this ?

-numberOfSectionsinRow : Is it safe to assume that this function is  
called
always *first* before constructing the table ? At least i want to be  
able to

initiate the fetch (if it is not already done before) here.
-As i can't return 0 for numberOfSectionsInRow, i still have to  
return 1

there and in numberOfRowsInSection, return zero till the data becomes
available

The problem  is that i need to initiate the fetch somewhere during  
the table

construction and i don't want to put hooks into all of the tableView
delegate methods. As the data for the tableview is dynamic, i need  
to tell
the framework not to call the other delegate methods till i return  
something

valid in numberOfSectionsInRow/numberOfRowsInSection. Is this a safe
assumption ?

thanks
mohan
___

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

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

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

This email sent to luket...@apple.com


___

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

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

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

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


Re: UITableViewController with dynamic data

2009-01-14 Thread Mohan Parthasarathy
Yes, that's what i meant. Just to confirm.. It is safe to assume that
numberOfSectionsInTableView will be first function called ? I am thinking of
this sequence..

1) The code receives low memory warning and frees up the data that the
tableView is currently displaying
2) CellForRowAtIndexPath is called now for Nth Row.

(2) in my code would reference the data that has been freed in step (1). Is
it possible to invalidate the tableView Data also while freeing memory at
step (1) ?

thanks
mohan


On Wed, Jan 14, 2009 at 12:32 PM, Luke the Hiesterman luket...@apple.comwrote:

 I assume you meant numberOfSectionsInTableView:anyway, a good strategy
 might be to just go ahead and return 0 initially, and then whenever you have
 successfully pulled your data from the network, do [tableView reloadData]
 and then you can return the appropriate numbers at that time, since they
 will be ready.

 Luke


 On Jan 14, 2009, at 12:24 PM, Mohan Parthasarathy wrote:

  Hi,

 I am using a UITableViewController and the data for the table view is
 generated dynamically (fetched from the network). The data is normally
 fetched based on some search. But when the Controller is loaded and i
 don't
 have the data ready, i want to return something back sane and later reload
 the data when it becomes ready. What is the best way to do this ?

 -numberOfSectionsinRow : Is it safe to assume that this function is called
 always *first* before constructing the table ? At least i want to be able
 to
 initiate the fetch (if it is not already done before) here.
 -As i can't return 0 for numberOfSectionsInRow, i still have to return 1
 there and in numberOfRowsInSection, return zero till the data becomes
 available

 The problem  is that i need to initiate the fetch somewhere during the
 table
 construction and i don't want to put hooks into all of the tableView
 delegate methods. As the data for the tableview is dynamic, i need to tell
 the framework not to call the other delegate methods till i return
 something
 valid in numberOfSectionsInRow/numberOfRowsInSection. Is this a safe
 assumption ?

 thanks
 mohan
 ___

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

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

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

 This email sent to luket...@apple.com



___

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

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

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

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


Re: UITableViewController with dynamic data

2009-01-14 Thread Luke the Hiesterman
The way to invalidate data in the tableView when you free it would be  
to reloadData. So, get rid of whatever you're getting rid of, build  
your new, truncated list of items, and then call [tableView  
reloadData] so you put only the data you've kept around in the table.  
Also, if you're worried about a race condition, you could set a flag  
before you begin freeing things, so that if any data is requested  
while you're in the process of freeing but you haven't yet called  
reloadData, you will do the right thing.


Luke


On Jan 14, 2009, at 12:57 PM, Mohan Parthasarathy wrote:

Yes, that's what i meant. Just to confirm.. It is safe to assume  
that numberOfSectionsInTableView will be first function called ? I  
am thinking of this sequence..


1) The code receives low memory warning and frees up the data that  
the tableView is currently displaying

2) CellForRowAtIndexPath is called now for Nth Row.

(2) in my code would reference the data that has been freed in step  
(1). Is it possible to invalidate the tableView Data also while  
freeing memory at step (1) ?


thanks
mohan


On Wed, Jan 14, 2009 at 12:32 PM, Luke the Hiesterman luket...@apple.com 
 wrote:
I assume you meant numberOfSectionsInTableView:anyway, a good  
strategy might be to just go ahead and return 0 initially, and then  
whenever you have successfully pulled your data from the network, do  
[tableView reloadData] and then you can return the appropriate  
numbers at that time, since they will be ready.


Luke


On Jan 14, 2009, at 12:24 PM, Mohan Parthasarathy wrote:

Hi,

I am using a UITableViewController and the data for the table view is
generated dynamically (fetched from the network). The data is normally
fetched based on some search. But when the Controller is loaded and  
i don't
have the data ready, i want to return something back sane and later  
reload

the data when it becomes ready. What is the best way to do this ?

-numberOfSectionsinRow : Is it safe to assume that this function is  
called
always *first* before constructing the table ? At least i want to be  
able to

initiate the fetch (if it is not already done before) here.
-As i can't return 0 for numberOfSectionsInRow, i still have to  
return 1

there and in numberOfRowsInSection, return zero till the data becomes
available

The problem  is that i need to initiate the fetch somewhere during  
the table

construction and i don't want to put hooks into all of the tableView
delegate methods. As the data for the tableview is dynamic, i need  
to tell
the framework not to call the other delegate methods till i return  
something

valid in numberOfSectionsInRow/numberOfRowsInSection. Is this a safe
assumption ?

thanks
mohan
___

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

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

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

This email sent to luket...@apple.com




___

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

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

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

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


Custom drawn menus?

2009-01-14 Thread Scott Andrew
Is there any good way to custom draw a menu? Or is the old carbon  
'mdef', like the star menu sample, the only way? And will it break in  
10.6?


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/archive%40mail-archive.com

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


Re: Custom drawn menus?

2009-01-14 Thread I. Savant
On Wed, Jan 14, 2009 at 4:14 PM, Scott Andrew
scottand...@roadrunner.com wrote:
 Is there any good way to custom draw a menu? Or is the old carbon 'mdef',
 like the star menu sample, the only way? And will it break in 10.6?

  You could use a custom view and set it as the menu item's view ...

--
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: Custom drawn menus?

2009-01-14 Thread Scott Andrew
Not up for the menu item route. I am looking at just changing the  
background and shape slightly or the whole menu to match my UI.


Scott

On Jan 14, 2009, at 1:16 PM, I. Savant wrote:


On Wed, Jan 14, 2009 at 4:14 PM, Scott Andrew
scottand...@roadrunner.com wrote:
Is there any good way to custom draw a menu? Or is the old carbon  
'mdef',

like the star menu sample, the only way? And will it break in 10.6?


 You could use a custom view and set it as the menu item's view ...

--
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: Custom drawn menus?

2009-01-14 Thread Joe Ranieri
Not up for the menu item route. I am looking at just changing the  
background and shape slightly or the whole menu to match my UI.


Unfortunately there's not much of a good route to go here. Using a  
custom view requires you to do handle *all* drawing, mouse handling,  
keyboard events, etc. It is possible to do using an undocumented  
method, but that's not on-topic for this list.


-- Joe Ranieri
___

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

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

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

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


Re: NIB's owner doesn't get released because of NSArrayController

2009-01-14 Thread Vitaly Ovchinnikov
I just found a solution, but I don't like it. I added method
-beforeRelease to my view controller where I send -unbind: to my array
controller. I call this method from my window controller just before
-release call. This helps. But looks ugly... Does somebody know better
way?


On Thu, Jan 15, 2009 at 12:51 AM, Vitaly Ovchinnikov
vitaly.ovchinni...@gmail.com wrote:
 Hello all,

 I have a custom-loaded NIB file with NSView and NSArrayController.
 Array controller is bound to file's owner (NSObject's derived class)
 and use some keypath for contentArray. The problem is when I close a
 window and main window controller tries to release this file's owner -
 array controller still holds a reference to it and doesn't allow to do
 that.

 So I have two questions:
 1. What is the correct way to catch closing of the view to unbound
 array controller?
 2. Do I really need to catch something? Maybe there is a simpler solution?

 Any ideas?
 Thank you.

___

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

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

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

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


Re: NIB's owner doesn't get released because of NSArrayController

2009-01-14 Thread Jason Foreman
On Wed, Jan 14, 2009 at 3:51 PM, Vitaly Ovchinnikov
vitaly.ovchinni...@gmail.com wrote:
 Hello all,

 I have a custom-loaded NIB file with NSView and NSArrayController.
 Array controller is bound to file's owner (NSObject's derived class)
 and use some keypath for contentArray. The problem is when I close a
 window and main window controller tries to release this file's owner -
 array controller still holds a reference to it and doesn't allow to do
 that.

 So I have two questions:
 1. What is the correct way to catch closing of the view to unbound
 array controller?
 2. Do I really need to catch something? Maybe there is a simpler solution?

 Any ideas?

Top-level objects in a nib need to be released.  You can do this in
the File's Owner object when the window is closed, for example.

See this page for some additional info on nib object memory management:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemMgmtNibObjects.html


Jason
___

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

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

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

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


Re: KVC error from bound SortDescriptor

2009-01-14 Thread Keary Suska


On Jan 14, 2009, at 11:10 AM, Quincey Morris wrote:


On Jan 14, 2009, at 08:35, Keary Suska wrote:


On Jan 14, 2009, at 4:54 AM, Steven Hamilton wrote:

I have a customer WindowController class and within it I have a  
method that returns a NSSortDescriptor. Like this;


-(NSArray *)nameSortDescriptors
{
NSSortDescriptor *sorter;
sorter = [[[NSSortDescriptor alloc]
   initWithKey: @name
   ascending: YES] autorelease];
return ([NSArray arrayWithObject: sorter]);
}

...

Error setting value for key path nameSortDescriptors of object  
MLAccountController: 0x58ae390 (from bound object  
NSArrayController: 0x589d1a0[entity: Account, number of selected  
objects: 1](null)): [MLAccountController 0x58ae390  
setValue:forUndefinedKey:]: this class is not key value coding- 
compliant for the key nameSortDescriptors.


... 2) make nameSortDescriptors key value coding compliant.


Jumping in with a quibble ...

The OP's window controller class *is* KVC-compliant for the  
'nameSortDescriptors' property, but it's an immutable property. The  
sortable column needs it to be a mutable property. The error message  
is slightly at fault here.


So the solution is to put the array of sort descriptors in an  
instance variable and write a setter for the property, which is, I  
think, what you were implying the OP should do.



I stand corrected. To be more specific, I would say a setter or  
indexed accessors.


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


addObserver problem with protocols

2009-01-14 Thread Mohan Parthasarathy
Hi,

I have protocol X that is implemented by a few classes of my own. These
classes are not known directly to my main code but only through the protocol
(idprotocol). When my main code tries to addObserver:self to the object
idprotocol, i get a warning saying that my protocol does not implement it.
This would have worked if i used the real object behind. What should i do ?
Just add a method like addObserver in the protocol and in the real object
make the method just invoke the [super addobserver]. Or is there a better
way to solve it ?

thanks
mohan
___

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

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

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

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


Re: addObserver problem with protocols

2009-01-14 Thread Keary Suska


On Jan 14, 2009, at 3:18 PM, Mohan Parthasarathy wrote:

I have protocol X that is implemented by a few classes of my own.  
These
classes are not known directly to my main code but only through the  
protocol
(idprotocol). When my main code tries to addObserver:self to the  
object
idprotocol, i get a warning saying that my protocol does not  
implement it.
This would have worked if i used the real object behind. What should  
i do ?
Just add a method like addObserver in the protocol and in the real  
object
make the method just invoke the [super addobserver]. Or is there a  
better

way to solve it ?


If you search the archives you will find a few discussions on this  
subject. I don't remember the reason exactly, but you just can't use  
that syntax. You can use an informal protocol instead, but you won't  
get the compile-time checks that protocol gives you.


HTH,

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


Re: Debugging objc_msg errors

2009-01-14 Thread Greg Parker

On Jan 14, 2009, at 11:18 AM, Jeff Johnson wrote:

On Jan 14, 2009, at 1:04 PM, John Nairn wrote:
I occasionally get difficult-to-debug crashes where that last thing  
in the crash log is a message being sent, which ends up being a  
message sent to an object that has been released (I think it is  
objc_msg, but I am not looking at a crash log now). These happen  
much more often in Leopard than in Tiger.


Since I have many messages going to many objects, it can take me a  
long time to track these problems down (in one case several weeks).  
I am fairly certain it is not a notification message because I also  
remove objects as observers before they are deallocated. Is there a  
debugging tool that can provide more information about what message  
was sent to what object at the time of the crash?


See the following for a good tutorial:

http://www.sealiesoftware.com/blog/archive/2008/09/22/objc_explain_So_you_crashed_in_objc_msgSend.html


That will help you extract info from the crash log itself. There are  
also other debugging modes to run your program that can either catch  
the bug before it crashes, or provide more details about the problem  
when it does crash.


Mac OS X Debugging Magic
http://developer.apple.com/technotes/tn2004/tn2124.html
Look in particular for libgmalloc, MallocStackLogging, and NSZombie.

Clang Static Analyzer
http://clang.llvm.org/StaticAnalysis.html
A compile-time checker that can identify some retain/release errors.


--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: addObserver problem with protocols

2009-01-14 Thread Greg Parker

On Jan 14, 2009, at 2:18 PM, Mohan Parthasarathy wrote:
I have protocol X that is implemented by a few classes of my own.  
These
classes are not known directly to my main code but only through the  
protocol
(idprotocol). When my main code tries to addObserver:self to the  
object
idprotocol, i get a warning saying that my protocol does not  
implement it.
This would have worked if i used the real object behind. What should  
i do ?
Just add a method like addObserver in the protocol and in the real  
object
make the method just invoke the [super addobserver]. Or is there a  
better

way to solve it ?


Some options:

1. Use `NSObjectMyProtocol*` instead of `idMyProtocol`. Then any  
method from class NSObject is allowed along with the protocol's own  
methods. Since addObserver: is declared as a class on NSObject, this  
should pacify the compiler.


2. Add -addObserver: to the protocol.

3. Create another protocol that includes -addObserver:. Then either  
use `idMyProtocol,MyObserverProtocol`, or make MyProtocol itself  
adopt MyObserverProtocol.


#1 is probably the best, assuming all of your objects are in fact  
NSObjects.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

Help/Unsubscribe/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 objc_msg errors

2009-01-14 Thread Sean McBride
On 1/14/09 2:33 PM, Greg Parker said:

On Jan 14, 2009, at 11:18 AM, Jeff Johnson wrote:
 On Jan 14, 2009, at 1:04 PM, John Nairn wrote:
 I occasionally get difficult-to-debug crashes where that last thing
 in the crash log is a message being sent, which ends up being a
 message sent to an object that has been released (I think it is
 objc_msg, but I am not looking at a crash log now). These happen
 much more often in Leopard than in Tiger.

 Since I have many messages going to many objects, it can take me a
 long time to track these problems down (in one case several weeks).
 I am fairly certain it is not a notification message because I also
 remove objects as observers before they are deallocated. Is there a
 debugging tool that can provide more information about what message
 was sent to what object at the time of the crash?

 See the following for a good tutorial:

 http://www.sealiesoftware.com/blog/archive/2008/09/22/
objc_explain_So_you_crashed_in_objc_msgSend.html

That will help you extract info from the crash log itself.

Not to hijack this thread, but... anyone know what objc_msgSend_fixup
is?  Recently I've seen a lot of these types of crashes in my (64bit, GC) app.

Thread 0 Crashed:
0   libobjc.A.dylib 0x7fff809bbcf2
_objc_fixupMessageRef + 39
1   libobjc.A.dylib 0x7fff809bdc7f objc_msgSend_fixup + 
119
2   com.apple.CoreFoundation0x7fff82b798b7
__CFMachPortPerform + 119
3   com.apple.CoreFoundation0x7fff82b9b3ac
CFRunLoopRunSpecific + 3516
4   com.apple.HIToolbox 0x7fff80548da2
RunCurrentEventLoopInMode + 278
5   com.apple.HIToolbox 0x7fff80548bd8
ReceiveNextEventCommon + 322
6   com.apple.HIToolbox 0x7fff80548a83
BlockUntilNextEventMatchingListInMode + 79
7   com.apple.AppKit0x7fff80da93b0 _DPSNextEvent + 603
8   com.apple.AppKit0x7fff80da8cf1 -[NSApplication
nextEventMatchingMask:untilDate:inMode:dequeue:] + 136
9   com.apple.AppKit0x7fff80da2a84 -[NSApplication
run] + 455
10  com.apple.AppKit0x7fff80d6f83c NSApplicationMain + 
373

--

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


___

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

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

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

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


/tmp folder ok?

2009-01-14 Thread Chunk 1978
so an app doesn't need administrative rights to writeToFile in the /tmp folder?
___

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

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

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

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


Re: /tmp folder ok?

2009-01-14 Thread CodingMammoth

Every app  can write to the tmp folder but take a look at:

NSString * NSTemporaryDirectory (void);

On 15 Jan 2009, at 00:31, Chunk 1978 wrote:

so an app doesn't need administrative rights to writeToFile in the / 
tmp folder?

___

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

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

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

This email sent to maill...@codingmammoth.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: /tmp folder ok?

2009-01-14 Thread Graham Cox


On 15 Jan 2009, at 10:31 am, Chunk 1978 wrote:

so an app doesn't need administrative rights to writeToFile in the / 
tmp folder?

___



Don't do that.

Instead use the FindFolder with the 'kTemporaryFolderType' constant.  
Here's a Cocoa wrapper (a category on NSFileManager) to help:


@implementation NSFileManager (FindFolder)


- (NSString*)	pathToFolderOfType:(const OSType) folderType  
shouldCreateFolder:(BOOL) create

{
OSErr   err;
FSRef   ref;
NSString*   path = nil;

err = FSFindFolder( kUserDomain, folderType, create, ref);

if ( err == noErr )
{
// convert to CFURL and thence to path

		CFURLRef url = CFURLCreateFromFSRef( kCFAllocatorSystemDefault,  
ref );
		path = (NSString*) CFURLCopyFileSystemPath( url,  
kCFURLPOSIXPathStyle );

CFRelease( url );
}

return [path autorelease];
}


@end


But yes, once you have the path you should have write permission for it.

Note also though, that for the case of safe saving (i.e. write to a  
temporary file then swap with the 'real' file), you don't need to do  
that yourself. Just pass yes in the 'atomically' parameter in methods  
such as [NSData writeToFile:atomically:];


hth,

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: Debugging objc_msg errors

2009-01-14 Thread Nick Zitzmann


On Jan 14, 2009, at 4:21 PM, Sean McBride wrote:


Not to hijack this thread, but... anyone know what objc_msgSend_fixup
is?  Recently I've seen a lot of these types of crashes in my  
(64bit, GC) app.



I could have sworn I've seen this before, and the problem ended up  
being a subtle memory corruption bug. Have you tried turning on Guard  
Malloc lately? Memory corruption can still happen in GC-enabled apps...


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

___

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

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

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

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


Re: Debugging objc_msg errors

2009-01-14 Thread Corbin Dunn


On Jan 14, 2009, at 11:04 AM, John Nairn wrote:

I occasionally get difficult-to-debug crashes where that last thing  
in the crash log is a message being sent, which ends up being a  
message sent to an object that has been released (I think it is  
objc_msg, but I am not looking at a crash log now). These happen  
much more often in Leopard than in Tiger.


Since I have many messages going to many objects, it can take me a  
long time to track these problems down (in one case several weeks).  
I am fairly certain it is not a notification message because I also  
remove objects as observers before they are deallocated. Is there a  
debugging tool that can provide more information about what message  
was sent to what object at the time of the crash?


What the others have posted is good, but IMHO the easiest way to debug  
overreleased objects is with Instruments. You frequently want to know  
where the over release was.


http://www.corbinstreehouse.com/blog/index.php/2007/10/instruments-on-leopard-how-to-debug-those-random-crashes-in-your-cocoa-app/

corbin


___

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

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

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

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


Re: /tmp folder ok?

2009-01-14 Thread Chris Parker
NSTemporaryDirectory() already does (effectively) that, and yields the
same resulting folder.

You should just use NSTemporaryDirectory().

.chris


On Wed, Jan 14, 2009 at 3:44 PM, Graham Cox graham@bigpond.com wrote:

 On 15 Jan 2009, at 10:31 am, Chunk 1978 wrote:

 so an app doesn't need administrative rights to writeToFile in the /tmp
 folder?
 ___


 Don't do that.

 Instead use the FindFolder with the 'kTemporaryFolderType' constant. Here's
 a Cocoa wrapper (a category on NSFileManager) to help:

 @implementation NSFileManager (FindFolder)


 - (NSString*)   pathToFolderOfType:(const OSType) folderType
 shouldCreateFolder:(BOOL) create
 {
OSErr   err;
FSRef   ref;
NSString*   path = nil;

err = FSFindFolder( kUserDomain, folderType, create, ref);

if ( err == noErr )
{
// convert to CFURL and thence to path

CFURLRef url = CFURLCreateFromFSRef(
 kCFAllocatorSystemDefault, ref );
path = (NSString*) CFURLCopyFileSystemPath( url,
 kCFURLPOSIXPathStyle );
CFRelease( url );
}

return [path autorelease];
 }


 @end


 But yes, once you have the path you should have write permission for it.

 Note also though, that for the case of safe saving (i.e. write to a
 temporary file then swap with the 'real' file), you don't need to do that
 yourself. Just pass yes in the 'atomically' parameter in methods such as
 [NSData writeToFile:atomically:];

 hth,

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

 This email sent to ctpar...@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: /tmp folder ok?

2009-01-14 Thread Kyle Sluder
On Wed, Jan 14, 2009 at 7:24 PM, Chris Parker ctpar...@gmail.com wrote:
 You should just use NSTemporaryDirectory().

Do not just use NSTemporaryDirectory if you need to perform an atomic
save operation (write new data to location X and then overwrite old
data at location Y by moving X - Y).  If will not work if the
destination is on a different volume from the source.

In this case you must use FSFindFolder with the volume reference
number of the volume on which you wish to save your data.  Read
FSFolder.h for more information.

--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: Report writer for Cocoa?

2009-01-14 Thread Dave Fernandes
I make an RTFD report template in TextEdit and read this template  
into an NSMutableAttributedString. My template contains keywords such  
as FIRST_NAME, LAST_NAME, etc. I then substitute the keywords in the  
attributed string with real data, and then initialize an NSTextView  
with the string. This text view can be printed, or the attributed  
string can be written to an RTFD or other type of file. I haven't  
tried substituting graphics into the report template yet.


One big benefit of this simple technique is that end-users can  
customize the report template themselves using TextEdit.


You can certainly print a view created in IB, but NSTableViews, etc.  
are designed for the screen and don't look good in print.


Dave

On Jan 14, 2009, at 3:01 PM, Jon C. Munson II wrote:


Namaste!

I could be missing the obvious, however, my question is whether a  
report
writer tool (like Crystal Reports or MS Access, by way of example)  
exists

for Cocoa?

I Googled around for a bit tyring to find something (other than  
ReportMill).


I've looked at (and read) the printing-relevant Apple dox.  I've  
read the
relevant chapter in Hillegass' book too.  I can see how much work  
writing

pretty reports is going to be.

Unless...

I missed a point concerning an NSView - it knows about PDF, etc.

The dox don't really go into this much, so here's a follow-on  
question to

the first:

If I take the time to draw out a view in IB with all my fields,  
etc., will

that print as-is?  This, then, would become the report writer, right?

I'm looking for good, solid advice on creating reports.  I do have  
some
graphics I'd like to include in my reports, but most are lists, and  
some are

lists with child details too.

Many thanks in advance (and I hope this isn't a Help Vampire  
question)!!!


Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

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

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


Re: WebView (Caching)

2009-01-14 Thread Rob Keniger


On 15/01/2009, at 6:53 AM, Joseph Crawford wrote:

When I drop a WebView on my XIB does it automatically cache the  
file(s) that it loads?  I ask because I could not get a JS command  
to work properly even after I fixed the would be problem.  This  
morning it started working just fine.  If it does cache can anyone  
direct me to something I can read on how to disable caching?



This has been discussed several times on the WebKitSDK-dev list and  
the short answer is that yes, it does caching and no, there is nothing  
you can do to turn it off. I and others have tried a myriad of  
workarounds but unfortunately the caching is down in WebCore. The  
WebKit developers are aware of this issue and so hopefully it will be  
resolved in future but please file a bug.


The only solution that does work is the old web developer trick of  
appending a random argument to the URL, e.g.:


file:///path/to/myjavascript.js?random=12345234

If you change the random argument each time the page is loaded, the  
JavaScript file will be reloaded each time.


--
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: IKImageView setImage only works once.

2009-01-14 Thread Graham Cox


On 15 Jan 2009, at 12:22 pm, James Trankelson wrote:


Well, judging from how often ImageKit questions appear to be answered
here, my expectations aren't high, but here goes anyway...

I'm using an IKImageView and calling setImage to set its contents.

The problem is that setImage only works the first time. Subsequent
calls don't update the image. The first always remains.

Any ideas?



IKImageView doesn't implement -setImage:

It has -setImage:imageProperties: and -setImageWithURL:

Did you mean one of these?

You may need to call -setNeedsDisplay:YES also after setting the image  
(the docs are silent on this point but other ImageKit classes need  
this call for some operations - they don't necessarily flag the needed  
update internally).


any help?

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


Apply Preferences To Current Window

2009-01-14 Thread Walker Argendeli
I've just worked through Chapter 13 of Hillegass's book, which deals  
with setting user defaults.  My problem is that the preferences (e.g.  
colorwell which changes the background color of a tableview) only take  
effect when I open a new document, whereas I'd like them to be applied  
to the current one.  I'm pretty sure this would involve bindings, and  
there was a brief section in the book detailing binding a checkbox,  
but it didn't help me with changing the color.  I also looked here http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/DrawColor/Tasks/StoringNSColorInDefaults.html#/ 
/apple_ref/doc/uid/20001693-SW3

Thanks for the help!

- Walker Argendeli

___

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

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

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

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


Re: Report writer for Cocoa?

2009-01-14 Thread Matt Neuburg
On Wed, 14 Jan 2009 15:01:02 -0500, Jon C. Munson II jmun...@his.com
said:
I've looked at (and read) the printing-relevant Apple dox.  I've read the
relevant chapter in Hillegass' book too.  I can see how much work writing
pretty reports is going to be.

Unless...

I missed a point concerning an NSView - it knows about PDF, etc.

The dox don't really go into this much, so here's a follow-on question to
the first:

If I take the time to draw out a view in IB with all my fields, etc., will
that print as-is?  This, then, would become the report writer, right?

I would suggest breaking the problem down in to the basic elements of a
page, classifying the kinds of thing you'd like to have appear on the
printed page. By default, a view draws itself by asking its subviews to draw
themselves. Thus you can have your own special NSView subclasses that know
how to draw themselves, and combine them within superviews, and now
everything becomes very tight and simple and object-oriented and easily
maintained. If you want to design certain aspects of a view in IB, of course
you can, and you can load a nib multiple times to get multiple copies of it.

m.

-- 
matt neuburg, phd = m...@tidbits.com, http://www.tidbits.com/matt/
A fool + a tool + an autorelease pool = cool!
One of the 2007 MacTech Top 25: http://tinyurl.com/2rh4pf
AppleScript: the Definitive Guide - Second Edition!
http://www.amazon.com/gp/product/0596102119



___

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

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

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

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


Re: IKImageView setImage only works once.

2009-01-14 Thread James Trankelson
Ha!

I actually tried both of your suggestions, but without avail.

It turns out that calling [setImage: imageProperties:] is happiest to
be called from the main thread. Calling it by using
performSelectorOnMainThread: works.

jt

On Thu, Jan 15, 2009 at 2:51 AM, Graham Cox graham@bigpond.com wrote:

 On 15 Jan 2009, at 12:22 pm, James Trankelson wrote:

 Well, judging from how often ImageKit questions appear to be answered
 here, my expectations aren't high, but here goes anyway...

 I'm using an IKImageView and calling setImage to set its contents.

 The problem is that setImage only works the first time. Subsequent
 calls don't update the image. The first always remains.

 Any ideas?


 IKImageView doesn't implement -setImage:

 It has -setImage:imageProperties: and -setImageWithURL:

 Did you mean one of these?

 You may need to call -setNeedsDisplay:YES also after setting the image (the
 docs are silent on this point but other ImageKit classes need this call for
 some operations - they don't necessarily flag the needed update internally).

 any help?

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


Localized resources not loading from external frameworks

2009-01-14 Thread Samir Patel
I have an external framework I built in XCode 2.5. I have an English.lproj 
folder and a Japanese.lproj folder. I build my framework and put it in 
/Library/Frameworks.

All the files are in the right locations, but when I run my app which is linked 
against the framework, the English version of my UI from the framework always 
loads no matter what language I have set in System Preferences.

Any ideas how to get the localized resources to load?

Thanks,



  
___

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

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

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

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


JOB OPENING- MAC OS modem interface SW ENGINEER

2009-01-14 Thread Lindsey Glass





JOB OPENING---

I am a recruiter of senior level hardware and software engineers for contract 
positions nationwide. We place engineers in the areas of semiconductors, 
aerospace, commercial, telecom, networking, and government defense. 

 

If you are interested in this contract position or others, please send me you 
current resume and manager references. Also, please feel free to call me 
directly if you have any questions about this position. 

 

Lindsey Glass

Triple Crown Consulting, LLC

Technical Recruiter

Direct: 512-623-5773

Toll Free: 866-901-8880 ext 140

Fax: 512-233-5341

www.tripleco.com

 




MAC OS position- Montreal, Canada




6-12 months


new modem product


development, architecture through verification and test 


big thing is Mac OS experience 
USB drivers (mac related) ACM, ECM, CCM


arm 9 exp is ideal but 7 will work


embedded C (95%) C++ 



 

Required Prior Experience/job Qualifications



Bachelor Degree in Electrical Engineering/Computer Science/Computer Engineering 
or equivalent.   
Masters preferred.

5+ years experience in design, development, and verification of complex 
Embedded Real-Time Software Systems.

Experience in the design and implementation of Real-Time / High Performance 
software, required.

Wireless (GSM, GPRS, EDGE, TDMA, WCDMA), data communication, or networking 
experience preferred.

Experience in design, development, and verification of  
platform related software preferred (RTOS integration, inter-processor 
communication, HW / SW interfacing, etc.). Serial (USB), MAC-OS network 
interface (ACM, ECM, CCM, …) and card bus drivers experience preferred.

Experience with ARM embedded processors, preferred. 

Clear ability to learn and grow in Software Engineering skills, required to 
design, implement, integrate, and maintain complex pieces of software and 
software products.

Commercial Product experience required.

Proficient in C/C++, and assembly.

Familiarity with model-based engineering (SDL, UML, or the equivalent) 
preferred. 

Excellent verbal and written communication skills.

Excellent problem solving, logic, and analytical skills

 


Summary of Job Duties


Responsible for the design, implementation, integration and architecture of 
Wideband CDMA/GSM-GPRS-EDGE terminal products, specifically platform drivers, 
and protocol software.  


 

Assist in integration / verification, and maintenance (defect analysis, 
isolation, resolution, and verification) of modem interface software for MAC OS 
data card reference and customer platforms.









 

Lindsey Glass

Triple Crown Consulting, LLC

Technical Recruiter

Direct: 512-623-5773

Toll Free: 866-901-8880 ext 140

Fax: 512-233-5341

www.tripleco.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

Text field with buttons like the To field in Mail

2009-01-14 Thread Sergey Kuleshov
Hello all,

I am very new to cocoa development and just making my first steps.
What I am trying to do is something like a To field in Mail.app which
provides autocomplete and once matched replaces the text with the
button.

After hours of googling it looks like I have to put NSButtonCell
inside NSTextView (or NSTextField?) however, I can't understand how do
it though it should be fairly common as I see same kind of behavior in
many applications! (especially for list of tags) Maybe there is a
ready made component?

Thank you advance for your help and sorry for such a lame question!


-- 
Sergey Kuleshov
___

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

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

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

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


What determines VSIZE allocation?

2009-01-14 Thread Tobias Zimmerman
I have searched for an answer to this question, including in Amit Singh's
book, but have not found the answer (at least, not in a form that I
recognize it).
I have a fairly simple Cocoa app that creates an NSStatusItem with a small
menu.  It is compiled using Garbage Collection and in 64bit mode (it
identifies in the Activity Monitor as Intel(64 bit).

In non-debug mode it basically just sits there.  The active memory usage is
quite reasonable -- about 4.5 to 7.5MB of RPRVT, 10MB RSIZE and 23-30MB
RSHRD.  However, the VSIZE is 8.36GB (giga, with a G).  Compiling in
32bit mode drops VSIZE to 475MB, which is still an awful lot for such a
small app.

I know there are people who will say VSIZE doesn't matter if there is no
paging, but if I ever sought to distribute my app people will not want to
install a statusitem that looks like a memory hog.

My question is two-fold:  (1) How does the OS determine how much to allocate
to VSIZE? and (2) is there something I am doing wrong in my app (likely)
that is causing the out-sized allocation?

I am a newbie w/r/t cocoa and objective-C, but I have read the article on
garbage collection and tried to understand and apply 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


ImageAndTextCell + NSOutlineView editing problem

2009-01-14 Thread Andrew Shamel

Greetings Cocoa-Dev!

I am having the hardest time with a persistent and strange error with  
Apple's ImageAndTextCell in my NSOutlineView.


I have the ImageAndTextCell set to be the outline's data cell via  
NSTableColumn's -setDataCell: method, and I set the image of the cell  
in the outlineView's delegate, using  -  
(void)outlineView:willDisplayCell:forTableColumn:item:  And here's  
where the trouble starts.


The problem I am encountering is this: When I have an image set in the  
cell, and I go to edit the text of the *first* item in any particular  
set of children, after the first keystroke, the text field goes  
haywire, turning white, with the text appearing only as shadow lines,  
and editing stops.  If I click off the cell, the mess goes away, the  
one keystroke's worth of edit remains, but does not get noticed by the  
bindings.


Here is a picture of what happens: http://www.pileofdebris.com/editError.png

Does anyone have any thoughts about why this might be happening?  I've  
figured out that if my willDisplayCell: delegate method is empty, this  
does not happen.  Here is the code for that method, should it be of  
any help.


- (void)outlineView:(NSOutlineView *)outlineView willDisplayCell: 
(id)cell forTableColumn:(NSTableColumn *)tableColumn item:(id)item

{
NSManagedObject *node = [item representedObject];
NSString *type = [node valueForKey:@type];
NSString *tag = [node valueForKey:@tag];

if ([type isEqual:@collection]) {
[cell setImage:[self defaultFolderImage]];
} else if ([type isEqual:@library]) {
if ([tag isEqual:@booksLibrary]) {
[cell setImage:[self booksLibraryImage]];
} else if ([tag isEqual:@articlesLibrary]) {
[cell setImage:[self articlesLibraryImage]];
} else {
[cell setImage:[self articlesLibraryImage]];
}
} else if ([type isEqual:@section]) {
[cell setImage:nil];
[cell setEditable:NO];
[cell setSelectable:NO];
} else if ([type isEqual:@smartCollection]) {
[cell setImage:[self smartFolderImage]];

}
}

Thanks so much for any input people can offer.

pax,

Andy 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: IKImageView setImage only works once.

2009-01-14 Thread Graham Cox


On 15 Jan 2009, at 2:07 pm, James Trankelson wrote:


It turns out that calling [setImage: imageProperties:] is happiest to
be called from the main thread. Calling it by using
performSelectorOnMainThread: works.



Anything concerned with views or other drawing must be called on the  
main thread. That goes for any method implemented by any view.


--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: What determines VSIZE allocation?

2009-01-14 Thread Andrew Farmer

On 14 Jan 09, at 14:31, Tobias Zimmerman wrote:
I have searched for an answer to this question, including in Amit  
Singh's

book, but have not found the answer (at least, not in a form that I
recognize it).
I have a fairly simple Cocoa app that creates an NSStatusItem with a  
small

menu.  It is compiled using Garbage Collection and in 64bit mode (it
identifies in the Activity Monitor as Intel(64 bit).

In non-debug mode it basically just sits there.  The active memory  
usage is
quite reasonable -- about 4.5 to 7.5MB of RPRVT, 10MB RSIZE and  
23-30MB
RSHRD.  However, the VSIZE is 8.36GB (giga, with a G).   
Compiling in
32bit mode drops VSIZE to 475MB, which is still an awful lot for  
such a

small app.

I know there are people who will say VSIZE doesn't matter if there  
is no
paging, but if I ever sought to distribute my app people will not  
want to

install a statusitem that looks like a memory hog.

My question is two-fold:  (1) How does the OS determine how much to  
allocate
to VSIZE? and (2) is there something I am doing wrong in my app  
(likely)

that is causing the out-sized allocation?


The short version:

Ignore the number under the VSIZE column. In fact, turn that column  
off. It has no practical meaning whatsoever.



The long version:

VSIZE is the total amount of address space that's mapped for your  
application. This includes things like libraries and shared memory, so  
it doesn't really correlate directly with *real* memory usage (which  
is tracked much more accurately by RSIZE). Beyond that, I understand  
that garbage collection also uses virtual memory in various clever  
ways. This is most noticeable under 64-bit builds, but I think it does  
similar things (albeit on a more limited scale) under 32-bit builds.


If you're curious what all the virtual address space is being used for  
within an application, play around with the vmmap and vmmap64  
utilities. But don't try to minimize address space usage unless you're  
actually low on it (in 32-bit apps).

___

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

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

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

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


Re: What determines VSIZE allocation?

2009-01-14 Thread Bill Bumgarner

On Jan 14, 2009, at 2:31 PM, Tobias Zimmerman wrote:
I have searched for an answer to this question, including in Amit  
Singh's

book, but have not found the answer (at least, not in a form that I
recognize it).
I have a fairly simple Cocoa app that creates an NSStatusItem with a  
small

menu.  It is compiled using Garbage Collection and in 64bit mode (it
identifies in the Activity Monitor as Intel(64 bit).

In non-debug mode it basically just sits there.  The active memory  
usage is
quite reasonable -- about 4.5 to 7.5MB of RPRVT, 10MB RSIZE and  
23-30MB
RSHRD.  However, the VSIZE is 8.36GB (giga, with a G).   
Compiling in
32bit mode drops VSIZE to 475MB, which is still an awful lot for  
such a

small app.

I know there are people who will say VSIZE doesn't matter if there  
is no
paging, but if I ever sought to distribute my app people will not  
want to

install a statusitem that looks like a memory hog.

My question is two-fold:  (1) How does the OS determine how much to  
allocate
to VSIZE? and (2) is there something I am doing wrong in my app  
(likely)

that is causing the out-sized allocation?


Nope -- you aren't doing anything wrong.

VSIZE does not actually indicate the amount of memory allocated, but  
not necessarily used or paged out, for the application.


A more accurate description is that VSIZE indicates the amount of  
address space the application has reserved.


Under 64 bit, the garbage collector reserves 8GB of address space to  
ensure that the Auto Zone -- the allocation zone from which the  
collector allocates all objects -- remains contiguous up to 8GB of  
GC'd memory usage.   As allocation requests are fulfilled, chunks of  
the address space are doled out to the program and utilized.


Note that reserving address space comes nearly for free (there is a  
bit of administrative metadata).  It is touching the memory -- writing  
data into it -- that is costly.


The absolute VSIZE of your application isn't terribly useful.  The  
change over time is, though.  If the VSIZE is increasing relatively  
steadily over time *and* you don't know exactly why (there are  
legitimate reasons, especially under 64 bit), then it likely indicates  
that there is a memory leak in the form of, say, mapped files.


In general, the RSIZE and RPRVT of your application are more  
immediately interesting.


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: Text field with buttons like the To field in Mail

2009-01-14 Thread Quincey Morris

On Jan 14, 2009, at 08:30, Sergey Kuleshov wrote:


I am very new to cocoa development and just making my first steps.
What I am trying to do is something like a To field in Mail.app which
provides autocomplete and once matched replaces the text with the
button.

After hours of googling it looks like I have to put NSButtonCell
inside NSTextView (or NSTextField?) however, I can't understand how do
it though it should be fairly common as I see same kind of behavior in
many applications! (especially for list of tags) Maybe there is a
ready made component?



See:


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

The first sentence of this reads:

NSTokenField is a subclass of NSTextField that provides tokenized  
editing similar to the address field in the Mail application.



I have a feeling that's probably what you're looking for. ;)


___

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

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

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

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


drag and drop with snapping

2009-01-14 Thread Francisco Tolmasky
I'd like to implement drag and drop behavior with snapping to guides
in my application.  I have looked at both the NSDraggingSource and
NSDraggingDestination protocols and there seems to be no obvious way
of modifying the position of the dragged image.  Do I need to make my
own transparent window and handle all drag-drawing myself to
accomplish this?

Thanks,

-- 
Francisco Tolmasky
www.tolmasky.com
tolma...@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


Dealing with exceptions in a drawing stack

2009-01-14 Thread Graham Cox
Suppose I have a drawing stack that is called from a view's drawRect:  
method. This stack can end up quite deep, with objects calling other  
objects to implement parts of their drawing. Some of these methods  
will save and restore the graphics context.


If an exception is thrown from somewhere down inside this stack, I'd  
prefer it if I could continue to draw what can be drawn, rather than  
have to abort the drawing altogether which usually leaves the whole  
view in a weird state (at which point I'm hosed - I have to abandon  
that document and create a new one, which is hardly user friendly).


Short of using try/catch around every place where the graphics context  
is saved and restored, is there a way to unwind the graphics context  
stack or at least put it into a good known state? (i.e. discard all  
the saved states and start over). If so, I can then implement a try/ 
catch at a higher level and fix up the graphics context there.


Anyone had some experience of handling this?

--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: Dealing with exceptions in a drawing stack

2009-01-14 Thread Kyle Sluder
On Wed, Jan 14, 2009 at 11:34 PM, Graham Cox graham@bigpond.com wrote:
 If an exception is thrown from somewhere down inside this stack, I'd prefer
 it if I could continue to draw what can be drawn, rather than have to abort
 the drawing altogether which usually leaves the whole view in a weird state
 (at which point I'm hosed - I have to abandon that document and create a new
 one, which is hardly user friendly).

This is known as a continuation.  Scheme, for example, often uses
them instead of exceptions.  Much like a jmp_buf, It contains all of
the information necessary to resume execution at the point the
continuation is created.  In the event of an error, an error handler
is invoked with the continuation object, at which point the error
handler can inspect the error condition and potentially modify the
state such that execution can continue to proceed.  It then executes
the continuation and the program resumes where it left off.

This isn't the model that exceptions follow, unfortunately.  By the
time your @catch block has caught the exception, the stack has already
been unwound and you can't get it back.

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


what the hell is Error (1007) creating CGSWindow?

2009-01-14 Thread Michael B Johnson
So I have an application that has been bedeviled by a nasty, nasty bug  
for years that manifests itself as an exception being thrown with:


Error (1007) creating CGSWindow

At that point, the user has no choice but to reboot the machine - the  
Window Server is pretty much hoarked.


Since the app is so complex, and the code path for tickling this bug  
is so arbitrary, I've been loathe to file a bug on it, since I didn't  
have a simple example to repro it.


Completely separately, I decided this AM to write a simple Cocoa app  
to generate a bunch of test files for my group.  Lo and behold, I  
managed to tickle the bug.


Error (1007) creating CGSWindow

I just filed the radar bug as  6498067

but if anyone wants to take a look, I'm happy to send you the source  
for the app - it's only 60KB, but the core of the thing looks like  
this (it falls apart after making about 340 images, on my machine with  
32GB of RAM, and a NVidia FX5600 w/1.5GB of VRAM):


where we're going from 0 to 1,000, and the width and height are  
1920x1080 - seems to crap out after 340 files for me.




// eventually put this in a background thread with a cancel button on  
a progress sheet

- (IBAction)generateFiles:(id)sender {
int start = [self.startingNumber intValue];
int howMany = 1 + [self.endingNumber intValue] - start;
NSSize imgSize = [self size];   
int i, digits = [self.endingNumber digits];

int fontSize = [self determineFontSizeForNumber:self.endingNumber];
	NSString* formatString = [NSString stringWithFormat:@%%0%dd,  
digits]; // end up with %03d

NSRect rect = NSMakeRect(0, 0, imgSize.width, imgSize.height);
for (i = 0; i  howMany; i++) {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSString* str = [NSString stringWithFormat:formatString, i];
NSFont* font = [NSFont systemFontOfSize:fontSize];
		NSDictionary* dict = [NSDictionary  
dictionaryWithObjectsAndKeys:font, NSFontAttributeName,  
self.textColor, NSForegroundColorAttributeName, nil];
		NSAttributedString* aStr = [[[NSAttributedString alloc]  
initWithString:str attributes:dict] autorelease];


NSImage* image = [[NSImage alloc] initWithSize:imgSize];
[image lockFocus];
[aStr drawInRect:rect];
[image unlockFocus];

		NSString* imgFormatString = [NSString stringWithFormat:@%...@_% 
%0%dd.tif, digits]; // end up with %03d
		NSString* imgName = [NSString stringWithFormat:imgFormatString,  
self.prefix, i];
		NSString* imgPath = [self.directory  
stringByAppendingPathComponent:imgName];
		NSData* tiffData = [image  
TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:1.0];

[tiffData writeToFile:imgPath atomically:YES];

[pool drain];
}
}




Thanks for any insight.



-- Michael B. Johnson, PhD
-- http://homepage.mac.com/drwave (personal)
-- http://xenia.media.mit.edu/~wave (alum)
-- MPG Lead
-- Pixar Animation Studios




___

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

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

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

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


Re: what the hell is Error (1007) creating CGSWindow?

2009-01-14 Thread Joe Ranieri
		NSDictionary* dict = [NSDictionary  
dictionaryWithObjectsAndKeys:font, NSFontAttributeName,  
self.textColor, NSForegroundColorAttributeName, nil];
		NSAttributedString* aStr = [[[NSAttributedString alloc]  
initWithString:str attributes:dict] autorelease];


NSImage* image = [[NSImage alloc] initWithSize:imgSize];


You're leaking this NSImage.

-- Joe Ranieri
___

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

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

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

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


Re: what the hell is Error (1007) creating CGSWindow?

2009-01-14 Thread Michael B Johnson


On Jan 14, 2009, at 9:13 PM, Joe Ranieri wrote:

		NSDictionary* dict = [NSDictionary  
dictionaryWithObjectsAndKeys:font, NSFontAttributeName,  
self.textColor, NSForegroundColorAttributeName, nil];
		NSAttributedString* aStr = [[[NSAttributedString alloc]  
initWithString:str attributes:dict] autorelease];


NSImage* image = [[NSImage alloc] initWithSize:imgSize];


You're leaking this NSImage.


sigh.  I knew I should have explained this more.

I know, in the code snippet I sent, that the NSImage is being leaked.   
But it's tickling the bug (where in the app, I have 100s of NSImages,  
and I need to keep them around).  Why, on a machine with 32GB of RAM,  
and 1.5GB of VRAM, would having 350 1920x1080 NSImages live in the app  
be a problem?  Make my app page, sure, but kill the window server so  
bad that it needs to get restarted?


Not acceptable.




-- Michael B. Johnson, PhD
-- http://homepage.mac.com/drwave (personal)
-- http://xenia.media.mit.edu/~wave (alum)
-- MPG Lead
-- Pixar Animation Studios




___

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

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

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

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


Re: Dealing with exceptions in a drawing stack

2009-01-14 Thread Graham Cox


On 15 Jan 2009, at 3:53 pm, Kyle Sluder wrote:


This is known as a continuation.  Scheme, for example, often uses
them instead of exceptions.  Much like a jmp_buf, It contains all of
the information necessary to resume execution at the point the
continuation is created.  In the event of an error, an error handler
is invoked with the continuation object, at which point the error
handler can inspect the error condition and potentially modify the
state such that execution can continue to proceed.  It then executes
the continuation and the program resumes where it left off.



OK, interesting...




This isn't the model that exceptions follow, unfortunately.  By the
time your @catch block has caught the exception, the stack has already
been unwound and you can't get it back.



That's OK for the stack in general. The problem seems to be it leaves  
the graphics context stack out of whack. I can obviously deal with  
this by @catching wherever I have used saveGraphicsState and calling  
restoreGraphicsState in my catch block before rethrowing, but it's  
really clunky.


What I tried was this:

// at my very top level, i.e. [NSView drawRect:]

NSGraphicsContext* topContext = [[NSGraphicsContext currentContext]  
retain];


@try
{
	// make all my other drawing calls, any of which might save/restore  
the graphics context but also could throw an exception


}
@catch( NSException* exc )
{
// we're back at the top, just ignore the exception here
}

[NSGraphicsContext setCurrentContext:topContext];
[topContext release];


Which actually seems to work - the view is no longer screwed up and  
unusable following an exception. However, I'm not sure this is safe,  
as it's blowing away all the stacked graphics contexts. While that's  
what I want, I don't know if I'm allowed to just forget they ever  
existed in this way.


--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: What determines VSIZE allocation?

2009-01-14 Thread Michael Ash
On Wed, Jan 14, 2009 at 5:31 PM, Tobias Zimmerman automa...@gmail.com wrote:
 I know there are people who will say VSIZE doesn't matter if there is no
 paging,

This is kind of like that famous question, Have you stopped beating
your wife? VSIZE doesn't matter, period. Paging doesn't enter into
it.

 but if I ever sought to distribute my app people will not want to
 install a statusitem that looks like a memory hog.

The solution there is to educate the foolish people who think that
VSIZE is any indication of being a memory hog, not to artificially
reduce a number that has no bearing on any kind of system resource
usage.

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: what the hell is Error (1007) creating CGSWindow?

2009-01-14 Thread Michael Ash
On Thu, Jan 15, 2009 at 12:16 AM, Michael B Johnson w...@pixar.com wrote:

 On Jan 14, 2009, at 9:13 PM, Joe Ranieri wrote:

NSDictionary* dict = [NSDictionary
 dictionaryWithObjectsAndKeys:font, NSFontAttributeName, self.textColor,
 NSForegroundColorAttributeName, nil];
NSAttributedString* aStr = [[[NSAttributedString alloc]
 initWithString:str attributes:dict] autorelease];

NSImage* image = [[NSImage alloc] initWithSize:imgSize];

 You're leaking this NSImage.

 sigh.  I knew I should have explained this more.

 I know, in the code snippet I sent, that the NSImage is being leaked.  But
 it's tickling the bug (where in the app, I have 100s of NSImages, and I need
 to keep them around).  Why, on a machine with 32GB of RAM, and 1.5GB of
 VRAM, would having 350 1920x1080 NSImages live in the app be a problem?
  Make my app page, sure, but kill the window server so bad that it needs to
 get restarted?

 Not acceptable.

350 32-bit images of that size works out to 2.7GB of memory. That's
getting dangerously close to the limit of a 32-bit process. That limit
is nominally 4GB, but system libraries decrease it significantly, and
of course the window server has other stuff to keep track of than your
images. NSImages created in this way use invisible windows which live
in the window server, so the memory usage counts against it, not your
app. When the window server runs out of address space and allocations
begin to fail, it probably can't recover nicely and down you go.

Now, should this happen? No. But UNIX is notoriously bad about
recovering from low-resource situations. The standard answer to just
about any resource allocation failure is to crash. Ideally the window
server should not be killed by one runaway process, but such is not
the world we live in.

As to the solution, draw into something you *know* lives in your
process and not on the window server, like an NSBitmapImageRep wrapped
in an NSGraphicsContext. Then you'll still kill your program (unless
you're building a 64-bit app), but you won't kill the system.

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: NIB's owner doesn't get released because of NSArrayController

2009-01-14 Thread Vitaly Ovchinnikov
Well, OK. I am ready to release all root objects myself. Just tested
with subclassed NSView from that NIB - it didn't get released
automatically.
So I added several -release calls to -dealloc method of my NIB's owner
and now it will release everything.
But the problem is still there: -dealloc of my view controller didn't
get called because array controller still retains it!
As I wrote above, I added special killer method that breaks binding
and after calling it I can call -release and it will call NIB owner's
-dealloc. But this is ugly...

On Thu, Jan 15, 2009 at 1:15 AM, Jason Foreman ja...@threeve.org wrote:
 On Wed, Jan 14, 2009 at 3:51 PM, Vitaly Ovchinnikov
 vitaly.ovchinni...@gmail.com wrote:
 Hello all,

 I have a custom-loaded NIB file with NSView and NSArrayController.
 Array controller is bound to file's owner (NSObject's derived class)
 and use some keypath for contentArray. The problem is when I close a
 window and main window controller tries to release this file's owner -
 array controller still holds a reference to it and doesn't allow to do
 that.

 So I have two questions:
 1. What is the correct way to catch closing of the view to unbound
 array controller?
 2. Do I really need to catch something? Maybe there is a simpler solution?

 Any ideas?

 Top-level objects in a nib need to be released.  You can do this in
 the File's Owner object when the window is closed, for example.

 See this page for some additional info on nib object memory management:

 http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/MemMgmtNibObjects.html


 Jason
 ___

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

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

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

 This email sent to vitaly.ovchinni...@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


Quick (?) NSCell question: getting the drawing (inner) rectangle

2009-01-14 Thread Luke Evans
I'm trying to determine what a cell's drawing rect will be  
(particularly the 'interior' size eventually expected to be sent to - 
drawInteriorWithFrame:inView: when the cell is actually drawn).
I can get the 'prototypical' cell object by asking for the pertinent  
NSTableView column, and then asking for the cell.  I can see that  
NSCell supports a range of methods under the heading Determining Cell  
Size in the docs.
The method -drawingRectForBounds: looks promising, but it takes  
another rectangle, i.e. the bounds.  Assuming that this method would  
give me what I want, how do I first obtain the appropriate 'bounds' to  
feed it?


Perhaps this method is only intended to provide information to the  
system by the NSCell implementation and is not intended for the  
purpose I need.  In which case, is there a way to achieve what I want  
without having to ask for the NSTableColumn width and working out what  
proportion of this width is used for non-'interior' furniture (if any)?


Cheers

-- Luke



___

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

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

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

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


Center image in NSTableView header

2009-01-14 Thread Ivan C Myrvold
I am creating an NSAttributedString containing an image in an  
NSTextAttachment, setting an NSTableView headerCell to the  
attachmentCell.
This works great, the image is shown nicely on the table view column  
header.
But I am unable to get the image centered in the column header. Anyone  
have a hint to how I can do that?

Here is my code:

NSImage *warningImage = [NSImage imageNamed:@danger];
NSTextAttachment *ta = [[[NSTextAttachment alloc] init] 
autorelease];
[(NSCell *)[ta attachmentCell] setImage:warningImage];

		NSAttributedString *headerAS = [NSAttributedString  
attributedStringWithAttachment:ta];
		[[[oactiveElementsTable tableColumnWithIdentifier:@warningword]  
headerCell] setAttributedStringValue:headerAS];


Ivan
___

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

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

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

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


Re: Localized resources not loading from external frameworks

2009-01-14 Thread Nick Zitzmann


On Jan 13, 2009, at 6:03 PM, Samir Patel wrote:

All the files are in the right locations, but when I run my app  
which is linked against the framework, the English version of my UI  
from the framework always loads no matter what language I have set  
in System Preferences.


Any ideas how to get the localized resources to load?



Which macro are you using? You must use  
NSLocalizedStringFromTableInBundle() within non-app bundles and  
frameworks, and the NSBundle passed in must point to the bundle  
holding the localized strings.


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



___

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

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

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

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


Re: What determines VSIZE allocation?

2009-01-14 Thread Bill Bumgarner

On Jan 14, 2009, at 9:40 PM, Michael Ash wrote:
On Wed, Jan 14, 2009 at 5:31 PM, Tobias Zimmerman  
automa...@gmail.com wrote:
I know there are people who will say VSIZE doesn't matter if there  
is no

paging,


This is kind of like that famous question, Have you stopped beating
your wife? VSIZE doesn't matter, period. Paging doesn't enter into
it.


but if I ever sought to distribute my app people will not want to
install a statusitem that looks like a memory hog.


The solution there is to educate the foolish people who think that
VSIZE is any indication of being a memory hog, not to artificially
reduce a number that has no bearing on any kind of system resource
usage.


Generally true (though I might choose a slightly different descriptor  
of the uselessness), but not always.


VSIZE *can* be a very useful indication that an application is  
consuming address space.   This is not the same as consuming memory  
and, to the user, is an utterly useless distinction to make.


For example, an application's VSIZE might be growing over time because  
it is mmap()'ing a bunch of files (or a few small files).   If the app  
fails to unmap, the VSIZE will grow and the app may likely exhaust its  
address space without any paging activity.


Example: for applications that are processing large files -- ID3 tag  
editors come to mind -- watching the VSIZE can be a useful way of  
determining if your code is properly managing the mapping of said files.


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


completely messed up with bindings...

2009-01-14 Thread Vitaly Ovchinnikov
Hello all,

I have array of Filter objects in my document. Filters are used in two ways:
1. I can select one of them to filter my data
2. I can browse them all and add, delete or/*modify any of them

My document exposes this array via -filters/-setFilters pair. I have
two NSArrayControllers: one for the first task and another for the
second task.

Main window has NSPopUpButton that is bound to the first array
controller. It is used to select filter. Window controller receives
messages from this button and call -setFilter method of my document.
Document filters data and all works fine, but I think there is a
simpler way to connect my document's -filter property and to
controller's selection. Is it possible? This is the first question.

Other array controller used for editing filters. I have NSTableView
bound to that controller that shows filter names and NSPredicateEditor
that is bound to selection of the second array controller. It is used
to edit filter.

All works fine, but I can't receive a notify that current filter was
changed. NSPopUpButton somehow knows that name of filter was changed
and displays it immediately. But my document's -setFilter method
didn't get called. -setFilters method didn't get called too.

I tried to bind filter property of my document to the first
controller's selection but it didn't work too. I wrote something like
this in the main window controller:
[[self document] bind:@filter toObject:pFiltersController1
withKeyPath:@selection options:nil]
I even added +initialize method to the document and exposed filter
binding. Nothing... Just some errors in log about
NSControllerObjectProxy predicate: unrecognized selector sent to
instance ..

So the questions are:
1. How to bind some property of my document to selected object of
NSArrayController? Or at least how to monitor changes of the selected
object?
2. What is the correct way to do what I want (two different types of
operations on one array)?
Thank you.
___

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

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

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

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