Re: Drawing over a transparent background

2009-08-24 Thread Ron Fleckner


On 24/08/2009, at 2:29 PM, Rob Keniger wrote:



On 24/08/2009, at 9:33 AM, Ron Fleckner wrote:

My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of the  
original drawing in the subview.  I don't want that ghost image!



What are you returning for the -isOpaque method of your custom view?  
If your view has any parts that have an alpha less than 1.0 then you  
must return NO from this method.



On 24/08/2009, at 2:36 PM, Kyle Sluder wrote:

On Aug 23, 2009, at 4:33 PM, Ron Fleckner  
 wrote:


My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of the  
original drawing in the subview.  I don't want that ghost image!


Have you remembered to override -isOpaque to return NO?


Yes, I return NO.  There are four views, each one a subview (built in  
IB) of the one below.  The background is the content view of the  
window with hourHand as a subview, which has minuteHand as a subview,  
which has secondHand as a subview.  To draw, a timer callback tells  
the bottom view to setNeedsDisplay:YES every second.  Each 'hand' view  
then rotates by the correct amount and draws it's hand.


I've googled a bit but it's very discouraging.

Thanks anyway,

Ron

___

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

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

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

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


scroll automatically if the text is too long

2009-08-24 Thread Massimiliano Gargani

Hi there,

there's a simple way to make text in a cell of a table to  
automatically scroll if the text is longer than the text field?


something like itunes when song title is too long and start to scroll  
horizontally.


Thanks,
Max

___

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

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

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

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


Re: authorization services

2009-08-24 Thread Rick C.
thank you kyle,

i've been carefully reading over authorization services since i posted and 
looks like i'm getting there.  i definitely want to make sure i do this the 
right way and thanks again for your help!

rick






From: Kyle Sluder 
To: Rick C. 
Cc: cocoa dev 
Sent: Monday, August 24, 2009 2:08:07 PM
Subject: Re: authorization services

Avoid using NSTask with Authorization Services in any pattern other than that 
illustrated in the documentation.

Using AppleScript for this sounds like severe overkill. And shelling out to a 
script is not a good idea when filenames or special characters are involved.

Learn and use Authorization Services. Don't make your app needlessly slow, and 
don't expose your users to fragility or potential security problems. :)

--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: Core Data dog-slow when using first time after boot

2009-08-24 Thread Ruotger Skupin


Am 20.08.2009 um 22:28 schrieb Ben Trumbull:


setRelationshipKeyPathsForPrefetching


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent to  
instance 0x10ee150


For the record: I do use one-way relationships

Ruotger

___

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

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

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

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


Re: I need to convert NSTableView data into something suitable for consumption by a spreadsheet

2009-08-24 Thread Michael A. Crawford

Thanks to Kyle for the 'where' and to Graham for the 'how'.

-Michael

On Aug 18, 2009, at 11:08 PM, Kyle Sluder wrote:

Coming at it from the point of NSTableView is attacking from the  
wrong direction. You should be exporting your model data as CSV; a  
controller (in your case, likely an NSArrayController subclass that  
takes the place of your existing NSArrayController—or perhaps your  
NSDocument subclass) should be doing the exporting.


--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: readInBackgroundAndNotify not working?

2009-08-24 Thread Greg Parker

On Aug 23, 2009, at 8:12 PM, Adam R. Maxwell wrote:

On Aug 23, 2009, at 8:01 PM, Kyle Sluder wrote:

On Aug 23, 2009, at 7:42 PM, PCWiz  wrote:

name:@"NSFileHandleReadCompletionNotification"


NSFileHandleReadCompletionNotification is the name of a constant,  
not necessarily its value.


Right, and that was my first thought, too!  I've never used  
NSFileHandle for this purpose, either, so wrote a quick test app to  
see what would happen.  It turns out that the value is the same as  
the constant in this case, though


Doesn't matter. Use the framework-provided constant. Some code depends  
on seeing the same address as the framework's variable. Such code will  
fail if you use a different copy of the same characters.



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


___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Sean Kline
Interface Builder->Text Field Cell Attributes->Layout->Scrolls

On Mon, Aug 24, 2009 at 3:59 AM, Massimiliano Gargani  wrote:

> Hi there,
>
> there's a simple way to make text in a cell of a table to automatically
> scroll if the text is longer than the text field?
>
> something like itunes when song title is too long and start to scroll
> horizontally.
>
> Thanks,
> Max
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/skline1967%40gmail.com
>
> This email sent to skline1...@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


Need NSOperation replacement for Tiger (10.4)

2009-08-24 Thread Michael A. Crawford
I have written an application that uses the NSOperation and  
NSOperationQueue classes.  My customer now wants me to make it run on  
Tiger.  Before I try to write my own limited version of NSOperation  
and NSOperationQueue that creates threads based on the number of  
available processing cores (I know there is more to a good  
implementation than that), I though someone out there might have  
already done so.  So, I'm looking for a drop in implementation I can  
insert into my existing CDAppTask class.


-Michael
--
The difference between genius and stupidity...
...is that genius has its limits."

-- Albert Einstein



___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Massimiliano Gargani

Hi,

I've already tried but the text don't move.

I set IB-->Text Field Cell Attributes:

Layout: scrolls
Text dir: natural (but tried all options)
State: enable continuos (flagged and not flagged)


I've noticed that Line break for Table View attributes is fixed to  
Word Wrap and don't let you to change.


Thanks,
Max

Il giorno 24/ago/09, alle ore 14:17, Sean Kline ha scritto:


Interface Builder->Text Field Cell Attributes->Layout->Scrolls

On Mon, Aug 24, 2009 at 3:59 AM, Massimiliano Gargani   
wrote:

Hi there,

there's a simple way to make text in a cell of a table to  
automatically scroll if the text is longer than the text field?


something like itunes when song title is too long and start to  
scroll horizontally.


Thanks,
Max

___

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

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

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


This email sent to skline1...@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: Confusion about custom UITableViewCell

2009-08-24 Thread Fritz Anderson

On 23 Aug 2009, at 7:19 PM, Chris Idou wrote:

I'm trying to make a custom UITableViewCell, but the way I'm doing  
it, all the drawing of the table seems to be screwed up. The view  
seems to be working in some sense, because I can see the data, but  
only one row at the bottom can be seen and things are generally  
screwed up when scrolling. This is what I'm doing:


1) Create new Navigation based app.
2) Add a Table View Cell to the RootViewController.xib
3) Edit the TableViewCell in IB, add some Labels onto it.
4) Connect TableViewCell and Labels to outlets in RootViewController.h
5) modify tableView:cellForRowAtIndexPath: so that it sets data in  
the UILabels and returns the TableViewCell from the Nib outlet.


Is there some reason this shouldn't work?


I'm sure this is somewhere in Apple's sample code, or in the relevant  
programmer's guide, but I don't have time to look it up.


If you're laying out a cell in Interface Builder, the cell has to be  
in its own NIB. This is because each cell (on display) in the table  
needs a separate instance of UITableViewCell.


You have to have onw outlet for a cell in your table-view controller,  
use the controller as File's Owner, and link the cell to the outlet.  
In tableViewCell:forRowAtIndexPath: (note lower-case F), if a new cell  
is needed, load the NIB. Take the cell from the outlet, retain 
+autorelease it, and nil-out the outlet.


You may have to implement tableView:heightForRowAtIndexPath:.

— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- 


___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Graham Cox


On 24/08/2009, at 10:30 PM, Massimiliano Gargani wrote:

I've noticed that Line break for Table View attributes is fixed to  
Word Wrap and don't let you to change.



Nothing to stop you changing that in your code.

--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: I am not sure which message I have to trust?

2009-08-24 Thread Fritz Anderson

On 23 Aug 2009, at 9:27 PM, Agha Khan wrote:

When I am using emulator there is no leak, but when I run on device,  
it looks like there is a leak. I am unable to figure out why it so   
nor I was able to find the source.


You should say explicitly, preferably in the subject, what Cocoa OS  
you are using. I can infer it, but it is courteous to say so at first,  
so people can decide whether they have the expertise to answer.


You have provided almost no information.

What "message" are you referring to? From where? What exactly is the  
content of this "message," how do you interpret it, and why?


What instruments are you using in Instruments? What does Instruments'  
allocation history say about the leaked block? What is the stack trace  
— does it pass through your code?


— F

--
Fritz Anderson -- Xcode 3 Unleashed: Now in its second printing -- 


___

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

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

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

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


Re: Need NSOperation replacement for Tiger (10.4)

2009-08-24 Thread Rob Keniger


On 24/08/2009, at 10:25 PM, Michael A. Crawford wrote:

I have written an application that uses the NSOperation and  
NSOperationQueue classes.  My customer now wants me to make it run  
on Tiger. Before I try to write my own limited version of  
NSOperation and NSOperationQueue that creates threads based on the  
number of available processing cores (I know there is more to a good  
implementation than that), I though someone out there might have  
already done so.  So, I'm looking for a drop in implementation I can  
insert into my existing CDAppTask class.



There's RAOperationQueue:

http://www.rogueamoeba.com/utm/2008/12/01/raoperationqueue-an-open-source-replacement-for-nsoperationqueue/

I don't know if it's Tiger compatible but it is open source, so  
adapting it would be quicker than coding from scratch.


--
Rob Keniger



___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Massimiliano Gargani

Yep,

but I don't know if "locked" line break attributes of table view if  
the cause of my problem.


I mean, it's enough scrolls is set only for Text Field Cell or *must*  
be set for both, Table View *and* Text Field Cell?


Sorry if my question is stupid but I'm just learning cocoa and before  
ask here I've googled a lot.


Thanks,
Max

Il giorno 24/ago/09, alle ore 14:40, Graham Cox ha scritto:



On 24/08/2009, at 10:30 PM, Massimiliano Gargani wrote:

I've noticed that Line break for Table View attributes is fixed to  
Word Wrap and don't let you to change.



Nothing to stop you changing that in your code.

--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: authorization services

2009-08-24 Thread Rick C.
hi again,

