Re: Cocoa class extension best practice

2013-10-16 Thread Charles Srstka
On Oct 15, 2013, at 11:13 PM, Steve Mills wrote: > On Oct 15, 2013, at 17:22:26, Graham Cox > wrote: > >> OK, so if that's the case, I'm interested in knowing whether each call to >> -itemArray returns the same object or a different one each time. If it's >> different, then it's either a copy

Re: Cocoa class extension best practice

2013-10-16 Thread Greg Parker
On Oct 15, 2013, at 9:13 PM, Steve Mills wrote: > Here's a typical stack for most of the calls to itemArray: > > 0 libsystem_c.dylib calloc > 1 libobjc.A.dylib _class_createInstanceFromZone > 2 libobjc.A.dylib _class_createInstance > 3 CoreFoundation __CFAllocateObject2 > 4 CoreFoundati

Re: Cocoa class extension best practice

2013-10-16 Thread Greg Parker
On Oct 16, 2013, at 12:31 AM, Charles Srstka wrote: > I ask because if you're not using NSApplication's run loop, you won't get an > automatic release pool, which would explain what you were seeing. On sufficiently-recent OS versions, the runtime will silently push an autorelease pool if you a

Re: Scrollable GridView with fixed row and column

2013-10-16 Thread Viacheslav Karamov
Tom, thanks a lot! 16.10.13, 09:19, BareFeetWare пишет: On 16 Oct 2013, at 5:05 am, Vyacheslav Karamov wrote: I need to implement Grid view for iOS 7 and newer. The users should have ability to scroll its contents both horizontally and vertically. They also should have ability to mark the ve

Re: Fastest way to do screen captures on OSX ?

2013-10-16 Thread Half Activist
Definitely not using CGWindowListCreateImage. In the past, inspired by some code, i wrote a screen capture test program using opengl, the trick was to declare a fullscreen context without a curtain window or setting it to transparent and then reading the pixels, and that was quite fast, on a G4

Re: Core Data with ODBC databases?

2013-10-16 Thread Mikael Hakman
I used the NSIncrementalStore to create an OdbcStore so that you can use Core Data with ODBC databases. You find it on https://github.com/mhakman/osx-cocoa-odbc. /Mikael On Oct 16, 2013, at 12:12 PM, Zac Bowling wrote: > CoreData is not an ORM. It's a object database that happens to use SQLit

Re: NSTextView without word wrap

2013-10-16 Thread Mikael Hakman
Works as advertised. Many thanks. /Mikael On Oct 16, 2013, at 7:55 AM, Jens Alfke wrote: > > On Oct 12, 2013, at 2:42 PM, Mikael Hakman wrote: > >> How can I make NSTextView not to do word wrap? Thanks. > > Basically you have to make the view’s text container infinitely wide. Here’s > an i

Re: Scrollable GridView with fixed row and column

2013-10-16 Thread Viacheslav Karamov
Thanks everyone again! I have found nice working example here http://www.raywenderlich.com/4680/how-to-make-an-interface-with-horizontal-tables-like-the-pulse-news-app-part-1 16.10.13, 09:19, BareFeetWare пишет: On 16 Oct 2013, at 5:05 am, Vyacheslav Karamov wrote: I need to implement Gri

Re: NSTextView without word wrap

2013-10-16 Thread Mark Wright
Shouldn't that be: - (BOOL) wrapsLines { return ![self isHorizontallyResizable]; } Otherwise if you set it to YES the getter will return NO because of the [self setHorizontallyResizable: !wraps] line in the setter? On 16 Oct 2013, at 06:55, Jens Alfke wrote: > > On Oct 12, 2013, at 2:4

Re: Core Data with ODBC databases?

