Re: Resetting the TableView

2009-01-08 Thread Davide Benini

Hi,
note that viewDidLoad gets called only the first time the view is  
loaded (thence its use or setting the hierarchy, things that don't  
change).

Also, note the implementation of viewWillAppear:animated:

-(void)viewWillAppear:(BOOL)animated {
[super viewWillAppear:animated];
[tableView reloadData];
// other customizations here
}

Do not forget the ":animated" part, otherwise the compiler won't  
recognise your method, and it won't get called.

I hope this helps.
Davide


Hi,

I tried all four entry points, they are not getting called. My
ViewController is initialized using initWithNibName.

First time, viewDidLoad gets called. After that, neither viewDidLoad  
nor the

ones you mention gets called. Do i need to do anything special ?

thanks
mohan


On Thu, Jan 8, 2009 at 4:28 PM, Wyatt Webb   
wrote:



Have a look at viewWillAppear/viewDidAppear and
viewWillDisappear/viewDidDisappear on the UIViewController class

You could clear out the table data on the disappear step (so you  
aren't
holding data you don't need) or wait for the appear phase to set up  
your

data before it's shown. These get called as you push and pop the
controllers. The viewdidLoad is just like it sounds. It only gets  
called
when the view is created or loaded from the NIB (which may happen  
more than
once if you have a low memory situation as, I believe, the  
UIViewController
can release it's view if it's not in use). In your normal case, the  
view is
loaded the first time and then kept around as you move it on and  
off the

navigation stack.

HTH,

Wyatt


On Jan 8, 2009, at 4:16 PM, Mohan Parthasarathy wrote:

Yes, but where will call this  when the ViewController is being made

active.
The new view was filled with data previously and i need a chance  
to reset

it. Could you explain in little bit more detail ?

thanks
mohan


On Thu, Jan 8, 2009 at 4:04 PM, sanchezm   
wrote:


UITableView has a reloadData method


- Miguel


On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote:

Hi,



I try to reuse UIViewControllers in didSelectatRowIndexPath. The  
new

View
has a table which is filled with data eventually. Later the view  
gets

popped
and when reusing the same ViewController the table shows old  
data. Is

there
a way to clear the data while still reusing ViewControllers (as
recommended). I tried in viewdidLoad etc. but it seems to get  
called

only
once the first time the View was created.

thanks
mohan
___

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

Please do not post admin requests or moderator comments to the  
list.

Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to sanchez...@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/wwebb%40inspiration.com

This email sent to ww...@inspiration.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/cocoa%40davidebenini.it

This email sent to co...@davidebenini.it


___

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

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

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

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


Weird problem: Application terminates unexpectedly after closing NSOpenPanel sheet

2009-01-08 Thread Oleg Krupnov
Here is my code:

//-
- (IBAction)scanFolder:(id)sender
{
NSOpenPanel* openPanel = [NSOpenPanel openPanel];
[openPanel setCanChooseDirectories:YES];
[openPanel setCanChooseFiles:NO];
[openPanel setAllowsMultipleSelection:NO];
[openPanel beginSheetForDirectory:nil
 file:nil
   modalForWindow:[sourceView window]
modalDelegate:self
   
didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:)
  contextInfo:NULL];
}

//-
- (void)openPanelDidEnd:(NSOpenPanel*)panel returnCode:(int)returnCode
contextInfo:(void*)contextInfo
{
if (returnCode == NSOKButton)
{
[self activatePath:[[panel filenames] objectAtIndex:0]];
}
}


It puzzles me that the application is terminated unexpectedly without
any error messages in the console after the stack is unwinded up from
the openPanelDidEnd function.

What might I be doing 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: Problem sending notification from C callback function

2009-01-08 Thread Ken Thomases

On Jan 8, 2009, at 7:57 PM, Sandro Noel wrote:


I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.


Does not seem to work in what way?  Are you getting compiler errors or  
warnings?  Crashes at runtime?  What?




the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;

NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"]; 

	[[NSNotificationCenter defaultCenter]  
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];

}

Obviously, default center does not exist in the callback,


Actually, I don't know what you mean here, so it's far from obvious.

The default notification center is a singleton.  It always "exists" in  
the sense that you can always retrieve it using [NSNotificationCenter  
defaultCenter], just as you have.




but i cant seem to typecast the context to
my object type and retrieve the notification center from the object.  
i just do not know how to do it.


Well, since the default notification center is a singleton, it is  
effectively globally available.  You don't need to stash a reference  
to it in your object and retrieve it from there.


With regard to the general question of how you can message the object  
passed in context: given that the context is an object pointer, you  
can just cast it:


id myObject = (id)context;
[myObject someMethod:someArgument];

If you have a more specific type than id, go ahead and use that.

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: Best way to handle this

2009-01-08 Thread Ken Thomases

On Jan 8, 2009, at 7:49 PM, Nathan Kinsinger wrote:


On Jan 8, 2009, at 4:20 PM, development2 wrote:

I am hoping someone can help me figure out the best way to handle  
this, I am sure someone out there has some experience with this.


I have some code that sends a command to an external hardware  
device and waits to get the response back with the info that was  
requested of the device. Now what I want to do is animate on screen  
the graphic of the device, showing that it is working. What I tried  
to do at first was setup an NSTimer that would be called every 1  
second say, then call my method to call the device and wait for the  
device to respond. But basically my call blocks the NSTimer because  
it takes some time (actually what I am calling from my code is a  
command line tool that we created that will return a result file to  
us).  So what I want to do is call my method to get the device info  
and while waiting for the response animate this graphic of the  
device in operation. What is the best way to do this?


1) Should I use an NSThread for this?
2) IS there some other Cocoa functionality that might help me here?

Thanks in advance for any help.


The short answer, yes you need to use threads.


I disagree.

The OP is invoking an external program to do the communication, but is  
unnecessarily blocking while waiting for that program to complete.  I  
suggest using NSTask if that's not already what you're doing.  Then  
use the asynchronous notifications of when it completes, and the  
asynchronous methods of NSFileHandle to do the communication, so that  
you don't block while waiting for it.


Using NSTimer for the animation will then work.  You will also be able  
to implement something like a Cancel button.  That is, by not  
blocking, your UI can remain responsive.


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: NSPersistentStoreCoordinator Wars Episode I: The Phantom Lock Menace

2009-01-08 Thread Ben Trumbull

I'm working on a project that uses CoreData objects on multiple
threads at once, where it's not uncommon for the main thread to be
loading data at the same time that an NSOperation running in the
background is processing a different set of data.

Whenever I fetch or store data from an NSManagedObjectContext, I
always make sure to lock and unlock it using the provided methods.


Why aren't you using a separate MOC for the main thread and the  
NSOperation ?  If you are, then you don't need to lock MOCs that are  
perfectly isolated.  If you are not, then you'll still need to lock  
the MOC when working with the managed objects themselves (like  
valueForKey) in addition to fetching or saving.  As Miguel notes, we  
discourage that usage pattern because it's (a) hard to get right and  
(b) tediously locks constantly obviating most performance benefits


You have tried using the multi-threading assertions ?  If you have  
failed to lock a MOC or MO when we require you to, the multit- 
threading assertions should detect that for you.  ADC just released  
the debug libraries for 10.5.6



How do I figure out who is locking the persistent store coordinator
and not unlocking it properly? It's a real mystery, since I've audited
my code several times now, and all locks appear to be balanced (and
until very recently, I wasn't even locking the persistent store
coordinator at all). I already tried setting breakpoints on -[_PFLock
lock] and -[_PFLock unlock] that print the stack traces, but it's
taking hours due to all of the locking and unlocking going on.


What does gdb say after the deadlock happens with:

> info threads
> thread apply all bt

- Ben



___

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

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

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

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


Re: [newbie] Use of accessors versus direct access of ivars

2009-01-08 Thread Quincey Morris

On Jan 8, 2009, at 21:27, Stuart Malin wrote:

I have a class with ivars for which there are accessors. I  
understand that the importance of using a setter method (or to use  
setValue:ForKey:) to set the ivar so that KVO operates. However, Is  
there a compelling reason to use, in the methods of a class, a  
getter method (or valueForKey:) versus directly accessing an ivar of  
the class?


My official opinion: use a getter unless you have a compelling reason  
to do otherwise.


But I'm a bit embarrassed to admit that my usual practice is the  
opposite -- I tend to avoid the getters AND setters within the class  
itself. However, in my own defense:


-- This only applies when the ivar and the property have identical  
semantics. (In which case they have the same name. If the semantics of  
one changes, but not the other, I can change the ivar name and then I  
get compile errors for all the places I need to fix.)


-- This only applies to garbage-collection-enabled applications,  
because then (in most situations) it's only the difference between  
'xxx' and 'self.xxx' (whether getting or setting), and brevity favors  
using the ivar. In retain/release applications, the code brevity  
payoff tilts in favor of using the accessors.


FWIW


___

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

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

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

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


Re: NSPersistentStoreCoordinator Wars Episode I: The Phantom Lock Menace

2009-01-08 Thread sanchezm

Nick,

	I can't be sure on what thread access pattern you are following in  
your application, but it sounds like you might be trying to access the  
same object and managed object context instances from different  
threads.  This is tough to get right.
	The preferred way of doing this is to have a separate context per  
thread pass object IDs between threads


http://developer.apple.com/DOCUMENTATION/Cocoa/Conceptual/CoreData/Articles/cdMultiThreading.html#/ 
/apple_ref/doc/uid/TP40003385-SW2


	In the above document you will also see the statement "If you lock  
(or successfully tryLock) a context, that context must be retained  
until you invoke unlock. If you don’t properly retain a context in a  
multi-threaded environment, you may cause a deadlock."


	Another thing you could try if have captured the deadlock in gdb is  
to try to determine which of the other active threads hasn't released  
the lock yet. You might do this by keeping a per thread counter that  
you increment when you lock and decrement when you unlock. When the  
deadlock is caught in gdb, you can inspect the other threads to see  
which one has the counter in a locked state.


	Finally, if you want to load data in a background thread you might  
want to take a look at the example


/Developer/Examples/CoreData/BackgroundFetching

I hope all this gives you some hints,

- Miguel

On Jan 8, 2009, at 6:14 PM, Nick Zitzmann wrote:


Yes, I did try searching and found nothing interesting...

I'm working on a project that uses CoreData objects on multiple  
threads at once, where it's not uncommon for the main thread to be  
loading data at the same time that an NSOperation running in the  
background is processing a different set of data.


Whenever I fetch or store data from an NSManagedObjectContext, I  
always make sure to lock and unlock it using the provided methods.  
But I'm having a problem where, if there are a lot of records in the  
model ("a lot" defined as 1,000+), some phantom object is leaving a  
stray lock open on the NSPersistentStoreCoordinator object, so I get  
a deadlock as one thread is waiting for the NSManagedObjectContext  
to unlock while the thread that has the lock is twiddling its thumbs  
waiting forever for the NSManagedObjectContext to come unlocked. And  
it's happening on all four CPU architectures.


How do I figure out who is locking the persistent store coordinator  
and not unlocking it properly? It's a real mystery, since I've  
audited my code several times now, and all locks appear to be  
balanced (and until very recently, I wasn't even locking the  
persistent store coordinator at all). I already tried setting  
breakpoints on -[_PFLock lock] and -[_PFLock unlock] that print the  
stack traces, but it's taking hours due to all of the locking and  
unlocking going on.


All I need is to get a stack trace to the code that locked the  
context but forgot to unlock it, which I'd normally do by  
subclassing the lock object and have the subclass keep track of  
stack traces, but I can't hack CoreData to do this (and yes, I did  
try posing, but it was too glitchy, and won't work on PPC64 or  
X86-64 anyway).


I've also tried Guard Malloc, which can often catch glitchy  
behavior, but so far it hasn't found anything either.


Or am I using the wrong locks in the first place?

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


This email sent to sanchez...@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: [newbie] Use of accessors versus direct access of ivars

2009-01-08 Thread Adam Foltzer
Hi Stuart,

I'm still something of a neophyte, but a theme I've found in threads here is
that consistent use of accessors tends to save memory management headaches
if you're not using garbage collection. If you use @property and @synthesize
to generate your accessors, and then use them to both initialize ( [self
setIvar:[[MyObj alloc] init] ) and release ( [self setIvar:nil] ) your
ivars, you bypass most common memory management problems. If you want to add
custom behavior, be sure to write them according to these guidelines to keep
this benefit:

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

Essentially, accessors let you put the majority of your memory management
code in one place, rather than forcing you to pay attention to it in every
method that uses your ivars.

The more abstract benefit of using accessors is that your code becomes
easier to maintain and update. If you decide you want to store an ivar
differently, you can just change its accessors, rather than changing every
method that directly accesses it.

Of course, accessors are not a magic bullet for either of these issues, they
just help in many ways you might not anticipate.

Cheers, and HTH,
Adam

On Fri, Jan 9, 2009 at 12:27 AM, Stuart Malin  wrote:

> I have a class with ivars for which there are accessors. I understand that
> the importance of using a setter method (or to use setValue:ForKey:) to set
> the ivar so that KVO operates. However, Is there a compelling reason to use,
> in the methods of a class, a getter method (or valueForKey:) versus directly
> accessing an ivar of the class?
>
> I have re-read both the Key-Value Observing Programming Guide and Key-Value
> Coding Programming Guide, and have not derived guidance from them on this
> question. Perhaps I have missed something.
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/acfoltzer%40gmail.com
>
> This email sent to acfolt...@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: Getting to the Console Logs

2009-01-08 Thread Jerry Krinock


On 2009 Jan, 08, at 15:25, Reza Farhad wrote:

To get to the bottom of some bugs, I want to also have a look at the  
console Logs that might have been generated by my app or relating to  
my app.

Now where are these files or how can I extract them programatically.


Well, this is not the right forum, but since I'm not sure what would  
be the right forum for general questions like this, here is a link to  
an AppleScript which I send users.  Open it up and you'll see code to  
extract and zip a filtered console log along with lots of other  
troubleshooting data.


http://sheepsystems.com/files/SSYTroubleZipper.zip

You can ask me privately or better yet send further questions to applescript-us...@lists.apple.com 
.  Several folks there are AppleScript magicians.


___

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

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

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

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


[newbie] Use of accessors versus direct access of ivars

2009-01-08 Thread Stuart Malin
I have a class with ivars for which there are accessors. I understand  
that the importance of using a setter method (or to use  
setValue:ForKey:) to set the ivar so that KVO operates. However, Is  
there a compelling reason to use, in the methods of a class, a getter  
method (or valueForKey:) versus directly accessing an ivar of the class?


I have re-read both the Key-Value Observing Programming Guide and Key- 
Value Coding Programming Guide, and have not derived guidance from  
them on this question. Perhaps I have missed something.

___

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

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

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

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


Re: Visualization strategy/choosing a framework

2009-01-08 Thread Adam Foltzer
Just wanted to update for anyone who might be interested -- OpenGL turned
out to be perfect for this. After only the first three chapters of the
OpenGL SuperBible (and a little help from the Hillegass OpenGL chapter),
I've got a visualization up and running with great performance. Now I need
to keep reading so I can make it look halfway decent :)

Thanks again to everyone who chimed in.

Cheers,
Adam

On Tue, Jan 6, 2009 at 10:31 AM, Adam Foltzer  wrote:

> To the list this time :D
>
>
> -- Forwarded message --
> From: Adam Foltzer 
> Date: Tue, Jan 6, 2009 at 10:00 AM
> Subject: Re: Visualization strategy/choosing a framework
> To: Andrew Farmer 
>
>
> I found the Accelerate framework after posting this, and have had some good
> success with it on my Intel Mac. For the iPhone, I found this bit of code
> for accessing the VFP unit, since Accelerate is not available there:
> http://code.google.com/p/vfpmathlibrary/ . I may wind up porting more
> functions from Accelerate to ARM -F assembly, since nearly everything the
> algorithm does is SIMD. The instruction set for the VFP seems capable enough
> to reimplement many of the veclib.h functions, which makes me wonder why
> Apple hasn't done it (at least not publicly ;)
>
> Yes, I'm also getting sidetracked, but this project is all about practice,
> and this seems like an informative rabbit hole :)
>
> Cheers,
> Adam
>
>
> On Tue, Jan 6, 2009 at 1:53 AM, Andrew Farmer  wrote:
>
>> On 01 Jan 09, at 10:56, Adam Foltzer wrote:
>>
>>> Off to do some refactoring of my Swarm class; at the risk of spawning a
>>> tangent, am I just completely missing a Cocoa data structure that's
>>> suited
>>> to matrices of scalar values? I had a working implementation using nested
>>> NSMutableArrays, but the code wound up looking disgusting (my fault, not
>>> the
>>> API's ;-), so I rewrote it with good ol' C arrays, malloc, and free. It
>>> has
>>> no leaks now, and is really, really fast, but I feel like I shouldn't
>>> have
>>> to reinvent the wheel in order to do matrix operations.
>>>
>>
>> The Cocoa collection classes are primarily oriented towards dealing with
>> ObjC objects. If all you're working with is homogeneous arrays of scalar
>> values (or structures consisting of scalar values), you probably are best
>> off using C arrays.
>>
>> That's not to say that Apple has nothing to offer. If you're performing
>> SIMD-esque operations on large matrices or vectors, the Accelerate framework
>> might have some tools you'd be interested in. It's listed under Carbon for
>> some reason, but it's just as applicable to Cocoa applications.
>>
>> If that doesn't do it, but you're fine with targeting Intel machines only,
>> dropping down to the SSE primitives may also be an option to consider.
>>
>
>
>
___

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

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

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

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


Please help

2009-01-08 Thread Parker Logan



Please can any one teach me about code I just started and I want to learn.  
 Thanks for your time


Begin forwarded message:

From: Parker Logan 
Date: January 9, 2009 4:11:52 AM GMT+02:00
To: Cocoa Developers 
Subject: Help


I am new to all this so if any one can help please do. Thank you


From: LIL PLO 








  
___

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

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

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

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


Help

2009-01-08 Thread Parker Logan
I am new to all this so if any one can help please do. Thank you


From: LIL PLO 




  
___

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

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

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

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


Re: Encryption and Security

2009-01-08 Thread Andrew Farmer

On 08 Jan 09, at 16:44, Peter N Lewis wrote:
* If you use any non-system encryption for purposes other that just  
authentication then you'll need to sort out the US Export approval  
drivel.


Don't worry about ITAR - it's a non-issue. There are a few types of  
cryptographic exports that still require approval, but software isn't  
one of them.

___

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

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

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

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


setting accessibility links for cocoa applications in IB

2009-01-08 Thread Yi Qiang
Hi,
I am trying to enable accessibility in one of my features and need a bit of
help figuring out how to do it in IB. Specifically, I want to relate a label
and a text field, e.g "Server: ".

The Accessibility Programming Guideline For Cocoa (url) states:

"To do this, you create an accessibility object to represent the static text
object. Then, in each accessibility object representing one of the titled
user interface elements (each of the address fields, in this example), you
add the NSAccessibilityTitleUIElementAttribute attribute. The value of this
attribute is the accessibility object representing the static text title.
Finally, in the static text title accessibility object, add the
NSAccessibilityServesAsTitleForUIElementsAttribute attribute. The value of
this attribute is an array of the accessibility objects for which this
static text object serves as title (in this example, the array comprises the
set of editable text fields)."

In the information tab in the inspector, there are two things that look of
interest to me. The "link" connection in particular looks relevant here.

There are two headings I am interested in: "Accessibility" and
"Accessibility Reference"

1.  What is the difference between the two?

2.  If I want to set a link between a label and a text field, do I link
the text field to the label, or vice a versa? An do I do it in
"Accessibility" or "Accessibility Reference"

3.  Am I completely wrong about what the "link" reference is for?

Cheers,
Yi
___

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

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

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

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


setting accessibility links for cocoa applications in IB

2009-01-08 Thread Yi Qiang
Hi,
I am trying to enable accessibility in one of my features and need a bit of
help figuring out how to do it in IB. Specifically, I want to relate a label
and a text field, e.g "Server: ".

The Accessibility Programming Guideline For Cocoa (url) states:

"To do this, you create an accessibility object to represent the static text
object. Then, in each accessibility object representing one of the titled
user interface elements (each of the address fields, in this example), you
add the NSAccessibilityTitleUIElementAttribute attribute. The value of this
attribute is the accessibility object representing the static text title.
Finally, in the static text title accessibility object, add the
NSAccessibilityServesAsTitleForUIElementsAttribute attribute. The value of
this attribute is an array of the accessibility objects for which this
static text object serves as title (in this example, the array comprises the
set of editable text fields)."

In the information tab in the inspector, there are two things that look of
interest to me. The "link" connection in particular looks relevant here.

There are two headings I am interested in: "Accessibility" and
"Accessibility Reference"

1.  What is the difference between the two?

2.  If I want to set a link between a label and a text field, do I link
the text field to the label, or vice a versa? An do I do it in
"Accessibility" or "Accessibility Reference"

3.  Am I completely wrong about what the "link" reference is for?

Cheers,
Yi
___

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

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

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

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


Re: Hyperlinks

2009-01-08 Thread Sean McBride
Matthew Morton (mattmor...@me.com) on 2009-01-08 7:02 AM said:

>have bound the value of the NSTextField to an NSAttributedString in a
>custom class and set attributes for NSLinkAtributeName,
>NSForegroundColorAtributeName, and NSUnderlineStyleAttributeName.

If you're interested, you can get the correct 'blue' colour for the
hyperlink like this:

ICAttr  attr;
RGBColorrgbColour;
size = sizeof(RGBColor);
err = ICGetPref (icInstance, kICWebUnreadColor,
&attr, &rgbColour, &size);

(Old API, but still the best way AFAIK.  Even works in 64bit.)

Sean


___

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

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

Help/Unsubscribe/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 sending notification from C callback function

2009-01-08 Thread Sean McBride
Sandro Noel (sandro.n...@mac.com) on 2009-01-08 8:57 PM said:

>DARegisterDiskDisappearedCallback(daSession, NULL,
>&DiskDisappearedCallback, (void *)self);

Is your application garbage collected?  If so, passing self as the
context could be problematic.  See:



Sean


___

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

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

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

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


NSPersistentStoreCoordinator Wars Episode I: The Phantom Lock Menace

2009-01-08 Thread Nick Zitzmann

Yes, I did try searching and found nothing interesting...

I'm working on a project that uses CoreData objects on multiple  
threads at once, where it's not uncommon for the main thread to be  
loading data at the same time that an NSOperation running in the  
background is processing a different set of data.


Whenever I fetch or store data from an NSManagedObjectContext, I  
always make sure to lock and unlock it using the provided methods. But  
I'm having a problem where, if there are a lot of records in the model  
("a lot" defined as 1,000+), some phantom object is leaving a stray  
lock open on the NSPersistentStoreCoordinator object, so I get a  
deadlock as one thread is waiting for the NSManagedObjectContext to  
unlock while the thread that has the lock is twiddling its thumbs  
waiting forever for the NSManagedObjectContext to come unlocked. And  
it's happening on all four CPU architectures.


How do I figure out who is locking the persistent store coordinator  
and not unlocking it properly? It's a real mystery, since I've audited  
my code several times now, and all locks appear to be balanced (and  
until very recently, I wasn't even locking the persistent store  
coordinator at all). I already tried setting breakpoints on -[_PFLock  
lock] and -[_PFLock unlock] that print the stack traces, but it's  
taking hours due to all of the locking and unlocking going on.


All I need is to get a stack trace to the code that locked the context  
but forgot to unlock it, which I'd normally do by subclassing the lock  
object and have the subclass keep track of stack traces, but I can't  
hack CoreData to do this (and yes, I did try posing, but it was too  
glitchy, and won't work on PPC64 or X86-64 anyway).


I've also tried Guard Malloc, which can often catch glitchy behavior,  
but so far it hasn't found anything either.


Or am I using the wrong locks in the first place?

Nick Zitzmann


___

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

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

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

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


Re: Resetting the TableView

2009-01-08 Thread Mohan Parthasarathy
Hi,

I tried all four entry points, they are not getting called. My
ViewController is initialized using initWithNibName.

First time, viewDidLoad gets called. After that, neither viewDidLoad nor the
ones you mention gets called. Do i need to do anything special ?

thanks
mohan


On Thu, Jan 8, 2009 at 4:28 PM, Wyatt Webb  wrote:

> Have a look at viewWillAppear/viewDidAppear and
> viewWillDisappear/viewDidDisappear on the UIViewController class
>
> You could clear out the table data on the disappear step (so you aren't
> holding data you don't need) or wait for the appear phase to set up your
> data before it's shown. These get called as you push and pop the
> controllers. The viewdidLoad is just like it sounds. It only gets called
> when the view is created or loaded from the NIB (which may happen more than
> once if you have a low memory situation as, I believe, the UIViewController
> can release it's view if it's not in use). In your normal case, the view is
> loaded the first time and then kept around as you move it on and off the
> navigation stack.
>
> HTH,
>
> Wyatt
>
>
> On Jan 8, 2009, at 4:16 PM, Mohan Parthasarathy wrote:
>
>  Yes, but where will call this  when the ViewController is being made
>> active.
>> The new view was filled with data previously and i need a chance to reset
>> it. Could you explain in little bit more detail ?
>>
>> thanks
>> mohan
>>
>>
>> On Thu, Jan 8, 2009 at 4:04 PM, sanchezm  wrote:
>>
>>  UITableView has a reloadData method
>>>
>>> - Miguel
>>>
>>>
>>> On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote:
>>>
>>> Hi,
>>>

 I try to reuse UIViewControllers in didSelectatRowIndexPath. The new
 View
 has a table which is filled with data eventually. Later the view gets
 popped
 and when reusing the same ViewController the table shows old data. Is
 there
 a way to clear the data while still reusing ViewControllers (as
 recommended). I tried in viewdidLoad etc. but it seems to get called
 only
 once the first time the View was created.

 thanks
 mohan
 ___

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

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

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

 This email sent to sanchez...@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/wwebb%40inspiration.com
>>
>> This email sent to ww...@inspiration.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


Problem sending notification from C callback function

2009-01-08 Thread Sandro Noel

Greetings.

I'm having a little problem due to lack of knowledge here.

I have this callback from DiskArbritation framework
and I would like to send a notification to my app.
but it does not seem to work.

the callback is registered like this.
daSession  = DASessionCreate(kCFAllocatorSystemDefault);
DASessionScheduleWithRunLoop(daSession, [[NSRunLoop currentRunLoop]  
getCFRunLoop], kCFRunLoopCommonModes);
DARegisterDiskDisappearedCallback(daSession, NULL,  
&DiskDisappearedCallback, (void *)self);



the callback is defined like this.
void DiskDisappearedCallback(DADiskRef disk, void *context){
CFDictionaryRef diskDescription = DADiskCopyDescription(disk);
NSDictionary *nsDiskDescription = (NSDictionary *)diskDescription;

NSString *name = [nsDiskDescription valueForKey:@"DAVolumeName"];
NSString *type = [nsDiskDescription valueForKey:@"DAVolumeKind"];
NSString *path = [nsDiskDescription valueForKey:@"DAVolumePath"]; 

	[[NSNotificationCenter defaultCenter]  
postNotificationName:ADD_REMOVE_NOTIFICATION object:nil userInfo:nil];

}

Obviously, default center does not exist in the callback, but i cant  
seem to typecast the context to
my object type and retrieve the notification center from the object. i  
just do not know how to do it.


could someone enlighten me please ?

thank you Sandro Noel.
___

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

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

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

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


Re: Best way to handle this

2009-01-08 Thread Nathan Kinsinger

On Jan 8, 2009, at 4:20 PM, development2 wrote:

I am hoping someone can help me figure out the best way to handle  
this, I am sure someone out there has some experience with this.


I have some code that sends a command to an external hardware device  
and waits to get the response back with the info that was requested  
of the device. Now what I want to do is animate on screen the  
graphic of the device, showing that it is working. What I tried to  
do at first was setup an NSTimer that would be called every 1 second  
say, then call my method to call the device and wait for the device  
to respond. But basically my call blocks the NSTimer because it  
takes some time (actually what I am calling from my code is a  
command line tool that we created that will return a result file to  
us).  So what I want to do is call my method to get the device info  
and while waiting for the response animate this graphic of the  
device in operation. What is the best way to do this?


1) Should I use an NSThread for this?
2) IS there some other Cocoa functionality that might help me here?

Thanks in advance for any help.


The short answer, yes you need to use threads.

However NSThread is not the only way, the performSelector... set of  
methods can be useful in situations like this.



In particular, - performSelectorInBackground:withObject: for the  
method that runs the command line tool. Then the main thread is free  
to update the graphics in your NSTimer. The UI graphics need to be  
updated from the main thread, so don't block it if at all possible.


When the command line tool returns, call -  
performSelectorOnMainThread:withObject:waitUntilDone: or set a flag,  
so you know when the response has been received.



--Nathan
___

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

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

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

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


Re: Encryption and Security

2009-01-08 Thread Peter N Lewis

At 17:54 + 8/1/09, Matt Keyes wrote:
I am working on an iPhone app that communicates with a .NET SOAP web 
service.  I have the SOAP client down, but now I need to think about 
the security.  The .NET web service ultimately will be validating 
the Windows login as part of the communication process, and I am 
trying to think how best to handle this on the iPhone.  My thoughts 
are that maybe using SSL would be good or encrypting part of the 
data in the transmission (we tend to use Rijndael in most of our 
apps).


I am relatively new to Cocoa, however, and I would appreciate some 
pointers.  I know the CryptoSample project exists out there, but I 
am not clear as to what is possible on the iPhone.  Can I use SSL? 
If not, could I use Rijndael or some other common encryption method? 
If so (for any of this), can anyone point me to a sample.


Several comments:

* Authentication = verifying the person is who they claim to be. 
This is distinct from data privacy/integrity protection for which 
data encryption is useful.


* If you use any non-system encryption for purposes other that just 
authentication then you'll need to sort out the US Export approval 
drivel.  Presumably SSL does not require this.  You can use anything 
you want for the authentication.


* If you use SSL, the server must have a real properly trusted 
certificate as the iPhone has no way to disable this requirement - 
this killed the system SSL for me as the server is a desktop 
application.  Presumably you could include openssl yourself, although 
you might then have to go through the US export encryption stuff.


* Try to avoid storing clear text passwords on the iPhone as your 
preference files can be read off if the phone is stolen and people 
tend to reuse passwords.


* For password hashing, MD5 is easy, but relatively weak. SHA-1 is stronger.

* If you do want a non-system encryption, Blowfish is a few hundred 
lines of public domain code, so its an easy solution.


Enjoy,
   Peter.

--
  Keyboard Maestro 3 Now Available!
   Now run macros from your iPhone with Keyboard Maestro Control!

Keyboard Maestro  Macros for 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: What's the most cocoa-ey pattern for this?

2009-01-08 Thread j o a r


On Jan 8, 2009, at 3:34 PM, Michael B Johnson wrote:


@property (readonly) NSMutableSet *activeMarkers;


You're right - it should be a set, not an array.  But would it be  
mutable if it's readonly?  What are the correct semantics for that,  
actually?



The "readonly" attribute only refers to the property itself, not the  
mutability / immutability characteristics of that property, so it's  
perfectly OK to have a readonly mutable property. That said, you  
typically wouldn't expose a mutable collection through an interface  
like that of course - it's a bit too promiscuous.


If performance allows, the easiest and most straight forward way to  
implement this would be to have an immutable collection, and to  
replace the entire collection whenever it changes. If you need better  
performance or granularity, you can use a mutable collection, but you  
need to ensure that you mutate the collection in such a way that you  
get the KVO behavior that you need.


j o a r


___

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

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

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

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


Re: NSDecimalNumber seen as NSCFNumber; a bug?

2009-01-08 Thread Quincey Morris

On Jan 8, 2009, at 08:49, Davide Benini wrote:


And here the application terminates and I get this error message

*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '*** -[NSCFNumber  
decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector  
sent to instance 0x10755e0'


By far the most common cause of an error like this (the class of the  
object is not what you expect) is a memory management bug in your code.


That is, the NSDecimalNumber object (to which something is holding a  
pointer) has actually been improperly released and deallocated. By  
chance, the same block of memory has since been reused for a  
completely unrelated object (a NSNumber object, in this case).


Check to see that you've followed memory management rules everywhere.  
(Look for a missing retain or an extra release.)



___

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

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

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

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


Re: NSDecimalNumber seen as NSCFNumber; a bug?

2009-01-08 Thread Ashley Clark
Do you have an NSNumberFormatter applied to unitaryPrice somewhere  
that is not set to generate decimal numbers? The documentation  
indicates that generating NSDecimalNumbers is on by default, but just  
dragging the NSNumberFormatter to an empty XIB over here doesn't start  
with it ticked off in the object attributes.


If that's not it you might try setting a breakpoint on your accessor  
and seeing where it's getting set to an NSNumber.


Ashley


On Jan 8, 2009, at 10:49 AM, Davide Benini wrote:


Hello folks,
I have run into a strange issue.
I have a LineItem class featuring a NSDecimalNumber *unitaryPrice  
property.
The property works allright all across my app, except in a single  
view controller.


I have this LineItemDataPickerViewController (UIViewController  
subclass) with


@property (nonatomic, retain) LineItem *lineItem;

Before displaying it, I set

controller.lineItem = aLineItem;

When the controller is displayed, in the viewWillDisplay:animated:  
method, I need to set the unitaryPrice value in the appropriate  
field, but before I perform some rounding.


NSDecimalNumberHandler *roundingBehavior = [NSDecimalNumberHandler  
decimalNumberHandlerWithRoundingMode:NSRoundBankers scale:2  
raiseOnExactness:FALSE raiseOnOverflow:TRUE raiseOnUnderflow:TRUE  
raiseOnDivideByZero:TRUE];
NSDecimalNumber *roundedAmount = [lineItem.unitaryPrice  
decimalNumberByRoundingAccordingToBehavior:roundingBehavior];


And here the application terminates and I get this error message

*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '*** -[NSCFNumber  
decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector  
sent to instance 0x10755e0'


for what it'w worthm, I tried also the following change, which was  
useless.
NSDecimalNumber *roundedAmount = (NSDecimalNumber *) 
[lineItem.unitaryPrice  
decimalNumberByRoundingAccordingToBehavior:roundingBehavior];


I spent a couple of hours analysing the flow with the debugger. The  
controller.lineItem property is correctly set, and the  
lineItem.unitaryPrice object is seen as a NSDecimalNumber until  
BEFORE the LineItemDataPickerViewController  is loaded and  
viewWillAppear:animated is called. Then, inside this method,  
lineItem.unitaryPrice is seen as an "out of scope" NSCFNumber.


I've been googling, and this discussion here is the closest thing I  
found to my issue:


http://www.cocoadev.com/index.pl?NSDecimalNumbersSeenAsNSNumbers

Any suggestion? Could this be a bug?

Davide




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: Resetting the TableView

2009-01-08 Thread Wyatt Webb
Have a look at viewWillAppear/viewDidAppear and viewWillDisappear/ 
viewDidDisappear on the UIViewController class


You could clear out the table data on the disappear step (so you  
aren't holding data you don't need) or wait for the appear phase to  
set up your data before it's shown. These get called as you push and  
pop the controllers. The viewdidLoad is just like it sounds. It only  
gets called when the view is created or loaded from the NIB (which may  
happen more than once if you have a low memory situation as, I  
believe, the UIViewController can release it's view if it's not in  
use). In your normal case, the view is loaded the first time and then  
kept around as you move it on and off the navigation stack.


HTH,

Wyatt

On Jan 8, 2009, at 4:16 PM, Mohan Parthasarathy wrote:

Yes, but where will call this  when the ViewController is being made  
active.
The new view was filled with data previously and i need a chance to  
reset

it. Could you explain in little bit more detail ?

thanks
mohan


On Thu, Jan 8, 2009 at 4:04 PM, sanchezm  wrote:


UITableView has a reloadData method

- Miguel


On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote:

Hi,


I try to reuse UIViewControllers in didSelectatRowIndexPath. The  
new View
has a table which is filled with data eventually. Later the view  
gets

popped
and when reusing the same ViewController the table shows old data.  
Is

there
a way to clear the data while still reusing ViewControllers (as
recommended). I tried in viewdidLoad etc. but it seems to get  
called only

once the first time the View was created.

thanks
mohan
___

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

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

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

This email sent to sanchez...@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/wwebb%40inspiration.com

This email sent to ww...@inspiration.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: Resetting the TableView

2009-01-08 Thread Mohan Parthasarathy
Yes, but where will call this  when the ViewController is being made active.
The new view was filled with data previously and i need a chance to reset
it. Could you explain in little bit more detail ?

thanks
mohan


On Thu, Jan 8, 2009 at 4:04 PM, sanchezm  wrote:

> UITableView has a reloadData method
>
> - Miguel
>
>
> On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote:
>
>  Hi,
>>
>> I try to reuse UIViewControllers in didSelectatRowIndexPath. The new View
>> has a table which is filled with data eventually. Later the view gets
>> popped
>> and when reusing the same ViewController the table shows old data. Is
>> there
>> a way to clear the data while still reusing ViewControllers (as
>> recommended). I tried in viewdidLoad etc. but it seems to get called only
>> once the first time the View was created.
>>
>> thanks
>> mohan
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/sanchezm95%40gmail.com
>>
>> This email sent to sanchez...@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: Resetting the TableView

2009-01-08 Thread sanchezm

UITableView has a reloadData method

- Miguel

On Jan 8, 2009, at 3:58 PM, Mohan Parthasarathy wrote:


Hi,

I try to reuse UIViewControllers in didSelectatRowIndexPath. The new  
View
has a table which is filled with data eventually. Later the view  
gets popped
and when reusing the same ViewController the table shows old data.  
Is there

a way to clear the data while still reusing ViewControllers (as
recommended). I tried in viewdidLoad etc. but it seems to get called  
only

once the first time the View was created.

thanks
mohan
___

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

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

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


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


Resetting the TableView

2009-01-08 Thread Mohan Parthasarathy
Hi,

I try to reuse UIViewControllers in didSelectatRowIndexPath. The new View
has a table which is filled with data eventually. Later the view gets popped
and when reusing the same ViewController the table shows old data. Is there
a way to clear the data while still reusing ViewControllers (as
recommended). I tried in viewdidLoad etc. but it seems to get called only
once the first time the View was created.

thanks
mohan
___

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

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

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

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


Re: Can I call unbind: in finalize? Is it thread safe?

2009-01-08 Thread Rob Keniger


On 09/01/2009, at 2:12 AM, Sean McBride wrote:


I'm inclined to agree.  However, mmalc's page says "If your view may
become full screen, then you should ideally use another invalidation
method to mark when the view is finished with and unbind in that,
otherwise you should unbind in finalize".


This actually doesn't work, -finalize is never called if you still  
have observers registered, so you can't unbind in -finalize.


So if not finalize and not viewWillMoveToSuperview, when can I stop  
the
observing I started in bind:?  That's what I'm trying to get at  
really.



I do it based on a notification from another object (in my case the  
document) when it is cleaning up.


--
Rob Keniger



___

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

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

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

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


Re: What's the most cocoa-ey pattern for this?

2009-01-08 Thread Michael B Johnson


On Jan 8, 2009, at 3:31 PM, Greg Titus wrote:



On Jan 8, 2009, at 3:28 PM, j o a r wrote:



On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:

This Sequence has a delegate, that would like to express interest  
in the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an  
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".



So this is the goal: To be able to track the active element and  
marker, to be notified when elements and markers are activated? It  
seems to me that you're not really talking about delegation, but  
rather observation (?), so how about using KVO (pseudocode &  
incomplete):


@interface Sequence
@property (readonly) Element *activeElement;
@property (readonly) Element *activeMarker;
@property (readonly) Direction currentDirection;
@end

Your observers would add themselves as observers for the properties  
that they are interested in, and then get notified as they changes.  
I think that these three properties would be all that you need to  
satisfy your #1 - #3 above.


Except that there can be multiple active markers (they can overlap).  
But you could change that to:


@property (readonly) NSMutableSet *activeMarkers;


You're right - it should be a set, not an array.  But would it be  
mutable if it's readonly?  What are the correct semantics for that,  
actually?






And then continue to use KVO as joar is proposing...

- Greg


___

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

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

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

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


Re: What's the most cocoa-ey pattern for this?

2009-01-08 Thread Michael B Johnson


On Jan 8, 2009, at 3:28 PM, j o a r wrote:



On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:

This Sequence has a delegate, that would like to express interest  
in the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an  
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".



So this is the goal: To be able to track the active element and  
marker, to be notified when elements and markers are activated? It  
seems to me that you're not really talking about delegation, but  
rather observation (?), so how about using KVO (pseudocode &  
incomplete):


@interface Sequence
@property (readonly) Element *activeElement;
@property (readonly) Element *activeMarker;
@property (readonly) Direction currentDirection;
@end

Your observers would add themselves as observers for the properties  
that they are interested in, and then get notified as they changes.  
I think that these three properties would be all that you need to  
satisfy your #1 - #3 above.


Interesting - that's a nice suggestion.  I need to think on it.

One nit - there would only be a single active Element, but there could  
be multiple active Markers, so your interface would be:


@interface Sequence
@property (readonly) Element* activeElement;
@property (readonly) NSArray* activeMarkers;
@property (readonly) Direction currentDirection;
@end



___

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

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

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

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


Re: What's the most cocoa-ey pattern for this?

2009-01-08 Thread Greg Titus


On Jan 8, 2009, at 3:28 PM, j o a r wrote:



On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:

This Sequence has a delegate, that would like to express interest  
in the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an  
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".



So this is the goal: To be able to track the active element and  
marker, to be notified when elements and markers are activated? It  
seems to me that you're not really talking about delegation, but  
rather observation (?), so how about using KVO (pseudocode &  
incomplete):


@interface Sequence
@property (readonly) Element *activeElement;
@property (readonly) Element *activeMarker;
@property (readonly) Direction currentDirection;
@end

Your observers would add themselves as observers for the properties  
that they are interested in, and then get notified as they changes.  
I think that these three properties would be all that you need to  
satisfy your #1 - #3 above.


Except that there can be multiple active markers (they can overlap).  
But you could change that to:


@property (readonly) NSMutableSet *activeMarkers;

And then continue to use KVO as joar is proposing...

- Greg
___

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

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

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

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


Re: What's the most cocoa-ey pattern for this?

2009-01-08 Thread Greg Titus

Hey Wave,

Is the Sequence delegate interested in all Element/Markers moved into  
and out of? Or only some small subset?


If the former, you really just want something like:

NSNotificationCenter* ctr = [NSNotificationCenter defaultCenter];
SEL s = @selector(enteredElement:);
[ctr addObserver:delegate selector:s name:XXTimeMovedForward  
object:sequence];


and then make the Sequence include the element/marker info as part of  
the notification user info:


NSDictionary *info = [NSDictionary  
dictionaryWithObjectsAndKeys:markerArray, @"XXMarkers", element,  
@"XXElement", nil];
[[NSNotificationCenter defaultCenter]  
postNotificationName:XXTimeMovedForward object:self userInfo:info];


The delegate then examines the user info of the notification it  
receives to get the list of Markers that got entered and the Element  
entered (if any).


If your delegates don't want to see all those notifications and are  
only interested in a small subset of the Elements/Markers, then you'll  
probably want to have your Sequence have its own notification center,  
and have delegates sign up with that center to get notified of  
Elements/Markers. Multiple Sequences then have different centers,  
which would support having the same marker or element in more than one  
sequence (you didn't mention if this was a requirement or not, but it  
wouldn't be a problem)...


Delegate then looks like:

NSNotificationCenter* ctr = [sequence notificationCenter];
SEL s = @selector(enteredElement:);
[ctr addObserver:delegate selector:s name:XXTimeMovedForward  
object:elementInterestedIn];


and the notifications can just be sent from the Sequence via:

[[self notificationCenter] postNotificationName:XXTimeMovedForward  
object:elementMovedInto];


Hope this helps!

- Greg


You'll probably want to have your Sequence have its own


On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:

So I have a "Sequence" of "Elements", ordered by "Time".  Elements  
cannot overlap each other, they can only be strung in a temporal  
line, with no gaps (i.e. the end of one element abuts another,  
unless its at the front or end).


In addition to these Elements, we can drop "Markers" on this  
sequence, where the Markers can be attached to a single point in  
Time, or some contiguous range of Time.  Multiple Markers could be  
on the same point in Time, or overlap each other in Time.


Let's say Time can move forward, move backwards, or instantaneously  
jump to a point in Time.


This Sequence has a delegate, that would like to express interest in  
the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an  
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".


So what info do we need?   Assuming a Sequence has some delegate,  
that delegate could register the Sequence to be told when any of  
those three events happens.


Let's say we use as our unique identifier the following info in a  
dictionary:


- sequence
- time value
- time direction (forward, backwards, impulse (i.e. neither, it just  
appeared there))

- object (i.e. Element or Marker that this Time value concerns

so the delegate registers to get notifications from the sequence by  
(and this is where the pattern is weird):


NSNotificationCenter* ctr = [NSNotificationCenter defaultCenter];
SEL s = @selector(enteredElement:);
NSDictionary* dict = [NSDictionary  
dictionaryWithObjectsAndKeys:sequence, @"XXSequence", time,  
@"XXTimeValue", direction, @"XXTimeDirection", element,  
@"XXElement", nil];
[ctr addObserver:delegate selector:s name:XXTimeMovedForward  
object:dict];


what's weird about this is that we're handing in a *dictionary* that  
contains the object that will send out this notification, not the  
object itself.


That's weird, right?  But you see what I'm trying to do?  Is there  
some other pattern here I'm missing?


Thanks in advance for any help.


--> Michael B. Johnson, PhD
--> http://homepage.mac.com/drwave (personal)
--> http://xenia.media.mit.edu/~wave (alum)
--> MPG Lead
--> Pixar Animation Studios

___

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

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

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

This email sent to g...@omnigroup.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/optio

Re: What's the most cocoa-ey pattern for this?

2009-01-08 Thread j o a r


On Jan 8, 2009, at 2:59 PM, Michael B Johnson wrote:

This Sequence has a delegate, that would like to express interest in  
the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an  
Element or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".



So this is the goal: To be able to track the active element and  
marker, to be notified when elements and markers are activated? It  
seems to me that you're not really talking about delegation, but  
rather observation (?), so how about using KVO (pseudocode &  
incomplete):


@interface Sequence
@property (readonly) Element *activeElement;
@property (readonly) Element *activeMarker;
@property (readonly) Direction currentDirection;
@end

Your observers would add themselves as observers for the properties  
that they are interested in, and then get notified as they changes. I  
think that these three properties would be all that you need to  
satisfy your #1 - #3 above.


j o a r


___

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

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

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

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


Getting to the Console Logs

2009-01-08 Thread Reza Farhad

Hi

I hope this is the right place to be asking this question.

To get to the bottom of some bugs, I want to also have a look at the  
console Logs that might have been generated by my app or relating to  
my app.

Now where are these files or how can I extract them programatically.

Thanks in advance.

Reza
___

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

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

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

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


Re: Tiger vs Leopard Printing

2009-01-08 Thread Raleigh Ledet

David,

Does your code assume that the pages will be printed only once and in  
order during the print cycle?


-raleigh

On Jan 7, 2009, at 5:25 PM, David Blanton wrote:


I build my app with the MACOSX10.4u.sdk.

When the following is executed:

	[[NSPrintOperation printOperationWithView:catalog]  
runOperationModalForWindow:mainWindow delegate:self  
didRunSelector:nil contextInfo:nil];


the Tiger and Leopard print panels are different.

In Leopard you can select to see detail by clicking the arrow next  
to the printer name. This is not available in Tiger.


When I run on Leopard and select the detail view in the print panel,  
if I use the forward and back arrows to preview the print then when  
I choose PDF preview the pages are empty.
If I do not display the detail and click the preview button all is  
well.


Do I need to handle the detail preview in some manner when on Leopard?


David Blanton




___

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

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

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

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


Best way to handle this

2009-01-08 Thread development2
I am hoping someone can help me figure out the best way to handle  
this, I am sure someone out there has some experience with this.


I have some code that sends a command to an external hardware device  
and waits to get the response back with the info that was requested of  
the device. Now what I want to do is animate on screen the graphic of  
the device, showing that it is working. What I tried to do at first  
was setup an NSTimer that would be called every 1 second say, then  
call my method to call the device and wait for the device to respond.  
But basically my call blocks the NSTimer because it takes some time  
(actually what I am calling from my code is a command line tool that  
we created that will return a result file to us).  So what I want to  
do is call my method to get the device info and while waiting for the  
response animate this graphic of the device in operation. What is the  
best way to do this?


1) Should I use an NSThread for this?
2) IS there some other Cocoa functionality that might help me here?

Thanks in advance for any help.
___

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

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

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

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


Re: Encryption and Security

2009-01-08 Thread Don Messerli
Hate to be a stickler for semantics; but here I go.

MD5 is a hashing algorithm, not encryption.  In general, it is not reversible.  
You hash the password, send it across and then compare it with the hashed 
password on the server side.

Encryption is a two-way process.  You encrypt the data, send it, decrypt it and 
use it.

Matt, There are basically two problems you are concerned about.
1.  That the person/entity connecting to your server and possibly modifying 
data there is in fact who they say they are and that they're authorized to do 
so.
This can be as simple as Basic or Digest Authentication ala HTTP which 
concatenates known values with "handshake" exchanged data and then hashes it or 
as complex as signing "handshake" exchanged data with a public key and then 
checking it with the private key.

2. Protecting the data from prying eyes.  This is done with encryption - 
either symmetrical with shared keys or with public/private key pairs.

   Don





From: Arsen Pereymer 
To: cocoa-dev@lists.apple.com; Matt Keyes 
Sent: Thursday, January 8, 2009 12:02:43 PM
Subject: Re: Encryption and Security

Matt,

I have done several implementations similar to what you mention.

Here are some pointers (I can send you code too if you would like):

When sending any sensitive data (i.e. username. password, etc...) via WS from 
iPhone, encrypt the data (I like to use MD5)  before sending to the WS.


_

Arsen Pereymer

--- On Thu, 1/8/09, Matt Keyes  wrote:
From: Matt Keyes 
Subject: Encryption and Security
To: cocoa-dev@lists.apple.com
Date: Thursday, January 8, 2009, 12:54 PM

Hello,

I am working on an iPhone app that communicates with a .NET SOAP web service. 
I have the SOAP client down, but now I need to think about the security.  The
.NET web service ultimately will be validating the Windows login as part of the
communication process, and I am trying to think how best to handle this on the
iPhone.  My thoughts are that maybe using SSL would be good or encrypting part
of the data in the transmission (we tend to use Rijndael in most of our apps).

I am relatively new to Cocoa, however, and I would appreciate some pointers.  I
know the CryptoSample project exists out there, but I am not clear as to what is
possible on the iPhone.  Can I use SSL?  If not, could I use Rijndael or some
other common encryption method?  If so (for any of this), can anyone point me to
a sample.

Any help is appreciated!  Thanks in advance!

~Matt

_
Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_explore_012009___

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

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

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

This email sent to ar...@yahoo.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/donmesserli%40yahoo.com

This email sent to donmesse...@yahoo.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: Convert GWorldPtr into a NSImage

2009-01-08 Thread Graham Cox


On 9 Jan 2009, at 12:53 am, Eric Gorr wrote:

Interesting. It looks like the function has a pixelFormatType  
parameter, so there is no need to place it in the attributes  
dictionary. While it does look like I could get a CVPixelBufferRef,  
what is unclear is how I could get a NSImage from the  
CVPixelBufferRef. I've searched briefly, but couldn't come up with  
anything...all of the messages I found mentioning both these items  
talk about converting a NSImage to a CVPixelBufferRef.


Once you have a raw pixel buffer of any sort, it's easy to get it into  
an NSImage.


First wrap a NSBitmapImageRep around it - you can pass in the base  
address of the pixel buffer in the first parameter ("planes").


Then add the rep to an NSImage. At no point is it necessary to create  
a context, data provider, do any drawing or anything else - you have  
the data (the pixel buffer) it just needs putting into the right  
structure.


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


What's the most cocoa-ey pattern for this?

2009-01-08 Thread Michael B Johnson
So I have a "Sequence" of "Elements", ordered by "Time".  Elements  
cannot overlap each other, they can only be strung in a temporal line,  
with no gaps (i.e. the end of one element abuts another, unless its at  
the front or end).


In addition to these Elements, we can drop "Markers" on this sequence,  
where the Markers can be attached to a single point in Time, or some  
contiguous range of Time.  Multiple Markers could be on the same point  
in Time, or overlap each other in Time.


Let's say Time can move forward, move backwards, or instantaneously  
jump to a point in Time.


This Sequence has a delegate, that would like to express interest in  
the following:


(1) when the "current time" moves forward into the beginning of an  
Element or Marker.
(2) when the "current time" moves backward into the end of an Element  
or Marker.
(3) when the "current time" is the same as a Marker attached to a  
single point in time.


With that information, we would know what Element is "active", and  
what Markers might be "active".


So what info do we need?   Assuming a Sequence has some delegate, that  
delegate could register the Sequence to be told when any of those  
three events happens.


Let's say we use as our unique identifier the following info in a  
dictionary:


- sequence
- time value
- time direction (forward, backwards, impulse (i.e. neither, it just  
appeared there))

- object (i.e. Element or Marker that this Time value concerns

so the delegate registers to get notifications from the sequence by  
(and this is where the pattern is weird):


NSNotificationCenter* ctr = [NSNotificationCenter defaultCenter];
SEL s = @selector(enteredElement:);
NSDictionary* dict = [NSDictionary  
dictionaryWithObjectsAndKeys:sequence, @"XXSequence", time,  
@"XXTimeValue", direction, @"XXTimeDirection", element, @"XXElement",  
nil];
[ctr addObserver:delegate selector:s name:XXTimeMovedForward  
object:dict];


what's weird about this is that we're handing in a *dictionary* that  
contains the object that will send out this notification, not the  
object itself.


That's weird, right?  But you see what I'm trying to do?  Is there  
some other pattern here I'm missing?


Thanks in advance for any help.


--> Michael B. Johnson, PhD
--> http://homepage.mac.com/drwave (personal)
--> http://xenia.media.mit.edu/~wave (alum)
--> MPG Lead
--> Pixar Animation Studios

___

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

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

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

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


Re: Hyperlinks

2009-01-08 Thread Greg Titus

Hi Matt,

You need to use an NSTextView here rather than an NSTextField. The  
behavior you are seeing is because an NSTextField is not 'active'  
until clicked upon, and then it gets the window's field editor (which  
is a shared NSTextView used by all fields on the window), and places  
that view on top of the text field and uses it to edit the text. It is  
NSTextView that handles the link hand cursor, and et cetera.


Hope this helps,
- Greg

On Jan 8, 2009, at 4:02 AM, Matthew Morton wrote:


Hi all,

I have a NSTextField in Interface Builder that is quite large and  
includes a number of lines, one of which I want to be a hyperlink.   
I have bound the value of the NSTextField to an NSAttributedString  
in a custom class and set attributes for NSLinkAtributeName,  
NSForegroundColorAtributeName, and NSUnderlineStyleAttributeName.   
Back in Interface Builder I have set the NSTextField to be  
selectable, allow rich text, and the control state enabled.  When I  
build and run my app the text appears as expected but there is no  
'finger-style' cursor when I hover over the hyperlink, just the  
'text-edit' style one until I click on the textfield.  At this point  
the text changes size and the hyperlink becomes clickable.


Anybody have any ideas on what I am doing wrong and any pointers to  
help me resolve this issue.


Thanks,

Matt.
___

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

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

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

This email sent to g...@omnigroup.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: Encryption and Security

2009-01-08 Thread Arsen Pereymer
Matt,

I have done several implementations similar to what you mention.

Here are some pointers (I can send you code too if you would like):

When sending any sensitive data (i.e. username. password, etc...) via WS from 
iPhone, encrypt the data (I like to use MD5)  before sending to the WS.


_

Arsen Pereymer

--- On Thu, 1/8/09, Matt Keyes  wrote:
From: Matt Keyes 
Subject: Encryption and Security
To: cocoa-dev@lists.apple.com
Date: Thursday, January 8, 2009, 12:54 PM

Hello,

I am working on an iPhone app that communicates with a .NET SOAP web service. 
I have the SOAP client down, but now I need to think about the security.  The
.NET web service ultimately will be validating the Windows login as part of the
communication process, and I am trying to think how best to handle this on the
iPhone.  My thoughts are that maybe using SSL would be good or encrypting part
of the data in the transmission (we tend to use Rijndael in most of our apps).

I am relatively new to Cocoa, however, and I would appreciate some pointers.  I
know the CryptoSample project exists out there, but I am not clear as to what is
possible on the iPhone.  Can I use SSL?  If not, could I use Rijndael or some
other common encryption method?  If so (for any of this), can anyone point me to
a sample.

Any help is appreciated!  Thanks in advance!

~Matt

_
Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_explore_012009___

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

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

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

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


NSDecimalNumber seen as NSCFNumber; a bug?

2009-01-08 Thread Davide Benini

Hello folks,
I have run into a strange issue.
I have a LineItem class featuring a NSDecimalNumber *unitaryPrice  
property.
The property works allright all across my app, except in a single view  
controller.


I have this LineItemDataPickerViewController (UIViewController  
subclass) with


@property (nonatomic, retain) LineItem *lineItem;

Before displaying it, I set

controller.lineItem = aLineItem;

When the controller is displayed, in the viewWillDisplay:animated:  
method, I need to set the unitaryPrice value in the appropriate field,  
but before I perform some rounding.


NSDecimalNumberHandler *roundingBehavior = [NSDecimalNumberHandler  
decimalNumberHandlerWithRoundingMode:NSRoundBankers scale:2  
raiseOnExactness:FALSE raiseOnOverflow:TRUE raiseOnUnderflow:TRUE  
raiseOnDivideByZero:TRUE];
NSDecimalNumber *roundedAmount = [lineItem.unitaryPrice  
decimalNumberByRoundingAccordingToBehavior:roundingBehavior];


And here the application terminates and I get this error message

*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '*** -[NSCFNumber  
decimalNumberByRoundingAccordingToBehavior:]: unrecognized selector  
sent to instance 0x10755e0'