if i can follow up please about authorization services i just want to be sure 
i'm on the right track.  if i'm just trying to do a simple movePath but i don't 
have access is the only way to get access by using 
authorizationExecuteWithPrivileges?  i keep reading about how i should avoid it 
if possible.  i have followed authorizing in a simple self-restricted 
application according to the docs but i don't really see what i can do after i 
get authorization...maybe i'm missing something?  i guess i'm just looking for 
confirmation if i must use authorizationExecuteWithPrivileges or not, and if so 
can i control the timeout because the docs seem to say it needs authentication 
every time.  thanks again for the help and patience,

rick






From: Kyle Sluder 
To: Rick C. 
Cc: cocoa dev 
Sent: Monday, August 24, 2009 2:08:07 PM
Subject: Re: authorization services

Avoid using NSTask with Authorization Services in any pattern other than that 
illustrated in the documentation.

Using AppleScript for this sounds like severe overkill. And shelling out to a 
script is not a good idea when filenames or special characters are involved.

Learn and use Authorization Services. Don't make your app needlessly slow, and 
don't expose your users to fragility or potential security problems. :)

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


Not accepting click on Button

2009-08-24 Thread Nikhil Khandelwal
Hi List,

In my application, I am running a process for copying files from one location 
to another. In this I select number of files from panel and then showing a 
progress bar which shows progress of copying. In this window I have a cancel 
button to cancel the copying process but clicking on the cancel button does not 
call the IBAction until the whole process of copying the file completes.
Any one faced same problem ?

Thanks,
Nikhil


DISCLAIMER
==
This e-mail may contain privileged and confidential information which is the 
property of Persistent Systems Ltd. It is intended only for the use of the 
individual or entity to which it is addressed. If you are not the intended 
recipient, you are not authorized to read, retain, copy, print, distribute or 
use this message. If you have received this communication in error, please 
notify the sender and delete all copies of this message. Persistent Systems 
Ltd. does not accept any liability for virus infected mails.
___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread I. Savant
On Mon, Aug 24, 2009 at 3:59 AM, Massimiliano Gargani   
wrote:


something like itunes when song title is too long and start to  
scroll horizontally.


  With respect, I don't believe any of the responses so far have  
noticed the above line. He appears to be asking for the animated  
scrolling in iTunes' track title display.


  In short, there is no automatic way to do this. The "scrolls"  
feature of NSTextField/Cell is a good start, though. Subclass and mix  
it with some Leopard animation and you're there. Hint: whatever  
mechanism (for you to read and discover) controls the scrolling can be  
given an animatable property, which you can call.


  The trick is, rather than animating distance over some given time,  
you'll need to spread the time over a given distance (otherwise long  
strings will scroll faster than short ones).


--
I.S.

___

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

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

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

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


Re: Not accepting click on Button

2009-08-24 Thread I. Savant

On Aug 24, 2009, at 9:14 AM, Nikhil Khandelwal wrote:

In my application, I am running a process for copying files from one  
location to another. In this I select number of files from panel and  
then showing a progress bar which shows progress of copying. In this  
window I have a cancel button to cancel the copying process but  
clicking on the cancel button does not call the IBAction until the  
whole process of copying the file completes.

Any one faced same problem ?


  You're doing your work in the main run loop (where all UI stuff is  
handled). The main run loop is blocked until your work completes and  
the run loop is ready to handle a new event (the button click).


  Move your work to a separate thread (if on Leopard, try  
NSOperation / NSOperationQueue). That way your UI is free to respond  
to the cancel button (which in turn tells the queue to cancel all  
pending tasks).


--
I.S.




___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Graham Cox


On 24/08/2009, at 10:49 PM, Massimiliano Gargani wrote:

but I don't know if "locked" line break attributes of table view if  
the cause of my problem.


I mean, it's enough scrolls is set only for Text Field Cell or  
*must* be set for both, Table View *and* Text Field Cell?


Sorry if my question is stupid but I'm just learning cocoa and  
before ask here I've googled a lot.



I think that only the text cell settings matter here. The other  
setting is inherited from NSControl and I'm not sure if it's actually  
used by NSTableView.


--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: Not accepting click on Button

2009-08-24 Thread Dave DeLong
Your copy method seems to be blocking the main thread. If you split it  
off onto its own thread, it should do what you're looking for. You  
mayhave to take other things into account, such as resource locking,  
but such is the world of threaded programming.


Dave

Sent from my iPod

On Aug 24, 2009, at 6:14 AM, Nikhil Khandelwal > wrote:



Hi List,

In my application, I am running a process for copying files from one  
location to another. In this I select number of files from panel and  
then showing a progress bar which shows progress of copying. In this  
window I have a cancel button to cancel the copying process but  
clicking on the cancel button does not call the IBAction until the  
whole process of copying the file completes.

Any one faced same problem ?

Thanks,
Nikhil

___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Graham Cox


On 24/08/2009, at 11:14 PM, I. Savant wrote:

 With respect, I don't believe any of the responses so far have  
noticed the above line. He appears to be asking for the animated  
scrolling in iTunes' track title display.



Well, I thought that at first but after reading it different ways  
decided he was talking about scrolling while typing. But having  
checked, iTunes doesn't allow direct editing in its table views, so I  
think you're right after all.


OP please clarify what you want.

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


Getting an image of an NSTableView row

2009-08-24 Thread Paul Kim
I'm trying to get an image of an NSTableView row. Sounds simple but if  
you actually try it, you'll find that NSTableView is particularly  
resistant to this. Here is what I am looking for:


- The row must look like how it does to the user. In particular, the  
background must look like as it does when the window is key. In  
particular, retain the look of the row if it is a group row, in source  
list and regular mode.
- The row will probably not be visible at the time (scrolled off). It  
may never have been visible before.


Methods used (all of which failed):

- -bitmapImageRepForCachingDisplayInRect:/- 
cacheDisplayInRect:toBitmapImageRep: created a blank image.

- -initWithFocusedViewRect:. I forget how it failed but it failed.
- Lock focus on image, drawRect (after proper coord system  
translations). Various but never entirely correct results.
- Lock focus on image, -drawBackgroundInClipRect:/-drawRow:clipRect:.  
Background was never right.
- Lock focus on image, cycle across the columns, do - 
preparedCellAtColumn:row: and draw each cell. Same as above.
- -dragImageForRowsWithIndexes:tableColumns:event:offset: gets a row  
image but, as above, no background.


In the lock focus scenarios, I've even tried scrolling the row to  
visible, draw it, scroll back. In some cases, a slight improvement but  
never quite right. I suspect that NSTableView is optimized to the  
point where it won't draw anything properly that isn't visible, and it  
seems to do a way too good a job of it. Ideas?


paul

___

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

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

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

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


Re: scroll automatically if the text is too long

2009-08-24 Thread Massimiliano Gargani

Just to clarify,

I've talked about itunes just as example. What I looking for is a way  
to:


I have a table (not editable) with 1 column and severals rows.
contents in some rows is longer than colum width so I have:

Column
---
Venice
Rome
Los Ang
New Yor
Washin.
etc etc

So i'm looking a way to scroll content of row when selected.

something like:
Washin -- ashing -- shingt -- hingto -- ington

Hope new is more clear.

Thanks,
Max


Il giorno 24/ago/09, alle ore 15:23, Graham Cox ha scritto:



On 24/08/2009, at 11:14 PM, I. Savant wrote:

With respect, I don't believe any of the responses so far have  
noticed the above line. He appears to be asking for the animated  
scrolling in iTunes' track title display.



Well, I thought that at first but after reading it different ways  
decided he was talking about scrolling while typing. But having  
checked, iTunes doesn't allow direct editing in its table views, so  
I think you're right after all.


OP please clarify what you want.

--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: scroll automatically if the text is too long

2009-08-24 Thread I. Savant

On Aug 24, 2009, at 10:12 AM, Massimiliano Gargani wrote:


I have a table (not editable) with 1 column and severals rows.
contents in some rows is longer than colum width so I have:

Column
---
Washin.

So i'm looking a way to scroll content of row when selected.

something like:
Washin -- ashing -- shingt -- hingto -- ington



  If you indeed mean you want to animate the scroll automatically  
while the row is selected, it only adds one more layer to my previous  
suggestion. That additional layer is turning the animation on and off  
if it is used in a selected row.


  As Graham suggested, only the NSTextFieldCell needs modification  
since it'll be used in a table view.


--
I.S.




___

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

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

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

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


Re: Need NSOperation replacement for Tiger (10.4)

2009-08-24 Thread Adam R. Maxwell


On Aug 24, 2009, at 5:47 AM, Rob Keniger wrote:



On 24/08/2009, at 10:25 PM, Michael A. Crawford wrote:

I have written an application that uses the NSOperation and  
NSOperationQueue classes.  My customer now wants me to make it run  
on Tiger. Before I try to write my own limited version of  
NSOperation and NSOperationQueue that creates threads based on the  
number of available processing cores (I know there is more to a  
good implementation than that), I though someone out there might  
have already done so.  So, I'm looking for a drop in implementation  
I can insert into my existing CDAppTask class.



There's RAOperationQueue:


I wrote an implementation as part of my FileView framework at http://fileview.googlecode.com 
 (BSD license).  As far as features, it's somewhere between  
NSOperationQueue and RAOperationQueue; e.g., I don't support  
dependencies, since I don't need them, and the concurrent task  
scheduling doesn't try to adjust based on load.  However, it should be  
easy to extract from the framework, and it's been tested and used on  
Tiger and later.





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: Need NSOperation replacement for Tiger (10.4)

2009-08-24 Thread Michael A. Crawford
Thanks', guys.  These are both excellent suggestions.  I'll weight  
them in order to determine which will be the best fit for my  
particular needs.


-Michael



On Aug 24, 2009, at 10:21 AM, Adam R. Maxwell wrote:



On Aug 24, 2009, at 5:47 AM, Rob Keniger wrote:



On 24/08/2009, at 10:25 PM, Michael A. Crawford wrote:

I have written an application that uses the NSOperation and  
NSOperationQueue classes.  My customer now wants me to make it run  
on Tiger. Before I try to write my own limited version of  
NSOperation and NSOperationQueue that creates threads based on the  
number of available processing cores (I know there is more to a  
good implementation than that), I though someone out there might  
have already done so.  So, I'm looking for a drop in  
implementation I can insert into my existing CDAppTask class.



