Punching holes into IKImageView

2010-04-05 Thread Gerriet M. Denkmann
I have an IKImageView and would like to create holes, i.e. set alpha to zero in 
some rectangle.
And then save the result in some format.

What would be the easiest way to do this?

1. Create a CIFilter and do:
myIkImageView.imageCorrection = myHoleFIlter
save myIkImageView

2. 
CGImageRef cgImage = [ myIkImageView image ];
NSBitmapImageRep  *bp = [ [NSBitmapImageRep alloc ] initWithCGImage: 
cgImage];
NSColor *c = [ NSColor clearColor];
for the intended rectangle do: [ bp setColor: c atX: ... y: ...];
CGImageRef new = [ bp CGImage ];
[ myIkImageView setImage: new  imageProperties: ...];
save myIkImageView

3.  Something else? Maybe just use an existing filter 
(CISourceOverCompositing ?) to put a clear rectangle on top?


Efficiency is not the prime concern. It would be acceptable if it takes a few 
seconds to create a hole.
I have no experience with CIFilter yet.


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


Re: Two text fields, one outlet?

2010-04-05 Thread Klaus Backert


On 5 Apr 2010, at 04:09, Jenny M wrote:


This is the method I ended up going with. I had tried to use bindings
before by doing exactly that - setting up a property, synthesizing it,
and binding the value to the property - but I noticed I was setting
the value wrong. I was calling
  property = [NSNumber...]
rather than
  [self setProperty:[]]. -- Finally, that worked!!



Setting of properties can and should be done this way (except when  
using the modern runtime and synthesizing the instance variable):


self.property = ...

which is equivalent to [self setProperty: ...]

Klaus

___

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

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

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

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


Any frameworks for Leopard's Spaces?

2010-04-05 Thread Ulai Beekam

How can I make my app know about when a space has changed, and when it has done 
so to which space it has changed? Also, how can I read which Spaces and how 
many are currently available? I'm allowed to use Snow Leopard.

The only thing I'm aware of is the NSWorkspaceActiveSpaceDidChangeNotification 
in NSWorkspace, but that only tells me that a space changed, but doesn't 
provide me with any more information.

Any ideas? I suppose the developer of Hyperspaces.app would know about this, 
but I guessed that he wouldn't want to tell me about his trade secrets :) Not 
that I'm gonna develop a competing product, just need to do some in-house stuff 
that allows for different keyboard layouts for differents spaces, but anyway, 
better to ask here I think.  
_
Hotmail: Trusted email with Microsoft’s powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969___

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

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

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

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


Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?

2010-04-05 Thread Jerry Krinock
OK, I filed Bug ID# 7827354.  (See bottom of this message.)  But I don't see 
the need for MAKVONotificationCenter here...


On 2010 Apr 02, at 22:33, Kyle Sluder wrote:

 I would think that the right thing to do would be to subclass 
 NSArrayController and write a
 -canPerformFoo method.

Yes, so I went back and did it the right way.  To be general, I called it 
simply -(BOOL)hasSelection

 But you would need to self-observe the selection property,

Indeed, because of the bug in NSArrayController, this doesn't work:

+ (NSSet*)keyPathsForValuesAffectingHasSelection {
return [NSSet setWithObject@selection] ;
}

 which is perilous because -removeObserver:forKeyPath: doesn't take a context 
 argument (another
 bug every Cocoa developer should file a duplicate of).  So you could use 
 MAKVONotificationCenter (or OFBinding, our analogue) to self-observe.

I already use MAKVONotificationCenter in this project, but I don't see the need 
for it here.  In the array controller's -dealloc,

[self removeObserver:self 
  forKeyPath:@selectedObjects] ;

Why is that perilous?  (It seems to work.)

 Perhaps it would be easier to instead put the -canPerformFoo method on your 
 window controller.

I already have my own NSArrayController subclass for other reasons.


**

Apple Bug ID# 7827354
Title: NSArrayController Observeable Methods Don't Do 
+keyPathsForValuesAffectingKey

Summary:  There are four methods which give the selection in some form, and 
they are all documented to be observable using key-value observing.  However, 
none of them trigger change notifications when their name is returned in 
+keyPathsForValuesAffectingKey.

Steps to Reproduce:

1.  Require an instance variable which is a function of the current selection 
in an NSArrayController.  Here is a simple example:

// In @interface,

/*!
 @briefReturns whether or not any content item in the receiver
 is selected.
@details  This property should be observeable using KVO.
*/
- (BOOL)hasSelection ;

// In @implementation,

+ (NSSet*)keyPathsForValuesAffectingHasSelection {
return [NSSet setWithObjects:
// Any one of the following should be sufficient.
@selection,
@selectedObjects,
@selectionIndex,
@selectionIndexes,
nil] ;
}

- (BOOL)hasSelection {
return ([[self selectedObjects] count]  0) ;
}

2.  Bind some binding in a user-interface element, for example the 'enabled' 
binding of some button which requires a selection in the array controller, to 
the 'hasSelection' property.

3.  Build and run the project.

4.  Change the number of items selected in the array controller from 0 to some 
nonzero number, and vice versa.

Expected Results:

When the number of selected objects changes, the object observing 
'hasSelection' should invoke -hasSelection.

Actual Results:

-hasSelection does not get invoked.

Notes:

I am advised by Kyle Sluder that the bug underlying this bug is the bug that 
+keyPathsForValuesAffectingValueForKey relies on 
NSKeyValueObservingOptionPrior, and that NSArrayController doesn't support 
NSKeyValueObservingOptionPrior.  See discussion here:

http://lists.apple.com/archives/Cocoa-dev/2010/Apr/msg00088.html

You must read the entire thread because I originally discovered this problem 
indirectly, and we also hypothesized other causes which turned out to be wrong.






___

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

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

Help/Unsubscribe/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 the #import directive

2010-04-05 Thread Jeremy Pereira

On 2 Apr 2010, at 00:59, Steve Cronin wrote:

 
 On Apr 1, 2010, at 5:58 PM, Jens Alfke wrote:
 
 
 On Apr 1, 2010, at 3:51 PM, Steve Cronin wrote:
 
 I have an import statement like the last example but I can't find any bar 
 directory
 I'm unable to determine the particular instance of foo.h that is being 
 used here…
 
 Select bar/foo.h and press Cmd-Shift-D (File  Open Quickly). That should 
 open the header. Then you can command-click the window title to see the path.
 
 —Jens
 
 Jens;
 
 Thanks for this and it did allow me to find the offending file.
 
 I now would like to specify a different remote source for a few headers.
 I have set 'Header Search Paths to  $(SRCROOT)/../../dir1/dir2  (recursive 
 checked)
 
 I can't seem to figure out how to refer to them in the #import statement…
 #import dir2/foo.h  -- no such
 #import /foo.h-- no such file..
 
 How do I do this?

Have you tried #import foo.h yet?  

 
 Thanks for helping out here!
 Steve___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/adc%40jeremyp.net
 
 This email sent to a...@jeremyp.net

___

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

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

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

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


NSMutableURLRequest: How to change Request URI?

2010-04-05 Thread Lloyd Sargent
Writing an iPhone app to login to a site remotely that is running php. In order 
to log in to the website it appears I need to do the following:

POST /submit.php?do=submit HTTP/1.1\r\n

However, no matter what I do all I seem to be able to accomplish is:

POST / HTTP/1.1\r\n

It appears that the / HTTP/1.1\r\n are added by NSMutableURLRequest. But I 
need it to be /submit.php?do=submit HTTP/1.1\r\n. So how do I make these 
changes?

Cheers,

Lloyd___

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

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

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

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


Problem with NSData

2010-04-05 Thread McLaughlin, Michael P.
In a Cocoa app targeting Leopard, I am getting a malloc error when using the
NSData method

- (void)getBytes:(void *)buffer

My function is as follows:

-(void)getDataSz:(void*)data ofSize:(NSUInteger)sz
{
   NSData *theData = [input readDataOfLength:sz];
   [theData getBytes:data]; // -- no error when commented out
}

