Re: mount dmg disk

2010-03-15 Thread gMail.com
Kyle,
you could be right, but, if I put the program name as first argument, it
doesn't work. Please note I launch the /usr/bin/hdiutil and not the shell.

  args = [NSArray arrayWithObjects:@"mount", @"-stdinpass", dmgPath, nil];
  [aTask setLaunchPath:@"/usr/bin/hdiutil"];

and this way it works all the time.


Regards
--
Leonardo


> Da: Kyle Sluder 
> Data: Sun, 14 Mar 2010 18:42:51 -0700
> A: "gMail.com" 
> Cc: Gwynne Raskind , 
> Oggetto: Re: mount dmg disk
> 
> On Sun, Mar 14, 2010 at 1:41 PM, gMail.com  wrote:
>> I had to modify just one thing, then it worked: since we invoke directly
>> hdiutil, I removed "hdiutil" from the args, so now it looks like:
> 
> This is incorrect. Unix convention requires the program name be the
> first argument.
> 
> Remember, NSTask is *NOT* like entering a command at the shell prompt.
> 
> --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: Edit NSTokenField's token?

2010-03-15 Thread Frédéric BLANC
Hi,

I'm "resurrecting" this old thread (from late 2007!) to see whether
someone succeeded in reproducing Apple Mail's ability to turn any
given token into "editable plain text" mode.  (I'm here talking about
the behaviour of Apple Mail's "Edit Address" token-based menu item.)

Alexander Griekspoor (hi!) seemed to reply so to Fredrik Olsson (hi!)
[relevant tidbits copied below], and I'd love to hear anyone willing
to share some more details 'cause my initial attempts+websearches
didn't lead me to good results so far :( !  [Note: It was very easy to
add this "Edit" token-based menu item to my tokens; but its dedicated
action is lacking the li'l "trick" that would turn the corresponding
token back to (editable) plain text…]

Thanks in advance,

--
— Fred

===

25 jul 2006 kl. 14.14.54 skrev Fredrik Olsson:
>> Mail allows the user to edit a token by (…) selecting edit from the
>> token's menu.
>>
>> This behavior is not default for NSTokenField. (…)
>>
>> Is there a way to let the user edit an existing token, instead of
>> deleting and retyping?
>>
>> Tokens are highlighted when hovering the mouse (…), but I can not find
>> a reference in the documentation for how to catch these events, or even
>> selection of tokens.

On Fri, Dec 7, 2007 at 10:09 AM, Alexander Griekspoor (…) wrote:
> Unfortunately the double-click editing of tokens is not possible on Tiger. I
> ended up with a menu with an edit item that tries to bring it back in
> editing mode again (tricky). (…)
___

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

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

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

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


Cut and paste out of/ into text fields in a separate window doesn't work

2010-03-15 Thread Brian Postow
I have a Mozilla plugin which puts up a separate window for login information. 
It seems to work fine, it gets keyboard events like typing and hitting 
return to hit the default button. HOWEVER, it doesn't seem to get cut 
and paste events. When I hit Cmd-v, the edit menu flashes, but nothing 
happnes. 
Is this a problem with my responder chain? Do I have to specially tell 
Mozilla that I want these events? or am I likely to have some other 
problem that I haven't even thought of? 
thanks.


Brian Postow
Senior Software Engineer
Acordex Imaging Systems

___

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

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

Help/Unsubscribe/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] can't make selected text stay black

2010-03-15 Thread Corbin Dunn
Howdy all,

Kent's solution is also another good work around -- calling setHighlighted:NO 
on the cell will cause it to not draw highlighting, which is the source of the 
problem.

So, to summarize, there are two ways to fix this with public API:

1. In the table's delegate, -willDisplayCell: method, call setHighlighted:NO on 
the cell, and call setBackgroundStyle: to the appropriate style you want 
(light/dark)
  OR
1. Override -highlightColorWithFrame:controlView: and return nil

2. Draw the highlighting via a table subclass in highlightSelectionInClipRect:

-corbin

On Mar 14, 2010, at 3:58 PM, Keith Blount wrote:

> Hi Kent,
> 
> You're absolutely right! Thanks for sharing this. For myself, I have tables 
> and outline views that draw a custom highlight and need the text colour to 
> stay black, but your solution works for that too. The key, as you say, is 
> calling -setHighlighted: to NO on the cell in the delegate method, and that 
> is what I had missed before (given that I want to draw a highlight in my 
> table, it hadn't occurred to me that I needed to prevent the cell drawing a 
> highlight - but of course, that is all the private method was doing anyway). 
> This prevents the cell from changing its text colour but I can still draw my 
> custom highlights in the table/outline view subclasses. I need to test on 
> Tiger (which I support and where NSBackgroundStyleLight isn't supported) to 
> check that the private method isn't necessary there, but I believe you have 
> just obviated my need for the private method altogether, which is great as 
> resorting to private methods is never good - thanks! It seems you have 
> definitely found the best way of doing this.
> 
> All the best,
> Keith
> 
> From: Kent Hauser 
> To: Keith Blount ; Corbin Dunn 
> Cc: cocoa-dev@lists.apple.com
> Sent: Sun, March 14, 2010 8:09:27 PM
> Subject: Re: [NSTableview] can't make selected text stay black
> 
> Now I'm all confused. Everything's working now where it wasn't before.
> 
> I'm having the desired result (selected cell not appearing selected) by 
> following Corbin's original advice: 
> 
> override NSTable's -hightlightSelectionInClipRect: to do nothing & having the 
> delegate method
> - tableView:willDisplayCell:forTableColumn:row:   perform setHighlighted:NO  
> & setBackgroundStyle:NSBackgroundStyleLight on the cell.
> 
> I'm getting backColor text as desired.
> 
> Also, if I send [cell setHighlighted:NO], the cell's 
> -highlightColorWithFrame:controlView: is not called, shao wholesale 
> subclassing of cells does not appear to be needed.
> 
> My guess as to what I had wrong before was that I had set hightlight style to 
> "source list" in IB when exploring & had not set it back to normal. I'm 
> testing now with a programmaticly generated NSTableView.
> 
> Thanks for all your help. 
> 
> Kent
> 
> On Fri, Mar 12, 2010 at 3:48 PM, Keith Blount  wrote:
> Actually, after testing this, does overriding NSCell's 
> -highlightColorWithFrame:controlView: really have the same effect as 
> overriding the _highlightColorForCell: private message? I assume the latter 
> just calls the former, but I must be doing something wrong because overriding 
> -highlightColorWithFrame: didn't have the desired effect for me. Please see 
> the following demo project:
> 
> http://www.literatureandlatte.com/misc/BlackSelectedTableText.zip
> 
> Note that in that simple project, MyTextFieldCell overrides 
> -highlightColorWithFrame:controlView: to return nil (and there is an NSLog in 
> there to ensure it is getting called), but although doing so prevents the 
> highlight colour from getting drawn, the text still gets drawn in white (even 
> though the -willDisplayCell: delegate method in MyDocument is setting it to 
> black). Contrast this with uncommenting the _highlightColorForCell: method 
> that returns nil in MyTableView, which has the desired effect of ensuring the 
> text gets drawn in black (which is what the op was after and is the reason I 
> ended up resorting to this private message).
> 
> Am I missing something obvious? Is there something else that needs to be used 
> in conjunction with this to force the text to be drawn in black even when 
> highlighted? (To put this in context, I use NSOutlineView to provide an 
> OmniOutliner-style outline with a light blue selection, so the text needs to 
> be black even when highlighted given the light highlight, which is 
> custom-drawn.)
> 
> Many thanks and all the best,
> Keith
> 
> 
> - Original Message 
> From: Corbin Dunn 
> To: Keith Blount 
> Cc: cocoa-dev@lists.apple.com; k...@khauser.net
> Sent: Fri, March 12, 2010 11:29:08 PM
> Subject: Re: [NSTableview] can't make selected text stay black
> 
> >
> > P.S. I'm hesitant about mentioning private methods here, but I don't think 
> > there's another way of doing it - I filed an enhancement request for this 
> > method to be made public back in April '06, ID#4521167, so please do the 
> > same if you think it would be 

Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Fritz Anderson
On 14 Mar 2010, at 9:47 PM, mmalc Crawford wrote:

> On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote:
> 
>> So my question is - how do you detect this before loading the file? I'm 
>> aware of the sqlite3 PRAGMA integrity_check, but there does not seem to be a 
>> C API for this. Any pointers?
>> 
> 
> 
> See 
> 
>  for an example.

My understanding may be incomplete, but it seems that the example shows the use 
of pragmas (pragmata?) that set the state of the store at 
addPersistentStore...: time, and have no significant return value. PRAGMA 
integrity_check and PRAGMA quick_check return tables. 

Is there a way to collect the results of the integrity check? Would 
addPersistentStore...: return nil and somehow populate the error return?

— F

___

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

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

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

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


Re: mount dmg disk

2010-03-15 Thread Kyle Sluder
On Mon, Mar 15, 2010 at 3:34 AM, gMail.com  wrote:
> you could be right, but, if I put the program name as first argument, it
> doesn't work. Please note I launch the /usr/bin/hdiutil and not the shell.

I'm not right. I was thinking of the exec* functions, which require
you to pass the program name as an argument. As Mike pointed out,
NSTask does this for you.

--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: mount dmg disk

2010-03-15 Thread Michael Ash
On Mon, Mar 15, 2010 at 12:33 AM, Kyle Sluder  wrote:
> On Sun, Mar 14, 2010 at 9:50 PM, Michael Ash  wrote:
>> NSTask is also not like calling the exec family of functions. NSTask
>> implicitly passes the target path as the first argument, and puts your
>> arguments starting with argv[1].
>
> Durr. I should have confirmed with the documentation.

I actually couldn't find any documentation that says it behaves one
way or another. I just know how it works from prior use. If there is a
place which states the behavior in this respect, I'd like to know
where!

Mike
___

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

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

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

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


Re: Cut and paste out of/ into text fields in a separate window doesn't work

2010-03-15 Thread Steven Degutis
Not trying to be pessimistic here, just honest, but it seems like this is a
problem with Mozilla's (Firefox's? Thunderbird's? which app are we talking
about here?) plugin-architecture system.

