Re: NSArrayController - compound values vs Select Inserted Objects

2009-08-17 Thread Jonathan del Strother
On Thu, Aug 13, 2009 at 12:11 PM, Jonathan del
Strother wrote:
> Heya,
> I'm struggling a bit with an NSArrayController with content bound to
> NSUserDefaultsController.
>
> The NSArrayController manages dictionaries, and so it appears that I
> need to select 'Handles Content as Compound Value'.  Without this,
> changes made to the array through an NSTableView don't seem to persist
> (for reasons slightly beyond me).
>
> However, I'd like it to auto-select newly added items.  I've ticked
> 'Select Inserted Objects', but it has no effect.  When I untick the
> Compound Value checkbox, 'Select Inserted Objects' starts working
> again.
>
> Is this a bug, or am I misunderstanding something somewhere?
>
> -Jonathan
>

No comments?
___

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

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

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

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


Re: Printing Multiple-Pages Issue

2009-08-17 Thread Alastair Houghton

On 17 Aug 2009, at 06:39, Renzil D'Souza wrote:

So if I print a really large view, it will print on multiple pages -  
is this

what is meant by 'Collated' ?


No.  Collated means that if you print several copies of a given  
document, the pages will come out like this:


  1, 2, 3, 4, 5, ..., 1, 2, 3, 4, 5, ..., 1, 2, 3, 4, 5, ...

rather than like this

  1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 5, 5,  
5, 5, 5, ...


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: iPhone: detect if docked?

2009-08-17 Thread Eric E. Dolecki
I want to disable the sleep timer, so any charging I'll do that, if  
not I will restore the sleep timer


Thanks,
E.

On Aug 17, 2009, at 12:33 AM, David Duncan   
wrote:


More than likely yes. But I'm not certain you can use the EA  
framework to detect such a situation anyway (if someone knows for  
certain I'm happy to be wrong here). And in absence of further data  
as to the nature of the power source, it would be difficult for a  
developer to recognize this situation.


Caveat implementor.

On Aug 15, 2009, at 2:19 PM, Jack Carbaugh wrote:

ah but wouldn't this be a FAIL if say, the user was using a battery  
extender for a quick recharge ?


On Aug 15, 2009, at 3:40 AM, David Duncan wrote:


On Aug 14, 2009, at 4:29 AM, Sean Kline wrote:


Is another option to use the External Accessory framework?


I don't think so. A simple charger may not appear as any kind of  
accessory at all (consider the wall-outlet charger) so EA wouldn't  
track it. If you want to know if the device is on external power  
(which in this particular case would likely be a false positive on  
one of those external battery packs) then you want to know if the  
battery status is "charging".


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

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


looking for System APIs for load monitoring

2009-08-17 Thread Marc Lohse
I am developing an application that needs to monitor the system's
CPU and IO load while it's running to be able to identify a low
system load and only do it's resource-hungry work while the system
is not busy doing other things. I've been searching for the low-level
system API that would give me access to this kind of information but
i have not yet found exactly what i need - functions like
host_processor_info supply the overall CPU usage which is nice, but i need
to know the CPU usage of each individual process. The kind of information i
need is essentially what's supplied by the ps -axv command. But i don't want
to solve my problem by calling ps as an external task - i am sure there is
a more elegant way to get the info directly. Could anybody help me by
pointing me to some source of documentation (maybe i am stupid or looking in
the wrong place but i did not find the info in the documentation supplied
with Xcode) and/or maybe some code examples.

thanks a lot

P.S.: My apologies if this question is not exactly Cocoa-related...

___

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

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

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

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


Re: looking for System APIs for load monitoring

2009-08-17 Thread Dave Keck
> P.S.: My apologies if this question is not exactly Cocoa-related...

You're probably better off taking this to darwin-dev. There was also a
discussion related to this a few weeks ago on darwin-kernel:

http://lists.apple.com/archives/darwin-kernel/2009/Jul/msg00080.html
___

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

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

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

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


Re: looking for System APIs for load monitoring

2009-08-17 Thread Mike Abdullah
If you can design to its paradigm, NSOperationQueue is almost exactly  
what you want. By default it will dynamically adjust the number of  
running operations to match the system load. Also, read up on Grand  
Central Dispatch which is coming in Snow Leopard.


Mike.

On 17 Aug 2009, at 12:13, Marc Lohse wrote:


I am developing an application that needs to monitor the system's
CPU and IO load while it's running to be able to identify a low
system load and only do it's resource-hungry work while the system
is not busy doing other things. I've been searching for the low-level
system API that would give me access to this kind of information but
i have not yet found exactly what i need - functions like
host_processor_info supply the overall CPU usage which is nice, but  
i need
to know the CPU usage of each individual process. The kind of  
information i
need is essentially what's supplied by the ps -axv command. But i  
don't want
to solve my problem by calling ps as an external task - i am sure  
there is

a more elegant way to get the info directly. Could anybody help me by
pointing me to some source of documentation (maybe i am stupid or  
looking in
the wrong place but i did not find the info in the documentation  
supplied

with Xcode) and/or maybe some code examples.

thanks a lot

P.S.: My apologies if this question is not exactly Cocoa-related...

___

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

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

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

This email sent to cocoa...@mikeabdullah.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


[SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Graham Cox


On 17/08/2009, at 10:21 AM, Graham Cox wrote:


I have an outline view using source list style.

When I right-click on the view, the item under the mouse highlights  
with a blue outline independent of the current selection. This gives  
the impression that the menu command applies to that item, not the  
real selected item. In my case my menu commands pertain to the list  
as a whole, and therefore the current normal selection, so I'd like  
to turn off this additional highlight.


How? I couldn't find any means to do this, using a delegate method  
or otherwise.



I solved this initially by going right back to basics and overriding  
the -rightMouseDown: method, and just handling the menu there. There  
is presently no public method of NSTableView/NSOutlineView that is  
exposed for specifically dealing with the standard item highlighting  
for the menu.


There is a curiosity here though. I did this, which is fine for what I  
wanted:


- (void)rightMouseDown:(NSEvent*) event
{
NSMenu* menu = [self menu];
if( menu )
[NSMenu popUpContextMenu:menu withEvent:event forView:self];
}


But if I do this, which appears to be more correct:

- (void)rightMouseDown:(NSEvent*) event
{
NSMenu* menu = [self menuForEvent:event];
if( menu )
[NSMenu popUpContextMenu:menu withEvent:event forView:self];
}


...then I get the highlight back again! This indicates that the  
NSOutlineView's implementation of this highlight is being done in a  
dubiously skanky way, drawing directly as part of the -menuForEvent:  
method, rather than flagging the menu tracking and drawing as part of  
the standard drawing mechanism. So, to prove that, I ended up doing  
this:


- (NSMenu*) menuForEvent:(NSEvent*) event
{
#pragma unused(event)
return [self menu];
}

...which also gives the desired result, suppressing the highlight. It  
means that one surprising side-effect of returning a menu in - 
menuForEvent: built in code will be that if you want the standard row  
highlight, you won't get it without invoking super, even if you don't  
want super's menu.


It seems strange to me that this method is doing highlighting duty  
when all it's meant for is to return a property.


Bugs will be filed...

--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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread I. Savant

On Aug 17, 2009, at 7:49 AM, Graham Cox wrote:

This indicates that the NSOutlineView's implementation of this  
highlight is being done in a dubiously skanky way


  Unfortunately this can describe numerous parts of NSTableView &  
NSOutlineView. Not a knock against the engineers, but this is one  
critical group of view classes that could really use some attention in  
future cats. They're a frequent source of frustration when  
customization is needed.


  Yes, I practice what I preach - I've filed requests over the  
years. :-)


--
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: observeValueForKeyPath returns null in the change directory???

2009-08-17 Thread Sean McBride
On 8/15/09 3:18 PM, Sandro Noel said:

>I do successfully receive the notification for my key path.
>but the change directory only returns null values for the old and the
>new values, I do not know what i'm doing wrong.



"The change dictionary doesn't contain old and new values. This is not
your fault, it's due to a bug in the controller. This bug will not be
fixed in the forseeable future."

This bug has been there since 10.3.  I wish the documentation mentioned this.

--

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: initWithCoder but I do not have nib file

2009-08-17 Thread Scott Ribe
I think what you want to do is override +buttonWithType in your CustomButton
class, but it's not entirely clear from your message.

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


___

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

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

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

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


Re: Printing Multiple-Pages Issue

2009-08-17 Thread Jeffrey Oleander
> On Mon, 2009/08/17, Renzil D'Souza  wrote:
> From: Renzil D'Souza 
> Subject: Re: Printing Multiple-Pages Issue
> To: "Graham Cox" 
> Cc: cocoa-dev@lists.apple.com
> Date: Monday, 2009 August 17, 12:39 AM
> 
> No, I want control over how many pages I'm dividing my
> view into, and precisely how I divide my image into
> those pages. I'm writing a function for someone to
> print N images from 1 large image, and the user of
> the function may want to supply the ratios at which to
> divide the image (vertically only). I found out what
> my problem was - in my call to CGContextDrawImage(),
> I was passing the CGRect I used to get the sub-image
> which was wrong. That, combined with some
> transformation stuff in my code, messed it up.
> 
> So if I print a really large view, it will print on
> multiple pages - is this what is meant by 'Collated'?
> 
> Thanks,
> Renzil


>> 2009/08/17 Graham Cox 
>>> On 2009/08/17, at 03:56, Renzil D'Souza wrote:
>>>  I'm trying to print a really large image into
>>> 'N' pages. So I over-rode 'knowsPageRange' and
>>> 'rectForPage'.

>> If you're simply trying to tile a large view
>> over 'n' pages, you don't need to do this -
>> that's what it will do by default with no
>> intervention on your part. Try that first and
>> see if it does what you want.
>> --Graham

I think Graham is correct.  Try it without any
over-riding, first.

I tend to think of what you describe as dividing
the page into tiles, with some tile size (usually
the same as the page size), and the amount or 
percentage of over-lap.  (And then you need to 
decide whether the user should designate the 
amount of overlap in millimeters or inches or 
pixels and which of these Cocoa expects.)  And
then you'd probably have to give it multiple 
rectForPage
for each page you want to be tiled, one for 
each tile.

I have not done this with Cocoa, so am only 
describing how I think of it in hopes of 
providing some insight and possible terms 
on which to search.

Collating has to do with the order in which the 
separate tiles and pages of a document are printed.
If you tell it to print it 3 times, page n will
precede page n+1, and each copy will be "together".
What order is proper for tiles is up to you, since
I know of no widely accepted conventions.



___

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

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

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

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


Re: Trying to track down error in NSPersistentDocument when saving

2009-08-17 Thread Sean McBride
On 8/16/09 9:47 PM, Gideon King said:

>Cool - haven't used conditional breakpoints before, and didn't realize
>about objc_exception_throw...

Then you probably don't know about the ".gdbinit" file either (google
it), it's quite handy.  Mine contains the following, which I suggest you
add to yours:

fb objc_assign_global_error
fb objc_assign_ivar_error
fb objc_exception_during_finalize_error
fb objc_exception_throw
fb szone_error
fb malloc_error_break
fb auto_zone_resurrection_error
fb auto_zone_thread_registration_error
fb auto_refcount_underflow_error
fb _NSLockError
fb -[_NSZombie release]
fb handleFailureInMethod:object:file:lineNumber:description:
fb handleFailureInFunction:file:lineNumber:description:
fb _NSAutoreleaseNoPool

--

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: observeValueForKeyPath returns null in the change directory???

2009-08-17 Thread Kyle Sluder
On Mon, Aug 17, 2009 at 9:20 AM, Sean McBride wrote:
> This bug has been there since 10.3.  I wish the documentation mentioned this.

http://developer.apple.com/releasenotes/Cocoa/AppKitOlderNotes.html#X10_3Notes

"NSControllers ignore the options that can be passed to the
-addObserver:forKeyPath:options:context:context: method. So even if
you register observers with the NSKeyValueObservingOptionNew or
NSKeyValueObservingOptionOld options, you will not receive the values
in the change dictionary of the
-observeValueForKeyPath:ofObject:change:context: calls. This is
usually not a problem, but if you rely on receiving those values, a
workaround may be to observe the model objects directly."

Like I said, incredibly frustrating.  Also poorly documented.  And no
explanation is given.

--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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Corbin Dunn



...then I get the highlight back again! This indicates that the  
NSOutlineView's implementation of this highlight is being done in a  
dubiously skanky way, drawing directly as part of the -menuForEvent:  
method, rather than flagging the menu tracking and drawing as part  
of the standard drawing mechanism. So, to prove that, I ended up  
doing this:


- (NSMenu*) menuForEvent:(NSEvent*) event
{
#pragma unused(event)
return [self menu];
}


Ah! sorry for the confusion this has caused, but it is clearly  
documented. Here are the release notes for Leopard:


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

Copied below is the pertinent information:


NSTableView/NSOutlineView - Contextual menu support

NSTableView and NSOutlineView now have better contextual menu  
support. Please see the DragNDropOutlineView demo application for an  
example of how to properly do contextual menus with a TableView.


The key thing to note is that clickedRow and clickedColumn will now  
both be valid when a contextual menu is popped up. In addition, one  
can dynamically set the popup menu for a particular cell/column in  
the delegate method willDisplayCell:. NSTableView handles this by  
properly overriding menuForEvent:, setting the clickedRow/ 
clickedColumn, and calling [NSCell menuForEvent:inRect:ofView] to  
find the correct menu. If no menu was returned, the menu for the  
NSTableView will be used. If one right clicks on a selection of  
items, all the items are highlighted. One should check to see if  
clickedRow is one of the selected rows, and if it is then do the  
menu operation on all the selected rows. The clickedRow and  
clickedColumn properties will still be valid when the action is sent  
from the NSMenuItem.



Unfortunately, you may have stumbled upon one deficiency; there is no  
way to have the menu apply for the table as a whole. As you  
discovered, the way to fix this is to override -menuForEvent:.




...which also gives the desired result, suppressing the highlight.  
It means that one surprising side-effect of returning a menu in - 
menuForEvent: built in code will be that if you want the standard  
row highlight, you won't get it without invoking super, even if you  
don't want super's menu.


It seems strange to me that this method is doing highlighting duty  
when all it's meant for is to return a property.


To me, it doesn't seem strange. It is AppKit that displays the menu,  
and it allows a consistent user interface to be used throughout, and  
we wanted to work easily and without trouble to the developer.


I'm open to suggestions and ways on improving things -- please do log  
bugs and/or enhancement requests, and ways you would expect the  
highlighting to work but does not.


thanks,
corbin

___

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

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

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

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


Re: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Corbin Dunn


On Aug 17, 2009, at 6:24 AM, I. Savant wrote:


On Aug 17, 2009, at 7:49 AM, Graham Cox wrote:

This indicates that the NSOutlineView's implementation of this  
highlight is being done in a dubiously skanky way


 Unfortunately this can describe numerous parts of NSTableView &  
NSOutlineView. Not a knock against the engineers, but this is one  
critical group of view classes that could really use some attention  
in future cats. They're a frequent source of frustration when  
customization is needed.




Hopefully customization has become easier, and frequently less  
required (ie: the "source list" highlighting style, proper drag and  
drop feedback, etc). Do you have specific examples of things that are  
difficult to do which should be easier?  I'm interested in knowing  
what is difficult to customize, or work with.