This function is actually in a subtask and
input
is an NSFileHandle.

Input is reading data (from the main task) correctly with no error.
However,

[theData getBytes:data];

generates the following error (most of the time):

malloc: *** free() called with 0x9aadca0 with refcount 0
malloc: *** auto malloc[3230]: agc error for object 0x9aadca0: Deallocating
a non-block

In normal operation, getDataSz takes in a buffer allocated by an STL vector
in the following call:

[mySubtaskServer getDataSz:my_vec[0] ofSize:dataSize];

If (just for testing), I replace the argument, data, with a local malloc
buffer (in getDataSz) and free it before exiting, then I do not see this
error.  

FWIW, I also do not see this error in an earlier call in which the amount of
data read is less than a block (4096 bytes).

The Build options have
Call C++ Default Ctors/Dtors in Objective-C
set to YES
and garbage-collection is Supported.

Compiler is gcc 4.2.

Is there something else I should be doing here?
Thanks.

-- 
Mike McLaughlin

___

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

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

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

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


Re: Finding managed objects by URI representation

2010-04-05 Thread Gideon King
On 05/04/2010, at 6:51 AM, Ben Trumbull wrote:

 No, this is going the wrong way.  The objectID is the object's identity in 
 the persistent store (e.g. primary key).  You don't need to store pieces of 
 it somewhere else.
 
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@self == %@, 
 myobjectid];
 or
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@self in %@, 
 objectidarray];
 

Can I just clarify a couple of things about this:

1. The documentation says Important:  If the receiver has not yet been saved, 
the object ID is a temporary value that will change when the object is saved. 
Now I want to use the IDs as keys in a dictionary, which of course copies the 
keys, and it is very likely that the objects will be added to the dictionary 
before saving, and referenced after save. I have checked, and the documentation 
is true - the object ID does get changed to a completely new one (different 
pointer) upon save, and also I note in the documentation, it warns about the 
file modification date, so in order to make sure this works, I believe I will 
have to do the following before I put it into my dictionary (I don't want to 
have my object directly as an instance variable of the managed object, since 
the object is at the UI layer, and the managed object layer shouldn't need to 
know about it):

if ([[myManagedObject objectID] isTemporaryID]) {
NSError *error = nil;
if (![[myManagedObject managedObjectContext] 
obtainPermanentIDsForObjects:[NSArray arrayWithObject:myManagedObject] 
error:error]) {
log4Error(@Could not obtain permanent ID for %@, 
myManagedObject);
if (error) {
[NSApp presentError:error];
}
return nil;
}
NSPersistentDocument *document = self view] window] 
windowController] document];
[document setFileModificationDate:[NSDate date]];
}
...(create my object)...
[myDictionary setObject:anObject forKey:[myManagedObject objectID]];

But when I try that, it throws an exception saying Can't resolve how to assign 
objects to stores; Coordinator does not have any stores. 

The documentation says Any object not already assigned to a store is assigned 
based on the same rules Core Data uses for assignment during a save operation 
(first writable store supporting the entity, and appropriate for the instance 
and its related items).. 

My store class is registered in applicationWillFinishLaunching:, and everything 
seems to work OK while saving, so I would have expected it to be able to create 
one if it needed to, but the error seems to imply that I have to manually 
create my atomic store and add it to the coordinator before this, in order to 
be able to get it to generate the permanent ID. 

If this is the case, sure, I can create one, but I'm not sure what URL to give 
it seeing as the user hasn't saved it yet, and besides, I'm not sure if it will 
have any impact on the behavior when the user actually does save it.

I just want to check that I haven't gone off on the wrong path again with this, 
and that I really do have to do all this to get a stable ID...it just seems to 
me that if I have to do all this just to get a stable ID, maybe there is some 
more fundamental design issue with my program, or concept I am not getting, and 
maybe I am trying to work against the way the framework is supposed to be used.



2. From the Predicate Programming Guide, it says that SELF refers to the 
objects that are being searched. I read through the whole guide and found 
nothing there stating that it could also refer to the managed object ID. I did 
eventually find it in the Core Data Programming Guide, but even when I knew 
what I was looking for, it took ages to find. I really think it should be 
mentioned in the Predicate Programming Guide - should I file a bug against that 
documentation?


Thanks

Gideon___

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

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

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

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


Re: Run Loop in Tool Idles for 60.0 seconds before exitting [Solved]

2010-04-05 Thread Ken Thomases
On Apr 4, 2010, at 11:00 PM, Jerry Krinock wrote:

 On 2010 Apr 04, at 14:44, Ken Thomases wrote:
 
 Since you're already using operations, why use the above 'while' loop, 
 anyway?  Why not use -[NSOperationQueue waitUntilAllOperationsAreFinished].  
 Or schedule a sentinel operation that depends on all of the other 
 operations, either directly or indirectly, and then invoke 
 -waitUntilFinished on it.
 
 Alas, many of my operations call back to perform Core Data operations on the 
 main thread.  (Syncing multiple managed object contexts never looked like 
 much fun to me.)  The disadvantage is that this nice, clean approach you 
 suggest results in deadlock.

Ah, yes.  This approach won't work in that case.


 - (void)tickleRunLoop {
// No op
 }
 
 /* This method is called from the -main of the final NSOperation
 in an Agent task.  Like all NSOperations, it's running on a
 secondary thread. */
 - (void)terminateWork {
// Set the exit condition for Worker
[[AgentPerformer sharedPerformer] setIsDone:YES] ;
 
// Now install an input source on the main run loop, so that
// in Worker-main.m, in main(), -runLoop:beforeDate: will
// unblock, the above exit condition will be tested, found
// to be true, and cause the loop to break so that Worker
// can continue along to exit.
[self performSelectorOnMainThread:@selector(tickleRunLoop)
   withObject:nil
waitUntilDone:YES] ;
 }
 
 This is actually a simple modification of the code at the end of my original 
 post, except that now we remember to call back to the main thread -- Thank 
 you, Ken!

You're welcome.

 I'm happy with this, although I suspect someone might suggest something less 
 kludgey.

You might have -terminateWork only do the -setIsDone: step.  Then, instead of 
the operation's -main directly invoking -terminateWork, it could perform it on 
the main thread.  That way, the setting of isDone is actually happening on the 
main thread, plus it serves as its own tickle of the run loop.

Also, there's no need to pass YES for the waitUntilDone: parameter.  Since this 
is the last thing you need to be done on the background thread, there's no need 
to be sure it's complete before exiting.  In general, it's best to avoid 
blocking the worker threads managed for your by NSOperationQueue or GCD.


 I still wonder why my original code exitted after a 60-second timeout, though.

Well, the run loop documentation specifically warns that you can't be sure that 
your input sources are the only input sources in the run loop.  The frameworks 
may put their own input sources there, too.

In this case, my guess is that it was the last worker thread timing out from 
waiting for work, and shutting itself down.  It may have performed some 
internal selector on NSOperationQueue on the main thread, to inform it that the 
worker thread had terminated.

Regards,
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: Any frameworks for Leopard's Spaces?

2010-04-05 Thread Ulai Beekam

I don't mind using private API for this. After all my goal is to make some 
simple in-house app and it doesn't matter too much if it breaks after some OS X 
update.

I am aware the private API discussion is forbidden here. Thus, if anyone can 
point me in the right direction, I would appreciate it if he or she can send me 
an off-list message about it.

Thanks in advance, U.




-
The NSWorkspace notification is the only public API for this. Relatedly, you 
should not use private APIs which will restrict Apple's ability to change the 
internal implementation easily in the future, and make innovations or 
improvements difficult on them.

-Steven



  
_
Hotmail: Trusted email with powerful SPAM protection.
https://signup.live.com/signup.aspx?id=60969___

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

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

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

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


Preservation of State

2010-04-05 Thread Frederick C. Lee
Greetings:
I wish to preserve the state of an iPhone/iTouch application; which means 
that I would like the application to continue deep down within a stock of View 
Controllers at a particular view when I return to the application.

   Does this mean that I need to preserve the ID of a particular 
