Re: preventing bad memory access

2011-10-20 Thread Don Quixote de la Mancha
On Tue, Oct 18, 2011 at 9:22 AM, Jens Alfke wrote: > On Oct 17, 2011, at 9:26 PM, Wilker wrote: > if the user is acessing a >> file from an external drive, and the file has 8gb, I only wanna read 64kb, >> so, I don't wanna read it all just for 64kb. > > Just use fopen/fseek/fread/fclose. Mapping i

Re: Enter/exit full screen notification

2011-10-20 Thread lowell
Yup. Here are two different ways: /System/Library/Frameworks/AppKit.framework/Versions/C/Headers/NSWindow.h @757: - (void)windowWillEnterFullScreen:(NSNotification *)notification NS_AVAILABLE_MAC(10_7); - (void)windowDidEnterFullScreen:(NSNotification *)notification NS_AVAILABLE_MAC(10_7); -

Re: Enter/exit full screen notification

2011-10-20 Thread Ryan Joseph
Thanks. those are what I was looking for, but unfortunately this is in only in 10.7. What were people using prior to 10.7? Does anyone know anything about kEventMenuBarShown and if this is the correct Carbon event to handle pre-10.7? The information I found is from 2005 so I don't know if this

Re: Enter/exit full screen notification

2011-10-20 Thread Lee Ann Rucker
You're trying to see changes made by other apps, right? I don't think you're going to see these notifications, then, and also Lion's fullscreen moves the window into its own special Mission Control Space, so I'd think your window would be left behind on the original Space. In 10.6 (and 10.7) it

Re: Enter/exit full screen notification

2011-10-20 Thread Ryan Joseph
On Oct 20, 2011, at 2:45 PM, Lee Ann Rucker wrote: > You're trying to see changes made by other apps, right? I don't think you're > going to see these notifications, then, and also Lion's fullscreen moves the > window into its own special Mission Control Space, so I'd think your window > would

Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Nick
Hello I have an application that is able to process .txt files, which can be opened using File->Open and saved with File->Save, File->Save As. The problem is that Finder thinks that my application is an app that the user may want to open by double clicking a text file. How does it do it? And how co

Re: IBOutlet getter/setter pattern question

2011-10-20 Thread Matt Neuburg
On Tue, 18 Oct 2011 11:00:49 -0700, Eeyore said: >When I declare something as an IBOutlet, am I exposing it to others? IBOutlet is not a "declaration" in any meaningful sense. It's just a bit of internal fluff with Xcode; the compiler never sees it. It makes no difference whatever to the status

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Matt Neuburg
On Wed, 19 Oct 2011 11:47:22 -0600, John Pannell said: >- (CGColorRef)CGColorCopy The CG prefix is not yours to use at the start of a method name. Start with your own prefix. Also, follow the convention that if you're handing back a newly created retained object, the word Create appears earl

CD database breaks after lightweight migration?

2011-10-20 Thread Fritz Anderson
Xcode 4.2, iOS 5.0 SDK, iOS Simulator for 4.3. I'll do the short version of this, in case there's a well-known answer. If we need to get into code, I'll be glad to supply it. I added a version to my data model* and added an attribute to one of my entities. It is Boolean, non-optional, and defau

Re: Enter/exit full screen notification

2011-10-20 Thread Lee Ann Rucker
On Oct 20, 2011, at 2:21 AM, Ryan Joseph wrote: > > On Oct 20, 2011, at 2:45 PM, Lee Ann Rucker wrote: > >> You're trying to see changes made by other apps, right? I don't think you're >> going to see these notifications, then, and also Lion's fullscreen moves the >> window into its own speci

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Lee Ann Rucker
On Oct 20, 2011, at 4:51 AM, Nick wrote: > Hello > I have an application that is able to process .txt files, which can be > opened using File->Open and saved with File->Save, File->Save As. > The problem is that Finder thinks that my application is an app that the > user may want to open by doubl

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 On 10/20/11 12:25 PM, Lee Ann Rucker wrote: > > On Oct 20, 2011, at 4:51 AM, Nick wrote: > >> Hello I have an application that is able to process .txt files, >> which can be opened using File->Open and saved with File->Save, >> File->Save As. The p