Graham definitely ran into one thing that should be easier (in recap:  
how to make the contextual menu apply to the entire table, and not  
just the selection -- I'll look forward to seeing the bug that was  
logged).


corbin

___

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

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

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

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


Notification for launch of root daemon process?

2009-08-17 Thread Dave DeLong

Hi everyone,

Is there some notification that's posted by the OS when a root daemon  
process is launched?  Here's what I've tried:


1.  Carbon Events - I tried creating a CarbonEventHandler to listen  
for kEventAppLaunched, but I did not observe any events come through  
after running backupd.  It would appear (and the documentation seems  
to confirm this) that these notifications are posted only for  
processes that interact with the WindowServer.


2.  Distributed Notifications - I found that the root daemon I'm  
trying to observe posts distributed notifications as it launches and  
exits, but I've also found that these notifications are not reliable  
and are sometimes dropped.


3.  Polling attempt 1 - I created a timer that executes "ps aux" as an  
NSTask and searches the results for the name of the daemon.  This  
works, but involves creating another process and searching through a  
string every time I need to find if the daemon is running (which is  
every couple seconds).


4.  Polling attempt 2 - Again, I created a timer, but this time I used  
the GetBSDProcessList function (defined here: http://developer.apple.com/qa/qa2001/qa1123.html 
 ).  This also works and is *significantly* faster than creating an  
NSTask to run "ps", but it still requires me to poll.  In addition, I  
still have to search through the entire process structure looking for  
the correct process name.  However, since I don't have anything better  
right now, this is what I'm currently using.


Is there a better way I could be doing this?

Thanks,

Dave
___

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

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

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

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


Audio CD Subchannel Info

2009-08-17 Thread bryscomat
Hey everyone, is there any way to tell if an audio track on a CD  
contains CDG subchannel info? Currently, I am using a the following  
code to read the subchannel info:


dk_cd_read_tcd_read;

unsigned char *buffer = (unsigned char*)malloc(capacity);
memset(&cd_read, 0, sizeof(cd_read));

cd_read.offset  = offset;
cd_read.sectorArea  = 0xf8 + kCDSectorAreaSubChannel;
cd_read.sectorType  = kCDSectorTypeUnknown;
cd_read.buffer  = buffer;
cd_read.bufferLength= capacity;

[self openDevice];
if ( ioctl(self.fileDescriptor, DKIOCCDREAD, &cd_read) == -1 )
{
NSLog(@"Failed to read subchannel");
NSLog(@"Error: %d",errno);
free( buffer );
[self closeDevice];
return NO;
}
[self closeDevice];

It works great. Now I am wanting to create a loop to read only 1024  
sectors at a time so that the UI can update in response to the time  
left. I don't want the loop to begin if there's no subchannel info as  
the ioctl call will fail an arbitrary number of times. Also, I'd like  
to test all the tracks on CD insertion to indicate if subchannel info  
is available. Is there another way to do this?

___

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

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

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

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


Re: Notification for launch of root daemon process?

2009-08-17 Thread Todd Heberlein
Is there some notification that's posted by the OS when a root  
daemon process is launched?  Here's what I've tried:


Off the Cocoa topic, but I track processes using the BSM audit trail.

Todd

___

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

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

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

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


"too many nested undo groups" -- What does that mean?

2009-08-17 Thread Jerry Krinock

I'm getting a reproducible "too many nested undo groups" message logged.

But I don't know what to look for because I don't know what that  
means.  How many is "too many"?  Of what?  Is there any way to see the  
number?


Here is what I have found by experiment:
   Whenever I -beginUndoGrouping, -groupingLevels is incremented.
   Whenever I -endUndoGrouping, -groupingLevels is decremented.
   If I -endUndoGrouping when -groupingLevels is 0, I get an
  exception: -endUndoGrouping invoked with no matching begin.

All this makes sense.  Then, by extension, "too many nested undo  
groups" implies that -groupingLevels is too high.  But  by default, - 
levelsOfUndo is inifinite.


The "Undo Architecture" document seems to just scratch the surface in  
so many places!  If someone can answer this I'll happily file a bug.


Thank you,

Jerry Krinock
___

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

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

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

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


Re: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Quincey Morris

On Aug 17, 2009, at 09:30, Corbin Dunn wrote:

Hopefully customization has become easier, and frequently less  
required (ie: the "source list" highlighting style, proper drag and  
drop feedback, etc). Do you have specific examples of things that  
are difficult to do which should be easier?  I'm interested in  
knowing what is difficult to customize, or work with.


Well, since you've opened things up like this ...

My guess is that I. S. wasn't referring to specific defects (though  
there are those) but to the "Frankenstein's monster" nature of  
NSTableView/NSOutlineView -- a lot of not-quite-matching pieces bolted  
onto the corpse of a much simpler class that died about 15 years ago.  
It's not so much about whether the current implementation has 9  
fingers or 11 toes, but whether a new organism might do a better job.


I'd say that NSTableView and NSOutlineView are two of a small number  
of very important classes that make developers' lives miserable, when  
used for anything above the simplest of scenarios. (NSController and  
its mutant offspring are in this number too, vid. another ongoing  
discussion on this list regarding defective KVO notifications.)


Here are some of the issues, just off the top of my head:

-- The table/outline view class APIs have become so intricate,  
especially in regard to what's implicit rather than explicit, that  
they seem to be undocumentable. Consider the number of questions we  
get on this list about how to do things, *from developers who've read  
the documentation*, and consider how hard it is to answer the  
questions correctly, because usually there are obscure conceptual  
issues in the questions that need to be untangled first.


-- The proliferation of delegate methods, while it does enhance  
customizability, suggests that bolt-on, ad-hoc solutions are being  
favored over fundamental design evolution. It's not much use if the  
monster has dozens of useful gizmos sticking out of its head, if it  
can't lurch one step without falling over.


-- The conceptual divide between data-sourced and KVO-bound approaches  
to providing content is vast. The distinction between customizations  
that are done through subclassing and through delegation is  
incomprehensible (cf. frameOfOutlineCellAtRow: vs.  
outlineView:isGroupItem:). The determination of what can be customized  
(through subclassing and delegation) and what cannot be customized,  
seems random.


-- In the interests of compatibility, the source list style has ended  
up having a "nudge, nudge, wink, wink" API. It's not available  
directly, but just sort of happens as a lucky side-effect of patting  
your head and rubbing your stomach simultaneously.


-- Etc.

To be honest, I'm amazed at the amount of very sophisticated  
functionality in NSTableView/NSOutlineView. It does many, many things  
I know I'd be unwilling to re-invent if they weren't handed to me for  
free. However, I think you've proved that a general purpose table view  
class is much more complicated than its original conception (however  
many years ago that was). In effect, NSTableView and NSOutlineView and  
NSObjectController and NSArrayController and NSTreeController have  
been a long-running lab experiment that prove you *do* have the  
technology to solve the problem. Perhaps the time will soon come when  
you are willing to heave the experiment off a cliff, and turn your  
weird science project into a consumer product.


FWIW.


___

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

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

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

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


Re: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread I. Savant



--
I.S.



On Aug 17, 2009, at 12:30 PM, Corbin Dunn wrote:

Hopefully customization has become easier, and frequently less  
required (ie: the "source list" highlighting style, proper drag and  
drop feedback, etc). Do you have specific examples of things that  
are difficult to do which should be easier?  I'm interested in  
knowing what is difficult to customize, or work with.




  Fair enough.

  First, for the record, I meant it when I said I meant no  
disrespect. AppKit as a whole is still an amazing API.


  Second, customization *has* become somewhat easier over the years  
but I'm sad to say I feel NSTableView and NSOutlineView are very  
neglected in this regard (customization) than are other UI elements.  
It's progressing at a glacial pace.


  Third, the (short but important-to-me list):

