Re: Lock a file in cocoa

2010-03-19 Thread Ken Thomases
On Mar 19, 2010, at 1:36 PM, Charles Srstka wrote: > On Mar 19, 2010, at 11:04 AM, Jens Alfke wrote: > >> On Mar 19, 2010, at 5:17 AM, Don Quixote de la Mancha wrote: >> >>> How long do you need to prevent its removal? Just holding the file >>> open should prevent it from being deleted. >> >>

NSUserDefaultsController valueForUndefinedKey:

2010-03-19 Thread Richard Somers
When moving a slider in a preference panel I sometimes get an error. 2010-03-19 01:46:49.860 MyApp[4249:10b] Error setting value for key path values.ABRadius of object 0x169c00>[applies immediately: YES] (from bound object 0x6707de0> with object ID 59 in Nib named ABPreferencePanel.nib): [ va

Re: Three odd iPhone dev problems

2010-03-19 Thread William Squires
So I found out... :) After spending some time trying to figure out how to (1) obtain the application's documents folder, and (2) use NSFileNamaner to copy the read-only version into said documents folder. On Mar 19, 2010, at 11:01 AM, Jens Alfke wrote: On Mar 18, 2010, at 8:55 PM, William

Re: Three odd iPhone dev problems

2010-03-19 Thread William Squires
After a bit of poking about, I managed to solve #1. On Mar 18, 2010, at 10:59 PM, Dave Carrigan wrote: On Mar 18, 2010, at 8:55 PM, William Squires wrote: 1) How does one save an XML back into its file? I've got a project that loads an xml file via a UITableView's delegate methods - that

Re: Three odd iPhone dev problems

2010-03-19 Thread William Squires
Thanks! Now, is it possible to make a UIButton look like a UITextField whose caption is underlined (to look like a link)? On Mar 18, 2010, at 11:00 PM, Dave Carrigan wrote: On Mar 18, 2010, at 8:55 PM, William Squires wrote: 3) How do I get a UITextField that displays a telephone number to

Re: App modal window and secondary thread

2010-03-19 Thread Andrew James
You can also consider creating a singleton class that wraps the worker thread so that you don't always bear the cost of creating the thread just to do some work.  This singleon class does need to be thread safe. Once that's been done provide a way to set the data that needs to be shared and the

Re: App modal window and secondary thread

2010-03-19 Thread Jens Alfke
On Mar 19, 2010, at 2:31 PM, Philippe Sismondi wrote: Right - that's exactly my question - I don't know that I have to do this while loop. Is starting the thread after the window pops up enough? Is there anything about *not* waiting for NSApplication to set this window as its modal window

Re: [Solved] -validateMenuItem: like crazy, hogs CPU for 1st minute

2010-03-19 Thread Jerry Krinock
On 2010 Mar 19, at 12:28, Eric Schlegel wrote: > It looks to me that some other process on your system is using the > Accessibility API to inspect your menu structure. That's the > "_XCopyAttributeValue" and subsequent callstack in your first sampler output. > > Do you have Accessibility enabl

Re: App modal window and secondary thread

2010-03-19 Thread Philippe Sismondi
On 2010-03-19, at 4:56 PM, Jens Alfke wrote: > > On Mar 19, 2010, at 9:30 AM, Philippe Sismondi wrote: > >> while (![NSApp modalWindow]) // probably not thread-safe, but harmless?? >> NSLog(@"polling for modalWindow"); > > That's a bad idea, I think. You're making an assumption about

Re: App modal window and secondary thread

2010-03-19 Thread Jens Alfke
On Mar 19, 2010, at 9:30 AM, Philippe Sismondi wrote: while (![NSApp modalWindow]) // probably not thread-safe, but harmless?? NSLog(@"polling for modalWindow"); That's a bad idea, I think. You're making an assumption about NSApplication's implementation (I can think of severa

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jim Correia
On Mar 19, 2010, at 3:21 PM, H. Miersch wrote: > just had another surprise: i inserted NSLogs into the method that initializes > the array and into -numberOfItemsInComboBox, trying to see the contents of my > array and find out why -numberOfItemsInComboBox returns zero. the surprise > was that

Re: Lock a file in cocoa

2010-03-19 Thread John Joyce
> > > This seems like a case where it might be good to know why you need to > prevent a file from being trashed. There is probably a better way to > accomplish what you need. > > _murat > > O It's not even Cocoa. What you are looking for is either file permissions (bad idea) OR keeping dat

