Re: ARC and autorelease pools

2014-02-17 Thread Marcel Weiher

On Feb 17, 2014, at 2:08 , Clark Smith Cox III clark@apple.com wrote:

 I didn't say take them out. I said why do they need to return an 
 autoreleased object.
 
 Because they always have, and their semantics cannot be changed without 
 breaking decades worth of non-ARC code.

Sort of like the way GC did, where you had to have 2 versions of every 
framework, the GC version and the non-GC version.  If you had 2 versions of 
every framework and the compiler enforced a no autorelease rule, then you could 
have what you want.

However, one of the big points of ARC was to not require 2 versions of every 
framework, but instead provide compatibility between ARC and non-ARC code.  
Therefore all the old requirements for autorelease, which have been explained 
so well by various posters, apply.

Cheers,

Marcel

___

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

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

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

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

Re: ARC and autorelease pools

2014-02-17 Thread Kevin Meaney
Thanks to Marcel, John McCall, and Clark Smith Cox III for addressing the 
question I was trying to ask, apologies to others that the question was unclear.

So it seems that because ARC provides compatibility between ARC and non-ARC 
code unlike how garbage collection worked with duplicated frameworks is part of 
or even the main reason we can't get rid of autorelease.

My response to Roland's first reply to this thread was incorrect. I had 
forgotten the reason why I new that class methods like stringWithFormat return 
an autoreleased object. When I first learnt ARC in May last year I wrote a blog 
post covering my experiments of when an object stays alive and when it doesn't. 
I hadn't just assumed, I'd forgotten why I new.

In terms of crossing boundaries I find the result of TestArc9() interesting 
when passing a weak pointer into a function.

The last line of output from each test routine is at the end of the blog post 
if you want to test your understanding.

http://blog.yvs.eu.com/2013/05/experimental-arc/

Kevin

On 17 Feb 2014, at 08:08, Marcel Weiher marcel.wei...@gmail.com wrote:

 
 On Feb 17, 2014, at 2:08 , Clark Smith Cox III clark@apple.com wrote:
 
 I didn't say take them out. I said why do they need to return an 
 autoreleased object.
 
 Because they always have, and their semantics cannot be changed without 
 breaking decades worth of non-ARC code.
 
 Sort of like the way GC did, where you had to have 2 versions of every 
 framework, the GC version and the non-GC version.  If you had 2 versions of 
 every framework and the compiler enforced a no autorelease rule, then you 
 could have what you want.
 
 However, one of the big points of ARC was to not require 2 versions of every 
 framework, but instead provide compatibility between ARC and non-ARC code.  
 Therefore all the old requirements for autorelease, which have been explained 
 so well by various posters, apply.
 
 Cheers,
 
 Marcel
 

___

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

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

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

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

Re: PDFPage init methods not called

2014-02-17 Thread jonat...@mugginsoft.com

On 14 Feb 2014, at 20:32, Antonio Nunes devli...@sintraworks.com wrote:

 On 14 Feb 2014, at 15:09, jonat...@mugginsoft.com wrote:
 
 PDFPage has two declared initialiser methods:
 
 - init
 - InitWithImage:(NSImage *)image
 
 When creating a PDFDocument with -initWithURL: neither of the above are 
 called on my PDFPage subclass.
 
 A bit of digging reveals that what is called is the undocumented:
 
 - (id)initWithPageRef:(id)pageRef
 
 This seems peculiar. Will defining an override on -initWithPageRef: count as 
 the use of private API?
 
 I suspect that this is just an oversight in the header.
 
 I would be highly surprised if using that method would not be considered use 
 of private API. The two public init methods are useful when you want to 
 create pages yourself. When opening a PDF document you’ll have to resort to 
 other options to perform custom setup of pages. Is there a particular reason 
 that you really need to be active during the init process?
Being active during the init stage is just the norm.
I personally haven’t encountered any other appkit class that doesn’t call a 
public initialiser as part of its initialisation.
Perhaps it is more common than I presume.

 I find that I can do whatever I need by iterating through a document’s pages 
 shortly after loading the document. You could declare a method on your 
 subclass, say “finishSetup”, and then call that on each page as you iterate 
 throughout the pages once you have obtained the document from initWithURL:.
 
I think that I will override -initWithURL: in my PDFDocument subclass and do a 
manual initialisation there.

Thanks

Jonathan
___

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

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

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

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

QTMovieLayer in IKImageBrowserCell