1 - Drawing. Take a look back through the archives. This has to be the  
single-most-bemoaned issue. Adding a standardized source list style  
was great (more like this, please), but at the very least, more places  
to intervene are long overdue. A specific method for drawing the DnD  
insertion point would be a good example. The archives are full of this  
request but unless I failed to notice (and I admit the strong  
possibility as I haven't specifically checked in the last year or  
two), there's no supported way to do this. Plenty of ugly hacks,  
though. There are other examples but I'm a lazy, lazy man.


2 - Column drag and drop. It's like the poor, neglected stepchild  
compared to row drag and drop. Why? We don't get nearly the control  
that we do for rows/nodes. We also have no (easy? foreseeable?  
supported?) way of dragging columns outside a table. There aren't as  
many reasons why you'd want to drag columns between tables as there  
are for rows, but there are plenty.


3 - Column headers. Customizing the look is fairly easy. Customizing  
behavior, however, has all sorts of gotcha's, depending on your goal.  
This is a separate post unto itself. Again, the archives are the  
smoking gun (smoldering underground coal fire?).


4 - Animation. Come on, guys, you (Apple, collectively) have been  
pushing animation since Leopard. Animation on sort is a bit  
ridiculous, but how about sliding rows out of the way to make room for  
a drop? How about slamming them shut and flinging a locally-dragged  
row back to its position (or making it disappear "under" the edge of  
the scroll view in the direction of its original position if it's not  
currently visible due to a scroll)? Developers have been using hacks  
to perform at least "live, animated sorting" for years. I cite  
NewsFire as the first example I've ever encountered (let's not bring  
up the NewsFire author debate that raged for years on cocoadev.com,  
please). Columns too. Right now, the columns just kind of "pop" back  
and forth. I often get visually confused when reordering the columns  
of any app. Columns can tend to look alike, differentiated only by  
title. This is a *perfect* example of why at least a judicious touch  
of animation is sorely needed in this control. But that's not  
customization, merely improvement. :-)


  That's all I have time for at the moment, but it's illustrative of  
the kind of issues I've encountered or frequently read of others  
encountering.


  I understand this is a highly complex control. I know a lot of the  
"why can't we just..." pleas probably don't take this into proper  
account. Again, I have nothing but respect for the AppKit team, but I  
think it's time to focus on major renovations for these views for the  
next cat. That's all. :-)



___

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

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

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

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


Re: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread I. Savant

On Aug 17, 2009, at 1:48 PM, Quincey Morris wrote:

My guess is that I. S. wasn't referring to specific defects (though  
there are those) but to the "Frankenstein's monster" nature of  
NSTableView/NSOutlineView -- a lot of not-quite-matching pieces  
bolted onto the corpse of a much simpler class that died about 15  
years ago. It's not so much about whether the current implementation  
has 9 fingers or 11 toes, but whether a new organism might do a  
better job.




  Quincey, you're my new hero. :-) Very well-said. I agree with most  
of your points below. Here's one place you lose me:



-- In the interests of compatibility, the source list style has  
ended up having a "nudge, nudge, wink, wink" API. It's not available  
directly, but just sort of happens as a lucky side-effect of patting  
your head and rubbing your stomach simultaneously.




  I'm not sure what you mean here, but I'm fairly sure I disagree. :-D

  This is one step in the right direction. One. At least, insofar as  
"we heard a very common request and, in the interests of consistency  
and promoting good-looking apps on our platform, we will address it."


  Here's the other point of divergence:


Perhaps the time will soon come when you are willing to heave the  
experiment off a cliff, and turn your weird science project into a  
consumer product.


  I think that's a bit harsh but sadly probably the best way to put  
it. You're absolutely right that these views do far more than we would  
(or many of us could) do on our own. Keeping performance firmly in  
mind, this can easily become a very difficult thing to customize in  
plenty of cases I can think of. But these controls are as common as  
buttons (by inclusion in an app, not by frequency in the app). They  
should receive some of the highest attention and see constant  
improvement but I don't feel they have.


--
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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Quincey Morris

On Aug 17, 2009, at 11:14, I. Savant wrote:


 I'm not sure what you mean here, but I'm fairly sure I disagree. :-D

 This is one step in the right direction. One. At least, insofar as  
"we heard a very common request and, in the interests of consistency  
and promoting good-looking apps on our platform, we will address it."


OK, source lists were a fairly weak example. I guess what I meant was  
-- in API terms -- source lists are "just" a stylistic variant,  
whereas in fact they likely have behavioral differences too, in a lot  
of scenarios. But there are no source list APIs, just indirect sort-of  
customizations (like outlineView:isGroupItem:).


Of course, as soon as I clicked "Send" last time, I thought of much  
better examples:


-- Performance sensitivity. The general policy is not to worry about  
performance tuning unless a performance issue can be measured, but  
table views come with an admonition to consider performance before you  
write any code. A necessary evil, perhaps, but also an indication of  
an overburdened design.


-- Cells. Using cells to encapsulate drawing and interaction is fine  
as an implementation detail, but exposing cells as a technique of  
class customization is a real PITA. Cell programming, beyond the  
simplest of overrides, is no fun at all (cells are on my short list of  
cliff-ready experiments too), and there just isn't a wide enough range  
of standard cells to meet the demand for customizations.



___

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

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

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

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


[OT] Re: Audio CD Subchannel Info

2009-08-17 Thread Alastair Houghton

On 17 Aug 2009, at 17:47, bryscomat wrote:

Hey everyone, is there any way to tell if an audio track on a CD  
contains CDG subchannel info?


This isn't Cocoa-related and so it isn't the right mailing list.   
Please go to


  http://lists.apple.com

and select a more appropriate list.

Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: "too many nested undo groups" -- What does that mean?

2009-08-17 Thread Alastair Houghton

On 17 Aug 2009, at 18:08, Jerry Krinock wrote:

I'm getting a reproducible "too many nested undo groups" message  
logged.


But I don't know what to look for because I don't know what that  
means.  How many is "too many"?  Of what?  Is there any way to see  
the number?


Here is what I have found by experiment:
  Whenever I -beginUndoGrouping, -groupingLevels is incremented.
  Whenever I -endUndoGrouping, -groupingLevels is decremented.
  If I -endUndoGrouping when -groupingLevels is 0, I get an
 exception: -endUndoGrouping invoked with no matching begin.

All this makes sense.  Then, by extension, "too many nested undo  
groups" implies that -groupingLevels is too high.  But  by default, - 
levelsOfUndo is inifinite.


Levels of undo and nested undo groups are separate things, I think.   
The message is most likely being generated because you're missing an - 
endUndoGrouping message somewhere.


Kind regards,

Alastair.

--
http://alastairs-place.net



___

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

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

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

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


Re: Changing NSSliderCell's knob thickness [SOLVED]

2009-08-17 Thread Brandon Walkin
Returning the smaller knob rect in -knobRectFlipped: seems to do the  
trick.


Brandon
___

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

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

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

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


Re: Displaying an animated graph (= nodes and edges)

2009-08-17 Thread Kaspar Fischer

Any ideas?

Kaspar

On 16.08.2009, at 12:43, Kaspar Fischer wrote:


Dear list,

After some hours of research I realise that I need some advice on  
how to tackle this: My goal is to render a graph [1] consisting of  
at most 100 nodes and 300 edges (most of the time the graph will be  
much smaller, though). I have an algorithm to position the nodes and  
the algorithm works in iterations so that I can use intermediate  
positions to animate the placement of the nodes. Ultimately, I want  
a scrolling view that allows the user to view the graph and pinch- 
zoom or double-tap zoom into it. When zooming in and when the user  
scrolls, it's okay if the parts that become visible are initially  
blurry and will get redrawn a little later. I need to be able to  
catch touch events on the nodes.


