Re: quick look question

2011-08-18 Thread Julien Jalon
See QLPreviewPanel

http://developer.apple.com/library/mac/#documentation/Quartz/Reference/QLPreviewPanel_Class/Reference/Reference.html

On Wed, Aug 3, 2011 at 6:10 AM, Rick Corteza rickcort...@gmail.com wrote:

 Hi again,

 I double-checked but isn't it that this one is just to create thumbnails?
  Actually running /usr/bin/qlmanage -p is exactly what I'm trying to do
 because I want to display short video clips not just still images.  If only
 it didn't put [DEBUG] in the title bar it would probably be good enough!
  What would be the best approach to doing this because I need it to work on
 10.5?  Thanks!


 On Tue, Aug 2, 2011 at 7:00 PM, jonat...@mugginsoft.com 
 jonat...@mugginsoft.com wrote:

 
  On 2 Aug 2011, at 11:39, Rick C. wrote:
 
   Hi all,
  
   I want to include this feature in my app and the way I want it to work
 is
  if a user selects a file in my table view and clicks a button it will
 open
  that file in a quick look panel just the way it works in Finder.
  Actually
  if there was only a way to trigger that easily like NSWorkspace or
 something
  I'd use it!  Now I need to support 10.5 still and unfortunately I see a
 lot
  of it became formal in 10.6.  But is it possible to achieve what I'm
 looking
  to do?  I have download QuickLook Sketch sample code am I going in the
 right
  direction because I wasn't hoping to make any plugins.  Any pointers
 would
  be great thanks!
  
 
  Checkout NSImage+QuickLook available at http://mattgemmell.com/source.
  This doesn't use the formal 10.6+ API but calls /usr/bin/qlmanage
 instead.
  Works fine on 10.5, 10.6 and 10.7
 
 
  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/rickcorteza%40gmail.com
 
  This email sent to rickcort...@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/jjalon%40gmail.com

 This email sent to jja...@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: Quick Look Preview with Scrollbar

2011-02-17 Thread Julien Jalon
On Sun, Feb 13, 2011 at 5:13 PM, Andrew Madsen
and...@openreelsoftware.comwrote:

 I'm writing a Quick Look Plug-in to generate previews of my application's
 (Core Data) documents. I've got the generator working ok with one problem.
 If the document is large/long, and I return an preview that is say 5000
 pixels high, Quick Look scales the preview image instead of putting it in a
 scroll view, making it impossible to see any detail. Is there some way to
 tell Quick Look to display the preview at its native width, then add a
 vertical scrollbar? For example, when Quick Looking long Microsoft Word or
 Excel documents, the Quick Look panel includes a vertical scrollbar.

 The generator uses QLPreviewRequestCreateContext to get a CGContext, and
 from there an NSGraphicsContext which it then draws into using a custom
 NSView subclass, in a similar manner to Apple's QuickLookSketch example
 code.

 Is generating HTML or multi-page PDF the only way to get a scrolling
 preview?


Yes.

-- 
Julien
___

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

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

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

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


Re: QuickLook returning small image

2011-01-15 Thread Julien Jalon
When requesting a thumbnail, it's up to the underlying plug-in to honor the
requested size.

If icon == NO, Quick Look will return the plug-in's image result as is.

If icon == YES, Quick Look will force the requested size (because it adds
icon decoration which should match the requested size) - so if you request a
512x512 icon, you should always get a 512x512 image.

Many plug-in just use a low-resolution image stored in the file as a Quick
Look thumbnail. It's totally acceptable but nowadays, low-resolution
should be more toward 512x512 than 128x128.

Previews are more complex (generally slower to generate) and are meant to be
displayed mainly in Quick Look panel but they also appear in Cover Flow,
Column view, Info window and, starting with SnowLeopard, in live previews in
Finder's icons.

-- 
Julien

On Thu, Jan 13, 2011 at 10:11 AM, aglee ag...@mac.com wrote:

 On Jan 13, 2011, at 01:06 PM, Kyle Sluder kyle.slu...@gmail.com wrote:
 Taking a while stab here: icon==YES?

 I get the same result (size-wise) whether icon is YES or NO.

 Joar pointed out off-list that Finder might be asking for a *preview*
 rather than a *thumbnail*.  I totally missed that distinction and I bet it's
 the explanation.

 Thanks,
 --Andy


 ___

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

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

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

 This email sent to jja...@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: A Quick Look contribution and a question

2011-01-04 Thread Julien Jalon
Look at Apple provided code sample at:

http://developer.apple.com/library/mac/samplecode/QuickLookDownloader/Introduction/Intro.html

-- 
Julien Jalon

On Monday, January 3, 2011, Brad Stone cocoa-...@softraph.com wrote:
 I'm submitting this code for anyone who needs a quick hack to get Quick Look 
 working.  It's a hack because it's using AppleScript and the Quick Look 
 Server debug and management tool.  If you send an array of paths this will 
 bring them up in a Quick Look window.

 I don't think the Quick Look documentation is as robust as it can be, I'm 
 still trying to figure out how to do the same thing the right way.

 - (void)quickLook:(NSArray *)srcPathArray {

         //build the paths string
         NSString *paths = @;
         for (NSString *thisPath in srcPathArray) {

                 NSString *s = @;
                 if ([paths length] == 0) {
                         s = [NSString stringWithFormat:@(quoted form of 
 (POSIX path of \%...@\)), thisPath];
                 } else {
                         s = [NSString stringWithFormat:@  \ \  (quoted 
 form of (POSIX path of \%...@\)), thisPath];
                 }
                 paths = [paths stringByAppendingString:s];
         }


         NSAppleScript *quickLook = nil;
         // do shell script (qlmanage -p   (quoted form of (POSIX path of 
 srcPath)))
         NSString *command = [NSString stringWithFormat:@do shell script 
 (\qlmanage -p \  %@),paths];
         quickLook = [[NSAppleScript alloc] initWithSource:command];
         [quickLook executeAndReturnError:nil];
 }___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: respondsToSelector warning: may not respond

2010-11-26 Thread Julien Jalon
Z) ignore the warning

On Fri, Nov 26, 2010 at 9:44 PM, Ken Thomases k...@codeweavers.com wrote:

 On Nov 26, 2010, at 12:27 PM, Mike Abdullah wrote:

  C) Typecast the object to a class that is known to implement -setOrdinal:

 D) Typecast the object to id.

 Regards,
 Ken

 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: Designated Initializer

2010-10-30 Thread Julien Jalon
NSWindowController doc states that you should invoke super's initWithWindow:
or initWithWindowNibName:

In your class’s initialization method, be sure to invoke on super either
one of the initWithWindowNibName:... initializers or the initWithWindow:
initializer

This breaks the designated initializer pattern, which is bad (and indeed
initWithWindowNibName: calls [self initWithWindow:]). Not catastrophic
though if you look at the usual usage pattern for NSWindowController.

-- 
Julien

On Sat, Oct 30, 2010 at 10:32 PM, Richard Somers rsomers.li...@infowest.com
 wrote:

 Thanks for the insight.

 If calling any of super's initializers will work from the designated
 initializer, why then does Apple specifically say the designated initializer
 should begin by sending a message to super to invoke the designated
 initializer of its superclass?

 There must be a subtle issue here.

 --Richard Somers


 On Oct 30, 2010, at 1:12 PM, Dave Carrigan wrote:

  So just because a designated initializer didn't call super's designated
 initializer, it doesn't mean that super's designated initialer was not
 invoked; it was.


 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: Why is NSPopUp broken in drop-down mode?

2010-10-01 Thread Julien Jalon
 developers have been able to dictate in other platforms' UIs

Welcome to the modern Mac platform where the frameworks try to ensure
a coherent user experience, especially for basic controls.

-- 
Julien
___

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

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

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

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


Re: Why is NSPopUp broken in drop-down mode?

2010-10-01 Thread Julien Jalon
Let me rephrase: same control should have the same behavior across
applications. Cocoa framework enforce that rule.

Disagreeing with Apple choices about how each control should work is
an other story that I'm not sure is interesting for this list.

If you want to develop for MacOS X, embrace the frameworks and read Apple HIG:

http://developer.apple.com/library/mac/#documentation/UserExperience/Conceptual/AppleHIGuidelines/XHIGIntro/XHIGIntro.html%23//apple_ref/doc/uid/TP3894-TP6

-- 
Julien

On Friday, October 1, 2010, G S stokest...@gmail.com wrote:
 Welcome to the modern Mac platform where the frameworks try to ensure a 
 coherent user experience, especially for basic controls.

 How is this behavior coherent?  As has already been noted, it's
 inconsistent between drop-down lists and combo boxes.  Also, nothing
 indicates to the developer why the data-handling behavior of the
 control has changed simply because he chose an up or down style of
 opening.  That's like changing the behavior of a control because you
 picked a beveled instead of a flat decorative box around it.

 And modern?  You're kidding, right?  The transition to OS X was
 Apple's chance to modernize many things about its UI, and it chose to
 squander that opportunity.

___

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

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

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

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


Re: autorelease: how does this work!? (if at all)

2010-06-18 Thread Julien Jalon
Is the compiler/runtime being clever enough to retain it because it is
going to be needed in the inner block (if so: very clever!)?

Yes, it is very clever.

When creating the block, the ObjC compiler also specifies the Object stored
into the block metadata. When the block is copied (which is done as soon as
you call dispatch_async), the copied block retains these objects.

Note that it only works for blocks and ObjectiveC objects with some
(logical) special cases (ivars, __block).

See:
http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/Blocks/Articles/bxVariables.html

-- 
Julien

On Fri, Jun 18, 2010 at 5:00 PM, Jonny Taylor j.m.tay...@durham.ac.ukwrote:

 I've just been looking back at some code that has been working fine for me
 for a while, and as far as I can see it shouldn't actually work! I'd be
 interested for peoples' comments. The code is as follows:

 dispatch_async(queue1,
 ^{
NSImage *theImage = [frame GetNSImage];
NSData *tiffRep = [theImage TIFFRepresentation];
dispatch_async(queue2,
^{
[tiffRep writeToFile:[NSString stringWithFormat:@
 %...@%d.tif,
[[frame Camera] ExportFilePrefix],
 [frame FrameNumber]]
atomically:YES];
});
[theImage release];
 });

 Work running on serial queue queue1 calculates a TIFF representation for
 an image, and then schedules work on serial queue queue2 to write that
 data to disk. What I can't work out is why tiffrep isn't autoreleased as
 soon as the outer block completes. Is the compiler/runtime being clever
 enough to retain it because it is going to be needed in the inner block (if
 so: very clever!)? If not, am I just getting lucky here with exactly
 when/how grand central does its autorelease cleanup? Or maybe the TIFF
 representation and/or my frame data is still being retained elsewhere for a
 while (possible, depending on how the thread timings work out...).

 I'm pretty new to Cocoa so I'm keen to understand this properly - I'd be
 interested to hear peoples thoughts on this: is what I am doing ok, or do I
 need to add some explicit retain/releasing of tiffRep?

 Cheers
 Jonny___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: autorelease: how does this work!? (if at all)

2010-06-18 Thread Julien Jalon
[theImage release] is really suspicious.

On Friday, June 18, 2010, Jens Alfke j...@mooseyard.com wrote:

 On Jun 18, 2010, at 9:20 AM, Mike Abdullah wrote:

 Aside from your actual question, I urge you to go back and read the Cocoa 
 fundamentals. Your method names are totally wrong,

 I only saw one error: the method name “GetNSImage” should probably be “image” 
 (method names should be lowercase unless they begin with a common acronym 
 like “URL” or “TIFF”, and the prefix “get” is not used.)

 and the memory management guide covers all the details of -autorelease.

 Has it been extended to discuss objects referenced inside blocks? That’s a 
 pretty tricky detail.

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

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


autorelease: how does this work!? (if at all)

2010-06-18 Thread Julien Jalon
Suspicious because it clearly does not follow ObjC coding style for
memory management.

If you have to call release here, it's likely because GetNSImage is
incorrect by returning an object that needs to be released.

If your code happens not to use C++ (or in very localized places), you
should run Build  Analyze (in Build menu) and see the static analyzer
pointing to where your code might clearly be wrong wrt coding style
and memory management.

-- 
Julien

On Friday, June 18, 2010, Jonny Taylor j.m.tay...@durham.ac.uk wrote:
 [theImage release] is really suspicious.
 Suspicious in what way? Are you saying I am using the wrong sort of 
 implementation for my [frame GetNSImage], and I shouldn't be returning 
 something that requires an explicit release? Because I can certainly confirm 
 that in its current state it leaks memory unless I include the release - the 
 function is returning an internally cached NSImage with its reference count 
 incremented by one.
 To be fair the release is in an illogical place - it should immediately 
 follow the call to [theImage TIFFRepresentation], but with the code as 
 currently written, the release is definitely necessary...