The shortcuts Cmd+C and Cmd+V in the Edit menu link to the First Responder,
and typically any text field (NSTextField, NSSearchField, et al) which gets
"focused", becomes the First Responder. Thus, it should Just Work™ like you
are expecting it to.

However, if the host app controlling your plugin is not giving your plugin a
chance to become first responder, it's most likely because said app is
completely breaking the Responder Chain. In my experience, Firefox (and thus
probably other Mozilla apps) isn't even a native Cocoa app, it just pretends
to be one, so I wouldn't doubt it if it doesn't even *have* a Responder
Chain.

You may want to contact the developers of the host app to ask them what's
going on, since they will have more intimate knowledge of their app's
"uniqueness".

-Steven

On Mon, Mar 15, 2010 at 11:04 AM, Brian Postow wrote:

> I have a Mozilla plugin which puts up a separate window for login
> information.
> It seems to work fine, it gets keyboard events like typing and hitting
> return to hit the default button. HOWEVER, it doesn't seem to get cut
> and paste events. When I hit Cmd-v, the edit menu flashes, but nothing
> happnes.
> Is this a problem with my responder chain? Do I have to specially tell
> Mozilla that I want these events? or am I likely to have some other
> problem that I haven't even thought of?
> thanks.
>
>
> Brian Postow
> Senior Software Engineer
> Acordex Imaging Systems
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/steven.degutis%40gmail.com
>
> This email sent to steven.degu...@gmail.com
>



-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/
___

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

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

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

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


Re: Best approach for a bunch of new UI controls

2010-03-15 Thread Igor Mozolevsky
On 14 March 2010 15:23, Andreas Mayer wrote:
>
> Am 14.03.2010 um 04:14 Uhr schrieb Igor Mozolevsky:
>
>> I've got a few *nix libs to flesh out with some Cocoa UI goodness and
>> would welcome suggestions for a good way to do a bunch of controls:
>
> Instead of describing the proposed look of your controls, you should tell us
> what their *purpose* is supposed to be.


Picture a warehouse with billions of locations (>32bit uint limit),
each location can be either full or empty, a full location can be one
of multiple categories. A warehouse employee needs to be able to a)
pull up a manifest of each individual location and b) create a
(ordered) shipping list of containers. The shipping list is not
constrained by weight but by what the manifest for each container says
and while it can be automated to a degree, it requires a manual
interaction.

So each line of control 1 would represent the number of containers
control 2 can hold and can be one of {full, partially full, empty},
where as control 2 would show each individual location that could
store a container which can be dragged and placed into control 3 to
create an ordered shipping list.

I was thinking of using a scrollable view for control 1 and a
collection view for both of controls 2 and 3, but didn't want to
"poison" the recommendation pool... Incidentally, there is no need to
remember which locations were selected in control 2 once the sliding
window of control 1 is moved.

Cheers,

--
Igor
___

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

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

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

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


Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Ben Trumbull
> On 14 Mar 2010, at 9:47 PM, mmalc Crawford wrote:
> 
>> On Mar 14, 2010, at 7:21 pm, Dave Fernandes wrote:
>> 
>>> So my question is - how do you detect this before loading the file? I'm 
>>> aware of the sqlite3 PRAGMA integrity_check, but there does not seem to be 
>>> a C API for this. Any pointers?
>>> 
>> 
>> 
>> See 
>> 
>>  for an example.
> 
> My understanding may be incomplete, but it seems that the example shows the 
> use of pragmas (pragmata?) that set the state of the store at 
> addPersistentStore...: time, and have no significant return value. PRAGMA 
> integrity_check and PRAGMA quick_check return tables. 
> 
> Is there a way to collect the results of the integrity check? Would 
> addPersistentStore...: return nil and somehow populate the error return?

Yes, if it detects corruption you'll get an error back.  There isn't much 
useful in the "result" tables from those pragmas.

Running an integrity check can be useful if you have previously gotten a 
corrupt db error back from fetching or saving, or your app previously crashed, 
or you have some other active indicator it might be worthwhile.  However, it's 
quiet expensive in I/O and you should not do it on every app launch / document 
open.  Customers with account home directories on AFP, NFS or SMB servers will 
be very unhappy, and if your files become large enough so will people using 
local drives.

- 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:NSManagedObject awakeFromFetch not sent on secondary thread?

2010-03-15 Thread Ben Trumbull
> My custom NSManagedObject subclass uses awakeFromInsert and awakeFromFetch
> to setup custom object to ivar. This works as expected, but when I fetch the
> same object on secondary thread (in NSOperation), the ivar remains nil as
> awakeFromFetch is not sent...
> 
> Is NSManagedObject's awakeFromFetch supposed to be sent when fetching on
> secondary thread?

Does the secondary thread have its own private NSManagedObjectContext that you 
are using for the fetch, or are you fetching against an NSManagedObjectContext 
that was created on another thread ?  If you are using an NSOperationQueue with 
maxConcurrency > 1, then each NSOperation will need to allocate, use, and 
deallocate its own NSManagedObjectContext.

- 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: Problem with "save as" and freed managed object context