I have played around with a UIScrollView and an associated  
UIViewController; the scroll view contains a  
custom view that draws the complete graph in its -(void)drawRect: 
(CGRect)rect method. I have two problems with this approach: On the  
one hand, when the user zoomed in, even though drawRect: is called  
again, it draws a blurry graph [2]. On the other hand, I am not sure  
how to animate the graph with this approach: I have no layers so I  
basically have to do the animation myself and I fear this does not  
leverage any of the iPhone's hardware capabilities (layer  
composition, etc).


I plan to have a background thread that runs the algorithm and at  
the end of each iteration tells the main (UI) thread the new  
positions of the nodes.


The questions I have:

1. Would you implement each graph node as a CALayer so that it can  
easily be animated, or will that result in too many layers for the  
iPhone's Core Animation framework?


2. Should I use UIScrollView? It already provides the scrollbars,  
the zooming and panning but I could not remove the blurriness/ 
unsharpness.


I have also come across CATiledLayer but I am not sure whether they  
were intended to have sublayers (representing the nodes and edges).


Thanks in advance for any advice on any of these questions!
Kaspar

--
[1] a drawing as you can see on http://en.wikipedia.org/wiki/Graph_(mathematics)
[2] http://halmueller.wordpress.com/2008/10/08/a-very-simple-uiscrollview-demo/


___

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

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

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

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


Re: Displaying an animated graph (= nodes and edges)

2009-08-17 Thread I. Savant

On Aug 17, 2009, at 4:18 PM, Kaspar Fischer wrote:


Any ideas?


  If there were, someone would have replied. Bumping your own message  
without adding new information to help clarify your question or goals  
is considered poor list etiquette. Especially when you've only allowed  
a day.


--
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: Displaying an animated graph (= nodes and edges)

2009-08-17 Thread David Duncan
If you can require iPhone OS 3.0 then you can experiment with the  
CAShapeLayer which will automatically rerender when zoomed.


--
David Duncan @ My iPhone

On Aug 17, 2009, at 4:18 PM, Kaspar Fischer  
 wrote:



Any ideas?

Kaspar

On 16.08.2009, at 12:43, Kaspar Fischer wrote:


Dear list,

After some hours of research I realise that I need some advice on  
how to tackle this: My goal is to render a graph [1] consisting of  
at most 100 nodes and 300 edges (most of the time the graph will be  
much smaller, though). I have an algorithm to position the nodes  
and the algorithm works in iterations so that I can use  
intermediate positions to animate the placement of the nodes.  
Ultimately, I want a scrolling view that allows the user to view  
the graph and pinch-zoom or double-tap zoom into it. When zooming  
in and when the user scrolls, it's okay if the parts that become  
visible are initially blurry and will get redrawn a little later. I  
need to be able to catch touch events on the nodes.


I have played around with a UIScrollView and an associated  
UIViewController; the scroll view contains a  
custom view that draws the complete graph in its -(void)drawRect: 
(CGRect)rect method. I have two problems with this approach: On the  
one hand, when the user zoomed in, even though drawRect: is called  
again, it draws a blurry graph [2]. On the other hand, I am not  
sure how to animate the graph with this approach: I have no layers  
so I basically have to do the animation myself and I fear this does  
not leverage any of the iPhone's hardware capabilities (layer  
composition, etc).


I plan to have a background thread that runs the algorithm and at  
the end of each iteration tells the main (UI) thread the new  
positions of the nodes.


The questions I have:

1. Would you implement each graph node as a CALayer so that it can  
easily be animated, or will that result in too many layers for the  
iPhone's Core Animation framework?


2. Should I use UIScrollView? It already provides the scrollbars,  
the zooming and panning but I could not remove the blurriness/ 
unsharpness.


I have also come across CATiledLayer but I am not sure whether they  
were intended to have sublayers (representing the nodes and edges).


Thanks in advance for any advice on any of these questions!
Kaspar

--
[1] a drawing as you can see on http://en.wikipedia.org/wiki/Graph_(mathematics)
[2] http://halmueller.wordpress.com/2008/10/08/a-very-simple-uiscrollview-demo/


___

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

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

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

This email sent to david.dun...@apple.com

___

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

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

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

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


Re: "too many nested undo groups" -- What does that mean?

2009-08-17 Thread Jerry Krinock


On 2009 Aug 17, at 12:50, Alastair Houghton wrote:

All this makes sense.  Then, by extension, "too many nested undo  
groups" implies that -groupingLevels is too high.  But  by default,  
-levelsOfUndo is inifinite.


Levels of undo and nested undo groups are separate things, I think.   
The message is most likely being generated because you're missing an  
-endUndoGrouping message somewhere.


The message appears when I click 'Undo'.  Here it is in its entirety:

"undo: NSUndoManager 0x164f7ef0 is in invalid state, undo was called  
with too many nested undo groups"


Documentation says that "-undo closes the last open undo group and  
then applies all the undo operations in that group. ... If any  
unclosed, nested undo groups are on the stack when undo is invoked, it  
raises an exception."


So if you interpret "nested" in this document to be "more than one  
open" and "too many" in the log message to be "more than one", this  
may be the exception I'm seeing.


Thanks, Alastair.  I'll check that out.  So maybe what they're trying  
to say with that log message is "... undo was called with more than  
one open (nested) undo group".


___

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

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

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

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


RE: Cleaning "garbage" in Core Data

2009-08-17 Thread Ben Trumbull

Squ,

You're basically saying you don't want to model your data formally,  
but you do want to write your own relationship maintenance and delete  
propagation system.  That is a lot of work.   At this point, your  
problem doesn't have anything to do with Core Data.  You have  
NSDictionaries with informal relationships to other NSDictionaries  
that you want to clean up.


In the general case, a scanning process across large amounts of  
persistent data is going to be very expensive.  It's hard to do this  
well.  You really ought to have performance data in hand to verify  
that this plan is faster than purging more aggressively during saves.



1.
When the app is idle, keep selecting random employees to clean up  
key-value pairs within them. Stop this process as soon as the app is  
not idle any more. Over time, this will tend to keep the app  
"clean", and the user won't notice anything. How could I do this?  
How can I figure out whether an app is idle? Will Apple's "Treading  
Programming Guide" help me with it?



This won't work since you may randomly select "clean" employees.   
Indeed, the further you get in the collection process, the odds of  
selecting "dirty" employees decreases thereby making this very  
inefficient.



2.
Judging from ONLY (yes, ONLY; do NOT break the NDA) the information  
already available on apple.com's GCD intro page and the nice PDF  
intro brochure they made for everyone, would I be able to create  
threads for this task, create MOCs for each of them, do the cleaning  
on those threads, and hand those threads to GCD? It sounds fancy and  
cool, but is this even a realistic solution? The problem I can think  
of is that when actually saving the "main MOC", the main MOC will  
still contain the garbage and wouldn't be able to figure out whether  
to persist the garbage or not.


This is orthogonal to actually solving your problem.  You'll need a  
reasonable design for the collection process before deciding whether  
or not to do it synchronously on the main thread, in a background  
thread, or even in a background process.  Given the amorphous problem  
description, and the early stages of resolution, I would counsel  
against "throwing threads" at it.


Finally, note that I cannot use willTurnIntoFault, and clean up the  
garbage there, because it is very inefficient in my case to do the  
clean up for the managed objects one by one. And again, the user  
would have to wait while saving, which is a bad solution. I really  
have to do them in batches, in such a way that the user will not  
notice it.



-willTurnIntoFault is for *memory* management of the instantiated  
object's life cycle.  It is NOT an appropriate place to access the  
database.


-willSave, however, is a good place for this kind of work.