for what it'w worthm, I tried also the following change, which was  
useless.
NSDecimalNumber *roundedAmount = (NSDecimalNumber *) 
[lineItem.unitaryPrice  
decimalNumberByRoundingAccordingToBehavior:roundingBehavior];


I spent a couple of hours analysing the flow with the debugger. The  
controller.lineItem property is correctly set, and the  
lineItem.unitaryPrice object is seen as a NSDecimalNumber until BEFORE  
the LineItemDataPickerViewController  is loaded and  
viewWillAppear:animated is called. Then, inside this method,  
lineItem.unitaryPrice is seen as an "out of scope" NSCFNumber.


I've been googling, and this discussion here is the closest thing I  
found to my issue:


http://www.cocoadev.com/index.pl?NSDecimalNumbersSeenAsNSNumbers

Any suggestion? Could this be a bug?

Davide

___

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

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

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

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


PDF Problem

2009-01-08 Thread Devon Govett

Hello everyone,

I have developed an application that converts a PDF to a bitmap  
image.  The program creates an image in which all of the pages in the  
PDF are stacked - one on top of the other.   But I have a problem.   
When the program is run on a PowerPC running Tiger, the quality is  
much worse than when I do the same thing from an Intel based machine  
running leopard.   I think that maybe the Tiger api is not  
antialiasing, but I tried explicitly telling it to do so with no  
effect.  The code is below:


		NSRect viewBounds = [[pdfDoc pageAtIndex:0]  
boundsForBox:kPDFDisplayBoxMediaBox];
		int height = (int)(viewBounds.size.height * 1.25) * [pdfDoc  
pageCount];

