Re: Delayed -dealloc occurs on worker thread if object is "working". How?

2010-06-02 Thread BJ Homer
detachNewThreadSelector:target:withObject: retains both the target and the object. -BJ On Wed, Jun 2, 2010 at 11:39 AM, Jerry Krinock wrote: > I allocate an object Foo on the main thread. Then I spin off a secondary > thread and give it a long task to do there, but immediately release the > ob

Notification of unmount events

2010-05-13 Thread BJ Homer
events? If there's a better list for such questions, please feel free to direct me there. I searched on lists.apple.com, and everything relating to DiskArbitration was showing up on Cocoa-dev. Thanks, -BJ Homer ___ Cocoa-dev mailing list

Re: CCHmacInit - key?

2010-05-10 Thread BJ Homer
That is terrifying. I really wish the images worked in that link. Anyone know where you can find them? -BJ On Mon, May 10, 2010 at 3:31 PM, Kyle Sluder wrote: > On Mon, May 10, 2010 at 2:26 PM, Patrick M. Rutkowski > wrote: > > Eh, my rule of thumb is that if I can get it done in less than 48

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: User-space threads and NSAutoreleasePool

2010-03-17 Thread BJ Homer
On Wed, Mar 17, 2010 at 11:47 PM, Greg Guerin wrote: > > Two main questions come to mind: > > Q1. What are you trying to accomplish? > Q2. Why do you think this would work? > > More on Q1: You said you need user-space threads, but you gave no reason > or rationale. If it's because you need 500 t

User-space threads and NSAutoreleasePool

2010-03-17 Thread BJ Homer
d? I assume it is being stored in thread-local storage, but it's not in the NSThread threadDictionary, which means it's probably set using pthread_setspecific. Accessing that value would require the key used to store it, but naturally I don't have access to that. So is there some existi

Re: NSPredicate regex

2010-02-18 Thread BJ Homer
I've found Reggy (http://reggyapp.com/) to be *extremely* useful in debugging regular expressions. -BJ ___ 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

Re: iPhone: validate a NSString for US zipcode