viewController/position in the NSUserDefaults?   For example, I store a unique 
identifier/pathway of a target in NSUserDefaults then navigate back to that 
position upon return to the application?


What is the recommended paradigm to handle this?

Regards,

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: NSMutableURLRequest: How to change Request URI?

2010-04-05 Thread Nick Zitzmann

On Apr 5, 2010, at 7:30 AM, Lloyd Sargent wrote:

 Writing an iPhone app to login to a site remotely that is running php. In 
 order to log in to the website it appears I need to do the following:
 
 POST /submit.php?do=submit HTTP/1.1\r\n
 
 However, no matter what I do all I seem to be able to accomplish is:
 
 POST / HTTP/1.1\r\n
 
 It appears that the / HTTP/1.1\r\n are added by NSMutableURLRequest.

Yes; that is required by the spec. Otherwise the server would assume the client 
is using an ancient version of HTTP, which is not what you want to happen.

 But I need it to be /submit.php?do=submit HTTP/1.1\r\n. So how do I make 
 these changes?

Are you sure you're setting the URL correctly? That bit is part of the URL. 
What is the returned value of [request URL] prior to placing the request into a 
connection?

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

___

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

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

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

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


Re: NSMutableURLRequest: How to change Request URI?

2010-04-05 Thread Lloyd Sargent
  It appears that the / HTTP/1.1\r\n are added by NSMutableURLRequest.
 
 
 Yes; that is required by the spec. Otherwise the server would assume the 
 client is using an ancient version of HTTP, which is not what you want to 
 happen.

Got it.

 But I need it to be /submit.php?do=submit HTTP/1.1\r\n. So how do I make 
 these changes?
 
 
 Are you sure you're setting the URL correctly? That bit is part of the URL. 
 What is the returned value of [request URL] prior to placing the request into 
 a connection?

Doh!!! Thanks, it's been a while and the mind gets rusty.

Yup, just added it to the URL and now it works just perfect! I'm a happy camper!

Cheers,

Lloyd___

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

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

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

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


Modal Window with dynamic nstextfield

2010-04-05 Thread Jeremy Matthews
I have a modal window with code to update both a progress bar and corresponding 
text...the progress bar gets updated just fine but the textfield never does 
(except if I re-run the method the last string I pushed to the textfield from 
the previous run does appear).My understanding was that if you ran a modal 
session you could still interact with the UI to display changes...let me know 
what I'm missing here. I created a simple run loop to detail my issue.

[NSApp  beginSheet: progressWindow
   modalForWindow: mainWindow
modalDelegate: self
   didEndSelector: nil
  contextInfo: nil];
NSModalSession session = [NSApp 
beginModalSessionForWindow:progressWindow];
[progressIndicator displayIfNeeded];
[progressIndicator setDoubleValue:0.0];
[NSApp runModalSession:session];
int mmm;
for (mmm=0;mmm150;mmm++)
{
[progressIndicator displayIfNeeded];
[progressIndicator setDoubleValue:mmm];
NSString *temp222 = [NSString stringWithFormat:@%d,mmm];
NSLog(@string value is %d,mmm);
[statusText setStringValue:temp222];
}
NSDate *future2 = [NSDate dateWithTimeIntervalSinceNow:2];
[NSThread sleepUntilDate:future2];
[NSApp endModalSession:session];
[progressWindow orderOut:self];
[NSApp endSheet:progressWindow];


Thanks,
jeremy
___

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

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

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

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


Re: Preservation of State

2010-04-05 Thread WT
On Apr 5, 2010, at 6:04 PM, Frederick C. Lee wrote:

 Greetings:
I wish to preserve the state of an iPhone/iTouch application; which means 
 that I would like the application to continue deep down within a stock of 
 View Controllers at a particular view when I return to the application.
 
   Does this mean that I need to preserve the ID of a particular 
 viewController/position in the NSUserDefaults?   For example, I store a 
 unique identifier/pathway of a target in NSUserDefaults then navigate back to 
 that position upon return to the application?
 
 
 What is the recommended paradigm to handle this?
 
 Regards,
 
 Ric

Hi Frederick,

I've been giving some thought to the same question lately and here's what I've 
come up with.

For a UI that is heavy on drilling down a hierarchy of view controllers, I 
imagine the path from the application's root view controller to any other view 
controller as represented by an instance of NSIndexPath. So, for example, the 
index path 1.3.2 would represent going through the second VC from the root 
controller, then the fourth VC accessible from that, then the third VC 
accessible from that. (Recall that indices in an index paths are zero-based)

So, one could have an index path ivar in the application delegate which is 
updated every time a given VC is pushed into, or popped from, the navigation 
stack. Naturally, that ivar is saved when the application terminates and read 
when the application starts up.

Then, once it's read back in, it's just a matter of following the bread crumbs 
to the last visited view controller. Of course, one needs to make sure that 
this automated walk-through of the hierarchy has the same relevant effects as 
when the user did it, but not everything needs to be redone. For instance, 
animations that might happen in the intermediate view controllers need not be 
performed again, since the goal is to get back to the last visited view 
controller as quickly as possible.

I'm very interested in other people's take on this issue, since I have no idea 
if my solution is the best or even the recommended way of achieving the desired 
result.

Wagner___

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

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

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

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


Re: C typedef for NS ptrs?

2010-04-05 Thread Sean McBride
On Fri, 2 Apr 2010 16:38:48 -0500, Andy O'Meara said:

A have a couple vanilla NS object ptrs (e.g. NSWindow*) that I have to
pass through some cross-plaform C++ code until it ends up in a .mm file
where where the NS object is accessed.  The problem is that in the .cpp
code, there's no obvious way to declare a NSWindow ptr so that thinks
will link without complaint.

You could maybe use this trick:

http://lists.apple.com/archives/cocoa-dev/2009/Dec/msg01466.html

basically:

The header objc/objc.h is a C-language header implementing the
runtime. It defines some standard types used by Objective-C, including
id. So if you include this, your headers can use the id data type even
if they're included from plain C++ or C files.

--

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


___

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

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

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

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


Bindings ivars

2010-04-05 Thread Charles Burnstagger
Why, after I have connected a control in my nib. window using bindings can I no 
longer access it from code?

After connecting a checkbox control using bindings, when my window controller 
loads, that control's ivar shows up as nil.

Thanks,

Chuck



  
___

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

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

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

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


Standard controls on top of NSGradients

2010-04-05 Thread Charles Burnstagger
I have a custom NSView subclass that contains an NSGradient. All this class 
does is draw a grey vertical gradient like iPhoto and iTunes do.

When I place standard controls on top of one of my custom gradient views, when 
clicked, they also draw their rects with the same gradient - even though I 
don't include any code to do that. Do I need to lockFocus or some other aspect 
of CG on my custom view before I draw my gradient in my view's drawRect: method?

Thanks,

Chuck



  
___

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

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

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

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


Re: Standard controls on top of NSGradients

2010-04-05 Thread David Duncan
On Apr 5, 2010, at 12:15 PM, Charles Burnstagger wrote:

 When I place standard controls on top of one of my custom gradient views, 
 when clicked, they also draw their rects with the same gradient - even though 
 I don't include any code to do that. Do I need to lockFocus or some other 
 aspect of CG on my custom view before I draw my gradient in my view's 
 drawRect: method?


What happens is when those controls redraw, some part of your view is 
invalidated, so you are asked to draw again. I suspect that when you draw, you 
are then using the rect parameter passed to -drawRect: to determine the extends 
of the gradient – which is incorrect.

The rect parameter passed to -drawRect: is only a hint as to what parts of the 
view need to be redrawn. You should always do your drawing with respect to your 
view's bounds.
--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Andy O'Meara

Hey cocoa crew, quick question...

I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity() since 
it appears to be unavailable under x86_64.

Any help or suggestion would be appreciated!

Thanks,
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: Problem with NSData

2010-04-05 Thread McLaughlin, Michael P.
I may be off on an island by myself here but I thought I'd add some more
info just in case someone recognizes it and has a useful thought.