App modal window and secondary thread

2010-03-19 Thread Philippe Sismondi
This is related to an earlier post of mine, but I think it warrants a new subject. I may be expecting others to sort out my potential race conditions, but I don't think so. The essential point here is that I need to know the relationship between a window becoming "key" and that same window being

Re: UITable Views and display lags

2010-03-19 Thread Michael Davey
That worked a treat - thanks. I was already aware of the threading issues as have developed for the Mac before, but thanks for the heads up On 19 Mar 2010, at 17:55, WT wrote: > On Mar 19, 2010, at 6:40 PM, Michael Davey wrote: > >> OK, so I have changed the code to show a placeholder image, b

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Kyle Sluder
On Fri, Mar 19, 2010 at 12:21 PM, H. Miersch wrote: > just had another surprise: i inserted NSLogs into the method that initializes > the array and into -numberOfItemsInComboBox, trying to see the contents of my > array and find out why -numberOfItemsInComboBox returns zero. the surprise > was

Re: FREED(id)

2010-03-19 Thread Michael Davey
Thank you for your help On 19 Mar 2010, at 20:04, Don Quixote de la Mancha wrote: > While Guard Malloc didn't find this particular problem, before you > deliver to your client you would do well to test your entire > application with Guard Malloc enabled. If it complains, then you've > got a bug

Re: -validateMenuItem: like crazy, hogs CPU for 1st minute

2010-03-19 Thread Eric Schlegel
It looks to me that some other process on your system is using the Accessibility API to inspect your menu structure. That's the "_XCopyAttributeValue" and subsequent callstack in your first sampler output. Do you have Accessibility enabled? What happens if you disable it? -eric On Mar 19, 2010

Re: FREED(id)

2010-03-19 Thread Don Quixote de la Mancha
While Guard Malloc didn't find this particular problem, before you deliver to your client you would do well to test your entire application with Guard Malloc enabled. If it complains, then you've got a bug and a potentially serious one. What it does is manipulate the virtual memory manager so tha

Re: FREED(id)

2010-03-19 Thread Michael Davey
I will, but for now I just need to get this out of the door for a client - however, it certainly looked like a very powerful tool. On 19 Mar 2010, at 19:43, Greg Parker wrote: > On Mar 19, 2010, at 11:55 AM, Michael Davey wrote: >> Thanks, I have managed to find and fix my error, just by using Z

Re: FREED(id)

2010-03-19 Thread Greg Parker
On Mar 19, 2010, at 11:55 AM, Michael Davey wrote: > Thanks, I have managed to find and fix my error, just by using Zombies - I > turned on Guard Malloc and it didn't do anything, and I tried instruments and > found myself in a whole new world of things I have no idea how to use :o) Learn it! Th

Re: One NSTextView, several model objects - how to synchronise undo manager

2010-03-19 Thread Rui Pacheco
I need to come back to this as something's not right and I can't find out what. I am now initialising a new instance of NSUndoManager when I create my model object. When I type I can see undoManagerForTextView being called and a valid undo manager returned to the text view. My problem is, when I

find panel buttons not enabling

2010-03-19 Thread kvic...@pobox.com
if i have an NSTextView in a sheet and open the find panel, the buttons remain disabled. however, the find commands from the menu work fine. is the find panel not supposed to work if the key window is a sheet? or is this a known bug? any suggestions as to how to get the buttons to be properly e

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch
just had another surprise: i inserted NSLogs into the method that initializes the array and into -numberOfItemsInComboBox, trying to see the contents of my array and find out why -numberOfItemsInComboBox returns zero. the surprise was that -numberOfItemsInComboBox is called BEFORE the method tha

Re: -validateMenuItem: like crazy, hogs CPU for 1st minute

2010-03-19 Thread Jerry Krinock
I just realized I should have included the Sampler output. Here it is. You see after the 1643 samples of MenuData::GetNamedAccessibleAttributeSelf, it breaks into two branches, both of which end up in -validateMenuItem: Analysis of sampling pid 25997 every 1 millisecond 1691 Thread_798599 Di

Re: FREED(id)

2010-03-19 Thread Michael Davey
Thanks, I have managed to find and fix my error, just by using Zombies - I turned on Guard Malloc and it didn't do anything, and I tried instruments and found myself in a whole new world of things I have no idea how to use :o) On 19 Mar 2010, at 18:09, Don Quixote de la Mancha wrote: > On Fri,

Re: Printing an NSDocument

