memory advice for still learning coder

2009-10-03 Thread Rick C.
hello, i'm having a few memory issues where my memory climbs over time although using leaks it shows i have no leaks. i have gone over my code many times making sure i release items that need it and have gone over the docs looking for something i might be missing. i'm thinking my problem migh

releasing a object containing others in a array

2009-10-03 Thread Nick Rogers
Hi, I have a class as following: @interface NodeTypeOrph : NSObject { int count; ItemTypeOrph*key[4]; // Warning: indexing starts at 0, not 1 NodeTypeOrph*branch[5]; // Fake pointers to child nodes } when I'll send a release to an

Re: NSLayoutManager and best override point for temporary attributes

2009-10-03 Thread Keith Blount
Many thanks, Aki, much appreciated. > You can do: > NSGraphicsContext *context = [NSGraphicsContext > currentContext]; > [context saveGraphicsState]; > [yourCustomColor set]; > [super showPackedGlyphs:...]; > [context restoreGraphicsState]; > This works perfectly, thank you. > There is no rende

Re: releasing a object containing others in a array

2009-10-03 Thread Roland King
Well follow the memory management rules. You retained the objects when you put them in the array so you must release them. On 03-Oct-2009, at 16:10, Nick Rogers wrote: Hi, I have a class as following: @interface NodeTypeOrph : NSObject { intcount; ItemTypeOrph*k

objc_atomicCompareAndSwapInstanceVariable

2009-10-03 Thread André Berg
Hi, In I found this functions: OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapInstanceVariable(id predicate, id replacement, volatile id *objectLocation); OBJC_GC_EXPORT BOOL objc_atomicC

Re: objc_atomicCompareAndSwapInstanceVariable

2009-10-03 Thread Greg Parker
On Oct 3, 2009, at 2:13 AM, André Berg wrote: In I found this functions: OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapPtr(id predicate, id replacement, volatile id *objectLocation) OBJC_GC_EXPORT BOOL objc_atomicCompareAndSwapInstanceVariable(id predicate, id replacement, volatile id *objec

Re: memory advice for still learning coder

2009-10-03 Thread Ken Thomases
On Oct 3, 2009, at 2:38 AM, Rick C. wrote: i'm having a few memory issues where my memory climbs over time although using leaks it shows i have no leaks. Leaks aren't the only way to use excessive memory. For example, if you keep allocating objects and putting them in a collection somewher

Re: releasing a object containing others in a array

2009-10-03 Thread Ken Thomases
On Oct 3, 2009, at 3:10 AM, Nick Rogers wrote: I have a class as following: @interface NodeTypeOrph : NSObject { int count; ItemTypeOrph*key[4]; // Warning: indexing starts at 0, not 1 NodeTypeOrph*branch[5]; // Fake pointers to ch

CFNumberFormatterCreate question

2009-10-03 Thread Dmitry Markman
Hi, I'd like to emulate %15.4g format with CFNumberFormatterCreate I have a problem with padding for exponential notation patterns like * ##...@###e00 don't work Note: pattern * ##...@### works fine icu returns error for patterns like * ##...@###e00 from other hand documentation for decimal fo

Re: objc_atomicCompareAndSwapInstanceVariable

2009-10-03 Thread André Berg
Thanks Greg! This really clears up a lot! And also thanks about clarifying the bit about the objc->ivar syntax. Seems I jumped to conclusions when I accidentally tried to access another object's ivar that way. Personally I think you're doing a great job with the GC, Dispatch and Blocks suppor

Re: memory advice for still learning coder

2009-10-03 Thread Rick C.
i appreciate the reply ken. i'll try to answer your questions: 1. got it about the Object Alloc instrument. i'll have to spend some more time with it to interpret everything and i will do so. 2. yes on the mutable arrays. besides memory issues if i didn't release and then add objects correc

Re: memory advice for still learning coder

2009-10-03 Thread Ken Thomases
On Oct 3, 2009, at 9:17 AM, Rick C. wrote: 5. returning i am not doing. :-( maybe a bad error on my part. in the thread method my first line i alloc/init an autorelease pool and the last line i release the pool. should my last line be return? the method is void. Allowing the method t

Re: memory advice for still learning coder

2009-10-03 Thread Ken Thomases
Oh, and I forgot to respond to this: On Oct 3, 2009, at 9:17 AM, Rick C. wrote: 4. i don't believe i'm having a problem with the arrays being accessed the same time by different threads. although i am not using a lock. If I'm understanding what you're saying, you're courting disaster. I

RE: CoreData async fetch request

2009-10-03 Thread Frederick Bartram
Is there a way to do an asynchronous fetch request against Core data returning partial results? Try spawning the fetch in a background thread. There is an example of this in the CoreData sample project 'BackgroundFetching'. You will need to read up on the threading issues as in "don't share co

whether to use core data...

2009-10-03 Thread Colin Howarth
This is a long (but witty and interesting) rambling post about design, apple documentation, learning Obj-C & Cocoa and so on. I'm writing a raytracing / lens design program. This is basically my fist serious attempt at a real Cocoa program, and whist I'm quite happy with C and Perl, I don'

Re: whether to use core data...

2009-10-03 Thread Sherm Pendley
On Sat, Oct 3, 2009 at 11:14 AM, Colin Howarth wrote: > > But the Core Data documentation starts like this: > > ... > Core Data is not an entry-level technology. > ... > You should not simply try to read [The Core Data Programming Guide] straight > through to understand Core Data. > ... > Do not a

Re: whether to use core data...

2009-10-03 Thread I. Savant
On Oct 3, 2009, at 11:14 AM, Colin Howarth wrote: This is a long (but witty and interesting) rambling post about design, apple documentation, learning Obj-C & Cocoa and so on. [ big, massive, much-needed snip ] FOCUS!!! I get that you're trying to be witty, but I was forced to skim m

Keeping NSWindow below all other windows

2009-10-03 Thread PCWiz
Hi, I have a full screen borderless NSWindow. The problem is that it covers all other windows (Finder windows and app windows). How do I make it so that the window is kept below ALL other windows. Thanks ___ Cocoa-dev mailing list (Cocoa-dev@list

Re: whether to use core data...

2009-10-03 Thread Izidor Jerebic
On 3.10.2009, at 17:14, Colin Howarth wrote: Now that's a shame, because save: load: sounds like a persistent document to me. But if even Apple's documentation says WARNING, Do NOT attempt to read the Programming GUIDE in order to understand Core Data -- well, I believe 'em! On the o

Re: releasing a object containing others in a array

2009-10-03 Thread Kenneth Bruno II
As per: "You take ownership of an object if you create it using a method whose name begins with “alloc” or “new” or contains “copy” (for example, alloc, newObject, or mutableCopy), or if you

Re: memory advice for still learning coder

2009-10-03 Thread Rick C.
thanks ken for all the input. i will work on the things you've mentioned. i really appreciate it! rick From: Ken Thomases To: Rick C. Cc: cocoa dev Sent: Saturday, October 3, 2009 10:37:11 PM Subject: Re: memory advice for still learning coder Oh, and I

Re: Keeping NSWindow below all other windows

2009-10-03 Thread Ron Fleckner
On 04/10/2009, at 3:12 AM, PCWiz wrote: Hi, I have a full screen borderless NSWindow. The problem is that it covers all other windows (Finder windows and app windows). How do I make it so that the window is kept below ALL other windows. Thanks [myWindow setLevel:]; check the docs. ___

Re: Keeping NSWindow below all other windows

2009-10-03 Thread PCWiz
Thanks, setting the window level to -1 worked :) On 2009-10-03, at 10:44 AM, Ron Fleckner wrote: On 04/10/2009, at 3:12 AM, PCWiz wrote: Hi, I have a full screen borderless NSWindow. The problem is that it covers all other windows (Finder windows and app windows). How do I make it so th

Rounded NSBox/NSView?

2009-10-03 Thread PCWiz
Hi, I want to create a NSBox or an NSView (doesn't matter which one) that has rounded corners. Now I know about NSBox's setCornerRadius method, and using NSBezierPath in an NSView subclass to draw a rounded rect. The problem with these 2 methods is that even though the rounded corners are

Re: Keeping NSWindow below all other windows

2009-10-03 Thread Sherm Pendley
On Sat, Oct 3, 2009 at 1:32 PM, PCWiz wrote: > > On 2009-10-03, at 10:44 AM, Ron Fleckner wrote: > >> >> [myWindow setLevel:]; >> >> check the docs. > > Thanks, setting the window level to -1 worked :) Don't do that. Magic numbers are considered very poor programming:

Re: Keeping NSWindow below all other windows

2009-10-03 Thread PCWiz
The lowest constant I could find was 0 (NSNormalWindowLevel) and it still positioned itself above other windows. Is there a constant for -1 ? On 2009-10-03, at 11:44 AM, Sherm Pendley wrote: On Sat, Oct 3, 2009 at 1:32 PM, PCWiz wrote: On 2009-10-03, at 10:44 AM, Ron Fleckner wrote: [

Re: Keeping NSWindow below all other windows

2009-10-03 Thread Mike Abdullah
So logically you would specify your window to be: [myWindow setLevel:(NSNormalWindowLevel - 1)]; On 3 Oct 2009, at 19:04, PCWiz wrote: The lowest constant I could find was 0 (NSNormalWindowLevel) and it still positioned itself above other windows. Is there a constant for -1 ? On 2009-10-0

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 18:07, Sherm Pendley wrote: On Sat, Oct 3, 2009 at 11:14 AM, Colin Howarth wrote: WARNING! Do not even ATTEMPT the NSPersistentDocument Core Data Tutorial! Your very MIND is in MORTAL DANDER! Overreact much? We're talking about technical documentation, not an H.P. Lov

Auto Install Login Item

2009-10-03 Thread David Blanton
Should my cocoa app write an entry to com.apple.loginitems.plist so it launches at login or is there a better way? ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact th

Re: whether to use core data...

2009-10-03 Thread Mike Abdullah
On 3 Oct 2009, at 20:20, Colin Howarth wrote: OK, skipping the melodrama, there's something wrong with the Apple documentation, but I can't quite put my finger on it. The Perl man pages on nested data structures, say a dictionary containing arrays containing other dictionaries which are ac

Re: Auto Install Login Item

2009-10-03 Thread Todd Heberlein
On Oct 3, 2009, at 12:30 PM, David Blanton wrote: Should my cocoa app write an entry to com.apple.loginitems.plist so it launches at login or is there a better way? Look at the documentation for launchd. ___ Cocoa-dev mailing list (Cocoa-dev@list

Re: Rounded NSBox/NSView?

2009-10-03 Thread Kyle Sluder
On Oct 3, 2009, at 10:35 AM, PCWiz wrote: The problem with these 2 methods is that even though the rounded corners are drawn, anything inside the view (e.g. a table view) does not have rounded corners, only the view itself does. Is there any workaround for this? Set a mask on the graphic

Re: Auto Install Login Item

2009-10-03 Thread Izidor Jerebic
On 3.10.2009, at 21:30, David Blanton wrote: Should my cocoa app write an entry to com.apple.loginitems.plist so it launches at login or is there a better way? See the documentation that answers exactly this question at: < http://developer.apple.com/mac/library/documentation/MacOSX/Conceptu

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 18:08, I. Savant wrote: [ big, massive, much-needed snip ] hmmph. FOCUS!!! I get that you're trying to be witty, but I was forced to skim much of your "question" because it's mostly rambling. Witty is fine. Even a good dose of funny irrelevance, but you do need at l

NSPasteboard -> NSTextView

2009-10-03 Thread Knut Lorenzen
Dear List, My App receives RTF (or RTFD) data via Drag & Drop: - (BOOL)performDragOperation:(id )sender { NSPasteboard *pboard; pboard = [sender draggingPasteboard]; . . . and checks with if ( [[pboard types] containsObject: NSPasteboardTypeRTF] ) { ... for available data type

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 21:31, Mike Abdullah wrote: Well for a start your translation is wrong. Being able to do this: baz = foo.bar; foo.bar = baz; is an Objective-C 2.0 feature – Dot Notation. It is completely orthogonal to Key-Value Coding. Dot Notation works by the compiler figuring out whi

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 17:39, Volker in Lists wrote: have you filled a bug report? - Yes, can do this for documentation. Might lead to the responsible person fastest. So, if not yet done, hurry and do so! But the documentation isn't wrong. It isn't even unclear, if you know exactly what its tr

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 18:12, Izidor Jerebic wrote: Extremely simplified way of describing CoreData is "easy to use database". So if you have something like a personal library application with list of books, CDs, DVDs etc. that can go into 1000s of items and application has GUI for searching,

Re: NSPasteboard -> NSTextView

2009-10-03 Thread Kyle Sluder
On Oct 3, 2009, at 12:59 PM, Knut Lorenzen wrote: How do I assign the RTF(D) in NSPasteboard to my NSTextView *programmatically*? Deserialize the data off the pasteboard, and mutate the text view's associated text storage. Undo events will be logged correctly, but you may want to set the

Re: whether to use core data...

2009-10-03 Thread Greg Guerin
Colin Howarth wrote: This is basically my first serious attempt at a real Cocoa program, This statement has no context. What less-than-serious attempts have you made at less-than-real Cocoa programs? Were all those attempts successful, i.e. did they result in a working program for whatev

Re: Auto Install Login Item

2009-10-03 Thread Jens Alfke
On Oct 3, 2009, at 12:38 PM, Todd Heberlein wrote: On Oct 3, 2009, at 12:30 PM, David Blanton wrote: Should my cocoa app write an entry to com.apple.loginitems.plist so it launches at login or is there a better way? Look at the documentation for launchd. No, launchd is not in charge of u

Re: NSPasteboard -> NSTextView

2009-10-03 Thread Mark Munz
You might just go with some built-in NSTextView methods: - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard which should take the richest data type available or if you want to specify the type: - (BOOL)readSelectionFromPasteboard:(NSPasteboard *)pboard type:(NSString *)type On Sat, Oc

Re: Auto Install Login Item

2009-10-03 Thread Kyle Sluder
On Oct 3, 2009, at 2:26 PM, Jens Alfke wrote: No, launchd is not in charge of user-visible login items, only background agents. See the second answer to the question. On 10.5 and up, launchd can now handle per-user agents that need to launch in a GUI bootstrap namespace. So if you are writ

Re: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 23:05, Greg Guerin wrote: Colin Howarth wrote: This is basically my first serious attempt at a real Cocoa program, This statement has no context. What less-than-serious attempts have you made at less-than-real Cocoa programs? Were all those attempts successful, i.e. d

Re: Auto Install Login Item

2009-10-03 Thread John Joyce
Please don't do that without asking users first. To do so would be Microsoftian iPhoneから送信 ___ 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-d

Re: Auto Install Login Item

2009-10-03 Thread Kyle Sluder
On Oct 3, 2009, at 2:50 PM, John Joyce > wrote: Please don't do that without asking users first. To do so would be Microsoftian It was Skype for me. But yes, this is a very important point, thank you for remembering to make it. :-) --Kyle Sluder ___

KVC, KVO and dot notation. Was: whether to use core data...

2009-10-03 Thread Colin Howarth
On 3 Oct, 2009, at 23:51, Klaus Backert wrote: On 3 Oct 2009, at 22:06, Colin Howarth wrote: If you use dot notation and properties, you are using the -value and -setValue: accessor methods, which is KVC compliant and means that KVO bits will get notified, no? No. From the documentation "

Re: View shifted up on iPhone simulator

2009-10-03 Thread Anthony Smith
Thanks for the input. I was just trying to load a particular XIB based on the device being used. Each XIB would communicate something different. It sounds like I can scratch this idea for something simpler using UIViewController. I'll reread the programming and reference guides and rethink

main nib, firing a secondary nib and it's controller....

2009-10-03 Thread jon
i want to have a WindowController object and it's own nib separate from the main nib.. but i want this secondary nib and controller to fire up when the application launches... what is the best way to do that? thanks in advance, Jon. ___ Coco

Re: Keeping NSWindow below all other windows

2009-10-03 Thread PCWiz
Thanks, that works :-) On 2009-10-03, at 12:14 PM, Alexander Heinz wrote: You could just use (NSNormalWindowLevel - 1). That should be clear to anyone reading the code that you want the level below the lowest. - Alex On Oct 3, 2009, at 2:04 PM, PCWiz wrote: The lowest constant I could find

Working with an Unsupported Character Encoding (ANSEL)

2009-10-03 Thread Thomas Wetmore
I am writing software to handle GEDCOM files. These files are usually in ASCII format, though some are in ANSEL format (the format they are supposed to be in), and in recent years more and more are in UNICODE encodings. A GEDCOM file is supposed to include an attribute that specifies its ch

Probs with "BetterAuthorizationSample"-code

2009-10-03 Thread Frank W. Tag
Dear all, as a preface: Hopefully this is the right discussion group for my question - otherwise I apologize for the inconveniance and would ask you for a hint to the right one ... I am trying around with the "BetterAuthorizationSample"-code to perform privileged system calls in a mostly

list editor (iPhone)

2009-10-03 Thread Nigel Redmon
I'm writing a simple calculator-like security code lookup app--as a first iPhone app and learning experience, and because it's useful for me. It's for a brokerage service for which the user must go through a challenge-response process to log on. That is, after the user logs on with username

Re: Probs with "BetterAuthorizationSample"-code

2009-10-03 Thread Todd Heberlein
1. How can I debug my HelperTool? Obviously any breakpoints set in XCode won't work because the HelperTool is launched outside by the launchd. 2. My idea is to use asl to debug "barefoot". But for that I have to install aeach time when I have compiled a modified version of the HelperTool to

Re: Working with an Unsupported Character Encoding (ANSEL)

2009-10-03 Thread Adam R. Maxwell
On Oct 3, 2009, at 8:11 AM, Thomas Wetmore wrote: While scanning the file I look for the attribute that specifies what the file should be, but I also do other checks. For example I check whether any of the upper half bytes are illegal ANSEL. And I check for UTF-8 multi-byte encodings. At t

Re: main nib, firing a secondary nib and it's controller....

2009-10-03 Thread Jens Alfke
On Oct 3, 2009, at 4:19 PM, jon wrote: i want to have a WindowController object and it's own nib separate from the main nib.. but i want this secondary nib and controller to fire up when the application launches... Create and open an instance of that WindowController subclass from yo

Re: Keeping NSWindow below all other windows

2009-10-03 Thread Jens Alfke
One oddity of low window levels is that below some level the windows become immune to Exposé, i.e. they stay in place. I think this happens because the Finder's desktop icons are in fact windows at a very low level, and Exposé needs to leave them alone. This can be a useful effect if you wa

Re: Probs with "BetterAuthorizationSample"-code

2009-10-03 Thread Jens Alfke
On Oct 3, 2009, at 6:04 AM, Frank W. Tag wrote: 1. How can I debug my HelperTool? Obviously any breakpoints set in XCode won't work because the HelperTool is launched outside by the launchd. You can use Xcode's Run > Attach command to attach GDB to it once it's launched. (Hopefully Xcode

Bundle is not using icon or CFBundleIdentifier

2009-10-03 Thread Timothy Reaves
I have a bundle defined as a document type for an app. When I build one of these bundles, and double-click it, it opens in my app. All well and good. Except the following. 1) I have an icns file in my bundle, and have the CFBundleIconFile key in the info.plist in the bundle set to the

Re: Working with an Unsupported Character Encoding (ANSEL)

2009-10-03 Thread Jens Alfke
On Oct 3, 2009, at 8:11 AM, Thomas Wetmore wrote: 1. Apparently reading a file to an NSString using the NSASCIIStringEncoding returns each of the bytes of the file exactly as they were, that is, the 8-bit bytes seem to be read exactly as they were. So is it true that reading with NSASCIISt

Re: Bundle is not using icon or CFBundleIdentifier

2009-10-03 Thread Todd Heberlein
Anyone want to point out what I'm doing wrong? Any help appreciated. I think I had to do a Project->Add To Project... and then select the icon file in order to get the icon to be used. Dragging the icons into my project didn't do the trick. Todd __

RE: Making a new "ICNS file" with NSImage

2009-10-03 Thread Squ Aire
<8f5c05b70909172123n2d83a5f8u8191ff101de9a...@mail.gmail.com> Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Thanks for the reply=2C However. I'm having a hard time testing this (i.e. see the difference in ma= rgins) because wheneve