2013-10-16 Thread Andrew Satori
I'd like to take this a step further. CoreData is a really nice tool, but CoreData really isn't the tool for using a multi-user RDMS since it skips over some of the frequently forgotten concepts like locking and data concurrency. Most of the time when people talk about CoreData and ODBC, they

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 15, 2013, at 23:54:56, Jens Alfke wrote: > Then they’re not strictly speaking leaks — something is still pointing to > them (and likely holding references to them.) > > It might be an autorelease pool that isn’t getting drained, but the stack you > showed is inside a call to -[NSMenu up

Re: NSTextView without word wrap

2013-10-16 Thread Jens Alfke
On Oct 16, 2013, at 5:33 AM, Mark Wright wrote: > Shouldn't that be: > > - (BOOL) wrapsLines { > return ![self isHorizontallyResizable]; > } You’re right — I think I never noticed this bug because I never called the getter; I only added it so the compiler would let me declare wrapsLines as

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 02:31:16, Charles Srstka wrote: > Just out of curiosity, what kind of run loop are you running in? I ask > because the older Finale 2012 appears to use a Carbon run loop while using > some Cocoa elements here and there. Is this still the case, or have you > switched to a Co

Re: Core Data with ODBC databases?

2013-10-16 Thread Jens Alfke
On Oct 16, 2013, at 6:14 AM, Andrew Satori wrote: > I'd like to take this a step further. CoreData is a really nice tool, but > CoreData really isn't the tool for using a multi-user RDMS since it skips > over some of the frequently forgotten concepts like locking and data > concurrency. Als

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 03:25:45, Greg Parker wrote: > On sufficiently-recent OS versions, the runtime will silently push an > autorelease pool if you autorelease without one. This can lead to > unrecognized leaks if this happens on a long-lived thread. On some of those > OS versions you can run w

Re: Core Data with ODBC databases?

2013-10-16 Thread Andrew Satori
Oh, I've got a rudimentary ODBC ORM sitting in my private SVN repo, but I elected to not publish it because while it handles PostgreSQL and MSSQL alright, it doesn't do MySQL, Oracle, FrontBase, MS Access, etc very well at all. The vague nature of what is behind an ODBC data source means that e

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 00:28:17, Ken Thomases wrote: > Regarding the general issue of the mystery objects that are still alive, > there's little point in speculating. Look at the object's history in the > Allocations instrument to see not only where it was allocated but all > retains, releases,

Converting views to use layer backing

2013-10-16 Thread Kenneth Baxter
Hi, I have an NSScrollView with a document view which has subviews. All my views are flipped. I am using and targeting 10.8. I am not using autolayout (I tried it and got horribly confused by how it works with scrollviews, so just turned it off) I turned the magnification capabilities of the s

Re: Cocoa class extension best practice

2013-10-16 Thread Ken Thomases
On Oct 16, 2013, at 9:38 AM, Steve Mills wrote: > On Oct 16, 2013, at 00:28:17, Ken Thomases wrote: > >> Regarding the general issue of the mystery objects that are still alive, >> there's little point in speculating. Look at the object's history in the >> Allocations instrument to see not on

Re: Core Data with ODBC databases?

2013-10-16 Thread Flavio Donadio
Dru, > I'd like to take this a step further. CoreData is a really nice tool, but > CoreData really isn't the tool for using a multi-user RDMS since it skips > over some of the frequently forgotten concepts like locking and data > concurrency. So, that's why we need another tier: an applicati

Re: Core Data with ODBC databases?

2013-10-16 Thread Mikael Hakman
Yes, it is an interesting topic, isn't it? The problem of concurrency and locking is not unique for Core Data. These 2 issues affect every application that accesses a multiuser database, whether you use Core Data or ODBC or some native access methods. This is because you cannot hold locks or be

Re: Core Data with ODBC databases?

2013-10-16 Thread Andrew Satori
Well... This is why I LOVE Objective-C and Cocoa for this work. What follows is a little complex, and honestly still in very raw form as I've had limited time to really finish all the work for something that is a line of business bit of work, but wasn't really built to be made generally availa

Re: Core Data with ODBC databases?

2013-10-16 Thread Flavio Donadio
On 16/10/2013, at 13:11, Andrew Satori wrote: > At the root of things, what I think we are really discussing is a model not > about CoreData, but one about CoreWebServices. Could we build a framework > that let's you model your data in a modeler, and it publishes the model to a > RESTful web

Question about matrix of possibilities

2013-10-16 Thread Eric E. Dolecki
I've been asked to make a tableview with 8 rows. Each row has a UISwitch. Based on a combination of switch values, the result would be a different image displayed to the right of the table (this is for iPad). How would I best go about covering all of those combinations? When one switch changes I'

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 10:08:03, Ken Thomases wrote: > Released to the point of being deallocated? Deallocation would also be > indicated in the history. # Address CategoryEvent Type RefCt Timestamp Size Responsible Library Responsible Caller 0 0x7eb9c160

Re: Question about matrix of possibilities

2013-10-16 Thread Marco Tabini
On Oct 16, 2013, at 12:48 PM, Eric E. Dolecki wrote: > I've been asked to make a tableview with 8 rows. Each row has a UISwitch. > Based on a combination of switch values, the result would be a different > image displayed to the right of the table (this is for iPad). > > How would I best go abo

Re: Core Data with ODBC databases?

2013-10-16 Thread Jeffrey Oleander
On 2013 Oct 16, at 12:47, Flavio Donadio wrote: For sure, ODBC is not the answer here, nor direct client access to the database, as we need something to manage locking and concurrency, as you said -- unless the RDBMS can do that. Is there such a beast? The reason we look to CoreData as a Holy

Re: Cocoa class extension best practice

2013-10-16 Thread Charles Srstka
On Oct 16, 2013, at 11:57 AM, Steve Mills wrote: > So at this point, let's finish this thread by going back to my original > question. Is it OK to use the private instance variable _itemArray in NSMenu > since the methods we've added are *extensions* of NSMenu and not a subclass? I wouldn't. I

Infinite Scroll View Revisited

2013-10-16 Thread Dave
Hi, This has been bugging me for a while and today, I've managed to grab some time in order to try and get it working. I based my class on the "Street Scroller" Sample App from Apple. The main methods that are important in "Street Scroller" are: - (void)recenterIfNecessary { CGPoint curre

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 12:57 PM, Steve Mills wrote: > So at this point, let's finish this thread by going back to my original > question. Is it OK to use the private instance variable _itemArray in NSMenu > since the methods we've added are *extensions* of NSMenu and not a subclass? > They simply

Re: Cocoa class extension best practice

2013-10-16 Thread Sean McBride
On Wed, 16 Oct 2013 01:18:18 -0700, Greg Parker said: >You can call +[NSAutoreleasePool showPools] from the debugger to log the >autorelease pool stack to the console (check both the debugger console On Wed, 16 Oct 2013 01:25:45 -0700, Greg Parker said: >those OS versions you can run with enviro

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 1:38 PM, Charles Srstka wrote: > On Oct 16, 2013, at 11:57 AM, Steve Mills wrote: > >> So at this point, let's finish this thread by going back to my original >> question. Is it OK to use the private instance variable _itemArray in NSMenu >> since the methods we've added ar

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 12:45:49, Andy Lee wrote: > I still don't see what mutability has to do with it, but that's a side issue. The mutability doesn't matter. I'm just emphasizing that the internal array is mutable and this is returning a COPY of that array (which happens to be immutable). > I

Re: Cocoa class extension best practice

2013-10-16 Thread Fritz Anderson
On 16 Oct 2013, at 11:57 AM, Steve Mills wrote: > So at this point, let's finish this thread by going back to my original > question. Is it OK to use the private instance variable _itemArray in NSMenu > since the methods we've added are *extensions* of NSMenu and not a subclass? > They simply

Re: Cocoa class extension best practice

2013-10-16 Thread Andy Lee
On Oct 16, 2013, at 2:09 PM, Steve Mills wrote: > On Oct 16, 2013, at 12:45:49, Andy Lee wrote: > >> I still don't see what mutability has to do with it, but that's a side issue. > > The mutability doesn't matter. I'm just emphasizing that the internal array > is mutable and this is returnin

Re: Cocoa class extension best practice

2013-10-16 Thread Uli Kusterer
On 16 Oct 2013, at 18:57, Steve Mills wrote: > So at this point, let's finish this thread by going back to my original > question. Is it OK to use the private instance variable _itemArray in NSMenu > since the methods we've added are *extensions* of NSMenu and not a subclass? > They simply iter

Re: Question about matrix of possibilities

2013-10-16 Thread Eric E Dolecki
Thank you. Solved and implemented. Eric > On Oct 16, 2013, at 1:09 PM, Marco Tabini wrote: > > >> On Oct 16, 2013, at 12:48 PM, Eric E. Dolecki wrote: >> >> I've been asked to make a tableview with 8 rows. Each row has a UISwitch. >> Based on a combination of switch values, the result would

Re: Question about matrix of possibilities

2013-10-16 Thread Uli Kusterer
On 16 Oct 2013, at 18:48, Eric E. Dolecki wrote: > I've been asked to make a tableview with 8 rows. Each row has a UISwitch. > Based on a combination of switch values, the result would be a different > image displayed to the right of the table (this is for iPad). > > How would I best go about cov

CFPreferencesAppSynchronize() "looping synchronize attempt"

2013-10-16 Thread Jerry Krinock
My app's helper uses CFPreferencesAppSynchronize() to update preferences of its main app, in whose package it resides. CFPreferencesAppSynchronize() sometimes logs this to the system console… ERROR: looping synchronize attempt. Dirty keys count is 1. Saved server state is 3650. Shmem state is 36

Re: Cocoa class extension best practice

2013-10-16 Thread Dave
Hi, Out of interest, have you tried doing this: - (NSMenuItem*)itemWithTag:(NSInteger)tag searchSubmenus:(BOOL)searchSubmenus depthFirst:(BOOL)depthFirst { NSMenuItem* item; //* NSArray*myArray;//* NSMenuItem* subi

Re: CFPreferencesAppSynchronize() "looping synchronize attempt"

2013-10-16 Thread Kyle Sluder
On Wed, Oct 16, 2013, at 12:00 PM, Jerry Krinock wrote: > My app's helper uses CFPreferencesAppSynchronize() to update preferences > of its main app, in whose package it resides. > > CFPreferencesAppSynchronize() sometimes logs this to the system console… > > ERROR: looping synchronize attempt. >

Re: CFPreferencesAppSynchronize() "looping synchronize attempt"

2013-10-16 Thread Jerry Krinock
On 2013 Oct 16, at 12:39, Kyle Sluder wrote: > "98% of the time that means the process changed its sandbox at runtime > such that it gained or lost access to some prefs." Thank you, Kyle. Neither this app, nor its tool, are sandboxed. I didn't think that a sandboxed app could use CFPreferenc

Correctly setting UIViewController backgView.image size

2013-10-16 Thread Carl Hoefs
iPad 2 (non-retina), iOS 7.0.2, Xcode 5.0 I have a UIViewController that I'm setting the background image of: viewController.backgView.image=[UIImage imageNamed:@"background"]; The image is sized at 768x1024, which is the resolution of the iPad display. But when I run the app on the iPad (or s

Re: Correctly setting UIViewController backgView.image size

2013-10-16 Thread Carl Hoefs
The problem seems to be that the iPad & Simulator are running the app in 2X mode, not sure why. Perhaps best moved to the Xcode list. On Oct 16, 2013, at 1:37 PM, Carl Hoefs wrote: > iPad 2 (non-retina), iOS 7.0.2, Xcode 5.0 > > I have a UIViewController that I'm setting the background image

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 12:56:00, Andy Lee wrote: > As for the creeping memory footprint, maybe try Heapshot Analysis to see what > objects are being created during particular intervals? Aha! Thanks, I didn't know about this very helpful debugging aid yet. I was getting about a meg worth of junk e

Re: Cocoa class extension best practice

2013-10-16 Thread Charles Srstka
On Oct 16, 2013, at 4:20 PM, Steve Mills wrote: > On Oct 16, 2013, at 12:56:00, Andy Lee wrote: > >> As for the creeping memory footprint, maybe try Heapshot Analysis to see >> what objects are being created during particular intervals? > > Aha! Thanks, I didn't know about this very helpful

Re: Cocoa class extension best practice

2013-10-16 Thread Steve Mills
On Oct 16, 2013, at 16:39:04, Charles Srstka wrote: > Aha, that definitely explains the leaks you've been getting. The trouble with > instantiateWithOwner:, and the reason it's been deprecated, is because it > doesn't follow the standard Cocoa memory management rules. Specifically, it > retain

Re: Cocoa class extension best practice

2013-10-16 Thread Scott Ribe
On Oct 16, 2013, at 3:39 PM, Charles Srstka wrote: > 3. (This is the one I'd recommend) Instead of using NSNib, make a subclass of > NSWindowController (if your nib defines a window) or NSViewController (if > your nib defines a view). Then use either -[NSWindowController > initWithWindowNibNam

Re: Core Data with ODBC databases?

2013-10-16 Thread Jens Alfke
On Oct 16, 2013, at 8:24 AM, Flavio Donadio wrote: > So, that's why we need another tier: an application server between the client > and database server, to manage locking and concurrency (among other things). > This is really annoying, as we have to deal with things like web services > (or, e

Re: Core Data with ODBC databases?

2013-10-16 Thread Alex Kac
Can’t you use NSIncrementalStore to talk with REST services as a backend for Core Data? I remember seeing some articles on this. Yes: http://sealedabstract.com/code/nsincrementalstore-the-future-of-web-services-in-ios-mac-os-x/ http://stackoverflow.com/questions/17813652/nsincrementalstore-using-

Re: Core Data with ODBC databases?

2013-10-16 Thread Kyle Sluder
On Wed, Oct 16, 2013, at 04:26 PM, Alex Kac wrote: > Can’t you use NSIncrementalStore to talk with REST services as a backend > for Core Data? I remember seeing some articles on this. You can, and many people have tried, but it inevitably fails because Core Data has no semantics for asynchonous, f

Re: Any way to get a warning if a non-boolean type is used in an if expression?

2013-10-16 Thread Rick Mann
On Oct 16, 2013, at 21:16 , Keary Suska wrote: > "if (self.active)" should never flag a warning, because it is not only > perfectly legal but also not in any way an odd construct. The compiler can't > know that you might not be testing for a nil value, for instance. Some > advocate always hav

Re: Any way to get a warning if a non-boolean type is used in an if expression?

2013-10-16 Thread Clark S. Cox III
On Oct 16, 2013, at 21:44, Rick Mann wrote: > > On Oct 16, 2013, at 21:16 , Keary Suska wrote: > >> "if (self.active)" should never flag a warning, because it is not only >> perfectly legal but also not in any way an odd construct. The compiler can't >> know that you might not be testing fo

Re: Any way to get a warning if a non-boolean type is used in an if expression?

2013-10-16 Thread Rick Mann
On Oct 16, 2013, at 22:44 , "Clark S. Cox III" wrote: > > On Oct 16, 2013, at 21:44, Rick Mann wrote: > >> >> On Oct 16, 2013, at 21:16 , Keary Suska wrote: >> >>> "if (self.active)" should never flag a warning, because it is not only >>> perfectly legal but also not in any way an odd con