2010-03-19 Thread John Velman
Somewhere I read that printing is always a pain, but with Cocoa it's somewhat less of a pain. Not that I've done a lot of printing, but that was my impression. (Some years ago I tried printing with Microsoft Visual C++ and that was really bad -- maybe MSVC is better by now, but haven't touched MS

Re: Lock a file in cocoa

2010-03-19 Thread Murat Konar
This seems like a case where it might be good to know why you need to prevent a file from being trashed. There is probably a better way to accomplish what you need. _murat On Mar 19, 2010, at 11:36 AM, Charles Srstka wrote: On Mar 19, 2010, at 11:04 AM, Jens Alfke wrote: On Mar 19, 2010,

Re: Lock a file in cocoa

2010-03-19 Thread Charles Srstka
On Mar 19, 2010, at 11:04 AM, Jens Alfke wrote: > On Mar 19, 2010, at 5:17 AM, Don Quixote de la Mancha wrote: > >> How long do you need to prevent its removal? Just holding the file >> open should prevent it from being deleted. > > Yes, but not from being moved to the trash, which was the OP’s

-validateMenuItem: like crazy, hogs CPU for 1st minute

2010-03-19 Thread Jerry Krinock
This morning I was noticing that text fields could not keep up with my typing into them. But this only occurs during the first minute or so after my app is launched, and sampling shows that the main thread is spending most of its time in my app delegate's -validateMenuItem:. I do have a couple

Re: FREED(id)

2010-03-19 Thread Michael Davey
Thank you both for your suggestions, I will give them a go later :o) On 19 Mar 2010, at 18:09, Don Quixote de la Mancha wrote: > On Fri, Mar 19, 2010 at 11:00 AM, Nick Zitzmann wrote: >> Run your app with Instruments with the object alloc tool, and turn on >> reference counting and zombies. And

Re: FREED(id)

2010-03-19 Thread Don Quixote de la Mancha
On Fri, Mar 19, 2010 at 11:00 AM, Nick Zitzmann wrote: > Run your app with Instruments with the object alloc tool, and turn on > reference counting and zombies. And hope your app doesn't run out of memory > before catching the double-free. You can also try turning on Guard Malloc. That is a me

Re: FREED(id)