There's RAOperationQueue:


I wrote an implementation as part of my FileView framework at http://fileview.googlecode.com 
 (BSD license).  As far as features, it's somewhere between  
NSOperationQueue and RAOperationQueue; e.g., I don't support  
dependencies, since I don't need them, and the concurrent task  
scheduling doesn't try to adjust based on load.  However, it should  
be easy to extract from the framework, and it's been tested and used  
on Tiger and later.



___

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

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

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

This email sent to michaelacrawf...@me.com


___

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

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

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

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


Re: readInBackgroundAndNotify not working?

2009-08-24 Thread Adam R. Maxwell


On Aug 24, 2009, at 3:45 AM, Greg Parker wrote:


On Aug 23, 2009, at 8:12 PM, Adam R. Maxwell wrote:

On Aug 23, 2009, at 8:01 PM, Kyle Sluder wrote:

On Aug 23, 2009, at 7:42 PM, PCWiz  wrote:

   name:@"NSFileHandleReadCompletionNotification"


NSFileHandleReadCompletionNotification is the name of a constant,  
not necessarily its value.


Right, and that was my first thought, too!  I've never used  
NSFileHandle for this purpose, either, so wrote a quick test app to  
see what would happen.  It turns out that the value is the same as  
the constant in this case, though


Doesn't matter. Use the framework-provided constant. Some code  
depends on seeing the same address as the framework's variable. Such  
code will fail if you use a different copy of the same characters.


IIRC there's some limitation with NSNotification and constants, but I  
couldn't find it in the documentation last time I checked.  Doesn't  
NSNotificationQueue coalescing depend on pointer equality of the  
notification name?  Regardless, I always use named constants, as you  
say, and had no intention to contradict Kyle's advice there.





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

Create VNC Client iPhone

2009-08-24 Thread Joe Turner

Hello,

I've wanted to switch from bonjour to something more universal for a  
while now. And, I'm wondering about how to do VNC. I've seen that many  
apps on the iPhone use Apple's Screen-Sharing functionality as a VNC  
Server, and I would like to do the same. I have looked around for any  
sample code for VNC, but cannot find any.


So, how do I connect to a Mac with Screen-Sharing on (password set or  
not), and then how do I tell it to type something? I'm fairly new to  
VNC, so any help would be much appreciated :)


Cheers,

Joe Turner
___

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

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

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

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


Re: Create VNC Client iPhone

2009-08-24 Thread Andrew Farmer

On 24 Aug 2009, at 07:49, Joe Turner wrote:
I've wanted to switch from bonjour to something more universal for a  
while now. And, I'm wondering about how to do VNC. I've seen that  
many apps on the iPhone use Apple's Screen-Sharing functionality as  
a VNC Server, and I would like to do the same. I have looked around  
for any sample code for VNC, but cannot find any.


So, how do I connect to a Mac with Screen-Sharing on (password set  
or not), and then how do I tell it to type something? I'm fairly new  
to VNC, so any help would be much appreciated :)


You'll need to write some code implementing the RFB protocol... read  
this:


http://www.realvnc.com/docs/rfbproto.pdf

If you aren't comfortable with network programming, now is the time to  
start looking that stuff up.

___

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

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

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

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


Re: Create VNC Client iPhone

2009-08-24 Thread Michael Watson

On Aug 24, 2009, at 7:49, Joe Turner  wrote:


Hello,

I've wanted to switch from bonjour to something more universal for a  
while now. And, I'm wondering about how to do VNC. I've seen that  
many apps on the iPhone use Apple's Screen-Sharing functionality as  
a VNC Server, and I would like to do the same. I have looked around  
for any sample code for VNC, but cannot find




Bonjour is a discovery protocol. It exists independently of VNC.


--
michael
via iPhone
___

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

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

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

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


Re: Simple array controller master-detail binding problem

2009-08-24 Thread Leon Starr

Thanks, Quincy.

There was no error message in the session when I originally submitted  
my question.  But I just tried running my code (unchanged) this  
morning several times and found that SOMETIMES I get an error in the  
console just before the stack trace.  And it is not always exactly the  
same, but the theme is similar.  It always involves something about  
not being able to create an array.  Here's the latest:
Cannot create NSArray from object [number  
of indexes: 1 (in 1 ranges), indexes: (0)] of class NSMutableIndexSet


If I change the @property for weapons to (readwrite, copy), from  
retain, I get this error:

Cannot create NSArray from object selection of class NSCFString

I have tried running my code as a command line tool (no bindings) and  
I don't get any runtime errors, so I am not sure where the memory  
issue would be.  Any other ideas?


- Leon

On Aug 24, 2009, at 5:43 , cocoa-dev-requ...@lists.apple.com wrote:


From: Quincey Morris 
Subject: Re: Simple array controller master-detail binding problem
On Aug 23, 2009, at 19:58, Leon Starr wrote:


I can't make a lot of sense out of the stack trace, but it does end
with:
0 objc_msgSend
1 objc_getProperty
2 -[Combatant weapons]
3 -[NSObject(NSKeyValueCoding) valueForKey:]
4- [NSObject(NSKeyValueCoding) valueForKeyPath:]


You left out the vital piece of information: the error message that
was logged when this occurred. Look in the debugger console window.
(However, if this is an exception, sometimes the exception is thrown
before the error is logged. You may have to continue until the error
message appears.)

According to your stack trace, something is attempting to retrieve the
"weapons" property of a Combatant, which seems perfectly reasonable,
and all your bindings appear reasonable at first glance. The most
likely cause of your problem is a memory management error in your code
-- the Combatant object with name "Vlad" has likely been over- 
released. Chances are, when you see the error message, it will tell

you that "weapons" was sent to an object of the wrong class, and that
would pretty much confirm it. (That is, the memory that was previously
a Combatant object has been reused for a different class of object.)




Well, simple for you guys I hope!

I apologize in advance for this monstrosity of a question, but I've
had a tough time narrowing this thing down so I'm laying out all the
details to keep the thread short in hopes that someone will spot an
obvious mistake right away.  Any help greatly appreciated!

I've been trying to build a simplified implementation of the
combatants example in the Cocoa Bindings Programming Topics doc to
prove that I really understand Array Controllers and Binding.
Apparently, I do not!

My goal is to get two array controllers (master/detail) working
together in a simple non-doc cocoa app.
How hard could that be?  Versions I am working with  [10.5.8 / Xcode
3.1.3]

I have the master ac bound to its model class (Combatant) creating  
and

deleting entries no problem.  All the trouble started when I created
the detail ac for (Weapon) and tried to bind it to the master ac.   
The

app starts up without any errors or warnings at first.

I create two combatants, "Vlad" and "Atilla" in the master table, no
problem.  Now I cursor up and select "Vlad" in the first row and BAM
stack trace.  What!  Unbind the detail ac in the XIB and the master
table works perfectly adding/deleting/selecting/name changing.  To
further simplify, I have not yet attached a gui element to the detail
ac.

I can't make a lot of sense out of the stack trace, but it does end
with:
0 objc_msgSend
1 objc_getProperty
2 -[Combatant weapons]
3 -[NSObject(NSKeyValueCoding) valueForKey:]
4- [NSObject(NSKeyValueCoding) valueForKeyPath:]
leading me to wonder if I did something wrong with my accessors.
Please pardon the newbie confusion!

Data elements and settings for the ac's follow:

Classes:
App Controller
NSMutableArray *combatants
Combatant
NSString *name
NSMutableArray *weapons
Weapon
NSString *name
(code further below if you want to see it all)

Array Controllers:

Master Combatants
Attributes panel
Mode:Class, Class Name: Combatant, Key:name, weapons
Bindings panel
Content Array
Bind to: App Controller, Controller Key , Model Key Path:
combatants
(and I do have an App Controller object in the MainMenu.xib with the
AppController name set in the identity panel)

Detail Weapons
Attributes panel
Mode:Class, Class Name: Weapon, Key:name
Bindings Panel
Content Array
Bind to: Master Combatants, Controller Key: selection, Model Key
Path: weapons

The intention is to bind a Popup or even just a Table with a name
column to the Detail Weapons ac once I eliminate the runtime error.

Honestly, I wouldn't be posting all this if I hadn't been banging my
head against the wall, googling, reading tutorials, trying dozens of
variations before getting so de

Re: leak in a sound function

2009-08-24 Thread Sean McBride
On 8/23/09 11:37 AM, Agha Khan said:

>   if (fileInfo != NULL)
>   {
>   delete fileInfo;

Another minor note: you don't need to check if the pointer is null.  free
(), delete, and delete[] all do nothing if given null (this is
documented, portable, and safe to rely on).

--

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


___

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

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

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

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


Re: authorization services

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 6:10 AM, Rick C. wrote:
> if i can follow up please about authorization services i just want to be sure 
> i'm on the right track.  if i'm just trying to do a simple movePath but i 
> don't have access is the only way to get access by using 
> authorizationExecuteWithPrivileges?  i keep reading about how i should avoid 
> it if possible.  i have followed authorizing in a simple self-restricted 
> application according to the docs but i don't really see what i can do after 
> i get authorization...maybe i'm missing something?  i guess i'm just looking 
> for confirmation if i must use authorizationExecuteWithPrivileges or not, and 
> if so can i control the timeout because the docs seem to say it needs 
> authentication every time.  thanks again for the help and patience,

Yes, AEWP is what you'll need.  You factor out your "move the file"
code into a helper tool and execute that with AEWP.

Much of the advice about avoiding AEWP is to steer people away from
needlessly elevating their own privileges, and when they do need to do
so ensuring that they take the time to read and understand the sample
code.

--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: Simple array controller master-detail binding problem

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 9:14 AM, Leon Starr wrote:
> There was no error message in the session when I originally submitted my
> question.  But I just tried running my code (unchanged) this morning several
> times and found that SOMETIMES I get an error in the console just before the
> stack trace.  And it is not always exactly the same, but the theme is
> similar.  It always involves something about not being able to create an
> array.  Here's the latest:

Smells like memory mismanagement.  Set NSZombieEnabled=YES (Google for
NSZombie if you don't know what that means) and try again.

--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: I am not sure which message I have to trust?

2009-08-24 Thread David Duncan

On Aug 23, 2009, at 7:27 PM, Agha Khan wrote:


When I am using emulator there is no leak


There is no such thing as the iPhone OS Emulator. It is the iPhone OS  
Simulator, the major difference being that there is no guarantee that  
the Simulator will faithfully reproduce everything that occurs on a  
particular iPhone OS device. The simulator attempts to maintain the  
API contract of the iPhone OS SDK, not necessarily all of the  
behaviors that you will encounter on a real device.


, but when I run on device, it looks like there is a leak. I am  
unable to figure out why it so  nor I was able to find the source.



Trust what you see on the device. It is what your users will  
experience. But you haven't provided enough information for anyone to  
really assist you at this time...

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: leak in a sound function

2009-08-24 Thread David Duncan

On Aug 23, 2009, at 9:53 AM, Agha Khan wrote:

When I call this function 2nd time I get a leak. I am unable to  
figure out what I am doing wrong. Please note if I call  this  
function once there is no leak.


SoundEngine_Initialize(44100);



Please do not use SoundEngine. It was pulled from the sample code  
because there were a number of design flaws that lead to many issues,  
such as the leak you are seeing here. Use the AVAudioPlayer class or  
OpenAL directly instead.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Simple array controller master-detail binding problem

2009-08-24 Thread Leon Starr
Yes it does, Kyle!  I was so focused on being an array controller  
binding idiot that I forgot that I was also a memory management fool.   
I was about to google that NSZombie thing - which I will do next, when  
I took one more look at the code, this time with a clear focus on  
memory.  The releases looked reasonable, leaving only the possibility  
of a missing retain somewhere Voila!  I added a retain message  
where I create the weapons array in the Combatant class.  Awesome - it  
works!!!


- (id)init{
NSLog(@"Initializing combatant");
[super init];
// Create initial weapons
	weapons = [[NSMutableArray arrayWithObjects:@"Dagger", @"Sword",  
@"Pike", nil] retain];

return self;
}

Pardon my thinking as I write I am guessing I need the retain  
because this thing is being autoreleased.  AND it worked in the  
command line because the pool isn't drained in the middle of my  
session, but with a GUI it is drained on each event loop.  Of course.   
Duh.  Thanks guys!


- Leon

On Aug 24, 2009, at 9:37 , Kyle Sluder wrote:

On Mon, Aug 24, 2009 at 9:14 AM, Leon Starr  
wrote:
There was no error message in the session when I originally  
submitted my
question.  But I just tried running my code (unchanged) this  
morning several
times and found that SOMETIMES I get an error in the console just  
before the

stack trace.  And it is not always exactly the same, but the theme is
similar.  It always involves something about not being able to  
create an

array.  Here's the latest:


Smells like memory mismanagement.  Set NSZombieEnabled=YES (Google for
NSZombie if you don't know what that means) and try again.

--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: Simple array controller master-detail binding problem

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 9:58 AM, Leon Starr wrote:
> Pardon my thinking as I write I am guessing I need the retain because
> this thing is being autoreleased.  AND it worked in the command line because
> the pool isn't drained in the middle of my session, but with a GUI it is
> drained on each event loop.  Of course.  Duh.  Thanks guys!

More accurately: you need to retain it because you didn't get it from
an +alloc, -copy, or +new method.  The fact that it's autoreleased and
therefore drained at the end of the event loop is not guaranteed by
the memory management documentation.  :)

But good on ya for finding it and accurately explaining the problem
for yourself.

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


Why would +[initialize] be called twice?

2009-08-24 Thread Michael A. Crawford
Why would the class initializer be called more than once when my app  
starts up? Is this expected behavior?  In case you're wondering, it is  
called twice.


+ (void)initialize
{
// Create the defaults dictionary, fill it with the standard  
values,

// and register it.
NSMutableDictionary* defaultValues = [NSMutableDictionary  
dictionary];


[defaultValues setObject:[NSNumber numberWithBool:YES]
  forKey:CDFilterKey];
[defaultValues setObject:[NSNumber numberWithBool:YES]
  forKey:CDNotifyUserOnAnalysisCompletionKey];
[defaultValues setObject:[NSNumber numberWithBool:YES]
  forKey:CDPlaylistReminderKey];

[[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues];


MCLog(@"Registered defaults: %@", defaultValues);
}

-Michael
--
We know as much about software quality problems as they knew about the  
Black Plague in the 1600s.  We've seen the victims' agonies and helped  
burn the corpses.  We don't know what causes it; we don't really know  
if there is only one disease.  We just suffer - and keep pouring our  
sewage into our water supply.


-- Unknown

___

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

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

Help/Unsubscribe/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 would +[initialize] be called twice?

2009-08-24 Thread Jonathan del Strother
On Mon, Aug 24, 2009 at 6:19 PM, Michael A.
Crawford wrote:
> Why would the class initializer be called more than once when my app starts
> up? Is this expected behavior?  In case you're wondering, it is called
> twice.
>
> + (void)initialize
> {
>    // Create the defaults dictionary, fill it with the standard values,
>    // and register it.
>    NSMutableDictionary* defaultValues = [NSMutableDictionary dictionary];
>
>    [defaultValues setObject:[NSNumber numberWithBool:YES]
>                      forKey:CDFilterKey];
>    [defaultValues setObject:[NSNumber numberWithBool:YES]
>                      forKey:CDNotifyUserOnAnalysisCompletionKey];
>    [defaultValues setObject:[NSNumber numberWithBool:YES]
>                      forKey:CDPlaylistReminderKey];
>
>    [[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues];
>
>    MCLog(@"Registered defaults: %@", defaultValues);
> }
>


You should generally check for "self == [MyClass class]" at the start
of +[MyClass initialize].  It can get called twice if, say, someone
subclasses your class, and the subclass doesn't implement initialize.
___

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

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

Help/Unsubscribe/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 would +[initialize] be called twice?

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 10:19 AM, Michael A.
Crawford wrote:
> Why would the class initializer be called more than once when my app starts
> up? Is this expected behavior?  In case you're wondering, it is called
> twice.

Read the docs for +[NSObject initialize]:

"If a particular class does not implement initialize, the initialize
method of its superclass is invoked twice, once for the superclass and
once for the non-implementing subclass. If you want to make sure that
your class performs class-specific initializations only once,
implement initialize as in the following example:"

http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSObject_Class/Reference/Reference.html#//apple_ref/doc/uid/2050-initialize

--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: Why would +[initialize] be called twice?

2009-08-24 Thread Quincey Morris

On Aug 24, 2009, at 10:19, Michael A. Crawford wrote:

Why would the class initializer be called more than once when my app  
starts up? Is this expected behavior?  In case you're wondering, it  
is called twice.


Yes, it can be invoked more than one. Searching developer.apple.com  
for "initialize twice" found the answer in the first hit -- the reason  
and the workaround are spelled out in (mirabile dictu!) the  
documentation of +initialize.



___

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

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

Help/Unsubscribe/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 would +[initialize] be called twice?

2009-08-24 Thread Michael A. Crawford

Got it.  Thanks.

-Michael

On Aug 24, 2009, at 1:29 PM, Quincey Morris wrote:


On Aug 24, 2009, at 10:19, Michael A. Crawford wrote:

Why would the class initializer be called more than once when my  
app starts up? Is this expected behavior?  In case you're  
wondering, it is called twice.


Yes, it can be invoked more than one. Searching developer.apple.com  
for "initialize twice" found the answer in the first hit -- the  
reason and the workaround are spelled out in (mirabile dictu!) the  
documentation of +initialize.



___

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

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

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

This email sent to michaelacrawf...@me.com


___

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

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

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

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


Re: authorization services

2009-08-24 Thread Jean-Daniel Dupas


Le 24 août 2009 à 18:35, Kyle Sluder a écrit :


On Mon, Aug 24, 2009 at 6:10 AM, Rick C. wrote:
if i can follow up please about authorization services i just want  
to be sure i'm on the right track.  if i'm just trying to do a  
simple movePath but i don't have access is the only way to get  
access by using authorizationExecuteWithPrivileges?  i keep reading  
about how i should avoid it if possible.  i have followed  
authorizing in a simple self-restricted application according to  
the docs but i don't really see what i can do after i get  
authorization...maybe i'm missing something?  i guess i'm just  
looking for confirmation if i must use  
authorizationExecuteWithPrivileges or not, and if so can i control  
the timeout because the docs seem to say it needs authentication  
every time.  thanks again for the help and patience,


Yes, AEWP is what you'll need.  You factor out your "move the file"
code into a helper tool and execute that with AEWP.

Much of the advice about avoiding AEWP is to steer people away from
needlessly elevating their own privileges, and when they do need to do
so ensuring that they take the time to read and understand the sample
code.


You can also ask to the Finder to do it using AppleEvent. The Finder  
will ask the user its password if needed and will take care of the  
hard part for you.


___

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

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

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

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


Re: Why would +[initialize] be called twice?

2009-08-24 Thread Jean-Daniel Dupas


Le 24 août 2009 à 19:19, Michael A. Crawford a écrit :

Why would the class initializer be called more than once when my app  
starts up? Is this expected behavior?  In case you're wondering, it  
is called twice.


+ (void)initialize
{
   // Create the defaults dictionary, fill it with the standard  
values,

   // and register it.
   NSMutableDictionary* defaultValues = [NSMutableDictionary  
dictionary];


   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDFilterKey];
   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDNotifyUserOnAnalysisCompletionKey];
   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDPlaylistReminderKey];

   [[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues];


   MCLog(@"Registered defaults: %@", defaultValues);
}


Just a question. Did you read the +initialize reference before posting ?

Especially this part:
“If a particular class does not implement initialize, the initialize  
method of its superclass is invoked twice, once for the superclass and  
once for the non-implementing subclass. If you want to make sure that  
your class performs class-specific initializations only once,  
implement initializeas in the following example: …”


___

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

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

Help/Unsubscribe/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 would +[initialize] be called twice?

2009-08-24 Thread Bill Bumgarner

On Aug 24, 2009, at 7:19 AM, Michael A. Crawford wrote:

Why would the class initializer be called more than once when my app  
starts up? Is this expected behavior?  In case you're wondering, it  
is called twice.


+ (void)initialize
{
   // Create the defaults dictionary, fill it with the standard  
values,

   // and register it.
   NSMutableDictionary* defaultValues = [NSMutableDictionary  
dictionary];


   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDFilterKey];
   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDNotifyUserOnAnalysisCompletionKey];
   [defaultValues setObject:[NSNumber numberWithBool:YES]
 forKey:CDPlaylistReminderKey];

   [[NSUserDefaults standardUserDefaults]  
registerDefaults:defaultValues];


   MCLog(@"Registered defaults: %@", defaultValues);
}