___

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

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

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

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


Re: How to Open PPT file in Cocoa Application

2010-06-17 Thread Julien Jalon
You can only use Quick Look through the Preview panel API. Search for
QLPreviewPanel

No preview view is accessible through API so far. File an enhancement request.

-- 
Julien

On Thursday, June 17, 2010, kalpana k kalpana.forum...@gmail.com wrote:
 Hi All,

 I am trying to open a ppt (power point) file in my cocoa application
 (leopard/snow leopard).
 I want to open it in a view inside my application. Open as a slide show view
 (ie: no editing is allowed)
 I don't want to open it as a separate application triggered from my
 application.

 Quicklook opens ppt files, So Can we achieve this using Quick look
 Framework? How to use it?

 Thanks  Regards,
 K.Kalpana
 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

Help/Unsubscribe/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 madness with retain count

2010-04-27 Thread Julien Jalon
ObjectAlloc instrument is your friend. Configure it to record retains
and releases. Much more accurate, much easier to understand what's
going on.

On Tuesday, April 27, 2010, Gary L. Wade garyw...@desisoftsystems.com wrote:
 On 04/27/2010 2:12 PM, Bill Bumgarner b...@mac.com wrote:


 On Apr 27, 2010, at 2:09 PM, Gary L. Wade wrote:

 On 04/27/2010 1:58 PM, Bill Bumgarner b...@mac.com wrote:

 Frankly, the -retainCount method should be deprecated and, eventually,
 removed.

 I wouldn't go THAT far; after all, when you're tracking a memory leak,
 checking your influence on the retain count is important to your
 investigation.  Hopefully that's why the original poster is looking at it.

 The combination of leaks, zombies, heap, and malloc stack logging are much
 *much* more powerful and effective than trying to debug a leak, over-retain 
 or
 under-retain with -retainCount.

 b.bum


 Yes, but how would you use those to determine why an Apple framework now
 chooses to retain a delegate (I'm referring to one particular one I
 discovered), thereby causing a retain cycle?  It's not a memory leak in the
 sense that Instruments or leaks would ever catch it.  Calling -retainCount
 immediately before and after the -setDelegate call is pretty much the only
 way.


 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

Help/Unsubscribe/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 autorelease weirdness

2010-04-19 Thread Julien Jalon
I don't see anything wrong with the output being 1/2:

-(void) test
{
   testString = NULL;

   dispatch_async(dispatch_get_global_queue(0, 0), ^{
   dispatch_async(dispatch_get_main_queue(), ^{

   NSString* aString = [[NSMutableString alloc] init];* //
retain count is 1*
   NSLog(@retainCount: %d,[aString retainCount]);

   testString = [aString retain]; *// retain count is 2*

   [aString *auto*release]; *// retain count is still 2
- object will be released sometimes in the future*

   dispatch_async(dispatch_get_main_queue(), ^{
   NSLog(@retainCount: %d,[testString
retainCount]);* // you can't assume the future release has already been
called*
   });
   });
   });
}

On Mon, Apr 19, 2010 at 11:35 AM, Henk Kampman
henk.kamp...@secondmove.comwrote:

 Have a look at the following code

 -(void) test
 {
testString = NULL;

dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{

NSString* aString = [[NSMutableString alloc] init];
NSLog(@retainCount: %d,[aString retainCount]);

testString = [aString retain];

[aString release];

dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@retainCount: %d,[testString
 retainCount]);
});
});
});
 }

 As expected the output is:

 retainCount: 1
 retainCount: 1

 However when I change [aString release] to [aString autorelease] the output
 shows:

 retainCount: 1
 retainCount: 2

 Why?

 BTW I first noticed this behavior when my application started leaking the
 QTMovie objects I was creating in a block.

 -

 Henk___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

Help/Unsubscribe/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 autorelease weirdness

2010-04-19 Thread Julien Jalon
I have to add that using dispatch_async on main queue within an NSApp will
automatically drain the autorelease pool.

AppKit drains the autorelease pool upon NSEvents dispatch.

On Mon, Apr 19, 2010 at 12:36 PM, Julien Jalon jja...@gmail.com wrote:

 I don't see anything wrong with the output being 1/2:

 -(void) test
 {
testString = NULL;

dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{

NSString* aString = [[NSMutableString alloc] init];
 * // retain count is 1*

NSLog(@retainCount: %d,[aString retainCount]);

testString = [aString retain]; *// retain count is
 2*

[aString *auto*release]; *// retain count is still
 2 - object will be released sometimes in the future*


dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@retainCount: %d,[testString
 retainCount]);* // you can't assume the future release has already been
 called*
});
});
});
 }

 On Mon, Apr 19, 2010 at 11:35 AM, Henk Kampman 
 henk.kamp...@secondmove.com wrote:

 Have a look at the following code

 -(void) test
 {
testString = NULL;

dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{

NSString* aString = [[NSMutableString alloc] init];
NSLog(@retainCount: %d,[aString retainCount]);

testString = [aString retain];

[aString release];

dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@retainCount: %d,[testString
 retainCount]);
});
});
});
 }

 As expected the output is:

 retainCount: 1
 retainCount: 1

 However when I change [aString release] to [aString autorelease] the
 output shows:

 retainCount: 1
 retainCount: 2

 Why?

 BTW I first noticed this behavior when my application started leaking the
 QTMovie objects I was creating in a block.

 -

 Henk___

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

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

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

 This email sent to jja...@gmail.com



___

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

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

Help/Unsubscribe/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 autorelease weirdness

2010-04-19 Thread Julien Jalon
And of course, I need some rest:

On Mon, Apr 19, 2010 at 12:38 PM, Julien Jalon jja...@gmail.com wrote:

 I have to add that *you can't assume* using dispatch_async on main queue
 within an NSApp will automatically drain the autorelease pool.

 AppKit drains the autorelease pool upon NSEvents dispatch.


 On Mon, Apr 19, 2010 at 12:36 PM, Julien Jalon jja...@gmail.com wrote:

 I don't see anything wrong with the output being 1/2:

 -(void) test
 {
testString = NULL;

dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{

NSString* aString = [[NSMutableString alloc] init];
 * // retain count is 1*

NSLog(@retainCount: %d,[aString retainCount]);

testString = [aString retain]; *// retain count is
 2*

[aString *auto*release]; *// retain count is still
 2 - object will be released sometimes in the future*


dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@retainCount: %d,[testString
 retainCount]);* // you can't assume the future release has already been
 called*
});
});
});
 }

 On Mon, Apr 19, 2010 at 11:35 AM, Henk Kampman 
 henk.kamp...@secondmove.com wrote:

 Have a look at the following code

 -(void) test
 {
testString = NULL;

dispatch_async(dispatch_get_global_queue(0, 0), ^{
dispatch_async(dispatch_get_main_queue(), ^{

NSString* aString = [[NSMutableString alloc]
 init];
NSLog(@retainCount: %d,[aString retainCount]);

testString = [aString retain];

[aString release];

dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@retainCount: %d,[testString
 retainCount]);
});
});
});
 }

 As expected the output is:

 retainCount: 1
 retainCount: 1

 However when I change [aString release] to [aString autorelease] the
 output shows:

 retainCount: 1
 retainCount: 2

 Why?

 BTW I first noticed this behavior when my application started leaking the
 QTMovie objects I was creating in a block.

 -

 Henk___

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

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

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

 This email sent to jja...@gmail.com




___

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

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

Help/Unsubscribe/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 IKImageView subclasses not getting called

2010-02-15 Thread Julien Jalon
SnowLeopard introduced a bunch of new public API to make customizing easier:

On the view itself:

- (void) setBackgroundLayer:(CALayer *) aLayer;

- (void) setForegroundLayer:(CALayer *) aLayer;

extern NSString * const IKImageBrowserGroupHeaderLayer; /*
CALayer */

extern NSString * const IKImageBrowserGroupFooterLayer; /*
CALayer */

on the browser cell:

- (CALayer *) layerForType:(NSString *) type;

-- 
Julien

On Mon, Feb 15, 2010 at 5:42 PM, Jens Alfke j...@mooseyard.com wrote:


 On Feb 15, 2010, at 7:18 AM, Ashley Clark wrote:

  For objects that were saved in a NIB file -initWithFrame: is usually not
 what's called to recreate them (there are some exceptions that I don't
 remember off the top of my head). Since NIBs are essentially archives most
 of the views stored within them are recreated via -initWithCoder:

 Right. Setup code for objects from nibs should usually go in -awakeFromNib.

  As for the drawRect: override, it was my understanding that the IK*View
 objects didn't do any of their drawing in drawRect: but instead were done
 via CALayers. I could be misinformed on this point though.

 Right again, basically, although I think they use direct OpenGL for
 drawing. This unfortunately makes it extremely difficult to customize the
 display of these views, since the OpenGL surface covers up any regular
 drawing. I tried pretty hard to extend the image-browser a few years ago and
 eventually gave up.

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

 This email sent to jja...@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: IKImageBrowserView IKImageView subclasses not getting called

2010-02-15 Thread Julien Jalon
And you have an example:

http://devworld.apple.com/mac/library/samplecode/ImageBrowserViewAppearance/index.html

-- 
Julien

On Mon, Feb 15, 2010 at 5:42 PM, Jens Alfke j...@mooseyard.com wrote:


 On Feb 15, 2010, at 7:18 AM, Ashley Clark wrote:

  For objects that were saved in a NIB file -initWithFrame: is usually not
 what's called to recreate them (there are some exceptions that I don't
 remember off the top of my head). Since NIBs are essentially archives most
 of the views stored within them are recreated via -initWithCoder:

 Right. Setup code for objects from nibs should usually go in -awakeFromNib.

  As for the drawRect: override, it was my understanding that the IK*View
 objects didn't do any of their drawing in drawRect: but instead were done
 via CALayers. I could be misinformed on this point though.

 Right again, basically, although I think they use direct OpenGL for
 drawing. This unfortunately makes it extremely difficult to customize the
 display of these views, since the OpenGL surface covers up any regular
 drawing. I tried pretty hard to extend the image-browser a few years ago and
 eventually gave up.

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

 This email sent to jja...@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: Garbage Collection Docs Puzzle

2010-01-25 Thread Julien Jalon

Except -retain is more efficient under GC.

--
Julien from his iPhone

Le 26 janv. 2010 à 00:06, Dave Keck davek...@gmail.com a écrit :


sending myData -self at the end of the method would make a lot
more sense.

___

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

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

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

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


Re: if statement causing 32 Byte leak?

2010-01-10 Thread Julien Jalon
You have Instruments for that (ObjectAlloc instrument or Zombie/leaks  
templates). Also under certain conditions, you have the static analyzer.


--
Julien from his iPhone

Le 10 janv. 2010 à 18:13, Glenn L. Austin gl...@austin-soft.com a  
écrit :



On Jan 10, 2010, at 8:01 AM, Scott Ribe wrote:

Also, an isAutoReleased message would be worthless. At any point in  
time,
you have no idea how many times library routines that you've called  
might

have retained/released/autoreleased, nor should you care.


Actually, it would be nice to have *in a debugging context* since  
trying to track down a pointer that is in the autorelease pool the  
number of times it has been retained when you do a release would be  
very beneficial.  Yes, it would slow things down, but it would sure  
save a lot of time when trying to track down a spurious release!


e.g.

id pObj = [[[ObjectType alloc] init] autorelease];

... do something here that doesn't retain the pObj, maybe return the  
value to a caller...


[pObj release];// -- This should assert in a debug context,  
since it is already in the current autorelease pool.


// [pObj autorelease] should also probably assert, since it is now  
in the current autorelease pool twice...



What I ended up doing is progressively creating NSAutoreleasePools,  
running the code from that routine, then draining that pool until I  
found the culprit.  Oh the joys of working on a large project with  
programmers of varying Cocoa skill levels.


--
Glenn L. Austin, Computer Wizard and Race Car Driver 
http://www.austin-soft.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/jjalon%40gmail.com

This email sent to jja...@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: if statement causing 32 Byte leak?

2010-01-10 Thread Julien Jalon
This is the purpose of the zombie instrument. Once you know what  
object is overreleased, you click on the arrow and voilà, you get the  
list of retain/release/autorelease so you can look where is the extra  
one.


--
Julien from his iPhone

Le 10 janv. 2010 à 19:19, Glenn L. Austin gl...@austin-soft.com a  
écrit :


Zombie told us nothing. The project just didn't crash any more -- it  
only told us that the autoreleased object was a zombie.  Gee, we  
already knew that...

___

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

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

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

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


Re: NSApplicationLoad() can't connect to window server in user logged out.

2009-12-19 Thread Julien Jalon
ImageIO lets you load and save image files (See CGImageSource and
CGImageDestination)
CoreText provides text drawing facilities
CoreGraphics will give you bitmap contexts and compositing.