int pageHeight = (int)(viewBounds.size.height * 1.25);
NSRect rect = { 0,height-pageHeight, 990, pageHeight };
NSSize size = NSMakeSize(990, height);

NSImage * compositeImage;
compositeImage = [[NSImage alloc] initWithSize:size];

[compositeImage lockFocus];

[[NSGraphicsContext currentContext]
 setImageInterpolation: NSImageInterpolationHigh];
[[NSGraphicsContext currentContext] setShouldAntialias:YES];

NSData* theData = [pdfDoc dataRepresentation];
NSPDFImageRep* pdfRep = [NSPDFImageRep 
imageRepWithData:theData];

NSImage* pdfImage;

int i;
for(i=0;i<[pdfDoc pageCount];i++){
[pdfRep setCurrentPage:i];

			NSRect pageW = [[pdfDoc pageAtIndex:i]  
boundsForBox:kPDFDisplayBoxMediaBox];


pdfImage = [[NSImage alloc] initWithSize: pageW.size];
NSSize fullSize = NSMakeSize(pageW.size.width*1.25, 
pageHeight);
[pdfImage setScalesWhenResized:YES];
[pdfImage setSize:fullSize];
[pdfImage addRepresentation:pdfRep];

NSRect r = { 0, rect.origin.y, pageW.size.width*1.25, 
pageHeight };
[pdfImage drawInRect: r
fromRect: NSZeroRect
   operation: NSCompositeSourceOver
fraction: 1.0];

[pdfImage release]; pdfImage = nil;
rect.origin.y -= pageHeight;
}

[compositeImage unlockFocus];

NSData *imageData = [compositeImage TIFFRepresentation];
		NSBitmapImageRep *imageRep = [NSBitmapImageRep  
imageRepWithData:imageData];
		NSDictionary *imageProps = [NSDictionary dictionaryWithObject: 
[NSNumber numberWithFloat:0.9] forKey:NSImageInterlaced];
		imageData = [imageRep representationUsingType:NSJPEGFileType  
properties:imageProps];
		[imageData writeToFile:@"/Users/devon/Desktop/out.jpg"  
atomically:YES];


You can view images of the results here.

Any help would be fantastic!
Devon
___

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

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

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

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


Hyperlinks

2009-01-08 Thread Matthew Morton

Hi all,

I have a NSTextField in Interface Builder that is quite large and  
includes a number of lines, one of which I want to be a hyperlink.  I  
have bound the value of the NSTextField to an NSAttributedString in a  
custom class and set attributes for NSLinkAtributeName,  
NSForegroundColorAtributeName, and NSUnderlineStyleAttributeName.   
Back in Interface Builder I have set the NSTextField to be selectable,  
allow rich text, and the control state enabled.  When I build and run  
my app the text appears as expected but there is no 'finger-style'  
cursor when I hover over the hyperlink, just the 'text-edit' style one  
until I click on the textfield.  At this point the text changes size  
and the hyperlink becomes clickable.


Anybody have any ideas on what I am doing wrong and any pointers to  
help me resolve this issue.


Thanks,

Matt.
___

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

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

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

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


Re: Dock menu item action isn't performed in modal state

2009-01-08 Thread Ondrej Valik

On 7.1.2009, at 23:06, Peter Ammon wrote:



On Jan 7, 2009, at 8:05 AM, Ondrej Valik wrote:


Hello.
I'm using delegate's applicationDockMenu: method for returning my  
custom dock menu. It has a single menu item. This menu item has its  
target/action properly set up and my dock menu delegate implements  
worksWhenModal method (returning YES). So my menu item is enabled  
when my app is in modal state.


Nevertheless, my action isn't called when app is in modal state.  
Apple defined menu items such as "Show in Finder" works correctly.


I have made some investigation about other applications:
- this sample: http://developer.apple.com/samplecode/DeskPictAppDockMenu/index.html 
 has the same problem (you could show page setup dialog)