You got your answer.

However, I would suggest registering defaults in a different way.

Specifically, I have always pushed my registration defaults into a  
property list that sits in the app bundle.


Then:

[[NSUserDefaults standardUserDefaults] registerDefaults:defaultValues:  
[NSDictionary dictionaryWithContentsOfFile: [[NSBundle mainBundle]  
pathForResource: @"RegistrationDefaults" ofType: @"plist"]]];


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


F-Script 2.0 available

2009-08-24 Thread Philippe Mougin

Hi all,

F-Script 2.0 is has been released. It provides a set of open source  
tools for interactive introspection, manipulation and scripting of  
Cocoa objects.
New features include system-wide scripting, dynamic Cocoa class  
creation, 64-bit, garbage collection, and more.


More info: http://www.fscript.org/documentation/WelcomeToFScript2/index.htm
Download: http://www.fscript.org/download/F-Script20090809.zip

Philippe Mougin


___

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

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

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

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


Re: Drawing over a transparent background

2009-08-24 Thread Steve Christensen

On Aug 23, 2009, at 10:00 PM, Ron Fleckner wrote:


On 24/08/2009, at 2:29 PM, Rob Keniger wrote:


On 24/08/2009, at 9:33 AM, Ron Fleckner wrote:

My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of  
the original drawing in the subview.  I don't want that ghost image!


What are you returning for the -isOpaque method of your custom  
view? If your view has any parts that have an alpha less than 1.0  
then you must return NO from this method.


On 24/08/2009, at 2:36 PM, Kyle Sluder wrote:

On Aug 23, 2009, at 4:33 PM, Ron Fleckner  
 wrote:


My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of  
the original drawing in the subview.  I don't want that ghost image!


Have you remembered to override -isOpaque to return NO?


Yes, I return NO.  There are four views, each one a subview (built  
in IB) of the one below.  The background is the content view of the  
window with hourHand as a subview, which has minuteHand as a  
subview, which has secondHand as a subview.  To draw, a timer  
callback tells the bottom view to setNeedsDisplay:YES every  
second.  Each 'hand' view then rotates by the correct amount and  
draws it's hand.


1. Are you erasing the view before redrawing the hand?

2. Is there any reason why you couldn't be drawing the entire clock  
(face + hands) in a single view? If it's only being updated once a  
second, it'll still take considerably less than a second to draw it  
all unless you're doing something horribly complicated.


steve

___

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

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

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

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


Re: Core Data dog-slow when using first time after boot

2009-08-24 Thread Ben Trumbull


On Aug 24, 2009, at 3:20 AM, Ruotger Skupin wrote:



Am 20.08.2009 um 22:28 schrieb Ben Trumbull:


setRelationshipKeyPathsForPrefetching


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent to  
instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use future- 
break objc_exception_throw



For the record: I do use one-way relationships



That should be okay as long as you're not pretending to use a no  
inverse to-many relationship as a de facto many to many relationship.   
No inverse relationships can only behave as if the inverse were to- 
one.  Specifically, each row in the destination entity may only be  
associated with a single row in the source entity if the relationship  
on the source entity does not have an inverse.  (e.g. you only get  
join tables in fully modeled bi-directional relationships)


Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if you've  
run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the context  
and details of your problem will help us get you answers more quickly.


- Ben

___

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

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

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

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


re: Using Core Data NSManagedObject subclasses outside of a managed object context

2009-08-24 Thread Ben Trumbull
I have objects that I use with core data that were automatically  
generated
for me by xcode and represent entities in my data store. They all  
subclass
NSManagedObject, and do not have instance variables, but instead use  
the
@dynamic setting for their properties, pretty standard. My  
understanding is

that this allows the NSManagedObject superclass to generate the
getters/setters at runtime and store data in it's own, more  
efficient, Core

Data friendly way.


yup

What this means for me, however, is that I can't just call [[Entity  
alloc]

init] and then get/set Entity's properties, because it won't properly
initialize unless it is given a managed object context. I need to be  
able to
use my objects in places that they won't be persisted, as just  
transient
objects, but this prevents that. The only way I know to initialize  
them is

by calling [NSEntityDescription insertNewObjectForEntityForName:name
inManagedObjectContext:managedObjectContext] . But, when creating  
objects

this way, they will be persisted on the next save call.


There's no requirement that you put them in the same  
NSManagedObjectContext that you call save: on.  You can just create a  
second transient MOC.  Alternatively, you can add an in-memory store  
to your NSPersistentStoreCoordinator and assign the newly inserted  
objects to that store with -assignObject:toPersistentStore: and then  
they'll get "saved" to an in memory backing store. This is probably  
easier to manage, and definitely provides more features than the  
second MOC approach.  It does do a touch more work, though.



Just so you know, I'm making a feed reader that has the option to save
selected stories from the feed for later, offline, browsing. I want  
to be
able to download the feed XML and create 'story' objects from that  
without

having to persist every story I fetch.


Regardless of approach, you'll need to copy the transient objects into  
new persistent objects to individually change their nature from  
transient to normal managed objects.


- Ben



___

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

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

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

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


Where to get Frameworks for AVFoundation.framework?

2009-08-24 Thread Agha Khan

Hi:
I am using iPhone OS 3.0 and unable to compile my code because I am  
missing AVFoundation.framework which I needed for sound files. What is  
the name of compatible framework or some work around.


Thanks in advance.

Best regards
Agha Khan
___

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

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

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

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


Re: Where to get Frameworks for AVFoundation.framework?

2009-08-24 Thread David Duncan

On Aug 24, 2009, at 2:44 PM, Agha Khan wrote:


Hi:
I am using iPhone OS 3.0 and unable to compile my code because I am  
missing AVFoundation.framework which I needed for sound files. What  
is the name of compatible framework or some work around.



Your probably looking in the wrong place for the framework. Open up  
your Targets, Get Info, select the General Tab and in the list at the  
bottom of the window press the + button. You should be able to find  
the AVFoundation.framework easily in the list.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


Re: Drawing over a transparent background

2009-08-24 Thread Ron Fleckner


On 25/08/2009, at 6:21 AM, Steve Christensen wrote:


On Aug 23, 2009, at 10:00 PM, Ron Fleckner wrote:


On 24/08/2009, at 2:29 PM, Rob Keniger wrote:


On 24/08/2009, at 9:33 AM, Ron Fleckner wrote:

My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of  
the original drawing in the subview.  I don't want that ghost  
image!


What are you returning for the -isOpaque method of your custom  
view? If your view has any parts that have an alpha less than 1.0  
then you must return NO from this method.


On 24/08/2009, at 2:36 PM, Kyle Sluder wrote:

On Aug 23, 2009, at 4:33 PM, Ron Fleckner > wrote:


My borderless window has a semi-transparent background. When the  
drawing in a subview changes, the background retains a ghost of  
the original drawing in the subview.  I don't want that ghost  
image!


Have you remembered to override -isOpaque to return NO?


Yes, I return NO.  There are four views, each one a subview (built  
in IB) of the one below.  The background is the content view of the  
window with hourHand as a subview, which has minuteHand as a  
subview, which has secondHand as a subview.  To draw, a timer  
callback tells the bottom view to setNeedsDisplay:YES every  
second.  Each 'hand' view then rotates by the correct amount and  
draws it's hand.


1. Are you erasing the view before redrawing the hand?

2. Is there any reason why you couldn't be drawing the entire clock  
(face + hands) in a single view? If it's only being updated once a  
second, it'll still take considerably less than a second to draw it  
all unless you're doing something horribly complicated.


steve



Hi Steve,

I think you are right to suggest drawing it all in one view.  That  
would probably avoid the problem.  The reason I don't is I'm too much  
of a maths dolt to be able to work out the point co-ordinates for each  
of the hand positions.  By giving each hand it's own view, I simply  
draw the hand from the centre to the top of the view, and then rotate  
the view by the required amount.  Of course, each hand needs to be  
rotated by a different amount, so having three different views gives  
me three different graphics contexts to have three different rotations.


But now while writing this, I realize it's possible to rotate each  
hand by using CGContextAddArc(...) and have a different arc for each  
hand.


So, that was a very good suggestion.  It will take me some time to  
implement it and I'm hopeful that it will work.


Thanks very much.

Ron

PS. I was able to work around the ghosting problem, but it involves  
having the central hub/target drawing in it's own view on top of the  
stack and erasing drawing at the beginning of it's -drawRect:   
Curiously, this doesn't erase the hub itself, but all the views  
beneath get wiped.  As this occurs only during window resizing, you  
get a queer floating target graphic by itself until the window stops  
resizing.


PPS.  By erasing the drawing, I'm assuming you mean fill the rect with  
clearColor?  That's what I'm doing.


___

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

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

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

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


Re: Drawing over a transparent background

2009-08-24 Thread Alastair Houghton

On 24 Aug 2009, at 23:36, Ron Fleckner wrote:

I think you are right to suggest drawing it all in one view.  That  
would probably avoid the problem.  The reason I don't is I'm too  
much of a maths dolt to be able to work out the point co-ordinates  
for each of the hand positions.


:-)  You don't need to do that...

 By giving each hand it's own view, I simply draw the hand from the  
centre to the top of the view, and then rotate the view by the  
required amount.


...and that's a *really* heavyweight way to do things.  I'm surprised  
it's causing trouble (it shouldn't, I don't think), but you certainly  
don't need a view per hand anyway.