Of course, the CG API is a little bit more hardcore than AppKit but not that
much.

On Sat, Dec 19, 2009 at 3:13 AM, Mr. Gecko grmrge...@gmail.com wrote:

 Can I do exactly what I'm doing there in that? I also need to place some
 text in there which I have in the full code, just made my code shorter as an
 example.

 On Dec 18, 2009, at 8:07 PM, Julien Jalon wrote:

 NSImage needs a connection to the Window Server in Leopard.

 If you want to do some offscreen headless rendering, use CoreGraphics +
 ImageIO

 On Sat, Dec 19, 2009 at 2:21 AM, Mr. Gecko grmrge...@gmail.com wrote:

 Ok, so I've done some more research and found this
 http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST,
 it basically says to run it in the loginwindow, but I can't do that with
 apache which is what I'm running my code with. Because this is a personal
 application I wouldn't mind doing things the hacking way and some how make
 the windowserver trust apache.

 On Dec 18, 2009, at 6:06 PM, Mr. Gecko wrote:

  Hello I'm running 10.5 and I'm trying to do some image drawing with
 NSImage in Terminal via SSH and it seems like every time I try, I get this
 error
  _RegisterApplication(), FAILED TO establish the default connection to
 the WindowServer, _CGSDefaultConnection() is NULL.
  2009-12-18 17:54:04.963 weather.mgm[655:10b] *** -[NSRecursiveLock
 unlock]: lock (NSRecursiveLock: 0x121b30 '(null)') unlocked when not
 locked
  2009-12-18 17:54:04.973 weather.mgm[655:10b] *** Break on _NSLockError()
 to debug.
  2009-12-18 17:54:04.978 weather.mgm[655:10b] An uncaught exception was
 raised
  2009-12-18 17:54:05.009 weather.mgm[655:10b] Error (1002) creating
 CGSWindow
  2009-12-18 17:54:05.014 weather.mgm[655:10b] *** Terminating app due to
 uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002)
 creating CGSWindow'
  2009-12-18 17:54:05.040 weather.mgm[655:10b] Stack: (
  2513718512,
  2536973548,
  2513718272,
  2513718328,
  2470748316,
  2470747564,
  2470746864,
  2470746400,
  2470743808,
  2470755712,
  2470754620,
  2470754184,
  2470743272,
  8540
  )
  I know this code I'm using works as it runs perfectly fine on Snow
 Leopard via SSH but for some reason it doesn't work on Leopard, what could
 be wrong here? How can I get this working on Leopard?
 
  Basic code to this is
  int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSApplicationLoad();
 
NSImage *image = [[NSImage alloc] initWithContentsOfFile:@
 /background.png];
NSSize imageSize = [image size];
[image lockFocus];
NSImage *type = [[NSImage alloc] initWithContentsOfFile:@
 /icons/93x93/1.png];
[type drawInRect:NSMakeRect((imageSize.width-[type size].width)/2,
 imageSize.height-[type size].height, [type size].width, [type size].height)
 fromRect:NSMakeRect(0, 0, [type size].width, [type size].height)
 operation:NSCompositeSourceOver fraction:1.0];
[image unlockFocus];
 
NSBitmapImageRep *imageRep = [NSBitmapImageRep
 imageRepWithData:[image TIFFRepresentation]];
NSData *iconData = [imageRep representationUsingType:NSPNGFileType
 properties:nil];
[iconData writeToFile:@/drawn.png automatcially:YES];
[image release];
 
[server release];
[pool drain];
return 0;
  }

 ___

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

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

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

 This email sent to jja...@gmail.com




___

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

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

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

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


Re: NSApplicationLoad() can't connect to window server in user logged out.

2009-12-18 Thread Julien Jalon
NSImage needs a connection to the Window Server in Leopard.

If you want to do some offscreen headless rendering, use CoreGraphics +
ImageIO

On Sat, Dec 19, 2009 at 2:21 AM, Mr. Gecko grmrge...@gmail.com wrote:

 Ok, so I've done some more research and found this
 http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECPRELOGINANDTRUST,
 it basically says to run it in the loginwindow, but I can't do that with
 apache which is what I'm running my code with. Because this is a personal
 application I wouldn't mind doing things the hacking way and some how make
 the windowserver trust apache.

 On Dec 18, 2009, at 6:06 PM, Mr. Gecko wrote:

  Hello I'm running 10.5 and I'm trying to do some image drawing with
 NSImage in Terminal via SSH and it seems like every time I try, I get this
 error
  _RegisterApplication(), FAILED TO establish the default connection to the
 WindowServer, _CGSDefaultConnection() is NULL.
  2009-12-18 17:54:04.963 weather.mgm[655:10b] *** -[NSRecursiveLock
 unlock]: lock (NSRecursiveLock: 0x121b30 '(null)') unlocked when not
 locked
  2009-12-18 17:54:04.973 weather.mgm[655:10b] *** Break on _NSLockError()
 to debug.
  2009-12-18 17:54:04.978 weather.mgm[655:10b] An uncaught exception was
 raised
  2009-12-18 17:54:05.009 weather.mgm[655:10b] Error (1002) creating
 CGSWindow
  2009-12-18 17:54:05.014 weather.mgm[655:10b] *** Terminating app due to
 uncaught exception 'NSInternalInconsistencyException', reason: 'Error (1002)
 creating CGSWindow'
  2009-12-18 17:54:05.040 weather.mgm[655:10b] Stack: (
  2513718512,
  2536973548,
  2513718272,
  2513718328,
  2470748316,
  2470747564,
  2470746864,
  2470746400,
  2470743808,
  2470755712,
  2470754620,
  2470754184,
  2470743272,
  8540
  )
  I know this code I'm using works as it runs perfectly fine on Snow
 Leopard via SSH but for some reason it doesn't work on Leopard, what could
 be wrong here? How can I get this working on Leopard?
 
  Basic code to this is
  int main (int argc, const char * argv[]) {
NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
NSApplicationLoad();
 
NSImage *image = [[NSImage alloc] initWithContentsOfFile:@
 /background.png];
NSSize imageSize = [image size];
[image lockFocus];
NSImage *type = [[NSImage alloc] initWithContentsOfFile:@
 /icons/93x93/1.png];
[type drawInRect:NSMakeRect((imageSize.width-[type size].width)/2,
 imageSize.height-[type size].height, [type size].width, [type size].height)
 fromRect:NSMakeRect(0, 0, [type size].width, [type size].height)
 operation:NSCompositeSourceOver fraction:1.0];
[image unlockFocus];
 
NSBitmapImageRep *imageRep = [NSBitmapImageRep
 imageRepWithData:[image TIFFRepresentation]];
NSData *iconData = [imageRep representationUsingType:NSPNGFileType
 properties:nil];
[iconData writeToFile:@/drawn.png automatcially:YES];
[image release];
 
[server release];
[pool drain];
return 0;
  }

 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
It's not necessarily a memory management problem. As this happens very early
in the application launch, when Launch Services uses your Info.plist to
register the application, your problem might also be that an entry supposed
to be a string is in fact an array.

On Mon, Dec 14, 2009 at 9:09 AM, Joe The Programmer 
joetheappleprogram...@gmail.com wrote:

 On Dec 14, 2009, at 12:52 AM, Kyle Sluder wrote:

  Turning on GC is not the solution to your problem.  Fixing your memory
  management bugs is the solution.

 On Dec 14, 2009, at 12:54 AM, Joar Wingfors wrote:

  For a trivial app it might be. For anything else, it would not be. GC and
 RC are fundamentally different memory management models, and converting an
 existing code base is never easy. You should not attempt it before you
 understand how GC and RC differs, before you've read up on how GC is
 supported in ObjC  Cocoa, etc.

 Understood.  I'll have a good read.  Thanks.

 Could this memory management issue have existed even when this project was
 being built with Xcode 2.5 and the 10.4 SDK, or is it something that was
 introduced to build with Xcode
 3.2.1?___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: App Launches in Finder, Hangs While Launching in Debugger

2009-12-14 Thread Julien Jalon
And indeed, your plist is broken. CFBundleDisplayName should be a string not
an array. It seems that what is CFBundleDisplayName should be
CFBundleDocumentTypes.

-- 
Julien

On Mon, Dec 14, 2009 at 3:29 PM, Joe The Programmer 
joetheappleprogram...@gmail.com wrote:


 On Dec 14, 2009, at 4:28 AM, Julien Jalon wrote:

  It's not necessarily a memory management problem. As this happens very
 early in the application launch, when Launch Services uses your Info.plist
 to register the application, your problem might also be that an entry
 supposed to be a string is in fact an array.

 Yes, that's why I was thinking resource.  As far as I can remember, I
 didn't touch the plist file going from Xcode 2.5 to 3.2.1.  However, I
 noticed a new key, CFBundleDisplayName, in my 3.2.1 info.plist file.  I'm
 not too familiar with the make up of a plist file.  Did the format of the
 info.plist change between versions?   Regardless, there seems to be an
 erroneous false/ in there.  Perhaps something got mangled along the way
 from 2.5 to 3.2.1?  I need to bone up on info.plist.  Thanks.

keyCFBundleDisplayName/key
array
dict
keyCFBundleTypeExtensions/key
array
stringtsk/string
stringTSK/string
/array
keyCFBundleTypeIconFile/key
stringtsk.icns/string
keyCFBundleTypeMIMETypes/key
array
stringapplication/tsk/string
/array
keyCFBundleTypeName/key
stringTSK Document/string
keyCFBundleTypeOSTypes/key
array
stringtsk /string
stringTSK /string
/array
keyCFBundleTypeRole/key
stringViewer/string
keyLSTypeIsPackage/key
false/
keyNSPersistentStoreTypeKey/key
stringJSON/string
/dict
/array


___

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

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

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

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


Re: NSURLConnection Problem Inside QuickLook Generator

2009-12-08 Thread Julien Jalon
This discussion would be better done in the quicklook-dev mailing list. And
in fact, it already took place there.
Please avoid cross posting questions like this.

On Tue, Dec 8, 2009 at 7:16 PM, Dalmazio Brisinda dbrisi...@gmail.comwrote:

 Thanks for that. Okay, I see the QuickLook docs sort of allude to this in
 regards to using Web-Kit plugins within QuickLook generators. Which gets me
 thinking: would it then be possible to maybe connect to the server via local
 distributed objects instead of using the NSURLConnection framework? In
 otherwords, how deep does the sandbox go?

 Any ideas on how to possibly bypass this would be most welcome.

 Best,
 Dalmazio


 On 2009-12-08, at 9:48 AM, David Duncan wrote:

  On Dec 8, 2009, at 2:13 AM, Dalmazio Brisinda wrote:
 
  I'm writing a QuickLook plugin that, as part of the preview process,
 makes an http call to a (localhost) server to obtain data that is then used
 to generate the preview image.
 
  The code below works fine outside the QuickLook architecture, as a
 standard Cocoa application. But as soon as I move the (exact) same code over
 to the QuickLook plugin, a call to the server only returns (null) response,
 and (null) data. The docs indicate that this means the connection is
 failing. But why o why is it failing?
 
 
  My understanding is Quicklook plugins are not allowed to make network
 connections due to sandbox restrictions.
  --
  David Duncan
  Apple DTS Animation and Printing
 

 ___

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

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

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

 This email sent to jja...@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: using QLPreviewPanel and supporting 10.5

2009-10-10 Thread Julien Jalon
Replace all calls to [QLPreviewPanel sharedPreviewPanel] and other class
calls to weak calls: [NSClassFromString(@QLPreviewPanel)
sharedPreviewPanel].
On Sat, Oct 10, 2009 at 3:47 AM, Mitchell Livingston livings...@mac.comwrote:

 Hello,

 I want to support Quick Look in my application, but still support 10.5. I'm
 using the 10.6 SDK and 10.5 deployment target. Launching on 10.5 gives:

 Dyld Error Message:
 Symbol not found: _OBJC_CLASS_$_QLPreviewPanel
 Referenced from:
 /Users/robertvehse/Desktop/Transmission.app/Contents/MacOS/Transmission
 xpected in: /System/Library/Frameworks/Quartz.framework/Versions/A/Quartz

 Obviously this is from using objects only available in 10.6. I won't be
 using the QL classes on 10.5. Is there a way around this?

 Thanks,
 Mitch
 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: an app that never quits

2009-09-22 Thread Julien Jalon
Note that when filing this kind of bug, it's always better to explain more
precisely your use case (not just let me have background processes!) as it
might help design a suited solution within the constraints of the device
(same way Push notifications was proposed to solve many use cases)

-- 
Julien

