Re: Subclassing UIWebview a show-stopper?

2011-08-09 Thread Dave DeLong
Hi Arri,

Subclassing UIWebView is probably not going to get your app rejected (though I 
have no insight in to the approval process).  However from a architecture 
point-of-view, it smells bad.  UIWebView is one of those views that's not 
intended to be subclassed.  Sure you can, since you can declare anything as 
your superclass, but I'd be highly surprised if the UIWebView authors are even 
expecting people to subclass it.  If they're not, then that could mean that 
there's logic in there that operates on the assumption of none of the methods 
being overridden.  There are certainly classes like that in all of the Cocoa 
(Touch) frameworks.

This sounds like one of the things that I'd only go ahead with after I've 
proven that every other idea presented isn't possible.

Dave

On Aug 8, 2011, at 10:51 PM, arri wrote:

 Hello,
 
 After allot of writing test-cases, and googling for others'
 experiences, i found that the most easy and straightforward way of
 achieving what i want, is to simply subcass UIWebView and override
 UIViews' - hitTest:withEvent method.
 However, as everyone emphasize everywhere i look, the docs say i
 should not subclass UIWebView.
 
 Perhaps this is more about the english language than about software
 development or Apple, but what does should exactlty mean in this
 context.
 Will Apple possibly reject the app if i use a UIWebView subclass?
 
 Or does it mean how i've always understood the word should and i
 could read the docs as such: …there shouldn't be a need to
 subclass….
 In other words: subclassing UIWebview will not result in a rejection.
 
 
 
 
 
 
 thanks,
 arri
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 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: CFURLWriteDataAndPropertiesToResource as root?

2011-08-09 Thread Chris Ridd

On 8 Aug 2011, at 16:02, Kyle Sluder wrote:

 On Aug 8, 2011, at 4:54 AM, Chris Ridd chrisr...@mac.com wrote:
 
 
 Does OS X really support the sticky bit? Lion's sys/stat.h suggests no, 
 though this line could be read a couple of ways:
 
 Yep, it's supported and used on directories. Don't think it's supported on 
 files, though.

I was assuming it was supported too, but the comment makes me less certain.

Chris
___

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

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

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

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


blocks and retaining CoreFoundation objects

2011-08-09 Thread Roland King
I have a slow image conversion which I want to throw onto a background thread 
using GCD. The actual method which does the conversion takes a CGImageRef and 
the code looks like this

-(void)convert:(CGImageRef)image withBlock:(ImageResizedBlock)callbackBlock
{
dispatch_async( dispatch_get_global_queue( 
DISPATCH_QUEUE_PRIORITY_DEFAULT, 0 ), ^{
CGImageRef converted = [ self createConvertedImage:image ];
callbackBlock( converted );
CGImageRelease( converted );
} );
};

I quickly found that whereas NSObject(s) are retained by the block, 
CoreFoundation objects don't appear to be, so image can be, and usually is, 
released before the block runs, causing an exception. 

One way to fix this is to add a CFImageRetain() before the dispatch_async() and 
a CFImageRelease() inside the block at the same place converted is released, 
which works, but I for some reason don't like, probably because the retain is 
outside the block and the release is inside it and it seems odd to me. 

After a bit of googling I came across some posts which explained Block_Copy() 
would treat a variable adorned with __attribute__((NSObject)) similarly to 
NSObjects and retain them. So changing the method signature to this 

-(void)convert:(__attribute__((NSObject))CGImageRef)image 
withBlock:(ImageResizedBlock)callbackBlock

appears to do the right thing in my testing, the CGImageRef is CFRetain()ed 
when the block is enqueued and I assume CFRelease()d later. I prefer this 
syntax, as I find it self-documenting;

I can't find anywhere apart from blog posts and the block specification itself 
which says this works. Does anyone know if it's officially supported, for gcc 
and clang and something that apple is likely to support going forward into ARC 
etc. ___

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

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

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

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


Re: Asynchronous downloading and parsing of XML

2011-08-09 Thread Mikkel Islay
On 8 Aug 2011, at 19:44, Jens Alfke wrote:

 It’s clearly a SAX parser. SAX parsers are incremental, that’s their whole 
 point, otherwise it would be easier just to use a DOM API like NSXMLDocument.

The docs implies that it is (related to it):
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/XMLParsing/Articles/ParserArchitecture.html#//apple_ref/doc/uid/20002263-BCIHAHJE
Does that imply anything, inherently, about whether the class blocks the main 
thread?

Mikkel___

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

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

Help/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: Asynchronous downloading and parsing of XML

2011-08-09 Thread Mikkel Islay

On 8 Aug 2011, at 19:20, Thomas Davie wrote:

 All of this is asynchronous, so everything works happily :)

Sure, we have established that your solution works, so far so good.
What I am trying to get at is whether there is some design-pattern implied in 
the docs for the class which should alert me to the behaviour that it will not 
block the main-thread.
An alternative solution to yours, might be batching NSData-objects as they are 
delivered by NSURLConnection and sending NSXMLParser off on a dispatch queue, 
so the main thread is not blocked. 

Mikkel

___

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

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

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

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


Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Devraj Mukherjee
Hi all,

I am writing an API client for a REST service, parts of the REST API
returns fixed String values. E.g. status of an order.

I want to represents these fixed responses as constants. I have
represented fixed numeric values using enums and used a typedef to
represent the data type.

Are Strings defined using #define good enough as String constants?

Or Should I be doing this another way?

Thanks for your time.
___

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

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

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

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


Frameworks (ConnectionKit)

2011-08-09 Thread Amy Heavey

Hi,

I'd  like to be able to use my mac app to upload an image to a server.  
From googling it seems the best way to achieve this is using the  
ConnectionKit framework to upload it via FTP.


I've downloaded the framework, but Im at a loss, the examples  
included don't build, and looking at the hillegass book there should  
be a .framework file for me to link to but I can't find one. I also  
can't find any documentation about how to use this. Can anyone point  
me in the right direction? Either for using ConnectionKit or how else  
to simply ftp a file to a server?


Many Thanks

Amy Heavey
Willow Tree Crafts
www.willowtreecrafts.co.uk



___

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

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

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

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


Re: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Vyacheslav Karamov

Don't forget about @:

#define MY_FUNNY_STR @Ha-ha-ha!


09-Aug-11 13:47, Devraj Mukherjee пишет:

Hi all,

I am writing an API client for a REST service, parts of the REST API
returns fixed String values. E.g. status of an order.

I want to represents these fixed responses as constants. I have
represented fixed numeric values using enums and used a typedef to
represent the data type.

Are Strings defined using #define good enough as String constants?

Or Should I be doing this another way?

Thanks for your time.
___

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

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

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

This email sent to ubuntul...@yandex.ru




___

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

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

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

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


Lingering windows

2011-08-09 Thread Shane Stanley
I have a document-based application that uses garbage collection. It's 
straight-forward in terms of having subclasses of NSDocument, NSWindow, and 
NSWindowController, and documents have a single window (with drawer, if that 
makes any difference).

But when I close a window/document, the window gets orderedOut, so it never 
closes. I can, for example, use the scripting interface after a document has 
been closed and make its window visible again.

When I close I see performClose: being called, windowShouldClose: being called 
on the delegate (the window controller), then close on the window, followed by 
windowWillClose: on the delegate, and then orderOut on the window.

Any thoughts/suggestions?

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

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

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

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

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


Re: help with this error

2011-08-09 Thread Rick C.
The error is appearing in Lion but only on one specific Mac and one specific 
user.  Other users are fine and other Macs are fine.  There is something 
specific to the system in this case and it's the minority I'm sure, but still 
trying to figure out what it is...


On Aug 9, 2011, at 8:19 AM, Sean McBride wrote:

 On Tue, 9 Aug 2011 08:14:15 +0800, Rick C. said:
 
 Yes the error is coming apparently when it tries to move a file which
 needs an administrator password.  Thing is a panel is presented asking
 for permission and even if you just cancel it this error doesn't
 appear.  And this is not something new meaning this project has been ran
 on many machines before without this error (to my knowledge).  So I'm
 just trying to figure out what can be causing the error when I have
 never experienced it before.  How else could I go about troubleshooting
 this?  Thanks!
 
 Is this error new in Lion?  There were many permission changes there.  Have 
 you tried with a non-admin user?
 
 --
 
 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: Know when text is edited in any app

2011-08-09 Thread Mike Abdullah
Forget any notion of doing this for NSTextView I'd advise; Safari and Mail are 
based around WebViews.

