NSTreeController/OutlineView w/CoreData Bindings multiple selection?

2010-01-04 Thread Rick Mann
I have an NSTreeController and outline view displaying a hierarchy of Group 
objects. This works fine. The NSTreeController is bound to the managed object 
context, and uses a fetch predicate of parent == nil.

It won't let me select more than one row. Is it simply not possible to do so?

TIA,
Rick

___

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

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

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

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


Re: NS_INLINE and obj = nil;?

2010-01-04 Thread Andy Lee
On Jan 3, 2010, at 5:26 PM, Scott Ribe wrote:
 Easily fixed:
 
 #define GDRelease(x) [(x) release], (x) = nil, (void)0
 
 Not really a good fix; compiler error is preferable to tweaking your macro
 to allow compilation of nonsense ;-)

Actually this causes a compiler error if you try if (GDRelease(...)).

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


Simple Core Data problem - zombie objects left in store

2010-01-04 Thread Ken Tabb

Hi folks  Happy New Year,

I'm not sure why this is a problem as I've done this before now, so  
can't quite see the problem. This is all on 10.6.2 in a Core Data app  
(i.e. non-document-based). Despite re-reading the Core Data  
Programming Topics  Marcus Zarra's (excellent) book, I'm stumped as  
to why I'm getting the problem I am.


I've distilled it into a sample app with XML store, so I can 'read'  
the store etc.


In the sample app I have Department and Person objects. Department has  
an optional to-many relationship 'people', with a cascade delete rule.  
Person has a non-optional to-one relationship 'department' (which is  
the inverse of the other relationship), with a nullify delete rule.


If I add a new person in a given department, all is well (app can be  
quit / relaunched, everything is as it should be). If I then remove  
that person, all seems well. Until the store tries to save, at which  
point I get a department is a required value error. I then quit  
anyway, relaunch, and the person is back from the dead.


If I make the person's 'department' relationship optional, then it's  
quite happy saving the store after I delete a person. However if I  
then open up the XML store, the person is lingering on in cryogenic  
storage, with no owning department, i.e. they were removed from the  
department, but not deleted from the store. Bearing in mind this is  
after the app has quit, so can't be the Undo manager etc. retaining  
them for its own needs.


The button doing the removing is hooking up to the 'remove' action of  
the People array controller, which in turn binds its content set to  
the Departments array controller (controller key = selection, model  
key path = people).


So it seems the array controller is not trying to remove the Person  
object, but just trying to break its relationship to its containing  
Department.


I'm missing something brain-numbingly obvious aren't I? :)

Thanks in advance for pointing out my stupidity,

Ken

p.s. I've checked and the app delegate is definitely using  
NSXMLStoreType, not NSCryogeneticStoreType ;)


- - - - - - - - - -
Dr. Ken Tabb
Mac  UNIX Developer - Health  Human Sciences
Machine Vision  Neural Network researcher - School of Computer Science
University of Hertfordshire, UK


___

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

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

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

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


NSDate without time portion

2010-01-04 Thread Brian Bruinewoud
Hi All,

What's the best way to get an NSDate object for 'today' such that the time is 
00:00:00 (or any other constant).
I not interested in the time, I only care about the year-month-day, but I do 
need the the hours-minutes-seconds to be the same on all dates so that I can 
compare the dates.

Currently I do this:

NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
[dateFmter setTimeStyle:NSDateFormatterNoStyle];
[dateFmter setDateStyle:NSDateFormatterMediumStyle];

NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I need 
dateText anyway

self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
00:00:00

But this seems ugly, cumbersome and inefficient.

The other option might be to use NSDate, NSCalendar and NSDateComponents, but 
that seems to be even more ugly and cumbersome and probably more inefficient.

Something like NSDate dateForTodayWithNoTimeComponentPleaseKTHXBAI would be 
good.

Regards,
Brian.

(Apologies for gratuitous 
LOLspeak)___

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

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

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

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


IGNORE ME: Simple Core Data problem - zombie objects left in store

2010-01-04 Thread Tabb, Ken

Hi again folks,

of course, the IB Deletes objects on remove option for the People  
array

controller had something to do with it... sigh...

Sorry for filling up your Inboxes...
Ken

On 4 Jan 2010, at 10:14, Tabb, Ken wrote:


Hi folks  Happy New Year,

I'm not sure why this is a problem as I've done this before now, so
can't quite see the problem. This is all on 10.6.2 in a Core Data app
(i.e. non-document-based). Despite re-reading the Core Data
Programming Topics  Marcus Zarra's (excellent) book, I'm stumped as
to why I'm getting the problem I am.

I've distilled it into a sample app with XML store, so I can 'read'
the store etc.

In the sample app I have Department and Person objects. Department has
an optional to-many relationship 'people', with a cascade delete rule.
Person has a non-optional to-one relationship 'department' (which is
the inverse of the other relationship), with a nullify delete rule.

If I add a new person in a given department, all is well (app can be
quit / relaunched, everything is as it should be). If I then remove
that person, all seems well. Until the store tries to save, at which
point I get a department is a required value error. I then quit
anyway, relaunch, and the person is back from the dead.

If I make the person's 'department' relationship optional, then it's
quite happy saving the store after I delete a person. However if I
then open up the XML store, the person is lingering on in cryogenic
storage, with no owning department, i.e. they were removed from the
department, but not deleted from the store. Bearing in mind this is
after the app has quit, so can't be the Undo manager etc. retaining
them for its own needs.

The button doing the removing is hooking up to the 'remove' action of
the People array controller, which in turn binds its content set to
the Departments array controller (controller key = selection, model
key path = people).

So it seems the array controller is not trying to remove the Person
object, but just trying to break its relationship to its containing
Department.

I'm missing something brain-numbingly obvious aren't I? :)

Thanks in advance for pointing out my stupidity,

Ken

p.s. I've checked and the app delegate is definitely using
NSXMLStoreType, not NSCryogeneticStoreType ;)

- - - - - - - - - -
Dr. Ken Tabb
Mac  UNIX Developer - Health  Human Sciences
Machine Vision  Neural Network researcher - School of Computer
Science
University of Hertfordshire, UK


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/k.j.tabb
%40herts.ac.uk

This email sent to k.j.t...@herts.ac.uk


- - - - - - - - - -
Dr. Ken Tabb
Mac  UNIX Developer - Health  Human Sciences
Machine Vision  Neural Network researcher - School of Computer Science
University of Hertfordshire, UK


___

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

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

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

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


Re: Need font anti aliasing techniques

2010-01-04 Thread Matthew Lindfield Seager
On Monday, January 4, 2010, padmakumar padmaku...@tataelxsi.co.in wrote:
 What are all the ways we can programmatically make anti aliasing techniques 
 for texts displayed in NSTextField.

 regards
 PK

Try this:
http://tinyurl.com/anel

Or this is shorter  easier to read:
http://tinyurl.com/l2fucm

This is also a good resource:
http://whathaveyoutried.com/

Failing that, this example is quite helpful to some:
http://lmgtfy.com/?q=anti-aliasing+cocoa
___

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

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

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

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


Implementing search field in core-data app

2010-01-04 Thread Martin Hewitson
Dear list,

I have a fairly basic core-data model with a set of Category entities, each 
category contains then a set of Item entities. What I want to do is implement a 
search field which searches all items from all categories - something like the 
searching is done in Mail.app.

I'm not really sure how to go about this. I've tried binding the predicate 
bindings of an NSSearchField to the Item array controller, but this only 
searches in the items of the currently selected category (since the array 
controller is bound to categorycontroller.selection.items).

I also tried making another array controller which contains all items and then 
set a filter predicate on this depending on the user having chosen a state: 
'all categories' or 'currently selected category'. Then I bound my table view 
to this 'all items array controller'. But this is not so nice since the 
relationship between categories and items is not automatically handled.

Is there a 'correct' way to attack such a problem, or has someone else managed 
to implement a search interface something like Mail.app?

Best wishes,

Martin



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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


How to find that my app is running under same security session in fast user switch

2010-01-04 Thread Parimal Das
Hi all

My app can run multiple instances of itself for different users.
I want to check that in case of a fast user switch, If my app is
requesting data from port of other user, then i should block this attempt.

one suggested approach is to use Security/AuthSession.h
which has
*SessionGetInfo*(callerSecuritySession, mySession, sessionInfo);

This gives me the bits like *sessionHasGraphicAccess*, *sessionIsRoot,* and
others

Here i am getting the SecuritySessionId for my process.
I am confused that from which id/bit i should compare this id to get the
info about this -  Form where my app is running and from where it is
getting served are running in the same security session

Please correct my understanding. I am confused with global and per-user
window-server.



-- 
--
Warm Regards,

Parimal Das
___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Charles Jenkins

Thank you to all who offered your expertise!

Whatta dumb mistake! I thought all objects were retained once when 
created, not auto-released. Gah!


I've been programming for 20+ years--mostly with C++ and C#. Cocoa-ObjC 
has the steepest learning curve of any programming I have ever done. It 
makes me feel like an idiot, so you can certainly expect to see more of 
these noobish questions from me... Thanks in advance for your help and 
patience!

___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Paul Sanders
Essential reading:

http://developer.apple.com/mac/library/documentation/cocoa/Conceptual/MemoryMgmt/MemoryMgmt.html

The 'memory management rules' are not complex.  A much bigger 
problem is avoiding memory leaks.

Paul Sanders.

- Original Message - 
From: Charles Jenkins cjenk...@tec-usa.com
To: Cocoa-Dev List cocoa-dev@lists.apple.com
Sent: Monday, January 04, 2010 12:44 PM
Subject: Re: Why is [NSArray arrayWithObjects:] failing for me?


Thank you to all who offered your expertise!

Whatta dumb mistake! I thought all objects were retained once 
when
created, not auto-released. Gah!

I've been programming for 20+ years--mostly with C++ and C#. 
Cocoa-ObjC
has the steepest learning curve of any programming I have ever 
done. It
makes me feel like an idiot, so you can certainly expect to see 
more of
these noobish questions from me... Thanks in advance for your 
help and
patience!



___

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

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

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

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


Re: Setting NSWindow titlebar height

2010-01-04 Thread Jeremy Pereira

On 3 Jan 2010, at 19:41, PCWiz wrote:

 I have a window that looks like this right now:
 
 http://img22.imageshack.us/img22/2953/screenshot20100103at123.png
 
 I've removed the titlebar buttons and everything

Why?  How does the user make the Window go away/hide without the title bar 
buttons?  

Perhaps I'm being unfair since I don't know what this window is for, but it 
seems like a huge waste of time and energy to try to do difficult things that 
break the Apple human interface guidelines.

 , however there is still that space at the top where the titlebar usually is. 
 Is there a way to remove that space (in other words, a way to set the height 
 of the title bar?). Moving up the NSToolbar would work too, is that possible?
 



 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.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/adc%40jeremyp.net
 
 This email sent to a...@jeremyp.net


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

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Charles Jenkins

On 2010-01-03 00:08, Eric Smith wrote:

Correct, do not release the array.  If you don't create it with init, or 
retain it, then you should not release it.
   
Eric, thank you for stating that rule. It should be easy enough to 
remember and help me avoid this problem in the future.


In my defense, there seems to be a bug in the latest XCode, which make 
strings stored in NSArrays look like garbage when inspected during 
debugging. So the elements of pnl appeared to be trashed immediately 
upon creation. That's why I was looking for the bug in the wrong place.


Does anyone else find XCode extremely buggy? I have to continually close 
and reopen my editing window because the code display gets trashed and 
appears to scramble my code. It doesn't really change the source code 
file; it just makes it look as if I've randomly gone through the file 
deleting stuff, and when I see that happen, I immediately save, close, 
and reopen the window, and everything is fine.


Mac software is usually first class, stable, and beautiful. How do folks 
write such great software when they're stuck with such a sub-par IDE? :-)


___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Kai Brüning

On 4.1.2010, at 13:44, Charles Jenkins wrote:

 Thank you to all who offered your expertise!
 
 Whatta dumb mistake! I thought all objects were retained once when created, 
 not auto-released. Gah!
 
 I've been programming for 20+ years--mostly with C++ and C#. Cocoa-ObjC has 
 the steepest learning curve of any programming I have ever done.

Strange that you feel so. I’d say C++ is way more complex - although I did 20+ 
years of C++ coding and only 2 of ObjC/Cocoa.

But in any case you can take the whole retain/release problem out of your 
learning curve by switching to GC - unless you are targeting the iPhone.

 It makes me feel like an idiot, so you can certainly expect to see more of 
 these noobish questions from me... Thanks in advance for your help and 
 patience!

Kai___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Graham Cox

On 04/01/2010, at 11:58 PM, Charles Jenkins wrote:

 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
   
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.