The error described below occurs because the data I sent through
NSFileHandle to NSData (in the subtask) was actually the elements of a
vectormyStruct
[just the array, not the vector header].

myStruct itself contains four fields which are STL containers and, hence,
have ctors/dtors, etc., of their own.

The fields are two strings, a list and a map, the latter two being empty.

If I create a pseudo_myStruct for testing that lacks these four fields, then
everything works.

Therefore, there is some STL/malloc issue involved in recreating
vectormyStruct with its STL containers
from the bytes recovered from an NSData object regardless of how one
accesses those bytes.  [I've tried all of the available NSData methods.]
Also, I had expected the copy in the subtask to be shallow but I might have
been mistaken on that score.

That is the limit of my knowledge about this and, if anyone has been down
this road before, I'd appreciate a clue or two.

Thanks again.

In a Cocoa app targeting Leopard, I am getting a malloc error when using the
NSData method

- (void)getBytes:(void *)buffer


My function is as follows:

-(void)getDataSz:(void*)data ofSize:(NSUInteger)sz
{
   NSData *theData = [input readDataOfLength:sz];
   [theData getBytes:data]; // -- no error when commented out
}

This function is actually in a subtask and
input
is an NSFileHandle.

Input is reading data (from the main task) correctly with no error.
However,

[theData getBytes:data];

generates the following error (most of the time):

malloc: *** free() called with 0x9aadca0 with refcount 0
malloc: *** auto malloc[3230]: agc error for object 0x9aadca0: Deallocating
a non-block

In normal operation, getDataSz takes in a buffer allocated by an STL vector
in the following call:

[mySubtaskServer getDataSz:my_vec[0] ofSize:dataSize];

If (just for testing), I replace the argument, data, with a local malloc
buffer (in getDataSz) and free it before exiting, then I do not see this
error. 

FWIW, I also do not see this error in an earlier call in which the amount of
data read is less than a block (4096 bytes).

The Build options have
Call C++ Default Ctors/Dtors in Objective-C
set to YES
and garbage-collection is Supported.

Compiler is gcc 4.2.

Is there something else I should be doing here?
Thanks.

-- 
Mike McLaughlin

___

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

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

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

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


Re: Standard controls on top of NSGradients

2010-04-05 Thread Charles Burnstagger
Thanks.

Changing to [ self.theGradient drawInRect:self.bounds angle:90.0 ];

in drawRect:

did the trick.

Chuck





From: David Duncan david.dun...@apple.com
To: Charles Burnstagger burnstag...@yahoo.com
Cc: cocoa-dev@lists.apple.com
Sent: Mon, April 5, 2010 12:23:46 PM
Subject: Re: Standard controls on top of NSGradients

On Apr 5, 2010, at 12:15 PM, Charles Burnstagger wrote:

 When I place standard controls on top of one of my custom gradient views, 
 when clicked, they also draw their rects with the same gradient - even though 
 I don't include any code to do that. Do I need to lockFocus or some other 
 aspect of CG on my custom view before I draw my gradient in my view's 
 drawRect: method?


What happens is when those controls redraw, some part of your view is 
invalidated, so you are asked to draw again. I suspect that when you draw, you 
are then using the rect parameter passed to -drawRect: to determine the extends 
of the gradient – which is incorrect.

The rect parameter passed to -drawRect: is only a hint as to what parts of the 
view need to be redrawn. You should always do your drawing with respect to your 
view's bounds.
--
David Duncan
Apple DTS Animation and Printing



___

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

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

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

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


Re: Bindings ivars

2010-04-05 Thread Kevin Cathey
Chuck,

By bindings, do you mean Cocoa Bindings or a standard IBOutlet?

If you mean Cocoa Bindings using the Bindings Inspector, then your control 
will only be accessible from code if you have made a standard outlet connection 
with it. Different types of connections (outlets, actions, bindings, etc) are 
separate entities. Having one does not mean the others are present. But it is 
certainly common to have multiple types of connections active for a given 
object (outlet to a button, action from the button, and binding the button's 
enabled property, for example).

Kevin

On 5 Apr 2010, at 11:53, Charles Burnstagger wrote:

 Why, after I have connected a control in my nib. window using bindings can I 
 no longer access it from code?
 
 After connecting a checkbox control using bindings, when my window controller 
 loads, that control's ivar shows up as nil.
 
 Thanks,
 
 Chuck
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cathey%40apple.com
 
 This email sent to cat...@apple.com

___

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

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

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

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


Re: Why doesn't -[NSArrayController selection] et al fire keyPathsForValuesAffectingKey?

2010-04-05 Thread Kyle Sluder
On Mon, Apr 5, 2010 at 3:08 AM, Jerry Krinock je...@ieee.org wrote:
 I already use MAKVONotificationCenter in this project, but I don't see the 
 need for it here.  In the array controller's -dealloc,

    [self removeObserver:self
              forKeyPath:@selectedObjects] ;

 Why is that perilous?  (It seems to work.)

Because if NSArrayController also self-observes on @selectedObjects,
you've removed that observation from under its feet.

MAKVONotificationCenter and OFBinding solve this problem by creating
separate objects, so they'll only ever register for a keypath once.

--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: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
Looks to me like it's still available for x86_64. Are you linking with the 
CoreServices framework?

Kevin


On Apr 5, 2010, at 12:36 PM, Andy O'Meara wrote:

 
 Hey cocoa crew, quick question...
 
 I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity() since 
 it appears to be unavailable under x86_64.
 
 Any help or suggestion would be appreciated!
 
 Thanks,
 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/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.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: Two text fields, one outlet?

2010-04-05 Thread Kyle Sluder
On Mon, Apr 5, 2010 at 1:56 AM, Klaus Backert klaus.back...@t-online.de wrote:
 Setting of properties can and should be done this way (except when using the
 modern runtime and synthesizing the instance variable):

There's nothing different about synthesizing the instance variable.

If you want the property semantics, use either dot syntax (foo.bar =
baz) or message syntax ([foo setBar:baz]). They are defined to be
exactly equivalent. Again, you can use whichever you like.

If you want the direct ivar access semantics (for example, in -init
and -dealloc), but you've synthesized the ivar, you can use pointer
dereference through self to get at it (self-bar = baz).

Both semantics are necessary. It's important to understand the
difference between them.

Older compilers don't support pointer dereference for synthesized
ivars. This is a bug, and you should upgrade your development tools.

--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: Bindings ivars

2010-04-05 Thread Joanna Carter

Le 5 avr. 2010 à 19:53, Charles Burnstagger a écrit :

 Why, after I have connected a control in my nib. window using bindings can I 
 no longer access it from code?
 
 After connecting a checkbox control using bindings, when my window controller 
 loads, that control's ivar shows up as nil.

A binding is a mechanism whereby a property of something like a control can be 
linked to a property of another object. It allows the observing object to be 
updated when the value of the observed property changes. It is not meant to 
be a means of talking to an object in a NIB.

If you need access to an object in the N IB, then you need to add an IBOutlet 
to the controller class and hook it up to the appropriate object in the NIB.

If you want to use the observer mechanism of bindings, then you cannot use an 
ivar in the observed class, you need a KVO compliant property instead, 
otherwise the notifications of change will not get sent to the observing object.

Joanna

--
Joanna Carter
Carter Consulting

___

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

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

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

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


Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Sean McBride
On Mon, 5 Apr 2010 14:36:56 -0500, Andy O'Meara said:

I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity()
since it appears to be unavailable under x86_64.

Google IOPMAssertionCreate / IOPMAssertionCreateWithName

Here's a snippit from our app:

err = IOPMAssertionCreate (
kIOPMAssertionTypeNoDisplaySleep,

kIOPMAssertionLevelOn,
_assertionID);

--

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


___

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

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

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

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


Re: Modal Window with dynamic nstextfield

2010-04-05 Thread Kyle Sluder
On Mon, Apr 5, 2010 at 10:15 AM, Jeremy Matthews jeremymatth...@mac.com wrote:
        for (mmm=0;mmm150;mmm++)
        {
                [progressIndicator displayIfNeeded];
                [progressIndicator setDoubleValue:mmm];
                NSString *temp222 = [NSString stringWithFormat:@%d,mmm];
                NSLog(@string value is %d,mmm);
                [statusText setStringValue:temp222];
        }

Oh, dear.

I would highly recommend reading the Threading Programming Guide:
http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html

--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: Finding managed objects by URI representation

2010-04-05 Thread Ben Trumbull

On Apr 5, 2010, at 8:18 AM, Gideon King wrote:

 On 05/04/2010, at 6:51 AM, Ben Trumbull wrote:
 
 No, this is going the wrong way.  The objectID is the object's identity in 
 the persistent store (e.g. primary key).  You don't need to store pieces of 
 it somewhere else.
 
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@self == %@, 
 myobjectid];
 or
 NSPredicate *predicate = [NSPredicate predicateWithFormat:@self in %@, 
 objectidarray];
 
 
 Can I just clarify a couple of things about this:
 
 1. The documentation says Important:  If the receiver has not yet been 
 saved, the object ID is a temporary value that will change when the object is 
 saved. Now I want to use the IDs as keys in a dictionary, which of course 
 copies the keys, and it is very likely that the objects will be added to the 
 dictionary before saving, and referenced after save. I have checked, and the 
 documentation is true 

