How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-27 Thread Tharindu Madushanka
Hi,

In order to get this I found following code, but I need to import some
frameworks into my code. Could somebody kindly point how can achieve SHA-1
Encrypted string in iPhone. I get few errors compiling since I do not have
necessary framework to use this.. :(

+(NSString *)stringToSha1:(NSString *)str{

// data to Hash
NSMutableData *dataToHash = [str
dataUsingEncoding:NSUTF8StringEncoding];

unsigned char hashBytes[CC_SHA1_DIGEST_LENGTH];
CC_SHA1([dataToHash bytes], [dataToHash length], hashBytes);
NSData *encodedData = [NSData dataWithBytes:hashBytes
length:CC_SHA1_DIGEST_LENGTH];
[dataToHash release];
NSString *encodedStr = [NSString stringWithUTF8String:[encodedData
bytes]];
//NSString *encodedStr = [[NSString alloc]  initWithBytes:[encodedData
bytes]

//
length:[encodedData length] encoding: NSUTF8StringEncoding];
NSLog(@"ENCODED SHA-1: %@", encodedStr);

return encodedStr;

}

Thank you,

Tharindu.
___

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

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

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

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


Re: Video player dead?

2010-11-27 Thread Andrew McLaughlin
Hmmm... Okay, so I unchecked the iTunes U and sync'd. Video player comes up and 
says there's nothing to watch. Now, rechecking and re syncing.

Question is, how could it have gotten blown?

Oh well...

Andrew


On Nov 26, 2010, at 11:56 PM, Andrew McLaughlin wrote:

> Hey list,
> 
> I just updated to 4.2.1 on my iPad 3G after have been on 4.2 gm and 4.2b gm. 
> At this point, my video player no longer plays. When I start it, all I get is 
> a black screen. Anybody else getting this now?
> 
> I hooked up to Xcode and opened the Organizer. Looking at the Console panel, 
> I see the following series of errors reported when I load the app:
> 
>   Fri Nov 26 23:54:35 iPad-3G com.apple.mediaserverd[18] : vxdDec 
> - Frame# 1, DecodeFrame failed with error: 6
> 
>   ...
> 
>   Fri Nov 26 23:54:35 iPad-3G com.apple.mediaserverd[18] : vxdDec 
> - Frame# 201, DecodeFrame failed with error: 6
> 
> So, sounds like I have a corrupted video? Too bad, these are all iTunes U 
> stuff... :P
> 
> Anybody seen this?
> 
> Andrew
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/pik0%40me.com
> 
> This email sent to p...@me.com

___

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

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

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

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


Re: How to encrypt a String to a SHA-1 Encrypted in iPhone

2010-11-27 Thread Tharindu Madushanka
Hi,

It was just I need to add  header. But above code
didn't work. But following encoded to SHA-1 correctly..

I would like to know whether it encodes right ? or Not ?



+(NSString *)stringToSha1:(NSString *)hashkey{

// Using UTF8Encoding
const char *s = [hashkey cStringUsingEncoding:NSUTF8StringEncoding];
NSData *keyData = [NSData dataWithBytes:s length:strlen(s)];

// This is the destination
uint8_t digest[CC_SHA1_DIGEST_LENGTH] = {0};
// This one function does an unkeyed SHA1 hash of your hash data
CC_SHA1(keyData.bytes, keyData.length, digest);

// Now convert to NSData structure to make it usable again
NSData *out = [NSData dataWithBytes:digest
length:CC_SHA1_DIGEST_LENGTH];
// description converts to hex but puts <> around it and spaces every 4
bytes
NSString *hash = [out description];
hash = [hash stringByReplacingOccurrencesOfString:@" " withString:@""];
hash = [hash stringByReplacingOccurrencesOfString:@"<" withString:@""];
hash = [hash stringByReplacingOccurrencesOfString:@">" withString:@""];
// hash is now a string with just the 40char hash value in it

return hash;

}
___

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

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

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

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


iOS - Help with nasty memory leak

2010-11-27 Thread Philip Vallone
Hi,

I have implemented a dragable annotation in my app. I am getting a 100% memory 
leak that has me puzzled. I was hoping that someone can provide some guidance. 
The leak is at:

MKAnnotationView *draggablePinView = [[[AnnotationView alloc] 
initWithAnnotation:annotation reuseIdentifier:@"PinIdentifier"] autorelease];

Here is the entire method:

- (MKAnnotationView *)mapView:(MKMapView *)MapView viewForAnnotation:(id 
)annotation
{

MKAnnotationView *draggablePinView = [[[AnnotationView alloc] 
initWithAnnotation:annotation reuseIdentifier:@"PinIdentifier"] autorelease];

if (draggablePinView) {
draggablePinView.annotation = annotation;

} else {


if ([draggablePinView isKindOfClass:[AnnotationView class]]) {

((AnnotationView *)draggablePinView).mapView = MapView;

}
}

((MKPinAnnotationView *)draggablePinView).pinColor = 
MKPinAnnotationColorGreen;
((MKPinAnnotationView *)draggablePinView).animatesDrop = YES;


return draggablePinView;
}


The analizer says the leak is AnnotationView. So I can't see anything in 
AnnotationView that would cause the leak:

#import "AnnotationView.h"
#import "CurrentLocationAnnotation.h"

@implementation AnnotationView
@synthesize hasBuiltInDraggingSupport;
@synthesize mapView;

