Re: Doc on Controller Content vs. Parameters in Interface Builder Bindings panel ?

2009-02-23 Thread mmalc Crawford


On Feb 22, 2009, at 11:54 PM, Guillaume Laurent wrote:

I've googled around quite a bit but can't seem to find a full  
reference on all the settings of the Bindings panel in Interface  
Builder.





In particular, in the case of a controller object  
(NSArrayController) and a Core Data model,




It's not clear what relevance a Core Data model is here.
If, as would seem to be the case, you're trying to learn Core Data and  
Cocoa Bindings at the same time, don't:



I'm not sure what the distinction is between the "Controller  
Content" ones and the "Parameter" ones.





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


Re: Relaunching App Programmatically - Terminal Window Shows up

2009-02-23 Thread Oleg Krupnov
Hi Daniel,
Thanks! I have found a better approach though, IMHO. I pass the path to the
application bundle and also the process ID as two args to the script ($1,
$2). In result, I make sure that exactly the calling process is shut down,
and exactly the same executable is relaunched. The only "problem" that
remains is that if more instances of the same bundle with the same path are
already launched, a new instance is not created, but activated an existing
one. Though I believe, this behavior is perfectly valid, because if one
clicks the bundle in Finder, the same thing happens.

Here is my code:

i="10"

while [ $i -gt 0 ]

do

  sleep 1



  is_running=$(osascript -e 'tell application "System Events" to exists
(process 1 whose unix id is '$2')')

  echo "Waiting for shutdown: " $is_running

  if [ "$is_running" = "false" ]; then

i="0"

  else

i=$(($i - 1))

  fi

done


# relaunch the app

osascript -e 'tell application "'"$1"'" to activate'


On Mon, Feb 23, 2009 at 10:52 AM, Daniel Waylonis  wrote:

> On Feb 22, 2009, at 10:46 AM, Oleg Krupnov wrote:
>
> Thanks, Dan! Sorry for the delay. Your code really works, and I likely will
> use it. I only have a little doubt in that if I refer to the app by its
> name, problems may occur when there are multiple instances of the app
> running at the same time, or there are multiple copies on disk. Have you
> thought about it?
>
>
> Hi Oleg,
>
> It's possible.  You could check the bundle identifier of the process in
> AppleScript as well:
>
> tell application "System Events"
> try
> bundle identifier of process ""
> end try
> end tell
>
> This will return the bundle ID and you can compare it against what you
> expect.
>
> Dan
>
> -
>
> *Dan Waylonis****d...@nekotech.com*
>
> nekotech SOFTWARE
>
> http://www.nekotech.com
>
> 650.887.3711
>
>
>
>
>
___

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

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

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

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


Re: Programmatically opening an NSComboBox list

2009-02-23 Thread Paul Sanders
Thank you Andy, this looks useful.  I can't *actually* get it to function 
(it will only inspect views contained within its own windows for some 
reason), but I'll talk to the F_Script guys about that.

I'm also looking for a way to trace messages sent to the various objects 
within my app, if anybody knows how to do that.  Some sort of filtering 
might be in order!

Paul.

- Original Message - 
From: "Andy Lee" 
To: "Paul Sanders" 
Cc: "Peter Hudson" ; 
Sent: Sunday, February 22, 2009 6:28 PM
Subject: Re: Programmatically opening an NSComboBox list


On Feb 21, 2009, at 11:11 AM, Paul Sanders wrote:
> And a question: is there a utility, similar to Spy++ under windows,
> Which
> can show you the window and view hierarchy of a running app?  I find
> Spy++
> extremely useful on occasion when doing Windows development.

I think F-Script can do that.

--Andy

___

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

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

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

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


Re: Programmatically opening an NSComboBox list

2009-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2009 at 5:45 AM, Paul Sanders  wrote:
> I'm also looking for a way to trace messages sent to the various objects
> within my app, if anybody knows how to do that.  Some sort of filtering
> might be in order!

Check out TN2124, Mac OS X Debugging Magic:
http://developer.apple.com/technotes/tn2004/tn2124.html

Also look at Instruments.  I just built a quick instrument that logs
every Objective-C message send; you can filter as you like.
Instruments > Build New Instrument > change Type to Cocoa > change
recording to Function > Save.

--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: Programmatically opening an NSComboBox list

2009-02-23 Thread Paul Sanders
Thank you, I'm sure I'll find a use for both of these.  I have seen the 
Technote in fact but had not read as far as the objective-C section.

By 'set Type to Cocoa', I think you mean 'set Type to Objective-C'.  10/10 
apart from that :)

Thanks again - Paul.

- Original Message - 
From: "Kyle Sluder" 
To: "Paul Sanders" 
Cc: "Andy Lee" ; 
Sent: Monday, February 23, 2009 10:58 AM
Subject: Re: Programmatically opening an NSComboBox list


On Mon, Feb 23, 2009 at 5:45 AM, Paul Sanders  
wrote:
> I'm also looking for a way to trace messages sent to the various objects
> within my app, if anybody knows how to do that.  Some sort of filtering
> might be in order!

Check out TN2124, Mac OS X Debugging Magic:
http://developer.apple.com/technotes/tn2004/tn2124.html

Also look at Instruments.  I just built a quick instrument that logs
every Objective-C message send; you can filter as you like.
Instruments > Build New Instrument > change Type to Cocoa > change
recording to Function > Save.

--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: Programmatically opening an NSComboBox list

2009-02-23 Thread Andy Lee

On Feb 23, 2009, at 5:45 AM, Paul Sanders wrote:
Thank you Andy, this looks useful.  I can't *actually* get it to  
function

(it will only inspect views contained within its own windows for some
reason), but I'll talk to the F_Script guys about that.


I took a look and realized I should have pointed you specifically to F- 
Script Anywhere, under the Extras directory.  It's an app that allows  
you to add an "FSA" menu to a running application.  Make sure you see  
the note in the "Read Me" about installing FScript.framework.  Also I  
had to run the Terminal commands in "How to install.txt".


Having done those two things, launch F-Script Anywhere and specify  
what app to hook into.  If that succeeds, go to that app and under the  
FSA menu select "Browser for Target...".  The cursor will change to a  
crosshair allowing to select a window that you want to inspect.   
You'll get a browser window that lets you inspect the window's ivars.   
It also lists all the messages it responds to and allows you to send  
any of those messages.


I don't want to drag this thread too far from the original question,  
so if you want to follow up you may want to start a new thread or, as  
you say, take it elsewhere.  Note that the above is everything I know,  
I'm not an F-Script expert.


--Andy

___

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

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

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

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


Re: Programmatically opening an NSComboBox list

2009-02-23 Thread Paul Sanders
OK, thanks very much, I'll give it a go.  My brain is full, currently, so I 
won't do it straightaway.

As you say, I guess we're not in Kansas anymore.  I'll start a new thread if 
I have anything useful to add.

Rgds - Paul.

- Original Message - 
From: "Andy Lee" 
To: "Paul Sanders" 
Cc: 
Sent: Monday, February 23, 2009 12:16 PM
Subject: Re: Programmatically opening an NSComboBox list


On Feb 23, 2009, at 5:45 AM, Paul Sanders wrote:
> Thank you Andy, this looks useful.  I can't *actually* get it to
> function
> (it will only inspect views contained within its own windows for some
> reason), but I'll talk to the F_Script guys about that.

I took a look and realized I should have pointed you specifically to F-
Script Anywhere, under the Extras directory.  It's an app that allows
you to add an "FSA" menu to a running application.  Make sure you see
the note in the "Read Me" about installing FScript.framework.  Also I
had to run the Terminal commands in "How to install.txt".

Having done those two things, launch F-Script Anywhere and specify
what app to hook into.  If that succeeds, go to that app and under the
FSA menu select "Browser for Target...".  The cursor will change to a
crosshair allowing to select a window that you want to inspect.
You'll get a browser window that lets you inspect the window's ivars.
It also lists all the messages it responds to and allows you to send
any of those messages.

I don't want to drag this thread too far from the original question,
so if you want to follow up you may want to start a new thread or, as
you say, take it elsewhere.  Note that the above is everything I know,
I'm not an F-Script expert.

--Andy

___

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

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

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

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


iTunes like transition?

2009-02-23 Thread Luca Pazzerello
Hi all,Can someone help me to figure out how to make the transition iTunes
uses to switch the artist - album of the playing song?



Thanks,
--Luca C.
___

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

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

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

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


Re: Unexpected mouse-handling behaviour

2009-02-23 Thread Manuel Meyer
Hmm, the endPoint and startingPoint are just helpers right now to  
visualize the mouse interaction. I haven't done any coding on the  
vertices between two Nodes yet.
I wanted to connect the Nodes without using the superview, but maybe I  
have to? What is the best way to find out, what View(s) are located at  
a certain point?


If u want to have a look: here is my coplete project code
http://gonzo.uni-weimar.de/~meyer4/SlipMaster.zip (175KB)

I'm not sure there is a problem.  If the clicked NodeView is  
receiving all the rightMouseDragged: messages, even when the mouse  
leaves the view, it would be consistent for it to receive the  
rightMouseUp: message as well.  Note that at the time the user  
releases the mouse, it might not be over any view, so it makes sense  
for the initially clicked view to handle all the events for the  
entire drag sequence.


If the start node and end node are guaranteed to have the same  
VSGraphView as their superview, it seems to me your code should  
still work, since that superview will still get the setEndPoint  
message.


--Andy

On Feb 22, 2009, at 9:21 AM, Manuel Meyer wrote:


Hey,

I just started to learn obj-c/Cocoa. As my first application I am  
writing a networkgraph-editor. Each node got it own view.
To connect to nodes, I thought of using rightMouseDown,  
rightMouseDragged and rightMouseUp.
So the NodeView, where a rightMouseDown event is triggered will be  
the starting-node for the connection and those NodeView, where the  
rightMouseUp event is triggered, will be the end-node.  
rightMouseDragged is used to show a line as visual feedback.


But I got another behaviour: the rightMouseUp-event will allways be  
triggered on the first node, no matter if the mouse was moved to  
another or to no NodeView.


What is my mistake?

Here is my code: http://paste.lisp.org/display/75958
Thanks for your help,

Manuel
___

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

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

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

This email sent to ag...@mac.com



aglee





___

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

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

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

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


NSUserCancelledError and the Dock

2009-02-23 Thread Gerriet M. Denkmann

I have a document based Cocoa app which uses:
- (BOOL)readFromURL:(NSURL *)absoluteURL ofType:(NSString *)typeName  
error:(NSError **)outError


This app checks the content of "absoluteURL" and if this content is  
not nice, shows a Panel:

"Content of ... is not nice. Cancel - Open Anyway.
When the user clicks cancel I return NSUserCancelledError.
Works perfectly.

But when I drag the same un-nice file to the image of my app in the  
Dock, I get the same panel, again I click "Cancel" but then I get  
another (unwanted) Panel:
"The document "..." could not be opened. The operation was cancelled.  
"Ok"


It is silly and quite pointless to tell me that an operation was  
cancelled, when I just have clicked "Cancel" in the previous panel.
And: I did return NSUserCancelledError because I was told, if "you  
don't want an error alert to be presented to the user, return an error  
object whose domain is NSCocoaErrorDomain and whose code is  
NSUserCancelledError."


So: what can I do to make the Dock respect this convention?
10.5.6

Kind regards,

Gerriet.

___

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

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

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

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


object wrapper for an opaque pointer

2009-02-23 Thread Roland King
I want to make an NSArray type container to store some handles in,  
they're just void* c pointers. I don't need them managed in any way, I  
can deal with removing the handles from the NSArray before deletion  
and cleaning them up, I really just want to use an NSArray as a  
convenient place to dump spare handles in an object I'm familiar with  
and wanted to use a simple syntax like [ [ NSCrapPointerKeeper alloc ]  
initWithPointer: ] and stuff it in an NSArray