- iTunes (but it's Carbon app?) custom dock menu items works OK.

Is there any way how to make custom dock menu item working in modal  
state?


Thanks in advance for any suggestions.
Ondrej Valik


I think this is a limitation of AppKit, and I do not see a  
workaround.  Please file a bug at http://bugreport.apple.com


Thanks,
-Peter


Thanks for your answer.
Bug reported: 

Ondrej
___

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

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

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

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


CALayer not displaying masked CGImage properly

2009-01-08 Thread Rob Boellaard

Hi everybody,

  I am trying to learn CoreGraphics and CoreAnimation, things were  
going well, but now I seem to be stuck.


  I have an image mask (CGImageRef) that displays nicely when I draw  
it directly in an NSView. But when I add the same image mask to a  
CALayer which I then add to a the super layer of a layer-backed  
NSView, the area that is supposed to be transparant is coloured black,  
no tranparancy there. Also the lines of the masked area are more  
jagged than when I draw it directly into an NSViews graphics context.


  here's the code from the "normal" NSView:

- (void)setImageRef:(CGImageRef)ref {
CGImageRelease(imageRef);
CGImageRetain(ref);

imageRef = ref;
}

- (void)drawRect:(NSRect)rect {
CGRect viewRect = [CGAStructUtil convertNSRect:rect];

	[[NSGraphicsContext currentContext] setImageInterpolation:  
NSImageInterpolationHigh];

CGContextRef cxt = [[NSGraphicsContext currentContext] graphicsPort];

//CGContextSetShouldAntialias(cxt, YES);

CGContextSetRGBFillColor(cxt, 0.1, 1.0, 0.1, 1.0); //green
CGContextFillRect(cxt, viewRect);

CGContextDrawImage(cxt, viewRect, imageRef);
}


the setImageRef is called by the Controller during awakeFromNib.

  here's the code from the layer-backed view:


- (void)setImageRef:(CGImageRef)ref {
[self setWantsLayer:YES];
CALayer *rootLayer = self.layer;
rootLayer.frame = [CGAStructUtil convertNSRect:[self frame]];

CALayer *contentLayer = [CALayer layer];
contentLayer.contents = (id)ref;
contentLayer.frame = CGRectMake(0, 0, 100, 130);
//contentLayer.opaque = NO;

[rootLayer addSublayer:contentLayer];
}

If you need to see more code, like how I create the mask or something,  
please let me know.


thanks a lot,

  Rob

  ps: I hoped the opaque property of CALayer would make a difference,  
but it doesn't.


___

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

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

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

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


Re: Large Core Data memory allocations for small rows

2009-01-08 Thread Benjamin Rister
If you can reproduce this in a sample project with your model, you  
should definitely file a bug.  If you can attach your program and  
steps to reproduce, you could file a bug with that as well.


I've filed Radar 6480291 with the app, user's data file, and  
instructions.


For the archives, following further followup from Ben, this one's now  
resolved.  No bug in Core Data here, just the mix of the unfortunate  
way Instruments displays NSManagedObject allocations and the way our  
particular model, classes, and project are structured resulted in me  
looking in the wrong classes for the rogue ivars.  D'oh.


They've now been discovered and eradicated, and memory usage has  
returned to sane levels.


Benjamin Rister
___

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

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

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

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


Re: iPhone UIView: How do I animate the addition/entrance of a window's subview?

2009-01-08 Thread Robert Marini
You can initialize the view with a frame that is positioned off screen  
and then use implicit animation to bring it in.  Alternatively, a  
subtler approach would be to animate it's appearance in by animating  
the change in alpha value from 0 to 1. For instance -


scanView.alpha = 0.0;

[UIView beginAnimations:@"fadein" context:nil];
[UIView setAnimationDuration:0.5f];
[UIView setAnimationCurve:UIViewAnimationCurveEaseInOut];
[UIView setAnimationDelegate:self];
// Change any animatable properties here
scanView.alpha = 1.0;
[UIView commitAnimations];  

Note that if you do want to accomplish the effect you're after, you  
can't directly animate the view's frame property but should instead  
modify its position.  Take a look at the Core Animation Programming  
Guide (specifically, animatable properties) for more information.


-rob.

On Jan 8, 2009, at 1:22 PM, fc...@dialup4less.com wrote:


Background:
@interface ScanView : EAGLView ScannerDelegate> <--- subclass of UIView.


-

The following code is typical for loading the 'scanView' subView  
into its parent window:


[window addSubview:scanView]; // ...this is what I'm doing now.

The end result is a brief flash of void/black background before the  
view is displayed.


I want to avoid this by animating the appearance/entrance of  
'scanView' before the user.

For example, sliding from the right --> left into view.

I'm not sure how to tackle this.
Any ideas would truly be appreciated!

Ric.
forum>

___

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

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

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

This email sent to r...@pinchmedia.com




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: [RESOLVED] Checking facts on NSCell (e.g. in NSTableView)

2009-01-08 Thread Corbin Dunn


Will do.

I'm going to subclass NSTextFieldCell for now.  I'll be drawing  
various bits of text and probably an icon.  It's probably a bit of a  
stretch to say my derived cell is really a "text cell", which is why  
I thought to directly subclass NSCell, but it's good enough for now  
- and I'm too lazy to add appropriate bindings support to a directly  
NSCell-derived subclass ;-)


I guess I should mention why it is easier to subclass the  
NSTextFieldCell; it gives you "free" stuff, like auto expansion tool  
tips, and in-place editing, simply by overriding a few methods and  
calling super with appropriate rects. The PhotoSearch demo on the  
developer site is a good example; it draws editable text, a preview  
icon, and uneditable sub-title text. (Plus, I like pushing my demos :)


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


[RESOLVED] Checking facts on NSCell (e.g. in NSTableView)

2009-01-08 Thread Luke Evans


Great - thanks a lot for clearing that up.  Let's just say the docs  
(including the guide) leave a little to be desired in terms of  
explaining how this works.


Please log a documentation bug requesting it to be clarified; this  
is good feedback, and we can make our docs better with proper bug  
reports.






If you want to draw text, then it is generally better/easier to  
subclass NSTextFieldCell. I think it is a known issue that bindings  
don't work with a plain NSCell subclass --- again, please log a bug  
for this issue and we can investigate.




Will do.

I'm going to subclass NSTextFieldCell for now.  I'll be drawing  
various bits of text and probably an icon.  It's probably a bit of a  
stretch to say my derived cell is really a "text cell", which is why I  
thought to directly subclass NSCell, but it's good enough for now -  
and I'm too lazy to add appropriate bindings support to a directly  
NSCell-derived subclass ;-)


-- lwe


___

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

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

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

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


Re: A custom cell in a NSOutlineView

2009-01-08 Thread Corbin Dunn



My second idea is that I could just dynamically add and remove  
columns & rows, but the problem is that in order to display the  
group titles, the column they are displayed in needs to be  
wide...when I added multiple columns, the column of the group title  
was never wide enough - they would always get clipped. If I had  
continued down this line, I suspect I would have had trouble  
dynamically adding and removing columns as the user was resizing the  
NSPanel.


RE: group rows. Take a look at the DragNDropOutlineView example in  
Leopard, and this delegate method (return something for the nil column):


/*  Optional - Different cells for each row
A different data cell can be returned for any particular  
tableColumn and item, or a cell that will be used for the entire row  
(a full width cell). The returned cell should properly implement  
copyWithZone:, since the cell may be copied by NSTableView. If the  
tableColumn is non-nil, you should return a cell, and generally you  
will want to default to returning the result from [tableColumn  
dataCellForRow:row].


When each row (identified by the item) is being drawn, this  
method will first be called with a nil tableColumn. At this time, you  
can return a cell that will be used to draw the entire row, acting  
like a group. If you do return a cell for the 'nil' tableColumn, be  
prepared to have the other corresponding datasource and delegate  
methods to be called with a 'nil' tableColumn value. If don't return a  
cell, the method will be called once for each tableColumn in the  
tableView, as usual.

*/
- (NSCell *)outlineView:(NSOutlineView *)outlineView  
dataCellForTableColumn:(NSTableColumn *)tableColumn item:(id)item  
AVAILABLE_MAC_OS_X_VERSION_10_5_AND_LATER;





The third idea was to subclass NSTextFieldCell and do all of the  
drawing myself. Each group (Gradients, Hatches, Images, etc.)  
contains just a single row with a single subclass of a  
NSTextFieldCell. It is this implementation that is pictured above.  
As you can see it mostly works and I can dynamically alter the row  
height so each item fits and moves to different rows as needed.


I've seen this done both ways; with/without columns, or with a single  
cell. Multiple Columns might be easier, especially with group rows,  
but it might also be difficult, as you have to dynamically add/remove  
them as the window resizes. So, a single cell that draws multiple  
pieces might be easier -- you could use subcells to do the actual work.


The PhotoSearch example (easy to find on the developer site) is a good  
example to start from.  It also shows group rows.


The problem I am having with this is that I cannot seem to get any  
help with tracking the mouse (see the thread http://tinyurl.com/ 
9y8to9).


The PhotoSearch example shows how to do this. Instead of doing the  
tracking in the cell, you can forward the tracking to a sub-cell.




The final idea is to dump NSTextFieldCell, since it seems to be  
eating all mouseUp and mouse tracking information, and go with a  
completely custom cell. I understand this may be a lot of work, but  
I cannot see a way around it at the moment.


You could have a main cell that subclasses NSCell, and sub-cells in it  
that subclass NSTextFieldCell for drawing the text.


corbin



I am hoping that someone else might have some alternate ideas or a  
pointer to some sample code of a subclass of NSCell which was  
written to work with a NSTableView.


One alternative that had been suggested is to simulate a  
NSOutlineView with a NSCollectionView. However, it is unclear how  
well this would actually work. Would it support the editing of the  
names of the items? Would it support rows of different heights?


___

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

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

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

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


Re: Checking facts on NSCell (e.g. in NSTableView)

2009-01-08 Thread Corbin Dunn

Thanks Kyle and Graham for your comments.




Am I wrong about this interpretation of what I'm reading?


Yes, take a look at -setObjectValue:.  This point confused me for
ages.  You can bind the cell's value to whatever object you like, and
in -setObjectValue: extract the relevant information into ivars for
later use.



Great - thanks a lot for clearing that up.  Let's just say the docs  
(including the guide) leave a little to be desired in terms of  
explaining how this works.


Please log a documentation bug requesting it to be clarified; this is  
good feedback, and we can make our docs better with proper bug reports.





More info can be had at this old page (Google cache because it's no
longer on kupuk.com):
http://74.125.45.132/search?q=cache:QhibCjcx2f0J:kupuk.com/2007/10/08/custom-nscells-with-nsmanagedobjects/+nscell+bindings

--Kyle Sluder



Very nice doc, thanks.

I now have a subclass of NSTextFieldCell that works as I'd expect.   
However, I thought I should probably be subclassing NSCell, but when  
I do this I get the message:
[ valueForUndefinedKey:]: this class is not  
key value coding-compliant for the key value.


...which came as something of a surprise.

Obviously, this suggests that something in the basic NSCell is  
trying to get a 'value' out of the NSTableColumn, unlike the  
NSTextFieldCell derived implementation.  Nothing in my subclass  
implementation has changed other than the attempt to change the  
superclass to NSCell from NSTextFieldCell.  Right now I'm only  
overriding -setObjectValue: and -drawInteriorWithFrame:inView:  but  
this turn of events makes me think that some other method must be  
overridden if I have the basic NSCell as the superclass.  Any ideas?


If you want to draw text, then it is generally better/easier to  
subclass NSTextFieldCell. I think it is a known issue that bindings  
don't work with a plain NSCell subclass --- again, please log a bug  
for this issue and we can investigate.


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: Custom tracking in a NSTextFieldCell

2009-01-08 Thread Eric Gorr

Well, I was finally able to spot the delegate method:

-outlineView:shouldTrackCell:forTableColumn:item:

and simply return YES.

This caused trackMouse & startTrackingAt to be called, but this isn't  
useful until stopTracking is called. For some reason, it isn't.


I would be interested in learning why this might not be the case and  
what I can do about it.


Thank you.




On Jan 8, 2009, at 10:46 AM, Eric Gorr wrote:


If it matters, this is within a NSOutlineView.

In the "Control and Cell Programming Topics for Cocoa" guide, it  
does state:



Controls manage the behavior of their cells. By inheritance from  
NSView, controls derive the ability for responding to user actions  
and rendering their on-screen representation. When users click on a  
control, it responds in part by sending  
trackMouse:inRect:ofView:untilMouseUp: to the cell that was clicked.


and

If you want to implement your own mouse-tracking or mouse-up  
behavior, consider overriding

startTrackingAt:inView:, continueTracking:at:inView:, and
stopTracking:at:inView:mouseIsUp:.


But, I am not seeing any of this documented behavior take place.

My own implementation currently looks like:

- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame  
ofView:(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp

{
NSLog( @"trackMouse" );

	return [super trackMouse:theEvent inRect:cellFrame  
ofView:controlView untilMouseUp:untilMouseUp];

}



- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView  
*)controlView

{
NSLog( @"startTrackingAt" );

return [super startTrackingAt:startPoint inView:controlView];
}



- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView: 
(NSView *)controlView mouseIsUp:(BOOL)flag

{
NSLog( @"stopTracking" );

	[super stopTracking:lastPoint at:stopPoint inView:controlView  
mouseIsUp:flag];

}


and I never see any of the log messages and any breakpoints set  
never get hit.




On Jan 7, 2009, at 6:26 PM, Eric Gorr wrote:


I need to do some custom mouse tracking in a NSTextFieldCell.

Based on the documentation, when a cell is clicked,
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView  
*)controlView


should be called.

However, neither this method nor

- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint  
inView:(NSView *)controlView mouseIsUp:(BOOL)flag


- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame  
ofView:(NSView *)controlViewuntilMouseUp:(BOOL)untilMouseUp


are ever invoked. I cannot seem to locate any other methods that  
would tell me where the cell was clicked or when the mouse button  
was let up and where.



- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect: 
(NSRect)cellFrame ofView:(NSView *)controlView



is being called and I may be able to put all of my logic in here by  
looking at the event information, etc., but I would like to be able  
to use startTrackingAt & stopTracking if that were possible.


Is there something unique about a NSTextFieldCell that prevents  
these methods from being invoked?






___

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

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

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

This email sent to mail...@ericgorr.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/mailist 
%40ericgorr.net


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


Contract Job Opening

2009-01-08 Thread Kenneth Clark

Contract Position Available:  Cocoa Developer

Production Resource Group, LLC (PRG) is the world’s leading supplier  
of entertainment technology solutions, including lighting, audio,  
projection, scenery, and automation systems. PRG serves a wide range  
of markets, including theatre, concert tours, and trade shows,  
corporate and special events, television and film, and themed  
environments.  For more information, visit our website atwww.prg.com.


We have some contract work available for a Cocoa developer to design  
and implement some user interface features for a video playback  
product.  The project would involve 3-6 months of work.  Our R&D group  
is based in Dallas, Texas.


If interested, please view our posting on craigslist:  
http://dallas.craigslist.org/dal/sof/981576557.html

___

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

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

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

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


Re: Checking facts on NSCell (e.g. in NSTableView)

2009-01-08 Thread Luke Evans

Thanks Kyle and Graham for your comments.




Am I wrong about this interpretation of what I'm reading?


Yes, take a look at -setObjectValue:.  This point confused me for
ages.  You can bind the cell's value to whatever object you like, and
in -setObjectValue: extract the relevant information into ivars for
later use.



Great - thanks a lot for clearing that up.  Let's just say the docs  
(including the guide) leave a little to be desired in terms of  
explaining how this works.



More info can be had at this old page (Google cache because it's no
longer on kupuk.com):
http://74.125.45.132/search?q=cache:QhibCjcx2f0J:kupuk.com/2007/10/08/custom-nscells-with-nsmanagedobjects/+nscell+bindings

--Kyle Sluder



Very nice doc, thanks.

I now have a subclass of NSTextFieldCell that works as I'd expect.   
However, I thought I should probably be subclassing NSCell, but when I  
do this I get the message:
[ valueForUndefinedKey:]: this class is not  
key value coding-compliant for the key value.


...which came as something of a surprise.

Obviously, this suggests that something in the basic NSCell is trying  
to get a 'value' out of the NSTableColumn, unlike the NSTextFieldCell  
derived implementation.  Nothing in my subclass implementation has  
changed other than the attempt to change the superclass to NSCell from  
NSTextFieldCell.  Right now I'm only overriding -setObjectValue: and - 
drawInteriorWithFrame:inView:  but this turn of events makes me think  
that some other method must be overridden if I have the basic NSCell  
as the superclass.  Any ideas?


Cheers

Luke


___

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

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

Help/Unsubscribe/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 reloadData]

2009-01-08 Thread David Blanton

To clarify.

App is running. User selects an item in the outline view. User quits  
app.


In windowWillClose save to user defaults an identifier for the item   
selected in the outline view.


At start up reload the outline view etc etc as already described.



On Jan 8, 2009, at 1:36 PM, Shawn Erickson wrote:

On Thu, Jan 8, 2009 at 12:04 PM, David Blanton  
 wrote:
I want to look through all the items,  find the last one selected  
before the
app terminated so I can reselect that item.  I wanted to be sure  
that all

items were loaded before I started looking.
Since reloadData is synchronous (thank you) I call my finding  
method right

after the reloadData call and I have the desired result!


I don't understand your need/desire to call reloadData in this
situation... If the user has selected an item then that item must have
been already known to the table/outline view. You only need to get the
currently selected item and turn that into some identifier that you
can persist. I see no reason to ask the table/outline reload things.

-Shawn




David Blanton




___

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

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

Help/Unsubscribe/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 reloadData]

2009-01-08 Thread Shawn Erickson
On Thu, Jan 8, 2009 at 12:04 PM, David Blanton  wrote:
> I want to look through all the items,  find the last one selected before the
> app terminated so I can reselect that item.  I wanted to be sure that all
> items were loaded before I started looking.
> Since reloadData is synchronous (thank you) I call my finding method right
> after the reloadData call and I have the desired result!

I don't understand your need/desire to call reloadData in this
situation... If the user has selected an item then that item must have
been already known to the table/outline view. You only need to get the
currently selected item and turn that into some identifier that you
can persist. I see no reason to ask the table/outline reload things.

-Shawn
___

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

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

Help/Unsubscribe/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 reloadData]