- (void)dealloc {

[super dealloc];
}

- (id)initWithAnnotation:(id )annotation 
reuseIdentifier:(NSString *)reuseIdentifier {

self.hasBuiltInDraggingSupport = [[MKPinAnnotationView class] 
instancesRespondToSelector:NSSelectorFromString(@"isDraggable")];

if (self.hasBuiltInDraggingSupport) {
if ((self = [[MKPinAnnotationView alloc] 
initWithAnnotation:annotation reuseIdentifier:reuseIdentifier])) {
[self 
performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber 
numberWithBool:YES]];
}
}


self.rightCalloutAccessoryView = [UIButton 
buttonWithType:UIButtonTypeDetailDisclosure];
self.canShowCallout = YES;


UIImage *image = [UIImage imageNamed:@"gps_add.png"];
UIImageView *imgView = [[[UIImageView alloc] initWithImage:image] 
autorelease];
self.leftCalloutAccessoryView = imgView;
self.image = image;

return self;
}


@end

Thanks for any help and guidance.

Phil___

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

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

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

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


OutlineView with big text editor

2010-11-27 Thread gMail.com
Hi, I have set a custom cell showing icon + text on my outlineView column.
It works well, but whenever I double click on the row to edit the text, I
get a text field editor bigger than the cell itself and covering the left
icon. How can I make this text field editor fit the cell bounds and not
covering the left icon?


Thanks
Leo








___

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

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

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

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


Re: NSTask with unzip

2010-11-27 Thread Ben Haller
On 2010-11-26, at 7:33 AM, gMail.com wrote:

> Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip
> The task saves the unzipped file to the disk, then a I read the unzipped
> file in a NSData. Well. My question is:
> Can I do the same job without saving the unzipped file to the disk?
> 
> I have tried to set the standard output to a pipe - which works well with
> other tasks - but here it doesn't work. The task never exits. Here's the
> wrong code:
> 
> NSTask *unzip = [[[NSTask alloc] init] autorelease];
> [unzip setLaunchPath:@"/usr/bin/unzip"];
> [unzip setArguments:[NSArray arrayWithObjects:@"-p", zipfile,
> @"filetounzip", nil]];
> 
> NSPipe *aPipe = [NSPipe pipe];
> [unzip setStandardOutput:aPipe];
> [unzip launch];
> [unzip waitUntilExit];
> 
> if([unzip terminationStatus] == noErr){
> dictData = [NSMutableData data];
> while((dataOut = [aPipe availableData]) && [dataOut length]){
> [dictData appendData:dataOut];
> }
> }

  If I recall correctly, the problem is likely to be your use of 
-waitUntilExit.  That API should apparently have a large red label on it 
("Warnin', lark's vomit!") since everybody wants to use it this way.  The 
problem is that the task's output pipe fills up because it isn't being 
serviced, and then things get locked up.  You need to go with asynchronous 
reads to service the pipe as output gets stuffed into it.  There should be lots 
of examples of this on this list, now that you know what to look for.

  What would be great would be a new call, along the lines of 
-dataFromWaitingUntilExit or some such, that does all this for you, since this 
is so commonly what people want to do.

Ben Haller
McGill University

___

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

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

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

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


Re: respondsToSelector & "warning: may not respond"

2010-11-27 Thread Mikkel Eide Eriksen
Thanks all,

I ended up changing around my object hierarchy and casting to a superclass that 
has ordinals.

Mikkel

On Nov 26, 2010, at 10:38 PM, Julien Jalon wrote:

> Z) ignore the warning
> 
> On Fri, Nov 26, 2010 at 9:44 PM, Ken Thomases  wrote:
> On Nov 26, 2010, at 12:27 PM, Mike Abdullah wrote:
> 
> > C) Typecast the object to a class that is known to implement -setOrdinal:
> 
> D) Typecast the object to id.
> 
> 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/jjalon%40gmail.com
> 
> This email sent to jja...@gmail.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

Core data binding "first" of to-many relationship

2010-11-27 Thread Mikkel Eide Eriksen
Hi

I have an NSArrayController that holds a set of persons. These persons have a 
to-many relationship of name objects. Usually they will only have one name, but 
there may be multiple (or even no name).

In my interface, I have an NSTableView that will display the persons. The 
attributes are easy enough (gender, etc), but how can I bind the names to a 
column so only one name is shown for a person?

If I just bind to my person-array controller with the names keypath, obviously 
I get the description of an array in the cell, which isn't very pretty. Seems I 
could do it with a custom NSValueTransformer but there is probably a better way?

Mikkel




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: NSTask with unzip

2010-11-27 Thread Dave DeLong
The way I get around this is to use an NSFileHandle for standard out instead of 
an NSPipe. It's a bit less efficient, but slightly more convenient. 

Dave

Sent from my iPhone

On Nov 27, 2010, at 7:59 AM, Ben Haller  wrote:

> On 2010-11-26, at 7:33 AM, gMail.com wrote:
> 
>> Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip
>> The task saves the unzipped file to the disk, then a I read the unzipped
>> file in a NSData. Well. My question is:
>> Can I do the same job without saving the unzipped file to the disk?
>> 
>> I have tried to set the standard output to a pipe - which works well with
>> other tasks - but here it doesn't work. The task never exits. Here's the
>> wrong code:
>> 
>> NSTask *unzip = [[[NSTask alloc] init] autorelease];
>> [unzip setLaunchPath:@"/usr/bin/unzip"];
>> [unzip setArguments:[NSArray arrayWithObjects:@"-p", zipfile,
>> @"filetounzip", nil]];
>> 
>> NSPipe *aPipe = [NSPipe pipe];
>> [unzip setStandardOutput:aPipe];
>> [unzip launch];
>> [unzip waitUntilExit];
>> 
>> if([unzip terminationStatus] == noErr){
>>dictData = [NSMutableData data];
>>while((dataOut = [aPipe availableData]) && [dataOut length]){
>>[dictData appendData:dataOut];
>>}
>> }
> 
>  If I recall correctly, the problem is likely to be your use of 
> -waitUntilExit.  That API should apparently have a large red label on it 
> ("Warnin', lark's vomit!") since everybody wants to use it this way.  The 
> problem is that the task's output pipe fills up because it isn't being 
> serviced, and then things get locked up.  You need to go with asynchronous 
> reads to service the pipe as output gets stuffed into it.  There should be 
> lots of examples of this on this list, now that you know what to look for.
> 
>  What would be great would be a new call, along the lines of 
> -dataFromWaitingUntilExit or some such, that does all this for you, since 
> this is so commonly what people want to do.
> 
> Ben Haller
> McGill University
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
> 
> This email sent to davedel...@me.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: iOS - Help with nasty memory leak

2010-11-27 Thread Joar Wingfors

On 27 nov 2010, at 06.33, Philip Vallone wrote:

>   if ((self = [[MKPinAnnotationView alloc] 
> initWithAnnotation:annotation reuseIdentifier:reuseIdentifier])) {
>   [self 
> performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber 
> numberWithBool:YES]];
>   }


You're replacing the current instance with a new instance here. Is that 
intended? While not illegal, it is really unusual to do that.

If that's intended, you also would have to release the old instance before 
replacing it with the new instance (that's the leak). If that was not intended, 
you probably should be calling [super initWithAnnotation:annotation 
reuseIdentifier:reuseIdentifier], and in any case, you need to make sure that 
you *always* call through to the designated initializer of your superclass 
somewhere in your init method.

Finally, why are you calling a method using "-performSelector:withObject:" 
here? That seems like a trick to "fix" a compiler warning? If so, you should 
think about why the compiler were warning you about that call, and fix it 
properly - by adding the required #import statement, by adding the missing 
method declaration to the header, or - if all else fails - by casting the 
receiver to the appropriate type.


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: NSTask with unzip

2010-11-27 Thread Ben Haller
  Here's a post that I found useful:

http://dev.notoptimal.net/2007/04/nstasks-nspipes-and-deadlocks-when.html

  Dave, not sure what you mean here.  NSPipe uses NSFileHandle.  Does using an 
NSFileHandle directly change things somehow?  If so, why?  I think this is an 
avenue I haven't explored; once I (finally) figured out the right magic 
incantations to get things to work reliably with NSPipe, I now recycle that 
code everywhere I need an NSTask :->.

Ben Haller
McGill University


On 2010-11-27, at 11:48 AM, Dave DeLong wrote:

> The way I get around this is to use an NSFileHandle for standard out instead 
> of an NSPipe. It's a bit less efficient, but slightly more convenient. 
> 
> Dave
> 
> Sent from my iPhone
> 
> On Nov 27, 2010, at 7:59 AM, Ben Haller  wrote:
> 
>> On 2010-11-26, at 7:33 AM, gMail.com wrote:
>> 
>>> Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip
>>> The task saves the unzipped file to the disk, then a I read the unzipped
>>> file in a NSData. Well. My question is:
>>> Can I do the same job without saving the unzipped file to the disk?
>>> 
>>> I have tried to set the standard output to a pipe - which works well with
>>> other tasks - but here it doesn't work. The task never exits. Here's the
>>> wrong code:
>>> 
>>> NSTask *unzip = [[[NSTask alloc] init] autorelease];
>>> [unzip setLaunchPath:@"/usr/bin/unzip"];
>>> [unzip setArguments:[NSArray arrayWithObjects:@"-p", zipfile,
>>> @"filetounzip", nil]];
>>> 
>>> NSPipe *aPipe = [NSPipe pipe];
>>> [unzip setStandardOutput:aPipe];
>>> [unzip launch];
>>> [unzip waitUntilExit];
>>> 
>>> if([unzip terminationStatus] == noErr){
>>>   dictData = [NSMutableData data];
>>>   while((dataOut = [aPipe availableData]) && [dataOut length]){
>>>   [dictData appendData:dataOut];
>>>   }
>>> }
>> 
>> If I recall correctly, the problem is likely to be your use of 
>> -waitUntilExit.  That API should apparently have a large red label on it 
>> ("Warnin', lark's vomit!") since everybody wants to use it this way.  The 
>> problem is that the task's output pipe fills up because it isn't being 
>> serviced, and then things get locked up.  You need to go with asynchronous 
>> reads to service the pipe as output gets stuffed into it.  There should be 
>> lots of examples of this on this list, now that you know what to look for.
>> 
>> What would be great would be a new call, along the lines of 
>> -dataFromWaitingUntilExit or some such, that does all this for you, since 
>> this is so commonly what people want to do.
>> 
>> Ben Haller
>> McGill University
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
>> 
>> This email sent to davedel...@me.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: NSTask with unzip

2010-11-27 Thread Scott Ribe
On Nov 27, 2010, at 10:12 AM, Ben Haller wrote:
> 
> NSPipe uses NSFileHandle.  Does using an NSFileHandle directly change things 
> somehow?  If so, why?

NSPipe uses pipes, which act sort of like files, except for that buffering 
thing, enough so that they can be accessed through the same interface as files. 
But using NSFileHandle directly, you can use actual files, which in essence use 
the disk as the "buffer"...

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.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: respondsToSelector & "warning: may not respond"

2010-11-27 Thread David Duncan
On Nov 26, 2010, at 6:22 PM, Dave Zwerdling wrote:

> You can implement other methods and do a single cast to NSObject 
> * (or id if you don't need the NSObject 
> methods)


It is often impossible to get away from needing at least some of NSObject's 
functionality, but fortunately you can declare that your protocol inherits from 
another, and there is also an NSObject protocol that defines the core 
functionality of the class, so you can do this when you declare your protocol 
and never need to worry about "NSObject"

@protocol SomeProtocol : NSObject
// stuff
@end
--
David Duncan

___

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

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

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

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


Re: respondsToSelector & "warning: may not respond"

2010-11-27 Thread Andy Lee
On Nov 27, 2010, at 12:35 PM, David Duncan  wrote:

>  fortunately you can declare that your protocol inherits from another, and 
> there is also an NSObject protocol that defines the core functionality of the 
> class, so you can do this when you declare your protocol and never need to 
> worry about "NSObject"
> 
> @protocol SomeProtocol : NSObject
> // stuff

AFAIK protocols don't inherit from each other but rather conform to each other, 
meaning the above should be

@protocol SomeProtocol 

But maybe I'm just unaware of new syntax in the latest compiler?

--Andy

___

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

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

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

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


Re: respondsToSelector & "warning: may not respond"

2010-11-27 Thread David Duncan
On Nov 27, 2010, at 9:46 AM, Andy Lee wrote:

> AFAIK protocols don't inherit from each other but rather conform to each 
> other, meaning the above should be
> 
> @protocol SomeProtocol 
> 
> But maybe I'm just unaware of new syntax in the latest compiler?


No, your probably right. Dangers of typing code into Mail instead of a compiler 
:).
--
David Duncan