On 8 Aug 2011, at 19:47, Joshua Garnham wrote:

 
 I need to know when text is entered (or anything relating to a delegate 
 method happens) in any NSTextView in the active app whether it's my app, 
 TextEdit or Safari. Similar to this app here (http://pilotmoon.com/popclip/).
 
 
 I'm not sure how exactly to go about this and the only thing I have thought 
 of so far is becoming a service but I'm not sure if it's the right way to go 
 about it and even so where I'd go from there.
 
 
 Thanks.
 
 
 Josh
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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: NSCoding to/from JSON?

2011-08-09 Thread Mike Abdullah
I toyed with doing something very similar for plists that might be of interest:

https://github.com/mikeabdullah/KSPropertyListEncoder

On 8 Aug 2011, at 17:56, Jens Alfke wrote:

 Been thinking about archiving NSObjects to/from JSON, using an API similar to 
 NSCoding. I haven’t found any prior art, but I thought I’d ask here.
 
 I am not talking about serializing JSON to/from collection objects a la 
 TouchJSON, JSONKit, etc.; rather, something that lets you convert your custom 
 model objects into JSON and back. And I want it to be clean JSON, so that you 
 can use this API to unarchive JSON created by any of the zillions of web APIs 
 that generate it.
 
 It’s tempting to try to do this using the existing NSArchiving protocol and 
 writing a custom NSKeyed[Un]Archiver subclass. This doesn’t work, at least 
 for my purposes, because JSON has a limited set of data types and I don’t 
 want to clutter up the output with extra type annotations. For example, say 
 the JSON contains a date. JSON doesn’t have a date type, so the convention is 
 to represent the date as a string in ISO-8661 format. But calling 
 -decodeObjectForKey: will return an NSString instead of an NSDate. To get 
 around this you have to add methods like -decodeDateForKey: that make it more 
 clear what you’re expecting. (The same goes for other common value classes 
 like NSData.)
 
 —Jens___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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


CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
I am having a problem with rendering text on a CALayer.
AFAIK, it works just fine with all users ... except one, where the text just 
does not show!

This is my code for printing the text:

@interface TextLayerDelegate : NSObject
{
// ...
}
- (void) drawLayer: (CALayer *) theLayer inContext: (CGContextRef) theContext;
@end

@implementation TextLayerDelegate

- (void) drawLayer: (CALayer *) theLayer inContext: (CGContextRef) ctxt
{
// ...
const char * str = [mesg cStringUsingEncoding: NSMacOSRomanStringEncoding]; 
// encoding must match with CGContextSelectFont() below
if ( str  strlen(str) )
{
CGContextSetShouldAntialias( ctxt, TRUE );
CGContextSetRGBFillColor( ctxt, 1.0, 1.0, 1.0, 1.0 );
CGContextSelectFont( ctxt, AndaleMono, 14, kCGEncodingMacRoman ); // 
Andale Mono doesn't work either
CGColorRef blue = CGColorCreateGenericRGB( 0.0, 0.0, 1.0, 1.0 );
CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
CGContextShowTextAtPoint( ctxt, theLayer.bounds.origin.x + 7.0, 
theLayer.bounds.origin.y + 7.0, str, strlen(str) );
CFRelease( blue );
}
}


I have checked that 'str' does actually hold a valid string at the user's 
instance. (I logged it and had him send me the log file.)
I have also tried different font sizes.
I have also googled around.
All to no avail.


Does anybody have an idea what else might be wrong?

Thanks a lot in advance.
Gab.



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: Frameworks (ConnectionKit)

2011-08-09 Thread Mike Abdullah
Why have you picked FTP?

On 9 Aug 2011, at 12:04, Amy Heavey wrote:

 Hi,
 
 I'd  like to be able to use my mac app to upload an image to a server. From 
 googling it seems the best way to achieve this is using the ConnectionKit 
 framework to upload it via FTP.
 
 I've downloaded the framework, but Im at a loss, the examples included don't 
 build, and looking at the hillegass book there should be a .framework file 
 for me to link to but I can't find one. I also can't find any documentation 
 about how to use this. Can anyone point me in the right direction? Either for 
 using ConnectionKit or how else to simply ftp a file to a server?
 
 Many Thanks
 
 Amy Heavey
 Willow Tree Crafts
 www.willowtreecrafts.co.uk
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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: Know when text is edited in any app

2011-08-09 Thread Joshua Garnham
 I'm not so bothered about Safari/Mail, I just used Safari as an example of 
what I wanted to do. I'd rather focus on doing it with NSTextView as that is 
what the majority of text editing apps use. 

I have - since I first asked the question - been using the Accessibility API's 
to find out information about a text view(s) in other apps, however my main 
target is to have access to the NSTextView's delegate methods specifically 
'textView:didCheckTextInRange:types:options:results:orthography:wordCount:' to 
find out when auto-complete occurs.

Whether or not this next step is possible, I am not sure.

Josh 


On Tuesday, 9 August 2011 at 13:40, Mike Abdullah wrote:

 Forget any notion of doing this for NSTextView I'd advise; Safari and Mail 
 are based around WebViews.
 
 On 8 Aug 2011, at 19:47, Joshua Garnham wrote:
 
  
  I need to know when text is entered (or anything relating to a delegate 
  method happens) in any NSTextView in the active app whether it's my app, 
  TextEdit or Safari. Similar to this app here 
  (http://pilotmoon.com/popclip/).
  
  
  I'm not sure how exactly to go about this and the only thing I have thought 
  of so far is becoming a service but I'm not sure if it's the right way to 
  go about it and even so where I'd go from there.
  
  
  Thanks.
  
  
  Josh
  
  
  
  ___
  
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com 
  (mailto:Cocoa-dev@lists.apple.com))
  
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com 
  (http://lists.apple.com)
  
  Help/Unsubscribe/Update your Subscription:
  http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
  
  This email sent to cocoa...@mikeabdullah.net 
  (mailto:cocoa...@mikeabdullah.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: Know when text is edited in any app

2011-08-09 Thread Mike Abdullah
It is not possible this way. You should not inject your code willy-nilly into 
other apps.

On 9 Aug 2011, at 13:48, Joshua Garnham wrote:

 I'm not so bothered about Safari/Mail, I just used Safari as an example of 
 what I wanted to do. I'd rather focus on doing it with NSTextView as that is 
 what the majority of text editing apps use.
 
 I have - since I first asked the question - been using the Accessibility 
 API's to find out information about a text view(s) in other apps, however my 
 main target is to have access to the NSTextView's delegate methods 
 specifically 
 'textView:didCheckTextInRange:types:options:results:orthography:wordCount:' 
 to find out when auto-complete occurs.
 
 Whether or not this next step is possible, I am not sure.
 
 Josh
 On Tuesday, 9 August 2011 at 13:40, Mike Abdullah wrote:
 
 Forget any notion of doing this for NSTextView I'd advise; Safari and Mail 
 are based around WebViews.
 
 On 8 Aug 2011, at 19:47, Joshua Garnham wrote:
 
 
 I need to know when text is entered (or anything relating to a delegate 
 method happens) in any NSTextView in the active app whether it's my app, 
 TextEdit or Safari. Similar to this app here 
 (http://pilotmoon.com/popclip/).
 
 
 I'm not sure how exactly to go about this and the only thing I have thought 
 of so far is becoming a service but I'm not sure if it's the right way to 
 go about it and even so where I'd go from there.
 
 
 Thanks.
 
 
 Josh
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Jerry Krinock

On 2011 Aug 09, at 03:47, Devraj Mukherjee wrote:

 Are Strings defined using #define good enough as String constants?

It will work, but is considered to be bad form, I think because it could bloat 
your code some trivial amount by having a constant defined multiple times, if 
the compiler does not recognize and combine them during optimization.  Or maybe 
just because THIS_LOOKS_UGLY.

 Or Should I be doing this another way?

This is how it's usually done:

In a .m, .c or .cpp file,

NSString* const constEntityNameLog = @Log_entity ;

and if you need to use this constant in other files, add, in the counterpart 
header file,

extern NSString* const constEntityNameLog ;


___

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

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

Help/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: Know when text is edited in any app

2011-08-09 Thread Joshua Garnham
 I wouldn't be doing it 'willy-nilly', I would only do it if necessary and the 
code would serve only one sole purpose. However, you are correct in saying that 
it does not seem that it is possible the way I have been hoping to do it and so 
I will have to try and find some other way. 


On Tuesday, 9 August 2011 at 13:55, Mike Abdullah wrote:

 It is not possible this way. You should not inject your code willy-nilly into 
 other apps.
 
 On 9 Aug 2011, at 13:48, Joshua Garnham wrote:
   I'm not so bothered about Safari/Mail, I just used Safari as an example of 
  what I wanted to do. I'd rather focus on doing it with NSTextView as that 
  is what the majority of text editing apps use. 
  
  I have - since I first asked the question - been using the Accessibility 
  API's to find out information about a text view(s) in other apps, however 
  my main target is to have access to the NSTextView's delegate methods 
  specifically 
  'textView:didCheckTextInRange:types:options:results:orthography:wordCount:' 
  to find out when auto-complete occurs.
  
  Whether or not this next step is possible, I am not sure.
  
  Josh 
  
  On Tuesday, 9 August 2011 at 13:40, Mike Abdullah wrote:
  
   Forget any notion of doing this for NSTextView I'd advise; Safari and 
   Mail are based around WebViews.
   
   On 8 Aug 2011, at 19:47, Joshua Garnham wrote:
   

I need to know when text is entered (or anything relating to a delegate 
method happens) in any NSTextView in the active app whether it's my 
app, TextEdit or Safari. Similar to this app here 
(http://pilotmoon.com/popclip/).


I'm not sure how exactly to go about this and the only thing I have 
thought of so far is becoming a service but I'm not sure if it's the 
right way to go about it and even so where I'd go from there.


Thanks.


Josh



___

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

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

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

This email sent to cocoa...@mikeabdullah.net 
(mailto:cocoa...@mikeabdullah.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: NSCoding to/from JSON?

2011-08-09 Thread jonat...@mugginsoft.com


On 8 Aug 2011, at 17:56, Jens Alfke wrote:

 Been thinking about archiving NSObjects to/from JSON, using an API similar to 
 NSCoding. I haven’t found any prior art, but I thought I’d ask here.
 
 I am not talking about serializing JSON to/from collection objects a la 
 TouchJSON, JSONKit, etc.; rather, something that lets you convert your custom 
 model objects into JSON and back. And I want it to be clean JSON, so that you 
 can use this API to unarchive JSON created by any of the zillions of web APIs 
 that generate it.
 
 It’s tempting to try to do this using the existing NSArchiving protocol and 
 writing a custom NSKeyed[Un]Archiver subclass. This doesn’t work, at least 
 for my purposes, because JSON has a limited set of data types and I don’t 
 want to clutter up the output with extra type annotations. For example, say 
 the JSON contains a date. JSON doesn’t have a date type, so the convention is 
 to represent the date as a string in ISO-8661 format. But calling 
 -decodeObjectForKey: will return an NSString instead of an NSDate. To get 
 around this you have to add methods like -decodeDateForKey: that make it more 
 clear what you’re expecting. (The same goes for other common value classes 
 like NSData.)
 
 

Have you thought about using YAML?
JSON is a strict subset of YAML.

http://yaml.org/spec/1.2/spec.html#id2759572

There are a number of bindings available.

Regards

Jonathan Mitchell

Developer
Mugginsoft LLP
http://www.mugginsoft.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: Frameworks (ConnectionKit)

2011-08-09 Thread Amy Gibbs
It seemed the easiest way of uploading  a file to the server?



Regards

Willow Tree Crafts
Www.willowtreecrafts.co.uk

On 9 Aug 2011, at 13:46, Mike Abdullah cocoa...@mikeabdullah.net wrote:

 Why have you picked FTP?
 
 On 9 Aug 2011, at 12:04, Amy Heavey wrote:
 
 Hi,
 
 I'd  like to be able to use my mac app to upload an image to a server. From 
 googling it seems the best way to achieve this is using the ConnectionKit 
 framework to upload it via FTP.
 
 I've downloaded the framework, but Im at a loss, the examples included 
 don't build, and looking at the hillegass book there should be a .framework 
 file for me to link to but I can't find one. I also can't find any 
 documentation about how to use this. Can anyone point me in the right 
 direction? Either for using ConnectionKit or how else to simply ftp a file 
 to a server?
 
 Many Thanks
 
 Amy Heavey
 Willow Tree Crafts
 www.willowtreecrafts.co.uk
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk
___

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

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

Help/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: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox

On 09/08/2011, at 10:43 PM, Gabriel Zachmann wrote:

 I have checked that 'str' does actually hold a valid string at the user's 
 instance. (I logged it and had him send me the log file.)
 I have also tried different font sizes.
 I have also googled around.
 All to no avail.
 
 
 Does anybody have an idea what else might be wrong?


I've found the Core Graphics text handling methods to be gnarly and awkward the 
few times I've attempted to use them, and always ended up going some other 
route to render text.

In your case, the choice seems simple - just use CATextLayer. Why not?

--Graham


___

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

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

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

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


Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox

On 09/08/2011, at 10:43 PM, Gabriel Zachmann wrote:

 I have checked that 'str' does actually hold a valid string at the user's 
 instance. (I logged it and had him send me the log file.)

CGContextSelectFont( ctxt, AndaleMono, 14, kCGEncodingMacRoman ); // 
 Andale Mono doesn't work either


Perhaps he doesn't have Andale Mono on his machine? I'm not sure what CG does 
with text if the font isn't there, does it fall back to something else or just 
silently fail? Maybe the fallback font is too big for the space and it isn't 
rendered as a result?

I think the way your code assumes this font is going to be there is a bit flaky.

But anyway, CATextLayer takes all this pain away for you.

--Graham


___

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

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

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

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


Re: Frameworks (ConnectionKit)

2011-08-09 Thread Mike Abdullah
My point is that you're not constrained to it.

ConnectionKit is almost certainly overkill for this. If you're determined to 
use FTP, check out CFWriteStreamCreateWithFTPURL(). In general, I'd advise a 
WebDAV-like system fed by NSURLConnection is best.

On 9 Aug 2011, at 14:15, Amy Gibbs wrote:

 It seemed the easiest way of uploading  a file to the server?
 
 
 
 Regards
 
 Willow Tree Crafts
 Www.willowtreecrafts.co.uk
 
 On 9 Aug 2011, at 13:46, Mike Abdullah cocoa...@mikeabdullah.net wrote:
 
 Why have you picked FTP?
 
 On 9 Aug 2011, at 12:04, Amy Heavey wrote:
 
 Hi,
 
 I'd  like to be able to use my mac app to upload an image to a server. From 
 googling it seems the best way to achieve this is using the ConnectionKit 
 framework to upload it via FTP.
 
 I've downloaded the framework, but Im at a loss, the examples included 
 don't build, and looking at the hillegass book there should be a .framework 
 file for me to link to but I can't find one. I also can't find any 
 documentation about how to use this. Can anyone point me in the right 
 direction? Either for using ConnectionKit or how else to simply ftp a file 
 to a server?
 
 Many Thanks
 
 Amy Heavey
 Willow Tree Crafts
 www.willowtreecrafts.co.uk
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.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/home%40willowtreecrafts.co.uk
 
 This email sent to h...@willowtreecrafts.co.uk

___

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

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

Help/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: Telling Auto Save, No, I'm busy now

2011-08-09 Thread Jerry Krinock

On 2011 Aug 08, at 09:29, Kevin Perry wrote:

 You may be able to work around this problem by overriding 
 -autosaveWithImplicitCancellability:completionHandler: instead (also?) and 
 doing the same approach of delaying NSDocument's code until once you've 
 completed the background work.

Thank you, Kevin.  That seems to work; at least, it has worked for a day.

As usual when dealing with NSDocument, the answer is to override as high as 
possible.

I just submitted Document Feedback suggesting that this document

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Documents/Articles/ObjectInteractions.html

get another excellent diagram like the others in there, showing how Autosave In 
Place works.  We would have gotten here faster!

Jerry


Here's the revised code for anyone else playing with customized autosave.  Now 
simpler and safer, because we're only dealing with autosave…

/*!
 @briefOverride of new autosave method invoked by Cocoa
 when running in Mac OS X 10.7 or later.
 */
- 
(void)autosaveWithImplicitCancellability:(BOOL)autosavingIsImplicitlyCancellable
 completionHandler:(void (^)(NSError 
*errorOrNil))completionHandler {
if ([self dataModelChangesAreNowInProgressOrWhatever]) {
if (autosavingIsImplicitlyCancellable) {
completionHandler([NSError errorWithDomain:NSCocoaErrorDomain
  code:NSUserCancelledError
  userInfo:nil]) ;
return ;
}
}

snip
Insert code here to queue an operation or block to be run when other
tasks changing the data model are completed.  If not a using modern
block-handling method, you may need Block_copy(completionHandler).
/snip
}


/*!
 @briefReal autosaving method, invoked when operation or block is dequeued.
 */
- (void)reallyAutosaveWithCompletionHandler:(void (^)(NSError 
*errorOrNil))completionHandler {
[super autosaveWithImplicitCancellability:NO
completionHandler:completionHandler] ;
// If you did Block_copy(), …
Block_release(completionHandler) ;
}



___

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

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

Help/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: Lingering windows

2011-08-09 Thread Jerry Krinock

On 2011 Aug 09, at 05:24, Shane Stanley wrote:

 Any thoughts/suggestions?

See if -dealloc is running in your NSDocument subclass.  Probably not.  In that 
case, it's you're whole document that's lingering, not just the window.

Never used garbage collection, so someone else will need to help out here…

___

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

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

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

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


Re: [Lion] IBOutlets, strong or weak?

2011-08-09 Thread Marc Respass
Thanks a lot Josh and Sean. I never remember to read the release notes but I 
just went through AppKit's. I'm going back to the straight iVar style for Mac 
OS X for now. I was putting them all in the class continuation category anyway 
since they shouldn't be exposed externally.

Marc

On Aug 8, 2011, at 5:40 PM, Josh Abernathy wrote:

 According to the AppKit release notes:
 
 Note that Xcode 4.2 defaults to ARC when creating new projects, and in the 
 WWDC seed release, as well as in the latest version available at the time 
 10.7 ships, generates outlet declarations that are strong. This is true for 
 outlets generated in new projects as well as when adding new outlet 
 declarations from Interface Builder. In most cases these should be changed to 
 weak (zeroing or not) to avoid cycles that may cause leaks.
 
 
 On Aug 8, 2011, at 5:21 PM, Sean McBride wrote:
 
 On Fri, 5 Aug 2011 15:11:25 -0400, Marc Respass said:
 
 With Xcode 4, I can drag from a control to the header and Xcode will
 create an outlet and a property. I noticed that Xcode creates a property
 like this
 
 @property (strong) IBOutlet NSTextField *someField;
 
 But I have other code where it is defined weak -- I started this project
 on an earlier build of Xcode . The strong and weak are new ARC types
 replacing retain and assign (if I remember correctly) and I thought that
 NSWindowController and NSViewController retain their top level objects
 so in 10.6 if I wanted to do this, I would make the property assign.
 Should I be using strong as Xcode seems to think now or weak as
 Xcode used to think?
 
 I haven't tried ARC, but according to WWDC11 video session 101 at 47:00, 
 delegates and outlets should be weak.
 
 --
 
 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/joshaber%40gmail.com
 
 This email sent to josha...@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: Frameworks (ConnectionKit)

2011-08-09 Thread Amy Gibbs
I'm certainly noy tied to FTP, and I'll have a go with  
NSURLConnection. I did try to use that for another part but I just  
couldn't get it to work. Is there a particular sample/tutorial you  
could recommend?


In the following code, accessing the URL  in a webView works, but the  
NSURLConnection doesn't;

[code]

NSURL *uploadURL = [[NSURL alloc] initWithString:escapedUrl];
		NSMutableURLRequest* post = [NSMutableURLRequest requestWithURL:  
uploadURL];
		//NSURLConnection *connect = [NSURLConnection initWithRequest:post   
delegate:self startImmediately:@YES];

NSLog (@uploadurl is: %@, uploadURL);


		[[uploadWeb mainFrame] loadRequest:[NSURLRequest  
requestWithURL:uploadURL]];


[/code]

On 9 Aug 2011, at 2:32PM, Mike Abdullah wrote:


My point is that you're not constrained to it.

ConnectionKit is almost certainly overkill for this. If you're  
determined to use FTP, check out CFWriteStreamCreateWithFTPURL(). In  
general, I'd advise a WebDAV-like system fed by NSURLConnection is  
best.


On 9 Aug 2011, at 14:15, Amy Gibbs wrote:


It seemed the easiest way of uploading  a file to the server?



Regards

Willow Tree Crafts
Www.willowtreecrafts.co.uk

On 9 Aug 2011, at 13:46, Mike Abdullah cocoa...@mikeabdullah.net  
wrote:



Why have you picked FTP?

On 9 Aug 2011, at 12:04, Amy Heavey wrote:


Hi,

I'd  like to be able to use my mac app to upload an image to a  
server. From googling it seems the best way to achieve this is  
using the ConnectionKit framework to upload it via FTP.


I've downloaded the framework, but Im at a loss, the examples  
included don't build, and looking at the hillegass book there  
should be a .framework file for me to link to but I can't find  
one. I also can't find any documentation about how to use this.  
Can anyone point me in the right direction? Either for using  
ConnectionKit or how else to simply ftp a file to a server?


Many Thanks

Amy Heavey
Willow Tree Crafts
www.willowtreecrafts.co.uk



___

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

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

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

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

This email sent to cocoa...@mikeabdullah.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/home%40willowtreecrafts.co.uk

This email sent to h...@willowtreecrafts.co.uk




___

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

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

Help/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: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
Thanks a lot for your response ...

 I've found the Core Graphics text handling methods to be gnarly and awkward 
 the few times I've attempted to use them, and always ended up going some 
 other route to render text.

Could you please point me to a few of them?

 
 In your case, the choice seems simple - just use CATextLayer. Why not?

Can CATextLayer render text with a shadow?
Like this:
  CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );

I really need the shadow to be able to discern it from a background layer, the 
color of which is unknown and changes fairly often.

Best regards,
Gabriel.



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: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox

On 10/08/2011, at 12:48 AM, Gabriel Zachmann wrote:

 Could you please point me to a few of them?

NSString, NSAttributedString, Core Text


 Can CATextLayer render text with a shadow?
 Like this:
  CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
 
 I really need the shadow to be able to discern it from a background layer, 
 the color of which is unknown and changes fairly often.


Yes. It inherits from CALayer, so it has all of its properties, including all 
the shadow properties.

--Graham___

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

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

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

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


Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread glenn andreas

On Aug 9, 2011, at 9:48 AM, Gabriel Zachmann wrote:

 Thanks a lot for your response ...
 
 I've found the Core Graphics text handling methods to be gnarly and awkward 
 the few times I've attempted to use them, and always ended up going some 
 other route to render text.
 
 Could you please point me to a few of them?
 
 
 In your case, the choice seems simple - just use CATextLayer. Why not?
 
 Can CATextLayer render text with a shadow?
 Like this:
  CGContextSetShadowWithColor( ctxt, CGSizeMake(0,0), 10, blue );
 
 I really need the shadow to be able to discern it from a background layer, 
 the color of which is unknown and changes fairly often.


CATextLayer is a subclass of CALayer, which has a wide variety of shadowing 
options:

/** Shadow properties. **/

/* The color of the shadow. Defaults to opaque black. Colors created
 * from patterns are currently NOT supported. Animatable. */

@property CGColorRef shadowColor;

/* The opacity of the shadow. Defaults to 0. Specifying a value outside the
 * [0,1] range will give undefined results. Animatable. */

@property float shadowOpacity;

/* The shadow offset. Defaults to (0, -3). Animatable. */

@property CGSize shadowOffset;

/* The blur radius used to create the shadow. Defaults to 3. Animatable. */

@property CGFloat shadowRadius;

/* When non-null this path defines the outline used to construct the
 * layer's shadow instead of using the layer's composited alpha
 * channel. The path is rendered using the non-zero winding rule.
 * Specifying the path explicitly using this property will usually
 * improve rendering performance, as will sharing the same path
 * reference across multiple layers. Defaults to null. Animatable. */

@property CGPathRef shadowPath;



So not only does it have a shadow that you can change, you can even animate the 
shadow.

Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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

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

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

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


Re: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Ken Thomases
On Aug 9, 2011, at 7:58 AM, Jerry Krinock wrote:

 This is how it's usually done:
 
 In a .m, .c or .cpp file,
 
 NSString* const constEntityNameLog = @Log_entity ;
 
 and if you need to use this constant in other files, add, in the counterpart 
 header file,
 
 extern NSString* const constEntityNameLog ;

If you don't need to use it in other files, define it as a static.

static NSString* const constEntityNameLog = @Log_entity ;

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


Scanning images

2011-08-09 Thread Eric Matecki

Hello,

I need to scan images into my app.
Which technology should I use, it has to work from 10.5.x upwards, PPC and 
Intel, 32 and 64 bits.

I know only of ICA.
Is there something better (ICA dates back to 10.2) ?

Thanks.

--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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

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

Help/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: Frameworks (ConnectionKit)

2011-08-09 Thread Thomas Wetmore
The startImmediately parameter is a BOOL, not a string. Use YES instead of 
@YES and see if that helps.

Tom W.

On Aug 9, 2011, at 10:44 AM, Amy Gibbs wrote:

 I'm certainly noy tied to FTP, and I'll have a go with NSURLConnection. I did 
 try to use that for another part but I just couldn't get it to work. Is there 
 a particular sample/tutorial you could recommend?
 
 In the following code, accessing the URL  in a webView works, but the 
 NSURLConnection doesn't;
 [code]
 
 NSURL *uploadURL = [[NSURL alloc] initWithString:escapedUrl];
   NSMutableURLRequest* post = [NSMutableURLRequest 
 requestWithURL: uploadURL];
   //NSURLConnection *connect = [NSURLConnection 
 initWithRequest:post  delegate:self startImmediately:@YES];
   NSLog (@uploadurl is: %@, uploadURL);
 
   
   [[uploadWeb mainFrame] loadRequest:[NSURLRequest 
 requestWithURL:uploadURL]];
 
 [/code]

___

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

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

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

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


Hide Quicktime logo when using MPMoviePlayerController to play audio

2011-08-09 Thread John Love
Reference my  iOS TabController app...

Apple docs state that the AVAudioPlayer class does not provide support for 
streaming audio based on HTTP URL's. AVAudioPlayer plays only music embedded in 
the iApp.

Given that, I do use MPMoviePlayerController to play these web stored audio/mp3 
files which it can handle.

This definitely works. I start out with a UIView with the lyrics for the song. 
At the very bottom of this lyrics UIView is a Play button. The user taps this 
button and the audio/mp3 plays; however, the audio/QuickTime (( Q )) graphic 
comes to the foreground and the lyrics disappear and will stay away until the 
user taps Done.

What I want to happen is that the audio/mp3 is played, but the lyrics stay in 
front.

BTW, I really don't think I need the Done button to be seen because the user 
can stop the audio by simply selecting another Tab.

Obviously this coming to the foreground for the AV Quicktime graphic makes 
sense because the MPMoviePlayerController object is primarily designed to play 
video and the video ought to come to the front. Therefore, it is consistent in 
that the Quicktime graphic also comes to the foreground.

BUT, I really do need a way to defeat the audio/QuickTime (( Q )) graphic 
coming to the front and keep the lyrics there.

I did insert code to determine if it was an audio file (mp3), versus a video 
file (mp4).  So far so good ... and then if it was an audio file, within my 
actual playing segment, I have:


if ( NSClassFromString(@MPMoviePlayerViewController) )
{
if (!isAudioFile)
{
[senderViewController
 
presentMoviePlayerViewControllerAnimated:moviePlayerViewController_];
}
}

[moviePlayerController_ play];


It actually works, that is, I actually hear the mp3 in the background, with the 
lyrics staying in front and the audio/QuickTime (( Q )) graphic does not show …

**BUT, what does happen is horrible, that is, the Done button shows over the 
lyrics** I talked about with some sort of unknown ??? letters there.  The 
gibberish that appears looks line the Done label for the UIButton 
superimposed on which is the time remaining to finish the song.

FWIW, I really don't think I need a Done button because as soon as I go to 
another tab, either new music or a video, the music initially playing stops and 
the new AV file starts.  If I press the Home button, the music stops playing, 
so I think I can get along without the Done button being around.

Any ideas to cover over the Done button ?? ... because right now I don't have a 
clue what to do.


John Love
Touch the Future! Teach!



___

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

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

Help/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: Scanning images

2011-08-09 Thread Eric Matecki

Hi Tom,

Yes I'm talking about scanner devices.
But I don't have to support versions EARLIER than 10.5, but from 10.5 to 10.7.

So is it twain or ICA ?
Which one should have the longest life ?

Thanks.

Tom Hohensee wrote:

If you are talking getting images from scanner device. You need TWAIN for 
versions earlier than 10.5

Sent from my iPhone

On Aug 9, 2011, at 10:14 AM, Eric Matecki eml...@wanadoo.fr wrote:


Hello,

I need to scan images into my app.
Which technology should I use, it has to work from 10.5.x upwards, PPC and 
Intel, 32 and 64 bits.

I know only of ICA.
Is there something better (ICA dates back to 10.2) ?

Thanks.

--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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

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

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

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





--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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

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

Help/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: Scanning images

2011-08-09 Thread Nick Zitzmann

On Aug 9, 2011, at 9:42 AM, Eric Matecki wrote:

 Hi Tom,
 
 Yes I'm talking about scanner devices.
 But I don't have to support versions EARLIER than 10.5, but from 10.5 to 10.7.
 
 So is it twain or ICA ?

In our SOHO Notes product, we use:
* IKScannerDeviceView if the user is using Snow Leopard or later,
* ICA if the user is using Leopard, and
* TWAIN if the user has no devices attached that are supported by Image 
Capture, but still wants to scan.

There is nothing newer than ICA on Leopard. Don't use ICA under Snow Leopard; 
due to a regression it crashes after its window is closed. Besides, 
IKScannerDeviceView is far better than ICA. And TWAIN is the option of absolute 
last resort, and doesn't work correctly in 64-bit apps anyway because most 
TWAIN drivers are 32-bit only.

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

___

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

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

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

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


Re: Scanning images

2011-08-09 Thread Robert Tillyard
Hello, Eric,

I thought that the machines I'm running it on were a range of 10.5 and 10.6 but 
it looks like I'm probably mistaken there. Sorry.

Regards, Rob.

On 9 Aug 2011, at 16:54, Eric Matecki wrote:

 Hi Robert,
 
 I just downloaded it, but the Build (and Runtime) Requirements are Mac OS X 
 10.6 or later.
 
 I still tried to compile it, and ImageCaptureCore.Framework doesn't exists on 
 10.5.8
 
 How did you get it to work on 10.5 ?
 
 Thanks.
 
 Robert Tillyard wrote:
 Hello, Eric,
 Take a look at the Scanner Bowser example code, I'm using that on 10.5 and 
 10.6 I assume it will work on PPC.
 Regards, Rob.
 On 9 Aug 2011, at 16:14, Eric Matecki wrote:
 Hello,
 
 I need to scan images into my app.
 Which technology should I use, it has to work from 10.5.x upwards, PPC and 
 Intel, 32 and 64 bits.
 
 I know only of ICA.
 Is there something better (ICA dates back to 10.2) ?
 
 Thanks.
 
 -- 
 Keep intel OUTSIDE my Mac !
 Hiii !!! I can see Intel chips creeping around my G5 !
 
 Eric M.
 
 
 -- 
 Keep intel OUTSIDE my Mac !
 Hiii !!! I can see Intel chips creeping around my G5 !
 
 Eric M.
___

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

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

Help/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: Scanning images

2011-08-09 Thread Eric Matecki

Hi Nick,

I will try this tomorrow.
Probably won't use twain, if the device isn't supported by ImageKit nor ICA, 
just too bad.

Thanks.

Nick Zitzmann wrote:

On Aug 9, 2011, at 9:42 AM, Eric Matecki wrote:


Hi Tom,

Yes I'm talking about scanner devices.
But I don't have to support versions EARLIER than 10.5, but from 10.5 to 10.7.

So is it twain or ICA ?


In our SOHO Notes product, we use:
* IKScannerDeviceView if the user is using Snow Leopard or later,
* ICA if the user is using Leopard, and
* TWAIN if the user has no devices attached that are supported by Image 
Capture, but still wants to scan.

There is nothing newer than ICA on Leopard. Don't use ICA under Snow Leopard; 
due to a regression it crashes after its window is closed. Besides, 
IKScannerDeviceView is far better than ICA. And TWAIN is the option of absolute 
last resort, and doesn't work correctly in 64-bit apps anyway because most 
TWAIN drivers are 32-bit only.

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





--
Keep intel OUTSIDE my Mac !
Hiii !!! I can see Intel chips creeping around my G5 !

Eric M.
___

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

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

Help/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: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Gabriel Zachmann
CGContextSelectFont( ctxt, AndaleMono, 14, kCGEncodingMacRoman ); 
 // Andale Mono doesn't work either
 
 Perhaps he doesn't have Andale Mono on his machine? I'm not sure what CG 
 does with text if the font isn't there, does it fall back to something else 
 or just silently fail?
 I think the way your code assumes this font is going to be there is a bit 
 flaky.

I didn't find an easy way to check whether a font is installed - do you know 
how to do it?

 But anyway, CATextLayer takes all this pain away for you.

Just checked the doc of CATextLayer but couldn't find a hint on how it helps me 
determine whether or not a font is installed ... can you tell me?

Best regards,
Gabriel.



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


Verify my Understanding

2011-08-09 Thread koko
I think I get it re: printing but would like some verification of my 
understanding.

When printing, the printing context coordinate system is measured in points (pt 
= 1/72 inch).

When getting paper size it is returned in points.

The printing context is device independent.

So, to print an exact size bitmap of mine I just need to convert its dimensions 
to points.  So if my bitmap is measured in tenths of a millimeter I set its 
rect to be drawn in to (bitmap width * 72/254) and (bit map height * 72/254).

Yes?

-koko
___

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

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

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

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


Re: Scanning images

2011-08-09 Thread Tom Hohensee
Ikscannerdevice  (part if image kit) and its related classes is the
new method going forward. There is a drop in IB solution. Double check
10.5 compatibility. Really easy.

Sent from my iPhone

On Aug 9, 2011, at 10:43 AM, Eric Matecki eml...@wanadoo.fr wrote:

 Hi Tom,

 Yes I'm talking about scanner devices.
 But I don't have to support versions EARLIER than 10.5, but from 10.5 to 10.7.

 So is it twain or ICA ?
 Which one should have the longest life ?

 Thanks.

 Tom Hohensee wrote:
 If you are talking getting images from scanner device. You need TWAIN for 
 versions earlier than 10.5
 Sent from my iPhone
 On Aug 9, 2011, at 10:14 AM, Eric Matecki eml...@wanadoo.fr wrote:
 Hello,

 I need to scan images into my app.
 Which technology should I use, it has to work from 10.5.x upwards, PPC and 
 Intel, 32 and 64 bits.

 I know only of ICA.
 Is there something better (ICA dates back to 10.2) ?

 Thanks.

 --
 Keep intel OUTSIDE my Mac !
 Hiii !!! I can see Intel chips creeping around my G5 !

 Eric M.
 ___

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

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

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

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


 --
 Keep intel OUTSIDE my Mac !
 Hiii !!! I can see Intel chips creeping around my G5 !

 Eric M.
 ___

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

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

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

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


NSLog() without the timestamp?

2011-08-09 Thread William Squires
Is there a function like NSLog() that doesn't print the timestamp (and other 
crap) and doesn't automatically append a '\n' at the end? If not, what would be 
the best way to implement such a function. Trouble is, printf() doesn't 
understand the %@ specifier, so that approach would be a PITA.

Sent from my whizz-bang iPad___

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

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

Help/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: NSLog() without the timestamp?

2011-08-09 Thread Dave DeLong
Try something like this:

http://cocoaheads.byu.edu/wiki/different-nslog

Cheers,

Dave

On Aug 9, 2011, at 9:30 AM, William Squires wrote:

 Is there a function like NSLog() that doesn't print the timestamp (and other 
 crap) and doesn't automatically append a '\n' at the end? If not, what would 
 be the best way to implement such a function. Trouble is, printf() doesn't 
 understand the %@ specifier, so that approach would be a PITA.
 
 Sent from my whizz-bang iPad
___

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

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

Help/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: NSCoding to/from JSON?

2011-08-09 Thread Jens Alfke

On Aug 9, 2011, at 6:10 AM, jonat...@mugginsoft.com wrote:

 Have you thought about using YAML?

YAML is nice, but this is for CouchDB, which is already strongly based on JSON.

—Jens



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: Frameworks (ConnectionKit)

2011-08-09 Thread Jens Alfke

On Aug 9, 2011, at 7:44 AM, Amy Gibbs wrote:

 NSURL *uploadURL = [[NSURL alloc] initWithString:escapedUrl];
 NSMutableURLRequest* post = [NSMutableURLRequest requestWithURL: uploadURL];

If you want to upload anything, you want to send a PUT or POST request, but the 
default is a GET; sou need to set the HTTPMethod property. You also need to 
provide the data you want to upload, by setting the HTTPBody property.

 //NSURLConnection *connect = [NSURLConnection initWithRequest:post  
 delegate:self startImmediately:@YES”];