2014-02-17 Thread Dragan Milić
Is it possible to set a QTMovieLayer (yes, I know it's deprecated in 10.9) as 
the IKImageBrowserCellForegroundLayer of an IKImageBrowserCell? If I do so in 
cell's -layerForType: method and then play a movie associated with the layer, I 
can hear the audio track, but there's no movie rendering above cell's image.

-- Dragan
___

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

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

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

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

Paged UIScrollview is acting strange in iOS7?

2014-02-17 Thread Scott Andrew
I have some old gallery code that uses UIScrollView in a paged mode. We are 
trying to port the code to iOS7 but when we are getting strange behavior. In 
iOS7 we are constantly getting scrollViewDidScroll with weird offset of 
negative or some large offset that has huge exponents. Is there a known change 
in paged scrollviews in iOS7? Code is simple.  The image content size is hard 
coded at 20 pages. The reality is its dynamic based on images coming and going.

if (_imageScroller == nil) {
CGRect scollViewRect = self.bounds;
scollViewRect.size.width += IMAGE_PADDING;


_imageScroller = [[UIScrollView alloc] initWithFrame:scollViewRect];
CGSize contentSize = _imageScroller.bounds.size;
contentSize.width *= 20;
_imageScroller.contentSize = contentSize;
_imageScroller.pagingEnabled = YES;
_imageScroller.delegate = self;
_imageScroller.clipsToBounds = YES;
_imageScroller.showsVerticalScrollIndicator = NO;
_imageScroller.showsHorizontalScrollIndicator = NO;
_imageScroller.backgroundColor = [UIColor blueColor];

[self addSubview:_imageScroller];
}
___

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

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

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

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

auto layout, 10.9, and NSScrollView and friends

2014-02-17 Thread Rob Nikander
Hi,

Last year I did some work in Cocoa and discovered that the auto layout
stuff was not completely supported in some common AppKit classes. I
remember having problems with NSScrollView and NSOutlineView. This message
talks in detail about some issues with NSScrollView...

http://lists.apple.com/archives/cocoa-dev/2013/Mar/msg00274.html

It ends with the sentence Let's see what 10.9 brings.  So, I'm getting
back into Cocoa, and my question is: what did 10.9 bring? I did some
searching and don't see any encouraging release notes or announcements. Has
anything changed with this issue?  Constraint based layout seems really
cool, but it's odd that it doesn't work with such important AppKit classes.

If it's not working easily, do people get it to work with some extra
effort, or should I just avoid NSScrollView and the others, if I use auto
layout?

thanks,
Rob
___

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

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

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

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

Re: auto layout, 10.9, and NSScrollView and friends

2014-02-17 Thread Kyle Sluder
On Mon, Feb 17, 2014, at 05:48 PM, Rob Nikander wrote:
 Has
 anything changed with this issue?  Constraint based layout seems really
 cool, but it's odd that it doesn't work with such important AppKit
 classes.

Yes.

Xcode 5's new XIB format now exposes the scroll view's clip view. You
can create constraints between the document view and the clip view to
influence the size of the scrollable region, much like how it works in
iOS.

--Kyle Sluder
___

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

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

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

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

Re: OpenCL Basic Programming Question

2014-02-17 Thread Gerriet M. Denkmann

On 14 Feb 2014, at 21:53, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 I am trying to build the Basic Programming Sample in: 
 https://developer.apple.com/library/mac/documentation/Performance/Conceptual/OpenCL_MacProgGuide/ExampleHelloWorld/Example_HelloWorld.html#//apple_ref/doc/uid/TP40008312-CH112-SW2
 
 I have myKernel.cl:
 
 __kernel void squareq(  __global float* input, __global float* output )
 {
   int i = get_global_id(0);
   printf(i %d\n,i); //  never seen
   output[i] = input[i] * input[i];
 }  
 
 and myKernel.cl.h:
 
 void squareq_kernel( cl_ndrange *range, float* input,  float* output);
 
[...]
 
 What am I doing wrong?

Do NOT create your own myKernel.cl.h; do NOT add this file to Xcode.
If you did violate this rule (as I did), rename the file (and maybe change the 
name of the kernel as well) and start again.

Also I also removed the underscores in the kernel definition. Not sure whether 
this is necessary.

Maybe this might help someone.

Gerriet.



___

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

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

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

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

Re: Paged UIScrollview is acting strange in iOS7?

2014-02-17 Thread Scott Andrew
Seems our tool was not taking into account that the size needed to be halved 
out of our photoshop template. Some reason setting the frame and content size 
to 2x size of the view was causing the issue. One the scroll view was sized 
properly all is now working as expected.

Scott

On Feb 17, 2014, at 5:31 PM, Scott Andrew scottand...@roadrunner.com wrote:

 I have some old gallery code that uses UIScrollView in a paged mode. We are 
 trying to port the code to iOS7 but when we are getting strange behavior. In 
 iOS7 we are constantly getting scrollViewDidScroll with weird offset of 
 negative or some large offset that has huge exponents. Is there a known 
 change in paged scrollviews in iOS7? Code is simple.  The image content size 
 is hard coded at 20 pages. The reality is its dynamic based on images coming 
 and going.
 
 if (_imageScroller == nil) {
CGRect scollViewRect = self.bounds;
scollViewRect.size.width += IMAGE_PADDING;
 
 
_imageScroller = [[UIScrollView alloc] initWithFrame:scollViewRect];
CGSize contentSize = _imageScroller.bounds.size;
contentSize.width *= 20;
_imageScroller.contentSize = contentSize;
_imageScroller.pagingEnabled = YES;
_imageScroller.delegate = self;
_imageScroller.clipsToBounds = YES;
_imageScroller.showsVerticalScrollIndicator = NO;
_imageScroller.showsHorizontalScrollIndicator = NO;
_imageScroller.backgroundColor = [UIColor blueColor];
 
[self addSubview:_imageScroller];
}
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/scottandrew%40roadrunner.com
 
 This email sent to scottand...@roadrunner.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

gcl_create_dispatch_queue where is CL_DEVICE_TYPE_USE_DEVICE_ID

2014-02-17 Thread Gerriet M. Denkmann
gcl.h says: gcl_queue_flags can be a combination of the 
followingCL_DEVICE_TYPE_GPU, CL_DEVICE_TYPE_CPU or CL_DEVICE_TYPE_USE_DEVICE_ID 
[...]

The slides for wwdc 2011 session_401__whats_new_in_opencl also mention 
CL_DEVICE_TYPE_USE_DEVICE_ID.

The problem: I can find no definition for CL_DEVICE_TYPE_USE_DEVICE_ID.

What to do?

What I am trying to do: the user selects some cl_device_id, and I need a queue 
for this. Not just any CL_DEVICE_TYPE_GPU, but the one the user did select.

Does anybody use this stuff? Or should one wait until this is mature enough to 
have some documentation?

Gerriet.
 
___

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

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

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

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