Yes, the documentation is true :-)

 But when I try that, it throws an exception saying Can't resolve how to 
 assign objects to stores; Coordinator does not have any stores. 

What is going on is that you haven't yet saved the NSDocument so there is no 
database backing it.  Until the first save, the document is entirely in memory. 
 We cannot assign a permanent objectID until you actually have a persistent 
store file.

 The documentation says Any object not already assigned to a store is 
 assigned based on the same rules Core Data uses for assignment during a save 
 operation (first writable store supporting the entity, and appropriate for 
 the instance and its related items).. 

Yes.  You can explicitly set the object to a store as well.

 My store class is registered in applicationWillFinishLaunching:, and 
 everything seems to work OK while saving, so I would have expected it to be 
 able to create one if it needed to, but the error seems to imply that I have 
 to manually create my atomic store and add it to the coordinator before this, 
 in order to be able to get it to generate the permanent ID. 

That's the store Class.  The exception message is that your NSDocument's PSC 
doesn't actually have any stores (files) added to it at all.

 I just want to check that I haven't gone off on the wrong path again with 
 this, and that I really do have to do all this to get a stable ID...it just 
 seems to me that if I have to do all this just to get a stable ID, maybe 
 there is some more fundamental design issue with my program, or concept I am 
 not getting, and maybe I am trying to work against the way the framework is 
 supposed to be used.


Well, what are you doing such that you need this dictionary that maps object 
IDs before the document has ever been saved ?  Where are you sending this 
dictionary off to ?



 2. From the Predicate Programming Guide, it says that SELF refers to the 
 objects that are being searched. I read through the whole guide and found 
 nothing there stating that it could also refer to the managed object ID. I 
 did eventually find it in the Core Data Programming Guide, but even when I 
 knew what I was looking for, it took ages to find. I really think it should 
 be mentioned in the Predicate Programming Guide - should I file a bug against 
 that documentation?


Please do.

- Ben



___

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

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

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

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


Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Andy O'Meara

On Apr 5, 2010, at 3:31 PM, Kevin Wojniak wrote:

 Looks to me like it's still available for x86_64. Are you linking with the 
 CoreServices framework?
 
 Kevin


Yeah, I've got:

#include CoreServices/CoreServices.h

void foo() {
UpdateSystemActivity( UsrActivity );   // Error: 'UpdateSystemActivity' was 
not declared in this scope
}

Also, if I declare it, I get a link error saying the symbol doesn't exist.

It'd be nice to use UpdateSystemActivity(), but it seems Sean's IOKit method 
the only way to proceed (thanks Sean!).

Andy


 
 
 On Apr 5, 2010, at 12:36 PM, Andy O'Meara wrote:
 
 
 Hey cocoa crew, quick question...
 
 I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity() 
 since it appears to be unavailable under x86_64.
 
 Any help or suggestion would be appreciated!
 
 Thanks,
 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/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.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: Two text fields, one outlet?

2010-04-05 Thread Klaus Backert


On 5 Apr 2010, at 22:40, Kyle Sluder wrote:

On Mon, Apr 5, 2010 at 1:56 AM, Klaus Backert klaus.back...@t-online.de 
 wrote:
Setting of properties can and should be done this way (except when  
using the

modern runtime and synthesizing the instance variable):


There's nothing different about synthesizing the instance variable.

If you want the property semantics, use either dot syntax (foo.bar =
baz) or message syntax ([foo setBar:baz]). They are defined to be
exactly equivalent. Again, you can use whichever you like.

If you want the direct ivar access semantics (for example, in -init
and -dealloc), but you've synthesized the ivar, you can use pointer
dereference through self to get at it (self-bar = baz).

Both semantics are necessary. It's important to understand the
difference between them.

Older compilers don't support pointer dereference for synthesized
ivars. This is a bug, and you should upgrade your development tools.

--Kyle Sluder


Yes, I know. My statement above has a different background, among  
other things a documentation bug (somebody told me off list about it),  
and, sigh, my incomplete ablity of expressing myself in a foreign  
language.


Klaus

___

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

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

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

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


Problems with repetetive execution of netstat using NSTask and NSTimer

2010-04-05 Thread Kazior Fukacz

Hello,

I'm working on an application named IPShowX. Take a look at for more  
info: http://kaziorvb.pl/IPShowX/
When I run it, it keeps working perfectly fine for a few minutes,  
then stops refreshing the IP and prints:


IPShowX[14917] *** NSTimer discarding exception '*** -[NSCFDictionary  
setObject:forKey:]: attempt to insert nil value' that raised during  
firing of timer with target 34e410 and selector 'getGameIP:'


every 3 seconds (what's my NSTimer's interval). It's my first Cocoa  
application and I don't really understand the problem.


My application works like this:
- On awakeFromNib it sets up the timer and executes my IP-refreshing  
method named getGameIP for the first time
- Every 3 seconds, the timer executes the mentioned getGameIP method,  
parses netstat's output and changes my NSTextField's value to the  
parsed IP


This is how my class' .m file looks like:

http://ipshowx.pastebin.com/ARFR3HRr

As you can see, getGameIP reads output of netstat -n. Then looks  
for .4000 in it. If it finds that substring, it extracts 4  
preceding characters, then extracts characters that occur right after  
the . and finally passes them to the text field. Otherwise the  
method sets the text field's value to -.


I tried googling the error but I couldn't find anything either  
related or helpful.


I would greatly appreciate if anyone could take a look at my issue.

Regards,
kaziorvb
___

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

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

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

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


Re: Problems with repetetive execution of netstat using NSTask and NSTimer

2010-04-05 Thread Ken Thomases
On Apr 5, 2010, at 4:05 PM, Kazior Fukacz wrote:

 When I run it, it keeps working perfectly fine for a few minutes, then stops 
 refreshing the IP and prints:
 
 IPShowX[14917] *** NSTimer discarding exception '*** -[NSCFDictionary 
 setObject:forKey:]: attempt to insert nil value' that raised during firing of 
 timer with target 34e410 and selector 'getGameIP:'
 
 every 3 seconds (what's my NSTimer's interval). It's my first Cocoa 
 application and I don't really understand the problem.

Well, I'm not sure how much you do understand.

Cocoa container classes can't contain 'nil' values; they can only contain 
actual objects.

Something, somewhere is attempting to insert a nil value into a 
NSMutableDictionary-derived object.  This causes an exception to be raised.

As a convenience, NSTimer catches and discards any exceptions which happen 
during execution of its selector, and logs the above message when it happens.  
It also, apparently, stops the timer from repeating subsequently.