I am not *explicitly* marking anything as garbage. Whenever a user  
decides to remove a ValidKeys managed object, corresponding key- 
value pairs in all the userInfo dictionaries are *conceptually*  
marked as garbage. This is because I do not want to show the beach  
ball to the user while things are getting cleaned up. I want to  
postpone the cleaning up until later when it will not bother the user.


You're basically saying you don't want to model your data formally,  
but you do want to write your own relationship maintenance and delete  
propagation system.  That is a lot of work.   At this point, your  
problem doesn't have anything to do with Core Data.  You have  
NSDictionaries with informal relationships to other NSDictionaries  
that you want to clean up.


You'd be better off modeling the data formally, and making it Core  
Data's problem.  Alternatively, you could sever the NSDictionaries  
from your NSManagedObjects and focus on a data structure other than an  
NSDictionary to hold these keys.  The NSManagedObjects can be linked  
to another data structure via a transient attribute or transient  
relationship with a persistent attribute that holds a UUID or token to  
look up the peer custom data structure.


Caleb's suggestions are all good ones:


Squ, if this is all correct, some things to consider:

- Rather than removing invalid key/value pairs from the userInfo
dictionary, it may be faster to copy the valid keys to a new
dictionary and dump the old one.

- Have you profiled your code? There are a few things in your proposed
operation which sound like they might take up a lot of time, but it's
impossible to know for sure without profiling. Implement the simplest
solution you can think of and then do some measuring.

- Depending on the results of the profiling, you might want to rethink
the data structure you're using, or how you're using that structure.
For example, if you keep a dictionary for each of the attributes that
are currently represented by your userInfo keys, and use Employee name
or ID or whatever as the keys into each of those dictionaries, then
removing all the data for a garbage key is just a matter of deleting
the correspondi

Overriding NSCollectionView's selection: a good idea?

2009-08-17 Thread Andrew McClain
I've been reading docs and looking at IconCollection for the last week and I
still can't really figure this out.
Here's the behavior I want to model: pretend I'm making poker dice game (I'm
using this as an example to help me understand cocoa programming). I have a
visual representation of the dice, and I want to select a certain number of
them each round.

Right now I'm using NSCollectionView with a prototype view that has a text
field (for a representation of the dice) and a button (for toggling
selection). Eventually I'll just use an image representation, but I'm just
trying to get this to work now.

When the user clicks the button in a view, the corresponding die will be
added into a "diceinhand" array in my AppController.
I can't figure out how, though, to connect the button in a way that
allows the AppController to understand which die has been selected
-- that is, I can't find any way to pass the representedObject associated
with my replicated view to any controller (but perhaps I'm thinking about
that incorrectly).

1. Can I call a selector on the representedObject itself from the view?
Where would I set that up that programmatically (I'm assuming you can't do
that with IB)?

or

2. Is it better to abandon the "selection buttons" and use the selection
code of NSCollectionView? Does that mean the user needs to shift-click to
select multiple dice? Since all I'm doing is trying to is add the object to
another array in my AppController, couldn't I programmatically bind the
DiceInHand array in my AppController to the selectedObjects key of my array
controller or do I need another array controller to manage that?

I'm happy to read docs, it just seems that everything I've been reading
deals mostly with binding values in a prototype view.

Thank you,
Andrew
___

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

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

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

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


int to bytes(value in NSString)

2009-08-17 Thread bosco fdo
  Hi I dont understand of the below case of converting int to byte , the
below java code can able to print the byte value as below

System.out.println("binary output ::: "+Byte.toString(bo[0]));
System.out.println("binary output ::: "+Byte.valueOf(bo[1]));
System.out.println("binary output ::: "+Byte.valueOf(bo[2]));
System.out.println("binary output ::: "+Byte.valueOf(bo[3]));
System.out.println("binary output ::: "+new String(bo));

binary output ::: 0
binary output ::: 0
binary output ::: 0
binary output ::: 1
binary output ::: squaresquaresquaresquare ( 4 square chars) - binary data

but when i make a objective-c code to the same data into final NSString it
also prints as "0001" but not in binary format ( 4 square chars)

I need NSString in binary format how do i print NSString in binary format
instead of "0001"
  obj-c code is uint8 barr[4];
barr[0] =(uint8)num;
barr[1] =(uint8)num>>8;
barr[2] =(uint8)num>>16;
barr[3] =(uint8)num>>24;

i am using [NSString stringwithFormat:@%i,barr[i]]

which %? i need to use to get the byte value(binary data) as it is from the
array?

please help
___

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

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

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

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


How to manage NSArray, NSDictionary, ... description encoding for non ascii characters?

2009-08-17 Thread Gernot A . Pohl

---

#import 

int main (int argc, const char * argv[]) {
   NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];

NSString *halo = @"Hello, Wörld!";
NSArray *array = [NSArray arrayWithObject:halo];
	NSDictionary *dictionary = [NSDictionary dictionaryWithObject:halo  
forKey:@"halo"];

NSLog(@"%...@\narray=%@\ndictionary=%@", halo, array, dictionary);
/* I got on Leopard 10.5.8/Xcode 3.1.2:
	2009-08-16 16:45:39.886  
WhyDoWeHaveWeirdEncodingInCmdLineOut[2436:813] Hello, Wörld!

array=(
"Hello, W\U00f6rld!"
)
dictionary={
halo = "Hello, W\U00f6rld!";
}

	Problem: HOW can I get the SAME NSString description output within  
the array/the dictionary description output???
I need a real unicode character instead of '\U' for a  
'real' stdout in any NSString encoding but not in the given one (see  
my example).
	(Is this a known description issue? Or a feature which NSString - 
description does not have?)
Could a NSArray/NSDictionary -descriptionWithLocale: with the  
right setup help?


*/

   [pool drain];
   return 0;
}

---___

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

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

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

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


Mac access to iPhone Document Directory

2009-08-17 Thread The Grand Poohbah
I'm writing a Mac application to process data for use with my iPhone  
app. It would be handy for development purposes to directly read from  
and write to my connected iPhone app's document directory. I know the  
Organizer can read my app's document directory and have used that, but  
I want to do it with my own Mac app. Is there a way to access the  
Document Directory of a connected iPhone from my home-brew Mac OS X  
application?

___

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

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

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

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


Memory management issues/leaks

2009-08-17 Thread PCWiz

Hi,

I have an Objective-C/Cocoa app with garbage collection enabled. To  
check for memory leaks I first ran it through Instruments and it did  
find some leaks. There was no information on where the leaks were  
coming from, so I used another tool, AnalysisTool (basically a front  
end for the Clang Static Analyzer) to check my code for memory issues.  
It found some leaks and I fixed all of them, however Instruments still  
reports leaks.


Further complicating the problem is that my app crashes when garbage  
collection is disabled. And in the Xcode debugger console (when  
garbage collection is enabled), right when my app starts I get these  
errors:
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x101bfb0,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x101ec90,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x1021560,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x1027da0,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x10293f0,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x102a2a0,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x102cd00,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x1030e70,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x1032bf0,  
has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr = 0x1033430,  
has non-zero refcount = 1


Any help with this would be appreciated. Source code is available upon  
request


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


Custom grid view

2009-08-17 Thread Georg Seifert

Hi,

I try to implement a control with several  NSTextCells in it.

I have problems starting the edit mode.

So fare I tried this (in the control’s mouseDown):
NSText * textObj = [[self window] fieldEditor:YES forObject:_editCell];
[textObj setEditable:YES];
[textObj setFieldEditor:YES];
[textObj setSelectable:YES];
	[_editCell selectWithFrame:Frame inView:self editor:textObj  
delegate:self start:0 length:32000];			

[_editCell setUpFieldEditorAttributes:textObj ];
	[_editCell editWithFrame:Frame inView:self editor:textObj  
delegate:self event:theEvent ];


What else should I implement. Is there any sample code (I did searched  
the web but found nothing)?