Is there a simple already-available wrapper for a void* I can use  
which doesn't even attempt to do any memory management, I failed to  
find one? I looked at NSPointerArray, which might actually do what I  
want, but was a little put off by the personality and memory  
management options.


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


[Q] Re: NSPersistentStore -addPersistentStoreWithType

2009-02-23 Thread Jon C. Munson II
Namaste!

I'm working on populating some entities with records just after when the
physical file of the store is created  (this would typically happen on
install and generally only once).  These records are generally for
application use and won't be managed by the end user.

In my app delegate's class implementation file there's a
-persistentStoreCoordinator method that returns the
persistentStoreCoordinator.  As part of functionality therein, it calls the
-addPersistentStoreWithType method which either returns an instance of an
existing store or creates a new store and then returns that instance.
Unfortunately, I don't see a way to know if that file was actually created
during that method call (without checking for a file before the call to
-addPersistentStoreWithType).

Is there a more elegant way to check whether the store had to create the
file, etc. (and what is it), or do I need to actually look for it, etc.,
first?

If the latter, would checking for the file on disk be better than obtaining
a record count from an entity?

Many thanks in advance!!! :D

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

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

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

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


Re: object wrapper for an opaque pointer

2009-02-23 Thread Graham Cox


On 24/02/2009, at 1:06 AM, Roland King wrote:

Is there a simple already-available wrapper for a void* I can use  
which doesn't even attempt to do any memory management



[NSValue valueWithPointer:];

--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: object wrapper for an opaque pointer

2009-02-23 Thread Roland King

*slaps head*

thanks

On Feb 23, 2009, at 10:10 PM, Graham Cox wrote:



On 24/02/2009, at 1:06 AM, Roland King wrote:

Is there a simple already-available wrapper for a void* I can use  
which doesn't even attempt to do any memory management



[NSValue valueWithPointer:];

--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: Unexpected mouse-handling behaviour

2009-02-23 Thread Michael Ash
On Mon, Feb 23, 2009 at 8:45 AM, Manuel Meyer  wrote:
> Hmm, the endPoint and startingPoint are just helpers right now to visualize
> the mouse interaction. I haven't done any coding on the vertices between two
> Nodes yet.
> I wanted to connect the Nodes without using the superview, but maybe I have
> to? What is the best way to find out, what View(s) are located at a certain
> point?

Certainly you don't have to use the superview, since you can run
equivalent code in either place. Which would be the better design,
that's hard to say. Personally I would use the superview rather than
the subviews, but obviously that's up to you.

You can find the view at any given location by using the -hitTest:
method of NSView. Be careful of the coordinate system of the point
that it takes, as it's a little unusual. You can use that to see what
view the mouse is over in the -mouseUp: method, and then communicate
with it to hook things up if it's the right kind of view.

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: [Q] Re: NSPersistentStore -addPersistentStoreWithType

2009-02-23 Thread Volker in Lists

Hi,

i am usually happy with the quick check if a file exists and don't  
rely on any entity counts within the first view milliseconds of  
startup. If you have a fixed location (say URL), the check is really  
easy to implement. If you use a document based app, you have more  
elegant possibilities, since document creation and document opening  
differ in their calls.


Cheers,
Volker

Am 23.02.2009 um 15:01 schrieb Jon C. Munson II:


Namaste!

I'm working on populating some entities with records just after when  
the

physical file of the store is created  (this would typically happen on
install and generally only once).  These records are generally for
application use and won't be managed by the end user.

In my app delegate's class implementation file there's a
-persistentStoreCoordinator method that returns the
persistentStoreCoordinator.  As part of functionality therein, it  
calls the
-addPersistentStoreWithType method which either returns an instance  
of an

existing store or creates a new store and then returns that instance.
Unfortunately, I don't see a way to know if that file was actually  
created
during that method call (without checking for a file before the call  
to

-addPersistentStoreWithType).

Is there a more elegant way to check whether the store had to create  
the
file, etc. (and what is it), or do I need to actually look for it,  
etc.,

first?

If the latter, would checking for the file on disk be better than  
obtaining

a record count from an entity?

Many thanks in advance!!! :D

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

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

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

This email sent to volker_li...@ecoobs.de


___

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

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

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

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


Re: Unexpected mouse-handling behaviour

2009-02-23 Thread Andy Lee
See NSView's hitTest: method.  I believe you'll also have to use one  
or more of NSView's convertPoint... methods.


Stepping back a bit, if you intend to significantly grow your app you  
should give it an MVC architecture -- have a model class that  
represents the structure and content of your document, and have the  
views interact with one or more controller objects to stay in sync  
with the model. If this is just a quick exercise to learn about  
drawing, you can postpone MVC for a later exercise, but even then it's  
worth thinking about now.


--Andy

On Feb 23, 2009, at 8:45 AM, Manuel Meyer wrote:

Hmm, the endPoint and startingPoint are just helpers right now to  
visualize the mouse interaction. I haven't done any coding on the  
vertices between two Nodes yet.
I wanted to connect the Nodes without using the superview, but maybe  
I have to? What is the best way to find out, what View(s) are  
located at a certain point?


If u want to have a look: here is my coplete project code
http://gonzo.uni-weimar.de/~meyer4/SlipMaster.zip (175KB)



aglee



___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
For anyone following along, the following answers the question I had
regarding adding "records" to a "table" using Core Data:

> Thus (psuedo coded for brevity):
>
> someObject = [NSEntityDescription insertNewObjectForEntityForName:object
inManagedObjectContext:moc];
> [someObject setValue:@"val" forKey:@"foo"];
> [someObject setValue:@"val2" forKey:@"foo2"];
>
> someObject = [...insert...];
> [someObject setValue:forKey:];
> [someObject setValue:forKey:];
>
> someObject = [...insert...];
> [someObject setValue:forKey:];
> [someObject setValue:forKey:];
>
>  ...
>
> [NSManagedObjectContext save:];

When the -insert method is called, Core Data creates an instance of a new
object for an entity and returns a pointer to that object.  By calling
-setValue:forKey: one can then fill in the data values for the required
attributes.  This is different from using default values for attributes as
set by either the data model or via equivalent code.  Those default values
will be automatically populated when the object is created.

Each time the -insert method is called, Core Data continues to create new
instances of objects and return the pointers to them.  someObject is only a
variable that contains that pointer and does not influence the actual object
to which it points other than to point to it.  Thus, re-using someObject
does not obviate the object previously pointed to.

How Core Data manages the created objects isn't anything of concern - the
objects are just managed and kept around in volatile memory.

Once [NSManagedObjectContext save:] is called, those objects are then
committed to the store.

Many thanks to Jerry Krinock for confirming that and fleshing out my
understanding.

Peace, Love, and Light,

/s/ Jon C. Munson II


___

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

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

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

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


Stop edit session with a NSTextField

2009-02-23 Thread Eric Gorr
I manually start an edit session with a NSTextField after the user  
clicks in the field by doing the following:


[textField selectText:nil]; 
NSTextView  *currentEditor  = (NSTextView*)[textField currentEditor];
NSPoint windowLocation  = [theEvent locationInWindow];
NSPoint		screenLocation	= [[self window]  
convertBaseToScreen:windowLocation];
NSUInteger	characterIndex	= [currentEditor  
characterIndexForPoint:screenLocation];
[currentEditor setSelectedRange:NSMakeRange( characterIndex + 1,  
0 )];			



I can then alter the text in the field and press return. Once I press  
return, the delegate of the field does get a controlTextDidEndEditing  
notification. However, the field still has it's focus ring and if I  
start typing again, what I type goes into the field.


The first thing I tried was:

- (void) controlTextDidEndEditing:(NSNotification *)aNotification
{
NSLog( @"ResourceItemController: controlTextDidEndEditing:  
object: %@", [aNotification object] );

BOOL resigned = [[aNotification object] resignFirstResponder];
NSLog( @"ResourceItemController: controlTextDidEndEditing:  
resigned: %d", (int)resigned );

}

but, as one likely expects, this did nothing since the NSTextField  
wasn't the first responder - it's field editor was.


In the documentation for NSControlTextDidEndEditingNotification, the  
field editor can be obtained via the userInfo dictionary of the  
notification. So, the next thing I tried was:



- (void) controlTextDidEndEditing:(NSNotification *)aNotification
{
NSLog( @"ResourceItemController: controlTextDidEndEditing:  
object: %@", [aNotification object] );
id fieldEditor = [[aNotification userInfo]  
objectForKey:@"NSFieldEditor"];

resigned = [fieldEditor resignFirstResponder];
NSLog( @"ResourceItemController: controlTextDidEndEditing:  
resigned: %d", (int)resigned );

}

However, this just results in an exception...

2009-02-23 10:13:55.842 OutlineCollection-VB[24861:813] NSWindow: - 
_newFirstResponderAfterResigining is not a valid message outside of a  
responder's implementation of -resignFirstResponder.


and the last NSLog call in controlTextDidEndEditing is not executed.


So, how can I properly edit an editing session of a NSTextField?






___

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

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

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

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


Re: Stop edit session with a NSTextField

2009-02-23 Thread Patrick Mau


On 23.02.2009, at 16:20, Eric Gorr wrote:

I manually start an edit session with a NSTextField after the user  
clicks in the field by doing the following:


[snip]



I can then alter the text in the field and press return. Once I  
press return, the delegate of the field does get a  
controlTextDidEndEditing notification. However, the field still has  
it's focus ring and if I start typing again, what I type goes into  
the field.


The first thing I tried was:

- (void) controlTextDidEndEditing:(NSNotification *)aNotification
{
   NSLog( @"ResourceItemController: controlTextDidEndEditing:  
object: %@", [aNotification object] );

   BOOL resigned = [[aNotification object] resignFirstResponder];
   NSLog( @"ResourceItemController: controlTextDidEndEditing:  
resigned: %d", (int)resigned );

}

but, as one likely expects, this did nothing since the NSTextField  
wasn't the first responder - it's field editor was.


In the documentation for NSControlTextDidEndEditingNotification, the  
field editor can be obtained via the userInfo dictionary of the  
notification. So, the next thing I tried was:



- (void) controlTextDidEndEditing:(NSNotification *)aNotification
{
   NSLog( @"ResourceItemController: controlTextDidEndEditing:  
object: %@", [aNotification object] );
   id fieldEditor = [[aNotification userInfo]  
objectForKey:@"NSFieldEditor"];

   resigned = [fieldEditor resignFirstResponder];
   NSLog( @"ResourceItemController: controlTextDidEndEditing:  
resigned: %d", (int)resigned );

}

However, this just results in an exception...

2009-02-23 10:13:55.842 OutlineCollection-VB[24861:813] NSWindow: - 
_newFirstResponderAfterResigining is not a valid message outside of  
a responder's implementation of -resignFirstResponder.


and the last NSLog call in controlTextDidEndEditing is not executed.


So, how can I properly edit an editing session of a NSTextField?


I had the same problem using a set of NSCell objects in one NSView.
You could try:

[[self window] endEditingFor:nil];

This is described as a last resort to abort editing in the NSWindow  
class reference.
It's not recommened, because you first need to save the textStorage  
contents.


I ended up looking for the controlView using a loop to traverse  
supervies:


[[self window] makeFirstResponder:nil];

NSView *v = fieldEditor;
while (v && ([v superview] != [self controlView]))
  v = [v superview];

[v removeFromSuperview];

(All typed in mail)

Regards,
Patrick
___

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

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

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

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


Re: Stop edit session with a NSTextField

2009-02-23 Thread Eric Gorr


On Feb 23, 2009, at 10:44 AM, Patrick Mau wrote:


I had the same problem using a set of NSCell objects in one NSView.
You could try:

[[self window] endEditingFor:nil];


Unfortunately, that did not work.

This is described as a last resort to abort editing in the NSWindow  
class reference.
It's not recommened, because you first need to save the textStorage  
contents.


I ended up looking for the controlView using a loop to traverse  
supervies:


[[self window] makeFirstResponder:nil];

NSView *v = fieldEditor;
while (v && ([v superview] != [self controlView]))
 v = [v superview];

[v removeFromSuperview];



I am not sure I understand this.

Are you are saying is that you looked for the NSTextView being used as  
the field editor for the NSTextField and then removed the NSTextView  
from it's superview?


I tried this:

id fieldEditor = [[aNotification userInfo]  
objectForKey:@"NSFieldEditor"];

[fieldEditor removeFromSuperview];

Unfortunately, it didn't work.

___

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

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

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

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


Re: Stop edit session with a NSTextField

2009-02-23 Thread Patrick Mau


On 23.02.2009, at 16:50, Eric Gorr wrote:



I am not sure I understand this.

Are you are saying is that you looked for the NSTextView being used  
as the field editor for the NSTextField and then removed the  
NSTextView from it's superview?


I tried this:

id fieldEditor = [[aNotification userInfo]  
objectForKey:@"NSFieldEditor"];

[fieldEditor removeFromSuperview];

Unfortunately, it didn't work.


Yes. The superview of the fieldeditor is some clipping view (I forgot  
the class).
Unfortunately, after starting to edit the view hierarchy looks  
something like this:


NSTextCellView
  NSxxxClipView
...
fieldeditor

So in my loop I create an NSLog line for each view "above" the  
fieldeditor until I figured

what my control view was.

Warning! The ugly sample code hacked for my test is here:

http://oscar.homelinux.net/MultiCellView.zip

Please don't complain ;)
Patrick


___

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

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

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

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


Re: Using a flip transition to a different view

2009-02-23 Thread Randall Meadows

On Feb 22, 2009, at 9:49 AM, David Hatch wrote:


Hi,
I'm writing an app that has a view that displays subviews to show  
information to the user.  I would like the user to click a button  
and have the clicked sub view transition to a different view where  
the user can edit the information.  I want to use the transition  
that is used with dashboard widgets when the user clicks the "i" for  
preferences but, upon looking through the documentation at Core  
Animation transitions, that was not an available transition.  Is  
there a way I can use the flip transition instead of one of the four  
included transitions?


I had a similar requirement in the app I'm working on, and resorted to  
modifying Lemur Flip to do the job.  It's not nearly as smooth or  
slick as the Dashboard (or iPhone) animation, but it works (FSDO  
"works").  I've been told the same thing can be done with Core  
Animation (I have to assume that's what iPhone is using to do it); my  
first (original) attempts failed (having never worked with CA before),  
and I've not revisited the issue yet to figure it out.


Google "lemur flip"; it's the first hit, but the URL is NSFW, so I'll  
omit it from this message.

___

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

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

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

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


Re: Stop edit session with a NSTextField

2009-02-23 Thread Eric Gorr


On Feb 23, 2009, at 11:01 AM, Patrick Mau wrote:



On 23.02.2009, at 16:50, Eric Gorr wrote:



I am not sure I understand this.

Are you are saying is that you looked for the NSTextView being used  
as the field editor for the NSTextField and then removed the  
NSTextView from it's superview?


I tried this:

id fieldEditor = [[aNotification userInfo]  
objectForKey:@"NSFieldEditor"];

[fieldEditor removeFromSuperview];

Unfortunately, it didn't work.


Yes. The superview of the fieldeditor is some clipping view (I  
forgot the class).


ah, ok. Makes more sense now.

In any case, the solution to my problem turned out to be not so bad. I  
simply did the following:


[[[self view] window] makeFirstResponder:[self view]];

Basically, told the window to make someone else the first responder.  
This seemed to work.


I do find it odd that I could not tell the field editor to resign as  
first responder.



___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Paul Kim

If I had been paying more attention, I could've intervened sooner.

http://www.nightproductions.net/blog/2007/05/25/introducing-polish-a-new-framework/

Framework to do what the OP asked. My blog article, which prompted the  
whole thing, is linked from that page. You can see the comments there  
for a lengthy debate on it, some of which has been already rehashed  
here.


Paul Kim

___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford


On Feb 23, 2009, at 6:37 AM, Jon C. Munson II wrote:

When the -insert method is called, Core Data creates an instance of  
a new

object for an entity and returns a pointer to that object. [...]


This is described in the documentation:



By calling -setValue:forKey: one can then fill in the data values  
for the required

attributes.

The documentation makes clear that you should typically *not* use key- 
value coding to set managed objects' attribute values:




This is different from using default values for attributes as
set by either the data model or via equivalent code.  Those default  
values

will be automatically populated when the object is created.




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


Re: NSOutlineView : Incorrect Drag and Drop drawing?

2009-02-23 Thread Corbin Dunn


On Feb 21, 2009, at 3:08 PM, Iceberg-Dev wrote:


I have a NSOutlineView and its highlight mode is "SourceList".

When I drag a selected item (the cell is a subclass of NSTextField  
from the DargAndDropOutlineView sample code) from the list, its text  
is drawn in white. This means you can't see it since most the of the  
windows background are white usually.


This does not happen with a NSOutlineView with a standard highlight  
mode.


Is this a known bug? (Mac OS X 10.5.6 clean install)


Yes, please do log this as a bug.

A work around is to implement -willDisplayCell in your delegate, and  
to manually change the text highlighting when it is the "drop target  
row". You may have to keep more internal state to figure out when that  
is.


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: Surprising entanglement of UI lock during fetch request in background thread (NSViewHierarchyLock/MOC locking deadlock). [POST SAD REALISATION]

2009-02-23 Thread Corbin Dunn


On Feb 21, 2009, at 1:49 AM, Luke Evans wrote:

Well, for now we're moving to a main-thread only model for Core Data  
access (I've created a little 'inter-thread thunk' toolkit for  
invoking the previously offending MOC-mutating methods on the main  
thread).


I'm still curious about how the "MOC-per-thread, shared coordinator"  
approach works out in practice.  Could anybody point me at a sample  
somewhere?
Do the several MOCs synchronise themselves in this scenario, so that  
new objects created in one MOC appear shortly afterward in another  
(and more to the point auto-update bound controllers etc.)?
Are the latencies involved in such auto-updating (if it exists)  
pretty low?
Where do "per thread" instance of MOCs typically reside and how are  
they looked-up?  I could imagine storing a reference in the NSThread  
dictionary, but wonder if there is a lot of overhead in accessing  
that.


Please log bugs requesting what you want to work, and/or the  
documentation to be increased. If you have a simple test case please  
also add it to the bug, as that greatly speeds up things.


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


Changing the height of a NSTextField for editing

2009-02-23 Thread Eric Gorr

Here's a sample application demonstrating the problem:

http://ericgorr.net/cocoadev/label/ItemDevLabel.zip

When I click in the label, I start an editing session. However, the  
height of the label can contain two lines of text. When the editing  
session begins, I would like just a single line of editable text.


I begin editing by doing the following:

[textField selectText:nil]; 
NSTextView  *currentEditor  = (NSTextView*)[textField currentEditor];
NSPoint windowLocation  = [theEvent locationInWindow];
NSPoint		screenLocation	= [[self window]  
convertBaseToScreen:windowLocation];
NSUInteger	characterIndex	= [currentEditor  
characterIndexForPoint:screenLocation];
[currentEditor setSelectedRange:NSMakeRange( characterIndex + 1,  
0 )];			



So, I figured I could simply take currentEditor and change it's height:

NSRect  editorBounds = [currentEditor bounds];
NSSize  newEditorSize = editorBounds.size;
newEditorSize.height = 16; // just some smaller value for now
[currentEditor setBoundsSize:newEditorSize];

Unfortunately, that does not work. I find it very odd that the height  
of the control remains the same and the text becomes larger.


Next, I tried altering the height of textField before I started the  
editing session and did:


NSSize  textViewSize = [textView bounds].size;
textViewSize.height = 16;
[textView setBoundsSize:textViewSize];

However, I saw the same behavior as demonstrated in the sample  
application.


Eventually, I would like to allow the user to edit on multiple lines,  
but if I cannot change the height to just a single line, I have no  
expectation that I'd be able to change the height to hold multiple  
lines.



Anyone have any ideas?



 
___


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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
>  >
> 
> > By calling -setValue:forKey: one can then fill in the data values
> > for the required
> > attributes.
> >
> The documentation makes clear that you should typically *not* use key-
> value coding to set managed objects' attribute values:
>  es/cdUsingMOs.html#//apple_ref/doc/uid/TP40001803
>  >
> 

[Jon C. Munson II] The documentation states the following:
" You can also use key-value coding (KVC) to get or set the value of a
simple attribute as illustrated in the following code fragment."

It then goes on to say:
" Using KVC, though, is considerably less efficient than using accessor
methods, so you should only use KVC when necessary (for example when you are
choosing the key or keypath dynamically)."

The sample code I saw elsewhere used the KVC methodology, so that was what I
latched onto.

I'll change my code and use the dot syntax which appears to be most
efficient.  Thank you for the pointer to that particular reference.



After some brief testing, if one creates entities of NSManagedObject thus:

NSManagedObject *someObject  = [NSEntityDescription insert...];

one most likely cannot use the dot syntax accessors as someObject, during
compilation, has no idea of the attributes of that object an thus an error
will be thrown - it is generic and falls into the "dynamic" category stated
by the documentation.

You'll have to use KVC in that case.  At least, I did.  I tried both the dot
and standard accessor to be sure.

___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2009 at 1:35 PM, Jon C. Munson II  wrote:
> You'll have to use KVC in that case.  At least, I did.  I tried both the dot
> and standard accessor to be sure.

You can usually cast the result yourself, since typically the
entityName argument for +[NSEntityDescription
insertNewObjectForEntityForName:inManagedObjectContext:] is a string
literal.  If you haven't subclassed NSManagedObject, you can use
mogenerator.

And unlike the dot syntax, sending messages to objects that may not
understand them isn't an error, as long as the compiler can see the
declaration of the method signature from where it stands.

--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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford


On Feb 23, 2009, at 10:35 AM, Jon C. Munson II wrote:

After some brief testing, if one creates entities of NSManagedObject  
thus:

NSManagedObject *someObject  = [NSEntityDescription insert...];
one most likely cannot use the dot syntax accessors [...]

This is not the case if you follow the patterns described in the  
documentation:



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


RE: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II

> > After some brief testing, if one creates entities of NSManagedObject
> > thus:
> > NSManagedObject *someObject  = [NSEntityDescription insert...];
> > one most likely cannot use the dot syntax accessors [...]
> >
> This is not the case if you follow the patterns described in the
> documentation:
>  es/cdAccessorMethods.html
>  >
> 

[Jon C. Munson II] Here's what I tried:

NSManagedObject *someObject = [NSEntityDescription insert...];
someObject.attribute = @"";

and also:

NSManagedObject *someObject = [NSEntityDescription insert...];
[someObject setAttribute:@""];

Neither would work.

Feel free to show me the correct way as I don't see it in the dox.  Again,
the samples I can readily find, given this particular circumstance, use KVC
to set the attribute values and that works just fine.

Kyle mentioned something about casting.  While I know what certain casting
is, (int)i for example, I'm not sure what he meant.  If he meant to include
the class header file and stipulate the class up front, etc., then I hadn't
done that as, again, the samples didn't cover that particular method for
this case - that was usually mentioned in the normal method, not the
convenience method being used here.

___

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

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

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

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


Re: iTunes like transition?

2009-02-23 Thread Luca Pazzerello
Maybe this screenshot clarifies about which transition i am talking about.
http://a1.s3.quickshareit.com/immagine28d926.png

Regards,
-- Luca C.
___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On 2/23/09, Jon C. Munson II  wrote:

> Kyle mentioned something about casting.  While I know what certain casting
> is, (int)i for example, I'm not sure what he meant.  If he meant to include
> the class header file and stipulate the class up front, etc., then I hadn't
> done that as, again, the samples didn't cover that particular method for
> this case - that was usually mentioned in the normal method, not the
> convenience method being used here.

  Well no, it wouldn't ... This is an aspect of the language with
which you are expected to be familiar. It doesn't make sense that this
information be repeated everywhere it could be used, right? This isn't
even Objective-C; it's just a pointer:

id obj = ...some class instance
(MyClassyClass *)[obj doSomethingSpecificToMyClassyClass]

  Same as your int cast example.

--
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/idiotsavant2005%40gmail.com
>
> This email sent to idiotsavant2...@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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford


On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote:

Feel free to show me the correct way as I don't see it in the dox.




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


Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 2:28 PM, I. Savant  wrote:

> This isn't even Objective-C; it's just a pointer:

  Sorry, I was trying to be brief as I was responding from an iPhone.
:-) What I meant was, it's not even *a matter of* Objective-C syntax.
The pointer to your managed object subclass instance is as valid a
cast as (int).

--
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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II


> 
> On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote:
> > Feel free to show me the correct way as I don't see it in the dox.
> >
>  es/cdUsingMOs.html
>  >
> 

[Jon C. Munson II] Again, feel free to show me the correct way, as I don't
see it in the dox.  I already explained that I attempted the methods
displayed therein.

___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
Ahh, I see...I did think that's what he meant, but I needed further
clarification.

I'll give that a shot...

Thanks!

Peace, Love, and Light,

/s/ Jon C. Munson II

> -Original Message-
> From: I. Savant [mailto:idiotsavant2...@gmail.com]
> Sent: Monday, February 23, 2009 2:29 PM
> To: jmun...@his.com
> Cc: Cocoa List
> Subject: Re: Populating a new SQLite Core Data store with default data
> 
> On 2/23/09, Jon C. Munson II  wrote:
> 
> > Kyle mentioned something about casting.  While I know what certain
> casting
> > is, (int)i for example, I'm not sure what he meant.  If he meant to
> include
> > the class header file and stipulate the class up front, etc., then I
> hadn't
> > done that as, again, the samples didn't cover that particular method for
> > this case - that was usually mentioned in the normal method, not the
> > convenience method being used here.
> 
>   Well no, it wouldn't ... This is an aspect of the language with
> which you are expected to be familiar. It doesn't make sense that this
> information be repeated everywhere it could be used, right? This isn't
> even Objective-C; it's just a pointer:
> 
> id obj = ...some class instance
> (MyClassyClass *)[obj doSomethingSpecificToMyClassyClass]
> 
>   Same as your int cast example.
> 
> --
> 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/idiotsavant2005%40gmail.com
> >
> > This email sent to idiotsavant2...@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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Quincey Morris

On Feb 23, 2009, at 11:09, Jon C. Munson II wrote:


[Jon C. Munson II] Here's what I tried:

NSManagedObject *someObject = [NSEntityDescription insert...];
someObject.attribute = @"";

and also:

NSManagedObject *someObject = [NSEntityDescription insert...];
[someObject setAttribute:@""];

Neither would work.


Clearly, these won't compile because NSManagedObject (the class) is  
not declared to have a property called "attribute". As it happens,  
someObject (the instance) *does* have such an attribute (assuming a  
suitable entity description in your core data model), so the trick is  
to figure out how to get to it. The documentation mmalc linked to  
*does* tell you how, but you have to follow along fairly carefully.


There are actually three main approaches to solving this *compile- 
time* issue:


#1. You don't add any auxiliary declarations. In this case, you must  
use [valueForKey:] and [setValue:forKey:]. There's absolutely nothing  
wrong with this, except that it is "considerably" slower than the  
other 2 approaches. Keep in mind, though, that what's slower is only  
the resolving of the generic KVC method to the internal core data  
method. (Call that the "accessor overhead".) The actual retrieval or  
modification of the property is the same no matter how you get there.  
Unless you are trying to create and set attributes for a large number  
(thousands) of objects in a short period of time, the accessor  
overhead is unlikely to be a problem you should agonize over.


#2. You use a custom subclass of NSManagedObject (which you specify in  
entity description of the core data model), and in that subclass's .h  
file you put @property declarations for the properties, and in that  
subclass's .m file you define the properties with @dynamic. Then the  
object you get back from [NSEntityDescription insert...] is actually  
an instance of your subclass, so you can simply cast it to the correct  
type and use the more-efficient accessors (similar to the code above).


#3. You use a custom subclass of NSManagedObject, and in addition you  
write custom accessors for various properties. There are different  
ways to do this (all in the documentation too), but this is not  
relevant to what you're trying to do here.


Unfortunately, the documentation doesn't separate case #2 from case #3  
very well. It's easy to skip over stuff that appears to be about #3  
when it contains information relevant to #2.


So although the *recommended* approach may be #2, I don't see any real  
problem in your continuing to use #1 -- provided the number of objects  
is not large. Also, if you find yourself using the generic KVO setter/ 
getter for the same key in lots of places, it's probably worth  
switching to approach #2 at least for the sake of code readability.


[Note: in approach #2, to get to core data's built-in to-many  
accessors (addXxxObject:, removeXxxObject: etc), you have to use a  
slight hack involving declarations within a category of your subclass,  
since there's no equivalent to @dynamic for that those accessors.  
That's also in the documentation.]



___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread mmalc Crawford


On Feb 23, 2009, at 11:43 AM, Jon C. Munson II wrote:

On Feb 23, 2009, at 11:09 AM, Jon C. Munson II wrote:

Feel free to show me the correct way as I don't see it in the dox.

, you're expected to be familiar with the fundamentals of Cocoa  
development:


"Core Data is not an entry-level technology. It leverages many other  
Cocoa technologies, including memory management, key-value coding, and  
key-value observing. You must understand these technologies to use  
Core Data effectively. You also need a solid understanding of data  
modeling and the model-view-controller design pattern as it pertains  
to Cocoa."


If you don't meet these prerequisites, as it seems you don't, you  
shouldn't be using Core Data.


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


Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 2:44 PM, Jon C. Munson II  wrote:
> Ahh, I see...I did think that's what he meant, but I needed further
> clarification.
>
> I'll give that a shot...

  Well, while you're giving it a shot, keep in mind I made an error here:

>> (MyClassyClass *)[obj doSomethingSpecificToMyClassyClass]

  I meant:

[(MyClassyClass *)obj doSomethingSpecificToMyClassyClass]

  The cast needs to be applied to the pointer - obj - and not to the
returned value (outside the [ ] square brackets).

--
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: iTunes like transition?

2009-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2009 at 2:18 PM, Luca Pazzerello
 wrote:
> Maybe this screenshot clarifies about which transition i am talking about.
> http://a1.s3.quickshareit.com/immagine28d926.png

That's not really a transition, it's just drawing.  iTunes is a Carbon
app, so it uses a different drawing model entirely.

It looks like all you want is a custom NSTextFieldCell subclass whose
objectValue can be set to an array of strings instead of just a single
string, and then you want to do the drawing yourself.

--Kyle Sluder
___

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

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

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

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


Re: Question on threads running in my Foundation tool

2009-02-23 Thread Charles E. Heizer

Thanks for the plug. :-) I do appreciate it.

Thanks,
-charles

On Feb 22, 2009, at 9:54 PM, Josh Freeman wrote:


Hi,


On Feb 22, 2009, at 9:35 AM, Charles E. Heizer wrote:


The issue I'm seeing is that for every time I call NSThread so not
to block the run loop it runs it's course but when it completes it
leaves a hanging thread. So every 60 seconds I see an additional
thread get added and never drops it once completed.

...

-(void)runSoftwareUpdate
{
NSTask *task;
   task = [[NSTask alloc] init];
   [task setLaunchPath: @"/usr/sbin/softwareupdate"];

   NSArray *arguments;
   arguments = [NSArray arrayWithObjects: @"-l", nil];
   [task setArguments: arguments];

   NSPipe *pipe;
   pipe = [NSPipe pipe];
   [task setStandardOutput: pipe];

   NSFileHandle *file;
   file = [pipe fileHandleForReading];

   [task launch];

   NSData *data;
   data = [file readDataToEndOfFile];

   NSString *string;
   string = [[NSString alloc] initWithData: data encoding:
NSUTF8StringEncoding];
   NSLog (@"Got a result \n%@", string);
}



   Could the hanging thread be due to the alloc'd NSTask not being
released?




   You might be interested in checking out the source code to an
open-source app I wrote, DAA Converter; It's a Cocoa wrapper for a
3rd-party command-line tool.

   The sources contain (hopefully helpful) examples for both ways of
using NSTask - asynchronously & synchronously (the latter for when
the task will exit very quickly). There's no explicit use of
NSThread, NSRunLoop, or NSAutoreleasePool, since the NSTasks are
created by the main thread.

   DAA Converter's sources are the bottom of the app's page:
http:// www. twilightedge.com/mac/daaconverter

   The NSTask code is found in DAAC_ConversionTask.m (async begins
in the 'beginDAA2ISOTaskWithDAAFile:ISOFile:' method, sync begins &
ends in the 'daa2isoCredits' method).

Cheers,

Josh






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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> 
>   I meant:
> 
> [(MyClassyClass *)obj doSomethingSpecificToMyClassyClass]
> 
>   The cast needs to be applied to the pointer - obj - and not to the
> returned value (outside the [ ] square brackets).
> 
> --
> I.S.

[Jon C. Munson II] That made a difference.  I took your literal word
originally.  :)

After adding @class anEntity; to the .h file (may not be necessary, but did
it anyway), and adding #import "anEntity.h" to the .m file, using:

[(anEntity *)someObject setAttribute:@"somevalue"];

everything worked just peachy.  This uses the dynamic setter for the
anEntity class.

So, I'll switch from using the KVC calls to the casted calls to take
advantage of better efficiency.

Thank you, Quincey Morris, for your insight, I appreciate it.

I could not, however get this to work (and it may not be possible) with the
appropriate @class & #import:

(anEntity *)someObject.attribute = @"somevalue";

Is there a way to implement that methodology as well?  Correct me if I'm
wrong, however, the dot syntax is the same as the dynamic setter, right?  To
use this methodology, does one then need to use the explicit someObject
instead of the generic version:

// generic
NSManagedObject someObject = [NSEntityDescription insert...];
(anEntity *)someObject.attribute = @"somevalue";

// explicit
AnEntity *anEntity = [NSEntityDescription insert...];
anEntity.attribute = @"somevalue";

Thanks I.S.!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

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

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


Re: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Wim Lewis


On Feb 23, 2009, at 12:50 PM, Jon C. Munson II wrote:
I could not, however get this to work (and it may not be possible)  
with the

appropriate @class & #import:

(anEntity *)someObject.attribute = @"somevalue";

Is there a way to implement that methodology as well?



I believe the problem here is just that the dot operator has higher  
precedence than the typecast operator --- so that your expression gets  
parsed as if it were  (anEntity *)(someObject.attribute) = ... It  
should work if you add parentheses to make it explicit that the  
typecast applies to the 'someObject' part of the expression instead of  
to the whole 'someObject.attribute' part:


  ((anEntity*)someObject).attribute = @"somevalue";



___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread Frédéric Testuz


Le 23 févr. 09 à 21:50, Jon C. Munson II a écrit :



 I meant:

[(MyClassyClass *)obj doSomethingSpecificToMyClassyClass]

 The cast needs to be applied to the pointer - obj - and not to the
returned value (outside the [ ] square brackets).

--
I.S.


[Jon C. Munson II] That made a difference.  I took your literal word
originally.  :)

After adding @class anEntity; to the .h file (may not be necessary,  
but did

it anyway), and adding #import "anEntity.h" to the .m file, using:

[(anEntity *)someObject setAttribute:@"somevalue"];

everything worked just peachy.  This uses the dynamic setter for the
anEntity class.

So, I'll switch from using the KVC calls to the casted calls to take
advantage of better efficiency.

Thank you, Quincey Morris, for your insight, I appreciate it.

I could not, however get this to work (and it may not be possible)  
with the

appropriate @class & #import:

(anEntity *)someObject.attribute = @"somevalue";

Is there a way to implement that methodology as well?  Correct me if  
I'm
wrong, however, the dot syntax is the same as the dynamic setter,  
right?  To
use this methodology, does one then need to use the explicit  
someObject

instead of the generic version:

// generic
NSManagedObject someObject = [NSEntityDescription insert...];
(anEntity *)someObject.attribute = @"somevalue";


Same here, I don't know if this must be seen as a bug or not. This  
works for me :


((anEntity *)someObject).attribute = @"somevalue";

Frédéric___

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

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

Help/Unsubscribe/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 a new SQLite Core Data store with default data

2009-02-23 Thread I. Savant
On Mon, Feb 23, 2009 at 3:50 PM, Jon C. Munson II  wrote:

> I could not, however get this to work (and it may not be possible) with the
> appropriate @class & #import:

>(anEntity *)someObject.attribute = @"somevalue";

  You really need to be specific here - I suspect that's one of the
reasons why other responders may sound a little irked. "It doesn't
work" means little to us - you need to state exactly what goes wrong
(compiler messages, runtime errors, etc.).

  Because I'm still not caught up on Obj-C 2.0's dot syntax, I'm not
sure if that's valid but the actual compiler messages may offer some
insight.

--
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: Populating a new SQLite Core Data store with default data

2009-02-23 Thread Jon C. Munson II
> >
> > // generic
> > NSManagedObject someObject = [NSEntityDescription insert...];
> > (anEntity *)someObject.attribute = @"somevalue";
> 
> Same here, I don't know if this must be seen as a bug or not. This
> works for me :
> 
> ((anEntity *)someObject).attribute = @"somevalue";
> 
> Frédéric=

[Jon C. Munson II] Thanks to Wim as well for the reply.

I decided to try and (since it worked) then go with the explicit route,
since I was mostly there anyway.

I added @class anEntity to the .h file.

I added #import "anEntity" to the .m file.

I then changed my insert statement to:

anEntity *thisObject = [NSEntityDescription insert...];
thisObject.attribute = @"somevalue";

After looking at the generic version (at top) and realizing that I had
pulled in the class info anyway, I saw no value (for what I'm doing) to
continue that approach, hence the explicit approach just above.

If that's not good, do let me know.

Thanks for all the answers and input!

Peace, Love, and Light,

/s/ Jon C. Munson II

___

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

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

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

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


Getting CGImage out of NSBitmapImageRep in 10.4

2009-02-23 Thread David Alter
I need to get a CGImage out of a NSBitmapImageRep. This needs to work in
10.4.
I tried doing this by setting the bitmap as the graphics context and then
creating the image form the context. This gives me an CGBitmapContextCreate:
unsupported parameter combination. Here is the code

NSGraphicsContext * context = [NSGraphicsContext
graphicsContextWithBitmapImageRep:offscreenRep];

CGContextRef bitmapContext = (CGContextRef)[context graphicsPort];

CGImageRef image = CGBitmapContextCreateImage (bitmapContext);

I suspect there is a better way to do this. Does anyone have any
suggestions.

enjoy
-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: Changing the height of a NSTextField for editing

2009-02-23 Thread Nate Weaver
Try setting the frame of the field/field editor instead (doing unit  
conversions if necessary). When you change the bounds of something  
explicitly, you end up changing the drawing transformation as well  
(see under setBounds: and friends).


This has bitten me in the butt before (recently!).

HTH!


On Feb 23, 2009, at 11:52 AM, Eric Gorr wrote:


Here's a sample application demonstrating the problem:

http://ericgorr.net/cocoadev/label/ItemDevLabel.zip

When I click in the label, I start an editing session. However, the  
height of the label can contain two lines of text. When the editing  
session begins, I would like just a single line of editable text.


I begin editing by doing the following:

[textField selectText:nil]; 
NSTextView  *currentEditor  = (NSTextView*)[textField currentEditor];
NSPoint windowLocation  = [theEvent locationInWindow];
NSPoint		screenLocation	= [[self window]  
convertBaseToScreen:windowLocation];
NSUInteger	characterIndex	= [currentEditor  
characterIndexForPoint:screenLocation];
[currentEditor setSelectedRange:NSMakeRange( characterIndex + 1,  
0 )];			



So, I figured I could simply take currentEditor and change it's  
height:


NSRect  editorBounds = [currentEditor bounds];
NSSize  newEditorSize = editorBounds.size;
newEditorSize.height = 16; // just some smaller value for now
[currentEditor setBoundsSize:newEditorSize];

Unfortunately, that does not work. I find it very odd that the  
height of the control remains the same and the text becomes larger.


Next, I tried altering the height of textField before I started the  
editing session and did:


NSSize  textViewSize = [textView bounds].size;
textViewSize.height = 16;
[textView setBoundsSize:textViewSize];

However, I saw the same behavior as demonstrated in the sample  
application.


Eventually, I would like to allow the user to edit on multiple  
lines, but if I cannot change the height to just a single line, I  
have no expectation that I'd be able to change the height to hold  
multiple lines.



Anyone have any ideas?


___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren


On Feb 18, 2009, at 7:28 AM, Ben Lachman wrote:


Hi all:

I'm wanting to move away from DMGs to ZIP delivery.  As part of this  
move I'd like to have my app, SousChef, prompt the user on first run  
to move itself to /Applications (or ~/Applications as appropriate).   
In a short search I can't find any code examples hanging about to do  
something like this.  Would anyone mind sharing ideas/code on how to  
do this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009

	My advice is: Don't do that. Well written applications can run from  
any directory the user have read access to;

for example a subdirectory of /Applications.
	I have for example subdirectories of /Application for thirdparty  
software development tools, and for webeditors

-
How many National Democrats does it take to change a light bulb?
108: 8 who smashes the rest of the light bulbs, and 100 to blame a  
zionist world conspiracy for the darkness

--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Re: Help with recursive includes

2009-02-23 Thread Tommy Nordgren


On Feb 22, 2009, at 2:12 AM, Aaron Wallis wrote:

While that's always an option, it's not exactly the answer I was  
hoping to hear :D


The good news is I was able to recreate the file in a considerably  
smaller scale and have uploaded the source here: http://junk.isnot.tv/test.zip


As you can see, i've got two classes which include each others  
headers (since they need to call each others methods directly)
I may be breaking some design patterns by doing this, and if so,  
please point them out - cause they could be the cause of the  
problem :D
	Are you importing the header files from each other? That's the  
problem. In one of the header files at least, you should

forward declare the class defined in the other header file like this:

@class SomeClass;

@interface MyClass: NSObject
{
SomeClass * aMember;
}

This style will probably fix your problem if you applies it consistenly
--
What is a woman that you forsake her, and the hearth fire and the home  
acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the Dane  
women

Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Alex Kac
Let me give you an example why I disagree with the advice. Yes, well  
written applications can run from anywhere and all apps should!  
However its a user experience issue. Not everyone wants to write a pkg  
installer for a variety of reasons.


So first here is a story. I have a friend I switched over to the Mac.  
She downloaded Firefox and started running it from the DMG. She just  
is not advanced enough to move it to the Applications folder. But she  
thinks her Mac is broken on why sometimes she can find it and  
sometimes she can't. The reason sometimes it works is the DMG is  
mounted, and other times its not.


If Firefox would just ask - would you like to install this to the  
Applications dir *once* on first run - this issue would be negated.  
Interestingly I can name dozens of users whom I've moved to the Mac in  
the last 2-3 years that have had the exact same issue. Firefox is not  
the only example.


People can suggest this is an issue with Firefox's distribution  
mechanism - DMG, but frankly you as an engineer don't always have  
control over that. Sometimes its easier to get management to accept  
something like the above than to change distribution mechanisms.


Secondly, I think this group does a great job of pushing high  
standards in development and I applaud it for that. However I also  
think it tends to punish people who have innovative ideas to help the  
user that does not hurt the Mac experience, but helps it. I think  
Ben's question has a lot of merit and instead of having 50 emails  
about something obvious and had nothing to do with his question, just  
assumptions, I think some help would've been more appropriate.


On Feb 23, 2009, at 5:25 PM, Tommy Nordgren wrote:



On Feb 18, 2009, at 7:28 AM, Ben Lachman wrote:


Hi all:

I'm wanting to move away from DMGs to ZIP delivery.  As part of  
this move I'd like to have my app, SousChef, prompt the user on  
first run to move itself to /Applications (or ~/Applications as  
appropriate).  In a short search I can't find any code examples  
hanging about to do something like this.  Would anyone mind sharing  
ideas/code on how to do this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009



	My advice is: Don't do that. Well written applications can run from  
any directory the user have read access to;

for example a subdirectory of /Applications.
	I have for example subdirectories of /Application for thirdparty  
software development tools, and for webeditors

-
How many National Democrats does it take to change a light bulb?
108: 8 who smashes the rest of the light bulbs, and 100 to blame a  
zionist world conspiracy for the darkness

--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

This email sent to a...@webis.net


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




___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Joseph Crawford
I am not that experienced as a Mac Developer but I can give my  
thoughts as a switcher.  When I first switched over to OS X a few  
years ago I thought it was odd that an application did not *need* to  
be installed rather copied to the Applications folder.  It was obvious  
to me that I needed to put it in the Applications folder even though I  
was new because the first app I installed (I don't recall what it was)  
had a nice window that popped up and had the app icon along with the  
applications folder.  It had a nice arrow that said drag.


Once I did that I checked the Applications folder which I found in the  
Finder window and there it was.


I loved the way it just copied over and there was no need for an  
installer (i found some apps that do require it, shame on them)


I have never had the problem of opening the app from the DMG and then  
not being able to find it so I cannot speak from that.


I however do like the idea of the app asking you where to install  
however that could also be a bad idea as Ben stated you are not  
*required* to install it to any particular location and some may have  
their applications organized by directories.  I particularly do not  
but it is a good idea now that Ben brings it up so I might in the near  
future.


I would lean towards not copying the file, rather showing the window  
like a lot of apps do that have the app icon draggable to the app  
folder. and some nice graphics making it clear that they need to drag  
& drop.


Joseph Crawford
___

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

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

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

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


NSTextView Undo behavior

2009-02-23 Thread Randall Meadows
In my app's window there is an NSTextView, a place in which to enter  
notes associated with a selected object.  Currently, when the user is  
finished editing those notes and switches to a different view (like  
clicking in another text area), I capture that edit session and store  
the new notes by calling -setNotes: on that object; this creates an  
Undo action, allowing the user to undo the entire edit session in one  
fell swoop.


I had initially turned on the "Undo" flag in IB for that text view, so  
that the user could undo (and redo) "sub-edits" while the edit session  
was in progress ("Undo Typing" is pushed onto the Undo stack by the  
text view, apparently), while my custom Undo action pushed onto the  
Undo stack would undo the entire edit session itself ("Undo Edit  
Notes").


I find when I do this, with the text view's Undo flag enabled, there  
is some "zombie" undo action left on the Undo stack, that does  
nothing, and doesn't go away.


Here's the entire process:

1. Select and object and start typing in the Notes field
2. The Edit menu contains "Undo Typing", and does just that--reverts  
the typing while I'm in still in that text view.
3. If I select "Undo Typing", that works, and now the Edit menu  
contains "Redo Typing" (there is no Undo available, and it is  
disabled).  Redo works, and the Edit menu contains "Undo Typing" (and  
Redo is disabled).
4. With changes in the text view, I click a different text area in the  
window; this action ultimately causes the object's -setNotes: method  
to be called, in which I set up the Undo action with the current notes  
and then update the object with the new notes.

5. The Edit menu now contains "Undo Edit Notes" (Redo is disabled).
6. If I select "Undo Edit Notes", the change is reverted; the Edit  
menu now contains "Redo Edit Notes", but also an enabled "Undo" item.
7. At this point, I can select "Undo" as long as I have the patience  
to continue doing so.  Nothing (apparent) happens, I never get to the  
end of the Undo stack, and *my* "Redo Edit Notes" Undo action remains  
available.
8. I can select my "Redo Edit Notes", and the right thing happens; the  
Edit menu goes back to "Undo Edit Notes" (Redo is disabled) and  
selecting it again takes me back to step 7, ad infinitum.


I can only assume this anonymous "Undo" action is left over from the  
NSTextView undo stack (since using that is the only way I can get this  
to appear).  Turning off the Undo flag for that text view in IB makes  
this all go away.  I s'pose I could liberally interpret the customer's  
"specification" to make my custom Undo action the "right" thing to do  
(and eliminate the undo ability whilst editing the field), but that  
just doesn't sit right with me.


But I haven't been able to figure out why this anonymous Undo action  
is left on the stack, or a good away to get rid of it, or even figure  
out what happens when I select it.


Any ideas?

Thanks!
randy
___

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

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

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

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


Re: iTunes like transition?

2009-02-23 Thread Graham Cox


On 24/02/2009, at 6:18 AM, Luca Pazzerello wrote:

Maybe this screenshot clarifies about which transition i am talking  
about.

http://a1.s3.quickshareit.com/immagine28d926.png

Regards,
-- Luca C.



You could probably implement this by using either a text view or a  
view of your own design inside a scrollview with hidden scrollbars and  
scroll it programatically.


--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: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Paul Sanders
CrossOver Mac (from CodeWeavers) has a nice solution to the problem of users 
forgetting where they have put their applications.  When the DMG is mounted, 
they pop up a box as shown here:

http://www.alpinesoft.co.uk/forum_images/crossover_installer.png

Problem solved? - assuming you know how to do what they are doing (which I 
don't, but I would like to).  It's probably not that hard...

Paul.
___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren

Actually there is an easy way to find the apps runtime path:

[[NSBundle mainBundle] bundlePath]
You can extract the info from the returned string.
On Feb 24, 2009, at 1:04 AM, Alex Kac wrote:

Let me give you an example why I disagree with the advice. Yes, well  
written applications can run from anywhere and all apps should!  
However its a user experience issue. Not everyone wants to write a  
pkg installer for a variety of reasons.


So first here is a story. I have a friend I switched over to the  
Mac. She downloaded Firefox and started running it from the DMG. She  
just is not advanced enough to move it to the Applications folder.  
But she thinks her Mac is broken on why sometimes she can find it  
and sometimes she can't. The reason sometimes it works is the DMG is  
mounted, and other times its not.


If Firefox would just ask - would you like to install this to the  
Applications dir *once* on first run - this issue would be negated.  
Interestingly I can name dozens of users whom I've moved to the Mac  
in the last 2-3 years that have had the exact same issue. Firefox is  
not the only example.


People can suggest this is an issue with Firefox's distribution  
mechanism - DMG, but frankly you as an engineer don't always have  
control over that. Sometimes its easier to get management to accept  
something like the above than to change distribution mechanisms.


Secondly, I think this group does a great job of pushing high  
standards in development and I applaud it for that. However I also  
think it tends to punish people who have innovative ideas to help  
the user that does not hurt the Mac experience, but helps it. I  
think Ben's question has a lot of merit and instead of having 50  
emails about something obvious and had nothing to do with his  
question, just assumptions, I think some help would've been more  
appropriate.


On Feb 23, 2009, at 5:25 PM, Tommy Nordgren wrote:



On Feb 18, 2009, at 7:28 AM, Ben Lachman wrote:


Hi all:

I'm wanting to move away from DMGs to ZIP delivery.  As part of  
this move I'd like to have my app, SousChef, prompt the user on  
first run to move itself to /Applications (or ~/Applications as  
appropriate).  In a short search I can't find any code examples  
hanging about to do something like this.  Would anyone mind  
sharing ideas/code on how to do this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009



	My advice is: Don't do that. Well written applications can run  
from any directory the user have read access to;

for example a subdirectory of /Applications.
	I have for example subdirectories of /Application for thirdparty  
software development tools, and for webeditors

-
How many National Democrats does it take to change a light bulb?
108: 8 who smashes the rest of the light bulbs, and 100 to blame a  
zionist world conspiracy for the darkness

--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

This email sent to a...@webis.net


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






--
The three things an undertaker should never say to a client:
-Nice doing business with you.
-Welcome back.
-Have a nice day. (The King of ID)
--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Simple way to traverse 2D array?

2009-02-23 Thread Ashley Perrien
I'm hoping there's a simple way to do this or perhaps I can get some  
ideas on which direction to go. I've built a 2D NSArray of NSArrays.  
The primary array will be of variable length (usually less than 10)  
and the secondary arrays will also be variable, usually less than 5,  
but each one may be different, the first may be 2, the second may be  
3, etc. I need to traverse them and build all the unique combinations  
of the elements.


For instance, I have
NSArray *numbers containing 1,2 and 3
NSArray *letters containing A and B
NSArray *colors containing Red, White, Blue.

I need to build an array of objects we'll call combos:
combo1: 1, A, Red
combo2: 1, A, White
combo3: 1, A, Blue
combo4: 1, B, Red
combo5: 1, B, White
.
.
.
combo18: 3, B, Blue

This is relatively easy if I know how many arrays I'm working with (3  
in this case) to simply nest the for loops but if I don't know how  
many arrays the primary array has, I can't think of a way to nest the  
loops if I don't know how deeply to nest them. Any suggestions on the  
best way to approach something like this?



Ashley Perrien
___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Ken Thomases

On Feb 23, 2009, at 6:30 PM, Paul Sanders wrote:

CrossOver Mac (from CodeWeavers) has a nice solution to the problem  
of users forgetting where they have put their applications.  When  
the DMG is mounted, they pop up a box as shown here:


http://www.alpinesoft.co.uk/forum_images/crossover_installer.png


Thanks for the plug, but we can't take credit for originality here.  :)

A number of Mac apps are delivered in disk images configured that  
way.  Firefox has already been mentioned.  As I recall, we were also  
inspired by the disk image for Bare Bones' TextWrangler .


Cheers,
Ken

___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Nick Zitzmann


On Feb 23, 2009, at 5:51 PM, Ken Thomases wrote:

A number of Mac apps are delivered in disk images configured that  
way.  Firefox has already been mentioned.  As I recall, we were also  
inspired by the disk image for Bare Bones' TextWrangler .



I believe the whole origin of this trend was Fetch, or at least, they  
were the first to write about it: 


Of course, I found out about it because the article plugs one of my  
weekend projects as a core component. :)


And now we're going OT, so I'll stop.

Nick Zitzmann


___

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

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

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

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


(Almost)Newbie Question: Implementing / use a free available source code editor

2009-02-23 Thread Hans Stimul

Dear all,

I am very new in Cocoa/ObjC development. I am software developer for 
more/less 7 years - but I did mostly web stuff and so I implemented the 
most with languages like java, php5(oop - as far as possible), ruby (on 
rails) or python. At the college, I did a lot of C/C++ development. So I 
do not have "no clue", but Objective-C is quite different to the 
languages I mentioned... But I begin to love it :)


For the beginning in learning development in Objective-C I decided to 
write an own lightweight php editor. Inspired by the new Xcode 3.0 
editor and that cool kind of /"code folding"/ and that by genius (wo)men 
developed /"focus follows selection"/ option. I am planning to integrate 
these features (code folding, code focus) into my new editor.


Currently, I use the OSAScriptView for the text editor. I searched for a 
quite long time for these issues in the www. The genius creators of 
/"CSSEdit"/ /"MacRabbit/Space Carrot", I suppose/" are currently develop 
an editor which those two features, as well (You can have a look here: 
http://macrabbit.com/espresso/features/edit/). Furthermore they 
implemented a sarafi-like search.


So, are these things directly from a open source lib I do now know, yet? 
Are they Cocoa foundation tools (or something simular) I did not found 
yet (I did not find anything...) -- or do I have to ("re-")implement 
that great stuff myself? I will jump to joy when these things are 
implemented into my new tiny application!


I am thankful for any help in this thing. Above all I am new in Mac 
Development (And I like it more and more... ;) )


Thanks and best whishes to all!

--Hans
___

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

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

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

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


RE: Question on threads running in my Foundation tool

2009-02-23 Thread Josh Freeman

Hi,


On Feb 22, 2009, at 9:35 AM, Charles E. Heizer wrote:

The issue I'm seeing is that for every time I call NSThread so not  
to block the run loop it runs it's course but when it completes it  
leaves a hanging thread. So every 60 seconds I see an additional  
thread get added and never drops it once completed.


...

-(void)runSoftwareUpdate
{
NSTask *task;
task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/sbin/softwareupdate"];

NSArray *arguments;
arguments = [NSArray arrayWithObjects: @"-l", nil];
[task setArguments: arguments];

NSPipe *pipe;
pipe = [NSPipe pipe];
[task setStandardOutput: pipe];

NSFileHandle *file;
file = [pipe fileHandleForReading];

[task launch];

NSData *data;
data = [file readDataToEndOfFile];

NSString *string;
string = [[NSString alloc] initWithData: data encoding:  
NSUTF8StringEncoding];

NSLog (@"Got a result \n%@", string);
}



   Could the hanging thread be due to the alloc'd NSTask not being  
released?





   You might be interested in checking out the source code to an  
open-source app I wrote, DAA Converter; It's a Cocoa wrapper for a  
3rd-party command-line tool.


   The sources contain (hopefully helpful) examples for both ways of  
using NSTask - asynchronously & synchronously (the latter for when  
the task will exit very quickly). There's no explicit use of  
NSThread, NSRunLoop, or NSAutoreleasePool, since the NSTasks are  
created by the main thread.


   DAA Converter's sources are the bottom of the app's page:
http://www.twilightedge.com/mac/daaconverter

   The NSTask code is found in DAAC_ConversionTask.m (async begins  
in the 'beginDAA2ISOTaskWithDAAFile:ISOFile:' method, sync begins &  
ends in the 'daa2isoCredits' method).


Cheers,

Josh

___

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

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

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

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


reloading IKImageBrowserView in an IBAction

2009-02-23 Thread Claus Guttesen
Hi.

I followed the excellent article 'Image Kit Programming Guide' at
http://developer.apple.com/documentation/graphicsimaging/Conceptual/ImageKitProgrammingGuide/Introduction/chapter_1_section_1.html#//apple_ref/doc/uid/TP40004907-CH1-SW1
and have my ImageBrowser working. I want to use it as the basis of an
image-uploader and would like to visualize the upload-progress by
removing the first image. I have connected a button to an IBAction and
can remove the images one by one.

- (IBAction)listImagesButtonClicked:(id)sender {
NSUInteger n;
NSArray *myArray;

if ( [mImages count] > 0 ) {
myArray = [mImages objectAtIndex:0];
NSLog(@"%@", [myArray description]);
[mImages removeObjectAtIndex:0];
[mImageBrowser reloadData];
n = [mImages count];
[numberOfImagesOutputField setIntValue:n];
//  sleep(1);
}
}

[mImages removeObjectAtIndex:0] removes the first image and
[mImageBrowser reloadData] animates it.

I changed the 'if' to a 'while' but it doesn't animate removals one by
one but is waiting with [mImageBrowser reloadData] until all images
are removed (perhaps IBAction blocks it?) and remove all images at
once.

How can I make the [mImageBrowser reloadData] refresh within the while-loop?

-- 
regards
Claus

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

Shakespeare
___

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

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

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

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


Re: Simple way to traverse 2D array?

2009-02-23 Thread Graham Cox


On 24/02/2009, at 11:36 AM, Ashley Perrien wrote:

I'm hoping there's a simple way to do this or perhaps I can get some  
ideas on which direction to go. I've built a 2D NSArray of NSArrays.  
The primary array will be of variable length (usually less than 10)  
and the secondary arrays will also be variable, usually less than 5,  
but each one may be different, the first may be 2, the second may be  
3, etc. I need to traverse them and build all the unique  
combinations of the elements.


For instance, I have
NSArray *numbers containing 1,2 and 3
NSArray *letters containing A and B
NSArray *colors containing Red, White, Blue.

I need to build an array of objects we'll call combos:
combo1: 1, A, Red
combo2: 1, A, White
combo3: 1, A, Blue
combo4: 1, B, Red
combo5: 1, B, White
.
.
.
combo18: 3, B, Blue

This is relatively easy if I know how many arrays I'm working with  
(3 in this case) to simply nest the for loops but if I don't know  
how many arrays the primary array has, I can't think of a way to  
nest the loops if I don't know how deeply to nest them. Any  
suggestions on the best way to approach something like this?



It's a bit unclear from your description if what you have is really a  
3D array or a 2D array. Each of the combinations in your example  
output has three dimensions, not two.


It sounds like what you really want is to enumerate all of the  
combinations of three separate arrays. If that's the case, you might  
be muddling yourself by creating arrays of arrays. Instead, just keep  
each array as a simple 1D array and combine them. Nested for loops of  
each from 0..[array count] will do it. If the "primary array" is  
merely a list of numbers from 0..count, it doesn't even need to exist.  
The number of combinations is simply count(a) x count(b) x...x  
count(n) where n is the number of dimensions.


e.g.

- (void)combinations
{
NSArray* numbers = [NSArray arrayWithObjects:@"1", @"2", @"3", nil];
	NSArray* letters = [NSArray arrayWithObjects:@"A", @"B", @"C", @"D",  
nil];
	NSArray* colours = [NSArray arrayWithObjects:@"Red", @"White",  
@"Blue", nil];


unsigned i, j, k;
NSString* combo;

for( i = 0; i < [numbers count]; ++i )
{
for( j = 0; j < [letters count]; ++j )
{
for( k = 0; k < [colours count]; ++k)
{
int index = (i * [letters count] * [colours count]) + (j *  
[colours count]) + k;
combo = [NSString stringWithFormat:@"combo%d: %@, %@, %@", index +  
1, [numbers objectAtIndex:i], [letters objectAtIndex:j], [colours  
objectAtIndex:k]];

NSLog(@"%@", combo);
}
}
}
}

This might also help, depending on what you're really trying to do: 
http://en.wikipedia.org/wiki/Combination




--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: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren

The following code will test if you are running from the DMG:

NSString * volName = @"Mother";
NSString * appName = @"MyApp.app";

if ([[[NSBundle mainBundle] bundlePath] isEqualTo: [ NSString  
stringWithFormat:@"/Volumes/%@/%@",volName,appName]) {


	//Here you can show an alert telling the user to to copy the app to  
the applications folder


}
On Feb 24, 2009, at 1:04 AM, Alex Kac wrote:

Let me give you an example why I disagree with the advice. Yes, well  
written applications can run from anywhere and all apps should!  
However its a user experience issue. Not everyone wants to write a  
pkg installer for a variety of reasons.


So first here is a story. I have a friend I switched over to the  
Mac. She downloaded Firefox and started running it from the DMG. She  
just is not advanced enough to move it to the Applications folder.  
But she thinks her Mac is broken on why sometimes she can find it  
and sometimes she can't. The reason sometimes it works is the DMG is  
mounted, and other times its not.


If Firefox would just ask - would you like to install this to the  
Applications dir *once* on first run - this issue would be negated.  
Interestingly I can name dozens of users whom I've moved to the Mac  
in the last 2-3 years that have had the exact same issue. Firefox is  
not the only example.


People can suggest this is an issue with Firefox's distribution  
mechanism - DMG, but frankly you as an engineer don't always have  
control over that. Sometimes its easier to get management to accept  
something like the above than to change distribution mechanisms.


Secondly, I think this group does a great job of pushing high  
standards in development and I applaud it for that. However I also  
think it tends to punish people who have innovative ideas to help  
the user that does not hurt the Mac experience, but helps it. I  
think Ben's question has a lot of merit and instead of having 50  
emails about something obvious and had nothing to do with his  
question, just assumptions, I think some help would've been more  
appropriate.


On Feb 23, 2009, at 5:25 PM, Tommy Nordgren wrote:



On Feb 18, 2009, at 7:28 AM, Ben Lachman wrote:


Hi all:

I'm wanting to move away from DMGs to ZIP delivery.  As part of  
this move I'd like to have my app, SousChef, prompt the user on  
first run to move itself to /Applications (or ~/Applications as  
appropriate).  In a short search I can't find any code examples  
hanging about to do something like this.  Would anyone mind  
sharing ideas/code on how to do this?


Thanks,
->Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

email: blach...@mac.com
twitter: @benlachman
mobile: 740.590.0009



	My advice is: Don't do that. Well written applications can run  
from any directory the user have read access to;

for example a subdirectory of /Applications.
	I have for example subdirectories of /Application for thirdparty  
software development tools, and for webeditors

-
How many National Democrats does it take to change a light bulb?
108: 8 who smashes the rest of the light bulbs, and 100 to blame a  
zionist world conspiracy for the darkness

--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

This email sent to a...@webis.net


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






---
See the amazing new SF reel: Invasion of the man eating cucumbers from  
outer space.
On congratulations for a fantastic parody, the producer replies :  
"What parody?"


Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Shawn Erickson
On Mon, Feb 23, 2009 at 6:22 PM, Tommy Nordgren
 wrote:
> The following code will test if you are running from the DMG:
>
> NSString * volName = @"Mother";
> NSString * appName = @"MyApp.app";
>
> if ([[[NSBundle mainBundle] bundlePath] isEqualTo: [ NSString
> stringWithFormat:@"/Volumes/%@/%@",volName,appName]) {
>
>//Here you can show an alert telling the user to to copy the app to
> the applications folder
>
> }

If a disk image it mounted a second time (can happen in a few ways) it
won't be at /Volumes/Mother/... but at /Volumes/Mounter 1/... Also you
can mount disk images in location other then under /Volumes/...

If you really want to check this you should utilize
DiskImages.framework (IIRC) or possibly use "hdutil info -plist" and
look for your disk image and its current mount location. Then compare
that to your bundles location.

-Shawn

For example...

MacPro:~ shawnce$ hdiutil info -plist

http://www.apple.com/DTDs/PropertyList-1.0.dtd";>


framework
195.2.2
images


autodiskmount

blockcount
1138724
blocksize
512
hdid-pid
7098
icon-path

/System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-alias

AAFuAAIAAARNYWluAADD
STB4SCsDpvcQaVdvcmswOVRyaWFsLmRtZwAA
AMSJ
7MWHd2YAAP8AAAkgCURv
d25sb2FkcwAAEAAIAADDSZLoEQAIAADFh+fmAQAMAAOm
9wADClAAAHmMAAIALU1haW46VXNlcnM6c2hhd25jZTpEb3dubG9h
ZHM6aVdvcmswOVRyaWFsLmRtZwAADgAiABAAaQBXAG8AcgBrADAA
OQBUAHIAaQBhAGwALgBkAG0AZwAPAAoABABNAGEAaQBuABIAKFVz
ZXJzL3NoYXduY2UvRG93bmxvYWRzL2lXb3JrMDlUcmlhbC5kbWcA
EwABLwAAFQACAA7//wAA

image-encrypted

image-path

/Users/shawnce/Downloads/iWork09Trial.dmg
image-type
UDIF read-only compressed (zlib)
owner-uid
501
removable

system-entities


content-hint
Apple_partition_scheme
dev-entry
/dev/disk7


content-hint
Apple_partition_map
dev-entry
/dev/disk7s1


content-hint
Apple_Driver_ATAPI
dev-entry
/dev/disk7s2


content-hint
Apple_HFS
dev-entry
/dev/disk7s3
mount-point
/Volumes/iWork '09 Trial 
Install DVD


writeable



revision
10.5v195.2.2
vendor
Apple


___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren


On Feb 24, 2009, at 3:34 AM, Shawn Erickson wrote:


On Mon, Feb 23, 2009 at 6:22 PM, Tommy Nordgren
 wrote:

The following code will test if you are running from the DMG:

NSString * volName = @"Mother";
NSString * appName = @"MyApp.app";

if ([[[NSBundle mainBundle] bundlePath] isEqualTo: [ NSString
stringWithFormat:@"/Volumes/%@/%@",volName,appName]) {

  //Here you can show an alert telling the user to to copy the  
app to

the applications folder

}


If a disk image it mounted a second time (can happen in a few ways) it
won't be at /Volumes/Mother/... but at /Volumes/Mounter 1/... Also you
can mount disk images in location other then under /Volumes/...

It will be /Volumes/Mother 1/...  I've tested.
This can be handled by using a regexp class for the matching instead  
of a simple

equality test.
	Also, while it's possible to mount a disk image at other places than  
under Volumes,
that won't happen when doubleclicking a disk image or it being mounted  
from Safari

--
The three things an undertaker should never say to a client:
-Nice doing business with you.
-Welcome back.
-Have a nice day. (The King of ID)
--
Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Charles Srstka

On Feb 23, 2009, at 6:30 PM, Paul Sanders wrote:

CrossOver Mac (from CodeWeavers) has a nice solution to the problem  
of users forgetting where they have put their applications.  When  
the DMG is mounted, they pop up a box as shown here:


http://www.alpinesoft.co.uk/forum_images/crossover_installer.png

Problem solved? - assuming you know how to do what they are doing  
(which I don't, but I would like to).  It's probably not that hard...


That's how I do it, and it's what I'd recommend if you're concerned  
about this. Moving the app from where the user wants to put it (or  
nagging the user to do so every startup) is a bad idea IMO. Putting up  
a dialog box if someone launches the app from the DMG is okay if  
you're concerned about that, but please don't automatically copy it,  
as some of us prefer to run a freshly downloaded app out of the DMG  
the first time, to evaluate whether we want to keep the app or not. As  
for me, I will put your app where I want to put it, and if your app  
constantly moves itself from where I want it, I will move your app...  
to the Trash. Don't do that.


Charles
___

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

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

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

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


Re: Stop edit session with a NSTextField

2009-02-23 Thread Michael Ash
On Mon, Feb 23, 2009 at 11:35 AM, Eric Gorr  wrote:
> I do find it odd that I could not tell the field editor to resign as first
> responder.

>From the documentation for -resignFirstResponder:

"Notifies the receiver that it's been asked to relinquish its status
as first responder in its window."

And:

"Use the NSWindow makeFirstResponder: method, not this method, to make
an object the first responder. Never invoke this method directly."

In other words, it is a method you can implement to perform an action
when this happens, but it is not a method you can call to make it
happen.

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: Getting CGImage out of NSBitmapImageRep in 10.4

2009-02-23 Thread Michael Ash
On Mon, Feb 23, 2009 at 4:51 PM, David Alter  wrote:
> I need to get a CGImage out of a NSBitmapImageRep. This needs to work in
> 10.4.
> I tried doing this by setting the bitmap as the graphics context and then
> creating the image form the context. This gives me an CGBitmapContextCreate:
> unsupported parameter combination. Here is the code
>
> NSGraphicsContext * context = [NSGraphicsContext
> graphicsContextWithBitmapImageRep:offscreenRep];
>
> CGContextRef bitmapContext = (CGContextRef)[context graphicsPort];
>
> CGImageRef image = CGBitmapContextCreateImage (bitmapContext);
>
> I suspect there is a better way to do this. Does anyone have any
> suggestions.

Just call CGImageCreate. Most of the parameters can be obtained by
simply querying the NSBitmapImageRep, and the remainder are not
terribly difficult to create yourself, being either constants or
fairly easy to construct.

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: Simple way to traverse 2D array?

2009-02-23 Thread Graham Cox


On 24/02/2009, at 1:21 PM, Ashley Perrien wrote:

It's a bit unclear from your description if what you have is really  
a 3D array or a 2D array. Each of the combinations in your example  
output has three dimensions, not two.


To recreate what I had described earlier:

NSArray *numbers = [NSArray arrayWithObjects: @"1", @"2", @"3", nil];
NSArray *letters = [NSArray arrayWithObjects: @"A", @"B", nil];
NSArray *colors = [NSArray arrayWithObjects: @"Red", @"White",  
@"Blue", nil];


NSArray *primaryArray = [NSArray arrayWithObjects: numbers, letters,  
colors, nil];


The primaryArray is being created in another method and being passed  
in. In THIS case it has 3 arrays in it, but I can't assume it'll  
always have 3.



- (void)combinations
{
NSArray* numbers = [NSArray arrayWithObjects:@"1", @"2", @"3", nil];
	NSArray* letters = [NSArray arrayWithObjects:@"A", @"B", @"C",  
@"D", nil];
	NSArray* colours = [NSArray arrayWithObjects:@"Red", @"White",  
@"Blue", nil];


unsigned i, j, k;
NSString* combo;

for( i = 0; i < [numbers count]; ++i )
{
for( j = 0; j < [letters count]; ++j )
{
for( k = 0; k < [colours count]; ++k)
{
int index = (i * [letters count] * [colours count]) + (j *  
[colours count]) + k;
combo = [NSString stringWithFormat:@"combo%d: %@, %@, %@",  
index + 1, [numbers objectAtIndex:i], [letters objectAtIndex:j],  
[colours objectAtIndex:k]];

NSLog(@"%@", combo);
}
}
}
}


But this code assumes there will be 3 arrays (numbers, letters,  
colors), what if that number is not known? It could be 3, it could  
be 8. I could (fairly safely) assume that it will always be less  
than 12 and then nest it as shown with lots of error checking but  
that would be an unsightly mess.


Ashley Perrien




OK, I get what you mean now.

What you want to do is multiply all the arrays together, i.e. result =  
m(0) x m(1) x..x m(n) where n is the number of arrays in your "primary  
array" (that being the dimension of the result), and m being each  
array contained therein.


The difficulty is defining what it means to "multiply" two objects. If  
an array is being multiplied by a scalar, the result is a new array  
containing the same number of objects as the original. If the array is  
multiplied by another array, the result is a new array containing m x  
n objects.


One solution that comes to mind is to create a "multiply" category for  
NSObject, NSArray and maybe NSString if that's what you know your  
objects are going to be. For each class you need to define what it  
means to multiply it by another object, be it an array, another object  
of its own kind or any other object. For strings for example it might  
mean concatenating the strings or inserting them into a formatted  
string. Once you've done that you can simply write something like:


result = 1;

for( each object in primaryArray )
result = [result multiplyBy:object];


Here's a very quick attempt at doing this - seems to work pretty well.  
Note that in the case of multiplying one array by another, if either  
array is empty it returns the other one. This is not strictly  
mathematically correct as it implies that n x 0 = n, which is not  
true. However this does simplify calling the code unconditionally (and  
if it offends you, you can redefine the empty array == 1) since the  
case of multiplying an array by a series of arrays is made to work  
simply.


This isn't the only solution, but it's object-oriented and clean. Hope  
it helps - interesting problem ;-)


--Graham





@interface NSArray (Multiply)

- (NSArray*)multiplyBy:(id) object;
- (NSArray*)multiplyByArray:(NSArray*) objects;
+ (void)testMultiplication;

@end


@interface NSObject (Multiply)

- (id)  multiplyBy:(id) object;

@end


@interface NSString (Multiply)

- (NSString*)   multiplyBy:(id) object;

@end



@implementation NSArray (Multiply)


- (NSArray*)multiplyByArray:(NSArray*) objects
{
	// returns an array which is all the combinations of the objects in  
the input array with the objects of self. To simplify things,
	// the empty array is treated as equal to a constant of 1, i.e. array  
* empty -> array, not -> empty.


if([self count] == 0 )
return objects;
else if([objects count] == 0 )
return self;
else
{
NSMutableArray* result = [NSMutableArray array];

unsigned i, j;

for( i = 0; i < [self count]; ++i )
{
for( j = 0; j < [objects count]; ++j )
[result addObject:[[self objectAtIndex:i] multiplyBy:[objects  
objectAtIndex:j]]];

}
return result;
}
}



- (NSArray*)multiplyBy:(id) object
{
  

Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Kyle Sluder
On Mon, Feb 23, 2009 at 10:08 PM, Tommy Nordgren
 wrote:
>        It will be /Volumes/Mother 1/...  I've tested.
> This can be handled by using a regexp class for the matching instead of a
> simple
> equality test.
>        Also, while it's possible to mount a disk image at other places than
> under Volumes,
> that won't happen when doubleclicking a disk image or it being mounted from
> Safari

This sounds like an amazing trip through Software Engineering Hell!

1) Relying on an implementation detail of a third-party application
(Safari mounts images in /Volumes).
2) Hard-coding a path in the filesystem (/Volumes)
3) Not considering other actions that can lead to the same
circumstance (a user can create a directory in /Volumes)
4) Bringing in a third-party regular expression library to deal with
paths (since one that works with NSString is not provided with the
system)
5) Not just using the system-provided facilities to ask the direct
question ("Is the volume on which this app's bundle resides
removable?") but relying on aforementioned assumptions to ask an
indirect question ("Does the path of the bundle of this app match a
pattern that resembles that of the system-created directories in the
default location for mount points?")

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


Disabled, auto-disappearing placeholder in search field like Safari, Console.app

2009-02-23 Thread Jerry Krinock
When I bind to an NSSearchField with option key=value pair  
NSNullPlaceholderBindingOption="Search names", indeed "Search names"  
is displayed in the search field whenever the bound keyPath is nil.   
But it appears as normal black text which the user must overtype.


In contrast, the "Google" search field in Safari has disabled (gray)  
text that disappears when the field becomes the key view.  The search  
field in Console.app has similar behavior.


I want my placeholder to behave like the ones in Safari and Console.   
Is this behavior built in to NSSearchField, or did they subclass it  
and write a little code?  If it's built in, how do I get it?


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: Simple way to traverse 2D array?

2009-02-23 Thread Mark Ritchie

On 23-Feb-09, at 7:36 PM, Ashley Perrien wrote:
I can't think of a way to nest the loops if I don't know how deeply  
to nest them.


Hey Ashley!

Thanks!  This was a fun diversion while I take a break from looking  
for a gig! ;-)  One solution is to use a second array which keeps the  
indices.  That way, on each iteration, you know where you are on each  
array.  Then the only fun part is to pay attention to roll over when  
incrementing each index!


Here's an implementation which illustrates my idea. While it works for  
me, please check it's suitability to your purpose and please don't use  
it for large arrays without additional memory management!



// Initialize the 2D array
NSMutableArray *arrays = [NSMutableArray array];
[arrays addObject:[NSArray arrayWithObjects:@"1", @"2", @"3", nil]];
	[arrays addObject:[NSArray arrayWithObjects:@"A", @"B", @"C", @"D",  
nil]];
	[arrays addObject:[NSArray arrayWithObjects:@"Red", @"White",  
@"Blue", nil]];


// Initialize the starting index in each array
NSMutableArray *indices = [NSMutableArray array];
for (int index = 0; index < [arrays count]; index++){
[indices addObject:[NSNumber numberWithInt:0]];
}

BOOL done = NO;
while(!done && ([arrays count] > 0)){
// Extract one item from each array
NSMutableArray *results = [NSMutableArray array];
for (int index = 0; index < [indices count]; index++){
NSArray *currentArray = [arrays objectAtIndex:index];
NSNumber *currentIndex = [indices objectAtIndex:index];
			id currentObject = [currentArray objectAtIndex:[currentIndex  
intValue]];

[results addObject:currentObject];
}
NSLog([results componentsJoinedByString:@", "]);

// Increment the indices, rolling over from inner most to outer 
most
for (int index = ([indices count] - 1); index >= 0; index--){
NSArray *currentArray = [arrays objectAtIndex:index];
NSNumber *currentIndex = [indices objectAtIndex:index];
int indexValue = [currentIndex intValue];
indexValue++;
if(indexValue == [currentArray count]){
indexValue = 0; // reset this index
if(index == 0){
done = YES; // we're done when we reset 
the outer most index
}
}
NSNumber *newIndex = [NSNumber 
numberWithInt:indexValue];
[indices replaceObjectAtIndex:index 
withObject:newIndex];
if(indexValue != 0){
break; // since this index didn't reset
}
}
}


Good luck!
Mark
__
Mark Ritchie
Cocoa and WebObjects Developer
Diamond Lake Consulting Inc.
Toronto, Ontario, 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: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren


On Feb 24, 2009, at 4:53 AM, Kyle Sluder wrote:


5) Not just using the system-provided facilities to ask the direct
question ("Is the volume on which this app's bundle resides
removable?") but relying on aforementioned assumptions to ask an
indirect question ("Does the path of the bundle of this app match a
pattern that resembles that of the system-created directories in the
default location for mount points?")

--Kyle Sluder
	This last trick is not useful for telling wether the user is running  
the app directly from the download

dmg.
	Testing wether the Volume containing the app is removeable will match  
for ANY volume except the boot volume.

---
Engineers supporting greenpeace: Comparable to Afroamericans who wants  
to join the Ku Klux Klan


Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-23 Thread Tommy Nordgren


On Feb 24, 2009, at 3:34 AM, Shawn Erickson wrote:


On Mon, Feb 23, 2009 at 6:22 PM, Tommy Nordgren
 wrote:

The following code will test if you are running from the DMG:

NSString * volName = @"Mother";
NSString * appName = @"MyApp.app";

if ([[[NSBundle mainBundle] bundlePath] isEqualTo: [ NSString
stringWithFormat:@"/Volumes/%@/%@",volName,appName]) {

  //Here you can show an alert telling the user to to copy the  
app to

the applications folder

}


If a disk image it mounted a second time (can happen in a few ways) it
won't be at /Volumes/Mother/... but at /Volumes/Mounter 1/... Also you
can mount disk images in location other then under /Volumes/...

If you really want to check this you should utilize
DiskImages.framework (IIRC) or possibly use "hdutil info -plist" and
look for your disk image and its current mount location. Then compare
that to your bundles location.

-Shawn


Unfortunately, the DiskImages framework is private (no headers)
Getting the output of hdiutil is a little awkward since the NSDictionary
class has no method to initialize from a pipe.
--
What is a woman that you forsake her, and the hearth fire and the home  
acre,
to go with the old grey Widow Maker.  --Kipling, harp song of the Dane  
women

Tommy Nordgren
tommy.nordg...@comhem.se



___

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

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

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

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