On Wed, Sep 23, 2009 at 12:32 AM, Erick Calder e...@arix.com wrote:

 On Sep 21, 2009, at 11:31 PM, Kyle Sluder wrote:

  On Mon, Sep 21, 2009 at 11:30 PM, Erick Calder e...@arix.com wrote:

 wow.  ok.  I guess that's not going to help much then.  I must say that
 without daemons the range of applications possible seems rather quite
 narrow
 to me.


 Background processing is a much-desired feature.  You can add your
 voice by filing a bug at http://bugreport.apple.com.


 done.  I hope somebody reads this stuff since it's obviously a matter of
 (poor) policy, rather than of technical difficulty.


 ___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: _NSAutoreleaseNoPool missing in Snow Leopard

2009-08-30 Thread Julien Jalon

It's __ (2 underscores) and not _

--  
Julien from his iPhone


Le 30 août 2009 à 23:00, Seth Willits sli...@araelium.com a écrit :



In Snow Leopard I started seeing this:
*** __NSAutoreleaseNoPool(): Object 0x100a49ec0 of class NSCFString  
autoreleased with no pool in place - just leaking



I have no idea where this is happening so I tried to break in  
_NSAutoreleaseNoPool just like the Apple documentation at http://developer.apple.com/mac/library/documentation/Performance/Conceptual/ManagingMemory/Articles/FindingLeaks.html 
 says to. However, it's not resolving. GDB claims there is no  
_NSAutoreleaseNoPool defined. I used nm on Foundation in Snow  
Leopard and there is no function. On 10.5, though, there is. So it  
seems it's gone and I can't find anything similarly named.


Does anyone know what I *should* be breaking on? I'd obviously like  
to track this down.



--
Seth Willits



___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: Reasons why QL would fail to create thumbnail?

2009-08-28 Thread Julien Jalon
Still, trying qlmanage -t /path/to/file on failing machine might help a
lot (qlmanage -t -d4 /path/to/file on SnowLeopard).Also, check that the
path you give is correct even on a case-sensitive FS.

-- 
Julien

On Fri, Aug 28, 2009 at 2:01 AM, Graham Cox graham@bigpond.com wrote:


 On 28/08/2009, at 5:12 AM, Keith Duncan wrote:

  What is your preview being generated from, a QuickLook generator or the
 Preview and Thumbnail files in your bundle's QuickLook folder?



 The bundle's QuickLook folder - I do not have a QL Generator, I just write
 an image to /QuickLook/Thumbnail.jpg when the document (package) is saved. I
 can also load this image directly and I am now doing so if the thumbnail
 creation fails, though it doesn't look as nice. I haven't found out yet
 whether this fallback succeeds in the cases where the thumbnail creation
 fails.

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

 This email sent to jja...@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: Reasons why QL would fail to create thumbnail?

2009-08-27 Thread Julien Jalon
Might be interesting to ask your user to use qlmanage -t on the file
to see if anything relevant appears here.

Also what kind of file is it? Maybe the user has some plugin installed there.

On Thursday, August 27, 2009, Graham Cox  wrote:
 I'm using the following code to generate thumbnail images in one of my user 
 interfaces. It works fine on my machine, and on all the ones I've tested, but 
 a couple of users have reported that they don't see the thumbnails. One user 
 experiencing this problem helped me to log some results which shows that the 
 QLThumbnailImageCreate function is returning nil. The docs state that this 
 will return nil if it can't read the file, but it's the exact same file on 
 every system, loaded from my app's resources. So why would it fail in a few 
 percent of cases, but mostly work? All affected users are running the latest 
 system version.


         CFURLRef url = CFURLCreateWithFileSystemPath( NULL, 
 (CFStringRef)[self path], kCFURLPOSIXPathStyle, NO );

         // logging the URL/path at this point shows that the correct path is 
 being returned from [self path], a path to app internal resources

         CGSize  maxImageSize = CGSizeMake( 512, 512 );
         NSDictionary* options = [NSDictionary 
 dictionaryWithObjectsAndKeys:(id)kCFBooleanTrue, 
 kQLThumbnailOptionIconModeKey, nil];

         CGImageRef qli = QLThumbnailImageCreate( NULL, url, maxImageSize, 
 (CFDictionaryRef)options );
         CFRelease( url );

         // on a very few systems, qli is nil here

 Is there a possibility that QuickLook can somehow be turned off?

 Any ideas?

 --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)http://lists.apple.com

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: UUID method Garbage Collection safe?

2009-07-22 Thread Julien Jalon
Correct code is:
+ (NSString *)stringWithUUID{  CFUUIDRef uuidObj = CFUUIDCreate(nil);
 NSString *uuidString =
(NSString*)NSMakeCollectable(CFUUIDCreateString(nil,uuidObj));
 CFRelease(uuidObj);  return [uuidString autorelease];}

Or you will leak in GC.

-- 
Julien

On Wed, Jul 22, 2009 at 6:45 PM, Squ Aire squ...@live.com wrote:


 I've been using this method to make UUID strings:

 + (NSString *)stringWithUUID{  CFUUIDRef uuidObj = CFUUIDCreate(nil);
  NSString *uuidString = (NSString*)CFUUIDCreateString(nil,uuidObj);
  CFRelease(uuidObj);  return [uuidString autorelease];}

 How do you all like it? Is it ok? It's based on some code I Googled a while
 back. In particular, is this code perfectly garbage collection safe?
 _
 Show them the way! Add maps and directions to your party invites.

 http://www.microsoft.com/windows/windowslive/products/events.aspx___

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

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

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

 This email sent to jja...@gmail.com

___

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

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

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

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


Re: Best 'Cocoa' File Preview

2009-07-14 Thread Julien Jalon
Hi David,

Glad you got it to work.

On Tue, Jul 14, 2009 at 3:34 AM, David Blanton aired...@tularosa.netwrote:


 Furthermore why so convoluted and difficult? I should be able to say call
 me for files of type'.pes' and be done with it.


That's what you need to do. Except file extensions is not a robust way to
designate file types (what about mime types or other way to identify
types?). That's why MacOS X uses an intermediate abstraction for type naming
(the content type)

- You have to declare the content type to the OS (UTTypeIdentifier) and
how to sniff files of this type (file extension, mime type, HFS type and
whatever might come up in the future under UTTypeTagSpecification). You
can also declare other information as well (like its type description,
conformance, etc.)

- At this point the OS is able to identify your files, now you can associate
your file type to applications or plug-ins in CFBundleDocumentTypes:

-- 
Julien
___

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

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

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

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


Best 'Cocoa' File Preview

2009-07-13 Thread Julien Jalon
On Monday, July 13, 2009, David Blanton aired...@tularosa.net wrote:

 Is it not the case that the UTI is defined in the info.plist 
 CFBundleDocumentTypes?  (which I have done).

Nope, CFBundleDocumentTypes associates your type to the plugin. You
should use UTExportedTypes or UTImportedTypes


look for declaring UTI in info.plist in google, you'll find exactly
what you need.

-- 
Julien
___

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

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

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

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


Re: Best 'Cocoa' File Preview

2009-07-12 Thread Julien Jalon
On Mon, Jul 13, 2009 at 12:58 AM, David Blanton aired...@tularosa.netwrote:

 I am traveling down the QuickLook path ...

 I have followed all directions but my code is not being called by qlmange
 as evidenced here:

 7/12/09 4:46:08 PM qlmanage[855] [QL] Thumbnailing
 /users/davidblanton/Aibnb18.pes. Content type UTI: dyn.ah62d4rv4ge81a3px.
 Generator used: None
 7/12/09 4:46:08 PM qlmanage[855] [QL] Thumbnailing for
 /users/davidblanton/Aibnb18.pes done (No image created).


 Is there some known secret sauce not divulged in the docs?


Your file type (UTI) should be declared somewhere (in your app or in the
plug-in). Still, during development, the file type registration might not be
done when you want to you can use:

qlmanage -t -c com.mycompany.mytype /path/to/file

to override type identification.

-- 
Julien
___

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

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

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

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


Re: Memory management in QuickLook plugin

2009-05-20 Thread Julien Jalon



Le 20 mai 2009 à 13:17, Georg Seifert georg.seif...@gmx.de a écrit :


Hi,

I’m developing a QuickLook plugin for a custom binary file format.

As long as I did not cared about memory leaks everything was fine.  
Then I fixed the leak with the help of Instruments. Everything runs  
fine from xCode and Instruments but now it crashes if I run the  
plugin from the finder.




Do you mean quicklookd crashes but qlmanage does not?

I have set up a custom executable with /usr/bin/qlmanage and the  
argument -p path/to/my/file.


Any advice is very welcome.


We lack information here. We'd need to know where it is crashing.

--
Julien from his iPhone ___

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

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

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

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


Re: How do I find this compile error?

2009-04-23 Thread Julien Jalon
I think Bill was meaning QuartzCore framework (for CoreAnimation)  
and not CoreAudio :-)


--
Julien from his iPhone

Le 23 avr. 2009 à 20:17, Bill Bumgarner b...@mac.com a écrit :


On Apr 23, 2009, at 11:09 AM, James Cicenia wrote:

Undefined symbols:
_kCATransactionDisableActions, referenced from:
_kCATransactionDisableActions$non_lazy_ptr in  
AudioViewController.o

_OBJC_CLASS_$_CALayer, referenced from:
__objc_classrefs__d...@0 in AudioViewController.o
_OBJC_CLASS_$_CATransaction, referenced from:
__objc_classrefs__d...@0 in AudioViewController.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


That isn't a compiler error, that is a linker error!

It means that you are using functionality in your application for  
which you haven't added the appropriate framework.


Given the errors, I'm guessing you didn't include  
CoreAudio.framework in your project?


b.bum

___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: canBeVisibleOnAllSpaces added in 10.5 and deprecated in 10.5?

2009-04-21 Thread Julien Jalon
I think the how is obvious. I suspect you're more interested in the  
why :-)


--
Julien from his iPhone

Le 21 avr. 2009 à 23:34, Sean McBride s...@rogue-research.com a  
écrit :



Hi,

Can someone explain how a method added in 10.5 can be deprecated in
10.5? [sic]

http://developer.apple.com/documentation/Cocoa/Reference/ 
ApplicationKit/
Classes/NSWindow_Class/DeprecationAppendix/ 
AppendixADeprecatedAPI.html


Cheers,

--

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


___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: Getting the message text of a mail

2009-04-21 Thread Julien Jalon
The problem is not really that your plugin might be broken by a new  
version of mail but that it might break mail without the user  
understanding it's caused by your plugin.


--
Julien from his iPhone

Le 21 avr. 2009 à 23:47, geoff...@fileflow.com a écrit :



On 21 Apr 2009, at 22:53, Kyle Sluder wrote:

On Tue, Apr 21, 2009 at 4:17 PM, Scott Anguish sc...@cocoadoc.com  
wrote:
You should know that there is no public API for writing a Mail.app  
plugin.


And please file a bug regarding this glaring omission.

--Kyle Sluder



Good point. I know all this but I'm willing to take the chance and  
update version of the plugins when new Mail.app is coming. But I  
really would need some help getting the body message as a String.


--Geoffrey Rekier
___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: Difference between SEL and const char* when sending a message?

2009-04-08 Thread Julien Jalon
64bit runtime selectors are not char* as far as I know.
In general, you should use NSSelectorFromString/NSStringFromSelector the
more low-level objc functions.

On Wed, Apr 8, 2009 at 9:21 AM, Sherm Pendley sherm.pend...@gmail.comwrote:

 On Wed, Apr 8, 2009 at 3:17 AM, Mark Ritchie mark.ritc...@mac.com wrote:

 
  You can not simply cast a C string to SEL. is from:
 
 
 http://developer.apple.com/documentation/Cocoa/Reference/ObjCRuntimeRef/ObjCRuntimeRef.pdf
 
  Note that while it's be convenient to cast SEL to char *, especially when
  debugging in gdb, there's no guarantee it will be that way in the future.


 In fact, in the Cocotron libobjc, and I believe in the GNU libobjc as well,
 it's not that way in the present. :-)

 sherm--

 --
 Cocoa programming in Perl: http://camelbones.sourceforge.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/jjalon%40gmail.com

 This email sent to jja...@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: Why isn't NSString's caseInsensitiveCompare working correctly?

2009-03-21 Thread Julien Jalon
   if( [fn caseInsensitiveCompare:s] ) break;
   NSLog(@%@ != %@, fn, s);


compare methods return NSOrderedSame (==0) if the strings are the same so
your test here seems incorrect.