2010-03-15 Thread Ben Trumbull
> One of the other things I had been working on must have fixed the underlying 
> problem, and my implementation of identifier and setIdentifier were actually 
> causing this issue. I completely removed those two methods (which is of 
> course going directly against the documentation at the top of the 
> NSAtomicStore class reference, but going along with the implication in 
> NSPersistentStore that you don't have to override it) and for the first time, 
> was able to "save as"! Yay!
> 
> But my elation was short lived because I now get an intermittent error on 
> save as:
> 
> Error Domain=NSCocoaErrorDomain Code=4 UserInfo=0x11e9c21c0 "The document 
> „Untitled60.nm5‰ could not be saved as „Untitled60sa.nm5‰. The folder doesn‚t 
> exist." Underlying Error=(Error Domain=NSCocoaErrorDomain Code=4 
> UserInfo=0x11ef217f0 "The folder „(null)‰ doesn‚t exist." Underlying 
> Error=(Error Domain=NSPOSIXErrorDomain Code=2 "The operation couldn‚t be 
> completed. No such file or directory"))
> 
> So sometimes it works and sometimes it doesn't. My file format is a zipped 
> folder with my XML files and other resources in it, so when a file is saved, 
> I create a temporary folder and put all the bits of my file into it, zip it 
> up, and then remove the old file and move the zipped up new one into place. 
> I'm not sure if this is relevant at all, but when I get the save error, it 
> also says:
> 
> AppKit called 
> rmdir("/private/var/folders/nl/nlcXN-oPHJiAXXc1Z0R5VE+++TI/TemporaryItems/(A 
> Document Being Saved By NovaMind5TP 71)"), it didn't return 0, and errno was 
> set to 66.
> 
> But I am collecting the error messages in my app, and it's not anywhere in 
> there, so must be from within CoreData, and the man page for rmdir just said 
> that the return on error is >0 for errors, so I can't be certain what the 
> error code means (I suspect it means that the folder is not empty).

Those are NSDocument errors.  It has two features that may be getting in your 
way (or vice versa).  First, the safe save functionality.  It tries to marshall 
all the changes into a temporary directory, and then switch the document with 
the old one wholesale.  You're removing the old file may confuse and anger the 
NSDocument gods, and your switching the new one may be duplicating its 
functionality in a way that it's not prepared for.  Pretty sure you don't want 
to delete the old file.

The second feature is document rename tracking.  NSDocument uses fs events to 
track any external changes to the document including renaming, deletion, or 
unexpected writes.  By "unexpected" I mean anything that happens outside of one 
of NSDocument's write methods.  So saving on a background thread directly 
against a MOC, or using FS commands to alter the document, will give NSDocument 
indigestion.

> 
> Has anyone else seen that one before?
> 
> 
> I also have a problem where the save as only appears to save some of the data 
> in my file, but I am guessing that that must be some bug in my code.
> 
> 
> If I open a file and then try to "save as" (without making any changes), then 
> I get a "Could not merge changes" error message. I'm not sure if that's 
> related to the problem where it is only saving part of the file, or is 
> something completely different, but am planning to look at the data loss one 
> first and see if it resolves the merge issue.

gdb:

>future-break objc_exception_throw
>future-break +[NSError errorWithDomain:code:userInfo:]

...

> info threads
> thread apply all bt

- 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: Better sorting using threads?

2010-03-15 Thread Andrew James
Thanks for everyone's feedback.  I'm always very  happy to have ignorance on my 
part removed!

As far as interface is concerned yes I completely respect the fact that it's 
there to hide details and help us focus on behavior not implementation.  And 
yes I'm sort of kicking myself for not realizing an array is really just some 
thing that lets you index into it with a number.  Doh!

That being said, once containers get large, understanding the Big O notation 
for operations can become important factors in choosing one implementation over 
another.  One of the things I do like about STL ( don't want to digress too far 
in this direction ) is that documentation provides gaurantees about Big O 
notation.

Do this type of gaurantee exist anywhere in Cocoa's containers?

--aj 





From: Jeffrey Oleander 
To: Gwynne Raskind ; Ken Ferry ; 
Andrew James 
Cc: Cocoa-Dev List 
Sent: Sun, March 14, 2010 12:34:35 PM
Subject: Re: Better sorting using threads?

> On Fri, 2010/03/12, Andrew James  wrote:
> From: Andrew James 
> Subject: Re: Better sorting using threads?
> To: "Gwynne Raskind" , "Ken Ferry" 
> 
> Cc: "Cocoa-Dev List" 
> Date: Friday, 2010 March 12, 13:55
> My concern is that keeping traditional C-arrays
> in sorted order means
>
> 1) finding the location for insert ( O(n) )
> 2) copying a range of contiguous memory to make the
> location available
> 3) copying in new value
> 
> I've made the assumption that NSArray wraps an
> old school contiguous C-style array
> ( ala C++ std:::vector )
>
> With many sorted container insertion inserting
> in sorted order means
> 1) finding the location for inserter ( O(nlogn) )
> or the like
> 2) create node with new value
> 3) swizzle some pointers to include new values
>
> .. ( ala C++ std::set )
>
> I have a hard time seeing how this is more expensive
> for very large container than sorting an array when
> needed.  The initial poster was indicating he has
> a container with thousands of members.
>
> Please educate me where my post illustrates ignorance.
>
> Cheers,
> --aj

Well, encapsulation requires a certain amount of enforced
ignorance.  We're not supposed to know exactly how it
does it.  We're only supposed to know the public 
interface and let it do its thing as it wishes to do it,
even changing when the maintainers of the class decide
to make changes.

I may be implemented as a Fibonacci heap, or a binary
tree for all we know, using a contiguous block of memory
or nodes allocated one at a time.  There are hints in
the interface provided, but no promises beyond it
regarding implementation.

>> 
>> From: Gwynne Raskind 
>> To: Ken Ferry 
>> Cc: Cocoa-Dev List 
>> Sent: Fri, March 12, 2010 9:14:35 AM
>> Subject: Re: Better sorting using threads?
>>> On Mar 12, 2010, at 2:25 AM, Ken Ferry wrote:
>>> Does Cocoa have sorted containers so that an
>>> object can be inserted in
>>> sorted order?  If so it seems like this would be far
>>> less expensive.
>> 
>> Probably the best thing to do if you want this is to
>> maintain the sort
>> yourself by inserting new objects in the correct
>> position.  You can find the
>> position using
>> -[NSArray
>> indexOfObject:inSortedRange:options:usingComparator:]
>> ...



___

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

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

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

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


Re: Best approach for a bunch of new UI controls

2010-03-15 Thread Andreas Mayer


Am 14.03.2010 um 17:51 Uhr schrieb Igor Mozolevsky:


Picture a warehouse [...]


It is not clear to me why you think that you need graphical  
representations for your objects.

Wouldn't simple lists of text work at least as good?

But if I really wanted to have those controls, I'd probably build them  
from the ground up. I.e create my own NSView subclass from scratch.
I found that the more complex build-in views are working best if you  
only use them exactly as they are supposed to be. Subclassing them is  
often more hassle than doing everything yourself.



Andreas
___

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

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

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

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


Re: Better sorting using threads?

2010-03-15 Thread Ken Ferry
On Mon, Mar 15, 2010 at 1:11 PM, Andrew James wrote:

> Thanks for everyone's feedback.  I'm always very  happy to have ignorance
> on my part removed!
>
> As far as interface is concerned yes I completely respect the fact that
> it's there to hide details and help us focus on behavior not
> implementation.  And yes I'm sort of kicking myself for not realizing an
> array is really just some thing that lets you index into it with a number.
> Doh!
>
> That being said, once containers get large, understanding the Big O
> notation for operations can become important factors in choosing one
> implementation over another.  One of the things I do like about STL ( don't
> want to digress too far in this direction ) is that documentation provides
> gaurantees about Big O notation.
>
> Do this type of gaurantee exist anywhere in Cocoa's containers?
>

Yes, but you probably won't like the guarantees, since they're pretty
conservative.  See CFArray.h, CFDictionary.h.

There are no guarantees for "NSArray" or "NSDictionary" because they can
have arbitrary subclasses.  However, in standard cases you'll be getting the
same behavior as with the un-subclassable CFArray and CFDictionary.

-Ken