It will help in diagnosing this to run your program under the debugger.  From 
Xcode's Run menu, enable Stop on Objective-C Exceptions.  Then, when the 
exception occurs the debugger will suspend the program and allow you to 
investigate.  You can see from the stack trace where exactly in your method the 
problem is happening.  You can also check out some other program state (e.g. 
variable values) to see if that explains what's happening.

I suspect you may be getting output from netstat that is not in pure ASCII.  
Then, 'string' will be nil and that will cascade through so that IPSubstr is 
nil and IPSplit is nil.  Then, you're passing a nil value to [IPField 
setStringValue:].


By the way, are you using garbage collection?  If not, then you're leaking 
several objects (those pointed to by 'netstat', 'pipe', and 'string').

Regards,
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: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
Including it isn't enough, you still need to link it with your other 
frameworks. I did this with a blank project and got no errors with a 64-bit 
build. Anyways, the IOKit function is probably the better way to go :)


On Apr 5, 2010, at 2:16 PM, Andy O'Meara wrote:

 
 On Apr 5, 2010, at 3:31 PM, Kevin Wojniak wrote:
 
 Looks to me like it's still available for x86_64. Are you linking with the 
 CoreServices framework?
 
 Kevin
 
 
 Yeah, I've got:
 
 #include CoreServices/CoreServices.h
 
 void foo() {
UpdateSystemActivity( UsrActivity );   // Error: 'UpdateSystemActivity' 
 was not declared in this scope
 }
 
 Also, if I declare it, I get a link error saying the symbol doesn't exist.
 
 It'd be nice to use UpdateSystemActivity(), but it seems Sean's IOKit method 
 the only way to proceed (thanks Sean!).
 
 Andy
 
 
 
 
 On Apr 5, 2010, at 12:36 PM, Andy O'Meara wrote:
 
 
 Hey cocoa crew, quick question...
 
 I'm looking for a Cocoa replacement for Carbon's UpdateSystemActivity() 
 since it appears to be unavailable under x86_64.
 
 Any help or suggestion would be appreciated!
 
 Thanks,
 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/kainjow%40kainjow.com
 
 This email sent to kain...@kainjow.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: Modal Window with dynamic nstextfield

2010-04-05 Thread Jeremy Matthews

Oh dear?

Sent from my iPhone

On Apr 5, 2010, at 4:47 PM, Kyle Sluder kyle.slu...@gmail.com wrote:

On Mon, Apr 5, 2010 at 10:15 AM, Jeremy Matthews jeremymatth...@mac.com 
 wrote:

   for (mmm=0;mmm150;mmm++)
   {
   [progressIndicator displayIfNeeded];
   [progressIndicator setDoubleValue:mmm];
   NSString *temp222 = [NSString  
stringWithFormat:@%d,mmm];

   NSLog(@string value is %d,mmm);
   [statusText setStringValue:temp222];
   }


Oh, dear.

I would highly recommend reading the Threading Programming Guide:
http://developer.apple.com/Mac/library/documentation/Cocoa/Conceptual/Multithreading/Introduction/Introduction.html

--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: Modal Window with dynamic nstextfield

2010-04-05 Thread Kyle Sluder
On Mon, Apr 5, 2010 at 3:12 PM, Jeremy Matthews jeremymatth...@mac.com wrote:
 Oh dear?

Yeah. It's a pretty heavy topic. Your use of a for loop inside a modal
runloop to perform a lengthy operation leads me to believe you'll be
starting at the ground level.

Please read through the Threading Programming Guide. It probably won't
answer all the questions it raises, but it will make you more informed
about how to perform lengthy operations within an event-driven GUI
framework, and enable you to ask better questions.

--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: Modal Window with dynamic nstextfield

2010-04-05 Thread Jeremy Matthews

On Apr 5, 2010, at 6:18 PM, Kyle Sluder wrote:

 On Mon, Apr 5, 2010 at 3:12 PM, Jeremy Matthews jeremymatth...@mac.com 
 wrote:
 Oh dear?
 
 Yeah. It's a pretty heavy topic. Your use of a for loop inside a modal
 runloop to perform a lengthy operation leads me to believe you'll be
 starting at the ground level.

Back to basics...

 
 Please read through the Threading Programming Guide. It probably won't
 answer all the questions it raises, but it will make you more informed
 about how to perform lengthy operations within an event-driven GUI
 framework, and enable you to ask better questions.

I love asking better questions - if only I knew what those were.

 
 --Kyle Sluder

thx
___

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

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

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

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


Re: How do I get a file reference w/o relying on the path?

2010-04-05 Thread Sean McBride
On Sat, 3 Apr 2010 18:31:03 -0700, Jens Alfke said:

Brad, what you want is a bookmark (in 10.6) or an alias reference.
Aliases didn't have a Cocoa API until 10.6, but the procedural API isn't
hard to use.

There is the 3rd party NDAlias wrapper, which works quite well:
http://github.com/nathanday/ndalias


On Sun, 4 Apr 2010 12:28:59 -0500, Ken Thomases said:

Sorry.  I probably shouldn't have said deprecated.  Aliases are not
officially deprecated, as far as I know.  Perhaps superseded is a
better word.

It likely won't be deprecated for a long long time either, just like the
Resource Manager.  Many file formats (including QuickTime's .mov) store
aliases and so Apple needs to keep this functionality forever.

--

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


___

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

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

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

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


Re: Multi Window cocoa application

2010-04-05 Thread John Baldwin
Depending on what you need to communicate and why, you might be able to use the 
NSNotificationCenter to meet your needs.

John

On Saturday Apr 3  4:22 PM, at 4:22 PM, Bharadwaj Parthasarathy wrote:

 
 Hi,
 
 I am currently working on porting an existing open source windows application 
 to mac OSX.
 I am fairly new to cocoa programming.
 
 The application involves opening a new window for a specifying the parameters 
 of the simulation.
 The second window has about 20 textboxes and cannot be a modal window.
 I have the XIB files and I got the windows working together somehow, but 
 needs a lot of fixing.
 
 If there are multiple windows in an application, how do I pass values and 
 messages between them?
 
 Apple developer library does not have an example source code and many 
 internet sources point to
 /Developer/Examples/InterfaceBuilder/SimpleMultiWindow which is apparently 
 not present in leopard.
 If some one has this example, that would be great. Also, this example being 
 removed hints that there is a new and better way to do it?
 
 I would appreciate if someone can pass on resources or sample code on working 
 with multiple windows in a cocoa application.
 Just to clarify, this is not a document based application. You can reach me 
 at barbi dot bruce at gmail
 
 Thanks,
 B
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/johnbaldwincocoa%40gmail.com
 
 This email sent to johnbaldwinco...@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: Finding managed objects by URI representation

2010-04-05 Thread Sean McBride
On Sun, 4 Apr 2010 23:14:20 +1000, Gideon King said:

I have some queries that used to look up objects based on an elementID
attribute, which used to be my unique identifier for objects, created
when the objects were inserted or loaded.

I use this pattern also.

I am now moving away from that
and using the standard managed object IDs and reference objects.

Why?  All the reasons you and Ben have been discussing is exactly why I
find it much easier to just have my own unique identifier.  The
downsides are: 1) takes a little more space in the store (and on disk
and in RAM) 2) is slower to fetch against vs using the permanent
NSManagedObjectID.  I'm curious why you are switching.  I have thought
about doing the same, but it just seems like way more work for little benefit.

--

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


___

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

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

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

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


Re: How do I compare two NSDates using NSPredicate Core Data

2010-04-05 Thread Sean McBride
On Sun, 4 Apr 2010 23:15:16 -0400, Michael A. Crawford said:

Thus far I've gotten away with using -predicateWithFormat and scalar
values.  I now need to compare a couple of NSDate instances but am not
sure how to code it up with NSPredicate.  Consider me a 'visual' learner.

I'm pretty sure you can use just , , ==, etc. with NSDates in NSPredicates.

--

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


___

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

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

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

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


Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Sean McBride
On Mon, 5 Apr 2010 15:02:49 -0700, Kevin Wojniak said:

Including it isn't enough, you still need to link it with your other
frameworks. I did this with a blank project and got no errors with a 64-
bit build. Anyways, the IOKit function is probably the better way to go :)