___

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

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

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

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


Re: NSTask with unzip

2010-11-27 Thread Dave DeLong
What Scott said.  I use NSFileManager to create a file in 
NSTemporaryDirectory(), then point an NSFileHandle to that file for writing.  
That NSFileHandle becomes the standard out of the task, and all the output of 
the task is written to the file, which I can then peruse and reuse later at my 
convenience.

Dave

On Nov 27, 2010, at 9:12 AM, Ben Haller wrote:

>  Dave, not sure what you mean here.  NSPipe uses NSFileHandle.  Does using an 
> NSFileHandle directly change things somehow?  If so, why?
___

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

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

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

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


Re: respondsToSelector & "warning: may not respond"

2010-11-27 Thread Stephen J. Butler
Or I believe you can also do id< NSObject, MyProtocol > if you need
something that conforms to both. Unless you actually need something
that is only implemented in the NSObject class and not defined in the
protocol.

On Sat, Nov 27, 2010 at 11:35 AM, David Duncan  wrote:
> On Nov 26, 2010, at 6:22 PM, Dave Zwerdling wrote:
>
>> You can implement other methods and do a single cast to NSObject 
>> * (or id if you don't need the NSObject 
>> methods)
>
>
> It is often impossible to get away from needing at least some of NSObject's 
> functionality, but fortunately you can declare that your protocol inherits 
> from another, and there is also an NSObject protocol that defines the core 
> functionality of the class, so you can do this when you declare your protocol 
> and never need to worry about "NSObject"
>
> @protocol SomeProtocol : NSObject
> // stuff
> @end
> --
> David Duncan
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/stephen.butler%40gmail.com
>
> This email sent to stephen.but...@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: NSTask with unzip

2010-11-27 Thread gMail.com
How do you create the NSFileHandle ?
I succeeded only creating it as
NSFileHandle*theFileH = [NSFileHandle
 fileHandleForWritingAtPath:tempFilePath];
and the file tempFilePath must exists.

But as I said, I would like to get rid of the temp file.

--
Leo