>
> --aj
>
>  --
> *From:* Jeffrey Oleander 
> *To:* Gwynne Raskind ; Ken Ferry <
> kenfe...@gmail.com>; Andrew James 
>
> *Cc:* Cocoa-Dev List 
> *Sent:* Sun, March 14, 2010 12:34:35 PM
>
> *Subject:* Re: Better sorting using threads?
>
> > On Fri, 2010/03/12, Andrew James  wrote:
> > From: Andrew James 
> > Subject: Re: Better sorting using threads?
> > To: "Gwynne Raskind" , "Ken Ferry" <
> kenfe...@gmail.com>
> > Cc: "Cocoa-Dev List" 
> > Date: Friday, 2010 March 12, 13:55
> > My concern is that keeping traditional C-arrays
> > in sorted order means
> >
> > 1) finding the location for insert ( O(n) )
> > 2) copying a range of contiguous memory to make the
> > location available
> > 3) copying in new value
> >
> > I've made the assumption that NSArray wraps an
> > old school contiguous C-style array
> > ( ala C++ std:::vector )
> >
> > With many sorted container insertion inserting
> > in sorted order means
> > 1) finding the location for inserter ( O(nlogn) )
> > or the like
> > 2) create node with new value
> > 3) swizzle some pointers to include new values
> >
> > .. ( ala C++ std::set )
> >
> > I have a hard time seeing how this is more expensive
> > for very large container than sorting an array when
> > needed.  The initial poster was indicating he has
> > a container with thousands of members.
> >
> > Please educate me where my post illustrates ignorance.
> >
> > Cheers,
> > --aj
>
> Well, encapsulation requires a certain amount of enforced
> ignorance.  We're not supposed to know exactly how it
> does it.  We're only supposed to know the public
> interface and let it do its thing as it wishes to do it,
> even changing when the maintainers of the class decide
> to make changes.
>
> I may be implemented as a Fibonacci heap, or a binary
> tree for all we know, using a contiguous block of memory
> or nodes allocated one at a time.  There are hints in
> the interface provided, but no promises beyond it
> regarding implementation.
>
> >> 
> >> From: Gwynne Raskind 
> >> To: Ken Ferry 
> >> Cc: Cocoa-Dev List 
> >> Sent: Fri, March 12, 2010 9:14:35 AM
> >> Subject: Re: Better sorting using threads?
> >>> On Mar 12, 2010, at 2:25 AM, Ken Ferry wrote:
> >>> Does Cocoa have sorted containers so that an
> >>> object can be inserted in
> >>> sorted order?  If so it seems like this would be far
> >>> less expensive.
> >>
> >> Probably the best thing to do if you want this is to
> >> maintain the sort
> >> yourself by inserting new objects in the correct
> >> position.  You can find the
> >> position using
> >> -[NSArray
> >> indexOfObject:inSortedRange:options:usingComparator:]
> >> ...
>
>
>
>
>
___

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

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

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

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


Re: Better sorting using threads?

2010-03-15 Thread Jens Alfke


On Mar 15, 2010, at 1:11 PM, Andrew James wrote:

That being said, once containers get large, understanding the Big O  
notation for operations can become important factors in choosing one  
implementation over another.  One of the things I do like about STL  
( don't want to digress too far in this direction ) is that  
documentation provides gaurantees about Big O notation.

Do this type of gaurantee exist anywhere in Cocoa's containers?


No. There isn't even any documentation about the underlying data  
formats or algorithms used by the container classes; you just use the  
nice shiny APIs. Very Apple-like :)


I missed the start of this thread, but I'll add (perhaps redundantly)  
that NSArray, at least its mutable variety, at large sizes switches  
from a flat vector implementation to one that's more of a two-level  
tree. This is done to keep insertions and deletions fast. I think what  
motivated this implementation is that mutable NSArrays are heavily  
used in the Cocoa text system.


As always, you should be avoiding thinking about such details until  
you've written your code, profiled it, and identified actual hot-spots  
involving arrays. Also, you should be using NSArray's sort methods  
rather than trying to make your own, since those methods have direct  
access to the internal array guts and can work much faster than you  
going through the API.


—Jens___

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

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

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

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


Re: Best approach for a bunch of new UI controls

2010-03-15 Thread Igor Mozolevsky
On 15 March 2010 20:17, Andreas Mayer wrote:
>
> Am 14.03.2010 um 17:51 Uhr schrieb Igor Mozolevsky:
>
>> Picture a warehouse [...]
>
> It is not clear to me why you think that you need graphical representations
> for your objects.
> Wouldn't simple lists of text work at least as good?

Nowhere near as effectively - I can pack about 1000 containers in a
650x400 control, and the human brain is really slow at processing text
v. simple graphics, telling the difference between 20 or so different
colours is much easier, more precise and faster that 20 different text
descriptions :-)

> But if I really wanted to have those controls, I'd probably build them from
> the ground up. I.e create my own NSView subclass from scratch.
> I found that the more complex build-in views are working best if you only
> use them exactly as they are supposed to be. Subclassing them is often more
> hassle than doing everything yourself.

Yup, that's what I found out after playing with NSMatrix and
NSCollectionView with all the implementation requirements seemed to be
an overkill coding-wise. I went the subclassing NSView and drawing
with CG route, just got a few bits to polish off now. :-)


Cheers,

--
Igor
___

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

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

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

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


Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Instead of passing my operation a target and selector, is there any way I can 
just pass it a block, but then have it execute that block on the main thread?

TIA,
Rick

___

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

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

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

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


Re: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Clark Cox
On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
> Instead of passing my operation a target and selector, is there any way I can 
> just pass it a block, but then have it execute that block on the main thread?

[[NSOperationQueue mainQueue] addOperationWithBlock: ^{
...
}];

or:

dispatch_async(dispatch_get_main_queue(), ^{
...
});


-- 
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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Thanks!

On Mar 15, 2010, at 14:35:39, Clark Cox wrote:

> On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
>> Instead of passing my operation a target and selector, is there any way I 
>> can just pass it a block, but then have it execute that block on the main 
>> thread?
> 
> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>...
> }];
> 
> or:
> 
> dispatch_async(dispatch_get_main_queue(), ^{
>...
> });
> 
> 
> -- 
> 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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Oh, hmm. I guess my blocks can't receive parameters in this case.

On Mar 15, 2010, at 14:35:39, Clark Cox wrote:

> On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
>> Instead of passing my operation a target and selector, is there any way I 
>> can just pass it a block, but then have it execute that block on the main 
>> thread?
> 
> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>...
> }];
> 
> or:
> 
> dispatch_async(dispatch_get_main_queue(), ^{
>...
> });
> 
> 
> -- 
> 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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Oh! Sorry for the noise, but I think I can do this:

[[NSOperationQueue mainQueue] addOperationWithBlock: ^{
   myProvidedBlock(param1, param2);
}];


On Mar 15, 2010, at 14:35:39, Clark Cox wrote:

> On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
>> Instead of passing my operation a target and selector, is there any way I 
>> can just pass it a block, but then have it execute that block on the main 
>> thread?
> 
> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>...
> }];
> 
> or:
> 
> dispatch_async(dispatch_get_main_queue(), ^{
>...
> });
> 
> 
> -- 
> 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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
Correct, because when you dispatch a block to a queue, the queue has no 
parameters to give to the block.  It also has no place to return to.  Hence the 
block signature is "void (^)(void)".

Dave

On Mar 15, 2010, at 3:43 PM, Rick Mann wrote:

> Oh, hmm. I guess my blocks can't receive parameters in this case.


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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Clark Cox
Indeed, such is the power of blocks :)

On Mon, Mar 15, 2010 at 2:45 PM, Rick Mann  wrote:
> Oh! Sorry for the noise, but I think I can do this:
>
> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>   myProvidedBlock(param1, param2);
> }];
>
>
> On Mar 15, 2010, at 14:35:39, Clark Cox wrote:
>
>> On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
>>> Instead of passing my operation a target and selector, is there any way I 
>>> can just pass it a block, but then have it execute that block on the main 
>>> thread?
>>
>> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>>    ...
>> }];
>>
>> or:
>>
>> dispatch_async(dispatch_get_main_queue(), ^{
>>    ...
>> });
>>
>>
>> --
>> Clark S. Cox III
>> clarkc...@gmail.com
>
>



-- 
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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Then again, what I was doing before was really:

[mTarget performSelectorOnMainThread: mSelector withObejct: data waitUntilDone: 
true];

which I don't see how to do with 1[addOperationWithBlock:];

On Mar 15, 2010, at 14:46:28, Clark Cox wrote:

> Indeed, such is the power of blocks :)
> 
> On Mon, Mar 15, 2010 at 2:45 PM, Rick Mann  wrote:
>> Oh! Sorry for the noise, but I think I can do this:
>> 
>> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>>   myProvidedBlock(param1, param2);
>> }];
>> 
>> 
>> On Mar 15, 2010, at 14:35:39, Clark Cox wrote:
>> 
>>> On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
 Instead of passing my operation a target and selector, is there any way I 
 can just pass it a block, but then have it execute that block on the main 
 thread?
>>> 
>>> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>>>...
>>> }];
>>> 
>>> or:
>>> 
>>> dispatch_async(dispatch_get_main_queue(), ^{
>>>...
>>> });
>>> 
>>> 
>>> --
>>> Clark S. Cox III
>>> clarkc...@gmail.com
>> 
>> 
> 
> 
> 
> -- 
> 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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
Yep, that's legal.

Dave