As Thomas said, the last parameter is a boolean. The compiler gave you an error 
message about the type being wrong for that parameter (and depending on which 
compiler, told you that it expected a boolean. That should have been a clue not 
to put an NSString there.

Also, this is going to send the request asynchronously. That means you’ll need 
to set a delegate, and implement the necessary delegate methods, otherwise you 
won’t get any information on the progress of the operation.

Have you read the Apple overview docs on using NSURLConnection? They describe 
all this in detail including plenty of examples.

—Jens

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: NSLog() without the timestamp?

2011-08-09 Thread Jens Alfke

On Aug 9, 2011, at 9:30 AM, William Squires wrote:

 Is there a function like NSLog() that doesn't print the timestamp (and other 
 crap) and doesn't automatically append a '\n' at the end? If not, what would 
 be the best way to implement such a function. Trouble is, printf() doesn't 
 understand the %@ specifier, so that approach would be a PITA.

fputs(stderr, [[NSString stringWithFormat: @“The count is %u”, count] 
UTF8String]);

Wrap that in a function if you don’t want to type it every time :)

(Even if you go with something else, make sure it writes to stderr not stout. 
Stdout gets buffered, so it’s much less useful for logging.)

—Jens

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: Frameworks (ConnectionKit)

2011-08-09 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/9/11 6:15 AM, Amy Gibbs wrote:
 It seemed the easiest way of uploading  a file to the server?