Scripting Bridge warning: 'no class for scripting class "iTunesBrowserWindow"'

2011-10-20 Thread Gabriel Roth
Hello all: The Scripting Bridge header file for iTunes identifies iTunesBrowserWindow as a subclass of iTunesWindow. But when I run the following code: iTunesApplication *iTunes = [SBApplication applicationWithBundleIdentifier:@"com.apple.iTunes"]; SBElementArray *windows = [iTunes window

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Lee Ann Rucker
On Oct 20, 2011, at 12:37 PM, Conrad Shultz wrote: > -BEGIN PGP SIGNED MESSAGE- > Hash: SHA1 > > On 10/20/11 12:25 PM, Lee Ann Rucker wrote: >> >> On Oct 20, 2011, at 4:51 AM, Nick wrote: >> >>> Hello I have an application that is able to process .txt files, >>> which can be opened us

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread John Joyce
>>> Hello I have an application that is able to process .txt files, which can be opened using File->Open and saved with File->Save, File->Save As. The problem is that Finder thinks that my application is an app that the user may want to open by double clicking a text f

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Greg Parker
On Oct 20, 2011, at 10:11 AM, Matt Neuburg wrote: > You know there's a rule that Create means a retained ref is returned There is no such rule in the Cocoa memory management conventions. http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/MemoryMgmt/Articles/mmRules.html Ther

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Lee Ann Rucker
On Oct 20, 2011, at 12:58 PM, John Joyce wrote: > Hello I have an application that is able to process .txt files, > which can be opened using File->Open and saved with File->Save, > File->Save As. The problem is that Finder thinks that my > application is an app that the

WebView doesn't scroll

2011-10-20 Thread Vladimir Pouzanov
Hi all, I have an issue with WebView and scrolling the content. Using even the simplest code (xib with webView on top of it and [[webView mainFrame] loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:@"http://any.site.with.long.content";]]]) I still fail to make the webView scrollab

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Matt Neuburg
On Oct 20, 2011, at 1:20 PM, Greg Parker wrote: > On Oct 20, 2011, at 10:11 AM, Matt Neuburg wrote: >> You know there's a rule that Create means a retained ref is returned > > There is no such rule in the Cocoa memory management conventions. > > http://developer.apple.com/library/mac/#document

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread John Joyce
>> Hello I have an application that is able to process .txt files, >> which can be opened using File->Open and saved with File->Save, >> File->Save As. The problem is that Finder thinks that my >> application is an app that the user may want to open by double >> clicking a t

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Charles Srstka
On Oct 20, 2011, at 3:43 PM, Matt Neuburg wrote: > > On Oct 20, 2011, at 1:20 PM, Greg Parker wrote: > >> On Oct 20, 2011, at 10:11 AM, Matt Neuburg wrote: >>> You know there's a rule that Create means a retained ref is returned >> >> There is no such rule in the Cocoa memory management convent

Re: Get my NSDocument-based application out from "Open With" menu?

2011-10-20 Thread Lee Ann Rucker
On Oct 20, 2011, at 2:04 PM, John Joyce wrote: >>> Hello I have an application that is able to process .txt files, >>> which can be opened using File->Open and saved with File->Save, >>> File->Save As. The problem is that Finder thinks that my >>> application is an app that the

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Bill Cheeseman
On Oct 20, 2011, at 4:43 PM, Matt Neuburg wrote: > Sure, but still, he's returning a retained CGColorRef. And CGColor > participates in this convention (CGColorRelease, CGColorRetain, CGColorCreate > etc.). I'm not saying he has to do it; I'm merely suggesting that the magic > word "Create" wi

Core Data: Determine if managed object is deleted

2011-10-20 Thread Jerry Krinock
When I need to know whether or not a managed object is deleted, often I fall into the trap of trying -[NSManagedObject isDeleted], forgetting that its documentation states … "… It may return NO at other times, particularly after the object has been deleted. …" In other words, they should hav

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Jean-Daniel Dupas
Le 20 oct. 2011 à 23:38, Bill Cheeseman a écrit : > > On Oct 20, 2011, at 4:43 PM, Matt Neuburg wrote: > >> Sure, but still, he's returning a retained CGColorRef. And CGColor >> participates in this convention (CGColorRelease, CGColorRetain, >> CGColorCreate etc.). I'm not saying he has to do