But now while writing this, I realize it's possible to rotate each  
hand by using CGContextAddArc(...) and have a different arc for each  
hand.


Rather than doing that, just draw them as you are doing now, but use  
NSAffineTransform (or CGAffineTransform) to set up the necessary  
transform yourself for each hand.


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


sortedArrayUsingFunction

2009-08-24 Thread Boyd Collier
The Discussion section in the current documentation for the NSArray  
method sortedArrayUsingFunction: context:
reads "The new array contains references to the receiver’s elements,  
not copies of them."  Nothing is said about incrementing the retain  
count of the objects in the array, which seems reasonable.  However,  
some time ago, I copied and pasted what was in Apple's earlier  
documentation into my code, and it read "The new array contains  
references to the receiver's elements, not copies of them. The retain  
count is incremented for each element in the receiving array." Was the  
second statement, i.e. that the retain count of each element is  
incremented, an error or has the method itself been changed, or am I  
misunderstanding something (always a strong possibility)?


Boyd___

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

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

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

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


Re: Drawing over a transparent background

2009-08-24 Thread Ron Fleckner


On 25/08/2009, at 8:44 AM, Alastair Houghton wrote:


On 24 Aug 2009, at 23:36, Ron Fleckner wrote:

I think you are right to suggest drawing it all in one view.  That  
would probably avoid the problem.  The reason I don't is I'm too  
much of a maths dolt to be able to work out the point co-ordinates  
for each of the hand positions.


:-)  You don't need to do that...

By giving each hand it's own view, I simply draw the hand from the  
centre to the top of the view, and then rotate the view by the  
required amount.


...and that's a *really* heavyweight way to do things.  I'm  
surprised it's causing trouble (it shouldn't, I don't think), but  
you certainly don't need a view per hand anyway.


But now while writing this, I realize it's possible to rotate each  
hand by using CGContextAddArc(...) and have a different arc for  
each hand.


Rather than doing that, just draw them as you are doing now, but use  
NSAffineTransform (or CGAffineTransform) to set up the necessary  
transform yourself for each hand.


Kind regards,

Alastair.


Hmm... better and better. I'll certainly use affine transforms.

For the record, though, I must say that my current approach of having  
several stacked views and rotating each separately doesn't use much  
CPU at all.  The whole point of this exercise, for me, was to have a  
resizable floating clock on my desktop.  It can sit as a small but  
still easy to read thing up in the top right of my screen, or I can  
have it as big as the screen so I can see it from across the room.   
Only when the clock is large does it use 5~6% of CPU, otherwise it's  
about 1%.


Thanks, Alastair, for your suggestions and comments.

Ron
___

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

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

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

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


Re: F-Script 2.0 available

2009-08-24 Thread André Berg

Congrats!

The work you are doing with F-Script is really cool. Through F-Script  
I learned as much about Cocoa than I did by picking up Hillegass' book.
And I also use it today to test short and middle sized concepts before  
building a whole test app. I always liked exploring Imaging stuff with  
it like explained in the wonderful intro tutorials.


Keep it up :)

Cheers!

André


Am 24.08.2009 um 21:53 schrieb Philippe Mougin:


Hi all,

F-Script 2.0 is has been released. It provides a set of open source  
tools for interactive introspection, manipulation and scripting of  
Cocoa objects.
New features include system-wide scripting, dynamic Cocoa class  
creation, 64-bit, garbage collection, and more.


More info: http://www.fscript.org/documentation/WelcomeToFScript2/index.htm
Download: http://www.fscript.org/download/F-Script20090809.zip

Philippe Mougin


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/andre.berg%40email.de

This email sent to andre.b...@email.de


___

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

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

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

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


Re: sortedArrayUsingFunction

2009-08-24 Thread Keary Suska

On Aug 24, 2009, at 4:46 PM, Boyd Collier wrote:

The Discussion section in the current documentation for the NSArray  
method sortedArrayUsingFunction: context:
reads "The new array contains references to the receiver’s elements,  
not copies of them."  Nothing is said about incrementing the retain  
count of the objects in the array, which seems reasonable.  However,  
some time ago, I copied and pasted what was in Apple's earlier  
documentation into my code, and it read "The new array contains  
references to the receiver's elements, not copies of them. The  
retain count is incremented for each element in the receiving  
array." Was the second statement, i.e. that the retain count of each  
element is incremented, an error or has the method itself been  
changed, or am I misunderstanding something (always a strong  
possibility)?



The element objects will be retained by the new array (in addition to  
being retained by the original array). This isn't explicit because it  
is a function of NSArray by definition. Refer to the NSArray API doc  
for this explicitly.


For the sake of accuracy, you should replace every occurrence  
(including in your own brain) of the statement "The retain count is  
incremented" with "A -retain message is sent to". It is possible, and  
not uncommon, that the retain count of an object may never increase or  
decrease, as is the case for singletons. Such an increase or decrease  
should be irrelevant to you in most cases.


HTH,

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

___

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

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

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

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


Re: otest output in xUnit XML format?

2009-08-24 Thread Tommy McLeod
Have a look at this http://osx-ci.blogspot.com ...

I've got cobertura style coverage using scan-build, gcovr, gcov and the unit
testing framework from the google toolbox for mac, however it should work
for otest so long as the unit tests are actually invoked. Turning on the
profiling will enable all of the coverage reporting when the unit tests are
run (as your code is compiled and linked with the -fprofile-arcs switch)

You may need to modify the linking section to point at the libgcov.a that is
relevant for your project (-isysroot is a bit broken, it ignores the SDK you
define and goes for the one in /usr/lib/gcc ... which is a pain when you're
compiling for the iPhone simulator)

hope that helps

2009/8/20 Barry Wark 

> I'm trying to integrate OCUnit unit tests more fully with our
> continuous integration system. Out of the box, Hudson supports test
> output in the xUnit XML format produced by JUnit, CppUnit, nose (a
> python test framework), etc. Is there any way to get otest to produce
> this XML formatted output? If not, can anyone point me towards a tool
> that converts otest output to xUnit XML format?
>
> Thanks!
>
> Barry
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tommy.mcleod%40gmail.com
>
> This email sent to tommy.mcl...@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


[iphone] Rotating UIViews?

2009-08-24 Thread Erg Consultant
Is there a simple way to rotate a UIView without applying a transform? I have a 
single UIViewController and nib file which has one view in landscape 
orientation with a single image in it. When I run my app, the view appears but 
in portrait mode which cuts off the right side of the view. I just want to 
rotate the entire view into landscape orientation programatically.

Thanks,

Erg



  
___

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

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

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

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


Why I have a leak? I am unable to understand

2009-08-24 Thread Agha Khan

HI:

I know the leak is in next 2 lines
I have commented all the code except these 2 lines.

// NSTimeInterval
	NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];
	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |  
NSSecondCalendarUnit;
	NSDateComponents *dateSegments = [gregorian components:unitFlags  
fromDate:[NSDate date]];


I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.

Can someone help me.

Why I have a leak? I am unable to understand?

Thanks in advance.

Agha
___

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

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

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

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


NSTableView and programmatic changing of contextual menu

2009-08-24 Thread Jack Carbaugh
I would like to change the Titles of MenuItems in a contextual menu  
based on the tableview row/cell in which the Right click was initiated.


I've searched several times for various methods to implement this, but  
came up empty. If i were using an imagekit cell, i could use:


- (void) imageBrowser:(IKImageBrowserView *) aBrowser   
cellWasRightClickedAtIndex:(NSUInteger) index withEvent:(NSEvent *)event



does something similar exist for tables? if not, ideas on how to  
sublcass and implement.


Many thanks,

jack
___

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

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

Help/Unsubscribe/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 I have a leak? I am unable to understand

2009-08-24 Thread Nick Zitzmann


On Aug 24, 2009, at 6:20 PM, Agha Khan wrote:


I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.

Can someone help me.


Yes, but you _did_ init it, so you have to release it. Go read the  
rules again.


Nick Zitzmann


___

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

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

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

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


Re: Why I have a leak? I am unable to understand

2009-08-24 Thread Nathan Vander Wilt


On Aug 24, 2009, at 5:20 PM, Agha Khan wrote:


HI:

I know the leak is in next 2 lines
I have commented all the code except these 2 lines.

// NSTimeInterval
	NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];
	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |  
NSSecondCalendarUnit;
	NSDateComponents *dateSegments = [gregorian components:unitFlags  
fromDate:[NSDate date]];


I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.

Can someone help me.

Why I have a leak? I am unable to understand?


From 
http://developer.apple.com/iphone/library/documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmObjectOwnership.html

"You own any object you create.
You “create” an object using a method whose name begins with “alloc”  
or “new” or contains “copy” (for example, alloc,newObject, or  
mutableCopy)."



You created gregorian using [NSCalendar alloc], so you own it. The  
next rule on that page says:


"If you own an object, you are responsible for relinquishing ownership  
when you have finished with it.
You relinquish ownership of an object by sending it a release message  
or an autorelease message (autorelease is discussed in more detail in  
“Delayed Release”). In Cocoa terminology, relinquishing ownership of  
an object is typically referred to as “releasing” an object."


hope this helps,
-natevw

___

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

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

Help/Unsubscribe/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 I have a leak? I am unable to understand

2009-08-24 Thread Luke the Hiesterman
The obligation to release doesn't come from the init - it comes from  
the alloc. This is an important distinction.


Luke

On Aug 24, 2009, at 5:24 PM, Nick Zitzmann wrote:



On Aug 24, 2009, at 6:20 PM, Agha Khan wrote:


I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.

Can someone help me.


Yes, but you _did_ init it, so you have to release it. Go read the  
rules again.


Nick Zitzmann



___

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

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

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

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


Re: Why I have a leak? I am unable to understand

2009-08-24 Thread Hank Heijink (Mailinglists)

On Aug 24, 2009, at 8:20 PM, Agha Khan wrote:


HI:

I know the leak is in next 2 lines
I have commented all the code except these 2 lines.

// NSTimeInterval
	NSCalendar *gregorian = [[NSCalendar alloc]  
initWithCalendarIdentifier:NSGregorianCalendar];
	unsigned unitFlags = NSYearCalendarUnit | NSMonthCalendarUnit |   