In addition to what others have mentioned, it is worth pointing out that
FTP is a notoriously insecure protocol (or at least lends itself to
security vulnerabilities).

It doesn't support encryption out of the box, so you would have to deal
with the added headache (larger or smaller, depending on implementation)
of tunneling through an encrypted pipe or using a later variant of FTP
that supports encryption but then requires support by both client and
server.

Like most vendors I've seen, Apple implicitly discourages the use of
FTP.  Quoting page 201 of the Snow Leopard Security Configuration guide:

Avoid using this protocol to share sensitive data. If you must use this
protocol, encrypt your data using a secure encrypted image.

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOQWbHaOlrz5+0JdURAn4RAJ9oHZVCLmqwcv7nNShZggzNGtVDFQCfVF/e
Rny+npzOo8j55OPj6Ql1Q3E=
=UbbC
-END PGP 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: Subclassing UIWebview a show-stopper?

2011-08-09 Thread David Duncan
On Aug 8, 2011, at 10:51 PM, arri wrote:

 After allot of writing test-cases, and googling for others' experiences, i 
 found that the most easy and straightforward way of achieving what i want, is 
 to simply subcass UIWebView and override UIViews' - hitTest:withEvent method. 
 However, as everyone emphasize everywhere i look, the docs say i should not 
 subclass UIWebView.