On Sat, Mar 21, 2009 at 7:26 PM, Wesley Spikes wesley.spi...@gmail.comwrote:

 Odds are, it's a bug that is based entirely in my code, but it's bugging me
 now, and I've hit a road block mentally. Any help provided would be greatly
 appreciated.

 Please excuse the crypticness of this message, but I'm only able to
 disclose
 the parts of the code in question.

 The basic overview of what's happening in the code is [classInst
 findIndexOfFilename:inData:] is being called, with the filename being
 passed
 in from a directory enumeration. A manual browsing through the data makes
 it
 look like all aspects of it appear like it should work.

 If anything further needs to be known, just let me know, I'll likely be
 able
 to provide.

 At the moment, I'm pretty sure it should work by the looks of it. What's
 really bothersome about it to me is that the output of the first error
 shows
 that the entry at 10:28:17.401 is the only entry that is outputted by
 findIndexOfFilename:inData:, and none of the subsequent entries are
 presented as having been checked. *scratches head*

  First failed output record in the XCode console
 [Session started at 2009-03-21 10:28:17 -0700.]
 2009-03-21 10:28:17.400 IX2[52319:10b] Contents
 2009-03-21 10:28:17.401 IX2[52319:10b] Contents != Contents
 2009-03-21 10:28:17.407 IX2[52319:10b] Hmm, it appears that Contents is
 not in passed data pointer. pname=cut path/Contents

  The code to find the index -- before this is called, the caller is
 currently calling NSLog(@%@, fn);
 - (int) findIndexOfFilename:(NSString*)fn
 inData:(S_KH_DATA*)data
 {
  int ctr   = 0;
  NSString *s;

  // this would indicate a failure in our build process
  assert( data[0].filename != NULL );

  do {
s = [NSString stringWithCString:data[ctr].filename
 encoding:NSUTF8StringEncoding];
if( [fn length] != [s length] ) continue; // don't go and do a full
 compare if diff lens
if( [fn caseInsensitiveCompare:s] ) break;
NSLog(@%@ != %@, fn, s);
  } while( data[++ctr].filename != NULL );

  if( data[ctr].filename != NULL )
return ctr;
  return -1;
 }

  The structure that is the data[x]
 typedef struct _S_KH_DATA
  {
uint8_t   fs_type;  // 1 is directory, 2 is plain
 file, 3 is executable file, 0 is unset/ignore
char *filename; // filename is the name of the
 filesystem
uint8_t   hash[SHA512_DIGEST_LENGTH];   // sha2-512
  } S_KH_DATA;

  The data being passed (first entries only, abbreviated)
 S_KH_DATA kh_data [] = {
  { KHD_TYPE_DIRECTORY, , 0 },
  { KHD_TYPE_DIRECTORY, Contents, 0 },
  { KHD_TYPE_DIRECTORY, Contents/MacOS, 0 },
  { KHD_TYPE_PLAIN_FILE, Contents/Info.plist, { 0x82, ..., 0xe3, } },
  ...
  { 0, NULL, 0 },
 };


 --
 Wesley Spikes
 wesley.spi...@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/jjalon%40gmail.com

 This email sent to jja...@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: using QuickLook from an application?

2009-03-12 Thread Julien Jalon



--  
Julien


Le 12 mars 09 à 22:29, Bill Janssen jans...@parc.com a écrit :


I'd like to be able to invoke the QuickLook server from my application
to obtain PDF or RTF preview versions of MS-Office Documents before
opening them.  The capability exists; you can see it in Finder, for
instance.  But I can't see how to invoke it from a client.  The only
useful call I can make is QLThumbnailImageCreate(), which  
unfortunately

is for single-page data.  Symmetry tells me there should be something
like QLPreviewDocumentCreate(), but I don't see it anywhere.

What am I missing?  Surely Apple wouldn't keep such a useful facility
out of the hands of developers?



As of Leopard, Apple does.

Please file a radar and explain precisely what you want.


Bill
___

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

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

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

This email sent to jja...@gmail.com

___

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

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

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

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


Re: UTIs and type codes and extensions

2009-01-13 Thread Julien Jalon
On Wed, Jan 14, 2009 at 2:14 AM, Randall Meadows cocoa-...@not-pc.comwrote:

 I'm just making sure I'm not missing something...

 There's no system-defined way to go from a UTI to an old-style file type
 code (which the UTI docs seem to refer to as a tag) and back again, am I
 correct?


extern CFStringRef
UTTypeCopyPreferredTagWithClass(
  CFStringRef   inUTI,
  CFStringRef   inTagClass)
AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

extern CFStringRef
UTTypeCreatePreferredIdentifierForTag(
  CFStringRef   inTagClass,
  CFStringRef   inTag,
  CFStringRef   inConformingToUTI)   /* can be NULL */
 AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;

extern CFArrayRef
UTTypeCreateAllIdentifiersForTag(
  CFStringRef   inTagClass,
  CFStringRef   inTag,
  CFStringRef   inConformingToUTI)   /* can be NULL */
 AVAILABLE_MAC_OS_X_VERSION_10_3_AND_LATER;




 For instance, my app can export files as TIFF, JPEG, or PNG.  When the user
 makes the selection, I convert the selection popup menu to the appropriate
 UTI using the defined constants in UTCoreTypes.h (kUTTypeTIFF, et al).  I'd
 like to generalize the subsequent code to take that UTI (public.tiff for
 example) and convert it to the appropriate type code ('TIFF').  The next
 logical step would be producing a file name extension based on that as well
 (public.tiff - tif).

 *All* this information is contained in the table at 
 http://developer.apple.com/documentation/Carbon/Conceptual/understanding_utis/utilist/chapter_4_section_1.html#//apple_ref/doc/uid/TP40001319-CH205-CHDIJFGJ,
 but I could discern no way to actually do these types of conversions in a
 general manner.

 History: The reason I need to do this is, Photoshop is brain-dead when it
 comes to opening image files that happen to have no extension in the
 filename (and no file type code).  Preview, QuickTime Player and
 GraphicConverter (and sometimes Safari) have NO problem identifying and
 opening the exact same files, sans extension, but PS simply says Could not
 complete your request because Photoshop does not recognize this type of
 file.  I am working around this by attaching type and creator codes to all
 the image files I export.  (Yes, my client could avoid all this by simply
 including an extension to the image name, but old dogs, new tricks, and all
 that...)


You always can teach new tricks to old dogs... it's significantly more
difficult for human beings.

-- 
Julien
___

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

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

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

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


Re: Security With Show Package Contents?

2009-01-12 Thread Julien Jalon
New Pages format is the same but zipped.

On Mon, Jan 12, 2009 at 4:27 PM, Devon Ferns dfe...@devonferns.com wrote:

 Have you checked if the new Pages file format is now binary instead of a
 package?  That would be my guess.  I don't see how you can stop anyone from
 listing a directory structure.

 Devon

 Chunk 1978 wrote:

 so i was a little put off after purchasing iWork '09, because i could
 no longer access Show Package Contents of my pages files.  i
 generally used this to swap out images of the same size, or to color
 balance, etc.

 anyway, i started thinking about security of applications based on
 showing package contents.  as far as i know the only way for someone
 to crack an application is to have access to the package contents
 which lists the Unix Executable File in the Mac OS folder.  i guess
 there's also the possibility to swap out frameworks (particularly
 Aquatic Prime framework if the framework is installed instead of the
 Aquatic Prime library)... since apps are really just folders with a
 .app extension, wouldn't it be possible to disable Show Package
 Contents, as with the new .pages files, so that it would make the app
 more secure (if not impossible to crack)?  couldn't Apple implement
 some sort of password protection or optional block on viewing package
 contents with XCode so that apps are impossible to crack?

 this post is totally just me thinking out loud.  i personally believe
 that if someone is going to download a cracked version of an app then
 either they wouldn't have bought a license anyway, or they don't have
 the money... i'm not trying to make an app of mine more secure.  but
 i'd like to hear your thoughts about this.
 ___

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

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

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

 This email sent to dfe...@devonferns.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/jjalon%40gmail.com

 This email sent to jja...@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: mydoc.myext/QuickLook/Preview.html and full screen

2009-01-05 Thread Julien Jalon
On Fri, Jan 2, 2009 at 5:05 PM, Gerd Knops gerti-cocoa...@bitart.comwrote:


 On Dec 31, 2008, at 8:43 PM, Julien Jalon wrote:


 On Wed, Dec 31, 2008 at 10:37 PM, Gerd Knops gerti-cocoa...@bitart.com
 wrote:


  Seemingly arbitrary limitation, when according to the documentation
 Java applets and Flash are supported.


 Web Plug-ins are not supported (if this is in QL documentation, it is a
 bug).


 http://developer.apple.com/documentation/UserExperience/Conceptual/Quicklook_Programming_Guide/QLDynamicGeneration/chapter_7_section_3.html#/
 /apple_ref/doc/uid/TP40005020-CH15-SW2

 Last Paragraph claims:

Although the code listing uses an img HTML element for the
 cid-scheme reference to the image attachment, you can also use the object
 element for all kinds of attachments (images, audio, videos, Java applets,
 and Flash animations). It is not recommended that you use Web Kit plug-ins
 in enriched HTML passed back to Quick Look.


Please file a bug as this is incorrect.





  Would have been nice to have some client-side javascript to produce a
 nice functional QuickLook document, instead of being limited to 'no nib
 allowed' C code. Why no full Objective-C support for Quicklook seems rather
 odd.


 Security, stability and other reasons.

 QL is not meant to fully replace an application. It's not meant to be some
 sort of Active X or OpenDoc either. Its goal is much more limited (but in
 the end much more useful ;-) ).


 For more complex document formats the ability to provide a UI is necessary.
 For example to explore archives, or in my case a hybrid document that
 contains a number of other documents (each of which do have PDF and gif
 previews), and where the document state changes dynamically because it is of
 a collaborative nature.


That's a misunderstanding. Quick Look is not meant to explore files but to
provide a quick look of the file. Goals of QL generators is to provide a
simple standard representation of the files' contents regardless of the UI
(QL is then responsible to provide the best UI possible depending on the
context, be it the Quick Look panel, Cover Flow or any other place in the
system it might make sense, today or in the future). If you feel the
proposed representations for your documents can't really suit your needs,
please file a bug describing exactly what your document is all about.



 In general, QL could be made a lot nicer for Cocoa Programmers than that
 limited C API.


Once you have a CGContext, you have a NSGraphicContext and you can use
whatever Cocoa drawing API (you can even use printing APIs or -[NSView
displayInContext...]).

Note that there is a more suited mailing list to discuss Quick Look (
quicklook-...@lists.apple.com)

-- 
Julien
___

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

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

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

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


Re: mydoc.myext/QuickLook/Preview.html and full screen

2008-12-31 Thread Julien Jalon
On Wed, Dec 31, 2008 at 10:37 PM, Gerd Knops gerti-cocoa...@bitart.comwrote:


 On Dec 31, 2008, at 1:22 PM, Gerd Knops wrote:

  I am looking to add QuickLook functionality to a fairly complex document.
 A static html file, using some javascript to interact with the document
 contents would be ideal for a number of reasons. So I experimented by adding
 a QuickLook/Preview.html file to my document bundle.

 That works fine, and in 'normal' QuickLook mode that html can be resized
 to cover most of the screen.

 But in full screen mode the html always appears to be sized to cover only
 about 1/4 of the available space. Is there some trick to allow the html
 document to use the entire screen?

  Closer examination shows that apparently javascript is not supported
 inside QuickLook.


Security reasons. In particular, QL is a little more paranoid if it gets the
preview directly from the disk (e.g. in
MyDoc.docextension/QuickLook/Preview.html)


 Seemingly arbitrary limitation, when according to the documentation Java
 applets and Flash are supported.


Web Plug-ins are not supported (if this is in QL documentation, it is a
bug).


 Would have been nice to have some client-side javascript to produce a nice
 functional QuickLook document, instead of being limited to 'no nib allowed'
 C code. Why no full Objective-C support for Quicklook seems rather odd.


Security, stability and other reasons.

QL is not meant to fully replace an application. It's not meant to be some
sort of Active X or OpenDoc either. Its goal is much more limited (but in
the end much more useful ;-) ).

-- 
Julien
___

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

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

Help/Unsubscribe/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 timers (without a run loop)

2008-12-04 Thread Julien Jalon
The question itself does not make a lot of sense for me. A timer API is
tightly bound to the underlying framework that is idling your thread.
If the idling API is CFRunLoopRun(), you'd use CFTimers, if your idling API
is select() or kevent(), you'd use their timeout parameters.

So, for what you seem to say, it's your framework responsibility to provide
some asynchronous timer API. If it does not, your only choice is to
simulate the timer using other means:
- the easy one: one thread that sleeps() for each timer then messages back
to your threads
- a more complex one is to use a dedicated thread that will effectively run
a CFRunLoop and bridge your timers over CFTimers.
- you could imagine using signal() +SIGALRM bug using Unix signals here is
really not something you should try to use except if you really know what
you are doing.

-- 
Julien