2009-01-08 Thread David Blanton
I want to look through all the items,  find the last one selected  
before the app terminated so I can reselect that item.  I wanted to  
be sure that all items were loaded before I started looking.
Since reloadData is synchronous (thank you) I call my finding method  
right after the reloadData call and I have the desired result!


Thanks!



On Jan 8, 2009, at 12:49 PM, j o a r wrote:



On Jan 8, 2009, at 11:07 AM, David Blanton wrote:


My error ... I thought reloadData was asynchronous!



It all depends on what you're after. Display updates are almost  
always delayed in Cocoa, meaning that the outline view will not  
show updated contents after your call to reloadData. All views will  
be redisplayed at the end of the current event loop. This leads to  
less "flickering", and less redundant redrawing.


Like I said in my last reply to you: We can't really help you  
before you tell us what you're *really* trying to do.


j o a r






David Blanton




___

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

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

Help/Unsubscribe/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 reloadData]

2009-01-08 Thread j o a r


On Jan 8, 2009, at 11:07 AM, David Blanton wrote:


My error ... I thought reloadData was asynchronous!



It all depends on what you're after. Display updates are almost always  
delayed in Cocoa, meaning that the outline view will not show updated  
contents after your call to reloadData. All views will be redisplayed  
at the end of the current event loop. This leads to less "flickering",  
and less redundant redrawing.


Like I said in my last reply to you: We can't really help you before  
you tell us what you're *really* trying to do.


j o a r


___

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

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

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

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


A custom cell in a NSOutlineView

2009-01-08 Thread Eric Gorr

Here is a picture of what I need to do:

http://ericgorr.net/cocoadev/customcell/customcell.png

Basically, I need a NSOutlineView which can contain a set of  
selectable images with titles that can be edited. It also needs to  
support keyboard navigation and when a section is opened (like  
Gradients), every item that section contains needs to be visible. I  
might be blanking on some other minor behaviors, but these are the  
fundamental ones.


My first thought was that I could just use a NSCollectionView, but  
this is not possible at the moment (rdar://6455493 & rdar://4857136).


My second idea is that I could just dynamically add and remove columns  
& rows, but the problem is that in order to display the group titles,  
the column they are displayed in needs to be wide...when I added  
multiple columns, the column of the group title was never wide enough  
- they would always get clipped. If I had continued down this line, I  
suspect I would have had trouble dynamically adding and removing  
columns as the user was resizing the NSPanel.


The third idea was to subclass NSTextFieldCell and do all of the  
drawing myself. Each group (Gradients, Hatches, Images, etc.) contains  
just a single row with a single subclass of a NSTextFieldCell. It is  
this implementation that is pictured above. As you can see it mostly  
works and I can dynamically alter the row height so each item fits and  
moves to different rows as needed. The problem I am having with this  
is that I cannot seem to get any help with tracking the mouse (see the  
thread http://tinyurl.com/9y8to9).


The final idea is to dump NSTextFieldCell, since it seems to be eating  
all mouseUp and mouse tracking information, and go with a completely  
custom cell. I understand this may be a lot of work, but I cannot see  
a way around it at the moment.


I am hoping that someone else might have some alternate ideas or a  
pointer to some sample code of a subclass of NSCell which was written  
to work with a NSTableView.


One alternative that had been suggested is to simulate a NSOutlineView  
with a NSCollectionView. However, it is unclear how well this would  
actually work. Would it support the editing of the names of the items?  
Would it support rows of different heights?



___

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

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

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

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


Re: App Listener

2009-01-08 Thread j.varela
>>On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:
>>
>>>does this work with Dashboard?  it seems that dashboard is a
>>>background application that's always open...
>>
>>Well, obviously it does not.
>>
>>You'd need a NSWorkspaceDidActivateApplicationNotification, but it looks like 
>>there is no such thing.  You could periodically poll -[NSWorkspace 
>>activeApplication], but I hope someone has a 
better idea, because if you do I would not want your process running on my Mac.
>
>Today, the only solution seems to be to install a Carbon Event handler for the 
>{kEventClassApplication, kEventAppFrontSwitched} event.

Even better is to register for a Carbon Event handler for  
{kEventClassApplication, kEventAppLaunched} event. The user may switch the 
front application without launching an application. I think 
the OP intends to be notified upon an application launch only.

>
>Even if such a NSWorkspace notification were to appear in a future version of 
>Mac OS X, I'd be interested in a lower-level solution. I have a background 
>process that can't link to AppKit due to 
security restrictions, and Carbon Events have gone away for 64-bit processes.

This is not entirely true. There are a few APIs of the Carbon Event model who 
have been ported to 64-bit and have been made public in Leopard.
Examples:

InstallEventHandler
InstallEventLoopTimer
RegisterEventHotKey
ReleaseEvent

Examples of APIs which are not available to 64-bit applications:

QuitApplicationEventLoop
InstallStandardEventHandler
InstallEventLoopIdleTimer

I.e., APIs that are GUI-oriented are out, most APIs that provide core services 
are in.

So I guess the logic is: if you have an API in Cocoa, use it. If you don't, 
resort to Carbon Events that have been ported and retained for 64-bit 
applications.

HTH

Joao Varela


 ___

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

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

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

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


Re: Tiger vs Leopard Printing

2009-01-08 Thread chaitanya pandit

Am not sure but have a look at :
NSPrintPanelAccessorizing Protocol Reference
-Chaitanya

On 08-Jan-09, at 6:55 AM, David Blanton wrote:


I build my app with the MACOSX10.4u.sdk.

When the following is executed:

	[[NSPrintOperation printOperationWithView:catalog]  
runOperationModalForWindow:mainWindow delegate:self  
didRunSelector:nil contextInfo:nil];


the Tiger and Leopard print panels are different.

In Leopard you can select to see detail by clicking the arrow next  
to the printer name. This is not available in Tiger.


When I run on Leopard and select the detail view in the print panel,  
if I use the forward and back arrows to preview the print then when  
I choose PDF preview the pages are empty.
If I do not display the detail and click the preview button all is  
well.


Do I need to handle the detail preview in some manner when on Leopard?


David Blanton




___

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

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

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

This email sent to chaita...@expersis.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: App Listener

2009-01-08 Thread j.varela
>>On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:
>>
>>>does this work with Dashboard?  it seems that dashboard is a
>>>background application that's always open...
>>
>>Well, obviously it does not.
>>
>>You'd need a NSWorkspaceDidActivateApplicationNotification, but it looks like 
>>there is no such thing.  You could periodically poll -[NSWorkspace 
>>activeApplication], but I hope someone has a 
better idea, because if you do I would not want your process running on my Mac.
>
>Today, the only solution seems to be to install a Carbon Event handler for the 
>{kEventClassApplication, kEventAppFrontSwitched} event.

Even better is to register for a Carbon Event handler for  
{kEventClassApplication, kEventAppLaunched} event. The user may switch the 
front application without launching an application. I think 
the OP intends to be notified upon an application launch only.

>
>Even if such a NSWorkspace notification were to appear in a future version of 
>Mac OS X, I'd be interested in a lower-level solution. I have a background 
>process that can't link to AppKit due to 
security restrictions, and Carbon Events have gone away for 64-bit processes.

This is not entirely true. There are a few APIs of the Carbon Event model who 
have been ported to 64-bit and have been made public in Leopard.
Examples:

InstallEventHandler
InstallEventLoopTimer
RegisterEventHotKey
ReleaseEvent

Examples of APIs which are not available to 64-bit applications:

QuitApplicationEventLoop
InstallStandardEventHandler
InstallEventLoopIdleTimer

I.e., APIs that are GUI-oriented are out, most APIs that provide core services 
are in.

So I guess the logic is: if you have an API in Cocoa, use it. If you don't, 
resort to Carbon Events that have been ported and retained for 64-bit 
applications.

HTH

Joao Varela


 ___

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

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

Help/Unsubscribe/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 indentation

2009-01-08 Thread James Walker

Bill Monk wrote:


On Jan 7, 2009, James Walker wrote:


  Having the indentation affect the top level may be technically
consistent, but I don't know why anyone would want it to work that way.



Yes, I agree. Top-level items should stay near the left margin, and 
setting the indent to 0 should not cause top-level disclosure controls 
to impinge on neighboring columns. The following fixed it for my purposes.


(snip)

Thanks, but your solution won't work for me.  The 
frameOfOutlineCellAtRow: method was introduced in Leopard, and I still 
need to support Tiger.


But then I had the idea of changing the frame rectangle of outline view 
when it awakes from the nib, this sort of thing:


NSRect outlineFrame = [mOutlineView frame];
outlineFrame.origin.x -= frameAdjust;
outlineFrame.size.width += frameAdjust;
[mOutlineView setFrame: outlineFrame];

It actually seems to work!  I guess it would be more complicated if the 
view were resizable, but my current case is not.


--
  James W. Walker, Innoventive Software LLC
  
___

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

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

Help/Unsubscribe/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 reloadData]

2009-01-08 Thread David Blanton

My error ... I thought reloadData was asynchronous!

On Jan 8, 2009, at 11:30 AM, j o a r wrote:



On Jan 8, 2009, at 9:42 AM, David Blanton wrote:

Is there a way to be notified when a reloadData operation is  
complete?



What do you mean with complete? It's a regular synchronous method  
call, so it's completed when it returns.


I bet there's something that you're trying to do that you're not  
asking. Could you perhaps explain what you're really trying to do?


Cheers,

j o a r






David Blanton




___

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

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

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

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


Re: Mail Activity sliding widget question

2009-01-08 Thread Volker in Lists

Hi,

you can animate a NSSplitView easily to achieve this effect. I use the  
following code to animate the resize of a split view after the users  
clicks a button:


- (IBAction)toggleSplitDisplay:(id)sender
{
NSSize newSize = [detailSplit frame].size;

[NSAnimationContext beginGrouping];
[[NSAnimationContext currentContext] setDuration:.5];

if ([sender selectedSegment] == 1) {
[[theLowerSubView animator] setFrameSize:newSize];
newSize.height = 2;
[[theUpperSubView animator] setFrameSize:newSize];
}
else if ([sender selectedSegment] == 0) {
[[theUpperSubView animator] setFrameSize:newSize];
newSize.height = 0;
[[theLowerSubView animator] setFrameSize:newSize];
}

[NSAnimationContext endGrouping];
}

Hope that helps, please contact me, if you need more information!

Volker

Am 08.01.2009 um 17:53 schrieb Sam Krishna:

I've been looking for a while now how to replicate a widget like  
Mail.app's "Mail Activity" slide-up/slide-down panel (the animation,  
not the widget itself).


The several times I've tried NSViewAnimation, it seemed to be a non- 
starter.


The bits and pieces that I've worked with CoreAnimation seem  
promising, but it *feels* like there's something obvious that I'm  
missing in terms of replicating the slide-up panel. You can see that  
sliding panel widget in many Apple apps, like Mail, iTunes (album  
cover), iPhoto's info panel, and Automator's workflow log, workflow  
variables table, and Automator's Description View.


Again, I'm just trying to replicate the animation--if anyone has any  
ideas, that would be really great.



___

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

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

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

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


iPhone UIView: How do I animate the addition/entrance of a window's subview?

2009-01-08 Thread fclee
Background:
 @interface ScanView : EAGLView  
<--- subclass of UIView.

-

The following code is typical for loading the 'scanView' subView into its 
parent window:
 
[window addSubview:scanView]; // ...this is what I'm doing now.

The end result is a brief flash of void/black background before the view is 
displayed.
 
I want to avoid this by animating the appearance/entrance of 'scanView' before 
the user.  
For example, sliding from the right --> left into view.

I'm not sure how to tackle this.
Any ideas would truly be appreciated!
 
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: [NSOutlineView reloadData]

2009-01-08 Thread j o a r


On Jan 8, 2009, at 9:42 AM, David Blanton wrote:


Is there a way to be notified when a reloadData operation is complete?



What do you mean with complete? It's a regular synchronous method  
call, so it's completed when it returns.


I bet there's something that you're trying to do that you're not  
asking. Could you perhaps explain what you're really trying to do?


Cheers,

j o a r


___

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

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

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

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


Re: How to obtain icon displayed by Finder for a file

2009-01-08 Thread David
I was thinking using NSAttributedString seems like a more general purpose
solution because they sound powerful and can be used all over the place.
I've used it for HTML which seems like way overkill for this. But I haven't
successfully come up with a string that looks correct, whereas I have been
able to get the ImageAndTextCell approach to work to my satisfaction,
although still convoluted.

On Thu, Jan 8, 2009 at 2:05 AM, Rob Keniger  wrote:

>
> On 08/01/2009, at 3:16 PM, Kyle Sluder wrote:
>
>  I'd disagree.  I'd say that the proper way to do this is to implement
>> a custom NSCell subclass (a la ImageAndTextCell).  This is more in
>> line with the framework: the cell is given an object value, which the
>> cell represents by drawing into a view.  That object value happens to
>> have two valid representations: an image and a textual label.
>> Therefore the cell should draw those two representations.
>>
>
>
> Correct, and Apple's ImageAndTextCell class, which is in the project linked
> from my previous post, does exactly that:
>
> http://developer.apple.com/samplecode/SourceView/
>
> --
> Rob Keniger
>
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/enki1711%40gmail.com
>
> This email sent to enki1...@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


Encryption and Security

2009-01-08 Thread Matt Keyes

Hello,

I am working on an iPhone app that communicates with a .NET SOAP web service.  
I have the SOAP client down, but now I need to think about the security.  The 
.NET web service ultimately will be validating the Windows login as part of the 
communication process, and I am trying to think how best to handle this on the 
iPhone.  My thoughts are that maybe using SSL would be good or encrypting part 
of the data in the transmission (we tend to use Rijndael in most of our apps).

I am relatively new to Cocoa, however, and I would appreciate some pointers.  I 
know the CryptoSample project exists out there, but I am not clear as to what 
is possible on the iPhone.  Can I use SSL?  If not, could I use Rijndael or 
some other common encryption method?  If so (for any of this), can anyone point 
me to a sample.

Any help is appreciated!  Thanks in advance!

~Matt

_
Windows Live™ Hotmail®: Chat. Store. Share. Do more with mail. 
http://windowslive.com/explore?ocid=TXT_TAGLM_WL_t1_hm_justgotbetter_explore_012009___

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

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

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

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


Re: App Listener?

2009-01-08 Thread Ken Thomases

On Jan 8, 2009, at 7:39 AM, Jerry Krinock wrote:


On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:


does this work with Dashboard?  it seems that dashboard is a
background application that's always open...


Well, obviously it does not.

You'd need a NSWorkspaceDidActivateApplicationNotification, but it  
looks like there is no such thing.  You could periodically poll - 
[NSWorkspace activeApplication], but I hope someone has a better  
idea, because if you do I would not want your process running on my  
Mac.


For typical apps, you can register for the Carbon event  
(kEventClassApplication, kEventAppFrontSwitched) which will let you  
know as apps get activated.


However, I doubt the Dashboard is a typical app in this sense.  I  
haven't tested that assumption, though.  Perhaps the Accessibility API  
will help, in that case.


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: [iPhone] Search control like in App Store

2009-01-08 Thread mmalc Crawford


On Jan 8, 2009, at 9:37 AM, Mohan Parthasarathy wrote:


The problem was that my WebViewController had an empty stub "loadView"
though the actual work was done in ViewDidLoad. When i read the
documentation it does say that when you load a ViewController using
initWithNiBName use ViewDidLoad and not loadView. But i did not know  
that an

empty loadView could cause problems like this :-)

[...] if you initialize the view using a nib file—that is, you set  
thenibName and nibBundle properties—then you should not override this  
method because the default implementation already reloads the nib  
file. Instead override the viewDidLoad method to set any properties  
after the nib file is loaded.





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: Recording video from a QCView to .mov

2009-01-08 Thread David Duncan

On Jan 8, 2009, at 1:47 AM, Jonathan Selander wrote:

I'm trying to record video form a webcam input to a .mov file. I've  
made a simple quartz composition and loaded it in a QCView. I tried  
using code from the QCTV example bundled with XCode, but there are  
things I'm not really sure about there. For instance, do i need to  
use OpenGL for rendering frames to a file, or can i use something  
else, perhaps something a little easier to use?



You would probably do better by investigating QTKit Capture rather  
than using a QCView like this. The best place to ask about that would  
be the Quicktime-API mailing list.

--
David Duncan
Apple DTS Animation and Printing

___

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

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

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

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


[NSOutlineView reloadData]

2009-01-08 Thread David Blanton