> Da: Dave DeLong 
> Data: Sat, 27 Nov 2010 08:48:34 -0800
> A: Ben Haller 
> Cc: "gMail.com" , Cocoa List
> 
> Oggetto: Re: NSTask with unzip
> 
> The way I get around this is to use an NSFileHandle for standard out instead
> of an NSPipe. It's a bit less efficient, but slightly more convenient.
> 
> Dave
> 
> Sent from my iPhone
> 
> On Nov 27, 2010, at 7:59 AM, Ben Haller  wrote:
> 
>> On 2010-11-26, at 7:33 AM, gMail.com wrote:
>> 
>>> Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip
>>> The task saves the unzipped file to the disk, then a I read the unzipped
>>> file in a NSData. Well. My question is:
>>> Can I do the same job without saving the unzipped file to the disk?
>>> 
>>> I have tried to set the standard output to a pipe - which works well with
>>> other tasks - but here it doesn't work. The task never exits. Here's the
>>> wrong code:
>>> 
>>> NSTask *unzip = [[[NSTask alloc] init] autorelease];
>>> [unzip setLaunchPath:@"/usr/bin/unzip"];
>>> [unzip setArguments:[NSArray arrayWithObjects:@"-p", zipfile,
>>> @"filetounzip", nil]];
>>> 
>>> NSPipe *aPipe = [NSPipe pipe];
>>> [unzip setStandardOutput:aPipe];
>>> [unzip launch];
>>> [unzip waitUntilExit];
>>> 
>>> if([unzip terminationStatus] == noErr){
>>>dictData = [NSMutableData data];
>>>while((dataOut = [aPipe availableData]) && [dataOut length]){
>>>[dictData appendData:dataOut];
>>>}
>>> }
>> 
>>  If I recall correctly, the problem is likely to be your use of
>> -waitUntilExit.  That API should apparently have a large red label on it
>> ("Warnin', lark's vomit!") since everybody wants to use it this way.  The
>> problem is that the task's output pipe fills up because it isn't being
>> serviced, and then things get locked up.  You need to go with asynchronous
>> reads to service the pipe as output gets stuffed into it.  There should be
>> lots of examples of this on this list, now that you know what to look for.
>> 
>>  What would be great would be a new call, along the lines of
>> -dataFromWaitingUntilExit or some such, that does all this for you, since
>> this is so commonly what people want to do.
>> 
>> Ben Haller
>> McGill University
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
>> 
>> This email sent to davedel...@me.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: NSTask with unzip

2010-11-27 Thread Dave DeLong
Something along the lines of:

NSString * tempFilePath = [NSTemporaryDirectory() 
stringByAppendingPathComponent:@"myTempFile.tmp"];
if (![[NSFileManager defaultManager] fileExistsAtPath:tempFilePath]) {
  [[NSFileManager defaultManager] createFileAtPath:tempFilePath contents:nil 
attributes:nil];
}

NSFileHandle * outHandle = [NSFileHandle 
fileHandleForWritingAtPath:tempFilePath];
[myTask setStandardOutput:outHandle];



NSString * output = [NSString stringWithContentsOfFile:tempFilePath 
encoding:NSUTF8StringEncoding error:nil];
[[NSFileManager defaultManager] removeItemAtPath:tempFilePath error:nil];

(typed in Mail.app. YMMV)

Dave

On Nov 27, 2010, at 10:29 AM, gMail.com wrote:

> How do you create the NSFileHandle ?
> I succeeded only creating it as
> NSFileHandle*theFileH = [NSFileHandle
> fileHandleForWritingAtPath:tempFilePath];
> and the file tempFilePath must exists.
> 
> But as I said, I would like to get rid of the temp file.
> 
> --
> Leo
___

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

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

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

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


Re: iOS - Help with nasty memory leak

2010-11-27 Thread Philip Vallone
Thank you, 

My viewForAnnotation was all wrong. I was trying code from this tutorial:

http://trentkocurek.wordpress.com/2010/07/21/ios4-map-kit-draggable-annotation-views/

So, I went back and redid my code, which fixed the memory leak and alleviated 
the need for a custom Annotation View.

- (MKAnnotationView *)mapView:(MKMapView *)MapView viewForAnnotation:(id 
)annotation
{

MKPinAnnotationView *pin = (MKPinAnnotationView *) [self.mapView 
dequeueReusableAnnotationViewWithIdentifier: @"PinIdentifier"];

if (pin == nil) {

pin = [[[MKPinAnnotationView alloc] initWithAnnotation: 
annotation reuseIdentifier: @"PinIdentifier"] autorelease];

}else   {
pin.annotation = annotation;
}
pin.pinColor = MKPinAnnotationColorGreen;
pin.animatesDrop = YES;
pin.draggable = YES;
pin.canShowCallout = YES;
pin.rightCalloutAccessoryView = [UIButton 
buttonWithType:UIButtonTypeDetailDisclosure];

UIImage *image = [UIImage imageNamed:@"gps_add.png"];
UIImageView *imgView = [[[UIImageView alloc] 
initWithImage:image] autorelease];
pin.leftCalloutAccessoryView = imgView;


return pin;

}

Thanks a bunch,

Phil

On Nov 27, 2010, at 11:50 AM, Joar Wingfors wrote:

> 
> On 27 nov 2010, at 06.33, Philip Vallone wrote:
> 
>>  if ((self = [[MKPinAnnotationView alloc] 
>> initWithAnnotation:annotation reuseIdentifier:reuseIdentifier])) {
>>  [self 
>> performSelector:NSSelectorFromString(@"setDraggable:") withObject:[NSNumber 
>> numberWithBool:YES]];
>>  }
> 
> 
> You're replacing the current instance with a new instance here. Is that 
> intended? While not illegal, it is really unusual to do that.
> 
> If that's intended, you also would have to release the old instance before 
> replacing it with the new instance (that's the leak). If that was not 
> intended, you probably should be calling [super initWithAnnotation:annotation 
> reuseIdentifier:reuseIdentifier], and in any case, you need to make sure that 
> you *always* call through to the designated initializer of your superclass 
> somewhere in your init method.
> 
> Finally, why are you calling a method using "-performSelector:withObject:" 
> here? That seems like a trick to "fix" a compiler warning? If so, you should 
> think about why the compiler were warning you about that call, and fix it 
> properly - by adding the required #import statement, by adding the missing 
> method declaration to the header, or - if all else fails - by casting the 
> receiver to the appropriate type.
> 
> 
> 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: NSTask with unzip

2010-11-27 Thread Leonardo
Ben, thank you so much! I have successfully done it.
I post the code here for anyone to use it. I love this list.

- (NSData*)UnzipFile:(NSString*)sourcePath
extractFileName:(NSString*)extractFileName
{
NSTask*unzip = [[[NSTask alloc] init] autorelease];
NSPipe*aPipe = [NSPipe pipe];
[unzip setStandardOutput:aPipe];
[unzip setLaunchPath:@"/usr/bin/unzip"];
[unzip setArguments:[NSArray arrayWithObjects:@"-p", sourcePath,
extractFileName, nil]];
[unzip launch];

NSMutableData*dataOut = [NSMutableData data];
NSData*dataIn = nil;
NSException*error = nil;

while((dataIn = [[aPipe fileHandleForReading]
availableDataOrError:&error]) && [dataIn length] && error == nil){
[dataOut appendData:dataIn];
}

if([dataOut length] && error == nil){
return dataOut;
}

return nil;
}


// Then I subclassed NSFileHandler this way

@implementation NSFileHandle (MyOwnAdditions)
- (NSData*)availableDataOrError:(NSException**)returnError
{
for(;;){
@try{
return [self availableData];
}...@catch (NSException *e) {
if ([[e name] isEqualToString:NSFileHandleOperationException]) {
if ([[e reason] isEqualToString:@"*** -[NSConcreteFileHandle
availableData]: Interrupted system call"]) {
continue;
}
if (returnError)
*returnError = e;
return nil;
}
@throw;
}
}
}
@end


> Da: Ben Haller 
> Data: Sat, 27 Nov 2010 12:12:39 -0500
> A: Dave DeLong 
> Cc: "gMail.com" , Cocoa List
> 
> Oggetto: Re: NSTask with unzip
> 
>   Here's a post that I found useful:
> 
> http://dev.notoptimal.net/2007/04/nstasks-nspipes-and-deadlocks-when.html
> 
>   Dave, not sure what you mean here.  NSPipe uses NSFileHandle.  Does using an
> NSFileHandle directly change things somehow?  If so, why?  I think this is an
> avenue I haven't explored; once I (finally) figured out the right magic
> incantations to get things to work reliably with NSPipe, I now recycle that
> code everywhere I need an NSTask :->.
> 
> Ben Haller
> McGill University
> 
> 
> On 2010-11-27, at 11:48 AM, Dave DeLong wrote:
> 
>> The way I get around this is to use an NSFileHandle for standard out instead
>> of an NSPipe. It's a bit less efficient, but slightly more convenient.
>> 
>> Dave
>> 
>> Sent from my iPhone
>> 
>> On Nov 27, 2010, at 7:59 AM, Ben Haller  wrote:
>> 
>>> On 2010-11-26, at 7:33 AM, gMail.com wrote:
>>> 
 Hi, I can properly unzip a zip file launching a NSTask with /usr/bin/unzip
 The task saves the unzipped file to the disk, then a I read the unzipped
 file in a NSData. Well. My question is:
 Can I do the same job without saving the unzipped file to the disk?
 
 I have tried to set the standard output to a pipe - which works well with
 other tasks - but here it doesn't work. The task never exits. Here's the
 wrong code:
 
 NSTask *unzip = [[[NSTask alloc] init] autorelease];
 [unzip setLaunchPath:@"/usr/bin/unzip"];
 [unzip setArguments:[NSArray arrayWithObjects:@"-p", zipfile,
 @"filetounzip", nil]];
 
 NSPipe *aPipe = [NSPipe pipe];
 [unzip setStandardOutput:aPipe];
 [unzip launch];
 [unzip waitUntilExit];
 
 if([unzip terminationStatus] == noErr){
   dictData = [NSMutableData data];
   while((dataOut = [aPipe availableData]) && [dataOut length]){
   [dictData appendData:dataOut];
   }
 }
>>> 
>>> If I recall correctly, the problem is likely to be your use of
>>> -waitUntilExit.  That API should apparently have a large red label on it
>>> ("Warnin', lark's vomit!") since everybody wants to use it this way.  The
>>> problem is that the task's output pipe fills up because it isn't being
>>> serviced, and then things get locked up.  You need to go with asynchronous
>>> reads to service the pipe as output gets stuffed into it.  There should be
>>> lots of examples of this on this list, now that you know what to look for.
>>> 
>>> What would be great would be a new call, along the lines of
>>> -dataFromWaitingUntilExit or some such, that does all this for you, since
>>> this is so commonly what people want to do.
>>> 
>>> Ben Haller
>>> McGill University
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/davedelong%40me.com
>>> 
>>> This email sent to davedel...@me.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 coco

Icon Designer?

2010-11-27 Thread Andrew McLaughlin
Hi all,

Can anyone recommend a good icon designer/illustrator? I have a good 
illustration designed for the splash screen of my app, but need help getting an 
icon built. My illustrator doesn't know how to do that, and I'm all thumbs when 
it comes to artwork.

TiA
Andrew
___

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

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

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

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


CG: linking two views at different zoom levels

2010-11-27 Thread Reaves, Timothy
I have two views: one displays an image created with CG calls, and in the
second one I would like to show a zoomed in version of the same image,
centered around where the user has tapped.  I am using
UIGestureRecognizerDelegate to get the pan gesture, and draw into the second
view with the new zoom level.  And this works.  What I don't know how to do
is to have the center of the second view coincide with the tap on the first
view.

Someone pointed me at code that does this for bit mapped CG contexts, but
this is using vectors with a default context.

Any pointers?
___

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

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

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

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


Re: Icon Designer?

2010-11-27 Thread koko

/ Developer / Applications / Utilities / Icon Composer


On Nov 27, 2010, at 3:06 PM, Andrew McLaughlin wrote:


Hi all,

Can anyone recommend a good icon designer/illustrator? I have a good  
illustration designed for the splash screen of my app, but need help  
getting an icon built. My illustrator doesn't know how to do that,  
and I'm all thumbs when it comes to artwork.


TiA
Andrew
___

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

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

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

This email sent to k...@highrolls.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: Icon Designer?

2010-11-27 Thread Eric Dolecki
You can hit me up on Monday if you'd like,  i develop and design all of the 
time and perhaps i can help you out.

Sent from my iPad of doom.

On Nov 27, 2010, at 5:06 PM, Andrew McLaughlin  wrote:

> Hi all,
> 
> Can anyone recommend a good icon designer/illustrator? I have a good 
> illustration designed for the splash screen of my app, but need help getting 
> an icon built. My illustrator doesn't know how to do that, and I'm all thumbs 
> when it comes to artwork.
> 
> TiA
> Andrew
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/edolecki%40gmail.com
> 
> This email sent to edole...@gmail.com
___

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

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

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

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


Re: Core data binding "first" of to-many relationship

2010-11-27 Thread Jerry Krinock

On 2010 Nov 27, at 08:20, Mikkel Eide Eriksen wrote:

> I have an NSArrayController that holds a set of persons. These persons have a 
> to-many relationship of name objects. Usually they will only have one name, 
> but there may be multiple (or even no name).
> 
> In my interface, I have an NSTableView that will display the persons. The 
> attributes are easy enough (gender, etc), but how can I bind the names to a 
> column so only one name is shown for a person?

Good old-fashioned code to the rescue.  Implement a method in your Person class 
which returns such a name, and bind the table column to it.  I think that as 
long as the column is not editable, you will not need a setter.

___

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

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

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

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


Re: Core data binding "first" of to-many relationship

2010-11-27 Thread Sean McBride
On Nov 27, 2010, at 17:44, Jerry Krinock wrote:

>> I have an NSArrayController that holds a set of persons. These persons have 
>> a to-many relationship of name objects. Usually they will only have one 
>> name, but there may be multiple (or even no name).
>> 
>> In my interface, I have an NSTableView that will display the persons. The 
>> attributes are easy enough (gender, etc), but how can I bind the names to a 
>> column so only one name is shown for a person?
> 
> Good old-fashioned code to the rescue.  Implement a method in your Person 
> class which returns such a name, and bind the table column to it.  I think 
> that as long as the column is not editable, you will not need a setter.

Additionally, in your Person class, implement 
keyPathsForValuesAffectingValueForKey: so that when the 'names' relationship 
changes, your 'primaryName' key does too.

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


Organize a file

2010-11-27 Thread Leonardo
...and now it comes the hardest part of my app.
I have to decide about the structure of my document file so I ask here to
get some hint.

A) My app should download the doc file from internet and show its content.
B) The file always contains a dict.plist NSDictionary.
C) The file could contains some images.jpg or png, or tiff...
D) The file could contain a QT movie I have to play in streaming.