On Mar 15, 2010, at 3:45 PM, Rick Mann wrote:

> Oh! Sorry for the noise, but I think I can do this:
> 
> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>   myProvidedBlock(param1, param2);
> }];


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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Clark Cox
You could do:

NSOperation *op = [NSBlockOperation blockOperationWithBlock: ^{
...
}];
[NSOperationQueue mainQueue] addOperations: [NSArray arrayWithObject:
op] waitUntilFinished: YES]

or:

dispatch_sync(dispatch_get_main_queue(), ^{
...
});

but be very careful that you aren't already running on the main
thread, as you could deadlock.

On Mon, Mar 15, 2010 at 2:47 PM, Rick Mann  wrote:
> Then again, what I was doing before was really:
>
> [mTarget performSelectorOnMainThread: mSelector withObejct: data 
> waitUntilDone: true];
>
> which I don't see how to do with 1[addOperationWithBlock:];
>
> On Mar 15, 2010, at 14:46:28, Clark Cox wrote:
>
>> Indeed, such is the power of blocks :)
>>
>> On Mon, Mar 15, 2010 at 2:45 PM, Rick Mann  wrote:
>>> Oh! Sorry for the noise, but I think I can do this:
>>>
>>> [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
>>>   myProvidedBlock(param1, param2);
>>> }];
>>>
>>>
>>> On Mar 15, 2010, at 14:35:39, Clark Cox wrote:
>>>
 On Mon, Mar 15, 2010 at 2:32 PM, Rick Mann  wrote:
> Instead of passing my operation a target and selector, is there any way I 
> can just pass it a block, but then have it execute that block on the main 
> thread?

 [[NSOperationQueue mainQueue] addOperationWithBlock: ^{
    ...
 }];

 or:

 dispatch_async(dispatch_get_main_queue(), ^{
    ...
 });


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



-- 
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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
You could put your block into an NSBlockOperation, and then use the queue's 
addOperations:waitUntilFinished: method to execute it.

Cheers,

Dave

On Mar 15, 2010, at 3:47 PM, Rick Mann wrote:

> Then again, what I was doing before was really:
> 
> [mTarget performSelectorOnMainThread: mSelector withObejct: data 
> waitUntilDone: true];
> 
> which I don't see how to do with 1[addOperationWithBlock:];


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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Rick Mann
Yep, thanks to both of you for that insight. Interesting there's not a 
single-block version of that call.

On Mar 15, 2010, at 14:58:39, Dave DeLong wrote:

> You could put your block into an NSBlockOperation, and then use the queue's 
> addOperations:waitUntilFinished: method to execute it.
> 
> Cheers,
> 
> Dave
> 
> On Mar 15, 2010, at 3:47 PM, Rick Mann wrote:
> 
>> Then again, what I was doing before was really:
>> 
>> [mTarget performSelectorOnMainThread: mSelector withObejct: data 
>> waitUntilDone: true];
>> 
>> which I don't see how to do with 1[addOperationWithBlock:];

___

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

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

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

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


Re: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Keith Duncan

On 15 Mar 2010, at 21:47, Rick Mann wrote:

> Then again, what I was doing before was really:
> 
> [mTarget performSelectorOnMainThread: mSelector withObejct: data 
> waitUntilDone: true];

In which case:

NSBlockOperation *blockOperation = [NSBlockOperation blockOperationWithBlock:^ {
...
}];
[[NSOperationQueue mainQueue] addOperation:blockOperation];
[blockOperation waitUntilFinished];

or

dispatch_sync(dispatch_get_main_queue(), ^ {
...
});


Keith

___

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

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

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

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


NSTrackingArea Problem

2010-03-15 Thread Richard Somers

I have a view in a window with a tracking area set up.

- (void)initializeTracking
{
 NSRect rect = [self frame];
 rect.origin.x = 0.0;
 rect.origin.y = 0.0;
 _trackingArea = [[NSTrackingArea alloc] initWithRect:rect  
options:(NSTrackingMouseEnteredAndExited | NSTrackingMouseMoved |  
NSTrackingActiveWhenFirstResponder | NSTrackingInVisibleRect)  
owner:self userInfo:nil];

 [self addTrackingArea:_trackingArea];
}

There is also a panel.

1. With the mouse inside the view, a keyboard shortcut is entered to  
bring up the panel.


2. Move the mouse outside the view, and then close the panel (with  
keyboard shortcut, window close box, or with the menu, it does not  
matter).


3. Move the mouse back inside the view and mouse moved tracking has  
stopped. That is the problem. Mouse moved tracking should be active  
but it is not.


4. Move the mouse outside the view and back in again and now mouse  
tracking is active again.


Any clues as to why mouse tracking stops on step 3?

--Richard

___

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

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

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

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


RE: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Jeff Laing
> Not necessarily true. While you are free to specify a delegate as
> NSObject , it is not standard convention. The convention
> for delegates is:  id.

As I recall, sending variables of type id useful messages like 
retain and release generate a compiler warning, whereas NSObject 
are fine.

I could be wrong on this, but I definitely recall thinking it was a stupid 
compiler behavior.

However, being totally anal, if you are going to document to the caller all the 
protocols that you require an object to respect, you should do it properly.  
Which probably means using id - if you put it in a 
dictionary, you need , 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: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread David Duncan
On Mar 15, 2010, at 3:22 PM, Jeff Laing wrote:

> As I recall, sending variables of type id useful messages like 
> retain and release generate a compiler warning, whereas 
> NSObject are fine.
> 
> I could be wrong on this, but I definitely recall thinking it was a stupid 
> compiler behavior.

This is because you didn't declare your protocol as extending the NSObject 
protocol. If you do something like this:

@protocol MyProtocol

Then you can call all the NSObject stuff without warning.
--
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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Thomas Davie
Just for reference's sake:

@interface NSObject (BlockOnMainThread)

- (void)performBlockOnMainThread:(void(^block)());

@end

@interface NSObject (BlockOnMainThreadPrivate)

- (void)performBlock:(void(^block)());

@end

@implementation NSObject (BlockOnMainThread)

- (void)performBlockOnMainThread:(void(^block)())
{
[self performSelector:(performBlock:) withObject:[block copy] 
waitUntilDone:YES];
}

- (void)performBlock:(void(^block)())
{
block();
[block release];
}

@end

Note though, this was typed entirely into my email client, so YMMV.

Bob

On 15 Mar 2010, at 22:01, Keith Duncan wrote:

> 
> On 15 Mar 2010, at 21:47, Rick Mann wrote:
> 
>> Then again, what I was doing before was really:
>> 
>> [mTarget performSelectorOnMainThread: mSelector withObejct: data 
>> waitUntilDone: true];
> 
> In which case:
> 
> NSBlockOperation *blockOperation = [NSBlockOperation 
> blockOperationWithBlock:^ {
>   ...
> }];
> [[NSOperationQueue mainQueue] addOperation:blockOperation];
> [blockOperation waitUntilFinished];
> 
> or
> 
> dispatch_sync(dispatch_get_main_queue(), ^ {
>   ...
> });
> 
> 
> Keith
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/tom.davie%40gmail.com
> 
> This email sent to tom.da...@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: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Alexander Spohr

Am 15.03.2010 um 23:22 schrieb Jeff Laing:

> As I recall, sending variables of type id useful messages like 
> retain and release generate a compiler warning, whereas 
> NSObject are fine.
> 
> I could be wrong on this, but I definitely recall thinking it was a stupid 
> compiler behavior.

You can let your protocol include the NSObjects protocol and get rid of the 
warnings.

@protocol YourProtocol 

atze

___

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

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

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

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


RE: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Jeff Laing
> > I could be wrong on this, but I definitely recall thinking it was a
> stupid compiler behavior.
> 
> This is because you didn't declare your protocol as extending the
> NSObject protocol. If you do something like this:
> 
> @protocol MyProtocol
> 
> Then you can call all the NSObject stuff without warning.