Is there a way to be notified when a reloadData operation is complete?

David Blanton




___

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

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

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

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


Re: [iPhone] Search control like in App Store

2009-01-08 Thread Mohan Parthasarathy
The problem was that my WebViewController had an empty stub "loadView"
though the actual work was done in ViewDidLoad. When i read the
documentation it does say that when you load a ViewController using
initWithNiBName use ViewDidLoad and not loadView. But i did not know that an
empty loadView could cause problems like this :-)

Thanks for your debugging tips.

-mohan


On Wed, Jan 7, 2009 at 6:20 PM, Robert Marini  wrote:

> Not to sound too much like tech support, but did you wire up your instance
> of a UIWebView in your xib to an IBOutlet property in your view controller?
>  I tried this scenario out juts now and it behaved as expected with
>
> // Implement viewDidLoad to do additional setup after loading the view,
> typically from a nib.
> - (void)viewDidLoad {
>[super viewDidLoad];
>[webView loadRequest:[NSURLRequest requestWithURL:[NSURL
> URLWithString:@"http://www.apple.com";]]];
> }
>
> Some general tips about debugging these scenarios - UIWebView has a
> delegate protocol that you can implement, I would do so in the view
> controller and then check in the delegate methods to see if there is an
> error with the URL for instance (which was exactly what I did when I wrote
> this test app, `htttp` isn't any protocol I know of).  You, of course, need
> to let IB know what object is the delegate (link the delegate outlet of the
> web view instance to the file's owner).
>
> IB is actually particularly useful for handing web views as you can create
> buttons and wire them up to common function directly with no code (back,
> forward, reload, etc).
>
> -rob.
>
> On Jan 7, 2009, at 4:01 PM, Mohan Parthasarathy wrote:
>
>  Hi,
>>
>> I agree that IB is useful but sometimes does not work as expected (mostly
>> because i am doing something wrong). I am new to Cocoa Application
>> development and perhaps takes times to get used to it.
>>
>> Recently i was trying to use UIWebView (one of the views in my navigation
>> hierarchy). And my viewDidLoad method sends the URL request to load. This
>> just does not work. It looks like i have done all the right things. Instead
>> doing this programatically by creating a UIView etc, in loadview just works.
>> As there are no error messages etc.,it is hard to find what mistake i am
>> making with IB. Sure, one could make mistakes in writing all the code but
>> somehow seems more reliable ;-)
>>
>> -mohan
>>
>>
>> On Wed, Jan 7, 2009 at 5:46 AM, Robert Marini  wrote:
>>
>> Martijn -
>>
>> I don't necessarily know that I'd agree with that though it could be
>> because I'm more accustomed to IB than programmatic layout.  In general,
>> anything you'd represent in code as a UIView subclass is something you'd
>> create in a xib file in Interface Builder.  That xib file would be "owned"
>> then by a subclass of a UIViewController (yes, you should be using view
>> controllers heavily on iPhone).  Each instance of a control in IB can then
>> be accessed programmatically from your view controller by IBOutlet and
>> IBAction declaration which enable you to add custom behavior.  It's a
>> different way of thinking than programmatic layout and while the constant
>> going back and forth between IB and Xcode can seem daunting, it's generally
>> worthwhile as your codebase's size will be cut by a large amount (in one
>> project I worked on, by 60%).
>>
>> There are, of course, times when I would fully suggest doing views
>> yourself in code (fast drawing in a flattened view hierarchy for
>> UITableViewCells for example) but really, there hasn't been a reason to
>> avoid IB since ~beta 4 of the SDK.  While it's true that a lot (most) of the
>> sample code provided use programmatic layout examples, to a great extent it
>> is as simple as imagining that the 20 lines of code used to set up a
>> UIToolBar are just a drag and drop operation in your xib.  I'd strongly
>> advise taking a look at doing your view work primarily in IB if only for the
>> fact that it makes that type of code much more maintainable.
>>
>> -rob.
>>
>>
>> On Jan 7, 2009, at 4:00 AM, Jonathan Hess wrote:
>>
>> Hey Martijn -
>>
>> If you could file bugs at http://bugreport.apple.com/ about the concepts
>> that you find confusing it would help us improve the usability of the tools.
>>
>> Thanks -
>> Jon Hess
>>
>> On Jan 6, 2009, at 11:47 PM, Martijn van Exel wrote:
>>
>> Thanks - I looked into the TableSearch sample project and it seems to give
>> me enough pointers to implement what I want.I'm also learning a lot from
>> the
>> UICatalog sample. I tend to stay away from Interface Builder, as is
>> provides
>> more confusion than solutions, IMO.
>>
>> Martijn
>>
>> On Wed, Jan 7, 2009 at 06:44, Robert Marini  wrote:
>>
>> UISearchBar is a standard cocoa touch control.
>>
>> -rob.
>>
>>
>> On Jan 6, 2009, at 7:35 AM, Martijn van Exel wrote:
>>
>> Hi all,
>> I'm looking to implement a user selection from a large number of items
>> contained in a deep hierarchy (a taxonomy of species) for the iPhone.
>> The hierar

Re: Returning value from detached NSThread selector with multiple arguments.

2009-01-08 Thread Michael Ash
On Thu, Jan 8, 2009 at 11:08 AM, Scott Ribe  wrote:
>> Careful!  Unless you're synchronizing access to the mutable
>> dictionary, this is not thread-safe.  Even if it appears to work in
>> some cases, it's likely to blow up in your face in real-world use.
>
> Right, in general, but I don't see any problem with the proposed use, since
> there's adequate synchronization implicitly:
>
> - Main thread sets up dictionary, retains it, spawns secondary thread.
>
> - 2nd thread retains the dictionary, reads parameters, does its stuff, adds
> results to the dictionary, releases the dictionary, calls
> performSelector:onMainThread.
>
> - Main thread reads results, releases the dictionary.

May as well ditch the shared dictionary altogether if you're doing
this. Instead follow this plan:

- Main thread sets up dictionary, spawns secondary thread and passes
it as an argument.

- Secondary thread uses its argument to do its calculations.

- When it's done, it constructs a response dictionary, calls
performSelectorOnMainThread:... to hand it back.

By removing shared mutable data you remove a huge potential for things
to go wrong with your threads.

> Note that the retain/release in the 2nd thread is really only necessary if
> there's a possibility that the main thread will lose interest in the results
> and release the dictionary before the 2nd thread finishes.

It's actually not necessary at all. NSThread, like any other Cocoa
class, knows about Cocoa memory management and will retain/release the
thread object and arguments appropriately. (As will
performSelectorOnMainThread:.)

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: App Listener?

2009-01-08 Thread Rainer Brockerhoff
At 15:09 + 08/01/09, James Montgomerie wrote:
>On 8 Jan 2009, at 14:14, Rainer Brockerhoff wrote:
>>Today, the only solution seems to be to install a Carbon Event handler for 
>>the {kEventClassApplication, kEventAppFrontSwitched} event.
>
>If you don't mind asking your users to switch on accessibility access ("enable 
>access for assistive devices" in the Universal Access preferences), you can 
>use the Accessibility APIs to monitor app switching (this is what's used in 
>the iChatStatusFromApplication sample code, for example - 
>http://developer.apple.com/samplecode/iChatStatusFromApplication/).

I'm using accessibility for other purposes too, so that's the first thing I 
tried.

The restriction on that is that you have to register for each application you 
need to watch, it's not a general notification. It also means you have to use 
other notifications to watch for applications to start up and quit, keep a list 
of running applications, etc. Lots of overhead and opportunities to go wrong.

For completeness, I'd like to mention that you don't need to ask the user to 
switch on accessibility if you use the APIs from a background process that's 
been authorized via AXMakeProcessTrusted().

>I say this informationally - I don't think it's a great solution either.

Exactly.
-- 
Rainer Brockerhoff  
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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

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

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

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


Mail Activity sliding widget question

2009-01-08 Thread Sam Krishna
I've been looking for a while now how to replicate a widget like  
Mail.app's "Mail Activity" slide-up/slide-down panel (the animation,  
not the widget itself).


The several times I've tried NSViewAnimation, it seemed to be a non- 
starter.


The bits and pieces that I've worked with CoreAnimation seem  
promising, but it *feels* like there's something obvious that I'm  
missing in terms of replicating the slide-up panel. You can see that  
sliding panel widget in many Apple apps, like Mail, iTunes (album  
cover), iPhoto's info panel, and Automator's workflow log, workflow  
variables table, and Automator's Description View.


Again, I'm just trying to replicate the animation--if anyone has any  
ideas, that would be really great.


TIA...

Live Playfully,

Sam
-
If he listens in faith,
finding no fault, a man is free
and will attain the cherished words
of those who act in virtue.

___

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

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

Help/Unsubscribe/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 indentation

2009-01-08 Thread Corbin Dunn

On Jan 7, 2009, at 5:32 PM, James Walker wrote:
Is there any way to change the difference in indentation between  
levels in an NSOutlineView, without changing the indentation of the  
top level?  Having the indentation affect the top level may be  
technically consistent, but I don't know why anyone would want it to  
work that way.


I agree; it is strange -- you are welcome to log a bug on the issue.  
Ideally, level 0 should always have a set (standard) indentation, and  
all subsequent levels should be indented from there.


Bill's work around is the way to change the location.

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


Is disabling global colormap for animated gif ignored?

2009-01-08 Thread Patrick Haruksteiner


Hello,

I'm trying to export an animation as animated gif. Adding all frames  
to the gif, setting loop count and writing the file works fine. But my  
choice if the gif should have a global colormap or not is ignored.


here the code I tried:

NSMutableDictionary *gifImageProperties = [[NSMutableDictionary  
dictionaryWithCapacity:2] retain];


//loop animation, 0 = indefinitly
[gifImageProperties setObject:[NSNumber numberWithFloat:0] forKey: 
(NSString *)kCGImagePropertyGIFLoopCount];


[gifImageProperties setObject:[NSNumber  
numberWithBool:useGlobalColormap] forKey:(NSString  
*)kCGImagePropertyGIFHasGlobalColorMap];


NSDictionary *finalGIFImageProperties = [NSDictionary  
dictionaryWithObject:gifImageProperties forKey:(NSString *)  
kCGImagePropertyGIFDictionary];


... my image creation code here ...

//set properties
CGImageDestinationSetProperties(imageDestination,  
(CFDictionaryRef)finalGIFImageProperties);



Am I setting something wrong for kCGImagePropertyGIFHasGlobalColorMap?  
This stuff is not quite well documented...
For kCGImagePropertyGIFLoopCount everything works fine - even for  
other loop counts.


Any clues?

thanks,
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: Can I call unbind: in finalize? Is it thread safe?

2009-01-08 Thread Sean McBride
On 1/7/09 10:12 PM, Kyle Sluder said:

>> When do AppKit views call unbind:?
>
>You say you're familiar with mmalc's recommendations... but this
>question is explicitly addressed in the "Unbinding" section.  I assume
>you want to call -unbind: so as to remove your view from observing a
>controller (doing it "for cleanliness sake" is useless; bindings are
>essentially UI design conveniences for KVO).  Call -unbind: in
>-viewWillMoveToSuperview: (as long as the view doesn't become
>fullscreen).

It was me that pointed out the fullscreen problems to mmalc. :) An
NSView has no control over whether its caller will decide to make it
fullscreen or not, so the viewWillMoveToSuperview solution isn't ideal.

>http://homepage.mac.com/mmalc/CocoaExamples/controllers.html#unbinding
>
>As for whether it's thread safe, I would say no, because Cocoa
>Bindings in general is not thread safe.  See Chris Hanson's post on
>the topic: http://chanson.livejournal.com/2005/07/23/

I'm inclined to agree.  However, mmalc's page says "If your view may
become full screen, then you should ideally use another invalidation
method to mark when the view is finished with and unbind in that,
otherwise you should unbind in finalize".

So if not finalize and not viewWillMoveToSuperview, when can I stop the
observing I started in bind:?  That's what I'm trying to get at really.

Cheers,

--

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: App Listener?

2009-01-08 Thread Jonathan Hendry


On Jan 8, 2009, at 09:14 AM, Rainer Brockerhoff wrote:


At 05:55 -0800 08/01/09, cocoa-dev-requ...@lists.apple.com wrote:

From: Jerry Krinock 
References: <63539670901072146w570a8dc1wc13c58b8ecb43...@mail.gmail.com 
>


<63539670901072246j1f659c63q33a73b501233f...@mail.gmail.com>
<63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com>
In-Reply-To: <63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com 
>

Date: Thu, 8 Jan 2009 05:39:57 -0800
Message-ID: <406b8377-613f-49d2-a3de-2ba381346...@ieee.org>

On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:


does this work with Dashboard?  it seems that dashboard is a
background application that's always open...


Well, obviously it does not.

You'd need a NSWorkspaceDidActivateApplicationNotification, but it  
looks like there is no such thing.  You could periodically poll - 
[NSWorkspace activeApplication], but I hope someone has a better  
idea, because if you do I would not want your process running on my  
Mac.


Today, the only solution seems to be to install a Carbon Event  
handler for the {kEventClassApplication, kEventAppFrontSwitched}  
event.




A hacky idea might be to create an Objective-C Dashboard widget that  
reports when it is displayed or updated, if that's possible.


--

Jonathan Hendry

Howard Hughes Medical Institute
Maunsell Lab
Harvard Medical School


___

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

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

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

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


Re: Returning value from detached NSThread selector with multiple arguments.

2009-01-08 Thread Scott Ribe
> Careful!  Unless you're synchronizing access to the mutable
> dictionary, this is not thread-safe.  Even if it appears to work in
> some cases, it's likely to blow up in your face in real-world use.

Right, in general, but I don't see any problem with the proposed use, since
there's adequate synchronization implicitly:

- Main thread sets up dictionary, retains it, spawns secondary thread.

- 2nd thread retains the dictionary, reads parameters, does its stuff, adds
results to the dictionary, releases the dictionary, calls
performSelector:onMainThread.

- Main thread reads results, releases the dictionary.

Note that the retain/release in the 2nd thread is really only necessary if
there's a possibility that the main thread will lose interest in the results
and release the dictionary before the 2nd thread finishes.

Re your caution in particular, the main thread must not "peek" in the
dictionary (to look at partial results for instance) before the 2nd thread
has called back, because that look into the dictionary could happen in the
middle of an update when its internal state is inconsistent.

Any attempt to monitor progress would require either explicit
synchronization on the dictionary, or more simply just use
performSelector:onMainThread: with a new object allocated and set up in the
2nd thread and released on the main thread for each call. And my personal
preference would be to return results that way as well, rather than reuse
the dictionary, because it doesn't seem simpler in any way to use a single
dictionary for both purposes (unless the main thread, after the 2nd thread
has finished, would need access to the parameters for UI display or
whatever).

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


___

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

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

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

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


Re: Can I call unbind: in finalize? Is it thread safe?

2009-01-08 Thread Sean McBride
On 1/7/09 2:25 PM, Ron Lue-Sang said:

>You don't need to call unbind: from finalize.
>
>If you're an observer of some other object, and you haven't removed
>yourself as an observer by the time you're in finalize... well, try to
>clean up any observing by the time you hit finalize.
>
>> When do AppKit views call unbind:?
>
>Most views, currently, don't call unbind: on themselves at all.

Ronzilla,

Thanks for your reply.

So if in my implementation of bind:toObject:withKeyPath:options: I add
myself as an observer, when is the correct time to remove myself as an
observer?

This example:


a) overrides unbind: and calls removeObserver there.  Is that correct?

b) calls unbind: from dealloc.  Is that correct?

c) in GC, assuming a client does not unbind: manually, when is the right
time to stop the observations started in bind:?

Cheers,

--

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: Custom tracking in a NSTextFieldCell

2009-01-08 Thread Eric Gorr

If it matters, this is within a NSOutlineView.

In the "Control and Cell Programming Topics for Cocoa" guide, it does  
state:



Controls manage the behavior of their cells. By inheritance from  
NSView, controls derive the ability for responding to user actions and  
rendering their on-screen representation. When users click on a  
control, it responds in part by sending  
trackMouse:inRect:ofView:untilMouseUp: to the cell that was clicked.


and

If you want to implement your own mouse-tracking or mouse-up behavior,  
consider overriding

startTrackingAt:inView:, continueTracking:at:inView:, and
stopTracking:at:inView:mouseIsUp:.


But, I am not seeing any of this documented behavior take place.

My own implementation currently looks like:

- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame ofView: 
(NSView *)controlView untilMouseUp:(BOOL)untilMouseUp