2010-01-07 Thread BJ Homer
Well, depends on what you mean by ordered. NSArray retains insertion order. NSSet does not. But NSSet may be sorting things on insertion (like you'd get with a binary tree structure), while NSArray cannot assume any particular order. So from the NSArray implementor's standpoint, the array is unorde

Question about looping constructs

2010-01-05 Thread BJ Homer
<< Branching from the "Question about garbage collection" thread >> On Sun, Jan 3, 2010 at 11:40 AM, Bill Bumgarner wrote: > > If you are writing your own looping construct, you can call > objc_clear_stack(...) to clear the stack at appropriate times, typically > when the stack is as shallow as

Re: Stack-based C++ class to wrap NSAutoreleasePool

2009-11-16 Thread BJ Homer
Does the stack-based idiom allow returning an autoreleased object? I'd think you'd end up with code like this: - (id)arrayWithStuff { StackAutoreleasePool(); NSArray *array = [NSArray arrayWithObjects:obj1, obj2, etc, nil]; return array; } which would essentially translate into: - (id)arr

Re: [iPhone] OS 3.0 and @synthesize AND @dynamic for the same property

2009-11-13 Thread BJ Homer
On Thu, Nov 12, 2009 at 2:52 AM, Joerg Simon wrote: > Dear all other Cocoa Developers: > > In an app I am developing I have the following strange thing: > > [code in the .h file] > @interface XY : CALayer >BOOL _editing; > ... > @property (assign, getter = isEditing) BOOL editing; > > [/code]

Re: Multiple variable rules in for() statement

2009-11-12 Thread BJ Homer
I believe this is actually independent of being in a for loop. Your first line corresponds to code like this: int i; i=0, int m=0; Which is syntactically incorrect. Your second example corresponds to this: int i; int m=0, i; Which is an attempt to re-declare i. So you're correct; you can't h

Re: Core Data Disable Undo

2009-11-09 Thread BJ Homer
[[managedObjectContext undoManager] disableUndoRegistration]; -BJ ___ 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-dev-admins(at)lists.apple.com

Re: Less verbose way to localize a string with a default value?

2009-11-09 Thread BJ Homer
You can use the -s flag to genstrings to tell it to use your own prefix instead of "NSLocalizedString". For example, passing "-s MyString" would catch calls to MyString(), MyStringFromTable(), MyStringWithDefaultValue(), etc. However, these functions must take the same arguments as the default N

Re: Core-Data : how to merge two contexts ?

2009-11-07 Thread BJ Homer
suspect that would be less efficient. I've tried precisely none of the above personally. I'm just throwing ideas out there. If the above isn't a feasible way to do this in Core Data, I'd love to know why. -BJ Homer ___ Cocoa-d

Re: Problem with allocating memory

2009-10-27 Thread BJ Homer
> > > > NSLog(@"%d", &myString); > Change this line to: NSLog(@"%p", myString); that will print the value of the pointer, which you'll see changing. -BJ ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mode

GC and atomic getters/setters

2009-10-17 Thread BJ Homer
In the Garbage Collection Programming Guide: Architecture [1], an example is given of a set of non-GC getters and setters which use @synchronized(self) to control the access to the ivar, and in the setter to protect the releasing of the old object and retaining of the new. Then, a GC example is gi

Re: NSWorkspaceDidMountNotification not firing on Snow Leopard

2009-10-08 Thread BJ Homer
On Thu, Oct 8, 2009 at 2:39 AM, Dave Keck wrote: > Not sure why it's not working, but if it turns out to be a bug with > NSWorkspace, you might try using the Disk Arbitration framework > instead. See DARegisterDiskAppearedCallback(). Note that there's a difference between "disk appeared" and "d

Re: Constructive Criticism

2009-10-07 Thread BJ Homer
On Wed, Oct 7, 2009 at 10:53 AM, Derek Chesterfield wrote: > > > On 6 Oct 2009, at 22:48, Alastair Houghton > wrote: > > Oh, and since I'm in the dot-syntax-is-evil camp, s/self.year/[self >> year]/g in Bill's code :-D :-D >> > > Just an aside, but does either syntax got optimised by the compil

Re: Correct way to tell if a path is to a .bundle?

2009-09-25 Thread BJ Homer
> Rick, > > You could also use: > NSBundle pluginBundle = [NSBundle bundleWithPath: fullPath]; > > This will return an NSBundle object as your require or nil if fullPath does > not identify an accessible bundle directory. So... > if ( pluginBundle == nil ) ... then it is not a valid bundle. > > Thi

Re: Creator Codes in Snow Leopard

2009-09-23 Thread BJ Homer
iles with the same type code and extension, it can't serve as a creator code. Incidentally, this is not a complaint against UTIs; they are very useful. They're just not meant to solve the creator code problem. -BJ Homer ___ Cocoa-dev mailing li

Re: Stability on Snow Leopard

2009-09-23 Thread BJ Homer
On Wed, Sep 23, 2009 at 6:24 AM, Kirk Kerekes wrote: > ... If you don't happen to be using any of these, (or any macros that hide > relevant code, because the analyzer appears to operate only on unexpanded > code) you should be golden. The analyzer definitely expands macros. I've got some lega

Re: an app that never quits

2009-09-21 Thread BJ Homer
On Sat, Sep 19, 2009 at 1:07 AM, Erick Calder wrote: > I want to write a daemon for the iPhone. my goal is to record the > orientation of the phone across time for later analysis. I am unsure how > this could be done since it seems only one application gets to run at a time > i.e. when the user

Re: #pragma to suppress a warning message

2009-09-16 Thread BJ Homer
If you're just wanting to use the method and avoid the warning, add a category to NSLocale declaring the preferred languages. Just add the interface; no implementation is necessary. You may want to do further investigation; however. It's possible that the preferredLanguages method appeared mid-wa

Re: Retaining a NSURL and retaining its -path

2009-09-12 Thread BJ Homer
On Sat, Sep 12, 2009 at 10:43 AM, John Love wrote: > In my controller, one of my instance variables is a NSURL and I retain it > because I pass it to a 2nd controller. In my second controller, I extract > [myURL path] and look at it in a secondary thread loop and everything works > fine. I bega

Re: Cleaning "garbage" in Core Data

2009-08-16 Thread BJ Homer
On Sun, Aug 16, 2009 at 10:35 AM, Squ Aire wrote: > > I am not *explicitly* marking anything as garbage. Whenever a user decides > to remove a ValidKeys managed object, corresponding key-value pairs in all > the userInfo dictionaries are *conceptually* marked as garbage. This is > because I do no

Re: Custom NSArrayController - Dynamic Class?

2009-07-19 Thread BJ Homer
On Jul 19, 2009, at 11:21 AM, Kyle Sluder wrote: On Jul 18, 2009, at 11:52 PM, BJ Homer wrote: Actually, use [object setIndex:] instead, and cast it as an IndexedObject*. That will get rid of your compiler warnings. -BJ We're talking about the case in which you don't have

Re: Custom NSArrayController - Dynamic Class?

2009-07-19 Thread BJ Homer
On Jul 18, 2009, at 11:52 PM, BJ Homer wrote: On Sat, Jul 18, 2009 at 4:23 PM, Quincey Morris > wrote: On Jul 18, 2009, at 15:07, Kyle Sluder wrote: I would instead recommend using -setValue:forKey: like this: [object setValue:[NSNumber numberWithInteger:[[self arrangedObje

Re: Custom NSArrayController - Dynamic Class?

2009-07-18 Thread BJ Homer
On Sat, Jul 18, 2009 at 4:23 PM, Quincey Morris wrote: > On Jul 18, 2009, at 15:07, Kyle Sluder wrote: > > I would instead recommend using -setValue:forKey: like this: >> >> [object setValue:[NSNumber numberWithInteger:[[self arrangedObjects] >> indexOfObject:object]] forKey:@"index"] >> > > Yes

Re: Where to release in UIView

2009-07-18 Thread BJ Homer
That actually is a valid concern; since you're on the iPhone, memory constraints are tight, and your view may actually be unloaded at some point. Instead of doing additional initialization in awakeFromNib, (which has no counterpart), I'd recommend doing your additional setup in viewDidLoad: on the

Re: ibtool and genstrings do nothing

2009-07-16 Thread BJ Homer
genstrings does not produce output. It does, however, produce Appdel.strings. -BJ On Thu, Jul 16, 2009 at 3:51 PM, Development wrote: > I am trying to use genstrings: > genstrings AppDelegate.m Appdel.strings > from the terminal window and I get no errors and no output. > > Likewise when I do >

Re: iTunes COM interface for Windows; need the equivalent for iTunes on the Mac

2009-07-16 Thread BJ Homer
Or, if you want something more "code-y", try the Scripting Bridge: http://developer.apple.com/documentation/Cocoa/Conceptual/ScriptingBridgeConcepts/UsingScriptingBridge/UsingScriptingBridge.html#//apple_ref/doc/uid/TP40006104-CH4-DontLinkElementID_11 -BJ On Thu, Jul 16, 2009 at 3:55 PM, Nick Zit

Re: Core Data debugging

2009-07-16 Thread BJ Homer
> > > NSError *err; >> BOOL result = [moc save: &err]; >> > Make sure you initialize err: > NSError *err = nil; Otherwise, you may be dealing with a bogus error object, since method-scope variables are not automatically initialized to 0. (Instance variables are initialized, btw.) I don't thin

Re: {Cocoa semi-related} Unable to de-archive an archive from SQLite.

2009-07-14 Thread BJ Homer
It's not an archive; that's the actual binary executable. Just rename it to something more reasonable. I dealt with this just last week. -BJ On Tue, Jul 14, 2009 at 5:06 PM, Frederick C. Lee wrote: > I'm trying to dearcive sqlite3-3.6.16-osx-x86.bin. > > But what I get is: sqlite3-3.6.16-osx-x8

Re: literal strings - who do they belong to?

2009-07-12 Thread BJ Homer
> > But then I saw the case where I have an object which returns, as a method > result or a property, one of its instance variables. The caller holds on to > it (without retaining it) then releases (and deallocs) my object. My object > releases its instance variables which results in the caller ho

Re: Why do I receive KVO notification when new value IS the old value?

2009-07-08 Thread BJ Homer
Likewise, what if I had a program that was counting the number of X events per 10 seconds, and I wanted to add a data point to a list every time it was updated? I would definitely want to record the same number twice in a row. It may not be a common case, but reporting the value enables situations

Re: AsyncSocket. Troubles with MTMessageBroker didReceiveData

2009-07-07 Thread BJ Homer
Neither AsyncSocket nor MTMessageBroker are part of Cocoa, and thus you're very unlikely to find help on a Cocoa developer's list. They're both third-party classes. My best recommendation is that you try Google. The first result for searching *AsyncSocket MTMessageBroker* is this

Re: MDSchemaCopyAllAttributes() returning nil

2009-06-18 Thread BJ Homer
> > > In this particular instance, don't forget that Spotlight importers can > live in ~/Library/Spotlight as well as within app bundles in > ~/Applications. Any answer that MDSchemaCopyAllAttributes() would > give you when running as root might be incorrect for the user who's > actually the resul

Binding to an NSArrayController subclass

2009-05-15 Thread BJ Homer
ind [NSArrayController arrangedObjects] that I don't have access to? Is there a better way to solve my problem? I considered using an NSValueTransformer, but I would have to create a static playlistController object which would be shared app-wide, and I'd

Re: Strategy for acting on changes in child objects?

2009-05-06 Thread BJ Homer
On Wed, May 6, 2009 at 11:55 PM, Graham Cox wrote: > > > I could be wrong, but I don't think this is possible. However, I have > solved this by minimising the tedium of having to register for all those > individual property observations as follows: > > A. each observable object class exports a lis

Re: A tree data structure?

2009-05-06 Thread BJ Homer
On Wed, May 6, 2009 at 2:15 AM, Andreas Grosam wrote: > > On May 5, 2009, at 6:54 PM, Clark Cox wrote: > > On Tue, May 5, 2009 at 8:28 AM, Andreas Grosam >> wrote: >> >>> >>> On May 5, 2009, at 3:21 PM, Ken Thomases wrote: >>> Since you mention NSTreeController and CFTree, you may alre

Re: A tree data structure?

2009-05-05 Thread BJ Homer
You may be interested the CHDataStructures framework, hosted by the BYU CocoaHeads group. It has a number of such structures that should work for you. http://cocoaheads.byu.edu/code/CHDataStructures <http://cocoaheads.byu.edu/code/CHDataStructures>-BJ Homer On Tue, May 5, 2009 at 7

Re: unrecognized selector sent to instance

2009-04-15 Thread BJ Homer
On Wed, Apr 15, 2009 at 9:02 AM, Bill Bumgarner wrote: > On Apr 15, 2009, at 7:04 AM, Jason Stephenson wrote: > >> So, the error that I get at runtime makes it appear that my >> SIGIOBzip2OutputStream does not respond to the -[initToFileAtPath:append:] >> selector, but it does. In the debugger, i

Re: Dragging around an NSImageView

2009-04-03 Thread BJ Homer
On Fri, Apr 3, 2009 at 9:54 AM, Randall Meadows wrote: > On Apr 3, 2009, at 4:14 AM, Aaron Scott wrote: > > I'm trying to figure out how to be able to drag an NSImageView around. The >> NSImageView has been added as a subview to another NSImageView. >> >> Basically, I'm trying to drag a grey box

-[UIView actionForLayer:forKey:] returns NSNull

2009-03-03 Thread BJ Homer
ch always bails out after the first step. This seems odd, since it seems that defaultActionForKey: never actually gets the chance to return a default action unless you're already changing things. Am I missing something here, or is a UIView's layer's actions dictionary on