One of the rules of this forum is don't restate the memory management rules, 
but instead point to the relevant documentation. While the gist of what Eric 
says is right, it's incomplete and potentially misleading, especially as 'init' 
does not create anything.

 In my defense, there seems to be a bug in the latest XCode, which make 
 strings stored in NSArrays look like garbage when inspected during debugging. 
 So the elements of pnl appeared to be trashed immediately upon creation. 
 That's why I was looking for the bug in the wrong place.

The debugger is gdb - Xcode merely acts as a window for it. I think I have seen 
the same effect but I don't think it's Xcode's fault necessarily. Ensure you 
are properly compiling for debug with no optimisation and so on.

 Does anyone else find XCode extremely buggy? I have to continually close and 
 reopen my editing window because the code display gets trashed and appears to 
 scramble my code. It doesn't really change the source code file; it just 
 makes it look as if I've randomly gone through the file deleting stuff, and 
 when I see that happen, I immediately save, close, and reopen the window, and 
 everything is fine.
 
 Mac software is usually first class, stable, and beautiful. How do folks 
 write such great software when they're stuck with such a sub-par IDE? :-)


I haven't experienced this. Some other minor irritations for sure, but nothing 
major. On the whole I've found Xcode to be pretty solid.

It might be worth taking this up on the xcode users list, or at least having a 
look through its archives to see if it's a common problem.

--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: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Roland King

On 04-Jan-2010, at 8:58 PM, Charles Jenkins wrote:

 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
   
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.

With respect to Eric, that's part of the rule, the rules are in the memory 
management guide and it's better to read them in full from the apple 
documentation than paraphrase them. 

 
 In my defense, there seems to be a bug in the latest XCode, which make 
 strings stored in NSArrays look like garbage when inspected during debugging. 
 So the elements of pnl appeared to be trashed immediately upon creation. 
 That's why I was looking for the bug in the wrong place.
 
 Does anyone else find XCode extremely buggy? I have to continually close and 
 reopen my editing window because the code display gets trashed and appears to 
 scramble my code. It doesn't really change the source code file; it just 
 makes it look as if I've randomly gone through the file deleting stuff, and 
 when I see that happen, I immediately save, close, and reopen the window, and 
 everything is fine.
 
 Mac software is usually first class, stable, and beautiful. How do folks 
 write such great software when they're stuck with such a sub-par IDE? :-)

I've found XCode, especially the recent releases, to be very good indeed. 
Certainly the XCode released with Snow Leopard (and since updated) is stable 
and I've not had any of those issues with it myself. If you have repeatable 
issues with XCode there is an XCode users list with a lot of helpful people on 
it and a couple of the toolchain guys from Apple do read it from time to time 
and reply also. I've had several questions answered there (mostly about how to 
do X or Y, XCode has a bit of a learning curve especially when you start to get 
creative with targets and executables). 


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

___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Kai Brüning

On 4.1.2010, at 13:58, Charles Jenkins wrote:

 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
   
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.
 
 In my defense, there seems to be a bug in the latest XCode, which make 
 strings stored in NSArrays look like garbage when inspected during debugging. 
 So the elements of pnl appeared to be trashed immediately upon creation. 
 That's why I was looking for the bug in the wrong place.

Yes, the data formatters in the debugger do not always work. Typing po 
object (e.g. po [pnl objectAtIndex:0]) normally works. po stand for print 
object.
 
 Does anyone else find XCode extremely buggy?

Not at all. For me Xcode is extremely robust and a lot of fun to use. I use the 
latest version under Snow Leopard, but it was mostly the same under Leopard, 
too. My impression was that Xcode gained a lot of robustness when it was 
switched to GC.

 I have to continually close and reopen my editing window because the code 
 display gets trashed and appears to scramble my code. It doesn't really 
 change the source code file; it just makes it look as if I've randomly gone 
 through the file deleting stuff, and when I see that happen, I immediately 
 save, close, and reopen the window, and everything is fine.

Sounds scary, i’ve never seen this.
 
 Mac software is usually first class, stable, and beautiful. How do folks 
 write such great software when they're stuck with such a sub-par IDE? :-)

They aren’t. There must be something very special with your setup.

Best
Kai


___

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

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

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

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


Animating an NSView in from Below.

2010-01-04 Thread Joshua Garnham
I know there are tutorials
like Marcus Zarras which shows how to change from one view to another,
but I would like to animate in a view which isn't going to replace another
view. Here's what I have at the moment:http://drp.ly/9w86s (Test App).
The view seems to slide in but the view isn't actually displayed. What's wrong?

Thanks.




___

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

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

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

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


Re: iPhone: load cell from XIB slows down tableview?

2010-01-04 Thread Damien Cooke


John,
I had a similar issue. For me the problem turned out to be that the  
reusableId was not being set as it was imported from the nib. Thus the  
call dequeue one was always retuning nil.  I solved this by building  
the cell by hand and calling the correct init method so the reusableid  
was being set and all works well now. Let me know if there is a better  
solution.


Regards
Damien

Sent from my iPhone 3GS

On 04/01/2010, at 3:33 PM, John Michael Zorko jmzo...@mac.com wrote:



Hello, all ...

I'm trying to determine why my tableviews scroll so jerkily on  
non-3GS devices. The datasource only has perhaps 170 records, so I  
think it may have something to do with how i'm instantiating the  
cells in -tableView:cellForRowAtIndexPath. In other apps i've done,  
I create the view for the cell programmatically, and alloc / init  
the cell if I can't dequeue it. However, in this app, I have the  
cell's view loaded from a XIB. Is there a better way of defining my  
cell's view with IB that still results in a performant tableview?


- (UITableViewCell *)tableView:(UITableView *)tableViewIn  
cellForRowAtIndexPath:(NSIndexPath *)indexPath

{
  static NSString *cellID = @mycellID;

   MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication  
sharedApplication] delegate];


   LogDailyCell *cell = (LogDailyCell *)[tableViewIn  
dequeueReusableCellWithIdentifier:cellID];


  if (nil == cell)
  {
   NSArray *nib = [[NSBundle mainBundle]  
loadNibNamed:@LogDailyCell
owner:self  
options:nil];

   for (id oneObject in nib)
   {
   if ([oneObject isKindOfClass:[LogDailyCell class]])
   {
   cell = (LogDailyCell *)oneObject;
   break;
   }
   }
  }

   MyObject *act = nil;

   switch(indexPath.section)
   {
   case 0:
   act = [appDelegate array1ItemAtIndex:indexPath.row];
   cell.type = 2;
   break;
   case 1:
   act = [appDelegate array2ItemAtIndex:indexPath.row];
   cell.type = 3;
   break;
   case 2:
   act = [appDelegate array3ItemAtIndex:indexPath.row];
   cell.type = 4;
   break;
   case 3:
   act = [appDelegate array4ItemAtIndex:indexPath.row];
   cell.type = 5;
   break;
   }

   cell.name.text = act.name;
   cell.label1.text = [NSString stringWithFormat:@%i,  
act.anNSString];

   cell.field1.text = @;
   cell.field2.text = @;
   cell.ident = indexPath.row;
   [cell.deleteButton removeFromSuperview];

  return cell;
}

Regards,

John
___

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

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

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

This email sent to dam...@smartphonedev.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: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Dave Keck
 Does anyone else find XCode extremely buggy? I have to continually close and
 reopen my editing window because the code display gets trashed and appears
 to scramble my code. It doesn't really change the source code file; it just
 makes it look as if I've randomly gone through the file deleting stuff, and
 when I see that happen, I immediately save, close, and reopen the window,
 and everything is fine.

This bug occurs for me fairly often - it usually happens when doing
something using auto-completion. Luckily, as you said, it doesn't
actually corrupt the file. :)
___

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

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

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

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


Re: Question about garbage collection

2010-01-04 Thread Quincey Morris
On Jan 3, 2010, at 18:21, Ben Haller wrote:

 Bill, I for one would like to hear a bit more about this.  What has changed 
 in SL?  Why would it ever be possible to outrun the collector?  If the limit 
 of memory is being reached, can't it always just do an immediate, synchronous 
 collection before the call to +alloc returns?  I'd love to have a better 
 understanding of what's going on under the hood here...

I think this:

http://lists.apple.com/archives/Cocoa-dev/2009/Jun//msg01586.html

is the thread where b.bum threw some light on that issue. (But I didn't reread 
the whole thing, so some of what I remember may be from a different thread.)



___

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

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

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

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


Re: Animating an NSView in from Below.

2010-01-04 Thread Graham Cox

On 05/01/2010, at 12:16 AM, Joshua Garnham wrote:

 I know there are tutorials
 like Marcus Zarras which shows how to change from one view to another,
 but I would like to animate in a view which isn't going to replace another
 view. Here's what I have at the moment:http://drp.ly/9w86s (Test App).
 The view seems to slide in but the view isn't actually displayed. What's 
 wrong?


The view 'secondView' is not part of the window, so there's nothing to display. 
All your code is doing is shrinking the first view, which is part of the window 
because you added it in IB.

You need to add 'secondView' to the window's content using [[window 
contentView] addSubview:secondView] at the start of the animation.

I realise you're only trying out a few ideas, but don't get carried away with 
this design - you need to move this stuff into a proper controller for your 
window.

--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: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Paul Bruneau


On Jan 4, 2010, at 7:58 AM, Charles Jenkins wrote:


On 2010-01-03 00:08, Eric Smith wrote:
Correct, do not release the array.  If you don't create it with  
init, or retain it, then you should not release it.


Eric, thank you for stating that rule. It should be easy enough to  
remember and help me avoid this problem in the future.


That rule isn't complete. Just read the published memory management  
docs that someone else linked for you--several times.


In my defense, there seems to be a bug in the latest XCode, which  
make strings stored in NSArrays look like garbage when inspected  
during debugging. So the elements of pnl appeared to be trashed  
immediately upon creation. That's why I was looking for the bug in  
the wrong place.


Does anyone else find XCode extremely buggy? I have to continually  
close and reopen my editing window because the code display gets  
trashed and appears to scramble my code. It doesn't really change  
the source code file; it just makes it look as if I've randomly gone  
through the file deleting stuff, and when I see that happen, I  
immediately save, close, and reopen the window, and everything is  
fine.


Mac software is usually first class, stable, and beautiful. How do  
folks write such great software when they're stuck with such a sub- 
par IDE? :-)


I don't find it buggy. I find it first class, stable and beautiful.
___

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

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

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

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


Re: Animating an NSView in from Below.

2010-01-04 Thread Florian Soenens

Joshua,

you are only setting the frames of your views but you never add  
secondView as a subview of your window.


Florian.

On 04 Jan 2010, at 14:16, Joshua Garnham wrote:


I know there are tutorials
like Marcus Zarras which shows how to change from one view to another,
but I would like to animate in a view which isn't going to replace  
another

view. Here's what I have at the moment:http://drp.ly/9w86s (Test App).
The view seems to slide in but the view isn't actually displayed.  
What's wrong?


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/florian.soenens%40nss.be

This email sent to florian.soen...@nss.be




Looking for Web-to-Print Solutions?
Visit our website :   http://www.vit2print.com


This e-mail, and any attachments thereto, is intended only for use by the 
addressee(s) named herein and may contain legally privileged and/or 
confidential information and/or information protected by intellectual property 
rights.
If you are not the intended recipient, please note that any review, 
dissemination, disclosure, alteration, printing, copying or transmission of 
this e-mail and/or any file transmitted with it, is strictly prohibited and may 
be unlawful.
If you have received this e-mail by mistake, please immediately notify the 
sender and permanently delete the original as well as any copy of any e-mail 
and any printout thereof.
We may monitor e-mail to and from our network.

NSS nv Tieltstraat 167 8740 Pittem Belgium 
___


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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Paul Sanders
Here's another useful link:

http://www.cocoadev.com/index.pl?NSZombieEnabled

I find enabling 'zombies' to be an excellent way of detecting an 
'over-released' object without getting horrible / delayed / 
cryptic crashes.  I aways have them enabled during debugging. 
Just a note of caution though: nothing is ever freed with this 
option enabled (which, when you're only debugging, is not really 
important).

And here is the 'tao of debugging' for OS X, which has a useful 
section on memory-related matters:

http://developer.apple.com/mac/library/technotes/tn2004/tn2124.html

Paul Sanders.



___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Jack Carbaugh

This has happened to me often.

On Jan 4, 2010, at 8:24 AM, Dave Keck wrote:

Does anyone else find XCode extremely buggy? I have to continually  
close and
reopen my editing window because the code display gets trashed and  
appears
to scramble my code. It doesn't really change the source code file;  
it just
makes it look as if I've randomly gone through the file deleting  
stuff, and
when I see that happen, I immediately save, close, and reopen the  
window,

and everything is fine.


This bug occurs for me fairly often - it usually happens when doing
something using auto-completion. Luckily, as you said, it doesn't
actually corrupt the file. :)
___

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

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

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

This email sent to intrn...@aol.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: NSDate without time portion