There are a /lot/ of gotchas with UIWebView, so much so that even things that 
you might consider as an innocent override can have impact that you would not 
expect. If there were two ways to do something, and one involved subclassing 
UIWebView and the other did not, I would nearly always choose the method that 
didn't involved subclassing.

So the question to you becomes what problem are you trying to solve that you 
believe you need to override -hitTest:withEvent:?
--
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: Scanning images

2011-08-09 Thread Scott Ribe
On Aug 9, 2011, at 9:14 AM, Eric Matecki wrote:

 Which technology should I use, it has to work from 10.5.x upwards, PPC and 
 Intel, 32 and 64 bits.

Well, TWAIN is not currently supported for 64-bit, and it's not clear that it 
ever will be.

-- 
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: blocks and retaining CoreFoundation objects

2011-08-09 Thread David Duncan
On Aug 8, 2011, at 11:43 PM, Roland King wrote:

 After a bit of googling I came across some posts which explained Block_Copy() 
 would treat a variable adorned with __attribute__((NSObject)) similarly to 
 NSObjects and retain them. So changing the method signature to this 
 
   -(void)convert:(__attribute__((NSObject))CGImageRef)image 
 withBlock:(ImageResizedBlock)callbackBlock
 
 appears to do the right thing in my testing, the CGImageRef is CFRetain()ed 
 when the block is enqueued and I assume CFRelease()d later. I prefer this 
 syntax, as I find it self-documenting;
 
 I can't find anywhere apart from blog posts and the block specification 
 itself which says this works. Does anyone know if it's officially supported, 
 for gcc and clang and something that apple is likely to support going forward 
 into ARC