Hypotheses.
1)
Save the doc file as filePackage and put the dict.plist, all the image
files, and the movie file within the package.
At runtime my app should then download, one by one, all the files from the
filePackage (which now on the server looks like a folder - not so safe).
This solution lets me easily make the streaming from the movie file.

2) Save the doc to one unique file (I would prefer this solution). If so, in
case the doc contains a movie file, I need to know how to point to the movie
data and begin the streaming. I have already a class which downloads files,
even with an offset from the beginning of the file.

Questions:
Do I need CoreData?
Can I use the old "Handle and Addresses" method to create the doc file? I
mean, I put at the beginning of the file a "fixed size header" containing
the addresses of the images block and the movie block, then firstly  I
download the header only, then I can download the image files thanks to the
offset... But, how to begin a (movie) streaming from an URL and an offset?


Thanks
Leonardo


___

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

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

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

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


Re: OutlineView with big text editor

2010-11-27 Thread Patrick Mau

On 27.11.2010, at 15:43, gMail.com wrote:

> Hi, I have set a custom cell showing icon + text on my outlineView column.
> It works well, but whenever I double click on the row to edit the text, I
> get a text field editor bigger than the cell itself and covering the left
> icon. How can I make this text field editor fit the cell bounds and not
> covering the left icon?

Hi Leo

Your NSCell implementation should implement something like the following.
In 'editWithFrame:...' you have to account for your image size and adjust
the cell frame before calling super.

(Copied from a custom cell code, but typed in mail to give you the idea)