2010-01-04 Thread Quincey Morris
On Jan 4, 2010, at 02:26, Brian Bruinewoud wrote:

 What's the best way to get an NSDate object for 'today' such that the time is 
 00:00:00 (or any other constant).
 I not interested in the time, I only care about the year-month-day, but I do 
 need the the hours-minutes-seconds to be the same on all dates so that I can 
 compare the dates.
 
 Currently I do this:
 
NSDateFormatter *dateFmter = [[NSDateFormatter alloc] init];
[dateFmter setTimeStyle:NSDateFormatterNoStyle];
[dateFmter setDateStyle:NSDateFormatterMediumStyle];
 
NSString dateText = [ dateFmter stringFromDate: self.now ]; // !! !! I 
 need dateText anyway
 
self.now = [ dateFmter dateFromString: dateText ]; // !! truncate time to 
 00:00:00
 
 But this seems ugly, cumbersome and inefficient.
 
 The other option might be to use NSDate, NSCalendar and NSDateComponents, but 
 that seems to be even more ugly and cumbersome and probably more inefficient.

NSDate is *not* a good choice for these sorts of comparisons, because it's 
always a date and a time, and it's not as simple as it seems. Consider this 
(unlikely) example:

Suppose you decided to force the time to 2:30 am instead of midnight. Probably 
doesn't behave as expected on days of daylight savings changeover (in places 
when it changes at 2 am), where they might be no 2:30 am, or two of them. Also, 
the difference between two dates standardized like that is not necessarily 
exactly one day, so computing elapsed days can be problematic too.

If you only need to compare dates, you could certainly do it if you could 
standardize each NSDate to a unique time on that date, but choosing the time -- 
and standardizing to it -- is not easy unless you assume knowledge about how 
NSDate is implemented.

The correct solution is NSDateComponents. It's slightly bulkier but correct.


___

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

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

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

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


Re: iPhone: load cell from XIB slows down tableview?

2010-01-04 Thread Tony Ingraldi
On Jan 4, 2010, at 12:03 AM, John Michael Zorko wrote:

 I'm trying to determine why my tableviews scroll so jerkily on non-3GS 
 devices. The datasource only has perhaps 170 records, so I think it may have 
 something to do with how i'm instantiating the cells in 
 -tableView:cellForRowAtIndexPath. In other apps i've done, I create the view 
 for the cell programmatically, and alloc / init the cell if I can't dequeue 
 it. However, in this app, I have the cell's view loaded from a XIB. Is there 
 a better way of defining my cell's view with IB that still results in a 
 performant tableview?
 
 - (UITableViewCell *)tableView:(UITableView *)tableViewIn 
 cellForRowAtIndexPath:(NSIndexPath *)indexPath
 {
   static NSString *cellID = @mycellID;
 

Have you verified that you've set the Identifier for the custom cell in the XIB 
to match the above cellID?  If they don't match, you'll end up loading the XIB 
for every row in the table view.  If things are set up properly, the XIB will 
be loaded once for each visible row on the screen plus a few more depending on 
how fast you scroll.


   MyAppDelegate *appDelegate = (MyAppDelegate *)[[UIApplication 
 sharedApplication] delegate];
 
   LogDailyCell *cell = (LogDailyCell *)[tableViewIn 
 dequeueReusableCellWithIdentifier:cellID];
 
   if (nil == cell)
   {
   NSArray *nib = [[NSBundle mainBundle] 
 loadNibNamed:@LogDailyCell
   
  owner:self options:nil];
   for (id oneObject in nib)
   {
   if ([oneObject isKindOfClass:[LogDailyCell class]])
   {
   cell = (LogDailyCell *)oneObject;
   break;
   }
   }
   }

This is less of an issue, but iterating over the objects in the XIB can be 
avoided by adding an outlet connected to the custom cell to your class that 
owns the XIB.  I've got a sample project that demonstrates this available at

http://majestysoftware.com/code/CustomCellFromNib.zip

The project was created pre-3.0, so you'll get a deprecation warning when 
building.  The basic concept is still valid in 3.x.

--
   Tony Ingraldi
   http://www.majestysoftware.com/
   Old-fashioned values and high-tech 
know-how___

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

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

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

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


Re: NSTreeController/OutlineView w/CoreData Bindings multiple selection?

2010-01-04 Thread Sean McBride
Rick Mann (rm...@latencyzero.com) on 2010-01-04 4:08 AM said:

I have an NSTreeController and outline view displaying a hierarchy of
Group objects. This works fine. The NSTreeController is bound to the
managed object context, and uses a fetch predicate of parent == nil.

It won't let me select more than one row. Is it simply not possible to do so?

That should work.  You sure you have the 'multiple selection' checkbox on?

Sean


___

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

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

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

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


Retain Count of NSConnection object

2010-01-04 Thread Alexander Reichstadt

Hi and happy new year,

I have a server and a client app using NSConnection.

All seems to work fine. The client is doing something like  
[(NSDistantObject *)aServer doThis] while the server object has a method


- (oneway void)doThis
{
NSLog(@do something);
}

After calling this method, the retain count I geton the client side  
when I call [[aServer connectionForProxy] retainCount] has increased  
by 3. Why I cannot understand at all. It doesn't do anything. Even if  
I empty the entire method doThis it increases and makes my client run  
out of memory eventually.


Is the server actually influencing the retainCount of its client's  
connectionForProxy, or is the retainCount something that every party  
has to look after on its own (which I thought would be the case)?


I can hardly expect for this to be a Cocoa-bug but imagine I am  
misunderstanding something. Can anyone help and please tell me where I  
am erring here?


Thanks a lot
Alex



smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Retain Count of NSConnection object

2010-01-04 Thread Sherm Pendley
On Mon, Jan 4, 2010 at 10:34 AM, Alexander Reichstadt l...@mac.com wrote:

 I can hardly expect for this to be a Cocoa-bug but imagine I am
 misunderstanding something. Can anyone help and please tell me where I am
 erring here?

You're expecting -retainCount to return a useful number. It doesn't.

Have a look at:
http://developer.apple.com/Mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html

sherm--

-- 
Cocoa programming in Perl:
http://www.camelbones.org
___

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

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

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

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


Re: iPhone: load cell from XIB slows down tableview?

2010-01-04 Thread John Michael Zorko


Tony,

Have you verified that you've set the Identifier for the custom cell  
in the XIB to match the above cellID?  If they don't match, you'll  
end up loading the XIB for every row in the table view.  If things  
are set up properly, the XIB will be loaded once for each visible  
row on the screen plus a few more depending on how fast you scroll.


I fixed the issue last night, perhaps 20 minutes after I posted the  
question. Yes, it was exactly as you described -- I had the ID set  
incorrectly in the XIB. Many thanks!


This is less of an issue, but iterating over the objects in the XIB  
can be avoided by adding an outlet connected to the custom cell to  
your class that owns the XIB.  I've got a sample project that  
demonstrates this available at


http://majestysoftware.com/code/CustomCellFromNib.zip

The project was created pre-3.0, so you'll get a deprecation warning  
when building.  The basic concept is still valid in 3.x.


That is a good idea -- i'll try it :-)

Regards,

John

Falling You - exploring the beauty of voice and sound
http://www.fallingyou.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: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Alex Kac
I don’t seem to have any issues with XCode at all beyond not being able to 
hover-inspect some vars (I just use po on the output window instead).

On Jan 4, 2010, at 5:58 AM, Charles Jenkins wrote:

 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
   
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.
 
 In my defense, there seems to be a bug in the latest XCode, which make 
 strings stored in NSArrays look like garbage when inspected during debugging. 
 So the elements of pnl appeared to be trashed immediately upon creation. 
 That's why I was looking for the bug in the wrong place.
 
 Does anyone else find XCode extremely buggy? I have to continually close and 
 reopen my editing window because the code display gets trashed and appears to 
 scramble my code. It doesn't really change the source code file; it just 
 makes it look as if I've randomly gone through the file deleting stuff, and 
 when I see that happen, I immediately save, close, and reopen the window, and 
 everything is fine.
 
 Mac software is usually first class, stable, and beautiful. How do folks 
 write such great software when they're stuck with such a sub-par IDE? :-)
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net
 
 This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

I am not young enough to know everything.
--Oscar Wilde




___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Alex Kac
Normally I’d agree, but people understand things in different ways. I found 
reading Aaron Hillegass book on Cocoa far more understandable than Apple’s 
docs. When I first started I used Apple’s docs as my reference and Aaron’s book 
as a way to understand it. Now I just use the Apple docs, but for beginners I 
strongly recommend that book. 

On Jan 4, 2010, at 6:11 AM, Roland King wrote:

 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
 
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.
 
 With respect to Eric, that's part of the rule, the rules are in the memory 
 management guide and it's better to read them in full from the apple 
 documentation than paraphrase them. 

Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible worlds; and 
the pessimist fears this is true.
-- James Clabell




___

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

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

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

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


Re: exposeBinding:

2010-01-04 Thread Jerry Krinock

On 2010 Jan 03, at 14:56, Rick Mann wrote:

 Is -exposeBinding: only necessary when implementing an IB plug-in? Or is it 
 required to make bind: work at all (on a custom object)?

It is required to make bind: work at all (on a custom object).  Put it in your 
+initialize method.

___

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

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

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

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


Re: NSBezierPath linewidth not correct

2010-01-04 Thread Alastair Houghton
On 2 Jan 2010, at 23:42, Rob Keniger wrote:

 On 02/01/2010, at 8:58 PM, Gustavo Pizano wrote:
 
 No worries, I modify it and in fact it does work, but the background images 
 will display a .5 gap between along the horizon between the images that 
 conform the background, so I will put just a .5 to everywhere I need 
 instead... 
 
 It will probably be easier to create an NSAffineTransform and translate the 
 whole context by 0.5px, so all drawing is offset without you needing to 
 fiddle with individual values.

While it sounds good superficially, that isn't such a great idea.  The reason 
is that while stroking draws the stroke centred on the specified path, filling 
draws strictly inside.  So e.g.

  NSRect myRect = NSMakeRect (10.0, 10.0, 100.0, 100.0);

  [[NSColor blueColor] set];
  NSRectFill (myRect);

will draw a sharp blue rectangle (by default), even though

  [[NSColor redColor] set];
  [NSBezierPath strokeRect:myRect];

will (on current displays) add a fuzzy outline.

Also, even if you adjust for the 0.5 pixel offset, you don't necessarily want 
to do so in both axes (depends what you're doing).  It isn't necessarily 0.5 
pixels either---you might be on a high DPI display, which is something Apple 
spent a lot of time talking about and has gone rather quiet about recently...

Kind regards,

Alastair.

-- 
http://alastairs-place.net



___

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

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

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

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


Re: Question about garbage collection

2010-01-04 Thread Bill Bumgarner

On Jan 4, 2010, at 5:31 AM, Quincey Morris wrote:

 On Jan 3, 2010, at 18:21, Ben Haller wrote:
 
 Bill, I for one would like to hear a bit more about this.  What has changed 
 in SL?  Why would it ever be possible to outrun the collector?  If the limit 
 of memory is being reached, can't it always just do an immediate, 
 synchronous collection before the call to +alloc returns?  I'd love to have 
 a better understanding of what's going on under the hood here...
 
 I think this:
 
   http://lists.apple.com/archives/Cocoa-dev/2009/Jun//msg01586.html
 
 is the thread where b.bum threw some light on that issue. (But I didn't 
 reread the whole thing, so some of what I remember may be from a different 
 thread.)

Yes -- this message covers the high level issues related to doing an exhaustive 
blocking scan-and-collect when memory runs low or, more specifically, out.

http://lists.apple.com/archives/Cocoa-dev/2009/Jun//msg01630.html

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: NSTreeController/OutlineView w/CoreData Bindings multiple selection?

2010-01-04 Thread Rick Mann

On Jan 4, 2010, at 06:21:47, Sean McBride wrote:

 Rick Mann (rm...@latencyzero.com) on 2010-01-04 4:08 AM said:
 
 I have an NSTreeController and outline view displaying a hierarchy of
 Group objects. This works fine. The NSTreeController is bound to the
 managed object context, and uses a fetch predicate of parent == nil.
 
 It won't let me select more than one row. Is it simply not possible to do so?
 
 That should work.  You sure you have the 'multiple selection' checkbox on?

Well, now, I'm an idiot. I couldn't fund such a checkbox last night. That was 
the *first* thing I looked for, and when I didn't find it, I decided there was 
something else. I probably just had the wrong thing selected in IB. And I 
looked for it more than once!

Thank you!

-- 
Rick


___

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

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

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

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


Pasteboard file promises under 10.6

2010-01-04 Thread Frank Illenberger
Does anybody know how to get file promises working with the new pasteboard API 
in Snow Leopard?
When the dragging session in started, I put the following item onto the 
provided pasteboard:

NSPasteboardItem* item = [[NSPasteboardItem alloc] init];
[item setDataProvider:self forTypes:[NSArray 
arrayWithObject:(NSString*)kPasteboardTypeFileURLPromise]];
[item setString:@net.mycompany.mydocument 
forType:kPasteboardTypeFilePromiseContent];
[pboard writeObjects:[NSArray arrayWithObject:item]];

But when I drag my objects, the delegate method 
pasteboard:item:provideDataForType: is never called. 
If I use public.data instead of my custom UTI, I get the following output in 
the console:

Looked for HFSPromises on the pasteboard, but found none

Sadly, the system documentation does not provide any more clues.

Cheers

Frank






___

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

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

Help/Unsubscribe/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 NSFormatter classes

2010-01-04 Thread Henri Häkkinen
Hello again Patric and others.

I have another question related to the previous one.

I now have the following things:
* Foo model class
* FooFormatter class which converts Foo objects into string representations
* User interface with NSTableView which uses the FooFormatter in a text field 
cell

What I would like to do next (yet not sure how to do it) is to have a context 
menu attached to the table view with menu items calling actions on a Foo object 
underneath the mouse cursor. Lets consider that the Foo class has something 
like the following:

- (IBAction)setOneDot:(id)sender;
- (IBAction)setTwoDots:(id)sender;
- (IBAction)setThreeDots:(id)sender;

And the context menu would have items like One dot, Two dots and Three 
dots which would call those actions.

The problem here is that target-action relationships can't be bound in the 
Interface Builder, since target is not known until the user presses right mouse 
on the table view. I am guessing that the best solution would be to subclass 
NSCell or NSTextFieldCell and then override some method to handle the mouse 
event?

Or maybe this could be done with some sort of Cocoa Bindings trickery to have 
those menu items call directly on the setDots: method of the Foo class, without 
having to implement a separate action for each setXXXDot(s) ? How about 
displaying a checkmark on the menu item for the current state?


On Jan 3, 2010, at 1:58 PM, Patrick Mau wrote:

 Hallo Henri
 
 Your assumption about how formatters should work are correct. To provide a 
 useful answer
 I have setup a mini project here, because I have stumbled over a detail I did 
 not now:
 
 http://public.me.com/pmau
 
 I took your approach and implemted a minimal datasource and a Foo object.
 This is not a great example, but here's what II did not know:
 
 When you wire up the formatter to the text field cell in IB,
 setFormatter is called on the TextFieldCell, which in turn will
 call your formatting code withe the cell's title:
 
 run
 [Switching to process 7123]
 Running…
 2010-01-03 12:39:47.790 Formatter[7123:a0f] NSCFString Cell Title
 2010-01-03 12:39:47.810 Formatter[7123:a0f] Foo Foo: 0x1139291d0
 2010-01-03 12:39:47.811 Formatter[7123:a0f] Foo Foo: 0x1151000a0
 2010-01-03 12:39:47.811 Formatter[7123:a0f] Foo Foo: 0x1151000b0
 
 Therefore you have too prepare to receive at least one object, which is not 
 Foo.
 
 Interestingly, I could not find that little detail in the documentation.
 
 If you want to return an instance Foo from your datasource, it is much more 
 convenient to write
 your own NSCell subclass, because you can control editing and formatting much 
 easier.
 You can even use an attached formatter that you setup in IB, passing it a 
 property of Foo.
 
 All the best,
 Patrick
 
 
 On Jan 3, 2010, at 1:47 , Henri Häkkinen wrote:
 
 Hello.
 
 I have an array of custom Foo objects which I would need to display in an 
 NSTableView object. I implement the data source delegate like this:
 
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
  return [arrayOfFoos count];
 }
 
 - (id)tableView:(NSTableView *)tableView 
 objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger) row {
  return [arrayOfFoos objectAtIndex:row];
 }
 
 Then I have NSFormatter subclass FooFormatter which takes in a Foo object 
 and converts it to a string. This formatter object is attached to the 
 formatter property of the TextFieldCell class in the NSTableView's table 
 column. The FooFormatter is like this:
 
 @implementation FooFormatter
 
 - (NSString *)stringForObjectValue:(id)anObject {
  if ([anObject isKindOfClass:[Foo class]] == NO) {
  [NSException raise:NSInvalidArgumentException format:@Wrong 
 object];
  }
  Foo *foo = (Foo *)anObject;
  NSString *string;
  // ... convert foo into string ...
  return string;
 }
 
 @end
 
 I am assuming here that the object returned by the data source 
 objectValueForTableColumn: is passed to the formatter's 
 stringForObjectValue: before it is displayed in the text field cell -- this 
 seems not to be the case. I would like to keep formatting of Foo objects 
 separate from the data source (if possible) since I intend to implement 
 multiple different FooFormatter derived classes suited for different 
 situations.
 
 The Cocoa docs seem to be a little low on details on how these NSFormatter 
 objects are supposed to work. Can anybody give me any insight? Would be 
 appreciated. 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/pmau%40me.com
 
 This email sent to p...@me.com
 