On Thu, Dec 4, 2008 at 4:14 PM, Påhl Melin [EMAIL PROTECTED] wrote:

 2008/12/4 Joseph Kelly [EMAIL PROTECTED]:
  I've used both the CF and NS timer apis in many different situations
 without
  a hitch. They're fairly reliable. Perhaps you could explain your can't
 use
  a runloop restriction -- e.g. if you are writing a daemon or a kext,
 this
  is not the list you want to post to.

 I'm not writing a daemon or a kext. I'm porting a framework that I've
 designed and used on .Net before that will form the foundation of my
 architecture for my future Mac OS applications (I'm new to Mac OS
 programming). The framework is used for easy communication and
 synchronization between threads, processes and computers (with the
 same syntax) and make it possible to design an application in small
 modules that communicates via messages and it's straightforward to
 start with the modules as threads in a single application and then
 split into several processes on a computer or ever distribute certain
 modules to other computers without changing much (or any) code at all.
 But mainly it makes it easier to write efficient multithreaded
 applications that work.

 I'm very happy with the messaging framework and would like to use it
 on Mac OS X as well. Run loops are not compatible with this approach
 since my threads need to run forever or block in my framework when
 they are waiting for messages (the timers are used to generate timer
 messages internally in the framework). The threads are not event
 driven and will not return to the run loop.

  You might find if you refactor your design a bit, that it will take to a
  runloop model quite well. In fact, most of the user space IOKit async
  routines require that you use a runloop.

 I don't want to refactor my design. :-) To do that, I would have
 give up the framework design completely. I'm generally happy with the
 design just want to make a good port to Mac OS X.

  Also, the Mach APIs are not strictly private -- the headers are publicly
  available. They are subject to change between releases, so if you do
 start
  using them, you will need to stay on top of things -- check your binaries
 on
  pre-release OS seeds etc.

 Okay, thats great to know. But I suppose it's still begging for
 trouble, if you can avoid it.

  Joe K.
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Quick Look with native types?

2008-11-28 Thread Julien Jalon
On Fri, Nov 28, 2008 at 5:50 AM, Rob Keniger [EMAIL PROTECTED] wrote:



 There's no public API to do this at present. You'd need to create a
 temporary file and use the qlmanage -p /path/to/thefile tool via NSTask.


I strongly discourage using qlmanage to display the Quick Look panel.
qlmanage -p is meant to debug plug-ins (as stated by the man page) and is
really not suited to provide a user interface. In fact, it will give you a
very poor user experience:

1) it executes the plug-in directly (and does not use quicklookd), it can't
protect itself from bad plug-in behavior.

2) it does not provide all Quick Look panel controls

3) since it's a simple terminal tool it does not integrate properly with a
calling application (does not get any key events, can't correctly zoom
in/out, etc.)

Using qlmanage that way will be even more discouraged in the future.

Of course, I also strongly discourage trying to use any private framework or
private API to work around that problem as you'll have 99% chance to see
your application broken in the next OS release.

The best you can hope is to wait for Apple to provide a public API (and you
are welcome filing a report to Apple).



 Of course, you'd need to write a QuickLook generator in order for the
 temporary file to be previewed correctly.

 If it were me, I'd just use a custom preview class as you have already
 done.


Exactly, an image view (IKImageView or NSImageView) + a HUD window is not
that hard to do.

-- 
Julien
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: LaunchServices/Finder refuses to recognize my NSDocument subclass

2008-11-01 Thread Julien Jalon
If your document type is a package, it does not conform to public.data but
to com.apple.package.
-- 
Julien

On Sat, Nov 1, 2008 at 5:12 PM, John Pannell [EMAIL PROTECTED]wrote:

 Hi all-

 I'm working on a document-based application, but having trouble getting the
 Finder to match my document to my application.  On disk, the document is a
 package.  I am successfully writing the directory and the contents to disk,
 and the directory is written with the proper extension (.pflow).

 On the un-successful side, the directory appears as a regular folder in the
 finder.  Here are the relevant entries to my app's Info.plist... do you see
 anything amiss?

 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN 
 http://www.apple.com/DTDs/PropertyList-1.0.dtd;
 plist version=1.0
 dict
keyCFBundleDevelopmentRegion/key
stringEnglish/string
keyCFBundleDocumentTypes/key
array
dict
keyCFBundleTypeExtensions/key
array
stringpflow/string
/array
keyCFBundleTypeIconFile/key
string/string
keyCFBundleTypeName/key
stringProtoFlow Document/string
keyCFBundleTypeRole/key
stringEditor/string
keyLSItemContentTypes/key
array
stringcom.positivespinmedia.pflow/string
/array
keyNSDocumentClass/key
stringPFDocument/string
/dict
/array
keyCFBundleExecutable/key
stringProtoFlow/string
keyCFBundleIconFile/key
string/string
keyCFBundleIdentifier/key
stringcom.positivespinmedia.ProtoFlow/string
keyCFBundleInfoDictionaryVersion/key
string6.0/string
keyCFBundlePackageType/key
stringAPPL/string
keyCFBundleShortVersionString/key
string2.0/string
keyCFBundleVersion/key
string48.1/string
keyNSMainNibFile/key
stringMainMenu/string
keyNSPrincipalClass/key
stringNSApplication/string
keyUTExportedTypeDeclarations/key
array
dict
keyUTTypeDescription/key
stringProtoFlow Document/string
keyUTTypeConformsTo/key
array
stringpublic.data/string
/array
keyUTTypeIconFile/key
string/string
keyUTTypeIdentifier/key
stringcom.positivespinmedia.pflow/string
keyUTTypeTagSpecification/key
dict
keypublic.filename-extension/key
array
stringpflow/string
/array
/dict
/dict
/array
 /dict
 /plist

 Any help you can give is much appreciated!

 John

 Positive Spin Media
 http://www.positivespinmedia.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/jjalon%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leaking CGColor objects

2008-10-26 Thread Julien Jalon
On Sun, Oct 26, 2008 at 4:20 PM, Antonio Nunes [EMAIL PROTECTED]wrote:

 On 26 Oct 2008, at 14:25, DKJ wrote:

  1. Is there such a thing as a CGColor class? I don't see it in the
 documentation; but CGColor is what Instruments lists as the leaked
 objects.


 You are creating CGColor objects to which you receive pointers of type
 CGColorRef. You are at C level here, not Objective-C.

  2. Are the CGColor objects being leaked when I remove MyCALayer objects
 from myArray? Should I set foregroundColor to nil when doing this?


 You need to make sure in the MyCALayer dealloc method to release the color
 you created during init using something like
 CGColorRelease(self.foregroundColor).


Bad idea: you don't know for sure self.foregroundColor instance will be the
one created in the first place (the one that is leaking). The flaw is at the
beginning:

self.foregroundColor =
   CGColorCreateGenericRGB( 1.0, 1.0, 0.9, 1.0 );

should be

   CGColorRef color = CGColorCreateGenericRGB( 1.0, 1.0, 0.9, 1.0 );
   self.foregroundColor = color;
   CFRelease(color);

-- 
Julien
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Leaking CGColor objects

2008-10-26 Thread Julien Jalon
self.foregroundColor = nil
in your -dealloc is totally useless (and in this case, it's even logging
some error log!). Taking care of foregroundColor is you superclass
responsibility. You are only responsible of the object YOU create or retain
(that's why the temp pattern is indeed the right one)

In the documentation, the foregroundColor property is defined like this:

   @property CGColorRef foregroundColor

There's no retain parameter.

because CGColorRef is not an ObjC type so it would confuse the compiler, but
you can consider it's there.

For Charles:

 Because otherwise there won't be a release to balance the retain in the in
setForgroundColor:. See the docs on Objective-C memory management:

since you don't do that retain you are clearly not the one responsible to
do any retain... as you mentioned: see the docs.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSNotificationQueue EXC_BAD_ACCESS problems

2008-10-07 Thread Julien Jalon
Try your code by enabling NSZombies (Add NSZombieEnabled=YES to the
environment before launching your tool/app).
This should show you what object is supposed to get messaged. I suspect some
object observes your notification but is deallocated.

-- 
Julien

On Tue, Oct 7, 2008 at 4:28 PM, Karan, Cem (Civ, ARL/CISD) 
[EMAIL PROTECTED] wrote:

 I'm having a great deal of trouble getting my notification queue to work
 correctly.  It always causes a EXC_BAD_ACCESS
 whenever I post using NSPostASAP or NSPostWhenIdle, but it works when I
 post using NSPostNow.  Here are the relevant lines of code:

 -(void) testMethod
 {
NSNotification *tempNotification = [NSNotification
 notificationWithName:@DummyName object:self userInfo:nil];

[[NSNotificationQueue defaultQueue] enqueueNotification:tempNotification
 postingStyle:NSPostNow
coalesceMask:(NSNotificationCoalescingOnName |
 NSNotificationCoalescingOnSender) forModes:nil];
 }

 If I change NSPostNow to NSPostASAP, then it immediately crashes.  In the
 last crash, the stack looked like this:

 #0  0x964e6688 in objc_msgSend
 #1  0x931731da in _nsnote_callback
 #2  0x90722aba in __CFXNotificationPost
 #3  0x90722d93 in _CFXNotificationPostNotification
 #4  0x931a071c in -[NSNotificationCenter postNotification:]
 #5  0x931d3121 in postQueueNotifications
 #6  0x9073f9c2 in __CFRunLoopDoObservers
 #7  0x90740d1c in CFRunLoopRunSpecific
 #8  0x90741cf8 in CFRunLoopRunInMode
 #9  0x94902480 in RunCurrentEventLoopInMode
 #10 0x949021d2 in ReceiveNextEventCommon
 #11 0x9490210d in BlockUntilNextEventMatchingListInMode
 #12 0x9580b3ed in _DPSNextEvent
 #13 0x9580aca0 in -[NSApplication
 nextEventMatchingMask:untilDate:inMode:dequeue:]
 #14 0x95803cdb in -[NSApplication run]
 #15 0x957d0f14 in NSApplicationMain
 #16 0xa7fe in main at main.mm:13

 The precise line I get the EXC_BAD_ACCESS is:

 0x964e6688  +0024  mov0x20(%edx),%edi

 and this seems to happen at the end of the runloop.  I tried removing the
 coalesceMask arguments, but no luck.  Note that NSPostNow causes all the
 code to work completely correctly, its just the other two modes that it
 doesn't work.  Anyone have any clue what is going on?

 This is on a OS X 10.5.5 machine with MacFUSE 1.7 installed.  The code is
 being compiled using Xcode 3.1.1.

 Thanks,
 Cem Karan

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How do I guarantee that an object is dealloced on the main thread?

2008-10-06 Thread Julien Jalon
IAs a side note, you always can remove statements like:[NSObject
cancelPreviousPerformRequestWithTarget:self ...];

in -dealloc as they are always useless (delayed performs retain the target
so if your object is dealloc'ed, there are no outstanding performs for this
object).

Also, if some object participates in some run loop sources, it should be
somehow retained until the source is removed from the loop (or the object
stops participating) - in a thread safe manner. It's especially true in a
multi-threaded architecture (you have to avoid the source being triggered
while the object is dealloc'ed).

-- 
Julien

On Sun, Oct 5, 2008 at 11:41 PM, Brian Stern [EMAIL PROTECTED] wrote:


 On Oct 5, 2008, at 4:52 PM, Jim Correia wrote:

  On Oct 5, 2008, at 4:43 PM, Brian Stern wrote:

  This is the question I really wanted to ask:

 I have an object X that is alloc/inited on the main thread.  This object
 creates some NSThreads with detachNewThreadSelector:toTarget:withObject,
 which have object X as their target.  At a later point I want to release
 object X and have it be dealloced on the main thread.

 How do I guarantee that object X is dealloced on the main thread?

 The problem is this: the NSThread objects retain object X.  I have a stop
 method in object X that sets a 'cancelled' global that the thread objects
 inspect and they then exit when it turns true.  So I send stop and then
 release on the main thread.  The thread objects exit and eventually release
 object X but the last release, which causes the dealloc, can be on any
 thread.


 The real question is, why do you care what thread the -dealloc method runs
 on?

 What non-memory management side effects does your -dealloc method have
 which much be run on the main thread?


 My main reason was just cleanliness.  Looking more closely at the code
 however, most of which I didn't write, there are some runloop sources that
 are removed and calls to NSObject
 cancelPreviousPerformRequestsWithTarge:selector:object. Most of the code
 that set those things up will have run on the main thread so should be
 cleaned up on the main thread. There's some other networking cleanup that I
 don't know if it's threadsafe or not.

 It's conceivable that I can rework the cleanup so that most of it happens
 in the stop method and the dealloc method is mostly empty but if there's a
 way to guarantee that dealloc runs on the main thread then I'd probably
 prefer that.

 I guess from your question you don't have a one sentence answer to my
 question.

 --
 Brian Stern
 [EMAIL PROTECTED]



 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Abusing targetForAction: with non-action selectors

2008-09-15 Thread Julien Jalon
It's not safe... once the target is found (using respondsToSelector:, you're
right), the action is performed with:[target performSelector:actionSelector
withObject:sender];