The ARC specification defines a retainable pointer as including those 
pointers that have the __attribute__((NSObject)) decoration, so this should 
behave as expected under ARC. 
http://clang.llvm.org/docs/AutomaticReferenceCounting.html#objects
--
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: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Gregory Weston
Devraj Mukherjee wrote:

 I am writing an API client for a REST service, parts of the REST API
 returns fixed String values. E.g. status of an order.
 
 I want to represents these fixed responses as constants. I have
 represented fixed numeric values using enums and used a typedef to
 represent the data type.
 
 Are Strings defined using #define good enough as String constants?
 
 Or Should I be doing this another way?
 
 Thanks for your time.

I'm still generally in favor of named constants over pre-processor 
substitution. Gives you types and no worry about parentheses.
___

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

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

Help/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: Decimation - NSBezierPath or something else?

2011-08-09 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 8/8/11 5:49 PM, Graham Cox wrote:
 I can tell you that 25,000 points in a bezier path will make for
 slow drawing, though it also depends on your hardware of course.
 

Lo and behold, when I went from 7500 points (which rendered instantly)
to 25000 the main thread blocked.

I did not expect the drawing would slow so dramatically with a mere 3.3
fold increase in plotted points, so I stand corrected.

I appreciate your drawing my attention to this matter as it is something
I will certainly keep in mind as I work on my application; I will have
to spend some more time benchmarking this and optimizing later on.

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOQWpJaOlrz5+0JdURAv/5AJwIYHgyXJcvHAcA1d7Y+9ZCBJGvmQCgh1OP
WkCsY92OHvgD4y4fNb9lwQs=
=XIor
-END PGP 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: NSCoding to/from JSON?

2011-08-09 Thread Sean McBride
On Mon, 8 Aug 2011 09:56:07 -0700, Jens Alfke said:

Been thinking about archiving NSObjects to/from JSON, using an API
similar to NSCoding. I haven’t found any prior art, but I thought I’d
ask here.

Lion has NSJSONSerialization:

http://developer.apple.com/library/mac/#documentation/Foundation/Reference/NSJSONSerialization_Class/Reference/Reference.html

-- 

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: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Chris Hanson
On Aug 9, 2011, at 3:47 AM, Devraj Mukherjee wrote:

 I am writing an API client for a REST service, parts of the REST API
 returns fixed String values. E.g. status of an order.
 
 I want to represents these fixed responses as constants. I have
 represented fixed numeric values using enums and used a typedef to
 represent the data type.
 
 Are Strings defined using #define good enough as String constants?
 
 Or Should I be doing this another way?

When working with a framework like Cocoa, I'd follow its lead.

In this case, that's to define global constant NSString pointers:

  // --- in MWSService.h
  
  /*! Default endpoint URL for MWSService. */
  MWS_EXPORT NSString * const MWSServiceDefaultEndpointURL;

  // --- in MWSService.m
  
  NSString * const MWSServiceDefaultEndpointURL = 
@http://www.example.com/endpoint;;

The macro MWS_EXPORT should be the typical extern without C++ name mangling 
macro:

  #if defined(__cplusplus)
  #define MWS_EXPORT extern C
  #else
  #define MWS_EXPORT extern

This is needed because if you compile some of your code as Objective-C and 
other as Objective-C++, without the C part of 'extern C' your global can 
wind up with C++ name mangling.

The NSString * const means the pointer is constant, so the optimizer can 
assume it's unchanging.  That'll be the case because you'll wind up with only 
one copy of the string in your built product (whether it's a library or 
executable).

That won't necessarily be the case for a #define - if you used a #define in a 
framework header, and built an OS X app that embeds the framework, you'd 
actually have separate copies of the string in the app and the framework.  (And 
-isEqual: implementations are generally smart about immediately returning YES 
when passed self, but falling back when not.)

In short: Do like Apple, use an NSString * const global.

  -- Chris

___

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

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

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

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


Re: Using #define a good way for String constants, like enums for NSIntegers?

2011-08-09 Thread Chris Hanson
On Aug 9, 2011, at 10:10 AM, Gregory Weston wrote:

 I'm still generally in favor of named constants over pre-processor 
 substitution. Gives you types and no worry about parentheses.

You can also use the global constant in the debugger (including in command 
completion) because it has a symbol it can look up.  That helps cut down on 
typos when investigating bugs.

  -- Chris

___

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

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

Help/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: Lingering windows

2011-08-09 Thread Quincey Morris
On Aug 9, 2011, at 05:24 , Shane Stanley wrote:

 I have a document-based application that uses garbage collection. It's 
 straight-forward in terms of having subclasses of NSDocument, NSWindow, and 
 NSWindowController, and documents have a single window (with drawer, if that 
 makes any difference).
 
 But when I close a window/document, the window gets orderedOut, so it never 
 closes. I can, for example, use the scripting interface after a document has 
 been closed and make its window visible again.
 
 When I close I see performClose: being called, windowShouldClose: being 
 called on the delegate (the window controller), then close on the window, 
 followed by windowWillClose: on the delegate, and then orderOut on the window.

It's not entirely clear what it is you're expecting here.

AFAICT -- and I have spent some time pondering the documentation and APIs on 
this -- there really *isn't* anything that you could call closing a window 
other than the sequence you describe above. Again AFAICT, window closing and 
ordering-out are indistinguishable, for all practical purposes at least.

The only difference that might happen at close time, which you'd normally want 
for a document window, is that the window might get released. (In GC terms, 
there might be no strong references and so the NIB objects can get garbage 
collected.) That's where things can get a little murky, because there are 
sometimes unexpected strong references.

The most obvious cause of this kind of lingering is the NIB mechanism itself. 
Normally, top level objects in a NIB receive an extra retain when loaded (have 
an extra strong reference, in the GC case). For windows specifically, there is 
a checkbox in IB that says release when closed. For a document window, you 
should check this box so that (presumably) when the window is closed the extra 
strong reference is discarded.

I suspect this is the cause of your window's lingering. If that's not it, then 
use the debugger's 'info gc-roots' command (having set a breakpoint somewhere 
after the window has been closed and the collector has had time to run, 
preferably) to find out what's keeping the window 
alive.___

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

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

Help/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: NSCoding to/from JSON?