___

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

Please do not 

Re: Pasteboard file promises under 10.6

2010-01-04 Thread Nick Zitzmann

On Jan 4, 2010, at 11:06 AM, Frank Illenberger wrote:

 Does anybody know how to get file promises working with the new pasteboard 
 API in Snow Leopard?

You can't. Every version of Mac OS X to date treats file promise pasteboards as 
being different from all other kinds of pasteboards, and the only supported way 
of starting a file promise drag operation is by using the 
-dragPromisedFilesOfTypes:... method of NSView. Also, some built-in views 
support file promise dragging through their delegate or data source methods, 
which ultimately use -dragPromisedFilesOfTypes:... to do the drag.

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


iPhone Creating a months view

2010-01-04 Thread Eric E. Dolecki
I am creating an iPhone view that has 12 months of views in it starting with
January.

For each subview (month) I need to get the 1st day of the month (which
calendar day it falls on as an int). For instance Jan 2010 begins on a
Friday (int of 5 I assume).

This way I can properly populate the UILabels I am positioning in each
subview.

I saw this: http://theocacao.com/document.page/389

but I can't get it to work for the iPhone. I am going through docs and
google at the moment. Any help appreciated.

Eric
___

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

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

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

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


Re: iPhone Creating a months view

2010-01-04 Thread Wyatt Webb
On Jan 4, 2010, at 10:35 AM, Eric E. Dolecki wrote:

 I am creating an iPhone view that has 12 months of views in it starting with
 January.
 
 For each subview (month) I need to get the 1st day of the month (which
 calendar day it falls on as an int). For instance Jan 2010 begins on a
 Friday (int of 5 I assume).
 
 This way I can properly populate the UILabels I am positioning in each
 subview.
 
 I saw this: http://theocacao.com/document.page/389
 
 but I can't get it to work for the iPhone. I am going through docs and
 google at the moment. Any help appreciated.
 
 Eric

I think the best approach would be a combination of NSDate, NSCalendar, and 
NSDateComponents.

You could create an NSDate for the first of each month (1/1, 2/1, 3/1, etc.) 
and then use the components:fromDate: method on NSCalendar with the 
NSWeekdayCalendarUnit constant to get the day of the week for the first of the 
month. That comes out as an int from 1 to 7 (1 is Sunday, 7 is Saturday, so 
Friday would be 6).

Wyatt___

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

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

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

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


Re: iPhone Creating a months view

2010-01-04 Thread Alex Kac
One caution about using NSDateComponents, NSCalendar, etc… is that they are 
considerably slower than the CF date code. We took code written using the NS 
versions and rewrote them as CF version and the performance was easily 10x. Of 
course it was mostly noticeable only in loops where we were doing lots of 
iterations, but on the iPhone it was noticeable to the user even in short loops 
of 10 items or so. 

On Jan 4, 2010, at 11:59 AM, Wyatt Webb wrote:

 On Jan 4, 2010, at 10:35 AM, Eric E. Dolecki wrote:
 
 I am creating an iPhone view that has 12 months of views in it starting with
 January.
 
 For each subview (month) I need to get the 1st day of the month (which
 calendar day it falls on as an int). For instance Jan 2010 begins on a
 Friday (int of 5 I assume).
 
 This way I can properly populate the UILabels I am positioning in each
 subview.
 
 I saw this: http://theocacao.com/document.page/389
 
 but I can't get it to work for the iPhone. I am going through docs and
 google at the moment. Any help appreciated.
 
 Eric
 
 I think the best approach would be a combination of NSDate, NSCalendar, and 
 NSDateComponents.
 
 You could create an NSDate for the first of each month (1/1, 2/1, 3/1, etc.) 
 and then use the components:fromDate: method on NSCalendar with the 
 NSWeekdayCalendarUnit constant to get the day of the week for the first of 
 the month. That comes out as an int from 1 to 7 (1 is Sunday, 7 is Saturday, 
 so Friday would be 6).
 
 Wyatt___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/alex%40webis.net
 
 This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc.

The optimist proclaims that we live in the best of all possible worlds; and 
the pessimist fears this is true.
-- James Clabell




___

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

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

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

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


Re: iPhone Creating a months view

2010-01-04 Thread Nick Zitzmann

On Jan 4, 2010, at 11:35 AM, Eric E. Dolecki wrote:

 I am creating an iPhone view that has 12 months of views in it starting with
 January.

Don't make assumptions about calendars unless you are absolutely sure you can 
get away with them, e.g. every calendar currently in use in the world uses 
seven day weeks. In this case, you shouldn't, because, for example, while it's 
true that most calendar types have exactly 12 months in a year, the Hebrew 
calendar has 12 months in a regular year and 13 months in a leap year. You can 
use NSCalendar to figure out how many months there are in a given year.

 For each subview (month) I need to get the 1st day of the month (which
 calendar day it falls on as an int). For instance Jan 2010 begins on a
 Friday (int of 5 I assume).

Again, use NSCalendar and NSDateComponents. They are available on the iPhone 
OS; the older NSCalendarDate class is not available on the iPhone OS.

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


Getting children of all subnodes of a selected node in NSTreeController?

2010-01-04 Thread Rick Mann
I now have a working Group selection UI, where you can choose one or more 
groups and see the list of items belonging to those groups in another pane.

Now, I'd like to extend things a bit so that if a group with subgroups is 
selected, all of the items belonging to that group, and to all of its 
subgroups, is shown in the list.

I didn't see any KVO operator that would do that, so I think what I need to do 
is subclass NSTreeController and add a property which is either all of the 
selected groups and their subgroups, or nodes.

OTOH, I think that would be hard to do correctly, because of the way the 
controllers return proxies. Maybe a better thing to do would be to add a 
property to my Group entity which is all of the it child items (which I have 
now), plus all of the subgroups' child items.

Any advice would be much appreciated. Thanks!

-- 
Rick

___

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

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

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

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


Re: iPhone Creating a months view

2010-01-04 Thread Eric E. Dolecki
Thanks for the insights. Currently I have a chunk of code in a loop that
looks like this:

*//'pointer' increments in a loop - so create a date for each month of the
year, c defined outside the loop*

int currentYear = [comp year];

NSDateComponents *components = [[[NSDateComponents alloc]init] autorelease];

[components setMonth:pointer+1];

[components setDay:1];

[components setYear:currentYear];

NSCalendar *gregorian = [[NSCalendar alloc]
initWithCalendarIdentifier:NSGregorianCalendar];

NSDate *myDate = [gregorian dateFromComponents:components];

NSRange range = [c rangeOfUnit:NSDayCalendarUnit inUnit:NSMonthCalendarUnit
forDate:[c dateFromComponents:components]];

 *//Now get the day of the week the 1st day of this month falls on (ie. 6 =
Friday)*

unsigned uFlags = NSWeekdayCalendarUnit;

NSDateComponents *comp2 = [gregorian components:uFlags fromDate:myDate];

NSLog(@Date: %@, days in this month: %d, starts on weekday:%i, myDate,
range.length, [comp2 weekday] );

And the output looks like this:

*Date: 2010-01-01 00:00:00 -0500, days in this month: 31, starts on
weekday:6*

*Date: 2010-02-01 00:00:00 -0500, days in this month: 28, starts on
weekday:2*

*Date: 2010-03-01 00:00:00 -0500, days in this month: 31, starts on
weekday:2*

*Date: 2010-04-01 00:00:00 -0400, days in this month: 30, starts on
weekday:5*

*Date: 2010-05-01 00:00:00 -0400, days in this month: 31, starts on
weekday:7*

*Date: 2010-06-01 00:00:00 -0400, days in this month: 30, starts on
weekday:3*

*Date: 2010-07-01 00:00:00 -0400, days in this month: 31, starts on
weekday:5*

*Date: 2010-08-01 00:00:00 -0400, days in this month: 31, starts on
weekday:1*

*Date: 2010-09-01 00:00:00 -0400, days in this month: 30, starts on
weekday:4*