IIRC, UpdateSystemActivity was accidentally/incorrectly excluded from 64
bit on some older SDK, I think the 10.5 SDK.  That might be why it works
for you and not him.

--

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


___

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

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

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

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


Re: UpdateSystemActivity replacement in Cocoa?

2010-04-05 Thread Kevin Wojniak
Yep, you're right. I built against 10.5 SDK and got the same problems.


On Apr 5, 2010, at 5:06 PM, Sean McBride wrote:

 On Mon, 5 Apr 2010 15:02:49 -0700, Kevin Wojniak said:
 
 Including it isn't enough, you still need to link it with your other
 frameworks. I did this with a blank project and got no errors with a 64-
 bit build. Anyways, the IOKit function is probably the better way to go :)
 
 IIRC, UpdateSystemActivity was accidentally/incorrectly excluded from 64
 bit on some older SDK, I think the 10.5 SDK.  That might be why it works
 for you and not him.
 
 --
 
 Sean McBride, B. Eng s...@rogue-research.com
 Rogue Researchwww.rogue-research.com
 Mac Software Developer  Montréal, Québec, Canada
 
 

___

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

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

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

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


Re: Finding managed objects by URI representation

2010-04-05 Thread Gideon King
You know you might just be right. The core problem was that I was using the 
value that I had generated as my reference object, because of my lack of 
understanding about it needing to be consistent for a particular managed 
object, but different for different objects (even if they had been loaded from 
the same store). And then I thought the managed object IDs were unique 
identifiers, but now understand that they change between creation and storage, 
and are therefore not like primary keys. 

So maybe I overreacted to take my identifiers out altogether. I could move my 
managed object ID to a different attribute in my store, and have my own id 
written out when I need to, and when I need to store and load relationships, 
just do them via the IDs. and not the managed object IDs.

Sometimes it's difficult to see the woods from the trees.

Thanks

Gideon

On 06/04/2010, at 10:00 AM, Sean McBride wrote:

 On Sun, 4 Apr 2010 23:14:20 +1000, Gideon King said:
 
 I have some queries that used to look up objects based on an elementID
 attribute, which used to be my unique identifier for objects, created
 when the objects were inserted or loaded.
 
 I use this pattern also.
 
 I am now moving away from that
 and using the standard managed object IDs and reference objects.
 
 Why?  All the reasons you and Ben have been discussing is exactly why I
 find it much easier to just have my own unique identifier.  The
 downsides are: 1) takes a little more space in the store (and on disk
 and in RAM) 2) is slower to fetch against vs using the permanent
 NSManagedObjectID.  I'm curious why you are switching.  I have thought
 about doing the same, but it just seems like way more work for little benefit.

___

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

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

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

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


Re: Problem with NSData

2010-04-05 Thread Graham Cox

On 06/04/2010, at 1:12 AM, McLaughlin, Michael P. wrote:

 In normal operation, getDataSz takes in a buffer allocated by an STL vector
 in the following call:
 
 [mySubtaskServer getDataSz:my_vec[0] ofSize:dataSize];
 
 If (just for testing), I replace the argument, data, with a local malloc
 buffer (in getDataSz) and free it before exiting, then I do not see this
 error.  


I don't see any allocation (of my_vec) going on here anywhere. Show that code. 
It seems you're simply supplying the address of a (possibly uninitialized) 
variable. That will fail in the way you've indicated.

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


Wondering about that iPad page curling

2010-04-05 Thread Laurent Daudelin
I got my hands on an iPad today. I was really impressed with the built-in book 
reader. When you flip the page while holding your finger down, the page will 
curl and follow your finger. Very impressive! Anybody has any idea how one 
would be able to achieve such effect?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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

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

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

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


Re: Wondering about that iPad page curling

2010-04-05 Thread Graham Cox
CIFilter has a page curl transition effect. Just map the 't' value to the 
mouse/finger location.

--Graham


On 06/04/2010, at 10:55 AM, Laurent Daudelin wrote:

 I got my hands on an iPad today. I was really impressed with the built-in 
 book reader. When you flip the page while holding your finger down, the page 
 will curl and follow your finger. Very impressive! Anybody has any idea how 
 one would be able to achieve such effect?

___

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

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

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

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


Re: Wondering about that iPad page curling

2010-04-05 Thread Gleb Dolgich

On 6 Apr 2010, at 01:55, Laurent Daudelin wrote:

 I got my hands on an iPad today. I was really impressed with the built-in 
 book reader. When you flip the page while holding your finger down, the page 
 will curl and follow your finger. Very impressive! Anybody has any idea how 
 one would be able to achieve such effect?

http://blog.steventroughtonsmith.com/2010/02/apples-ibooks-dynamic-page-curl.html

-- 
Gleb Dolgich
http://pixelespressoapps.com/decloner
Decloner -- find and remove duplicate files on your 
Mac___

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

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

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

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


Re: Wondering about that iPad page curling

2010-04-05 Thread Laurent Daudelin
On Apr 5, 2010, at 18:02, Graham Cox wrote:

 CIFilter has a page curl transition effect. Just map the 't' value to the 
 mouse/finger location.
 
 --Graham
 
 
 On 06/04/2010, at 10:55 AM, Laurent Daudelin wrote:
 
 I got my hands on an iPad today. I was really impressed with the built-in 
 book reader. When you flip the page while holding your finger down, the page 
 will curl and follow your finger. Very impressive! Anybody has any idea how 
 one would be able to achieve such effect?
 

It's that easy?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

___

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

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

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

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


Keeping a progress window showing active

2010-04-05 Thread Graham Cox
Hi,

My app currently needs to show a progress bar during startup (Yes, I know - I'm 
working on a better solution so this isn't going to be needed at all longer 
term). The problem I'm having is how to set this up correctly with respect to 
its active appearance. Other apps generally seem to use a normal modeless 
dialog type window with the full height title-bar with the name of the app in 
it. I do that, and also put the window into the 'modal dialog' layer (also 
tried 'status window' layer).

At first all is well, but as my app starts up and creates its first document 
window, that steals focus from the progress window which, though it remains in 
front, becomes inactive in appearance. Ideally I'd like to be able to have it 
remain having its active appearance even as the opened document also has an 
active appearance (or perhaps for the document to open inactive and become 
active when the progress bar completes and its window is hidden). Is there a 
way to do this without subclassing the window itself and forcing the active 
state using an override to the private _hasActiveControls method? For obvious 
reasons I dislike that solution. I also tried using a utility style window 
and that does work for keeping the controls active but has the wrong title bar 
appearance.

Also, while I'm on the subject, what is the Non-Activating checkbox in IB for 
NSWindow for? It doesn't seem to be listed as one of the flags in the Window 
Style masks.

--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: Wondering about that iPad page curling

2010-04-05 Thread Alex Kac
Except CIFilter doesn't exist on the iPad in a public SDK setting.

On Apr 5, 2010, at 8:22 PM, Laurent Daudelin wrote:

 On Apr 5, 2010, at 18:02, Graham Cox wrote:
 
 CIFilter has a page curl transition effect. Just map the 't' value to the 
 mouse/finger location.
 
 --Graham
 
 
 On 06/04/2010, at 10:55 AM, Laurent Daudelin wrote:
 
 I got my hands on an iPad today. I was really impressed with the built-in 
 book reader. When you flip the page while holding your finger down, the 
 page will curl and follow your finger. Very impressive! Anybody has any 
 idea how one would be able to achieve such effect?
 
 
 It's that easy?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin   
 http://nemesys.dyndns.org
 Logiciels Nemesys Software
 laurent.daude...@gmail.com
 Photo Gallery Store: 
 http://laurentdaudelin.shutterbugstorefront.com/g/galleries
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 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.

In the Country of the Blind, the one-eyed man is king.
--Desiderius Erasmus





___

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

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

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

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


Re: Keeping a progress window showing active