2011-08-09 Thread Jens Alfke

On Aug 9, 2011, at 10:45 AM, Sean McBride wrote:

 Lion has NSJSONSerialization:

I know, and I already use it. Not the same thing, though: in my original 
message I wrote I am not talking about serializing JSON to/from collection 
objects a la TouchJSON, JSONKit, etc.;”.

—Jens

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


IKImageBrowserView

2011-08-09 Thread koko
I have implemented

- (void) imageBrowser:(IKImageBrowserView *) view removeItemsAtIndexes: 
(NSIndexSet *) indexes 

and 

- (BOOL) imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: 
(NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex 

They are in the same file.  removeItemsAtIndexes is called as expected.

moveItemsAtIndexes is not called when I select images in the view and drag.

I have seen questions on this being encountered by others but no solution.

any help would be appreciated.

-koko___

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

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

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

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


Re: IKImageBrowserView

2011-08-09 Thread Tom Hohensee
How are you handling the drag operation?

Sent from my iPhone

On Aug 9, 2011, at 2:49 PM, koko k...@highrolls.net wrote:

 I have implemented

 - (void) imageBrowser:(IKImageBrowserView *) view removeItemsAtIndexes: 
 (NSIndexSet *) indexes

 and

 - (BOOL) imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: 
 (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex

 They are in the same file.  removeItemsAtIndexes is called as expected.

 moveItemsAtIndexes is not called when I select images in the view and drag.

 I have seen questions on this being encountered by others but no solution.

 any help would be appreciated.

 -koko___

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

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

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

 This email sent to tom.hohen...@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: Frameworks (ConnectionKit)

2011-08-09 Thread Leo

You can use libcurl:

http://curl.haxx.se/

Extremely powerful library, which is a part of Mac OS X, that supports 
most protocols (FTP, SFTP, HTTP etc.) I find it very easy to use - but  
I've been using it for years in either its command line (curl) or 
library implementation.


There's also excellent Open Source polkit:

http://code.google.com/p/polkit/

which is partially based on libcurl and Mac OS X frameworks and supports 
even more protocols, such as Amazon S3, AFP and SMB.


I remember trying the ConnectionKit, and whatever I tried it just didn't 
work.


Leo

On 8/9/11 7:04:08 AM, Amy Heavey wrote:

Hi,

I'd  like to be able to use my mac app to upload an image to a server. 
From googling it seems the best way to achieve this is using the 
ConnectionKit framework to upload it via FTP.


I've downloaded the framework, but Im at a loss, the examples 
included don't build, and looking at the hillegass book there should 
be a .framework file for me to link to but I can't find one. I also 
can't find any documentation about how to use this. Can anyone point 
me in the right direction? Either for using ConnectionKit or how else 
to simply ftp a file to a server?


Many Thanks

Amy Heavey
Willow Tree Crafts
www.willowtreecrafts.co.uk



___

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

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

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

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

2011-08-09 Thread koko
I just saw another Apple example that showed dragging implementations required, 
this was not in the first example I saw.

So I am doing the dragging stuff.

Thanks.

-koko

On Aug 9, 2011, at 3:07 PM, Tom Hohensee wrote:

 How are you handling the drag operation?
 
 Sent from my iPhone
 
 On Aug 9, 2011, at 2:49 PM, koko k...@highrolls.net wrote:
 
 I have implemented
 
 - (void) imageBrowser:(IKImageBrowserView *) view removeItemsAtIndexes: 
 (NSIndexSet *) indexes
 
 and
 
 - (BOOL) imageBrowser:(IKImageBrowserView *) aBrowser moveItemsAtIndexes: 
 (NSIndexSet *)indexes toIndex:(NSUInteger)destinationIndex
 
 They are in the same file.  removeItemsAtIndexes is called as expected.
 
 moveItemsAtIndexes is not called when I select images in the view and drag.
 
 I have seen questions on this being encountered by others but no solution.
 
 any help would be appreciated.
 
 -koko___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/tom.hohensee%40gmail.com
 
 This email sent to tom.hohen...@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: Frameworks (ConnectionKit)

2011-08-09 Thread Mike Abdullah

On 9 Aug 2011, at 21:36, Leo wrote:

 You can use libcurl:
 
 http://curl.haxx.se/
 
 Extremely powerful library, which is a part of Mac OS X, that supports most 
 protocols (FTP, SFTP, HTTP etc.) I find it very easy to use - but  I've been 
 using it for years in either its command line (curl) or library 
 implementation.
 
 There's also excellent Open Source polkit:
 
 http://code.google.com/p/polkit/
 
 which is partially based on libcurl and Mac OS X frameworks and supports even 
 more protocols, such as Amazon S3, AFP and SMB.

Bear in mind PolKit is GPL, unless the author gives you permission otherwise.

___

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

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

Help/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: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 9, 2011, at 11:50 PM, Jerry Krinock wrote:

 See if -dealloc is running in your NSDocument subclass.  Probably not.  In 
 that case, it's you're whole document that's lingering, not just the window.

Dealloc isn't called with GC, and the document isn't lingering -- it's just the 
window.

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

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

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

Help/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: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 10, 2011, at 3:51 AM, Quincey Morris wrote:

 It's not entirely clear what it is you're expecting here.

What I'm expecting is that when I close a document, the document, the window 
controller and the window will disappear. 
 
 AFAICT -- and I have spent some time pondering the documentation and APIs on 
 this -- there really *isn't* anything that you could call closing a window 
 other than the sequence you describe above. Again AFAICT, window closing and 
 ordering-out are indistinguishable, for all practical purposes at least.

I only noticed the problem from the scripting interface. Let's say I have two 
documents open: the (pretty standard) scripting interface shows two documents 
and two windows. If I close the documents, it shows no documents but still two 
windows -- which I can make reappear by setting their isVisible property.
 
 The only difference that might happen at close time, which you'd normally 
 want for a document window, is that the window might get released. (In GC 
 terms, there might be no strong references and so the NIB objects can get 
 garbage collected.) That's where things can get a little murky, because there 
 are sometimes unexpected strong references.
 
 The most obvious cause of this kind of lingering is the NIB mechanism itself. 
 Normally, top level objects in a NIB receive an extra retain when loaded 
 (have an extra strong reference, in the GC case). For windows specifically, 
 there is a checkbox in IB that says release when closed. For a document 
 window, you should check this box so that (presumably) when the window is 
 closed the extra strong reference is discarded.

I have Release when closed checked, but the docs say: Release when closed, 
however, is ignored for windows owned by window controllers.

Elsewhere it says:

The general behavior is as follows:

• When the last window of a document is closed, the document is also closed. 
The window, window controller, and document are all released. I'm trying to 
understand what might stop that from happening.
 
 If that's not it, then use the debugger's 'info gc-roots' command (having set 
 a breakpoint somewhere after the window has been closed and the collector has 
 had time to run, preferably) to find out what's keeping the window alive.

Thanks for the suggestion.

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

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

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

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

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


[SOLVED] Re: CoreData I/O error for database: no such table

2011-08-09 Thread Nick Zitzmann

On Aug 8, 2011, at 4:35 AM, Nick Shore wrote:

 I was in fact using existing databases - actually the update I'm working on 
 has a migration involved in it too. I didn't mention it originally as I'd 
 ruled it out as the cause, but that actually helped fix the problem. Since I 
 was already migrating the data (with custom entity migration policies) it was 
 trivial to rename the relationships at the same time. And that worked - the 
 migration can read the existing database and it fixed my issue when 
 attempting to read the new one.

And that turned out to be the solution. I was already working on a new data 
model at the time, so I turned it on and made a mapping model, and the migrator 
created a database that doesn't generate any I/O errors when the app tries to 
access the object with the many-to-many relationship.

The really strange part is, I did not rename the many-to-many relationship 
between database versions, and in the migrated database, the many-to-many table 
is not called Z_16PARENTS as I expected would happen after the migration. But 
I guess I shouldn't complain.

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

___

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

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

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

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


Re: NSLog() without the timestamp?

2011-08-09 Thread William Squires
Thanks, this is the sort of thing I'm looking for, but is one of those cases of 
if you don't know the right thing to ask for, you can't Google it... In this 
case, the 'right thing' is QuietLog. :)

On Aug 9, 2011, at 11:31 AM, Dave DeLong wrote:

 Try something like this:
 
 http://cocoaheads.byu.edu/wiki/different-nslog
 
 Cheers,
 
 Dave
 
 On Aug 9, 2011, at 9:30 AM, William Squires wrote:
 
 Is there a function like NSLog() that doesn't print the timestamp (and other 
 crap) and doesn't automatically append a '\n' at the end? If not, what would 
 be the best way to implement such a function. Trouble is, printf() doesn't 
 understand the %@ specifier, so that approach would be a PITA.
 
 Sent from my whizz-bang iPad

___

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

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

Help/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: NSLog() without the timestamp?

2011-08-09 Thread Klaus Backert


On 10 Aug 2011, at 02:29, William Squires wrote:

Thanks, this is the sort of thing I'm looking for, but is one of  
those cases of if you don't know the right thing to ask for, you  
can't Google it... In this case, the 'right thing' is QuietLog. :)


Try Google with NSLog without timestamp -- straightforward the  
right thing to ask for.


Cheers

Klaus

___

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

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

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

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


Re: CGContextShowTextAtPoint doesn't show text

2011-08-09 Thread Graham Cox

On 10/08/2011, at 2:06 AM, Gabriel Zachmann wrote:

 Just checked the doc of CATextLayer but couldn't find a hint on how it helps 
 me determine whether or not a font is installed ... can you tell me?