But my protocol only wanted to define the methods in my protocol - a nice clean 
Interface definition that's independent of all other definitions.  After all, 
Apple might add some non-optional methods to NSObject (ok, that's unlikely) 
that all objects implementing my protocol would suddenly fail to compile on.  

Objects could implement MyProtocol *without* implementing NSObject and still be 
completely useful functionality.  They just couldn't be used by code that has 
chosen to do *other* things to them as well.

To keep the discussion from descending into the foolishly abstract, consider 
NSCopying as the protocol instead.  If I want to let you know that the delegate 
will be stored in a dictionary, I would define the delegate as 
id.  Would you seriously think it was a good 
style to declare @protocol MyProtocol ?

In my opinion, this is a case where interface definitions are being specified 
badly to get around an implementation problem.

Sure, the delegate they pass in will *probably* be a subclass of NSObject but 
its not a given, as far as the compiler is concerned.  If it must be, then 
declare it properly.

I don't think people understand that id specifies a hell 
of a lot less than NSObject - all the categories on class NSObject 
for a start.
___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread Greg Parker
On Mar 15, 2010, at 3:35 PM, David Duncan wrote:
> On Mar 15, 2010, at 3:22 PM, Jeff Laing wrote:
>> As I recall, sending variables of type id useful messages like 
>> retain and release generate a compiler warning, whereas 
>> NSObject are fine.
>> 
>> I could be wrong on this, but I definitely recall thinking it was a stupid 
>> compiler behavior.
> 
> This is because you didn't declare your protocol as extending the NSObject 
> protocol. If you do something like this:
> 
> @protocol MyProtocol
> 
> Then you can call all the NSObject stuff without warning.

Well, some of the NSObject stuff. NSObject protocol is a subset of NSObject 
class. 

If you only use the basics - like retain/release/autorelease, 
respondsToSelector:, performSelector - then NSObject protocol is sufficient. 
Other more recent additions are part of NSObject class only.


-- 
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: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Gerd Knops

On Mar 15, 2010, at 4:32 PM, Rick Mann wrote:

> Instead of passing my operation a target and selector, is there any way I can 
> just pass it a block, but then have it execute that block on the main thread?

Note that the methods listed so far will cause a deadlock if called from the 
main thread.

For the non-parameters form I use the below as a category on NSObject, should 
be trivial to add arguments.

Gerd

- (void)runOnMainQueue:(void (^)(void))aBlock {

//
// Execute *aBlock* on the main queue/thread.
//
// # Parameters
// aBlock
// :The block to be executed.
// 
// # Discussion
// When called from the main queue the block is executed immediately.
// Otherwise the block will be scheduled for execution on the main 
queue,
// the method will return after the block was executed.
// 
if(dispatch_get_current_queue()==dispatch_get_main_queue())
{
aBlock();
}
else
{
dispatch_sync(dispatch_get_main_queue(),aBlock);
}
}

___

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

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

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

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


Re: Private ivars, not marked as IBOutlet, visible in IB

2010-03-15 Thread David Duncan
On Mar 15, 2010, at 3:49 PM, Jeff Laing wrote:

> But my protocol only wanted to define the methods in my protocol - a nice 
> clean Interface definition that's independent of all other definitions.  
> After all, Apple might add some non-optional methods to NSObject (ok, that's 
> unlikely) that all objects implementing my protocol would suddenly fail to 
> compile on.  

Unless you are going to be working with objects that don't descend from 
NSObject (the class) then extending NSObject (the protocol) should not be an 
issue. From the documentation on the NSObject Protocol:

"The NSObject protocol groups methods that are fundamental to all Objective-C 
objects.

If an object conforms to this protocol, it can be considered a first-class 
object. Such an object can be asked about its:

• Class, and the place of its class in the inheritance hierarchy
• Conformance to protocols
• Ability to respond to a particular message
In addition, objects that conform to this protocol—with its retain, release, 
and autorelease methods—can also integrate with the object management and 
deallocation scheme defined in Foundation (for more information see, for 
example, Memory Management Programming Guide for Cocoa). Thus, an object that 
conforms to the NSObject protocol can be managed by container objects like 
those defined by NSArray and NSDictionary.

The Cocoa root class, NSObject, adopts this protocol, so all objects inheriting 
from NSObject have the features described by this protocol."

On a practical note, many of the protocols that you work with in Cocoa and 
Cocoa Touch also declare that they extend NSObject, so this assumption has 
already been made for you in many places.
--
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: NSTrackingArea Problem

2010-03-15 Thread Quincey Morris
On Mar 15, 2010, at 15:18, Richard Somers wrote:

> 1. With the mouse inside the view, a keyboard shortcut is entered to bring up 
> the panel.
> 
> 2. Move the mouse outside the view, and then close the panel (with keyboard 
> shortcut, window close box, or with the menu, it does not matter).
> 
> 3. Move the mouse back inside the view and mouse moved tracking has stopped. 
> That is the problem. Mouse moved tracking should be active but it is not.
> 
> 4. Move the mouse outside the view and back in again and now mouse tracking 
> is active again.

You likely need to use the NSTrackingAssumeInside option. The actual behavior 
of this option is not as documented. IIRC, without this option the tracking 
isn't going to start reliably until you exit and re-enter the area.

(This may not be that scenario, but I'd try the option first. There really 
isn't any reason I know about *not* to use the option.)


___

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

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

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

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


Core data backed UITableView

2010-03-15 Thread Damien Cooke
Hi all,
Here is the dumb question for the day.

I have a coredata backed UITableView.  I populate a NSFetchedResultsController 
and use that to source the rows and sections etc.  All works well.
That is until I go to delete an item from the table.


- (void)tableView:(UITableView *)tableView 
commitEditingStyle:(UITableViewCellEditingStyle)editingStyle 
forRowAtIndexPath:(NSIndexPath *)indexPath
{
NSLog(@"commitEditingStyle called");
TheEntity *myEntity = (VideoEntity *) [fetchedResultsController 
objectAtIndexPath:indexPath];

NSManagedObjectContext *context = [[self fetchedResultsController] 
managedObjectContext];   
[context deleteObject:myEntity];

//commit the delete
NSError *saveError = nil;
if (![context save:&saveError]) {
NSLog(@"CoreData save Failure");
}else {
//all good removed from coredata
//now delete from tableView

[self.myTableView deleteRowsAtIndexPaths:[NSArray 
arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
}

Then I get an error like

*** Assertion failure in -[UITableView _endCellAnimationsWithContext:], 
/SourceCache/UIKit/UIKit-984.38/UITableView.m:774
*** Terminating app due to uncaught exception 
'NSInternalInconsistencyException', reason: 'Invalid update: invalid number of 
rows in section 0.  The number of rows contained in an existing section after 
the update (3) must be equal to the number of rows contained in that section 
before the update (3), plus or minus the number of rows inserted or deleted 
from that section (0 inserted, 1 deleted).'

This appears to mean I need to remove it from the fetchedResultsController 
before I remove it from the table.  So as NSFetchedResultsController has no 
remove facility I reload it.  Is there a more efficient way of achieving this?

Regards
Damien


___

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

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

Help/Unsubscribe/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 backed UITableView

2010-03-15 Thread mmalc Crawford

On Mar 15, 2010, at 5:33 pm, Damien Cooke wrote:

>   [self.myTableView deleteRowsAtIndexPaths:[NSArray 
> arrayWithObject:indexPath] withRowAnimation:UITableViewRowAnimationFade];
> 
Why are you doing this rather than (in addition to? which if so would probably 
be the cause of the problem) simply implementing the fetched results controller 
delegate methods as shown in the documentation 
()
 and in the Navigation-based Application template?

mmalc

___

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

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

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

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


Core Data Autoincrement?

2010-03-15 Thread William Squires
Is there a way (in a Core Data entity) to make an attribute that's  
like a relational DB "autoincrement" field? Or, failing that, does an  
object of class (or subclass) NSManagedObject inherit a "unique"  
UInt32 value that can reliably differentiate it from any other  
instance being managed by the NSManagedObjectContext in use?


___

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

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

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

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


Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Dave Fernandes

On 2010-03-15, at 3:30 PM, Ben Trumbull wrote:

> Running an integrity check can be useful if you have previously gotten a 
> corrupt db error back from fetching or saving, or your app previously 
> crashed, or you have some other active indicator it might be worthwhile.  
> However, it's quiet expensive in I/O and you should not do it on every app 
> launch / document open.  Customers with account home directories on AFP, NFS 
> or SMB servers will be very unhappy, and if your files become large enough so 
> will people using local drives.

That's a shame. It would certainly be easier to check when opening the file 
than to scatter code all over the app to diagnose the problem. Is there a 
standard exception I can expect to get when fetching or saving? 
NSInternalInconsistencyException is the one I currently get.

Thanks,
Dave___

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

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

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

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


Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Ben Trumbull

On Mar 15, 2010, at 7:49 PM, Dave Fernandes wrote:

> 
> On 2010-03-15, at 3:30 PM, Ben Trumbull wrote:
> 
>> Running an integrity check can be useful if you have previously gotten a 
>> corrupt db error back from fetching or saving, or your app previously 
>> crashed, or you have some other active indicator it might be worthwhile.  
>> However, it's quiet expensive in I/O and you should not do it on every app 
>> launch / document open.  Customers with account home directories on AFP, NFS 
>> or SMB servers will be very unhappy, and if your files become large enough 
>> so will people using local drives.
> 
> That's a shame. It would certainly be easier to check when opening the file 
> than to scatter code all over the app to diagnose the problem. Is there a 
> standard exception I can expect to get when fetching or saving? 
> NSInternalInconsistencyException is the one I currently get.


You should generally get an NSError with the code that is 
NSFileReadCorruptFileError.  In gdb, what does:

>future-break objc_exception_throw
>future-break +[NSError errorWithDomain:code:userInfo:]

...

>info threads
>thread apply all bt

say ?

The only place you should get an exception is if you try to fault in an object 
that is unreachable.  Either because the database was deleted or corrupted, or 
because another thread / context deleted that object you wanted before you and 
you only held the reference instead of getting all the data at once (e.g. race 
on delete)

- 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


NSTableView Tab Action

2010-03-15 Thread Курганский Сергей
When editing cell in the last column of NSTableView, pushing "Tab" button just 
ends editing. Is there any way to change it's default behavior ? I want it to 
go to the first (or second) cell in the next 
row.___

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

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

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

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


Re: Which iPhone Program?

2010-03-15 Thread Don Quixote de la Mancha
What I really need to know is how many developer seats each program
gets.  I need for three of us to be able to do our own builds, and for
us all to be able to install on our own machines.  My two QA people
are in other cities, so I can't do it for them.

On Sat, Mar 13, 2010 at 4:59 AM, Alexander Spohr  wrote:
> PS. I’d think all this info is on Apple’s site somewhere...

Actually it's not.  I looked pretty carefully before I wrote to the list.

Thanks,

Don Quixote
-- 
Don Quixote de la Mancha
quix...@dulcineatech.com
http://www.dulcineatech.com

   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
___

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

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

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

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


Re: Deleted Ressource folder

2010-03-15 Thread Don Quixote de la Mancha
On Sun, Mar 14, 2010 at 9:33 AM, Scott Andrew
 wrote:
>  This is where source control comes in handy. Even if its using git to keep 
> source control local in the project folder.

I don't know about git, but with Subversion one can install a
post-commit hook that runs the hot-backup.py script to backup your
entire repository after every commit.  On my Linux box I have a cron
job that copies that backup from my internal drive to an external one.
 Once a week I swap that external drive with one that I keep in a bank
safe deposit back.

I Got Religion after losing the third hard drive of my career.

Don Quixote
-- 
Don Quixote de la Mancha
quix...@dulcineatech.com
http://www.dulcineatech.com

   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
___

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

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

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

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


Re: mount dmg disk

2010-03-15 Thread Don Quixote de la Mancha
On Sun, Mar 14, 2010 at 12:22 PM, gMail.com  wrote:
> I can't find a way in Cocoa to mount a dmg disk.
> So I would try to call the shell through a NSTask.

I think you really want to do that via the APIs in the Disk
Arbitration framework.

Unfortunately it's rather poorly documented, but it does work if you
can figure it out.

I might have some sample code I could dig up if you're not able to
figure it out on your own.

Don Quixote
-- 
Don Quixote de la Mancha
quix...@dulcineatech.com
http://www.dulcineatech.com

   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
___

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

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

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

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


Re: mount dmg disk

2010-03-15 Thread Don Quixote de la Mancha
On Sun, Mar 14, 2010 at 6:42 PM, Kyle Sluder  wrote:
> This is incorrect. Unix convention requires the program name be the
> first argument.

Just to clarify, there are a couple reasons for this.

The first is that one can use a single binary to implement more than
one command line program.  Which identity the program adopts is
determined by the value of argv[ 0 ].  If you don't supply argv[ 0 ]
at all, the program may not know what to do.  The identity is supplied
by symbolically linking the extra identities, with the link's name
being the program you want it to act as.

For example, the bash shell has lots of extra features that the
traditional Bourne shell doesn't provide.  But if you execute bash as
/bin/sh, it runs in Bourne-shell compatible mode, and doesn't provide
any of those extra features.

A more extreme example is BusyBox, a single executable which
implements dozens of command-line programs for embedded Linux systems.
 This saves quite a lot of both filesystem and virtual memory space by
providing just one implementation of a lot of common functionality.

The other reason is that some programs use argv[ 0 ] in error
messages, to give the name of the program.  That way you can name the
executable anything you like, and error messages will always be
correct.

Don Quixote
-- 
Don Quixote de la Mancha
quix...@dulcineatech.com
http://www.dulcineatech.com

   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
___

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

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

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

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


secure cookie?

2010-03-15 Thread Horst Jäger
Hi,

it says in the NSHTTPCookieStorage class reference:

"NSHTTPCookieStorage implements a singleton object (shared instance) that 
manages the shared cookie storage. These cookies are shared among all 
applications and are kept in sync cross-process."

I need the opposite thing.

Is it possible to write an App so that the cookies it receives are 
Is it possible to make a cookie absolutely safe, so that it can only by 
accessed my app?

Thanks in advance


Horst___

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

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

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

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


Re: Cut and paste out of/ into text fields in a separate window doesn't work

2010-03-15 Thread Don Quixote de la Mancha
On Mon, Mar 15, 2010 at 10:15 AM, Steven Degutis
 wrote:
> In my experience, Firefox (and thus
> probably other Mozilla apps) isn't even a native Cocoa app, it just pretends
> to be one, so I wouldn't doubt it if it doesn't even *have* a Responder
> Chain.

I am quite certain that none of the Mozilla apps are Cocoa-native.
They are all written using the Mozilla Cross-Platform Application
Framework.  There is a book about how to write cross-platform apps
with that framework.

Any cross-platform framework ultimately has to call through to
platform-specific APIs, but it's likely that it does so only in a very
primitive, low-level way.

Firefox plugins *should* be able to handle the clipboard just like any
other user interface code.  But to do so, Firefox would need to
provide the necessary support.  There's no reason it couldn't.  Either
it just doesn't, or it tries to but it is buggy.

Don Quixote
-- 
Don Quixote de la Mancha
quix...@dulcineatech.com
http://www.dulcineatech.com

   Dulcinea Technologies Corporation: Software of Elegance and Beauty.
___

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

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

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

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


first responder

2010-03-15 Thread koko

I have two views in a window content view.

One view is custom the other is an NSTabView containing two items.

Each of these three views contain actions for menu items.

They do not get first responder until they are clicked in.

Can all three views be active in the responder chain without having to  
first click the view?


koko
___

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

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

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

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


Re: Populating TableView with Web Services in Cocoa

2010-03-15 Thread Nick Rawlins

Thanks Scott,

Do you have a link for this example?
Thanks

Nick

Sent from my iPhone

On 14 Mar 2010, at 08:19, Scott Anguish  wrote:



On Mar 13, 2010, at 3:43 AM, Nick Rawlins wrote:


Hi,

I would like to populate a TableView with data from a web service.

I would also like to send requests back and fourth depening on what
the user does on an iPhone.


Does anyone have an example or info on a simular application?



I think the earthquake example code gets the data from a web service.




___

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

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

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

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


Re: first responder

2010-03-15 Thread Graham Cox

On 16/03/2010, at 8:21 AM, k...@highrolls.net wrote:

> Can all three views be active in the responder chain without having to first 
> click the view?


Only if they have a parent-child relationship. If they are siblings, then no. 
(Obvious really, if you had two side-by-side views both "first" responder, who 
gets the key events?)

--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: Core Data Autoincrement?

2010-03-15 Thread Ben Trumbull
> Is there a way (in a Core Data entity) to make an attribute that's  
> like a relational DB "autoincrement" field? Or, failing that, does an  
> object of class (or subclass) NSManagedObject inherit a "unique"  
> UInt32 value that can reliably differentiate it from any other  
> instance being managed by the NSManagedObjectContext in use?

Each managed object has an objectID that is unique and automatically assigned.  
NSManagedObjectID are opaque value classes, but you can serialize the 
-URIRepresentation of an objectID.  Mutating the URI form and then reimporting 
it is unsupported with extreme prejudice.

If you must have an int32 autoincremented, you'll need to create your own.  You 
can create an entity with a single row to store the integer and update it 
transactionally.

- 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: secure cookie?

2010-03-15 Thread Jens Alfke

On Mar 15, 2010, at 5:50 AM, Horst Jäger wrote:

> Is it possible to write an App so that the cookies it receives are 
> Is it possible to make a cookie absolutely safe, so that it can only by 
> accessed my app?

OS X or iPhone? On iPhone, I believe that cookies are not shared between apps.

—Jens___

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

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

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

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


Re: Checking integrity of a Core Data document with SQLite store

2010-03-15 Thread Dave Fernandes
Yes, the exception occurs when the UI attempts to fault in an object for 
display. (The display code coalesces updates, which is why the stack trace 
starts with __NSFireDelayedPerform ).

On 2010-03-15, at 11:03 PM, Ben Trumbull wrote:

> 
> You should generally get an NSError with the code that is 
> NSFileReadCorruptFileError.  In gdb, what does:
> 
> >future-break objc_exception_throw
> >future-break +[NSError errorWithDomain:code:userInfo:]
> 
> ...
> 
> >info threads
> >thread apply all bt
> 
> say ?

(gdb) info threads
  4 port# 0x8b3b 0x7fff8064d9da in __workq_kernreturn ()
  2 port# 0x1703 0x7fff8064cbba in kevent ()
* 1 port# 0xa0f  0x7fff80a7a0da in objc_exception_throw ()
(gdb) thread apply all bt

Thread 4 (process 705):
#0  0x7fff8064d9da in __workq_kernreturn ()
#1  0x7fff8064ddec in _pthread_wqthread ()
#2  0x7fff8064da55 in start_wqthread ()

Thread 2 (process 705):
#0  0x7fff8064cbba in kevent ()
#1  0x7fff8064ea85 in _dispatch_mgr_invoke ()
#2  0x7fff8064e75c in _dispatch_queue_invoke ()
#3  0x7fff8064e286 in _dispatch_worker_thread2 ()
#4  0x7fff8064dbb8 in _pthread_wqthread ()
#5  0x7fff8064da55 in start_wqthread ()

Thread 1 (process 705):
#0  0x7fff80a7a0da in objc_exception_throw ()
#1  0x7fff802c in _execute ()
#2  0x7fff80888126 in -[NSSQLiteConnection execute] ()
#3  0x7fff808a5eda in -[NSSQLChannel selectRowsWithCachedStatement:] ()
#4  0x7fff8089780d in -[NSSQLCore 
_newRowsForFetchPlan:selectedBy:withArgument:] ()
#5  0x7fff8088fd2b in -[NSSQLCore newRowsForFetchPlan:] ()
#6  0x7fff808b23c7 in -[NSSQLCore 
newFetchedPKsForSourceID:andRelationship:] ()
#7  0x7fff808b1f2d in -[NSSQLCore 
retainedRelationshipDataWithSourceID:forRelationship:withContext:] ()
#8  0x7fff808b1b67 in -[NSFaultHandler 
retainedFulfillAggregateFaultForObject:andRelationship:withContext:] ()
#9  0x7fff808b16cc in -[_NSFaultingMutableSet willRead] ()
#10 0x7fff8091a82b in -[_NSFaultingMutableSet objectEnumerator] ()
#11 0x00010001a831 in -[BarGraph updateValues] (self=0x102678660, 
_cmd=0x100078359) at /Users/davef/Documents/♣ 
HCT/Projects/SpeechClinic/Source/BarGraph.m:380
#12 0x00010001a36c in -[BarGraph updateState] (self=0x102678660, 
_cmd=0x100078366) at /Users/davef/Documents/♣ 
HCT/Projects/SpeechClinic/Source/BarGraph.m:321
#13 0x00010001ae5c in -[BarGraph draw] (self=0x102678660, 
_cmd=0x7fff863f60d0) at /Users/davef/Documents/♣ 
HCT/Projects/SpeechClinic/Source/BarGraph.m:443
#14 0x00010006de60 in -[ChartImage renderForCellSize:] (self=0x102679ae0, 
_cmd=0x100079c5d, cellSize={width = 100, height = 100}) at 
/Users/davef/Documents/♣ HCT/Projects/SpeechClinic/Source/ChartImage.m:65
#15 0x00010006b4fe in -[ChartBrowserController updateViews] 
(self=0x102677050, _cmd=0x100081138) at /Users/davef/Documents/♣ 
HCT/Projects/SpeechClinic/Source/ChartBrowserController.m:267
#16 0x7fff81c64434 in __NSFireDelayedPerform ()
#17 0x7fff8453ca58 in __CFRunLoopRun ()
#18 0x7fff8453ac2f in CFRunLoopRunSpecific ()
#19 0x7fff81eeca4e in RunCurrentEventLoopInMode ()
#20 0x7fff81eec7b1 in ReceiveNextEventCommon ()
#21 0x7fff81eec70c in BlockUntilNextEventMatchingListInMode ()
#22 0x7fff85cff1f2 in _DPSNextEvent ()
#23 0x7fff85cfeb41 in -[NSApplication 
nextEventMatchingMask:untilDate:inMode:dequeue:] ()
#24 0x7fff85cc4747 in -[NSApplication run] ()
#25 0x7fff85cbd468 in NSApplicationMain ()
#26 0x00013d36 in main (argc=1, argv=0x7fff5fbff668) at 
/Users/davef/Documents/♣ HCT/Projects/SpeechClinic/Source/main.m:25