2010-04-05 Thread Quincey Morris
On Apr 5, 2010, at 18:31, Graham Cox wrote:

 My app currently needs to show a progress bar during startup (Yes, I know - 
 I'm working on a better solution so this isn't going to be needed at all 
 longer term). The problem I'm having is how to set this up correctly with 
 respect to its active appearance. Other apps generally seem to use a normal 
 modeless dialog type window with the full height title-bar with the name of 
 the app in it. I do that, and also put the window into the 'modal dialog' 
 layer (also tried 'status window' layer).

Maybe you could do something hinky with a custom view that can become first 
responder in the progress window, and arrange to make the document window main 
but the progress window key.

How many document windows are opening? I wonder if a different approach might 
make more sense to a user anyway: Display your freestanding progress window 
*until* the first document window appears. Then get rid of the separate 
progress window and, as each document window appears (one or more), display a 
progress sheet on each document window, showing how close *that* document is to 
being fully open and available. Something along that line.

 Also, while I'm on the subject, what is the Non-Activating checkbox in IB 
 for NSWindow for? It doesn't seem to be listed as one of the flags in the 
 Window Style masks.

It means that clicking on the window when your application is behind other 
applications brings the window to the front, but leaves the application in the 
background. (See NSNonactivatingPanelMask -- IDK if there's anything similar 
that works for NSWindows.)


___

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

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

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

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


Re: Wondering about that iPad page curling

2010-04-05 Thread Laurent Daudelin
That would be a problem, wouldn't it?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://nemesys.dyndns.org
Logiciels Nemesys Software  
laurent.daude...@gmail.com
Photo Gallery Store: http://laurentdaudelin.shutterbugstorefront.com/g/galleries

On Apr 5, 2010, at 18:32, Alex Kac wrote:

 Except CIFilter doesn't exist on the iPad in a public SDK setting.
 
 On Apr 5, 2010, at 8:22 PM, Laurent Daudelin wrote:
 
 On Apr 5, 2010, at 18:02, Graham Cox wrote:
 
 CIFilter has a page curl transition effect. Just map the 't' value to the 
 mouse/finger location.
 
 --Graham
 
 
 On 06/04/2010, at 10:55 AM, Laurent Daudelin wrote:
 
 I got my hands on an iPad today. I was really impressed with the built-in 
 book reader. When you flip the page while holding your finger down, the 
 page will curl and follow your finger. Very impressive! Anybody has any 
 idea how one would be able to achieve such effect?
 
 
 It's that easy?
 
 -Laurent.
 -- 
 Laurent Daudelin
 AIM/iChat/Skype:LaurentDaudelin  
 http://nemesys.dyndns.org
 Logiciels Nemesys Software   
 laurent.daude...@gmail.com
 Photo Gallery Store: 
 http://laurentdaudelin.shutterbugstorefront.com/g/galleries
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 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.
 
 In the Country of the Blind, the one-eyed man is king.
 --Desiderius Erasmus
 
 
 
 
 

___

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

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

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

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


Re: Keeping a progress window showing active

2010-04-05 Thread Graham Cox

On 06/04/2010, at 12:03 PM, Quincey Morris wrote:

 On Apr 5, 2010, at 18:31, Graham Cox wrote:
 
 My app currently needs to show a progress bar during startup (Yes, I know - 
 I'm working on a better solution so this isn't going to be needed at all 
 longer term). The problem I'm having is how to set this up correctly with 
 respect to its active appearance. Other apps generally seem to use a normal 
 modeless dialog type window with the full height title-bar with the name of 
 the app in it. I do that, and also put the window into the 'modal dialog' 
 layer (also tried 'status window' layer).
 
 Maybe you could do something hinky with a custom view that can become first 
 responder in the progress window, and arrange to make the document window 
 main but the progress window key.


I tried adding a non-drawing custom view that is initialFirstResponder, can 
become FR, and refuses to resign FR, but to no avail. It seems that making 
another window main/key will happen regardless of whether the existing key 
window has a view that refuses to resign.

Since I'm otherwise just making use of the standard document-based app opening 
behaviour, there isn't an easy or obvious way to only make the document window 
main but not key (seems -makeKeyAndOrderFront: is being called internally at 
some point). I'll look into that though.

 How many document windows are opening? I wonder if a different approach might 
 make more sense to a user anyway: Display your freestanding progress window 
 *until* the first document window appears. Then get rid of the separate 
 progress window and, as each document window appears (one or more), display a 
 progress sheet on each document window, showing how close *that* document is 
 to being fully open and available. Something along that line.

Generally only one doc opens (just the initial 'untitled' doc) but the progress 
relates to some global setup that takes a little time to run. This is done in a 
second thread, so the normal startup happens in parallel. There isn't any 
lengthy setup per document in this case, though it's a nice idea otherwise.

 Also, while I'm on the subject, what is the Non-Activating checkbox in IB 
 for NSWindow for? It doesn't seem to be listed as one of the flags in the 
 Window Style masks.
 
 It means that clicking on the window when your application is behind other 
 applications brings the window to the front, but leaves the application in 
 the background. (See NSNonactivatingPanelMask -- IDK if there's anything 
 similar that works for NSWindows.)


Ah, right, it's a panel setting rather than a window setting, which is why I 
didn't see it in Window Style masks. Thanks for the clarification.

--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: Problems with repetetive execution of netstat using NSTask and NSTimer

2010-04-05 Thread Adam R. Maxwell

On Apr 5, 2010, at 3:02 PM, Ken Thomases wrote:

 On Apr 5, 2010, at 4:05 PM, Kazior Fukacz wrote:
 
 When I run it, it keeps working perfectly fine for a few minutes, then stops 
 refreshing the IP and prints:
 
 IPShowX[14917] *** NSTimer discarding exception '*** -[NSCFDictionary 
 setObject:forKey:]: attempt to insert nil value' that raised during firing 
 of timer with target 34e410 and selector 'getGameIP:'
 
 every 3 seconds (what's my NSTimer's interval). It's my first Cocoa 
 application and I don't really understand the problem.
 
 Well, I'm not sure how much you do understand.
 
 Cocoa container classes can't contain 'nil' values; they can only contain 
 actual objects.
 
 Something, somewhere is attempting to insert a nil value into a 
 NSMutableDictionary-derived object.  This causes an exception to be raised.

I've seen this before with NSTask, typically when you run out of file 
descriptors.  In a test app I just threw together, the exception is raised 
because NSTask is blindly trying to insert a nil NSFileHandle in an internal 
dictionary (the key is _NSTaskOutputFileHandle).  

If NSTask asserted that it requires a non-nil NSPipe/NSFileHandle, you'd get a 
much more useful error, but you can catch at least some of these by asserting 
that pipe != nil yourself.

[...]

 I suspect you may be getting output from netstat that is not in pure ASCII.  
 Then, 'string' will be nil and that will cascade through so that IPSubstr is 
 nil and IPSplit is nil.  Then, you're passing a nil value to [IPField 
 setStringValue:].

Probably not in this case; -[NSString initWithData:encoding:] will always 
succeed when you use NSASCIIStringEncoding, unfortunately.

 By the way, are you using garbage collection?  If not, then you're leaking 
 several objects (those pointed to by 'netstat', 'pipe', and 'string').

Yeah, I suspect that the pipes (and corresponding NSFileHandles) are indeed 
leaking, and that's the real problem.  You may also want to create and launch 
NSTask instances inside an exception handler, since it and NSFileHandle/NSPipe 
can raise some unexpected exceptions.

-- 
Adam

___

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

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

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

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


Alternative Location of Cocoa ID3 Framework??

2010-04-05 Thread Chase Meadors
I've been searching google for a while, and have repeatedly stumbled  
across mention of an Objective-C ID3 framework constantly linked to


http://drewfamily.homemail.com.au/Cocoa_-_ID3Tag_framework.html

However, I must be really late because this project seems to have  
fallen off the face of the earth. Constant 404's and dead links. Sorry  
if this is somehow inappropriate for the list, but I was wondering if  
anybody here knows ANYTHING about this framework and if I might be  
able to get my hands on it.


Thanks in advance, -Chase
___

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

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

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

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