NSDayCalendarUnit | NSHourCalendarUnit | NSMinuteCalendarUnit |  
NSSecondCalendarUnit;
	NSDateComponents *dateSegments = [gregorian components:unitFlags  
fromDate:[NSDate date]];


I am not releasing gregorian, because I never used retain.
Same is true with dateSegments.


You'll have to reread the memory management guide.

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

You created gregorian using alloc + init, therefore you own it and you  
do need to release it.


Hank

___

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

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

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

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 5:20 PM, Jack Carbaugh wrote:
> does something similar exist for tables? if not, ideas on how to sublcass
> and implement.

Use -[NSTableView clickedRow] and -clickedColumn.

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


applicationWillTerminate: issue

2009-08-24 Thread Michael de Haan

May I ask the group the following?

In my small application, I save the user's preferences with  
applicationWillTerminate:


The application uses 2 "applicationWillTerminate:", one in the app's  
main class, the other in the app's preference class. What happens is  
that if the preference class is not used ( ie the user makes no  
changes to the preferences) the user's last values are saved in the  
app's main class, in "applicationWillTerminate". If however, the user  
makes a change to any preferences, **only** the pref class  
"applicationWillTerminate:" is called ie the second  
"applicationWillTerminate" is ignored.



So, 2 quick questions.

1) Is what I am seeing expected behavior or am I doing something wrong.

2) Although not strictly speaking a cocoa question, would better  
design be to collect all "values/properties" to be saved in one  
location, thus avoiding the problem I am having?


Apologize if this is in the documentation or CocoaBuilder...I was not  
able to find anything.


Thanks in advance.
___

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

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

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

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


Re: NSTableView and programmatic changing of contextual menu

2009-08-24 Thread Jack Carbaugh
I understand that clickedRow will give me the proper data that I want  
to use ...


My question is how do i change the contextual menu when the user right  
clicks.



On Aug 24, 2009, at 8:28 PM, Kyle Sluder wrote:

On Mon, Aug 24, 2009 at 5:20 PM, Jack Carbaugh  
wrote:
does something similar exist for tables? if not, ideas on how to  
sublcass

and implement.


Use -[NSTableView clickedRow] and -clickedColumn.

--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: applicationWillTerminate: issue

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 5:33 PM, Michael de Haan wrote:
> 1) Is what I am seeing expected behavior or am I doing something wrong.

You're going to have to post your code.

-applicationWillTerminate: doesn't magically get called.
NSApplication posts this notification to the default notification
center.  NSApplication also automatically signs its delegate up for
this notification.

So at some point your "preference class" (whatever that means) is
signing up for the application will terminate notification.  Does it
do this by making itself the app delegate?  If so, then that would be
why your "other" implementation of -applicationWillTerminate: doesn't
get called.

> 2) Although not strictly speaking a cocoa question, would better design be
> to collect all "values/properties" to be saved in one location, thus
> avoiding the problem I am having?

You should be saving your preferences immediately, as soon as they are
changed in the UI.  You should not be waiting for your app to quit.

--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: NSTableView and programmatic changing of contextual menu

2009-08-24 Thread Kyle Sluder
On Mon, Aug 24, 2009 at 5:39 PM, Jack Carbaugh wrote:
> My question is how do i change the contextual menu when the user right
> clicks.

Override -menuForEvent:.

--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: Drawing over a transparent background

2009-08-24 Thread Graham Cox


On 25/08/2009, at 8:36 AM, Ron Fleckner wrote:

I think you are right to suggest drawing it all in one view.  That  
would probably avoid the problem.  The reason I don't is I'm too  
much of a maths dolt to be able to work out the point co-ordinates  
for each of the hand positions.


Hi Ron,

Others have addressed different ways to handle this using  
NSAffineTransform, which is a good idea.


But the maths isn't hard, it's just a polar to Cartesian conversion:

endPoint.x = centrePoint.x + cos( angle ) * lengthOfHand;
endPoint.y = centrePoint.y + sin( angle ) * lengthOfHand;

If you visualise the hand as forming a right-angled triangle where the  
hypotenuse is the hand itself, the x axis goes through the centre and  
the y axis is a vertical line drawn from the tip if the hand to cut  
the x axis, this bit of trigonometry should be fairly obvious. This is  
what NSAffineTransform does internally. The advantage of using a  
transform is that you can apply it to a complete path of arbitrary  
shape, which is much more useful than just calculating where the end  
point would be. But I think it's useful to know a bit of the maths  
behind it so that it doesn't seem like "magic".


In code, the angle needs to be in radians. If you calculate in degrees  
(simpler for a clock probably) degrees to radians is:


#define DEGREES_TO_RADIANS( d ) ((d) * 0.0174532925199432958)





--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: applicationWillTerminate: issue

2009-08-24 Thread Graham Cox


On 25/08/2009, at 10:33 AM, Michael de Haan wrote:


So, 2 quick questions.

1) Is what I am seeing expected behavior or am I doing something  
wrong.


2) Although not strictly speaking a cocoa question, would better  
design be to collect all "values/properties" to be saved in one  
location, thus avoiding the problem I am having?



I'd suggest you should decentralise your preferences handling, or at  
least, use NSUserDefaults, which centralises them for you. In the bad  
old days, the classic model was to load all your prefs at start up and  
save them all at quit, but really it's easier just to get/set each  
preference at its point of use. You can do that easily using  
[NSUserDefaults standardUserDefaults]. Then this problem simply goes  
away as well as keeping your code nice and compartmentalized and even  
reusable despite having persistent state.


But if for some reason you have to get notified of a terminate, the - 
applicationWillTerminate: is sent to the application's delegate, so if  
you have one that implements the method it will be called. Otherwise  
you have to specifically subscribe to the notification using the  
NotificationCenter.


--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: Syntax Coloring?

2009-08-24 Thread Keitaroh Kobayashi
On Sun, Aug 23, 2009 at 9:32 PM, BareFeet wrote:

> Hi Keita,
>
>  Hello, I'm writing a code editor and so far, i've been using Flex for
>> regex-matching the whole document every time the text is changed and
>> coloring appropriately...
>>
>
> How are you doing this? How did you incorporate Flex or regex-matching?
>

It's terribly inefficient... Each time the text is modified, the whole text
is sent into flex, which parses it into tokens (strings, comments, etc), and
I colorize depending on what kind of token it is... I guess it's a little
hard to describe.

Anyways, I was thinking I could keep the basic flex part, and apply it only
to the changed portions of the text. The problem with that is that I would
have to check for quotes and record what's inside the quote from where the
person started typing... But then that runs into the problem of somebody
just putting their text cursor randomly in a string, etc etc.
___

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

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

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

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


Re: authorization services

2009-08-24 Thread Rick C.
ok thank you both it's most helpful!

rick






From: Jean-Daniel Dupas 
To: Rick C. 
Cc: cocoa dev 
Sent: Tuesday, August 25, 2009 1:35:45 AM
Subject: Re: authorization services


Le 24 août 2009 à 18:35, Kyle Sluder a écrit :

> On Mon, Aug 24, 2009 at 6:10 AM, Rick C. wrote:
>> if i can follow up please about authorization services i just want to be 
>> sure i'm on the right track.  if i'm just trying to do a simple movePath but 
>> i don't have access is the only way to get access by using 
>> authorizationExecuteWithPrivileges?  i keep reading about how i should avoid 
>> it if possible.  i have followed authorizing in a simple self-restricted 
>> application according to the docs but i don't really see what i can do after 
>> i get authorization...maybe i'm missing something?  i guess i'm just looking 
>> for confirmation if i must use authorizationExecuteWithPrivileges or not, 
>> and if so can i control the timeout because the docs seem to say it needs 
>> authentication every time.  thanks again for the help and patience,
> 
> Yes, AEWP is what you'll need.  You factor out your "move the file"
> code into a helper tool and execute that with AEWP.
> 
> Much of the advice about avoiding AEWP is to steer people away from
> needlessly elevating their own privileges, and when they do need to do
> so ensuring that they take the time to read and understand the sample
> code.

You can also ask to the Finder to do it using AppleEvent. The Finder will ask 
the user its password if needed and will take care of the hard part for you.



___

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

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

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

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


Help needed with ConvertCocoa64 script

2009-08-24 Thread Graham Cox

Trying to run the ConvertCocoa64 script.

/Developer/Extras/64BitConversion/ConvertCocoa64 'find . -name '*. 
[hm]' | xargs'


this comes up 'no match'

yet if I run the find command directly on the current directory:

find . -name '*.[hm]' | xargs

it lists all my source files as expected.

What gives?

--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: Drawing over a transparent background

2009-08-24 Thread Ron Fleckner


On 25/08/2009, at 10:56 AM, Graham Cox wrote:



On 25/08/2009, at 8:36 AM, Ron Fleckner wrote:

I think you are right to suggest drawing it all in one view.  That  
would probably avoid the problem.  The reason I don't is I'm too  
much of a maths dolt to be able to work out the point co-ordinates  
for each of the hand positions.


Hi Ron,

Others have addressed different ways to handle this using  
NSAffineTransform, which is a good idea.


But the maths isn't hard, it's just a polar to Cartesian conversion:

endPoint.x = centrePoint.x + cos( angle ) * lengthOfHand;
endPoint.y = centrePoint.y + sin( angle ) * lengthOfHand;

If you visualise the hand as forming a right-angled triangle where  
the hypotenuse is the hand itself, the x axis goes through the  
centre and the y axis is a vertical line drawn from the tip if the  
hand to cut the x axis, this bit of trigonometry should be fairly  
obvious. This is what NSAffineTransform does internally. The  
advantage of using a transform is that you can apply it to a  
complete path of arbitrary shape, which is much more useful than  
just calculating where the end point would be. But I think it's  
useful to know a bit of the maths behind it so that it doesn't seem  
like "magic".


In code, the angle needs to be in radians. If you calculate in  
degrees (simpler for a clock probably) degrees to radians is:


#define DEGREES_TO_RADIANS( d ) ((d) * 0.0174532925199432958)





--Graham


Thanks, Graham

