Based on the Apple documentation I came up with the following method
to switch between controllers in a containment controller.
But when there is an oldC I am getting "Unbalanced calls to begin/end
appearance transitions for <...>" on the console.
- (void) showController:(UIViewController*)newC
w
Hi,
Is there anyway to get the high memory mark programatically? e.g. the maximum
amount of memory used up to this point in time.
Thanks a lot
Dave
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderato
On Thu, Apr 24, 2014 at 6:22 AM, Torsten Curdt wrote:
> Based on the Apple documentation I came up with the following method
> to switch between controllers in a containment controller.
>
> But when there is an oldC I am getting "Unbalanced calls to begin/end
> appearance transitions for <...>" o
> Try it again without this addSubview call.
I totally missed that
"transitionFromViewController:toViewController:duration:options:animations:completion:"
also adds the view!
Thanks you so much! Problem solved.
___
Cocoa-dev mailing list (Cocoa-dev@lis
Hello Cocoa-Meisters,
My Document-based OS X program is parsing huge ASCII data files in an
NSOperationQueue, and then displays the data in a graph.
It works, however I've seen 2 different approaches to update the User-Interface
(UI) after the NSOperation has finished (please check code below)
I was just asked yesterday if there is any shorthand in Objective-C for "if
this thing = nil, then instantiate a new instance from the class"
Something like this:
NSString x;
if ([x isEqualtoString:nil]) {
x = @"yo";
}
Feel free to replace NSString with any class.
And we messed around a
Usually, I would access such variables as properties that are lazy loaded, in
which case the accessing code is simply:
self.x …
and the accessor is
- (NSString *) x {
if (!_x) {
_x = @“yo”;
}
return _x;
I guess my real question is "can we substitute the ternary operator for your if
statement and if not, why?"
Thanks man.
On Apr 24, 2014, at 10:53 AM, Raheel Ahmad wrote:
> Usually, I would access such variables as properties that are lazy loaded, in
> which case the accessing code is simply:
>
Not native and I've no idea when or if this is a good idea ... nor am I sure
how much typing you want to do ... but you _could_ create a class convenience
method for this
x = [Thing defaultIfNil:x];
With shorter or longer names as you see fit ... down to possibly:
x = [Thing :x]
I've
On Apr 24, 2014, at 11:12 AM, Luther Baker wrote:
> Not native and I've no idea when or if this is a good idea ... nor am I sure
> how much typing you want to do ... but you _could_ create a class convenience
> method for this
>
>x = [Thing defaultIfNil:x];
>
> With shorter or longer name
On Wed, 23 Apr 2014 20:16:22 -0500, Ken Thomases said:
>As far as I understood the original issue, it's that the
>cursor is set via tracking areas and -cursorUpdate: on one view but -
>mouseMoved: is being called on a different view. Sean wants Cocoa to be
>consistent about which view is asked to
well not if it's actually
x = (x) ?: @"yo";
but
x = (x) ? x : @yo" ;
seems to be fine.
nil is defined to be 0, 0x0, any other kind of zero you like.
I don't like bools not being bools so I'd personally do
x = (!x) ? @"yo" : x;
or
x = (!!x) ? x : @"yo"
On Apr 24, 2014, at 10:33 AM, Alex Zavatone wrote:
> I was just asked yesterday if there is any shorthand in Objective-C for "if
> this thing = nil, then instantiate a new instance from the class"
>
> Something like this:
>
> NSString x;
>
> if ([x isEqualtoString:nil]) {
>x = @"yo";
> }
On Apr 24, 2014, at 11:14 AM, Alex Zavatone wrote:
>
> On Apr 24, 2014, at 11:12 AM, Luther Baker wrote:
>
>> Not native and I've no idea when or if this is a good idea ... nor am I sure
>> how much typing you want to do ... but you _could_ create a class
>> convenience method for this
>>
>
On Apr 24, 2014, at 9:21 AM, Roland King wrote:
> well not if it's actually
>
> x = (x) ?: @"yo";
Actually, that will work just fine. Personally, I'd leave off the extraneous ():
x = x ?: @"yo";
While we're on the subject of obscurities of the ternary operator, if you
really want to
thanks graham,
i sent performSelectorOnMainThread from readFromURL & the message succeeded,
but visually i got the same result: the window did not show until the document
window showed. i fear apps may simply not show windows at this point in the
load.
my syntax for the test:
[self performSel
i’m probably missing something, but—
the controls appear sufficiently displaced from the rendering: can’t you
decease the height of your tracking rect in order to inhibit mouseMoved in this
region?
On Apr 24, 2014, at 11:20 AM, Sean McBride wrote:
> On Wed, 23 Apr 2014 20:16:22 -0500, Ken Tho
On Apr 24, 2014, at 7:33 AM, Alex Zavatone wrote:
> And we messed around a bit looking for any shorthand and though it looked
> like a terrible idea since the comparison is done against integers using the
> ternary operator, I'd like to know exactly why it's a terrible idea.
> NSString x;
> x
On Thu, 24 Apr 2014 12:12:12 -0400, edward taffel said:
>i’m probably missing something, but—
>the controls appear sufficiently displaced from the rendering: can’t you
>decease the height of your tracking rect in order to inhibit mouseMoved
>in this region?
I'd need two rects, one for the bulk,
you hit test in mouseMoved for the rollovers in the OpenGL view, yes? so, the
issue, as i see it, is inhibiting mouseMoved in the region of the controls: is
it the case that when the OpenGLView is wide that you may render to the right
of the controls? or, is there always that margin at the top?
On Apr 24, 2014, at 8:21 AM, Roland King wrote:
> well not if it's actually
> x = (x) ?: @"yo";
> but
> x = (x) ? x : @yo" ;
No; “a ?: b” is legal syntax in GCC and Clang*. It’s equivalent to “a ? a : b”.
I don’t think it’s made its way into a C standard yet, but it’s so damn use
On Apr 24, 2014, at 11:21 AM, Roland King wrote:
> well not if it's actually
>
> x = (x) ?: @"yo";
>
> but
>
> x = (x) ? x : @yo" ;
>
> seems to be fine.
>
> nil is defined to be 0, 0x0, any other kind of zero you like.
>
> I don't like bools not being bools so I'd personally
On Apr 24, 2014, at 12:44 PM, Jens Alfke wrote:
>
> On Apr 24, 2014, at 7:33 AM, Alex Zavatone wrote:
>
>> And we messed around a bit looking for any shorthand and though it looked
>> like a terrible idea since the comparison is done against integers using the
>> ternary operator, I'd like t
On Mar 26, 2014, at 5:05 AM, Fritz-Ulrich Siewert wrote:
> I'm writing an application to monitor disk i/o in OSX. Most work is done, but
> now I'm stuck: I cannot find a way to distinguish between a real, physical
> volume (i.e. the SSD and the hard disk in my fusion drive) and some mounted,
>
On Thu, 24 Apr 2014 09:44:42 -0700, Jens Alfke said:
>> NSString x;
>> x = (x) ?: @"yo";
>
>It’s not a terrible idea; I use this pattern a lot.
>
>The ternary operator doesn’t just work on integers. It’s like “if”, it
>takes any expression that can be interpreted as a boolean. For a pointer
>the t
On Apr 24, 2014, at 08:20 , Sean McBride wrote:
> Tracking areas are nice, but limited to rects, and I have circular areas to
> deal with too.
Not really. According to the event handling guide, if a responder's
cursorUpdate: declines the event (by invoking super), the event passes up the
resp
On Apr 24, 2014, at 9:53 AM, Alex Zavatone wrote:
> What worried me was that I've never seen this used in Objective-C in this
> manner. I've always used the ? operator to color the backgrounds of cells
> with alternating row colors. It seemed like a stretch to actually use it to
> achieve laz
On Apr 24, 2014, at 8:48 AM, Scott Ribe wrote:
> On Apr 24, 2014, at 9:21 AM, Roland King wrote:
>
>> well not if it's actually
>>
>> x = (x) ?: @"yo";
>
> Actually, that will work just fine. Personally, I'd leave off the extraneous
> ():
>
> x = x ?: @"yo";
>
> While we're on the
On Apr 24, 2014, at 9:48 AM, Scott Ribe wrote:
> (foo ? x : y) = @"yo";
Darn it, C++ once again infected a post of mine ;-)
--
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice
___
Cocoa-dev mailing list (C
On Apr 24, 2014, at 06:47 , Gilles Celli wrote:
> 1. With KVO in a Controller object: Observing the NSOperation's "isFinished"
> value and then in observeValueForKeyPath:ofObject:change:context:
>update the UI (graph display) on the main thread with
> performSelectorOnMainThread:withObject
Ok thank you very much for the clarification, it's much clearer now for me.
So I will stick with KVO, as you wrote.
Cheers,
Gilles
On 24 avr. 2014, at 19:38, Quincey Morris
wrote:
> On Apr 24, 2014, at 06:47 , Gilles Celli wrote:
>
>> 1. With KVO in a Controller object: Observing the NSOpe
In Smalltalk, where nil is an object like everything else, and we were working
with calls out to C APIs that had a lot of required parameters, we added an
"orIfNil:" that was very useful:
foo := bar orIfNil:10.
Nil
orIfNil:other
^other
Object
orIfNil:other
^self
It would be useful in ObjC if
Could we throw a category on NSObject for that and then every class that
originates with NSObject gets that lovely method?
Agree on the clunky bit, but so is using the @ compiler directive to accomplish
everything that couldn't be fit in in the first place. Not as if I know a
better way to do
On Apr 24, 2014, at 2:10 PM, Alex Zavatone wrote:
> Could we throw a category on NSObject for that and then every class that
> originates with NSObject gets that lovely method?
What's wrong with the simple straightforward C way???
--
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-
I'm looking for a way to determine the ambient light level for a program
simulating an electronic circuit involving a solar cell (photovoltaic cell),
where the output voltage will be set based on the measured ambient light level.
It looks like recent iMac and MacBook Pro models have a way to bri
That won't do any good, since if the receiver is nil, it'll return nil (since
nil isn't an object like it is in Smalltalk)
So the only place where it actually gets called will be the places that don't
need it.
On Apr 24, 2014, at 3:10 PM, Alex Zavatone wrote:
> Could we throw a category on N
On Apr 24, 2014, at 4:10 PM, Alex Zavatone wrote:
> Could we throw a category on NSObject for that and then every class that
> originates with NSObject gets that lovely method?
Not exactly, because unlike Smalltalk's nil, Objective-C's nil is *not* an
object. But you could switch it around:
On Apr 24, 2014, at 5:00 PM, Scott Ribe wrote:
> What's wrong with the simple straightforward C way???
One improvement might be if there was a ?:= conditional assignment operator.
Just as
x += y; is the same as x = x + y;
and likewise for other binary operators, you could have
x ?:= y; be
On Apr 24, 2014, at 14:10 , William Squires wrote:
>iii) Averages all the pixels to come up with a (rough) gauge of ambient
> light level (as an unsigned byte) - preferably by using the graphics
> coprocessor to unload the task from the main CPU!
Might be hard; I suspect the camera's auto
I hadn't known about the "foo ?: something" when I was thinking of macros -
it's much closer to an orIfNil: than "foo ? foo : something"
An orIfNull: for NSObject and NSNull might be nice for those times when you put
placeholders in dictionaries.
On Apr 24, 2014, at 2:21 PM, Andy Lee wrote:
>
On Apr 24, 2014, at 14:21 , Andy Lee wrote:
> I still don't see how
>
> foo = [@"Something" fallbackIfNil:foo];
>
> has any advantage over
>
> foo = foo ?: @"Something";
I don’t see how the latter has any advantage over your earlier suggestion [more
or less]:
if (!foo)
On Apr 24, 2014, at 5:39 PM, Lee Ann Rucker wrote:
> An orIfNull: for NSObject and NSNull might be nice for those times when you
> put placeholders in dictionaries.
For that you really only need a method in one place. I'd be inclined to put it
in NSNull:
+ (id)nullIfNil:(id)obj
{
return o
That's the flip side of what I was thinking about, but also useful. I was
thinking about the code that receives the dictionary:
- (void)processDictionary:(NSDictionary *)d
{
foo = [[d valueForKey:@"foo"] orIfNull:fooDefault];
...
On Apr 24, 2014, at 2:56 PM, Andy Lee wrote:
> On Apr 24, 201
On Apr 24, 2014, at 6:03 PM, Lee Ann Rucker wrote:
> That's the flip side of what I was thinking about, but also useful. I was
> thinking about the code that receives the dictionary:
>
> - (void)processDictionary:(NSDictionary *)d
> {
> foo = [[d valueForKey:@"foo"] orIfNull:fooDefault];
> ...
On Apr 24, 2014, at 5:45 PM, Quincey Morris
wrote:
> On Apr 24, 2014, at 14:21 , Andy Lee wrote:
>
>> I still don't see how
>>
>> foo = [@"Something" fallbackIfNil:foo];
>>
>> has any advantage over
>>
>> foo = foo ?: @"Something";
>
> I don’t see how the latter has any advantage over your
"Engineering has determined that your bug report (16683382) is a duplicate of
another issue (10109782) and will be closed."
.. that wasn't very worthwhile was it.
On 22 Apr, 2014, at 12:49 pm, Roland King wrote:
> There you go. 16683382
>
> On 22 Apr, 2014, at 2:55 am, Greg Parker wrote:
>
On Apr 24, 2014, at 5:21 PM, Andy Lee wrote:
>
> On Apr 24, 2014, at 4:10 PM, Alex Zavatone wrote:
>
>> Could we throw a category on NSObject for that and then every class that
>> originates with NSObject gets that lovely method?
>
> Not exactly, because unlike Smalltalk's nil, Objective-C's
Thanks for the bug report. If you could see rdar://10109782, you'd see that
your report prompted a new discussion about the priority and schedule for this
bug.
On Apr 24, 2014, at 4:09 PM, Roland King wrote:
> "Engineering has determined that your bug report (16683382) is a duplicate of
> an
On 25 Apr 2014, at 1:59 am, edward taffel wrote:
> thanks graham,
>
> i sent performSelectorOnMainThread from readFromURL & the message succeeded,
> but visually i got the same result: the window did not show until the
> document window showed. i fear apps may simply not show windows at this
Sorry - got out of bed the wrong side this morning. I'm happy the bug report
was of some use. Leaks is a great tool, especially the graph, would be a shame
if what seem like relatively small bugs lead to the impression that "it just
doesn't work right". Perhaps few people are as KVO junkie as me
On a more positive note, thanks to yours and others help, I’ve sorted my Memory
issues.
I got rid of the leaks (most if not all!), after that running a download test,
showed that memory peaked at 150+ MB.
After fishing about and changing every method in the call chain to conform to
new/alloc n
there’s no point in doing any work if the window doesn’t show—which does not
occur.
On Apr 24, 2014, at 8:46 PM, Graham Cox wrote:
>
> On 25 Apr 2014, at 1:59 am, edward taffel wrote:
>
>> thanks graham,
>>
>> i sent performSelectorOnMainThread from readFromURL & the message succeeded,
>>
Yesterday, I got the view for the NSToolbarItem to show the desired image by
putting the set image code for the button in the toolbar item’s validate()
method, then setting the toolbar item’s view to the button in that method.
However, now when I click the toolbar item in the app, the action doe
On Apr 24, 2014, at 10:23 PM, "Peters, Brandon" wrote:
> Yesterday, I got the view for the NSToolbarItem to show the desired image by
> putting the set image code for the button in the toolbar item’s validate()
> method, then setting the toolbar item’s view to the button in that method.
> Howev
> On Apr 24, 2014, at 5:34 PM, Rick Mann wrote:
>
>
>> On Apr 24, 2014, at 14:10 , William Squires wrote:
>>
>> iii) Averages all the pixels to come up with a (rough) gauge of ambient
>> light level (as an unsigned byte) - preferably by using the graphics
>> coprocessor to unload the tas
Andy,
I get the name of the custom NSToolbarItem, which I should get.
On Apr 24, 2014, at 10:41 PM, Andy Lee wrote:
> On Apr 24, 2014, at 10:23 PM, "Peters, Brandon" wrote:
>> Yesterday, I got the view for the NSToolbarItem to show the desired image by
>> putting the set image code for the bu
Try setting the target/action on the button rather than the toolbar item.
--Andy
On Apr 24, 2014, at 10:47 PM, "Peters, Brandon" wrote:
> Andy,
>
> I get the name of the custom NSToolbarItem, which I should get.
>
> On Apr 24, 2014, at 10:41 PM, Andy Lee wrote:
>
>> On Apr 24, 2014, at 10:2
I’m writing an Objective-C API around a database library, and trying to add
some optimizations. There’s a lot of room for parallelizing, since tasks like
indexing involve a combination of I/O-bound and CPU-bound operations. As a
first step, I made my API thread-safe by creating a dispatch queue
Andy,
My button is inside the customer toolbar item, if I make the button an outlet,
how will I connect to it in IB?
On Apr 24, 2014, at 10:55 PM, Andy Lee wrote:
> Try setting the target/action on the button rather than the toolbar item.
>
> --Andy
>
> On Apr 24, 2014, at 10:47 PM, "Peters,
On 25 Apr 2014, at 12:19 pm, edward taffel wrote:
> there’s no point in doing any work if the window doesn’t show—which does not
> occur.
Well, without looking at your code in detail, who can say (other than you) why
that is?
--Graham
___
Coco
Follow-up: I tried replacing every instance of
dispatch_sync(_queue, ^{ … });
with
@synchronized(self) { … }
Things got faster again — looks like @synchronized is a few percent slower than
no thread-safety, but _significantly_ faster than dispatch_sync. Which seems to
contradict
On Apr 24, 2014, at 10:14 PM, Jens Alfke wrote:
> I’m writing an Objective-C API around a database library, and trying to add
> some optimizations. There’s a lot of room for parallelizing, since tasks like
> indexing involve a combination of I/O-bound and CPU-bound operations. As a
> first step
On 25 Apr 2014, at 11:24 am, Dave wrote:
> I always knew autorelease was bad news!
No it isn't, at least not inherently. But if you don't properly understand it
then it can bite you. You've trodden this path before, and I don't want to
rehash all that, but you were wrong then as well. If you
On Apr 24, 2014, at 11:15 PM, "Peters, Brandon" wrote:
> My button is inside the customer toolbar item, if I make the button an
> outlet, how will I connect to it in IB?
You can do it in code when you set it up. See setAction: and setTarget:.
I don't know for sure if that'll work -- it's the o
On Apr 24, 2014, at 8:42 PM, Ken Thomases wrote:
> You may be aware of this, but dispatch_sync() is not necessary or even
> particularly relevant to thread-safety. The use of a serial queue or,
> possibly, a reader/write mechanism using barriers, is what achieves thread
> safety.
Initial ex
What’s the CPU utilization? Are you actually getting full use of them, or are
your threads blocked waiting for something?
On Apr 24, 2014, at 11:14 PM, Jens Alfke wrote:
> I’m writing an Objective-C API around a database library, and trying to add
> some optimizations. There’s a lot of room fo
On Apr 24, 2014, at 9:04 PM, Dave Fernandes wrote:
> What’s the CPU utilization? Are you actually getting full use of them, or are
> your threads blocked waiting for something?
Fairly high — I think 175% or so (out of 200% possible). The problem is that a
large fraction of that is taken up wi
It comes from a third .a file, how can I disable this warning, or how
can i depress all warnings from a single .a file? thanks
___
Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
Please do not post admin requests or moderator comments to the list.
I tried and nothing. The IBOutlet is on the NSToolbarItem custom class. Here is
my custom class:
@interface RBSStopButtonToolbarItem : NSToolbarItem
{
NSButton *_button;
}
@property (readwrite) NSButton *button;
@end
@implementation RBSStopButtonToolbarItem
@synthesize button = _button;
Is there any way to batch up more work to do in each block? Then your ratio of
real work to overhead would go up.
On Apr 25, 2014, at 12:35 AM, Jens Alfke wrote:
>
> On Apr 24, 2014, at 9:04 PM, Dave Fernandes
> wrote:
>
>> What’s the CPU utilization? Are you actually getting full use of th
On Apr 24, 2014, at 20:14 , Jens Alfke wrote:
> On my MacBook Pro this gave me a nice speedup of 50% or more.
>
> But when I tested the code on my iPhone 5 today, I found performance had
> dropped by about a third.
> I know that dispatch queues aren’t free, but I wasn’t expecting them to be
>
On Apr 24, 2014, at 10:30 PM, Quincey Morris
wrote:
> Approaching this naively, this result suggests that the block content, while
> not trivial, is too fine-grained — is divided too finely. For example, if
> you’re putting (essentially) one database read/write operation (or even a
> handful
On Apr 24, 2014, at 22:49 , Jens Alfke wrote:
> It is, but most of it appears to be memory management _caused_ by GCD, since
> it goes away when I replace the dispatch calls with @synchronized. GCD is
> apparently causing a lot of blocks to get copied to the heap.
Well, you know what you’re se
Okay, I just brushed up a bit on toolbars (wow, it's been a *very* long time).
How did you create the instance of RBSStopButtonToolbarItem in the nib? From
the docs, I learned that you can drag a view (in your case a button) from the
IB palette into the Allowed Toolbar Items area. This should
74 matches
Mail list logo