___

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

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

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

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


Re: Which iPhone Program?

2010-03-15 Thread Scott Anguish

On Mar 14, 2010, at 9:21 AM, Don Quixote de la Mancha wrote:

> What I really need to know is how many developer seats each program
> gets.  I need for three of us to be able to do our own builds, and for
> us all to be able to install on our own machines.  My two QA people
> are in other cities, so I can't do it for them.
> 
> On Sat, Mar 13, 2010 at 4:59 AM, Alexander Spohr  wrote:
>> PS. I’d think all this info is on Apple’s site somewhere...
> 
> Actually it's not.  I looked pretty carefully before I wrote to the list.

At this point, I’d suggest contacting WWDR directly.


Scott
Moderator___

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

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

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

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


Re: NSTrackingArea Problem

2010-03-15 Thread Richard Somers

On Mar 15, 2010, at 15:18, Richard Somers wrote:

1. With the mouse inside the view, a keyboard shortcut is entered to  
bring up the panel.


2. Move the mouse outside the view, and then close the panel (with  
keyboard shortcut, window close box, or with the menu, it does not  
matter).


3. Move the mouse back inside the view and mouse moved tracking has  
stopped. That is the problem. Mouse moved tracking should be active  
but it is not.


4. Move the mouse outside the view and back in again and now mouse  
tracking is active again.



On Mar 15, 2010, at 5:53 PM, Quincey Morris wrote:

You likely need to use the NSTrackingAssumeInside option. The actual  
behavior of this option is not as documented. IIRC, without this  
option the tracking isn't going to start reliably until you exit and  
re-enter the area.



Thanks for looking at this but unfortunately the suggestion did not  
work.


My application is document based with an inspector panel similar to  
this.


 http://borkware.com/rants/inspectors/

At step 3 above the document window is key and the view contained  
there in is the first responder but mouse moved tracking does not  
work. Mouse moved tracking works if you exit and re-enter the view.


Various NSTrackingAreaOptions produce the following results.

 NSTrackingActiveWhenFirstResponder: should work but does not.

 NSTrackingAssumeInside: using this modifier does not help, same  
problem.


 NSTrackingActiveInKeyWindow: same problem.

 NSTrackingActiveInActiveApp: fixes the problem but with the side  
effect that tracking is active all the time now (when the app is  
active).


--Richard

___

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

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

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

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