*Date: 2010-10-01 00:00:00 -0400, days in this month: 31, starts on
weekday:6*

*Date: 2010-11-01 00:00:00 -0400, days in this month: 30, starts on
weekday:2*

*Date: 2010-12-01 00:00:00 -0500, days in this month: 31, starts on
weekday:4*

I'll rename some of the stuff  check into that number of months in a year
thing.

Thanks again.

On Mon, Jan 4, 2010 at 2:17 PM, Nick Zitzmann n...@chronosnet.com wrote:


 On Jan 4, 2010, at 11:35 AM, Eric E. Dolecki wrote:

  I am creating an iPhone view that has 12 months of views in it starting
 with
  January.

 Don't make assumptions about calendars unless you are absolutely sure you
 can get away with them, e.g. every calendar currently in use in the world
 uses seven day weeks. In this case, you shouldn't, because, for example,
 while it's true that most calendar types have exactly 12 months in a year,
 the Hebrew calendar has 12 months in a regular year and 13 months in a leap
 year. You can use NSCalendar to figure out how many months there are in a
 given year.

  For each subview (month) I need to get the 1st day of the month (which
  calendar day it falls on as an int). For instance Jan 2010 begins on a
  Friday (int of 5 I assume).

 Again, use NSCalendar and NSDateComponents. They are available on the
 iPhone OS; the older NSCalendarDate class is not available on the iPhone OS.

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




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

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

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

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

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


GC memory leak - what is it?

2010-01-04 Thread jonat...@mugginsoft.com
A recent post mentioned the concept of GC memory leakage.

How is is this defined? Is it merely a failure to nil out a rooted reference?

man heap(1) makes reference to over-rooted objects.
Are these merely objects with more than one root reference or is something else 
afoot?

Regards

Jonathan Mitchell

Developer
http://www.mugginsoft.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: exposeBinding:

2010-01-04 Thread Kyle Sluder
On Mon, Jan 4, 2010 at 8:30 AM, Jerry Krinock je...@ieee.org wrote:
 It is required to make bind: work at all (on a custom object).  Put it in 
 your +initialize method.

Eh? It is not required at all.

--Kyle Sluder
___

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

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

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

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


Re: GC memory leak - what is it?

2010-01-04 Thread Bill Bumgarner

On Jan 4, 2010, at 11:50 AM, jonat...@mugginsoft.com wrote:

 A recent post mentioned the concept of GC memory leakage.
 
 How is is this defined? Is it merely a failure to nil out a rooted reference?
 
 man heap(1) makes reference to over-rooted objects.
 Are these merely objects with more than one root reference or is something 
 else afoot?

Under GC, a memory leak will fall into one of two categories:

(1) An object was CFRetain'd, but never CFRelease'd.  This is exactly like 
over-retaining an object in non-GC . Note that, in general, if you are using 
CFRetain under GC, it is only to work around a limitation somewhere or because 
of a design flaw.  If you need to use CFRetain to work around something, please 
file a bug!

(2) A hard reference to an object that isn't cleaned up.

For example, many applications have a cache somewhere, typically key/value 
pairs.   I have seen a number of these where, under non-GC, the cache never 
retained the values and was never pruned.  Because the values were never 
retained, the values in the cache were released and deallocated, leaving behind 
a dangling value with a key that would no longer ever be accessed.  In the move 
to GC, this created a leak in that the cache would often default to a strong 
reference.  Lesson; prune your caches!

It isn't so much thinking of it as a reference that needs to be nil'd out as 
much as it is a need to properly disconnect a subgraph of objects from the live 
object graph in an application such that the subgraph is collected.  That is, 
nil'ing out references is a fix for a symptom where the overarching problem 
is one of properly managing the connectivity of the object graph within the 
application.

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: GC memory leak - what is it?

2010-01-04 Thread Rippit the Ogg Frog



jonat...@mugginsoft.com wrote:

A recent post mentioned the concept of GC memory leakage.

How is is this defined? Is it merely a failure to nil out a rooted reference?


Yes.  If you hold a reference to memory you don't need anymore, you have 
a leak.


I've gotten into huge flamewars over this, but I'm convinced of its truth.

Consider a Java Document Object Model tree.  Every node holds a 
reference to its parent and all of its children.  If you hold a 
reference to any node in the tree, you prevent the entire tree from 
being collected.


If you can't be sure that some other code will nil out your references, 
then nil them out yourself.


Rippit the Ogg Frog
rip...@oggfrog.com
http://www.oggfrog.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: Custom NSFormatter classes

2010-01-04 Thread Patrick Mau
Hallo Henri

I have updated the Formatter to include a context menu
for the TableView.

http://public.me.com/pmau

Since you don't know the target, you could wire them up to the FirstResponder
object in IB.

Look at the inspector panel for FirstResponder, you can add actions there.
Since the TableView is not subclassed, the first responder in this case is
the Application Delegate. This is where I implemented the actions.

This is not how I would recommend implementing, but it should give you an idea.

Please read

http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/MenuList/Articles/EnablingMenuItems.html

It explains how the responder chain is searched and how enabling items works.

In my example:

* NSTableView does not implent it,
* The NSWinow does not implement it
* The widow delegate does not
* The Application delegate does (Bingo!)

You could look at the [window firstResponder] in the action method,
this would yield the TableView.

You could then mis-use the Datasource and forward the action there.
(You can get the selected rows there, too.)

You could subclass the NSTableView, implementing your actions there.

You could embed the TableView in a custom view subclass to handle actions and 
so on.

You could use a custom Controller as your FilesOwner and bind actions there in 
IB.

I hope you get the idea.
Patrick

PS: I don't mind answering, but my quick hacks will not necessarily improve 
your coding ;)
Please read a lot of documents about FirstResponder, FilesOwner and see what 
fits your needs.




On Jan 4, 2010, at 19:14 , Henri Häkkinen wrote:

 Hello again Patric and others.
 
 I have another question related to the previous one.
 
 I now have the following things:
 * Foo model class
 * FooFormatter class which converts Foo objects into string representations
 * User interface with NSTableView which uses the FooFormatter in a text field 
 cell
 
 What I would like to do next (yet not sure how to do it) is to have a context 
 menu attached to the table view with menu items calling actions on a Foo 
 object underneath the mouse cursor. Lets consider that the Foo class has 
 something like the following:
 
 - (IBAction)setOneDot:(id)sender;
 - (IBAction)setTwoDots:(id)sender;
 - (IBAction)setThreeDots:(id)sender;
 
 And the context menu would have items like One dot, Two dots and Three 
 dots which would call those actions.
 
 The problem here is that target-action relationships can't be bound in the 
 Interface Builder, since target is not known until the user presses right 
 mouse on the table view. I am guessing that the best solution would be to 
 subclass NSCell or NSTextFieldCell and then override some method to handle 
 the mouse event?
 
 Or maybe this could be done with some sort of Cocoa Bindings trickery to have 
 those menu items call directly on the setDots: method of the Foo class, 
 without having to implement a separate action for each setXXXDot(s) ? How 
 about displaying a checkmark on the menu item for the current state?
 
 
 On Jan 3, 2010, at 1:58 PM, Patrick Mau wrote:
 
 Hallo Henri
 
 Your assumption about how formatters should work are correct. To provide a 
 useful answer
 I have setup a mini project here, because I have stumbled over a detail I 
 did not now:
 
 http://public.me.com/pmau
 
 I took your approach and implemted a minimal datasource and a Foo object.
 This is not a great example, but here's what II did not know:
 
 When you wire up the formatter to the text field cell in IB,
 setFormatter is called on the TextFieldCell, which in turn will
 call your formatting code withe the cell's title:
 
 run
 [Switching to process 7123]
 Running…
 2010-01-03 12:39:47.790 Formatter[7123:a0f] NSCFString Cell Title
 2010-01-03 12:39:47.810 Formatter[7123:a0f] Foo Foo: 0x1139291d0
 2010-01-03 12:39:47.811 Formatter[7123:a0f] Foo Foo: 0x1151000a0
 2010-01-03 12:39:47.811 Formatter[7123:a0f] Foo Foo: 0x1151000b0
 
 Therefore you have too prepare to receive at least one object, which is not 
 Foo.
 
 Interestingly, I could not find that little detail in the documentation.
 
 If you want to return an instance Foo from your datasource, it is much more 
 convenient to write
 your own NSCell subclass, because you can control editing and formatting 
 much easier.
 You can even use an attached formatter that you setup in IB, passing it a 
 property of Foo.
 
 All the best,
 Patrick
 
 
 On Jan 3, 2010, at 1:47 , Henri Häkkinen wrote:
 
 Hello.
 
 I have an array of custom Foo objects which I would need to display in an 
 NSTableView object. I implement the data source delegate like this:
 
 - (NSInteger)numberOfRowsInTableView:(NSTableView *)tableView {
 return [arrayOfFoos count];
 }
 
 - (id)tableView:(NSTableView *)tableView 
 objectValueForTableColumn:(NSTableColumn *)tableColumn row:(NSInteger) row {
 return [arrayOfFoos objectAtIndex:row];
 }
 
 Then I have NSFormatter subclass FooFormatter which takes in a Foo object 
 and converts it to a string. 

Re: Custom NSFormatter classes

2010-01-04 Thread Henri Häkkinen
Thanks for your answer again, Patrick.

By the way, what is the general opinion about the Cocoa Bindings technology 
among Mac developers? I have been looking into it lately and while it looks 
very neat I have found it troublesome to actually put it into practical use. I 
am contemplating whether or not to adopt it into my projects, or to just use 
target-action mechanism which seems to be easier to use even though it requires 
a bit more glue coding.

___

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

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

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

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


Re: iPhone Creating a months view

2010-01-04 Thread Henry McGilton (Boulevardier)

On Jan 4, 2010, at 11:17 AM, Nick Zitzmann wrote:

 
 On Jan 4, 2010, at 11:35 AM, Eric E. Dolecki wrote:
 
 I am creating an iPhone view that has 12 months of views in it starting with
 January.
 
 Don't make assumptions about calendars unless you are absolutely sure you can 
 get away with them, e.g. every calendar currently in use in the world uses 
 seven day weeks. In this case, you shouldn't, because, for example, while 
 it's true that most calendar types have exactly 12 months in a year, the 
 Hebrew calendar has 12 months in a regular year and 13 months in a leap year. 
 You can use NSCalendar to figure out how many months there are in a given 
 year.
 
 For each subview (month) I need to get the 1st day of the month (which
 calendar day it falls on as an int). For instance Jan 2010 begins on a
 Friday (int of 5 I assume).
 
 Again, use NSCalendar and NSDateComponents. They are available on the iPhone 
 OS; the older NSCalendarDate class is not available on the iPhone OS.

As a follow-on to Nick's caveats above, check out NSLocale Calendar Keys
in the NSLocale Class Reference for a list of calendars supported on the phone.
Note that the phone-supported calendars are a subset of those supported on Mac 
OS X.

And NSCalendarDate appears to have vanished from Mac OS X Foundation as well . 
. .

Amateur and Professional calendar scholars alike can visit this web site for
everything you never wanted to know about calendar lore:

http://emr.cs.iit.edu/home/reingold/calendar-book/index.shtml


Cheers,
. . . . . . . .Henry


=
iPhone App Development and Developer Education . . .
Visit  www.nonatomic-retain.com

Mac OSX Application Development, Plus a Great Deal More . . .
Visit  www.trilithon.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: iPhone Creating a months view

2010-01-04 Thread Nick Zitzmann

On Jan 4, 2010, at 2:17 PM, Henry McGilton (Boulevardier) wrote:

 And NSCalendarDate appears to have vanished from Mac OS X Foundation as well 
 . . .

It's still there; it's just been deprecated because Apple wants to push the 
NSCalendar and NSDateComponents classes due to their superior localization 
capabilities. Not everybody in the world uses the Gregorian calendar, after 
all. But it's currently still useful for one reason - it's the only built-in 
way to include a time zone as part of a date.

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: Custom NSFormatter classes

2010-01-04 Thread Matthew Lindfield Seager
On Tuesday, January 5, 2010, Henri Häkkinen  wrote:
 Thanks for your answer again, Patrick.

 By the way, what is the general opinion about the Cocoa Bindings technology 
 among Mac developers?

Don't confuse my uninformed opinion with the general opinion but it
appears to be an 80% technology... 80% of the time (particularly for
simple cases) it works well  saves a bit of effort.

For the remaining 20% it varies significantly; sometimes you can bend
it, prod it and squish it to mostly fit... Sometimes you waste several
hours bending, prodding  squishing only to realise those several
hours of effort (assuming you were successful) saved you five or ten
minutes of glue coding.

My difficulty is knowing which situation is which. Plus often you will
get both situations in the one project...

Regards,
Matt
___

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

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

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

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


Re: GC memory leak - what is it?