which means that anything but an object as a sender will potentially crash.

The only safe thing you can image is to have an action selector with no
paramater at all.

-- 
Julien

On Mon, Sep 15, 2008 at 10:13 PM, Dave Dribin [EMAIL PROTECTED] wrote:

 Hello,

 Is it safe to use -[NSApplication targetForAction:] with non-action
 selectors?  For example, selectors that have more than one argument, non-id
 first argument, or return values?

 The documentation for targetForAction:to:from: seems to imply it just does
 a respondsToSelector: on each object in the responder chain, and it seems to
 behave this way in my tests.  I'd just like to make sure it is safe to rely
 on this behavior, or if we should find some other approach.

 Thanks,

 -Dave

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: brain-dead NSThread question ...

2008-09-14 Thread Julien Jalon
sleep() is just blocking the thread, so no event is processed. Use run loops
instead.
Try to replace sleep() with [[NSRunLoop currentRunLoop] runMode:beforeDate:]

-- 
Julien
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Linker error: symbol(s) not found

2008-09-03 Thread Julien Jalon
In the header declaring DGBoardRepFromGame, make sure to declare it extern
C.
#ifdef __cplusplus
extern C {
#endif

extern DGBoardRepFromGame(DGGame*, char*);

#ifdef __cplusplus
}
#endif

On Wed, Sep 3, 2008 at 10:40 PM, Joachim [EMAIL PROTECTED] wrote:

 Dear list,

 I'm getting a linker error, and it's not a missing inclusion of a
 framework. I suspect it has to do with mixing .m and .mm files, but I'm
 actually pretty clueless.

 This is the output from the build:

DGBoardRepFromGame(DGGame*, char*), referenced from:
-[DGTinyEngine setPositionFromGame:error:] in DGTinyEngine.o
ld: symbol(s) not found
collect2: ld returned 1 exit status

 In my otherwise Objective-C only project, DGTinyEngine.mm is using a C++
 engine, hence the need to make it an Objective-C++ file. It imports a
 DGFunctions.h file that amongst other general C functions declares the
 void DGBoardRepFromGame (DGGame *game, DGBoardRep buffer) function. The
 function is implemented in a .m file.

 It is the call in DGTinyEngine.mm to this function that causes the linker
 error. If I comment out the call to DGBoardRepFromGame, the project links
 fine. DGGame is an Objective-C class that is used several places in
 DGTinyEngine.mm without causing any problems.

 What causes the linker error, and what can I do to avoid it?

 Thanks in advance,
 Joachim
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quick look preview multipage rich text

2008-07-11 Thread Julien Jalon
On Fri, Jul 11, 2008 at 8:00 PM, Philip Dow [EMAIL PROTECTED] wrote:


 That's right, I realized after posting the message that I should have
 boiled it down to the following:

 + (NSPrintOperation *)PDFOperationWithView:insideRect:toData:printInfo:
 This operation produces a single page of PDF no matter what print settings
 I pass in, one very long page.

 + (NSPrintOperation *)printOperationWithView:printInfo:aPrintInfo
 This operation when set to write the data to disk correctly produces a
 paginated document.

 It's like the NSPrintOperation methods do not allow you to create a
 multi-page PDF in memory. You have to write it to disk first.

 I did take a look at the output in both operations, and that's exactly what
 happens. The fist op gives you one long page of pdf, which is unreadable
 when scaled to fit inside the quicklook preview. The second op gives you
 what you expect.

 I suppose I could use the second operation and then read back in the
 correctly paginated pdf, but then I'm writing out to the hard disk any time
 the user wants to quicklook my document. This seems like a terrible waste of
 resources.



Please, don't do that as your plug-in really should avoid doing anything but
reading stuff on disk. Maybe someone from the AppKit team will be able to
find the source of your problem.

-- 
Julien


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quick look preview multipage rich text

2008-07-09 Thread Julien Jalon
If I understand correctly your point, it seems that in the first case, you
use the direct to data print operation and in the second case, you use the
direct to file print operation then read back the file in memory and send it
to Quick Look. Both methods use QLPreviewRequestSetDataRepresentation(). Am
I right?

What do you mean when you say does not display the content as multipage.
What does it display?

You should try to dump on disk the data produced in the first case and take
a look at it.

-- 
Julien

On Wed, Jul 9, 2008 at 4:40 AM, Philip Dow [EMAIL PROTECTED] wrote:

 Hi all,

 I am trying to generate multipage pdf data for display in a quick look
 preview from rich text attributed string data. Attributed strings don't know
 anything about pages, so it seems to me that I'll have to go through the OS
 printing architecture to generate the multipage pdf content.

 Frustrating thing is, this works if I write the data to a file but not if I
 send it to quicklook. I can generate the pdf data with a custom print info
 specifying the page attributes, but quicklook does not display the content
 as multipage. If I use the same settings but a different print operation,
 writing the data to a temporary file instead, I get a correctly paginated
 document.

 Code follows.

 I understand that PDF content can be created with CGPDFContextCreate and
 the associated begin and end page calls, but the attributed string doesn't
 know about pages, so that seems like a dead end to me. If there's a method
 for doing it that way, I'm all for switching.

 You might also suggest just sending RTF to Quick Look, but I'd like the
 text attachments to display. Converting it to html seems like even more
 work.

 ===

 GenerateMultiPagePDFPreviewForURL(...)

 NSAttributedString *attrString = ...;
 NSTextView *textView = ... (filled with attrString);

 NSMutableData *pdfData = [NSMutableData data];
 NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];

 [printInfo setPaperSize:NSMakeSize(612,792)];
 [printInfo setHorizontalPagination: NSFitPagination];
 [printInfo setVerticalPagination: NSAutoPagination];
 [printInfo setVerticallyCentered:NO];

 NSPrintOperation *po = [NSPrintOperation PDFOperationWithView:textView
insideRect:[textView bounds]
toData:pdfData
printInfo:printInfo];

 [po runOperation];
 QLPreviewRequestSetDataRepresentation(preview, (CFDataRef)pdfData,
 kUTTypePDF, NULL);

 ===

 Quicklook does not present a multipage preview with that code. But the
 following code writes a multipage document...

 ===

 NSAttributedString *attrString = ...;
 NSTextView *textView = ... (filled with attrString);

 NSPrintInfo *printInfo = [NSPrintInfo sharedPrintInfo];
 NSMutableDictionary *printInfoDict = [NSMutableDictionary
 dictionaryWithDictionary:[printInfo dictionary]];

 [printInfoDict setObject:NSPrintSaveJob forKey:NSPrintJobDisposition];
 [printInfoDict setObject:@someLocation.pdf forKey:NSPrintSavePath];

 printInfo = [[NSPrintInfo alloc] initWithDictionary: printInfoDict];
 [printInfo setHorizontalPagination: NSFitPagination];
 [printInfo setVerticalPagination: NSAutoPagination];
 [printInfo setVerticallyCentered:NO];

 po  = [NSPrintOperation printOperationWithView:textView
 printInfo:printInfo];
 [po setShowPanels:NO];
 [po runOperation];

 ===

 In the first case I'm using [NSPrintOperation
 PDFOperationWithView:insideRect:toData:printInfo:] and in the second
 [NSPrintOperation printOperationWithView: printInfo:]. Is the
 PDFOperationWithView method not capable of producing multipage pdf data
 despite the custom printInfo?

 ~Phil


 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Building against 10.5 SDK, link error on open

2008-06-10 Thread Julien Jalon
The basic POSIX functions have changed a bit in Leopard (to achieve POSIX
conformance). This means that POSIX libraries are different in 10.4 SDK vs.
10.5. You can not mix them. Also, if you change the SDK, it's generally a
good idea to clean all your targets.
-- 
Julien

On Tue, Jun 10, 2008 at 7:34 AM, Dale Jensen [EMAIL PROTECTED]
wrote:

 I'm trying to get my project to build against the 10.5 SDK, but when I
 switch it from $(DEVELOPER_SDK_DIR)/MacOSX10.4u.sdk to 10.5, I get a couple
 of errors:

 Undefined symbols:
  _open$UNIX2003, referenced from:
  _CreateEventForPath in editorBridge.o
  _close$UNIX2003, referenced from:
  _SimplePing in SimplePing.o
  _CreateSocketForCommunicationWithHost in SimplePing.o
 ld: symbol(s) not found
 collect2: ld returned 1 exit status

 SimplePing.o is from the Apple provided example.  editorBridge is mine, an
 implementation of kQueue, which uses the open found in fcntl.h

 I don't know enough about UNIX flavoured C to figure out what settings I
 might need to change to solve the link error.  Suggestions?  Thanks!


 dale

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: invoking quicklook via code

2008-06-04 Thread Julien Jalon
In fact, this is not entirely true... there is no public way to activate
Quick Look. qlmanage is for debugging purpose only.
What's public is:
1) QLThumbnailImageCreate() in QuickLook framework
2) ImageKit usage of Quick Look

-- 
Julien

On Wed, Jun 4, 2008 at 3:29 PM, Charles Steinman [EMAIL PROTECTED]
wrote:

 --- Memo Akten [EMAIL PROTECTED] wrote:

  Is it possible to somehow just launch the quicklook
  window for a
  quicktime file?

 The publicly available way to activate Quick Look is
 to call the qlmanage command line tool. Why they
 didn't make the QuickLookUI framework public is beyond
 me (I spent hours looking for a public API before I
 realized it just wasn't there), but you can do
 something similar with qlmanage -p.


 http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/qlmanage.1.html

 Cheers,
 Chuck



 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: File's Owner

2008-05-23 Thread Julien Jalon
On Sat, May 24, 2008 at 12:30 AM, Hamish Allan [EMAIL PROTECTED] wrote:

 On Fri, May 23, 2008 at 11:17 PM, Steve Weller [EMAIL PROTECTED] wrote:

  The hang up that I see is that this documentation give no clue as to the
  reason for File's Owner's existence.

 From
 http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaFundamentals/CoreAppArchitecture/chapter_7_section_8.html
 (the first hit on Google for cocoa file's owner):

 You use the File's Owner object as the conduit for connections
 between objects in the nib file and objects outside of it.



which then point to *Further Reading:* You can find out more about nib
files (including how to dynamically load them) by reading *Resource
Programming 
Guidehttp://developer.apple.com/documentation/Cocoa/Conceptual/LoadingResources/index.html#//apple_ref/doc/uid/1051i
*which explains the anatomy of a nib file:

About the File's Owner

One of the more important concepts to understand when building your nib
files is what the File's Owner object represents. In Interface Builder, the
File's Owner object that appears in the nib document window is a proxy for
an object that your application will provide at runtime. When you
subsequently load a nib file into your application, your code can specify an
actual object to take the place of the File's Owner proxy. When you do, any
nib file connections to File's Owner are automatically made to the object
you provide (assuming it has the correct outlets and actions).

The File's Owner object is one of the primary connections your application
has to the contents of a nib file. File's Owner can be any object in your
application but is most often set to the controller object that manages the
corresponding user interface objects in the nib file. By using File's Owner
in this way, you can isolate the details of your user interface to your
controller object and let it manage the interactions with other parts of
your application.


Indeed, there is no clue ;-)

-- 

Julien
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: adding Quicklook preview to my app

2008-04-20 Thread Julien Jalon
If your document's format is a document bundle, just make sure to save your
PDF preview inside your document's bundle in a folder names QuickLook.
The preview should be named Preview.pdf
The thumbnail should be named Thumbnail.png (or jpg, or whatever format
suites you)

If you can't do that, you will have to write a Quick Look plug-in.

-- 
Julien

On Thu, Apr 17, 2008 at 10:07 PM, Victor Bovio [EMAIL PROTECTED]
wrote:

 Hi,

 I have a document based Cocoa app (CAD-like), to which I like to add the
 Leopard quicklook plugin feature.
 I tried first looking at the Documentation, but looks overwhelming to me,
 is there a simple tutorial or examples somewhere I can look at ??
 Basically I just want to embed a snapshot view (either PDF or Bitmap) to
 the saved documents and use that for the quicklook... I appreciate any hints
 on where to start with something as simple as possible.

 Thanks!

 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unable to access an instance properties and methods

2008-03-19 Thread Julien Jalon
I'd bet the firstNote object is not a DBNNote instance but an NSString
instance.

On Wed, Mar 19, 2008 at 5:33 PM, Davide Benini [EMAIL PROTECTED]
wrote:

 Hello folks.
 I receive an exception message and my application exits whenever I try
 to access properties or methods of an instance of DBNNote, a custo
 made class.
 Here is the code:

 DBNNote *firstNote= [[tune body] objectAtIndex:0];
 NSLog(@%@, firstNote);
 NSLog(@%@, [firstNote accident]);

 And this is the exception:

 2008-03-19 17:19:30.957 cocoabc[10832:10b] Note: A flat Octave: 6
 Duration: 3.00
 2008-03-19 17:19:30.957 cocoabc[10832:10b] *** -[NSCFString accident]:
 unrecognized selector sent to instance 0x33b040
 2008-03-19 17:19:30.958 cocoabc[10832:10b] An uncaught exception was
 raised
 2008-03-19 17:19:30.958 cocoabc[10832:10b] *** -[NSCFString accident]:
 unrecognized selector sent to instance 0x33b040
 2008-03-19 17:19:30.959 cocoabc[10832:10b] *** Terminating app due to
 uncaught exception 'NSInvalidArgumentException', reason: '*** -
 [NSCFString accident]: unrecognized selector sent to instance 0x33b040'
 2008-03-19 17:19:30.959 cocoabc[10832:10b] Stack: (
 2505978443,
 2451210491,
 2506007626,
 2506000972,
 2506001170,
 13259,
 8495,
 2506037845,
 2490420930,
 2490380524,
 2490378829,
 2490377872,
 2490377678,
 2490376830,
 8372,
 8298
 )

 The Debugger has exited due to signal 5 (SIGTRAP).The Debugger has
 exited due to signal 5 (SIGTRAP).


 As you see the first line of the exception message correctly logs
 [firstNote description].
 The second NSLog should print flat.
 So it appears the object is correctly instantiated, yet I cannot
 access its methods. I have tried to call both methods and properties
 accessors, but no call works so far. I have a feeling I am making a
 very basic mistake, but I can't tell which one.
 Any suggestion?
 Davide
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: warning: assignment from distinct Objective-C type

2008-03-11 Thread Julien Jalon
1) All init methods should return (id) not a specific class2) your
initWithDelegate: is likely too generic as a name and its signature
conflicts with an other one.