Re: Core Data: Determine if managed object is deleted

2011-10-20 Thread Gideon King
Ooh, I had never noticed that - I just assumed that the method did what you would think. That may be the cause of an issue in my code. Thanks for the heads up. I would tend to try to avoid processPendingChanges if possible since it appears to be a rather expensive operation. Regards Gideon O

Re: Core Data: Determine if managed object is deleted

2011-10-20 Thread Quincey Morris
On Oct 20, 2011, at 15:37 , Jerry Krinock wrote: > When I need to know whether or not a managed object is deleted, often I fall > into the trap of trying -[NSManagedObject isDeleted], forgetting that its > documentation states … > > "… It may return NO at other times, particularly after the ob

Re: ARC + return of autoreleased CFType

2011-10-20 Thread Quincey Morris
On Oct 20, 2011, at 15:38 , Jean-Daniel Dupas wrote: > Le 20 oct. 2011 à 23:38, Bill Cheeseman a écrit : > >> I found this discovery extraordinarily helpful in using Analyze to kill >> memory issues in a couple of frameworks I distribute. The frameworks make >> heavy use of CFTypeRef objects. I

Re: WebView doesn't scroll

2011-10-20 Thread Andy Lee
Works fine for me on 10.7.2 and Xcode 3.2.6. If you want to zip up your project and send it to me I'd be glad to see if I can reproduce the problem. (Just remember to remove the build directory before zipping.) --Andy On Oct 20, 2011, at 4:37 PM, Vladimir Pouzanov wrote: > Hi all, > > I have

Re: preventing bad memory access

2011-10-20 Thread Wilker
Thanks for the answers guys. I mean I will use the f* operations. But they are really safe? There is anything that I can do for extreme situations in case to avoid bad memory access? --- Wilker Lúcio http://about.me/wilkerlucio/bio Kajabi Consultant +55 81 82556600 On Thu, Oct 20, 2011 at 12:0

Re: preventing bad memory access

2011-10-20 Thread Jens Alfke
On Oct 20, 2011, at 8:19 PM, Wilker wrote: > I mean I will use the f* operations. > But they are really safe? There is anything that I can do for extreme > situations in case to avoid bad memory access? What’s unsafe is accessing file-mapped memory after the file becomes unavailable. If you us

Re: preventing bad memory access

2011-10-20 Thread Don Quixote de la Mancha
On Thu, Oct 20, 2011 at 8:19 PM, Wilker wrote: > But they are really safe? There is anything that I can do for extreme > situations in case to avoid bad memory access? Yes they are safe. The "f" I/O calls go back to the very beginnings of the C standard library in the late 1960s. I myself have

Re: preventing bad memory access

2011-10-20 Thread Don Quixote de la Mancha
On Thu, Oct 20, 2011 at 8:48 PM, Jens Alfke wrote: > What’s unsafe is accessing file-mapped memory after the file becomes > unavailable. > If you use fread (or read), you’re not doing that. You're allocating your > own memory from the heap first, then copying data from the file into it. > There’s

Re: preventing bad memory access

2011-10-20 Thread Kyle Sluder
On Oct 20, 2011, at 8:56 PM, Don Quixote de la Mancha wrote: > For C++, you would need to throw an exception on I/O error, then write > exception-safe code. I have not yet really figured out the right way > to do the equivalent for Objective-C, because Objective-C exceptions > don't work like C

Re: WebView doesn't scroll

2011-10-20 Thread Vladimir Pouzanov
On 21 окт. 2011, at 03:50, Andy Lee wrote: > Works fine for me on 10.7.2 and Xcode 3.2.6. > > If you want to zip up your project and send it to me I'd be glad to see if I > can reproduce the problem. (Just remember to remove the build directory > before zipping.) Somehow it was related to "ide