2010-01-04 Thread jonat...@mugginsoft.com
On 4 Jan 2010, at 20:39, Bill Bumgarner wrote:
 
 It isn't so much thinking of it as a reference that needs to be nil'd out as 
 much as it is a need to properly disconnect a subgraph of objects from the 
 live object graph in an application such that the subgraph is collected.  
 That is, nil'ing out references is a fix for a symptom where the 
 overarching problem is one of properly managing the connectivity of the 
 object graph within the application.
 
 b.bum

Thanks for the clarification.

I am using the ObjectGraph tool in Instruments. The table view for this tool 
has a Root column.

Presumably a item marked as Root is one of : global variables, stack 
variables, and objects with external references
Browsing through User-defined Root objects I can see in the Extended Detail 
view that some of my objects have multiple stack roots.

How can a multiple stack root occur?
Is this just saying that the same object is referenced by multiple stack 
allocated pointers at the time that the sample was taken?
Presumably a stack root cannot be the source of any persistent leak as once the 
frame is gone so is the root.

Sorry if this is dumb question. I am struggling to comprehend just what the 
ObjectGraph tool is telling me. 
Docs seem MIA for this tool (or maybe it's me that's MIA).

Most of my rooted objects are statically allocated singletons. ObjectGraph 
correctly identifies them as single roots.

Thanks again

Jonathan Mitchell
Developer
mugginsoft.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


Turn off font hinting?

2010-01-04 Thread Sander Stoks
Hello all,

I wrote some code to draw an NSString rotated by an arbitrary angle, which can 
be manipulated interactively.  The results are surprisingly bad (compared to 
how good font rendering is in general on the Mac).  Most notably, the character 
positions jump around in whole pixel increments while I'm rotating the text.  
Usually, this is caused by hinting which tries to place vertical and horizontal 
lines at integer pixels.  Does anyone know of a way to switch this off 
(temporarily) for a given context?

Thanks in advance,
Sander___

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

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

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

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


Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
Is there a way to lookup what and NString constant is at runtime? I want to
know what the string is for a given constant. For example I would like to
pass in the constant name ( i.e. NSDeviceResolution) and get back
the NSString that constant represents. I know in this case that the Constant
name and the string are the same but I suspect that is not always true. Any
ideas?

thanks
-dave
___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread Oftenwrong Soong
On Mon, Jan 4, 2010 at 4:56 PM, David Alter alterconsult...@gmail.com wrote:
 Is there a way to lookup what and NString constant is at runtime?



Have you tried

[NSDeviceResolution description]

or

[NSString stringWithString:NSDeviceResolution]

?

Soong


  
___

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

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

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

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


Do I need to download both XCode for both Mac iPhone

2010-01-04 Thread Jan Erik Moström
Newbie Q: I've been playing with the XCode env for iPhone for a 
few weeks and was thinking about doing some OS X dev but do I 
need to download the whole OS X version of XCode or is there 
some smaller download?


- jem
--
Jan Erik Moström
http://mostrom.eu

___

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

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

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

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


Re: Revolving scoreboard

2010-01-04 Thread Nick Paulson
Take a look at the first post in the following link:

http://www.cocoadev.com/index.pl?CoreAnimation

Basically, you just have the view's animator as a receiver rather than the view 
itself.  This will automatically do the default animations for you.

--Nick Paulson

On Jan 4, 2010, at 1:55 AM, gumbo...@mac.com wrote:

 Thanks Guys, that will work really well and its a nice neat solution. Can you 
 elaborate on the animation proxy a little bit or rather point me in the right 
 direction.
 Cheers
 Rob
 
 
 On 4/01/2010, at 2:29 PM, PCWiz wrote:
 
 Good point, the view subclass would be easy and clean.
 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.com
 
 
 On 2010-01-03, at 6:10 PM, Scott Anguish wrote:
 
 I don’t think using NSScrollView is at all necessary in this case. That’s 
 much more of a situation for user interaction.
 
 This sounds more like the case for creating a view subclass that contains a 
 view that displays the current score. When the score increases, insert 
 another view visually above the other ( so it’d be like 
 
 Main View
 
 New View
 
 then using an animation proxy to move the main view up and the new view up 
 as well. 
 
 
 
 On Jan 3, 2010, at 6:27 PM, PCWiz wrote:
 
 This isn't something thats extremely difficult to do. You will need to 
 create NSView subclasses for the scores at the top. You can use 
 NSAttributedString/NSMutableAttributedString to create styled text, and 
 use their drawInRect method to draw the text into the view. It would be a 
 good idea to read this:
 
 https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Introduction/Introduction.html
 
 And more specifically, this: 
 https://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Text/Text.html#//apple_ref/doc/uid/TP40003290-CH209-BCIEEIGC
 
 For the scrolling scores below, you will have to put the scores into an 
 NSTableView, or an NSCollectionView (the latter is better if you want to 
 customize the display) inside an NSScrollView. As for the automatic 
 scrolling, NSScrollView has nothing built in to facilitate this. Most 
 likely you are going to have to use an NSTimer that fires every few 
 milliseconds, and uses NSScrollView's scrollToPoint: method to scroll 
 gradually until you hit the bottom.
 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.com
 
 
 On 2010-01-03, at 4:07 PM, gumbo...@mac.com wrote:
 
 I have been asked to design a revolving scoreboard for a large Sporting 
 Clays event. The plan is to have a MacBook connected to a large flat 
 screen TV in the main tent. I will pull the scores from a CSV file (which 
 is updated regularly) and sort them into arrays for display. Creating the 
 on screen graphics is something I have not done much of with Cocoa. The 
 organizers have asked for a full screen display and would like have the 
 top 5 scores at the top of the screen and then scroll the rest of the 
 field below these scores.
 I could punch this out with HTML and a bit of Javascript, but I thought 
 it might be good to do have a play with Quartz.
 Can you please tell me how you good people might approach 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/pcwiz.support%40gmail.com
 
 This email sent to pcwiz.supp...@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/scott%40cocoadoc.com
 
 This email sent to sc...@cocoadoc.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/gumboots%40mac.com
 
 This email sent to gumbo...@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/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.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 

Need help regarding sleep notification

2010-01-04 Thread Poonam Virupaxi Shigihalli

Hi,

I am listening to the notifications NSWorkspaceWillSleepNotification and 
NSWorkspaceDidWakeNotification in my code. I am getting these notifications, 
when user selects sleep from system menu. But when system goes to sleep, after 
being idle for some duration, I am not getting these notifications.

I have faced the same problem on both leopard and snow leopard.


Thanks.

___

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

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

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

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


Re: Do I need to download both XCode for both Mac iPhone

2010-01-04 Thread Claus Guttesen
 Newbie Q: I've been playing with the XCode env for iPhone for a few weeks
 and was thinking about doing some OS X dev but do I need to download the
 whole OS X version of XCode or is there some smaller download?

You need xcode + iphone-sdk, so yes, you need both. :)

-- 
regards
Claus

When lenity and cruelty play for a kingdom,
the gentler gamester is the soonest winner.

Shakespeare

twitter.com/kometen
___

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

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

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

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


Re: Why is [NSArray arrayWithObjects:] failing for me?

2010-01-04 Thread Scott Anguish
that’s fine, Aaron’s book is an excellent source.

The issue is more that the memory management rules shouldn’t be paraphrased 
here. Too easy for people to make errors and confuse users.


On Jan 4, 2010, at 11:24 AM, Alex Kac wrote:

 Normally I’d agree, but people understand things in different ways. I found 
 reading Aaron Hillegass book on Cocoa far more understandable than Apple’s 
 docs. When I first started I used Apple’s docs as my reference and Aaron’s 
 book as a way to understand it. Now I just use the Apple docs, but for 
 beginners I strongly recommend that book. 
 
 On Jan 4, 2010, at 6:11 AM, Roland King wrote:
 
 On 2010-01-03 00:08, Eric Smith wrote:
 Correct, do not release the array.  If you don't create it with init, or 
 retain it, then you should not release it.
 
 Eric, thank you for stating that rule. It should be easy enough to remember 
 and help me avoid this problem in the future.
 
 With respect to Eric, that's part of the rule, the rules are in the memory 
 management guide and it's better to read them in full from the apple 
 documentation than paraphrase them. 
 
 Alex Kac - President and Founder
 Web Information Solutions, Inc.
 
 The optimist proclaims that we live in the best of all possible worlds; and 
 the pessimist fears this is true.
 -- James Clabell
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/scott%40cocoadoc.com
 
 This email sent to sc...@cocoadoc.com

___

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

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

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

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


Re: GC memory leak - what is it?

2010-01-04 Thread Oftenwrong Soong
On Mon, January 4, 2010 12:39:22 PM Bill Bumgarner b...@mac.com wrote:
 It isn't so much thinking of it as a reference that needs to be nil'd out as 
 much as it
 is a need to properly disconnect a subgraph of objects from the live object 
 graph in
 an application such that the subgraph is collected.  That is, nil'ing out 
 references is
 a fix for a symptom where the overarching problem is one of properly managing 
 the
 connectivity of the object graph within the application.


Does anybody know how the collector actually works? I've read the docs a dozen 
times but something about the description makes me think it doesn't exactly 
happen the way it's described. According to the docs, the collector scans all 
of your objects to determine what needs to be deallocated. But in performing 
this scan, how does it know which bits in your object are pointers to other 
objects and which bits are just data?

I think that an understanding of what actually happens behind the scenes would 
clear up a LOT of the common questions we see here about GC.

Soong



  
___

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

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

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

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


Re: Do I need to download both XCode for both Mac iPhone

2010-01-04 Thread Jean-Daniel Dupas

Le 4 janv. 2010 à 23:23, Rick Mann a écrit :

 
 On Jan 4, 2010, at 01:41:56, Jan Erik Moström wrote:
 
 Newbie Q: I've been playing with the XCode env for iPhone for a few weeks 
 and was thinking about doing some OS X dev but do I need to download the 
 whole OS X version of XCode or is there some smaller download?
 
 No. The iPhone SDK version of Xcode includes everything you need for desktop 
 development as well.


Ditto. So there is two 'no' and one 'yes' answers to your question.

'no' answer win ;-)


-- Jean-Daniel




___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread Scott Ribe
I think you're confused: the constant *is* the string; there is no lookup to
perform. You can do anything with it that you would do with any other
non-mutable string: log it, setStringValue on a text field in the user
interface, setMessageText in an alert, and so on.

-- 
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: Do I need to download both XCode for both Mac iPhone

2010-01-04 Thread Clark Cox
On Mon, Jan 4, 2010 at 1:41 AM, Jan Erik Moström li...@mostrom.pp.se wrote:
 Newbie Q: I've been playing with the XCode env for iPhone for a few weeks
 and was thinking about doing some OS X dev but do I need to download the
 whole OS X version of XCode or is there some smaller download?

The current iPhone SDK downloads are proper supersets of the
corresponding Xcode downloads. That is, everything contained in the
Mac-only downloads is also included in the iPhone SDK downloads.

-- 
Clark S. Cox III
clarkc...@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: Need font anti aliasing techniques

2010-01-04 Thread Chris Hanson
On Jan 3, 2010, at 8:33 PM, padmakumar wrote:

 What are all the ways we can programmatically make anti aliasing techniques 
 for texts displayed in NSTextField.

What kind of results are you trying to achieve?

Mac OS X has a standard antialiasing mechanism in its font rendering; normally, 
just using NSTextField should achieve appropriate antialiasing.

  — Chris

___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
This would work for finding out what the name is as well as logging it.

What if I'm getting a string passed in that is the name of the constant and
I want to return the constants string value. Is there a way to do that?