2010-03-19 Thread Nick Zitzmann
On Mar 19, 2010, at 10:58 AM, Michael Davey wrote: > I have just encountered the following error at (seemingly) random intervals > when trying to debug my iPhone application, and I was wondering what causes > it and how I might go about hunting it down so that I can try and fix it? > > objc[22

Re: UITable Views and display lags

2010-03-19 Thread WT
On Mar 19, 2010, at 6:40 PM, Michael Davey wrote: > OK, so I have changed the code to show a placeholder image, but I am a little > uncertain as to how to fetch the images asynchronously. I could start a > background thread with performSelectorInBackground, but am concerned that > this would s

Re: UITable Views and display lags

2010-03-19 Thread Michael Davey
OK, so I have changed the code to show a placeholder image, but I am a little uncertain as to how to fetch the images asynchronously. I could start a background thread with performSelectorInBackground, but am concerned that this would spawn far too many threads - does anyone have any suggestion

Re: [solved] Multiple validation errors. Why?

2010-03-19 Thread Jerry Krinock
On 2010 Mar 18, at 21:04, Lynn Barton wrote: > That was just the help I needed. Console messages showed that I needed to > explicitly set the value of one of the string attributes, which was defined > with a minimum length of zero After I had something like this happen a couple times, I decide

Re: NSString after an UIAlertView..

2010-03-19 Thread Stephen J. Butler
On Fri, Mar 19, 2010 at 12:24 PM, jon wrote: > and when an UIAlertView is "instanced"  if that is proper,   then afterward,   > the string instance is "out of scope" > > I had made the assumption before that this is normal,  but it maybe not > normal,  I'm looking for a bug in my code,  but i don

Re: NSString after an UIAlertView..

2010-03-19 Thread jon
sorry, I have not spoken in objective C in an email much as you can tell, (tried to translate) my terms of course are all incorrect.. the NSStrings are not instanced in the header, only declared, if that is the proper word... the are given values in the methods. and when an UIAlertView is

Re: UITable Views and display lags

2010-03-19 Thread Luke the Hiesterman
You should display a place-holder image in the tableView cells so that your app doesn't hang. You can then fetch the images asynchronously and replace the placeholder images with the real images as they become available. You should not do anything to interrupt smooth scrolling. Luke On Mar 19

UITable Views and display lags

2010-03-19 Thread Michael Davey
Another question... In my application, I have several connected UITable views, and on the last level, I am displaying images that may or may not already be cached, what I would like to know is whether there is some way I can display some sort of notification to the user that this is what is hap

Re: User-space threads and NSAutoreleasePool

2010-03-19 Thread BJ Homer
If only I could target 10.6... we just barely convinced management to let us drop 10.4. Someday... someday. -BJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the mod

Re: Anything like -[performBlockOnMainThread:]?

2010-03-19 Thread Benjamin Rister
> dispatch_sync(dispatch_get_main_queue(), ^{ >... > }); An important reminder to anybody using this technique: be careful doing dispatch_sync to the main queue under GC. There’s a bug (rdar://problem/7455071) that can cause objects to not be kept alive by the block across that thread switc

Re: NSString after an UIAlertView..

2010-03-19 Thread Fritz Anderson
I am stymied by imprecision in your questions. On 18 Mar 2010, at 11:53 PM, Jon wrote: > I have a class set up, and in the header file, I have instances of > NSString that i want to hang around for all the methods of the class to be > able to use...(why they are declared in the header file)

Re: NSBrowser and tab order

2010-03-19 Thread Corbin Dunn
On Mar 18, 2010, at 9:48 AM, Keary Suska wrote: > On Mar 18, 2010, at 8:40 AM, Corbin Dunn wrote: > >> Aj -- I believe this was a bug fixed in 10.6; maybe 10.5. What OS are you on? >> >> The work around is to set it up in awakeFromNib. > > Is there any way to tab into an NSBrowser in 10.4? It

FREED(id)

2010-03-19 Thread Michael Davey
Hi, I have just encountered the following error at (seemingly) random intervals when trying to debug my iPhone application, and I was wondering what causes it and how I might go about hunting it down so that I can try and fix it? objc[22029]: FREED(id): message release sent to freed object=0x3b

Re: One NSTextView, several model objects - how to synchronise undo manager

2010-03-19 Thread Rui Pacheco
You are right, I forgot to check the delegate methods. On 17 March 2010 14:41, Keith Blount wrote: > I might be missing something, but can you not just use the NSTextView > delegate message, -undoManagerForTextView:? This is what I do in my app. I > have a single text view that can have various

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez
On Mar 19, 2010, at 8:45 AM, H. Miersch wrote: > My theory is that there's something wrong with the array. Either it isn't > initialized properly or the methods can't access it or something. Gonna try > self.symbols instead of symbols, see if that changes anything... Another thing I forgot to

Re: Lock a file in cocoa

2010-03-19 Thread Jens Alfke
On Mar 19, 2010, at 5:17 AM, Don Quixote de la Mancha wrote: > How long do you need to prevent its removal? Just holding the file > open should prevent it from being deleted. Yes, but not from being moved to the trash, which was the OP’s request. Actually I’m not sure the immutable bit prevent

Re: Three odd iPhone dev problems

2010-03-19 Thread Jens Alfke
On Mar 18, 2010, at 8:55 PM, William Squires wrote: > How does one save an XML back into its file? -[NSData writeToFile:atomically:] > I've got a project that loads an xml file via a UITableView's delegate > methods - that all works; I can see all the items in the NSMutableArray which > was l

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez
H. Miersch wrote, >> uncaught exception 'NSRangeException', reason: '*** -[NSCFArray >> objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5)' I was running into something similar this morning, and I traced it back to the fact that I had set the type of a variable to NSUInteger, an

Re: Detecting if you're being debugged

2010-03-19 Thread Michael Ash
On Thu, Mar 18, 2010 at 8:14 AM, Jeremy Pereira wrote: > > On 18 Mar 2010, at 11:48, Peter Hudson wrote: > >> Technical Q&A QA1361 >> Detecting the Debugger >> >> Does this code report on my app being debugged by any third party, even when >> the app has been stripped of symbols ? >> Would it wor

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Bill Hernandez
On Mar 19, 2010, at 7:31 AM, Jim Correia wrote: >> uncaught exception 'NSRangeException', reason: '*** -[NSCFArray >> objectAtIndex:]: index (-1 (or possibly larger)) beyond bounds (5)' I was running into something similar this morning, and I traced it back to the fact that I had set the type

PDFView printWithInfo:autoRotate: fails? (was Re: Printing an NSDocument)

2010-03-19 Thread Brian Postow
I'm now trying to print a PDFDocument that I am constructing from a series of images. In case it matters, I'm doing all of this from within a Mozilla plugin. I create the PDFDocument, and put it into a PDFView, then I call [printView printWithInfo: [NSPrintInfo sharedPrintInfo] autoRotate: YES];

Re: Printing an NSDocument

2010-03-19 Thread Brian Postow
On Mar 19, 2010, at 2:26 AM, Scott Anguish wrote: > > On Mar 18, 2010, at 7:17 PM, Jenny M wrote: > >> Sorry, no answer, I'm just having a similar issue. I need to print >> columns of text, and all the examples I see indicate a manual creation >> and placement of EACH line of text in an NSRect

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch
Did you try sending -reloadData to the combo box after setting up the data source and before trying to access items in the combo box? No, because I set up the data source in IB. My theory is that there's something wrong with the array. Either it isn't initialized properly or the methods can't

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jeremy Pereira
On 19 Mar 2010, at 12:45, H. Miersch wrote: >> >> It appears you are sending -selectItemAtIndex: to the combo box, > > Correct. I tell it to select the first item (index 0). And when I put the > list if items in the nib file (no data source) it works. > > But this morning I quickly inserted a

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread H. Miersch
It appears you are sending -selectItemAtIndex: to the combo box, Correct. I tell it to select the first item (index 0). And when I put the list if items in the nib file (no data source) it works. But this morning I quickly inserted an nslog to find out how big the symbols array is, and it

Re: NSComboBox problem in 10.6.2

2010-03-19 Thread Jim Correia
On Mar 18, 2010, at 3:38 PM, H. Miersch wrote: > when i try to launch the app from within xcode, the console shows the > following: > > 2010-03-18 19:26:28.515 StoX[63999:a0f] An uncaught exception was raised > 2010-03-18 19:26:28.534 StoX[63999:a0f] *** -[NSCFArray objectAtIndex:]: > index (-1

Re: Lock a file in cocoa

2010-03-19 Thread Don Quixote de la Mancha
Nikhil, On Fri, Mar 19, 2010 at 2:59 AM, Nikhil Khandelwal wrote: > Is there any way to lock a file in cocoa? I want to lock a file on desktop > programmatically so that I can't move that file to trash until I unlock the > file. How long do you need to prevent its removal? Just holding the fi

Re: Lock a file in cocoa

2010-03-19 Thread Ken Thomases
On Mar 19, 2010, at 4:59 AM, Nikhil Khandelwal wrote: > Is there any way to lock a file in cocoa? I want to lock a file on desktop > programmatically so that I can't move that file to trash until I unlock the > file. I recommend against doing that. Locking the file in this sense should probabl

Re: Lock a file in cocoa

2010-03-19 Thread Ron Fleckner
On 19/03/2010, at 8:59 PM, Nikhil Khandelwal wrote: Hi, Is there any way to lock a file in cocoa? I want to lock a file on desktop programmatically so that I can't move that file to trash until I unlock the file. Thanks, Nikhil Hi Nikhil, here's how I do it: NSFileManager *f

Lock a file in cocoa

2010-03-19 Thread Nikhil Khandelwal
Hi, Is there any way to lock a file in cocoa? I want to lock a file on desktop programmatically so that I can't move that file to trash until I unlock the file. Thanks, Nikhil DISCLAIMER == This e-mail may contain privileged and confidential information which is the property of Persi

Re: Using Set/Array KVC operators

2010-03-19 Thread Ken Thomases
On Mar 18, 2010, at 6:15 PM, Sam Krishna wrote: > I have two arrays of NSDictionaries that I'm trying to "uniquely merge" by > making sure that no two dictionaries have duplicate contents. I came up with > one solution, but I wanted to see if the community had an answer that > involved using on

Re: Printing an NSDocument

2010-03-19 Thread Scott Anguish
On Mar 19, 2010, at 3:03 AM, Jenny M wrote: > Yes, for the most part the columns will line up, but I'll need some > headers, footers, and some dividers. So if I have two sets of data, > I'd want a header, then one set, then another, then a footer. I do > understand the need to keep track of data

Re: Printing an NSDocument

2010-03-19 Thread Jenny M
Yes, for the most part the columns will line up, but I'll need some headers, footers, and some dividers. So if I have two sets of data, I'd want a header, then one set, then another, then a footer. I do understand the need to keep track of data for pagination. I was thinking of trying WebKit, I ha