Since [XMPPStream alloc] is typed id, the compiler might not be sure of what
method signature you want to use for -initWithDelegate:

In the second case, the compiler knows you are using -[XMPPStream
initWithDelegate:]

I tend to remember that the compiler warning was more specific before
Leopard, maybe a regression.

Nonetheless, good coding style should lead you to rename your method to:

- (id)initXMPPStreamWithDelegate:(id)aDelegate;

instead of:

- (XMPPStream *)initWithDelegate:(id)aDelegate;

-- 
Julien

On Tue, Mar 11, 2008 at 9:19 AM, Stuart Malin [EMAIL PROTECTED] wrote:

 I have a line of code:

xmppStream = [[XMPPStream alloc] initWithDelegate:self];

 That when compiled, receives a warning:

 warning: assignment from distinct Objective-C type

 Now, what's odd to me, is if I change the source code to this:

xmppStream = [XMPPStream alloc];
[xmppStream initWithDelegate:self];

 It compiles without any warning.

 The interface for the XMPPStream initializer is:

- (XMPPStream*) initWithDelegate:(id)initialDelegate;

 And, in the file that is allocating and initializing, the xmppStream
 variable is defined as:

XMPPStream  *xmppStream;

 So I don't see any reason that I should get the warning.
 Any clues about why this happens would be appreciated.
 I'm sure I must be overlooking something obvious...

 This is happening with Xcode 2.4.1

 [I have posted to both Cocoa and Xcode because I have no idea which
 list would be better for this]



 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: warning: assignment from distinct Objective-C type

2008-03-11 Thread Julien Jalon
It depends on what you mean by bad... it is clearly bad Cocoa coding style
(*). It also lead to a lot of typing problems when subclassing you classes.
If the compiler can't decide which methods your code is referring to, it can
end up use the wrong signature producing incorrect code.
For example, suppose you have the two following methods:

- (id)initWithValue:(float)value;

- (id)initWithValue:(int)value;

If the compiler uses the wrong method, the underlying method implementation
will be called with a float parameter while expecting a int or vice-versa.

-- 
Julien

Note that this coding style exists mainly to work-around the ObjC
declaration limitations.

On Tue, Mar 11, 2008 at 7:03 PM, Stuart Malin [EMAIL PROTECTED] wrote:

 Brilliant Julien!  Thank you!
 I had always been curious why initializers returned id, since their return
 could be made specific to the class.

 I've been doing what I've done in many classes, and some give me grief,
 and not others.

 Both of your assessments are correct.

 To validate #1, if I change the offending line of code to do a cast:

 xmppStream = [(XMPPStream*)[XMPPStream alloc] initWithDelegate:self];

 the warning goes away. Of course, that's ugly and I won't retain that code
 change because the deeper problem is exactly what you refer to in item #2 --
 I do have more than one class with the same initializer signature. I'd
 thought the compiler would choose the right one because I'd
 naively presumed that [className alloc]  returned an instance in that
 class, not an object of type id.

 This is  probably why I had to cast in my initializer:

 - (XMPPStream*) initWithDelegate:(id)initialDelegate
 {
 self = (XMPPStream*)[super init];

 If I change my initializer method name as you suggest  so that it has a
 unique signature,

 - (XMPPStream*) initXMPPStreamWithDelegate:(id)initialDelegate;

 and the creation of an instance accordingly:

 xmppStream = [[XMPPStream alloc] initXMPPStreamWithDelegate:self];

 all now compiles cleanly.

 Now, the question is: is it bad to continue doing what I've been doing in
 having the initializer interface defined to not return id but an instance of
 the actual class?  Or would my continuing to do this merely be a
 non-conventional coding style?

 --Stuart

 On Mar 10, 2008, at 11:16 PM, Julien Jalon wrote:

 1) All init methods should return (id) not a specific class2) your
 initWithDelegate: is likely too generic as a name and its signature
 conflicts with an other one.

 Since [XMPPStream alloc] is typed id, the compiler might not be sure of
 what method signature you want to use for -initWithDelegate:

 In the second case, the compiler knows you are using -[XMPPStream
 initWithDelegate:]

 I tend to remember that the compiler warning was more specific before
 Leopard, maybe a regression.

 Nonetheless, good coding style should lead you to rename your method to:

 - (id)initXMPPStreamWithDelegate:(id)aDelegate;

 instead of:

 - (XMPPStream *)initWithDelegate:(id)aDelegate;

 --
 Julien

 On Tue, Mar 11, 2008 at 9:19 AM, Stuart Malin [EMAIL PROTECTED]
 wrote:

  I have a line of code:
 
 xmppStream = [[XMPPStream alloc] initWithDelegate:self];
 
  That when compiled, receives a warning:
 
  warning: assignment from distinct Objective-C type
 
  Now, what's odd to me, is if I change the source code to this:
 
 xmppStream = [XMPPStream alloc];
 [xmppStream initWithDelegate:self];
 
  It compiles without any warning.
 
  The interface for the XMPPStream initializer is:
 
 - (XMPPStream*) initWithDelegate:(id)initialDelegate;
 
  And, in the file that is allocating and initializing, the xmppStream
  variable is defined as:
 
 XMPPStream  *xmppStream;
 
  So I don't see any reason that I should get the warning.
  Any clues about why this happens would be appreciated.
  I'm sure I must be overlooking something obvious...
 
  This is happening with Xcode 2.4.1
 
  [I have posted to both Cocoa and Xcode because I have no idea which
  list would be better for this]
 
 
 
  ___
 
  Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
  Please do not post admin requests or moderator comments to the list.
  Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
  Help/Unsubscribe/Update your Subscription:
  http://lists.apple.com/mailman/options/cocoa-dev/jjalon%40gmail.com
 
  This email sent to [EMAIL PROTECTED]
 



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [iPhone] xml parsing

2008-03-10 Thread Julien Jalon
I'm pretty sure you read the SDK release notes ;-)
If not, I think you should, that's always a good idea.

-- 
Julien

On Mon, Mar 10, 2008 at 11:49 PM, Simon Fell [EMAIL PROTECTED] wrote:

 The iPhone docs point you in the direction of libXML2 for parsing XML,
 yet the headers for NSXML are included in the SDK headers, and i was
 able to build and run fine using NSXMLDoc/element/node. (in fact i
 just dropped my existing NSXML based code into a iPhone project and it
 worked fine, so it never even occurred to me that this might not be
 supported).  Would this constitute using a private API ? (is there a
 good definition of private API somewhere?)

 Tx
 Simon
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: [iPhone] xml parsing

2008-03-10 Thread Julien Jalon
I can't comment on the iPhone part as this is NDA (and should not be
discussed here) but, on Mac OS X, I'd add /usr/include/libxml2 to the header
search path in project (or target) build settings.
Also, I'd add the libxml2.dylib to my project using Add existing framework
or add -lxml2 to the additional linker flags of project (or target) build
settings.

Of course, this only describes what I'd do for a Mac OS X project in Xcode.

-- 
Julien

On Tue, Mar 11, 2008 at 1:33 AM, Jacob Bandes-Storch [EMAIL PROTECTED]
wrote:

 On a similar-ish note, I'm having trouble using libxml. I'm using a
 slightly modified version of the appropriate sample code. I need to
 make sure that the library is in my project. Since I couldn't find the
 library in a convenient place (where are you supposed to get those
 anyway?), I just dragged it from the sample project to mine. However,
 when I try to build the project, it says it cannot locate libxml or
 libxml/tree.h or whatever I import. I can't find any significant
 differences in the projects' properties... does anyone know how to get
 this working?

 On Mar 10, 2008, at 4:46 PM, [EMAIL PROTECTED] wrote:

  If you find a function/method/class declaration in a public header (an
  header that is not in PrivateHeader folder) you can problably
  considere it as public.
 
 
  Le 10 mars 08 à 23:49, Simon Fell a écrit :
 
  The iPhone docs point you in the direction of libXML2 for parsing
  XML, yet the headers for NSXML are included in the SDK headers, and
  i was able to build and run fine using NSXMLDoc/element/node. (in
  fact i just dropped my existing NSXML based code into a iPhone
  project and it worked fine, so it never even occurred to me that
  this might not be supported).  Would this constitute using a private
  API ? (is there a good definition of private API somewhere?)
 
  Tx
  Simon
 
 
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: localizable strings file with macro

2008-03-04 Thread Julien Jalon
1) Might not be a good idea to use CFStringGetCStringPtr as it might return
NULL2) kCFStringEncodingMacRoman is likely not a good choice as the
encoding, especially for localized strings

If I were you, I'd do something like (warning: Mail compiled code):
const char* MyGetLocalizedCString(CFStringRef string)
{
// if you need to be thread safe, add proper locks around that
static CFMutableDictionaryRef mapping = NULL;
if(mapping == NULL) {
mapping = CFDictionaryCreateMutable(NULL, 0,
kCFTypeDictionaryKeyCallBacks, NULL);
}

const char* result = (const char *)CFDictionaryGetValue(mapping,
string);
if(result == NULL) {
 CFStringRef localizedString = CFCopyLocalizedStringFromTable(string,
CFSTR(LibraryLocalizable), NULL);
 result = (const char
*)malloc(CFStringGetMaximumSizeForEncoding(CFStringGetLength(localizedString),
kCFStringEncodingUTF8);
CFStringGetCString(localizedString, (char *)result, bufferSize,
kCFStringEncodingUTF8);
CFDictionarySetValue(mapping, string, result);
}

return result;
}

And use that as you localizing function:
#define _(a) MyGetLocalizedCString(CFSTR(a))

Even better, if you can change that, add an extra parameter to your
localizing macro and give it a better name:
#define _loc(a, comment) MyGetLocalizedCString(CFSTR(a))

This keeps your code portable and you should be able to replace the
occurrences of _ in all your code fairly easily with a search and replace.
Added value is:
A) it makes your code more readable (IMHO)
B) it adds a proper way to explain the context of the localization
C) you can generate your strings file directly using genstrings:

genstrings -s _loc *.c -o /tmp ; mv /tmp/Localized.strings
path/LibraryLocalizable.strings

If you really can't do that, preprocess your files before launching
genstrings and call use -s MyGetLocalizedCString

-- 
Julien

On Tue, Mar 4, 2008 at 3:53 AM, Mitchell Livingston [EMAIL PROTECTED]
wrote:

 Hello,

 I have C code that I want to generate a strings file for use on Mac. I
 use:

 #if defined(SYS_DARWIN)
   #include CoreFoundation/CFBundle.h
   #define _(a) CFStringGetCStringPtr(CFCopyLocalizedStringFromTable( \
CFSTR( a ), CFSTR(LibraryLocalizable), comment ),
 kCFStringEncodingMacRoman)
 #else
 ...

 Unfortunately genstrings does not seem to compile the code before
 attempting to create the strings file. Is there some way to generate a
 string file while still considering that the code will also be run on
 other operating systems that generate localizable strings in different
 ways?

 Thanks,
 Mitchell Livingston
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]