something like...
NSString * constValue = [SomeToolToLookupConstants constant:@
NSDeviceResolution'];

any idea?
-dave


On Mon, Jan 4, 2010 at 2:19 PM, Oftenwrong Soong
oftenwrongso...@yahoo.comwrote:

 On Mon, Jan 4, 2010 at 4:56 PM, David Alter alterconsult...@gmail.com
 wrote:
  Is there a way to lookup what and NString constant is at runtime?



 Have you tried

 [NSDeviceResolution description]

 or

 [NSString stringWithString:NSDeviceResolution]

 ?

 Soong



 ___

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

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

 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/cocoa-dev/alterconsulting%40gmail.com

 This email sent to alterconsult...@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: Looking up a NSString constant at runtime

2010-01-04 Thread Nick Paulson
The constant *is* an NSString;  essentially you could do:

NSString *constValue = NSDeviceResolution;

Though, that may be a little redundant.

--Nick Paulson
On Jan 4, 2010, at 6:09 PM, David Alter wrote:

 This would work for finding out what the name is as well as logging it.
 
 What if I'm getting a string passed in that is the name of the constant and
 I want to return the constants string value. Is there a way to do that?
 
 something like...
 NSString * constValue = [SomeToolToLookupConstants constant:@
 NSDeviceResolution'];
 
 any idea?
 -dave
 
 
 On Mon, Jan 4, 2010 at 2:19 PM, Oftenwrong Soong
 oftenwrongso...@yahoo.comwrote:
 
 On Mon, Jan 4, 2010 at 4:56 PM, David Alter alterconsult...@gmail.com
 wrote:
 Is there a way to lookup what and NString constant is at runtime?
 
 
 
 Have you tried
 
 [NSDeviceResolution description]
 
 or
 
 [NSString stringWithString:NSDeviceResolution]
 
 ?
 
 Soong
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 
 http://lists.apple.com/mailman/options/cocoa-dev/alterconsulting%40gmail.com
 
 This email sent to alterconsult...@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/cocoa%40nickpaulson.com
 
 This email sent to co...@nickpaulson.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: help a brother out?

2010-01-04 Thread PCWiz
Hi Ryan,

Long time no talk, but distros aren't a good way to go with Snow Leopard. 
Retail install is easier and better.


Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2010-01-04, at 12:31 PM, Ryan R. Moos wrote:

 any chance you might know a rapidshare link for  OS X 10.6 Snow Leopard 
 Universal v3.6?
 Long ago you pointed me in the right direction for Kalyway
 
 Ryan
 
 Ryan R. Moos
 User 2 Productions
 Assistant VFX Editor
 
 cl   310-383-2663
 
 http://www.linkedin.com/in/ryanrmoos
 
 END OF LINE
 

___

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

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

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

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


Re: Turn off font hinting?

2010-01-04 Thread PCWiz
One idea would be to draw the text into the view at the normal angle, then 
convert the contents of the view into an NSImage, put that into an NSImageView 
and rotate that instead. I'm not sure how good of a solution this is, or if 
there is a better solution, but I've found that manipulating images of elements 
rather than the elements directly is smoother.


Independent Cocoa Developer, Macatomy Software
http://macatomy.com


On 2010-01-04, at 2:47 PM, Sander Stoks wrote:

 Hello all,
 
 I wrote some code to draw an NSString rotated by an arbitrary angle, which 
 can be manipulated interactively.  The results are surprisingly bad (compared 
 to how good font rendering is in general on the Mac).  Most notably, the 
 character positions jump around in whole pixel increments while I'm 
 rotating the text.  Usually, this is caused by hinting which tries to place 
 vertical and horizontal lines at integer pixels.  Does anyone know of a way 
 to switch this off (temporarily) for a given context?
 
 Thanks in advance,
 Sander___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/pcwiz.support%40gmail.com
 
 This email sent to pcwiz.supp...@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: GC memory leak - what is it?

2010-01-04 Thread Chris Hanson
On Jan 4, 2010, at 2:27 PM, Oftenwrong Soong wrote:

 According to the docs, the collector scans all of your objects to determine 
 what needs to be deallocated. But in performing this scan, how does it know 
 which bits in your object are pointers to other objects and which bits are 
 just data?

The Objective-C compiler has always generated extended type information for 
classes, so you can not only tell what the offset of an instance variable is at 
runtime, but also what its type is.

When building GC-supported or GC-required, the compiler additionally provides a 
layout bitmap that gives the collector a faster way to know what offsets should 
be considered to hold strong and weak references.  See class_setIvarLayout and 
class_setWeakIvarLayout in the Objective-C Runtime Reference; anyone 
constructing classes “by hand” (e.g. using objc_allocateClassPair) needs to use 
these if they want their classes to work under GC.

  — Chris

___

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

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

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

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


Re: Turn off font hinting?

2010-01-04 Thread Jens Alfke

On Jan 4, 2010, at 1:47 PM, Sander Stoks wrote:

 I wrote some code to draw an NSString rotated by an arbitrary angle, which 
 can be manipulated interactively.  The results are surprisingly bad (compared 
 to how good font rendering is in general on the Mac).  Most notably, the 
 character positions jump around in whole pixel increments while I'm 
 rotating the text.  Usually, this is caused by hinting which tries to place 
 vertical and horizontal lines at integer pixels.  Does anyone know of a way 
 to switch this off (temporarily) for a given context?

I don't think Quartz's text renderer uses hinting in the normal sense; this is 
part of why text looks different on Mac than on Windows. (Subpixel 
anti-aliasing largely removes the need for hinting, and makes the hints 
actually mess up the shape of the glyphs.)

I'm not sure why you're getting this result. Are you just applying a rotation 
transform to the NSGraphicsContext and then drawing the NSString? Have you 
tried using the lower-level CG APIs instead (it shouldn't make a difference, 
but you never know.)

—Jens___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread Scott Ribe
 What if I'm getting a string passed in that is the name of the constant and
 I want to return the constants string value. Is there a way to do that?

This is C, and just as with variables, the names are not there at runtime.
If you really need to do this, you'll have to build your own lookup table,
possibly using some macro magic to avoid having to type the name twice for
each entry.

-- 
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: GC memory leak - what is it?

2010-01-04 Thread Bill Bumgarner

On Jan 4, 2010, at 1:39 PM, jonat...@mugginsoft.com wrote:

 How can a multiple stack root occur?
 Is this just saying that the same object is referenced by multiple stack 
 allocated pointers at the time that the sample was taken?

That is correct;  the object may be referenced by multiple local variables [on 
the stack].  Note that since the stack is scanned conservatively, you may be 
seeing stale references -- references that have gone out of scope.

 Presumably a stack root cannot be the source of any persistent leak as once 
 the frame is gone so is the root.

One would like to believe that, but it isn't always the case.   On AMD64, the 
ABI specifies that there is a red zone of 128 bytes allocated just below the 
current stack pointer that can be used as scratch space.  Thus, the collector 
has to also scan the red zone conservatively.   However, the red zone will 
often contain whatever local variables -- including arguments (which are an 
awful lot like local variables, really) -- that were written there when the 
current frame called a function somewhere, pushing a frame below.

Hence the need for objc_clear_stack().  Among other things, it clears the red 
zone.

(Don't let the details scare you -- as long as you are using the recommended 
run loop / grand central dispatch mechanisms for looping and waiting, clearing 
the stack is handled automatically.  That is, very very few developers will 
ever run into a need to deal with this directly).

 Sorry if this is dumb question. I am struggling to comprehend just what the 
 ObjectGraph tool is telling me. 
 Docs seem MIA for this tool (or maybe it's me that's MIA).

File a bug, please!

 Most of my rooted objects are statically allocated singletons. ObjectGraph 
 correctly identifies them as single roots.

Good.

Note that you can also use gdb to perform the same analysis.  In any GC'd 
program, 'info gc-roots addr' and 'info gc-referers addr' can be used to 
interrogate the connectivity of the object at addr.

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: Bold Braille

2010-01-04 Thread Martin Wierschin

In my braille app, the font Apple Braille looks kind of wimpy when
printed. Some people say it's hard to read. I thought I'd try making  
it
bold, but for some reason, Apple Braille does not go bold in any app  
I've

tried.

...

3) Is there another way to make my braille look heavier?


You might try using NSStrokeWidthAttributeName with a negative value:

http://lists.apple.com/archives/Cocoa-dev/2004/Jun/msg01747.html

You'll want to apply that attribute and your font to an  
NSAttributedString.


~Martin

___

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

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

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

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


Exception thrown in _NXCreateWindow: reference offset exceeds bounds

2010-01-04 Thread slasktrattena...@gmail.com
Hi,

I just got this report about a crash on launch, while loading the nib.
Any ideas what the problem might be? I'm clueless. Thanks!

2010-01-05 10:44:39 +1100: CGSResolveShmemReference : window.RO :
Reference offset (37632) exceeds bounds (32768) on shmem obj 0x60b
2010-01-05 10:44:39 +1100: kCGErrorFailure:
CGSNewWindowWithOpaqueShape: Cannot map window information shmem
2010-01-05 10:44:39 +1100: kCGErrorFailure: Set a breakpoint @
CGErrorBreakpoint() to catch errors as they are logged.
2010-01-05 10:44:39 +1100: An uncaught exception was raised
2010-01-05 10:44:39 +1100: Error (1000) creating CGSWindow
2010-01-05 10:44:39 +1100: *** Terminating app due to uncaught
exception 'NSInternalInconsistencyException', reason: 'Error (1000)
creating CGSWindow'
*** Call stack at first throw:
(
0   CoreFoundation  0x928b340a __raiseError + 410
1   libobjc.A.dylib 0x92e44509 objc_exception_throw 
+ 56
2   CoreFoundation  0x928b3138 +[NSException
raise:format:arguments:] + 136
3   CoreFoundation  0x928b30aa +[NSException
raise:format:] + 58
4   AppKit  0x968ddca5 _NXCreateWindow + 316
5   AppKit  0x968ddab0 _NSCreateWindow + 59
6   AppKit  0x968dccd6 -[NSWindow
_commonAwake] + 1784
7   AppKit  0x968d98fa -[NSWindow
_commonInitFrame:styleMask:backing:defer:] + 1524
8   AppKit  0x968d8549 -[NSWindow
_initContent:styleMask:backing:defer:contentView:] + 1568
9   AppKit  0x96909782 -[NSPanel
_initContent:styleMask:backing:defer:contentView:] + 89
10  AppKit  0x968d7f23 -[NSWindow
initWithContentRect:styleMask:backing:defer:] + 71
11  AppKit  0x96909719 -[NSPanel
initWithContentRect:styleMask:backing:defer:] + 103
12  myApp0x00056e4b 0x0 + 355915
13  AppKit  0x96956b86 -[NSWindowTemplate
nibInstantiate] + 588
14  AppKit  0x968c7ca4 -[NSIBObjectData
instantiateObject:] + 253
15  AppKit  0x968c6faa -[NSIBObjectData
nibInstantiateWithOwner:topLevelObjects:] + 336
16  AppKit  0x968c5450 loadNib + 257
17  AppKit  0x968c4848
+[NSBundle(NSNibLoading) _loadNibFile:nameTable:withZone:ownerBundle:]
+ 228
18  AppKit  0x968c4759
+[NSBundle(NSNibLoading) loadNibFile:externalNameTable:withZone:] +
158
19  AppKit  0x968c46a4
+[NSBundle(NSNibLoading) loadNibNamed:owner:] + 383
20  AppKit  0x968c14a9 NSApplicationMain + 
434
21  myApp0x27e2 0x0 + 10210
)
___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread David Alter
I can open a library and lookup a function by name using dlsym. These
constants are EXTERN. It seams there should be away to look these up as
well.

-dave


On Mon, Jan 4, 2010 at 3:39 PM, Scott Ribe scott_r...@killerbytes.comwrote:

  What if I'm getting a string passed in that is the name of the constant
 and
  I want to return the constants string value. Is there a way to do that?

 This is C, and just as with variables, the names are not there at runtime.
 If you really need to do this, you'll have to build your own lookup table,
 possibly using some macro magic to avoid having to type the name twice for
 each entry.

 --
 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: Looking up a NSString constant at runtime

2010-01-04 Thread Graham Cox

On 05/01/2010, at 11:03 AM, David Alter wrote:

 I can open a library and lookup a function by name using dlsym. These
 constants are EXTERN. It seams there should be away to look these up as
 well.

Functions are not the same, because a function's name is a necessary part of 
the runtime. A constant's name is just a convenience for the programmer and 
doesn't make it into the binary.

There is no built-in standard way to do this - you're on your own.

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


[MEET] Toronto Area Cocoa WebObjects Developer Group - January 26

2010-01-04 Thread Karl Moskowski
The next meeting of tacow/Toronto CocoaHeads will be held on Tuesday, January 
26 at 6:30 PM at Ryerson University.

Note that this meeting is two weeks later than usual; also, we're no longer 
using the same meeting room. Up-to-date info and directions are available at 
http://groups.google.com/group/tacow and http://tacow.org/.


Karl Moskowski kolpa...@voodooergonomics.com
Voodoo Ergonomics Inc. http://voodooergonomics.com/





smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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

Re: Re: NSSearchField and bindings question

2010-01-04 Thread lorenzo7620

On Jan 4, 2010 5:15pm, Saurabh Sharan saurabh.sha...@isharan.com wrote:
You're not alone -- happened to me too. Though, when I downloaded the  
code from pragprog.com, it worked.



- Saurabh



On Sun, Jan 3, 2010 at 10:11 PM, lorenzo7...@gmail.com wrote:


I'm going the Zarra book, Core Data and I;ve reached the section where  
an NSSearchfield is bound to one of the arrays used in the sample  
application (page 43). As instructed in the book, I configured the  
NSSearchfield's predicate binding as follows:




Controller Key: filterPredicate



Model Key Path: name



Display Name: predicate



Predicate Format: keyPath contains $value




This did not work and the NSTableView (column) which should update itself  
from the NSArrayController does nothing.



I found an example of this sort of thing here:



http://homepage.mac.com/mmalc/CocoaExamples/controllers.html




and found that the binding in the second predicate used for the  
NSSearchfield is configured like this:



Controller Key: filterPredicate



Model Key Path :



Display Name: Last Name



Predicate Format: lastName contains[cd] $value





I configured my predicate binding fashion and it works. So my question is:



Did I miss something in the book, or is the book wrong?



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/saurabh.sharan%40isharan.com





This email sent to saurabh.sha...@isharan.com







Thanks for the reply. The downloadable code differs from the book as well:
Controller Key: filterPredicate
Model Key Path:
Display Name: Recipe Name --- Here is one difference, book uses 'predicate'
Predicate Format: name contains[c] $value --- Here is another, book  
uses 'keyPath contains $value'


This works. So, if not anything else, I know of two ways to do this now.
Thanks again.
___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread Mark Ritchie
On 4/Jan/2010, at 4:24 PM, glenn andreas wrote:
 CFBundle has routines for looking up both functions and data by name.  It 
 does require you figure out what framework the symbol comes from (and then 
 get the corresponding CFBundle), but it is doable.

Cool, I didn't know that CFBundle exposed access to external symbols at run 
time!  I've always used nm (or some such) to look at the symbol table.   This 
was a fun exercise to work out how to get access to the value of the symbol at 
runtime.  Apologies if I've done something weird, I don't work in CF very often.

If you know the bundle identifier, then it would seem that this code will find 
the symbol and allow access to its value:

CFBundleRef bundle = 
CFBundleGetBundleWithIdentifier(CFSTR(com.apple.AppKit));
if(bundle){
NSString **pointer = (NSString **)CFBundleGetDataPointerForName 
(bundle, CFSTR(NSDeviceResolution));
if(pointer){
NSLog(@NSDeviceResolution = %@, *pointer);
}
}

If you don't know the bundle identifier then I assume you have to iterate over 
the available bundles (left as an exercise for someone else. ;-)

As to the usefulness of this, I can't say.  The original poster never said why 
they were trying to do so I don't know if this will be suitable for the task... 
 Today however, at this moment, it worked for me!
M.

___

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

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

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

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


Question about multiple MOCs on shared PSC

2010-01-04 Thread Rick Mann
So, I thought I could create a new NSManagedObjectContext given the 
NSPersistentStoreCoordinator of a different MOC, and that it would be a 
completely blank context. But it turns out fetches for objects will fetch 
anything out of the store(s). This makes sense, but isn't what I wanted. I 
really wanted to have to create all new objects in the new MOC, and then add 
those to the store, and otherwise treat the MOC as if it were a blank slate 
(i.e., do fetches, etc and not have any problems).

So, it looks like I need to create a new standalone MOC, and then manually 
integrate the changes back into the old one. Before I proceed with that, can 
anyone tell me if that's not the case?

TIA!
Rick

P.S. It may not be as bad as all that; I may be able to do what I need to with 
no Fetches done in the MOC.

-- 
Rick

___

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

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

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

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


Re: Looking up a NSString constant at runtime

2010-01-04 Thread Scott Ribe
Ah yes, external symbols in a dynamic library--you do have some chance of
looking them up at run time ;-)

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