- (void)editWithFrame:(NSRect)r inView:(NSView *)controlView editor:(NSText 
*)textObj
 delegate:(id)anObject event:(NSEvent *)theEvent
{
// Adjust the cell frame to not cover the image
r.origin.x += imageWidth;
r.size.width -= imageWidth;
[super editWithFrame:r inView:controlView editor:textObj delegate:anObject 
event:theEvent];
}

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


QTKit Exception

2010-11-27 Thread Francisco Garza
I keep getting an exception from QTKit when quickly moving through a playlist 
of songs. Here is the console log and the portion of my code where the 
exception is thrown. I am using garbage collection on Snow Leopard.


2010-11-27 21:33:37.852 QTKitServer[15546:903] -[QTTrack_QuickTime 
originalKeepInactiveFlag]: unrecognized selector sent to instance 0x119fd0
2010-11-27 21:33:37.853 QTKitServer[15546:903] *** Terminating app due to 
uncaught exception 'NSInvalidArgumentException', reason: '-[QTTrack_QuickTime 
originalKeepInactiveFlag]: unrecognized selector sent to instance 0x119fd0'
*** Call stack at first throw:
(
0   CoreFoundation  0x9011a6ba __raiseError + 410
1   libobjc.A.dylib 0x92ada509 objc_exception_throw 
+ 56
2   CoreFoundation  0x9016790b -[NSObject(NSObject) 
doesNotRecognizeSelector:] + 187
3   CoreFoundation  0x900c0c36 ___forwarding___ + 
950
4   CoreFoundation  0x900c0802 
_CF_forwarding_prep_0 + 50
5   QTKit   0x949a4e08 -[QTMovie_QuickTime 
initWithQuickTimeMovie:disposeWhenDone:delegate:attributes:error:forParent:] + 
173
6   QTKit   0x949a386b -[QTMovie_QuickTime 
initWithAttributes:error:forParent:] + 6159
7   QTKit   0x9495b0f0 -[QTMovie 
initWithAttributes:error:] + 1012
8   QTKitServer 0x0001feb5 
do_initWithAttributes + 202
9   QTKitServer 0xea53 _XinitWithAttributes 
+ 220
10  QTKitServer 0x21bb QTKitServer_server + 
113
11  QTKitServer 0x0001e194 mach_port_callback + 
84
12  CoreFoundation  0x90088772 __CFMachPortPerform 
+ 338
13  CoreFoundation  0x900844db __CFRunLoopRun + 6523
14  CoreFoundation  0x90082464 CFRunLoopRunSpecific 
+ 452
15  CoreFoundation  0x900883a4 CFRunLoopRun + 84
16  QTKitServer 0x0001e702 main + 1068
17  QTKitServer 0x2141 start + 53
)
assertion failure on line 219 of 
"/SourceCache/gdb/gdb-1472/src/gdb/macosx/macosx-nat-inferior-util.c" in 
function "macosx_inferior_suspend_mach": macosx_task_valid (s->task)
warning: Got an error handling event: "assertion failure on line 219 of 
"/SourceCache/gdb/gdb-1472/src/gdb/macosx/macosx-nat-inferior-util.c" in 
function "macosx_inferior_suspend_mach": macosx_task_valid (s->task)
".
sharedlibrary apply-load-rules all
Error calling thread_get_state for GP registers for thread 
0x5123lx11557^error,msg="error on line 169 of 
\"/SourceCache/gdb/gdb-1472/src/gdb/macosx/i386-macosx-nat-exec.c\" in function 
\"fetch_inferior_registers\": (ipc/send) invalid destination port 
(0x1003)\n"

---

("song" is a QTMovie object)

if (self.isPlaying) {
[song stop];
[song setRate:0.0];
}
song = nil;
NSURL *url = [NSURL URLWithString:path];
NSError *err;

@try {
if ([QTMovie canInitWithFile:[url path]])
song = [QTMovie movieWithFile:[url path] error:&err];
if (err) {NSLog(@"quicktime can't init. bailing."); return;}
}
@catch (NSException * e) {
NSLog(@"quicktime exception %@", e);
}
@finally {

}



___

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

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

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

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


How to approach to write such an app?

2010-11-27 Thread ico
Hi All,

Suppose I have an forum powered by Discuz. I want to write an iPhone
application which is like a portal can
access that forum, any forum operation like browsing, reply, change profile,
make it favourite post etc can
be done in that iPhone application as well.
I just wonder how to approach that, say what documents I should read first,
what knowledge or technology
I should master to do it?
My idea is to start with reading CFNetwork programming guide and stream
programming guide for cocoa.
Any advice is appreciated!

-- 
==
Life isn't about finding yourself.
Life is about creating yourself.
___

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

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

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

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


Re: Icon Designer?

2010-11-27 Thread Andrew McLaughlin
Thanks. But I need help with the aesthetic perspective, not on the file 
building.

Andrew


On Nov 27, 2010, at 2:17 PM, k...@highrolls.net wrote:

> / Developer / Applications / Utilities / Icon Composer
> 
> 
> On Nov 27, 2010, at 3:06 PM, Andrew McLaughlin wrote:
> 
>> Hi all,
>> 
>> Can anyone recommend a good icon designer/illustrator? I have a good 
>> illustration designed for the splash screen of my app, but need help getting 
>> an icon built. My illustrator doesn't know how to do that, and I'm all 
>> thumbs when it comes to artwork.
>> 
>> TiA
>> Andrew
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
>> 
>> This email sent to k...@highrolls.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