Thanks
Georg___

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

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

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

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


Re: Mac access to iPhone Document Directory

2009-08-17 Thread Clark Cox
On Mon, Aug 17, 2009 at 2:12 PM, The Grand Poohbah wrote:
> I'm writing a Mac application to process data for use with my iPhone app. It
> would be handy for development purposes to directly read from and write to
> my connected iPhone app's document directory. I know the Organizer can read
> my app's document directory and have used that, but I want to do it with my
> own Mac app. Is there a way to access the Document Directory of a connected
> iPhone from my home-brew Mac OS X application?

No, there isn't.

-- 
Clark S. Cox III
clarkc...@gmail.com
___

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

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

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

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


Re: How to manage NSArray, NSDictionary, ... description encoding for non ascii characters?

2009-08-17 Thread Adam R. Maxwell


On Aug 17, 2009, at 9:46 AM, Gernot A.Pohl wrote:


NSString *halo = @"Hello, Wörld!";
NSArray *array = [NSArray arrayWithObject:halo];
	NSDictionary *dictionary = [NSDictionary dictionaryWithObject:halo  
forKey:@"halo"];

   NSLog(@"%...@\narray=%@\ndictionary=%@", halo, array, dictionary);
/* I got on Leopard 10.5.8/Xcode 3.1.2:
	2009-08-16 16:45:39.886 WhyDoWeHaveWeirdEncodingInCmdLineOut 
[2436:813] Hello, Wörld!

array=(
"Hello, W\U00f6rld!"
)
dictionary={
halo = "Hello, W\U00f6rld!";
}

	Problem: HOW can I get the SAME NSString description output within  
the array/the dictionary description output???


In general, you should never rely on -description for output, since  
it's intended for debugging and may change between OS releases.  In  
this case, NSDictionary and NSArray appear to be printing an old-style  
ASCII property list (NSPropertyListOpenStepFormat), which must use  
escapes for non-ASCII characters.


   I need a real unicode character instead of '\U' for a  
'real' stdout in any NSString encoding but not in the given one (see  
my example).


You'll need to iterate the collections and print the contents  
yourself, or convert to XML using NSPropertyListSerialization and  
print that.  If you need a specific encoding, use [[NSFileHandle  
fileHandleWithStandardOutput] writeData:[aString dataUsingEncoding:]].





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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Graham Cox


On 18/08/2009, at 2:27 AM, Corbin Dunn wrote:


Copied below is the pertinent information:


NSTableView/NSOutlineView - Contextual menu support

NSTableView and NSOutlineView now have better contextual menu  
support. Please see the DragNDropOutlineView demo application for  
an example of how to properly do contextual menus with a TableView.


The key thing to note is that clickedRow and clickedColumn will now  
both be valid when a contextual menu is popped up. In addition, one  
can dynamically set the popup menu for a particular cell/column in  
the delegate method willDisplayCell:. NSTableView handles this by  
properly overriding menuForEvent:, setting the clickedRow/ 
clickedColumn, and calling [NSCell menuForEvent:inRect:ofView] to  
find the correct menu. If no menu was returned, the menu for the  
NSTableView will be used. If one right clicks on a selection of  
items, all the items are highlighted. One should check to see if  
clickedRow is one of the selected rows, and if it is then do the  
menu operation on all the selected rows. The clickedRow and  
clickedColumn properties will still be valid when the action is  
sent from the NSMenuItem.



Unfortunately, you may have stumbled upon one deficiency; there is  
no way to have the menu apply for the table as a whole. As you  
discovered, the way to fix this is to override -menuForEvent:.



Hi Corbin, thanks for the clarification. I didn't re-read the release  
notes when looking for information on this I must admit, though the  
exact wording doesn't immediately clarify the precise issue. But I do  
understand the thinking a little better now. This though:



 If no menu was returned, the menu for the NSTableView will be used.


Suggests to me that a good behaviour might be to not draw the default  
row highlight in this case. If the cell returns a menu, then fine, the  
menu must pertain to the row, and so the highlight is appropriate. But  
if the table falls back to the view's menu, the row highlight isn't  
appropriate, no?


However, even better would be a setting - 
setShouldDrawRowHighlightForContextualMenu: or something (or another  
delegate method), which just refers the problem to the developer. For  
compatibility with the current implementation, this could default to  
YES.


I'm open to suggestions and ways on improving things -- please do  
log bugs and/or enhancement requests, and ways you would expect the  
highlighting to work but does not.


I haven't lodged a bug yet, but will once I know what a sensible  
suggestion would be.


--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: "too many nested undo groups" -- What does that mean?

2009-08-17 Thread Graham Cox


On 18/08/2009, at 7:43 AM, Jerry Krinock wrote:


On 2009 Aug 17, at 12:50, Alastair Houghton wrote:

All this makes sense.  Then, by extension, "too many nested undo  
groups" implies that -groupingLevels is too high.  But  by  
default, -levelsOfUndo is inifinite.


Levels of undo and nested undo groups are separate things, I  
think.  The message is most likely being generated because you're  
missing an -endUndoGrouping message somewhere.


The message appears when I click 'Undo'.  Here it is in its entirety:

"undo: NSUndoManager 0x164f7ef0 is in invalid state, undo was called  
with too many nested undo groups"


Documentation says that "-undo closes the last open undo group and  
then applies all the undo operations in that group. ... If any  
unclosed, nested undo groups are on the stack when undo is invoked,  
it raises an exception."


So if you interpret "nested" in this document to be "more than one  
open" and "too many" in the log message to be "more than one", this  
may be the exception I'm seeing.


Thanks, Alastair.  I'll check that out.  So maybe what they're  
trying to say with that log message is "... undo was called with  
more than one open (nested) undo group".



This is definitely caused by a missing -endUndoGrouping message.

However, this can be a nightmare to deal with in a nice way. First,  
there's the NSUndoManager bug where opening a group and closing a  
group but doing nothing else in between creates a bogus "Undo" task  
that doesn't do anything except pollute the Undo stack. So you need to  
code around that one by only opening the group if you really are going  
to put something on the Undo stack. Then having done that you need to  
make sure you make a note of that so that you can close the group as  
needed to avoid the error you're seeing here.


That's bad enough, but if there's also the chance of an exception  
being thrown, you need to catch it and make sure that if you did open  
a group, it gets closed as part of the exception clean up.


Where you can, avoid opening and closing undo groups yourself. A  
default group is opened by the event loop so if that is adequate it  
can save a lot of headaches.


--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: int to bytes(value in NSString)

2009-08-17 Thread Graham Cox


On 17/08/2009, at 5:07 PM, bosco fdo wrote:

I need NSString in binary format how do i print NSString in binary  
format

instead of "0001"
 obj-c code is uint8 barr[4];
barr[0] =(uint8)num;
barr[1] =(uint8)num>>8;
barr[2] =(uint8)num>>16;
barr[3] =(uint8)num>>24;

i am using [NSString stringwithFormat:@%i,barr[i]]

which %? i need to use to get the byte value(binary data) as it is  
from the

array?



This tells you:

http://www.opengroup.org/onlinepubs/009695399/functions/printf.html

It states that the default precision for %i is 1, but Apple appear to  
have changed it to 4 (???)


So try %i.1

--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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Adam R. Maxwell


On Aug 17, 2009, at 11:54 AM, Quincey Morris wrote:


On Aug 17, 2009, at 11:14, I. Savant wrote:


I'm not sure what you mean here, but I'm fairly sure I disagree. :-D

This is one step in the right direction. One. At least, insofar as  
"we heard a very common request and, in the interests of  
consistency and promoting good-looking apps on our platform, we  
will address it."


OK, source lists were a fairly weak example. I guess what I meant  
was -- in API terms -- source lists are "just" a stylistic variant,  
whereas in fact they likely have behavioral differences too, in a  
lot of scenarios. But there are no source list APIs, just indirect  
sort-of customizations (like outlineView:isGroupItem:).


I like the source list example, having tried to use it with a subclass  
of NSTextFieldCell.  NSTableView evidently uses SPI to get the proper  
bold and shadow attributes on the text; even with the new background  
style API, you still can't make it draw text correctly with a subclass  
[1].


-- Cells. Using cells to encapsulate drawing and interaction is fine  
as an implementation detail, but exposing cells as a technique of  
class customization is a real PITA. Cell programming, beyond the  
simplest of overrides, is no fun at all (cells are on my short list  
of cliff-ready experiments too), and there just isn't a wide enough  
range of standard cells to meet the demand for customizations.


Yes!  I loathe working with NSCell.  If you want variable height rows  
and an ImageAndTextCell, you have to subclass NSTextFieldCell to make  
it draw vertically centered...and then fix the same problem for  
editing.  And fix your expansion cell rects.  And the focus ring.  And  
probably a few other things that I'm too lazy to look up right now :).


Unfortunately, trying to figure out which NSCell methods to override  
is almost impossible, since so many of them seem redundant (how many  
people understand how cellSize, cellSizeForBounds, imageRectForBounds,  
titleRectForBounds, and drawingRectForBounds are related?  or calcSize  
and calcDrawInfo:?).  For additional confusion, lots of NSImageCell  
and NSTextFieldCell-specific methods are in NSCell...but which ones?   
I don't think documentation can even help at this point; I just keep  
hoping NSCell will be pushed over the cliff and replaced by something  
"very simple and light weight" [2].



[1] http://lists.apple.com/archives/cocoa-dev/2009/Feb/msg01552.html
[2] http://www.stepwise.com/Articles/Technical/NSCell.html



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: [SOLVED, with reservations] Re: Turn off menu highlight in outline view?

2009-08-17 Thread Graham Cox


On 18/08/2009, at 2:27 AM, Corbin Dunn wrote:

It seems strange to me that this method is doing highlighting duty  
when all it's meant for is to return a property.


To me, it doesn't seem strange. It is AppKit that displays the menu,  
and it allows a consistent user interface to be used throughout, and  
we wanted to work easily and without trouble to the developer.



Just to add a further comment on this.

It seems strange because on the face of it -menuForEvent: is meant, as  
far as I can see, merely to return a property - the view's contextual  
menu (the event providing the context). What is done with the menu as  
far as displaying it, is down to the client code that invokes this.  
(Though what it would do other than pop it up and track it, I couldn't  
say).


It is surely not meant to implement behaviours such as visual feedback  
(is this done here by any other class?). Wouldn't it be more  
appropriate to be doing the visual feedback part in -rightMouseDown: ?  
It strikes me that it would be a lot easier as well as more correct to  
do it there, since you have a single place to both turn on the  
highlight and turn it off when menu tracking finishes. You must be  
going out of your way to flag that the row will need an update when  
tracking ends to clear the highlight, since once -menuForEvent:  
returns it doesn't get called again when the menu tracking completes.


This is only conjecture of course as I don't have the source available  
to me, and there may be good reasons for not overriding - 
rightMouseDown: to handle this that I'm not able to think of  
(accessibility??), but currently it's looking like a slightly strange  
design in terms of where the responsibility for the highlight properly  
lies.


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


Read last x bytes of a text file?

2009-08-17 Thread Alex Kac
I'm sure there is a great way to do this, but I seem to not find it. I  
have a potentially large text file that I wish to only show the last  
32k worth - it could be 200MB. So I was looking at NSInputStream, but  
perhaps I'm being dense or its the wrong tool for the job, but I  
cannot find a way to tell it to start at byte x of the file.


Ideally, I'd like to do something like the tail command app works. Any  
pointers?

___

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

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

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

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


Re: Read last x bytes of a text file?

2009-08-17 Thread Adam R. Maxwell


On Aug 17, 2009, at 7:57 PM, Alex Kac wrote:

I'm sure there is a great way to do this, but I seem to not find it.  
I have a potentially large text file that I wish to only show the  
last 32k worth - it could be 200MB. So I was looking at  
NSInputStream, but perhaps I'm being dense or its the wrong tool for  
the job, but I cannot find a way to tell it to start at byte x of  
the file.


Check out NSFileHandle, specifically -seekToFileOffset: and - 
readDataToEndOfFile.




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: Memory management issues/leaks

2009-08-17 Thread Quincey Morris

On Aug 17, 2009, at 15:15, PCWiz wrote:

I have an Objective-C/Cocoa app with garbage collection enabled. To  
check for memory leaks I first ran it through Instruments and it did  
find some leaks. There was no information on where the leaks were  
coming from, so I used another tool, AnalysisTool (basically a front  
end for the Clang Static Analyzer) to check my code for memory  
issues. It found some leaks and I fixed all of them, however  
Instruments still reports leaks.


Further complicating the problem is that my app crashes when garbage  
collection is disabled. And in the Xcode debugger console (when  
garbage collection is enabled), right when my app starts I get these  
errors:
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x101bfb0, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x101ec90, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x1021560, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x1027da0, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x10293f0, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x102a2a0, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x102cd00, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x1030e70, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x1032bf0, has non-zero refcount = 1
MyApp(9874,0xb0103000) malloc: free_garbage: garbage ptr =  
0x1033430, has non-zero refcount = 1


a. These error messages are well known and perfectly harmless, though  
annoying. You get them in a GC app when you use the system-supplied  
images that IB shows in its Library Media tab. The fix is popularly  
believed to be coming in Snow Leopard.


b. You *cannot* safely disable garbage collection in an app unless  
you've intentionally written it using retain/release. With GC off, and  
no retain/release code, your app is certainly going to crash.


c. Instruments is known to be wrong about reporting leaks under  
Leopard. It's probably not worth trying to deduce any useful  
information from it, so unless you know form other evidence that you  
have a problem with leaks, I'd suggest you just don't bother looking  
for them. A fix to Instruments is popularly believed to be coming in  
Snow Leopard.




___

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

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

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

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


Re: int to bytes(value in NSString)

2009-08-17 Thread bosco fdo
Hi graham
 Thanks for the reply.  I have tried %i.1 but i am getting 0.10.10.10.1 ,
but i need it in binary byte value

bos




On Tue, Aug 18, 2009 at 10:06 AM, Graham Cox  wrote:

>
> On 17/08/2009, at 5:07 PM, bosco fdo wrote:
>
> I need NSString in binary format how do i print NSString in binary format
>> instead of "0001"
>>  obj-c code is uint8 barr[4];
>> barr[0] =(uint8)num;
>> barr[1] =(uint8)num>>8;
>> barr[2] =(uint8)num>>16;
>> barr[3] =(uint8)num>>24;
>>
>> i am using [NSString stringwithFormat:@%i,barr[i]]
>>
>> which %? i need to use to get the byte value(binary data) as it is from
>> the
>> array?
>>
>
>
> This tells you:
>
> http://www.opengroup.org/onlinepubs/009695399/functions/printf.html
>
> It states that the default precision for %i is 1, but Apple appear to have
> changed it to 4 (???)
>
> So try %i.1
>
> --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: int to bytes(value in NSString)

2009-08-17 Thread Andrew Farmer

On 17 Aug 2009, at 23:21, bosco fdo wrote:

Hi graham
Thanks for the reply.  I have tried %i.1 but i am getting  
0.10.10.10.1 ,

but i need it in binary byte value


Wait, you're trying to construct a NSString with null bytes in it? I'm  
pretty sure that doesn't work correctly in a lot of circumstances -  
NSString is primarily intended for representing a sequence of  
characters, not an arbitrary set of bytes. What you probably want  
instead is NSData.

___

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

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

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

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