NSViewController view swapping where to put the buttons at?

2010-01-04 Thread Dan

Hi all,

My end goal is to have an interface that swaps views and performs 
actions at each of those views, with the ability to go back and forth 
over those views. Not sure how to do this I found something similar to 
what I want to do in View swapping using a view controller. So I have a 
Main Window, that contains a NSView aka the right side of a vertical 
split view object and I have set up a situation using multiple xib 
interfaces containing views to swap.


Using an NSViewController object by following the example 
(http://developer.apple.com/mac/library/samplecode/ViewController/). 
This issue I am running into is where to place the buttons at to control 
swapping between views. At certain times I don't want the buttons to be 
there unless certain conditions are met. So that led me to the idea of 
placing the buttons I want within the Views, this is different from the 
example which provides a drop-down menu that's always visible as 
provided in the example. So I have a refresh button (left side of the 
split view)that checks that the conditions are right, if they are it 
loads the first view, I have this part working.


The part I am having trouble with is getting the buttons I make in each 
view to call a method in the Window Controller.  I figured swapping in 
out views would be a much better solution than doing a whole lot of 
setHidden: calls.  The Views that I am swapping in are subclasses of 
NSViewController. I have tried adding a NSObject in Interface Builder 
and classing it to that of my Window controller, this allows me to 
connect the button to the method, but causes a init loop, when I remove 
the refresh button method call from awakeFromNib that causes the init 
infinite loop to stop but now view swapping does not happen, even though 
my logs say the method is being called.  I am new to Cocoa Development 
so any guidance and suggestions are welcomed, it seems like I am doing 
this the hard way...


Thanks,
Dan

___

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

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

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

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


[moderator] Re: help a brother out?

2010-01-04 Thread Scott Anguish
Any discussion of copying will result in removal from the list and Apple WWDR 
and legal departments being notified.


[moderator]

On Jan 4, 2010, at 6:14 PM, PCWiz wrote:

 Hi Ryan,
 
 Long time no talk, but distros aren't a good way to go with Snow Leopard. 
 Retail install is easier and better.
 
 
 Independent Cocoa Developer, Macatomy Software
 http://macatomy.com
 
 
 On 2010-01-04, at 12:31 PM, Ryan R. Moos wrote:
 
 any chance you might know a rapidshare link for  OS X 10.6 Snow Leopard 
 Universal v3.6?
 Long ago you pointed me in the right direction for Kalyway

___

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

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

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

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


iPhone: NSXMLParser problems

2010-01-04 Thread Eric E. Dolecki
I am an XML parsing noob, but I do it all the time in AS3, etc. I have the
following methods... I was expecting something to be called in the delegate
methods, but I don't get anything. Shouldn't I be getting something...
although the Yahoo! API is supposed to return XML, it's really a weird
bastardization of XML and HTML:

- (void)parserDidStartDocument:(NSXMLParser *)parser {

NSLog(@parserDidStartDocument);

}


- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError
*)parseError {

NSLog(@Parsing Error);

}


- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName
namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
attributes:(NSDictionary *)attributeDict {

NSLog(@didStartElement);

//not sure how to handle namespaces in obj-c

if( [elementName isEqualToString:@yweather:condition]){

NSString *thisOwner = [attributeDict objectForKey:@text];

NSLog(@%@, thisOwner);

}

}


// I send this a string, ie. 01701

+(NSString*)getWeatherXmlForZipCode: (NSString*)zipCode {

NSError *error;

NSURLResponse *response;

NSData *dataReply;

NSString *stringReply;

NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL: [NSURL
URLWithString: [NSString stringWithFormat:@
http://weather.yahooapis.com/forecastrss?p=%@;, zipCode]]];

[request setHTTPMethod: @GET];

dataReply = [NSURLConnection sendSynchronousRequest:request
returningResponse:response error:error];

stringReply = [[NSString alloc] initWithData:dataReply
encoding:NSUTF8StringEncoding];

 NSString *header = @?xml version=\1.0\ encoding=\UTF-8\?;

NSString *xml = [NSString stringWithFormat:@%...@\n%@, header, stringReply];

NSData *data = [xml dataUsingEncoding:NSUTF8StringEncoding];

 NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];

[parser setDelegate:self];//should allow the methods above to be called when
I parse?

[parser setShouldResolveExternalEntities:YES];

[parser setShouldProcessNamespaces:YES];

[parser parse];

 //NSLog(stringReply);

return stringReply;

}
___

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

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

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

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


Re: NSViewController view swapping where to put the buttons at?

2010-01-04 Thread Graham Cox

On 05/01/2010, at 11:45 AM, Dan wrote:

 My end goal is to have an interface that swaps views and performs actions at 
 each of those views, with the ability to go back and forth over those views. 
 Not sure how to do this I found something similar to what I want to do in 
 View swapping using a view controller. So I have a Main Window, that contains 
 a NSView aka the right side of a vertical split view object and I have set up 
 a situation using multiple xib interfaces containing views to swap.
 
 Using an NSViewController object by following the example 
 (http://developer.apple.com/mac/library/samplecode/ViewController/). This 
 issue I am running into is where to place the buttons at to control swapping 
 between views. At certain times I don't want the buttons to be there unless 
 certain conditions are met. So that led me to the idea of placing the buttons 
 I want within the Views, this is different from the example which provides a 
 drop-down menu that's always visible as provided in the example. So I have a 
 refresh button (left side of the split view)that checks that the conditions 
 are right, if they are it loads the first view, I have this part working.
 
 The part I am having trouble with is getting the buttons I make in each view 
 to call a method in the Window Controller.  I figured swapping in out views 
 would be a much better solution than doing a whole lot of setHidden: calls.  
 The Views that I am swapping in are subclasses of NSViewController. I have 
 tried adding a NSObject in Interface Builder and classing it to that of my 
 Window controller, this allows me to connect the button to the method, but 
 causes a init loop, when I remove the refresh button method call from 
 awakeFromNib that causes the init infinite loop to stop but now view swapping 
 does not happen, even though my logs say the method is being called.  I am 
 new to Cocoa Development so any guidance and suggestions are welcomed, it 
 seems like I am doing this the hard way...


The buttons that control the view swapping don't want to be in the views that 
are swapped. They ought to be external to them, and handled by a separate 
(master?/parent?) controller.

If they need to be conditionally hidden, then maybe an informal protocol 
implemented by each view sub-controller can return whether a given button 
should be hidden or shown, and the master controller can then ask the 
subcontroller what to show/hide that way.

It sounds like you have something like a master/detail interface - if so then 
searching the archives and docs for those terms should unearth plenty of 
discussion and approaches.

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


Weird issue with BDAlias/FSRefs and the case of filesystem paths

2010-01-04 Thread Rob Keniger
Hi everyone,

I'm using the BDAlias wrapper (http://github.com/rentzsch/bdalias) for handling 
alias records so that my app manages files better when they're moved or renamed.

Things were working fine but recently, for no apparent reason, any alias that 
points to a file in the Users folder returns a lowercase users filename for 
the Users folder rather than the normal Users.

This means that my paths look like this:

/users/rob/some/file.html

rather than this:

/Users/rob/some/file.html

If I use any of the Cocoa methods to select a file such as NSOpenPanel, or just 
print NSHomeDirectory(), I get the correct result, Users.

In the Finder and when using Terminal, the folder is named Users. From what I 
can tell there are no extended attributes on the Users folder, running xattr 
-l -v /Users returns nothing.

I've looked at the BDAlias code and it's pretty straightforward, it is just 
getting a CFURLRef from the path and then grabbing the FSRef from the URL, 
something like this:

FSRef *outRef;
CFURLReftempURL = NULL;
Boolean gotRef = false;
tempURL = CFURLCreateWithFileSystemPath(kCFAllocatorDefault, inPath, 
kCFURLPOSIXPathStyle, false);
if (tempURL == NULL)
return fnfErr;
gotRef = CFURLGetFSRef(tempURL, outRef);

When the BDAlias object is asked for its path it does the reverse, and gets the 
path from the FSRef via a CFURL:

CFURLCreateFromFSRef(kCFAllocatorDefault, inRef);
if (tempURL == NULL)
   return NULL;
CFStringRef result = CFURLCopyFileSystemPath(tempURL, kCFURLPOSIXPathStyle);

This all seems fine, and the only things I can think of is that there is some 
weird bug in CoreFoundation that's causing this or that my drive is corrupted 
in some weird fashion, although Disk Utility reports no problems.

Interestingly, on my system other apps such as BBEdit and Coda also exhibit 
this behaviour. In BBEdit for example, if I choose Edit  Insert  File/Folder 
Paths then I get /users/rob/some/file.html. I assume that's because it's also 
using FSRefs internally.

I don't understand what could be happening here, does anyone have any clues? 
I've never seen anything like this.

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


Getting warning when saving merged MOC

2010-01-04 Thread Rick Mann
I'm slowly but surely getting the hang of using multiple MOCs. I'm successfully 
creating objects in MOC B and merging those changes into the existing MOC A, 
and seeing the UI bound to MOC A update to reflect the changes.

The problem I'm seeing now is that MOC A then becomes dirty, and wants to be 
saved. If I save it, I get a warning that This document’s file has been 
changed by another application since you opened or saved it. The changes made 
by the other application will be lost if you save. Save anyway?

The thing that's a bit wonky here is that these changes are already saved in 
the store, because that's how the MOCs got merged in the first place (the dirty 
flag is being set by my call to -mergeChangesFromContextDidSaveNotification:). 
There's definitely no other app involved.

The changes in MOC B consist of all new objects, and a relationship between an 
old object and a new one. This is a to-many relationship, that is, the old 
Group entity picks up another Part entity.

Am I doing something wrong, or failing to take some step to avoid this 
confusion? There may be legitimate changes in MOC A that need to be saved, but 
the merged changes should already be in the store.

TIA,
Rick

___

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

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

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

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