I doesn't. But it falls back gracefully, AFAIK.

If you need a specific non-standard font, you can bundle it with your app to 
ensure its present.

--Graham


___

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

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

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

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


Re: Frameworks (ConnectionKit)

2011-08-09 Thread Leo

On 8/9/11 6:28:54 PM, Mike Abdullah wrote:

Bear in mind PolKit is GPL, unless the author gives you permission otherwise.
Yeah actually I had to mention this but it didn't look like the original 
question referred to a commercial product.


___

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

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

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

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


NSTableView: move rows through drag and drop?

2011-08-09 Thread Izak van Langevelde
I implemented drag and drop in an NSTableView by writing the row indexes of the 
rows to be copied/moved to the pasteboard, which works.

Now I want to allow drag and drop from one document to another, and my first 
guess was to write the row data to the pasteboard.
What puzzles me, is how to delete the row data from the source data, in case of 
a move. That is, my acceptDrop inserts the row data into the destination data 
source, but the indexes of the source rows are not available at this point. Of 
course, I can add row numbers to the row data on the pasteboard, but this is a 
bit double. What is the standard approach to this?
---
Grinnikend door het leven...

___

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

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

Help/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: Lion's new Resume feature, document restoration, and splash screens

2011-08-09 Thread Dave Fernandes
I just got back to this problem (after watching the WWDC11 Resume and Automatic 
Termination video). I added an additional override and license check in:

-[NSDocumentController 
reopenDocumentForURL:withContentsOfURL:display:completionHandler:]

And now my modal window displays before the restored document is opened.
Hope this helps with your case.

Dave

On 2011-07-27, at 8:11 PM, Sean McBride wrote:

 On Jul 27, 2011, at 19:39, Dave Fernandes wrote:
 
 License agreements are still a necessity. This seems to be what the OP is 
 asking about, and not simply a marketing splash screen.
 
 Thanks for the on-topic reply!  (Sad that even though I anticipated the 
 'don't do that comments', they still came.)
 
 I used to put this check in my document controller's 
 openUntitledDocumentAndDisplay:error: and 
 openDocumentWithContentsOfURL:display:error: methods. Unfortunately, these 
 methods are not called for restored windows.
 
 Indeed.  I used to do something similar (don't recall exactly, the code is at 
 work).
 
 So I take it you are in the same boat?
 
 Perhaps the open AppleEvents themselves could be intercepted, queued, and 
 processed later... any other ideas?
 
 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: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 10, 2011, at 3:51 AM, Quincey Morris wrote:

 use the debugger's 'info gc-roots' command (having set a breakpoint somewhere 
 after the window has been closed and the collector has had time to run, 
 preferably) to find out what's keeping the window alive.

So I get this:

info gc-roots 0x4011fcca0
Number of roots: 7
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe288  Frame level: 1  
Symbol: unknown
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe248  Frame level: 0  
Symbol: self
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe238  Frame level: 0  
Symbol: it
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe278  Frame level: 1  
Symbol: unknown
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe308  Frame level: 3  
Symbol: unknown
   1 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   2 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
Root:
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe260  Frame level: 0  
Symbol: unknown
   1 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   2 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow

Anything useful there?

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

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

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

Help/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: Lingering windows

2011-08-09 Thread Quincey Morris
On Aug 9, 2011, at 21:33 , Shane Stanley wrote:

 info gc-roots 0x4011fcca0
 Number of roots: 7
 Root: #1
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe288  Frame level: 1  
 Symbol: unknown
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #2
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe248  Frame level: 0  
 Symbol: self
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #3
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe238  Frame level: 0  
 Symbol: it
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #4
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe278  Frame level: 1  
 Symbol: unknown
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #5
   0 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   1 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #6
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe308  Frame level: 3  
 Symbol: unknown
   1 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   2 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow
 Root: #7
   0 Kind: stack   rc:   0  Address: 0x7fff5fbfe260  Frame level: 0  
 Symbol: unknown
   1 Kind: bytes   rc:   1  Address: 0x000400efa2e0
   2 Kind: object  rc:   0  Address: 0x0004011fcca0  Class: MyWindow

(I annotated the above with numbers on the roots.)

Starting at the bottom, the last 3 show strong references to the window from 
object 0x000400efa2e0. *That* object is being kept alive by 2 stack 
references (#6 and #7), but it's a root reference in itself. I wouldn't be 
surprised if this is the window controller.

You don't happen to have a singleton pattern of some kind for the window's 
window controller? I mean something like [MyWindowController 
sharedWindowController]. The simplest implementation of that pattern doesn't 
ever release the singleton.

The first 4 roots are all stack references directly to the window.

The next step is to try getting the debugger to tell you the class of the 
referencing objects -- 'po [0x000400efa2e0 class]', etc.

Note that the only root that *isn't* a stack variable is #5, so that's the one 
I would be suspicious of. (After all, at a certain point, you'd expect all the 
stack frames that might have a variable referring to a window to be popped by 
the time you get back to the main event loop, so stack references shouldn't 
really be what's keeping this alive, unless a reference to the window has 
migrated up to a stack frame above the main event loop.)

If you get nowhere useful with the debugger, you can try following up in 
Instruments (Allocations and Leaks). If a window gets leaked for every document 
you open (but isn't detected by Instruments as a leak), then the quickest way 
to get a picture of what's going on is to use heapshot analysis:


http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/


___

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

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

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

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


Cocoaheads Lake Forest Meeting tomorrow, Wed. Aug. 9

2011-08-09 Thread Scott Ellsworth
CocoaHeads Lake Forest will be meeting on the second Wednesday of the month.

Please join us TONIGHT from 7pm to 9pm on Wednesday, 8/9.  We will be
meeting at the Orange County Public Library (El Toro) community room,
24672 Raymond Way, Lake Forest, CA 92630

Greetings, all,

We will be walking through some of the new changes to document based
applications in Lion, plus upcoming changes in the Mac/iOS world.

As always, details and the upcoming meeting calendar can be found at
the cocoaheads web site, www.cocoaheads.org.
___

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

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

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

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


Correction: Cocoaheads Lake Forest Meeting tomorrow, Wed. Aug. 10

2011-08-09 Thread Scott Ellsworth
Date corrected:

CocoaHeads Lake Forest will be meeting on the second Wednesday of the month.

Please join us TOMORROW from 7pm to 9pm on Wednesday, 8/10.  We will
be meeting at the Orange County Public Library (El Toro) community
room, 24672 Raymond Way, Lake Forest, CA 92630

Greetings, all,

We will be walking through some of the new changes to document based
applications in Lion, plus upcoming changes in the Mac/iOS world.

As always, details and the upcoming meeting calendar can be found at
the cocoaheads web site, www.cocoaheads.org.
___

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

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

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

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


Re: Menu Item Key Equivalent

2011-08-09 Thread Leo

On 8/5/11 4:43:06 AM, Uli Kusterer wrote:

On 05.08.2011, at 08:49, Jens Alfke wrote:

Photoshop has always used letter keys as commands to select tools, and most 
other image editors on Mac follow suit, like Pixelmator and (I think) Acorn. 
I’m not sure if these show up in menus, though, although that seems like a good 
idea, as it makes them more discoverable.

  Just make sure you don't do it like Pixelmator: Every time I habitually try 
to tab from one text field to the next, all my palettes just vanish. The first 
few times this happened, I thought Pixelmator had crashed.


They just copied Photoshop. Although I also think it's a bad idea.

___

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

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

Help/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: Lingering windows

2011-08-09 Thread Shane Stanley
On Aug 10, 2011, at 3:12 PM, Quincey Morris wrote:

 Starting at the bottom, the last 3 show strong references to the window from 
 object 0x000400efa2e0. *That* object is being kept alive by 2 stack 
 references (#6 and #7), but it's a root reference in itself. I wouldn't be 
 surprised if this is the window controller.
 
 You don't happen to have a singleton pattern of some kind for the window's 
 window controller? I mean something like [MyWindowController 
 sharedWindowController]. The simplest implementation of that pattern doesn't 
 ever release the singleton.

In my document class's -makeWindowControllers I'm setting a property to the 
window controller; could that be the problem?

(I'm only subclassing the window to override validateUserInterfaceItem: to stop 
performClose: at certain times.)
 
 The first 4 roots are all stack references directly to the window.

Yep, I realise now they're related to code I put in to get the address.
 
 The next step is to try getting the debugger to tell you the class of the 
 referencing objects -- 'po [0x000400efa2e0 class]', etc.
 
 Note that the only root that *isn't* a stack variable is #5, so that's the 
 one I would be suspicious of. (After all, at a certain point, you'd expect 
 all the stack frames that might have a variable referring to a window to be 
 popped by the time you get back to the main event loop, so stack references 
 shouldn't really be what's keeping this alive, unless a reference to the 
 window has migrated up to a stack frame above the main event loop.)
 
 If you get nowhere useful with the debugger, you can try following up in 
 Instruments (Allocations and Leaks). If a window gets leaked for every 
 document you open (but isn't detected by Instruments as a leak), then the 
 quickest way to get a picture of what's going on is to use heapshot analysis:
 
   
 http://www.friday.com/bbum/2010/10/17/when-is-a-leak-not-a-leak-using-heapshot-analysis-to-find-undesirable-memory-growth/

Thanks for the further ideas. I think ;-)

-- 
Shane Stanley sstan...@myriad-com.com.au
'AppleScriptObjC Explored' www.macosxautomation.com/applescript/apps/

___

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

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

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

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