Your explanation and the 'cos(angle)', 'sin(angle)' bits are a little  
opaque to me at first reading, but my daughter's doing more advanced  
maths at school than I ever did, so I've got someone to help me with  
this.  Having those code snippets will make it much easiser, and  
perhaps useful for me in the future.


Ron

___

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

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

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

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


Re: Help needed with ConvertCocoa64 script

2009-08-24 Thread Andrew Farmer

On 24 Aug 2009, at 19:17, Graham Cox wrote:

Trying to run the ConvertCocoa64 script.

/Developer/Extras/64BitConversion/ConvertCocoa64 'find . -name '*. 
[hm]' | xargs'


this comes up 'no match'


Try this:

find . -name '*.[hm]' | xargs /Developer/Extras/64BitConversion/ 
ConvertCocoa64

___

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

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

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

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


What's the purpose of the "fax" received action?

2009-08-24 Thread Behrang Saeedzadeh
Hi all,

What's the purpose of the "fax" received action in NSTableView and is it
documented somewhere at all? Did a quick search
and couldn't find its documentation.

Best regards,
Behrang Saeedzadeh
---
http://my.opera.com/behrangsa
http://twitter.com/behrangsa
___

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

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

Help/Unsubscribe/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 needed with ConvertCocoa64 script

2009-08-24 Thread Graham Cox

Sorted - Thankyou!

Why don't they just state that in the docs, instead of assuming we're  
all command-line jocks? Or is it a shell difference thing?



--Graham


On 25/08/2009, at 12:31 PM, Andrew Farmer wrote:


On 24 Aug 2009, at 19:17, Graham Cox wrote:

Trying to run the ConvertCocoa64 script.

/Developer/Extras/64BitConversion/ConvertCocoa64 'find . -name '*. 
[hm]' | xargs'


this comes up 'no match'


Try this:

find . -name '*.[hm]' | xargs /Developer/Extras/64BitConversion/ 
ConvertCocoa64


___

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

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

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

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


Drawing text into a UiView

2009-08-24 Thread J J

Hi, 

I'm trying to write an app that will page through text .. I'm trying to grab 
the text, find out how much with fit on a page, write the text to a view 
(page), then perhaps paginate the pages around it onto other views to be ready 
as needed.
Anyone have any ideas on how this would work ?  I'm having a hard time finding 
examples of writing text to a view directlyI'd love to do it via UIWebView, but 
not sure how I would know how big one page would be
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: Syntax Coloring?

2009-08-24 Thread Behrang Saeedzadeh
Hi there,
Somebody has written a complete thesis about this and other common tasks
required
for developing IDEs:
twagner-lexing.pdf
.

In
short, after parsing each token a lexer will be in one of the states of its
automaton.
You have to record these states and whenever the text is modified, you have
to go back
only as many characters as necessary to arrive at a token where it is known
that which
state the lexer's been in after parsing that token. You reset the lexer to
that state and
continue lexing the rest of the document, if I remember correctly, I think
till you arrive at a token where the
lexer's new state is equal to its old state and then you stop lexing the
rest of the document.


Cheers,
Behrang Saeedzadeh
---
http://my.opera.com/behrangsa
http://twitter.com/behrangsa


On Sat, Aug 22, 2009 at 10:33 PM, Keitaroh Kobayashi wrote:

> Hello, I'm writing a code editor and so far, i've been using Flex for
> regex-matching the whole document every time the text is changed and
> coloring appropriately... I got this idea from some CocoaBuilders or
> CocoaDev forum/mailing list awhile ago, but it's terribly inefficient and
> slow, especially with large documents.
> Just wondering if you guys have any suggestions in the direction I should
> go
> in... I just found NSPredicate, but I'm not sure if I should use it...
>
> Anyways, any suggestions are greatly appreciated,
> Keita
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/behrangsa%40gmail.com
>
> This email sent to behran...@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


Adding Segmented Buttons to Toolbar.

2009-08-24 Thread Philip Juel Borges

Hi.

Does any one know how to add segmented cell buttons to a toolbar in  
Interface builder? Like the ones in Mail and the back and forward  
buttons in Safari.


I've searched high and low in the mailing list+google and must admit  
that I haven't gotten anywhere close.


/Philip
___

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

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

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

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


Re: Confusion about custom UITableViewCell

2009-08-24 Thread Phillip Porch


I'm trying to make a custom UITableViewCell, but the way I'm doing  
it, all the drawing of the table seems to be screwed up. The view  
seems to be working in some sense, because I can see the data, but  
only one row at the bottom can be seen and things are generally  
screwed up when scrolling. This is what I'm doing:


1) Create new Navigation based app.
2) Add a Table View Cell to the RootViewController.xib
3) Edit the TableViewCell in IB, add some Labels onto it.
4) Connect TableViewCell and Labels to outlets in RootViewController.h
5) modify tableView:cellForRowAtIndexPath: so that it sets data in  
the UILabels and returns the TableViewCell from the Nib outlet.


Is there some reason this shouldn't work?


I found the following quicktime video to be useful:

http://pragmaticstudio.com/screencasts/5-custom-table-cells-in-interface-builder





___

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

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

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

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


Re: Adding Segmented Buttons to Toolbar.

2009-08-24 Thread Rob Keniger


On 25/08/2009, at 2:09 AM, Philip Juel Borges wrote:

Does any one know how to add segmented cell buttons to a toolbar in  
Interface builder? Like the ones in Mail and the back and forward  
buttons in Safari.


I've searched high and low in the mailing list+google and must admit  
that I haven't gotten anywhere close.



Just drag one into the toolbar in Interface Builder. No magic.

--
Rob Keniger



___

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

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

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

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


Re: applicationWillTerminate: issue

2009-08-24 Thread Michael de Haan

Hi Kyle,
FIrstly, thanks for this insight.



You should be saving your preferences immediately, as soon as they are
changed in the UI.  You should not be waiting for your app to quit.



That makes much more sense, and solves problem 1.

But, just so that I understand your other explanation,



1) Is what I am seeing expected behavior or am I doing something  
wrong.


You're going to have to post your code.





-applicationWillTerminate: doesn't magically get called.
NSApplication posts this notification to the default notification
center.  NSApplication also automatically signs its delegate up for
this notification.

So at some point your "preference class" (whatever that means) is
signing up for the application will terminate notification.  Does it
do this by making itself the app delegate?  If so, then that would be
why your "other" implementation of -applicationWillTerminate: doesn't
get called.


Kyle, from the "Cocoa Fundamentals Guide":   "Although you can  
dynamically change the delegate, only one object can be a delegate at  
a time. Thus if you want multiple objects to be informed of a  
particular program event at the same time, you cannot use delegation."


So, if I understand you and the documentation correctly , even though  
I had implemented the delegate of NSApplication in **both** of my  
classes, **only** one of those classes will respond to  
"applicationWillTerminate:" at a time. If this is indeed correct, then  
I need to rethink the design of my application, and you have already  
suggested how to do this.



Michael.
___

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

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

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

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


need help about the touch event

2009-08-24 Thread Gill Bates

Hi All,

currently we have three kinds of touch event:
- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesBegan"); }
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesMoved"); }
- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event  
{ NSLog(@"touchesEnded"); }

what if I want to detect the time once user pressed at a specific icon.
In particular, I want to implement some feature like iphone on the  
homescreen, when the user pressed an icon for 2 seconds, the system  
would show something.

So anyone has an idea for this?
thx in advance.
Ramon.

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: Syntax Coloring?

2009-08-24 Thread Rob Keniger


On 25/08/2009, at 11:36 AM, Keitaroh Kobayashi wrote:

Anyways, I was thinking I could keep the basic flex part, and apply  
it only
to the changed portions of the text. The problem with that is that I  
would
have to check for quotes and record what's inside the quote from  
where the
person started typing... But then that runs into the problem of  
somebody

just putting their text cursor randomly in a string, etc etc.



You could always look at Uli Kusterer's UKSyntaxColoredTextDocument  
class:


http://zathras.de/angelweb/sourcecode.htm#UKSyntaxColoredTextDocument

It's pretty comprehensive and performance is good. It's free for non- 
commercial projects.


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


NSTableView stops updating.....

2009-08-24 Thread tarek

Hi Everyone,

I have a NSTableView that stops updating randomly. I have a separate  
thread that I use to all the hard work. I get there using  
performSelectorInBackground:withObject:. From that thread I call  
[tableView reloadData]. Like I said, it can work for hours or it will  
work for 10 seconds but there is no rhyme or reason for stopping that  
I can see.


If you scroll up with the knob it refreshes. I you click a row it  
refreshes. But leaving it alone, it eventually stop updating itself.


Any ideas? Thank for the help...

T
___

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

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

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

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


undo and NSTextField

2009-08-24 Thread John Kassebaum
I have an app that has many arrays of inter-related items shown in  
NSTableView and using NSArrayControllers.  This is not a Core Data  
app.  Today, I added an NSTextField to the window (and not in any  
table), and set the NSTextField as editable.  The problem is that undo  
no longer works for any field I edit in any of the NSTableViews, nor  
for creating new items in these tables.  If I make the NSTextField not- 
editable, then undo functionality returns.  Why would this be happening?


-John
___

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

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

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

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


Re: NSTableView stops updating.....

2009-08-24 Thread Graham Cox


On 25/08/2009, at 4:14 AM, tarek wrote:


From that thread I call [tableView reloadData]



Try calling this on the main thread. I think reloadData marks the  
table view as needing display, and that should be done on the main  
thread.


[tableView performSelectorOnMainThread:@selector(reloadData)  
withObject:nil waitUntilDone:NO];


--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: NSTableView stops updating.....

2009-08-24 Thread Joar Wingfors


On 24 aug 2009, at 21.00, Graham Cox wrote:


From that thread I call [tableView reloadData]


Try calling this on the main thread. I think reloadData marks the  
table view as needing display, and that should be done on the main  
thread.


[tableView performSelectorOnMainThread:@selector(reloadData)  
withObject:nil waitUntilDone:NO];



Not only that, it seems very dangerous, if not outright unsafe, to  
update the data source for the table view directly from a background  
thread. Read more here:


	


Don't miss the Cocoa thread safety summary at the end.

j o a r


___

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

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

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

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