{
NSLog( @"trackMouse" );

	return [super trackMouse:theEvent inRect:cellFrame ofView:controlView  
untilMouseUp:untilMouseUp];

}



- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView *)controlView
{
NSLog( @"startTrackingAt" );

return [super startTrackingAt:startPoint inView:controlView];
}



- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView: 
(NSView *)controlView mouseIsUp:(BOOL)flag

{
NSLog( @"stopTracking" );

	[super stopTracking:lastPoint at:stopPoint inView:controlView  
mouseIsUp:flag];

}


and I never see any of the log messages and any breakpoints set never  
get hit.




On Jan 7, 2009, at 6:26 PM, Eric Gorr wrote:


I need to do some custom mouse tracking in a NSTextFieldCell.

Based on the documentation, when a cell is clicked,
- (BOOL)startTrackingAt:(NSPoint)startPoint inView:(NSView  
*)controlView


should be called.

However, neither this method nor

- (void)stopTracking:(NSPoint)lastPoint at:(NSPoint)stopPoint inView: 
(NSView *)controlView mouseIsUp:(BOOL)flag


- (BOOL)trackMouse:(NSEvent *)theEvent inRect:(NSRect)cellFrame  
ofView:(NSView *)controlViewuntilMouseUp:(BOOL)untilMouseUp


are ever invoked. I cannot seem to locate any other methods that  
would tell me where the cell was clicked or when the mouse button  
was let up and where.



- (NSUInteger)hitTestForEvent:(NSEvent *)event inRect: 
(NSRect)cellFrame ofView:(NSView *)controlView



is being called and I may be able to put all of my logic in here by  
looking at the event information, etc., but I would like to be able  
to use startTrackingAt & stopTracking if that were possible.


Is there something unique about a NSTextFieldCell that prevents  
these methods from being invoked?






___

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

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

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


This email sent to mail...@ericgorr.net


___

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

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

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

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


Re: -[NSView window] returns nil if its NSTabView not selected

2009-01-08 Thread Jerry Krinock

Thank you for your usual good explanation, Quincey.

A couple more wrinkles which I was not sure about but confirmed by  
testing...


-[NSView viewDidMoveToWindow] ...
  is also invoked for views not in tabs, before -awakeFromNib
  is invoked whenever a view is moved into or out from a window,
 which, for a view in an NSTabView, means whenever the tab is
 selected or deselected.

So, I need to review all of my -awakeFromNibs and consider all of this.

___

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

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

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

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


Re: App Listener?

2009-01-08 Thread James Montgomerie

On 8 Jan 2009, at 14:14, Rainer Brockerhoff wrote:
Today, the only solution seems to be to install a Carbon Event  
handler for the {kEventClassApplication, kEventAppFrontSwitched}  
event.


Even if such a NSWorkspace notification were to appear in a future  
version of Mac OS X, I'd be interested in a lower-level solution. I  
have a background process that can't link to AppKit due to security  
restrictions, and Carbon Events have gone away for 64-bit processes.


I did look at how HIToolbox does its magic, but it appears to be  
listening to a private notification from the Process Manager. And  
BSD, of course, has no concept of "front process". If nobody knows  
another public API for an app activation notification, I'll file an  
enhancement request.


If you don't mind asking your users to switch on accessibility access  
("enable access for assistive devices" in the Universal Access  
preferences), you can use the Accessibility APIs to monitor app  
switching (this is what's used in the iChatStatusFromApplication  
sample code, for example - http://developer.apple.com/samplecode/iChatStatusFromApplication/) 
.


I say this informationally - I don't think it's a great solution either.

Jamie.
___

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

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

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

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


Re: Removing CALayer after Animation

2009-01-08 Thread Matt Long
No. It is a CABasicAnimation, but it also works with a  
CAKeyframeAnimation.


I modified the example project from this blog post: http://www.cimgf.com/2008/11/05/core-animation-tutorial-interrupting-animation-progress/ 
 to demonstrate this. The modified project is here: http://www.cimgf.com/files/FollowMe.zip 
 .


The sample code does not actually call -removeFromSuperlayer as the  
layer gets referenced again which would cause it to crash. Make sure  
you're not accessing the layer again after you've removed it from it's  
parent. Unless you've explicitly retained it, it's been autoreleased  
at that point.


hth,

-Matt


On Jan 8, 2009, at 12:10 AM, Bridger Maxwell wrote:


Hey,
Is the animation your own subclass of CAAnimation? I am justing using
CAKeyframeAnimation.

TTFN
Bridger

On Tue, Jan 6, 2009 at 1:45 PM, Matt Long long.com>wrote:



Bridger,

As far as I can tell there is nothing inherent in the CA API to do  
what you
want, however, KVC is available to you. When you create your  
animation, do

this:

[animation setValue:objectLayer forKey:@"parentLayer"];

Where objectLayer is the layer the animation is going to be run on.  
Then,

in your -animationDidStop, you can grab the layer like this:

- (void)animationDidStop:(CAAnimation *)theAnimation finished: 
(BOOL)flag

{
CALayer *layer = [theAnimation valueForKey:@"parentLayer"];
if( layer )
{
  NSLog(@"The layer object was: %@ (%@)", layer, [layer name]);
  [layer removeFromSuperlayer];
}
}

I named my layer when I created it with a call to [objectLayer  
setName:@"parentLayer"]
in this code, so the NSLog in -animationDidStop won't display the  
name

unless you've done the same.

Best regards,

-Matt



___

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

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

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

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


Re: App Listener?

2009-01-08 Thread Rainer Brockerhoff
At 05:55 -0800 08/01/09, cocoa-dev-requ...@lists.apple.com wrote:
>From: Jerry Krinock 
>References: <63539670901072146w570a8dc1wc13c58b8ecb43...@mail.gmail.com>
>   
>   <63539670901072246j1f659c63q33a73b501233f...@mail.gmail.com>
>   <63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com>
>In-Reply-To: <63539670901072246u6b783883n69fdf7a44fb0a...@mail.gmail.com>
>Date: Thu, 8 Jan 2009 05:39:57 -0800
>Message-ID: <406b8377-613f-49d2-a3de-2ba381346...@ieee.org>
>
>On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:
>
>>does this work with Dashboard?  it seems that dashboard is a
>>background application that's always open...
>
>Well, obviously it does not.
>
>You'd need a NSWorkspaceDidActivateApplicationNotification, but it looks like 
>there is no such thing.  You could periodically poll -[NSWorkspace 
>activeApplication], but I hope someone has a better idea, because if you do I 
>would not want your process running on my Mac.

Today, the only solution seems to be to install a Carbon Event handler for the 
{kEventClassApplication, kEventAppFrontSwitched} event.

Even if such a NSWorkspace notification were to appear in a future version of 
Mac OS X, I'd be interested in a lower-level solution. I have a background 
process that can't link to AppKit due to security restrictions, and Carbon 
Events have gone away for 64-bit processes.

I did look at how HIToolbox does its magic, but it appears to be listening to a 
private notification from the Process Manager. And BSD, of course, has no 
concept of "front process". If nobody knows another public API for an app 
activation notification, I'll file an enhancement request.

-- 
Rainer Brockerhoff  
Belo Horizonte, Brazil
"In the affairs of others even fools are wise
 In their own business even sages err."
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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

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

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

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


Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Michael Vannorsdel
vImage_Buffer struct has a field for row bytes as well as image  
dimensions.



On Jan 8, 2009, at 6:54 AM, Eric Gorr wrote:

Looks nearly perfect ... unfortunately, it does not look like it  
will take the rowBytes of the GWorldPtr data into account. But, it  
may still be faster to create a flattened buffer and pass that into  
vImagePermuteChannels_ARGB to do all of the swapping.


___

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

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

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

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


Re: [iPhone] [SOLVED] Update table cell text on selection in other view

2009-01-08 Thread Martijn van Exel
Well, I figured it out, I need to put a
[self.tableView reloadData];
in the viewWillAppear handler.
Now it works fine.

Thanks!
Martijn

On Thu, Jan 8, 2009 at 13:11, Martijn van Exel  wrote:

> Hi all,
>
> I have a UITableView with a cell that the user taps to select an item from
> a large list. This list is provided in another view controller that is
> pushed onto view when the user taps the button. So far so good.
>
> Then the user makes a selection from the UITableView by tapping and the
> value is stored in a memeber of the app delegate:
>
> - (void)tableView:(UITableView *)tableView
> didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
> NSLog(@"Table cell selected at section %hu, row %hu",indexPath.section,
> indexPath.row);
> [tableView deselectRowAtIndexPath:indexPath animated:NO];
> Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
> delegate];
> delegate.NaamGeselecteerdeSoort = [soortenFiltered
> objectAtIndex:indexPath.row];
> // POP THE VIEW CONTROLLLERS
> [[delegate nieuweWaarnemingNavigationController]
> popToRootViewControllerAnimated:YES];
> }
>
> The root view controller then should be showing the selected item's name as
> cell text:
>
> (part of the cellForRowAtIndexPath code)
> Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
> delegate];
> ..
> cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
> if(delegate.NaamGeselecteerdeSoort == @"" ||
> delegate.NaamGeselecteerdeSoort == nil) cell.text = @"Nog niet gekozen";
> else cell.text = delegate.NaamGeselecteerdeSoort;
> cell.selectionStyle = UITableViewCellSelectionStyleBlue;
> ..
>
> but it doesn't. Do I need to refresh the view? How?
>
> Thanks,
> Martijn
>
> --
> martijn van exel -+- mve...@gmail.com -+- http://www.schaaltreinen.nl/
>



-- 
martijn van exel -+- mve...@gmail.com -+- http://www.schaaltreinen.nl/
___

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

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

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

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


Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Eric Gorr


On Jan 8, 2009, at 6:57 AM, Michael Vannorsdel wrote:

Have a look at vImagePermuteChannels_ARGB in the Accelerate  
framework.  Should be the fastest and easiest option for reordering  
color components in pixel streams.


Looks nearly perfect ... unfortunately, it does not look like it will  
take the rowBytes of the GWorldPtr data into account. But, it may  
still be faster to create a flattened buffer and pass that into  
vImagePermuteChannels_ARGB to do all of the swapping.



___

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

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

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

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


Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Eric Gorr


On Jan 7, 2009, at 7:39 PM, Graham Cox wrote:



On 8 Jan 2009, at 10:27 am, Eric Gorr wrote:



On Jan 7, 2009, at 11:31 AM, Daniel Kennett wrote:

To further support this theory, take a look at this NSImage where  
I mistakenly only flipped half of my data - the garbled half of  
the image is from data with the wrong endian-ness:


Well, I wrote the code to change the pixel format from BGRA to ARGB.

Running the code:

if ( (**pixMapHandle).pixelFormat == k32BGRAPixelFormat ) {
  NSInteger   x;
  NSInteger   y;
  Ptr currentRow = (**pixMapHandle).baseAddr;

  for ( y = 0; y < pixels_high; y++ ) {
  Uint32 *currentPixel = (Uint32*)currentRow;

  for ( x = 0; x < pixels_wide; x++ ) {
  Uint8 *components = (Uint8*)currentPixel;
  Uint8 temp;

  temp  = components[3];
  components[3] = components[0];
  components[0] = temp;

  temp  = components[1];
  components[1] = components[2];
  components[2] = temp;

  currentPixel++;
  }

  currentRow += rowBytes;
  }
}

over the pixel data to swap the components around allowed  
everything to draw correctly.


I have a feeling there is a better way to do this and, if so, I am  
interested.


Or you could use Core Video - it looks (on an admittedly cursory  
inspection) that you can get CV to perform the conversion for you  
using:


CVPixelBufferCreateWithBytes(...)

One of the arguments is the pixel buffer attributes dictionary, and  
one of its keys is:

kCVPixelBufferPixelFormatTypeKey
Which appears to take the QuickDraw pixelFormat value directly  
(wrapped in a CFNumber). Looks to me as if this is designed to  
handle the exact situation you're facing, that of making use of old  
QD formats. The advantage of this approach is platform independence,  
optimised for you and probably accelerated by the GPU.


Interesting. It looks like the function has a pixelFormatType  
parameter, so there is no need to place it in the attributes  
dictionary. While it does look like I could get a CVPixelBufferRef,  
what is unclear is how I could get a NSImage from the  
CVPixelBufferRef. I've searched briefly, but couldn't come up with  
anything...all of the messages I found mentioning both these items  
talk about converting a NSImage to a CVPixelBufferRef.


I will try CFSwapInt32BigToHost - that looks good.

___

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

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

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

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


Re: App Listener?

2009-01-08 Thread Jerry Krinock

On 2009 Jan, 07, at 22:46, Chunk 1978 wrote:


does this work with Dashboard?  it seems that dashboard is a
background application that's always open...


Well, obviously it does not.

You'd need a NSWorkspaceDidActivateApplicationNotification, but it  
looks like there is no such thing.  You could periodically poll - 
[NSWorkspace activeApplication], but I hope someone has a better idea,  
because if you do I would not want your process running on my 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


[iPhone] Update table cell text on selection in other view

2009-01-08 Thread Martijn van Exel
Hi all,

I have a UITableView with a cell that the user taps to select an item from a
large list. This list is provided in another view controller that is pushed
onto view when the user taps the button. So far so good.

Then the user makes a selection from the UITableView by tapping and the
value is stored in a memeber of the app delegate:

- (void)tableView:(UITableView *)tableView
didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
NSLog(@"Table cell selected at section %hu, row %hu",indexPath.section,
indexPath.row);
[tableView deselectRowAtIndexPath:indexPath animated:NO];
Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
delegate];
delegate.NaamGeselecteerdeSoort = [soortenFiltered
objectAtIndex:indexPath.row];
// POP THE VIEW CONTROLLLERS
[[delegate nieuweWaarnemingNavigationController]
popToRootViewControllerAnimated:YES];
}

The root view controller then should be showing the selected item's name as
cell text:

(part of the cellForRowAtIndexPath code)
Ecogrid_TouchAppDelegate *delegate = [[UIApplication sharedApplication]
delegate];
..
cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
if(delegate.NaamGeselecteerdeSoort == @"" ||
delegate.NaamGeselecteerdeSoort == nil) cell.text = @"Nog niet gekozen";
else cell.text = delegate.NaamGeselecteerdeSoort;
cell.selectionStyle = UITableViewCellSelectionStyleBlue;
..

but it doesn't. Do I need to refresh the view? How?

Thanks,
Martijn

-- 
martijn van exel -+- mve...@gmail.com -+- http://www.schaaltreinen.nl/
___

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

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

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

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


Re: Convert GWorldPtr into a NSImage

2009-01-08 Thread Michael Vannorsdel
Have a look at vImagePermuteChannels_ARGB in the Accelerate  
framework.  Should be the fastest and easiest option for reordering  
color components in pixel streams.



On Jan 7, 2009, at 4:27 PM, Eric Gorr wrote:


Well, I wrote the code to change the pixel format from BGRA to ARGB.

Running the code:

if ( (**pixMapHandle).pixelFormat == k32BGRAPixelFormat ) {
   NSInteger   x;
   NSInteger   y;
   Ptr currentRow = (**pixMapHandle).baseAddr;

   for ( y = 0; y < pixels_high; y++ ) {
   Uint32 *currentPixel = (Uint32*)currentRow;

   for ( x = 0; x < pixels_wide; x++ ) {
   Uint8 *components = (Uint8*)currentPixel;
   Uint8 temp;

   temp  = components[3];
   components[3] = components[0];
   components[0] = temp;

   temp  = components[1];
   components[1] = components[2];
   components[2] = temp;

   currentPixel++;
   }

   currentRow += rowBytes;
   }
}

over the pixel data to swap the components around allowed everything  
to draw correctly.


I have a feeling there is a better way to do this and, if so, I am  
interested.


___

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

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

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

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


Recording video from a QCView to .mov

2009-01-08 Thread Jonathan Selander

Hi,

I'm trying to record video form a webcam input to a .mov file. I've  
made a simple quartz composition and loaded it in a QCView. I tried  
using code from the QCTV example bundled with XCode, but there are  
things I'm not really sure about there. For instance, do i need to use  
OpenGL for rendering frames to a file, or can i use something else,  
perhaps something a little easier to use?


When i do

[_glContext setView:qcView];

I get

2009-01-08 10:40:33.084 macsupport[4218:10b] invalid drawable

in the Debugger Console. Not really sure what it means.

A bit down, this line returns nil:

_exporter = [[FrameMovieExporter alloc] initWithPath:[savePanel  
filename] codec:codec pixelsWide:size.width pixelsHigh:size.height  
options:options];

___

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

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

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

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


  1   2   >