Trouble with NSButtonCell

2009-09-02 Thread Dave DeLong
that seems hopelessly complex. Any ideas on why my tracking method isn't getting called, or a better approach I could be taking to this? Thanks! Dave DeLong ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin reques

Re: Trouble with NSButtonCell

2009-09-03 Thread Dave DeLong
Unfortunately, "setDoubleAction:" is not a method on NSCell or any of its subclasses (except NSPathCell). Really all the BWToolkit is doing is skinning. As far as I can tell from browsing through the code, it's not actually changing functionality of the controls. Dave On Sep 3, 2009, at

Re: singleton pattern in cocoa

2009-09-14 Thread Dave DeLong
Singleton implementation is something that you see debated back and forth every now and then. People argue about the values over overriding -retain, -release, -autorelease, and so on. I really like Peter Hosey's analysis (and implementation) that he's posted on his blog: http://boredzo.o

Optimizing Enormous lists in NSBrowser

2009-09-17 Thread Dave DeLong
ual listing of contents? (I can scan through the folder and count by just grabbing catalog infos myself, but is there a faster way?) 2. How can I retrieve the name of the nth item in a directory without retrieving the actual listing of contents? Thanks! Dave DeLong _

Re: favicon of address

2009-09-20 Thread Dave DeLong
I've been spending the past couple days working on webservers, and I've noticed that the first time that the browser requests a page, it also requests /favicon.ico, no matter what page in the file hierarchy it's trying to GET. From there, it would seem like if you have a host name (http://w

Re: Optimizing Enormous lists in NSBrowser

2009-09-21 Thread Dave DeLong
That's a great question. Simple tests show that Finder can handle a folder of a million files in about 2-3 minutes (more than twice as fast as what I described in my original email). Dave On Sep 21, 2009, at 9:01 AM, Scott Ribe wrote: For normal-sized directories, this works pretty well.

Re: an app that never quits

2009-09-21 Thread Dave DeLong
Unless you're running your app on a jailbroken iPhone, or you leave your app running all the time, what you are asking is not possible. IIRC, when the user takes a call, your app does not necessarily terminated, but the user can choose to switch to the phone app, which would kill your app.

Re: Static Analyzer Question

2009-09-30 Thread Dave DeLong
To continue a bit on this idea, I believe that the static analyzer only analyzes a single method at a time. I don't believe it recurses into called methods to do analysis. (Can any of the clang-sa folks confirm this?) Dave On Sep 29, 2009, at 6:31 PM, Jens Alfke wrote: On Sep 29, 2009,

Re: Cocoa UI Libraries?

2009-09-30 Thread Dave DeLong
Our CocoaHeads group has a decent list of code like this too: http://cocoaheads.byu.edu/resources/user-interface (You're welcome to add to it, too!) Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or mod

Re: GC crash due to being naughty

2009-10-15 Thread Dave DeLong
I'd start by taking a look at the CHDataStructures framework: http://cocoaheads.byu.edu/wiki/chdatastructures It's a framework hosted by our local CocoaHeads group that includes most of the data structures that Apple forgot. =) Cheers, Dave On Oct 15, 2009, at 5:44 PM, Ben Haller wrote:

Re: OSX have that is equivalent to WaitMessage() Win32 API

2009-10-18 Thread Dave DeLong
Since it wasn't explained "The WaitMessage function yields control to other threads when a thread has no other messages in its message queue. The WaitMessage function suspends the thread and does not return until a new message is placed in the thread's message queue." The closest thin

Re: Problem writing unit tests - "Incompatible types in initialization"

2009-10-25 Thread Dave DeLong
On Oct 25, 2009, at 2:08 PM, Ian Piper wrote: It also has a method called convertCToF that ... returns the converted temperature, also as a float. NSNumber *newTemperatureInF = [testConverter convertCToF]; // This is where I get the error "Incompatible types in initialization" An NSNumb

Re: first responder being clobbered

2009-10-26 Thread Dave DeLong
Nope. In CocoaTouch, you can explicitly assign a UIResponder to be first responder by sending it the -becomeFirstResponder message. There is no "makeFirstResponder" method. IMO, this is one of the improvements of CocoaTouch over Cocoa. The responder system seems to be better organized.

Re: UIButton label

2009-10-27 Thread Dave DeLong
Because the proper way to set the text of a UIButton is setTitle:forState: Looking at the documentation, it looks like "button.titleLabel.text" is for querying what the title happens to be at the time (without knowing the state). Dave On Oct 27, 2009, at 1:43 PM, DKJ wrote: I'm having a

Re: Trying blocks

2009-10-30 Thread Dave DeLong
PLBlocks - http://code.google.com/p/plblocks/ Dave On Oct 30, 2009, at 9:28 AM, Jens Alfke wrote: Also, there is an open-source implementation of blocks for 10.5, including a compatible copy of the Clang compiler. I don't recall the name/URL of the package but it shouldn't be hard to find

Re: Ruby Grammar for TDParseKit

2009-11-02 Thread Dave DeLong
TDParseKit can accept a BNF for a grammar, and a quick google search reveals that there are many ruby BNFs out there. Here's one: http://www.cse.buffalo.edu/~regan/cse305/RubyBNF.pdf Cheers, Dave On Nov 2, 2009, at 12:56 PM, Alexander Cohen wrote: Has anyone created a grammar file for Ruby

Best implementation for iTunes-like playlist structure?

2009-11-07 Thread Dave DeLong
list. Is there a better way I could model this structure? Have any of you worked on apps with similar structures? What did you find helpful? Any insights or suggestions you could sure are greatly appreciated. Thanks! Dave DeLong smime.p7s Description: S/MIME cryptographic sig

Re: Pausing an NSThread

2009-11-07 Thread Dave DeLong
Instead of a BOOL on the main thread, what about an NSLock? Start off by locking it on the main thread, and then the secondary thread can try to lock it, block (because it can't acquire the lock since the main thread has it), and not resume until the main thread unlocks it (equivalent to t

Re: Best implementation for iTunes-like playlist structure?

2009-11-08 Thread Dave DeLong
I've come across several guides and documentation that say the fetched properties can be used to mimic smart playlists in iTunes, but I've yet to see any example or explanation on how that can actually be implemented. I understand that a fetched property is basically a stored fetch request

Re: Best implementation for iTunes-like playlist structure?

2009-11-08 Thread Dave DeLong
On Nov 8, 2009, at 2:31 PM, Jerry Krinock wrote: On 2009 Nov 08, at 13:10, Dave DeLong wrote: I've come across several guides and documentation that say the fetched properties can be used to mimic smart playlists in iTunes, but I've yet to see any example or explanation on ho

Re: Best implementation for iTunes-like playlist structure?

2009-11-08 Thread Dave DeLong
That's good to know. I've decided to put them in while the schema is still malleable. Thanks for the advice. =) Dave On Nov 8, 2009, at 4:48 PM, Graham Cox wrote: On 08/11/2009, at 1:32 PM, Dave DeLong wrote: It has the same data hierarchy as iTunes' playlists (except

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

2009-11-09 Thread Dave DeLong
Hi everyone, I want to use the NSLocalizedStringWithDefaultValue macro in my code (so I can see the proper strings in the UI as I debug), but it's awfully verbose. For example: NSLocalizedStringWithDefaultValue(@"LibraryFolderTitle", (nil), [NSBundle mainBundle], @"Library", @"Library fo

Re: Cocoa Sounds

2009-11-09 Thread Dave DeLong
That makes sense, because NSSound has to go find the resource named "mySound.m4a", load it into memory, and then play it. Have you tried preloading the sound, so that by the time you want to play it, it's already in memory? Dave On Nov 9, 2009, at 11:37 AM, Chunk 1978 wrote: i'm using Co

NSPredicateEditorRowTemplate and dynamic popups

2009-11-13 Thread Dave DeLong
e to a popup button. How can I achieve my dynamic popup button in an NSPredicateEditorRowTemplate? Thanks! Dave DeLong smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin r

Re: Building a tree

2009-11-13 Thread Dave DeLong
While this doesn't exactly address what you're looking for, I'd just thought I'd throw in a plug for the CHDataStructures framework, which (among other things) contains a whole bunch of tree-based data structures (AVL, AA, RB, etc) so you don't have to recreate it yourself. It's FOSS and can be

Re: Where are the interface builder components?

2009-11-14 Thread Dave DeLong
There are a bunch of freely available frameworks that have UI elements like that, such as BWToolkit, BGHudAppKit, AmberFramework, iLife Controls, HMBlkAppKit, and more. Here's a decent list: http://cocoaheads.byu.edu/resources/user-interface Cheers, Dave On Nov 14, 2009, at 6:35 PM, Sandro N

Trouble with NSSegmentedControl

2009-11-16 Thread Dave DeLong
t sentence of this page: http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/SegmentedControl/Articles/SegmentedControlCode.html) How can I achieve the behavior that I'm looking for (and that is implied in the documentation)? Is there a way to set a different target and action for e

Re: Trouble with NSSegmentedControl

2009-11-16 Thread Dave DeLong
Thanks to Seth and his subclass of NSSegmentedControl, I have this working exactly as I had hoped! Cheers, Dave On Nov 16, 2009, at 7:44 PM, Seth Willits wrote: > > On Nov 16, 2009, at 2:09 PM, Dave DeLong wrote: > >> How can I achieve the behavior that I'm looking for

Re: [iPhone] UITableView section header title color

2009-11-18 Thread Dave DeLong
http://developer.apple.com/iPhone/library/documentation/UIKit/Reference/UITableViewDelegate_Protocol/Reference/Reference.html#//apple_ref/doc/uid/TP40006942-CH3-SW3 Cheers, Dave On Nov 18, 2009, at 12:06 PM, Tharindu Madushanka wrote: > Hi > > Could we customize the UITableView section header

Re: Annoying Pragma Mark "Feature"

2009-11-18 Thread Dave DeLong
If you see how "Touch Methods" is indented with respect to "Animation Methods", it would seem to indicate that you're missing a closing brace in your animationDidStop:finished:context: method. Dave On Nov 18, 2009, at 10:24 PM, Chunk 1978 wrote: > sometimes when i want to quickly jump to a met

Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
ke it might give me what I'm looking for. However, I've obviously missed something pretty fundamental to getting my string's rect. Any pointers? Thanks! Dave DeLong smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
wrote: > > On Nov 19, 2009, at 1:28 PM, Dave DeLong wrote: > >> I have an NSTextView that I need to resize dynamically. NSTextView appears >> to resize itself as I add text, but I also need it to shrink itself as I >> delete text. Here's what I've tried:

Re: Trouble finding bounding rect of NSAttributedString

2009-11-19 Thread Dave DeLong
anks, Dave On Nov 19, 2009, at 4:28 PM, Jens Alfke wrote: > > On Nov 19, 2009, at 2:39 PM, Dave DeLong wrote: > >> When I print out the size or rect that these return, I invariably get either >> {0, 0} or something absurd like {{1.17076e-318, 2.29357e-314}, >>

Re: NSOutlineView - How to hide disclosure triangle for root nodes ?

2009-11-25 Thread Dave DeLong
You want this delegate method: - (BOOL)outlineView:(NSOutlineView *)outlineView shouldShowOutlineCellForItem:(id)item; Cheers, Dave On Nov 25, 2009, at 9:49 AM, Mario Kušnjer wrote: > > On 2009.11.25, at 17:20, Jens Alfke wrote: > >> >> On Nov 25, 2009, at 5:49 AM, Mario Kušnjer wrote: >>

Re: NSOutlineView - how to have a default item selected

2009-11-25 Thread Dave DeLong
How about this? NSInteger index = [myOutlineView rowForItem:itemToSelect]; NSIndexSet * indexSet = [NSIndexSet indexSetWithIndex:index]; [myOutlineView selectRowIndexes:indexSet byExtendingSelection:NO]; HTH, Dave On Nov 25, 2009, at 4:48 PM, Boyd Collier wrote: > Mario Kušnjer's question remi

NSPredicateEditorRowTemplate and dynamic templateViews

2010-03-12 Thread Dave DeLong
Hi everyone, I'm trying to build a custom predicate editor row template that lets me do predicates like "in the last 30 days" or "since {aDate}". For the simple date comparison, I'm returning an NSDatePicker as the third view in my templateViews. My problem is that I only want to return the NS

Re: NSPredicateEditorRowTemplate and dynamic templateViews

2010-03-12 Thread Dave DeLong
This seems so obvious in retrospect that I can't believe I didn't think of that. Thank you so much! Dave On Mar 12, 2010, at 2:57 PM, Peter Ammon wrote: > What you want to do here is to create two separate templates. One "looks > like" this: > > [Creation Date, Modification Date]

Re: NSPredicateEditorRowTemplate and dynamic templateViews

2010-03-12 Thread Dave DeLong
nds of "greater than" comparisons in the same row template? Thanks! Dave DeLong smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator

Re: Proper control for a list of actions

2010-03-13 Thread Dave DeLong
t made the left expression a keyPath (@"stopRules"), the operator ==, and the right expression YES. I then overrode template views to not show the operator or the right expression. It works like a charm. Cheers, Dave On Mar 10, 2010, at 12:16 PM, Dave DeLong wrote: > OK, follow

Re: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
Correct, because when you dispatch a block to a queue, the queue has no parameters to give to the block. It also has no place to return to. Hence the block signature is "void (^)(void)". Dave On Mar 15, 2010, at 3:43 PM, Rick Mann wrote: > Oh, hmm. I guess my blocks can't receive parameters

Re: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
Yep, that's legal. Dave On Mar 15, 2010, at 3:45 PM, Rick Mann wrote: > Oh! Sorry for the noise, but I think I can do this: > > [[NSOperationQueue mainQueue] addOperationWithBlock: ^{ > myProvidedBlock(param1, param2); > }]; smime.p7s Description: S/MIME cryptographic signature

Re: Anything like -[performBlockOnMainThread:]?

2010-03-15 Thread Dave DeLong
You could put your block into an NSBlockOperation, and then use the queue's addOperations:waitUntilFinished: method to execute it. Cheers, Dave On Mar 15, 2010, at 3:47 PM, Rick Mann wrote: > Then again, what I was doing before was really: > > [mTarget performSelectorOnMainThread: mSelector w

Re: Threads Question

2010-03-17 Thread Dave DeLong
And it also happens to have a very convenient -terminate method. :) Dave On Mar 17, 2010, at 1:21 PM, Sherm Pendley wrote: > On Wed, Mar 17, 2010 at 10:36 AM, Philippe Sismondi > wrote: > >> So, I want to launch the secondary task in a separate thread to keep the >> main runloop responsive.

Re: drag & drop / re-ordering

2010-03-22 Thread Dave DeLong
Here's a little blurb I wrote a while ago on the basics of drag and drop: http://stackoverflow.com/questions/1383021#1383640 HTH, Dave DeLong On Mar 22, 2010, at 11:31 AM, Rainer Standke wrote: > Hello, > > I am looking to create a drag & drop mechanism that allows

Re: Remove/Disable NSPredicate from NSMutableSet?

2010-03-23 Thread Dave DeLong
filterUsingPredicate: modifies the container in place. Unless you created a copy of the set/array before filtering, you can't go back to how it was before. Cocoa doesn't have versioned collections. Dave On Mar 23, 2010, at 2:27 PM, Robert Monaghan wrote: > How does one remove a NSPredicate f

Re: Sending a Cmd-V keystroke

2010-03-26 Thread Dave DeLong
I think you're probably moving too fast. Pasting is not a synchronous operation. What I'm guessing is happening is that you're filling the pasteboard, pasting, filling, pasting, filling, and pasting, but the pasteboard hasn't starting actually *pasting* until you've already refilled it a third

Re: NSPredicateEditorRowTemplate and dynamic templateViews

2010-03-30 Thread Dave DeLong
I'm still struggling with this. Does anyone know how I can either: 1. Use custom comparators in an NSPredicateEditorRowTemplate or 2. Have two templates with the same left expression and operator, but different right expression types? Thanks, Dave On Mar 12, 2010, at 7:29 PM, Dave D

Re: performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)

2010-04-01 Thread Dave DeLong
performSelector:onThread:withObject:waitUntilDone: is a method on NSObject, not . HTH, Dave On Apr 1, 2010, at 11:32 AM, Andreas Grosam wrote: > I get this warning > > "performSelector:onThread:withObject:waitUntilDone:' not found in protocol(s)" > > when the receiver of the message is decla

Re: NSPredicate/NSExpression - can they solve this Core Data problem?

2010-04-02 Thread Dave DeLong
I can't think of a way to do this without iterating over the entire array. It *might* be possible using key-value coding and fancy keypaths and whatnot, but iteration is going to be far simpler to implement and understand. Dave On Apr 2, 2010, at 8:27 AM, David Hoerl wrote: > Objects: > - NSM

Re: NSPredicate/NSExpression - can they solve this Core Data problem?

2010-04-02 Thread Dave DeLong
Is the use of SUBQUERY() documented anywhere? The only mention I've seen of it is in the reserved keywords section of the Predicate Format String Syntax guide. Dave On Apr 2, 2010, at 3:42 PM, Ben Trumbull wrote: > NSComparisonPredicate* exprPred = (NSComparisonPredicate*)[NSPredicate >

Re: [NSMutableArray array]

2010-04-08 Thread Dave DeLong
Yes, that is safe to use. It's safe to use because classes are really just special objects, which means they get all the class method inheritance that instances get with instance methods. This will work in every case where the implementors have used: [[[self alloc] init] autorelease] //this

Re: What gets automatically localized?

2010-04-08 Thread Dave DeLong
This ticket has popped up on my radar again at work, and I still have a hard time believing that I have to translate things like "File", "Edit", "Undo", "Special Characters", etc myself. Is that really the case? Thanks, Dave On Jan 5, 2010, at 3:

Re: What gets automatically localized?

2010-04-08 Thread Dave DeLong
r 8, 2010, at 2:53 PM, Dave DeLong wrote: > >> This ticket has popped up on my radar again at work, and I still have a hard >> time believing that I have to translate things like "File", "Edit", "Undo", >> "Special Characters", etc myse

Re: set up a hotkey UI

2010-04-12 Thread Dave DeLong
The Shortcut Recorder works pretty darn well: http://code.google.com/p/shortcutrecorder/ The test project uses the PTHotKey library to demonstrate hotkey functionality, but I've found PTHotKey to be somewhat cumbersome, so I wrote my own wrapper: http://github.com/davedelong/DDHotKey Cheers,

Efficiently iterating files on the iPhone

2010-04-14 Thread Dave DeLong
ively ask for each item's attributes. It seems rather inefficient, and I want to make this as efficient as possible. (NSFileManager also does not include resource forks) Any suggestions on how I can iterate a directory and get file information at the same time? Thanks, Dave DeLong

Re: Efficiently iterating files on the iPhone

2010-04-14 Thread Dave DeLong
I don't know how many files I'll be iterating, since I'm working on a library that will (hopefully) end up included in many applications. My reason for wanting to optimize this as much as possible is so that it's as least invasive as possible to other developers who use this. But, judging from

Re: HUD window widgets

2010-04-16 Thread Dave DeLong
I know of three frameworks that provide controls for use in HUD windows (in order of recommendation): BWToolkit - http://www.brandonwalkin.com/bwtoolkit/ BGHUDAppKit - http://www.binarymethod.com/bghudappkit/ HMBlkAppKit - http://shiira.jp/hmblkappkit/en.html Cheers, Dave On Apr 16, 2010, at 2

Re: Checking if a touch is within a UIButton ’s bounds.

2010-04-18 Thread Dave DeLong
Is "self.view" the same thing as "button"? You're using the former to produce a CGPoint, but the latter to produce a bounding rectangle. My guess is that they're not the same, which means the point is in a different coordinate system than "button.bounds". HTH, Dave On Apr 18, 2010, at 9:02

Introspecting the current method

2010-04-18 Thread Dave DeLong
Hi everyone, I was just writing some code and asked myself a question that I don't know the answer to, and a quick look in the documentation didn't reveal anything promising. If I'm inside a method, is there a way to know at runtime whether that method is a class or an instance method? Curren

Re: Introspecting the current method

2010-04-18 Thread Dave DeLong
I like the ([self class] == self) method, simply because it's shorter, but the [[self class] instancesRespondToSelector:_cmd] is also a great solution. Thanks for the ideas! Dave On Apr 18, 2010, at 6:21 PM, Graham Cox wrote: > > On 19/04/2010, at 10:14 AM, Dave DeLong wrote: >

Re: Introspecting the current method

2010-04-18 Thread Dave DeLong
That's amazing! Is there some sort of coherent list of magic identifiers somewhere? Dave On Apr 18, 2010, at 8:21 PM, Michael Ash wrote: > The magic __func__ identifier produces a C string which I believe, in > an ObjC method, has exactly the format you're looking for. smime.p7s Description:

Re: Introspecting the current method

2010-04-18 Thread Dave DeLong
. Thanks everyone! Dave On Apr 18, 2010, at 8:26 PM, Dave DeLong wrote: > That's amazing! Is there some sort of coherent list of magic identifiers > somewhere? > > Dave > > On Apr 18, 2010, at 8:21 PM, Michael Ash wrote: > >> The magic __func__ identifier produce

setValue:forKey: and to-many relationships

2010-04-22 Thread Dave DeLong
Hi everyone, I'm working with some NSManagedObjects and relationships between them. When my code runs, I generate the appropriate key based on the data that I'm parsing. For non-relationship attributes, I can simply do: [myManagedObject setValue:aValue forKey:key]; My question is about to-ma

Re: setValue:forKey: and to-many relationships

2010-04-23 Thread Dave DeLong
Aha! I overlooked that one because I was expecting the method to accept two parameters. Thanks! :) Dave Sent from my iPhone On Apr 22, 2010, at 2:39 PM, Keary Suska wrote: > -mutableSetValueForKey: ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple

Re: NSCalendar date calculation anomaly

2010-04-28 Thread Dave DeLong
Yes. Yes it is. Dave (who also lives in MDT) On Apr 28, 2010, at 8:45 AM, Matt Gough wrote: > ... isn't that due to Daylight savings being different in December and May? smime.p7s Description: S/MIME cryptographic signature ___ Cocoa-dev mailing li

Archiving NSBlockPredicate and NSPredicate date functions

2010-04-28 Thread Dave DeLong
Hi everyone, I've figured out a way to do an "date in the last X days" predicate, but I'm having to do it as a block predicate. This works fine, but I've run up against another situation: NSBlockPredicates don't support archiving. This is a problem, since I need to store this predicate in a

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
You'll basically be writing a custom object to wrap an NSArray in an object with a semaphore to make it threadsafe. Arrays are not threadsafe by default. Cocoa doesn't have a semaphore object beyond the NSLock mutex. However, you can find an implementation of a semaphore here: http://cocoahead

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
#import //somewhere reasonably accessible to your producer: dispatch_queue_t mySerialQueue = dispatch_queue_create("franz.p.paul.myserialqueue", NULL); //in your producer: id newResource = ; // the thing you want to notifyAll() about dispatch_queue_async(mySerialQueue, ^{ /** do somet

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
Whoops, that should've been dispatch_async and not dispatch_queue_async. Silly typing code in an email window... Dave On Apr 29, 2010, at 10:26 AM, Dave DeLong wrote: > #import > > //somewhere reasonably accessible to your producer: > dispatch_queue_t mySerialQueue = > d

Re: Help with threads and queues

2010-04-29 Thread Dave DeLong
If you're worried about cross-platform compatibility, then use NSOperationQueue and NSOperations. The fundamental idea is identical (dispatch_queue = NSOperationQueue, dispatch_block = NSOperation), and on the platforms that have it, they've been re-written to use Grand Central Dispatch. The o

Re: #macdev/#iphonedev ban, in need of sympathy

2010-05-02 Thread Dave DeLong
Hi Patrick, This mailing list is not the place for you to grind your axe. It's where we ask questions and provide answers. I'd also just like to point out that excessive profanity and abusive language is a ban-worthy offense, as outlined in the terms and conditions you agreed to when signing

Re: #macdev/#iphonedev ban, in need of sympathy

2010-05-02 Thread Dave DeLong
They're separate in the sense that this mailing list is hosted and moderated by Apple, and #macdev and #iphone are not. However, I wouldn't be surprised if there's quite a bit of crossover between this community and the IRC community. If you're interested, you may also consider checking out Sta

Re: Custom view as a menu item

2010-05-05 Thread Dave DeLong
-[NSMenuItem setView:] ? http://developer.apple.com/mac/library/documentation/cocoa/reference/ApplicationKit/Classes/NSMenuItem_Class/Reference/Reference.html#//apple_ref/doc/uid/2265-SW1 Dave On May 5, 2010, at 10:17 AM, Nava Carmon wrote: > Anyone? > > On May 4, 2010, at 10:18 AM, Nava C

Determining when dragging begins and ends

2010-05-07 Thread Dave DeLong
Hi everyone, I've got an outlineView that's displaying some managed objects for me. One of the properties being displayed is a countForFetchRequest: integer. Whenever the outlineView reloads, this count is re-evaluated by querying the managedObjectContext. I have a problem when I start dragg

Re: Determining when dragging begins and ends

2010-05-08 Thread Dave DeLong
After playing around with stuff, I realized that this was probably the best option. It means tweaking my model slightly, but it'll probably be the better option in the long run. Thanks, Graham! Dave On May 7, 2010, at 11:07 PM, Graham Cox wrote: > Why not cache the count anyway? If it is tak

Re: Archiving NSBlockPredicate and NSPredicate date functions

2010-05-11 Thread Dave DeLong
awesome! :D Cheers, Dave On Apr 28, 2010, at 2:13 PM, Dave DeLong wrote: > Hi everyone, > > I've figured out a way to do an "date in the last X days" predicate, but I'm > having to do it as a block predicate. This works fine, but I've run up > agains

CocoaHeads Utah Tonight (Thursday), 7pm

2010-05-13 Thread Dave DeLong
Reed Olsen will be presenting on xiblessness (how to write apps without xibs). We'll be meeting in room W110 of the Tanner building on BYU campus (http://map.byu.edu/?building=tnrb) from 7 to 9 pm. Parking is free. See you there! Dave smime.p7s Description: S/MIME cryptographic signature

Re: new to cocoa

2010-05-13 Thread Dave DeLong
Yes, you cannot use UIButton's as keys in a dictionary, because keys in a dictionary are copied, and buttons are not copyable. Here's the better question: what are you trying to do? Using buttons as keys in a dictionary seems... odd. Cheers, Dave On May 11, 2010, at 2:36 PM, Alejandro Marco

Re: Detecting modifier key down when opening a menu?

2010-05-18 Thread Dave DeLong
Sounds to me like you want to investigate NSMenuItem's setAlternate: method. I answered a StackOverflow question about this recently, so I'll just link to that post instead of typing everything again. :) http://stackoverflow.com/questions/2808016#2808168 Cheers, Dave On May 18, 2010, at 1:05

Re: List of all supported apps for file type

2010-05-23 Thread Dave DeLong
Use LSCopyAllRoleHandlersForContentType to get a list of bundle identifiers. The bundle identifiers you can convert into full paths using NSWorkspace, which also has a method to retrieve an icon that for a file at a full path (which in the case of an app, will return an app icon). Cheers, Dav

Re: List of all supported apps for file type

2010-05-23 Thread Dave DeLong
That's really good to know! Thank you for sharing this. :) Dave On May 23, 2010, at 8:51 PM, Scott Ribe wrote: > On May 23, 2010, at 5:03 PM, Dave DeLong wrote: > >> Use LSCopyAllRoleHandlersForContentType to get a list of bundle identifiers. > > No, don't. I

Re: -[NSMutableSet randomObject]

2010-05-25 Thread Dave DeLong
What about something like: @implementation NSSet (Random) - (id) randomObject { NSArray * allObjects = [self allObjects]; if ([allObjects count] == 0) { @throw ...; } return [allObjects objectAtIndex:(arc4random() % [allObjects count])]; } @end On May 25, 2010, at 10:49 AM, Michael A. Cra

Re: -[NSMutableSet randomObject]

2010-05-25 Thread Dave DeLong
Ah, I see; you don't want to provide the same object twice in a row. If that's the case, is it really "random"? ;) Dave On May 25, 2010, at 10:52 AM, Dave DeLong wrote: > What about something like: > > @implementation NSSet (Random) > > - (id) randomObjec

Re: -[NSMutableSet randomObject]

2010-05-25 Thread Dave DeLong
Since an NSSet is, by definition, unordered, the allObjects method is not guaranteed to return the same ordering of objects every time. However, once you have the array, you could easily order it yourself using sortedArrayUsing(Selector/Comparator/Descriptors):. And I've used this code (or rea

Re: Question about predicates and list properties.

2010-05-26 Thread Dave DeLong
Having done a *lot* with NSPredicateEditorRowTemplates and NSPredicateEditors recently, I can confidently say that subclassing NSPredicateEditorRowTemplate is almost always the easiest way to work with row templates. Trying to configure them in Interface Builder is a pain in the proverbial post

Re: The Unadopted Protocol

2010-06-02 Thread Dave DeLong
Mostly d, but partly f. It's d in that it's well-known that you can send any message you want to an id, but f in that the scenario you came up with is a slightly unusual one. Dave On Jun 2, 2010, at 9:57 AM, Matt Neuburg wrote: > Here's something I stumbled on by accident. Consider the follow

Re: NSOutlineView drag and drop problem

2010-06-09 Thread Dave DeLong
What about a category on NSPasteboard that uses an associated object to store stuff in the NSDraggingInfo? Dave Sent from my iPhone On Jun 10, 2010, at 12:12 AM, Graham Cox wrote: > I'm implementing drag and drop in an outline view. > > I implement –outlineView:validateDrop:proposedItem:prop

Re: CocoaEcho

2010-06-14 Thread Dave DeLong
1. They're not being compiled into the same executable. CocoaEcho has two targets: CocoaEchoClient and EchoServer. Each one has only one main() function. 2. That's called a LaunchDaemon. Go research those and then come back with more questions. :) 3. You could kill the daemon if its runn

Re: How tell tell if an NSNumber was initialized from a float or int?

2010-06-26 Thread Dave DeLong
-[NSNumber objCType] Compare that against @encode(float), @encode(int), etc. Cheers, Dave On Jun 26, 2010, at 10:45 AM, Jaime Magiera wrote: > Hello, > > The list search keeps timing out for me, and web searches are not finding > anything. I can see how to tell if an NSNumber was initialized

Re: C arrays as __block variables

2010-06-26 Thread Dave DeLong
That's going to create a new copy of the array every time the block is executed, and the array is not accessible outside of the scope of the block. Matt was asking about: __block char array1[5]; NSBlockOperation * foo = [NSBlockOperation blockOperationWithBlock:^{ array1[0] = 'T'; } Dave On

Re: inference of block return type

2010-06-28 Thread Dave DeLong
Except that the Short Practical Guide to Blocks you linked to uses: ^ () { }; With the example of: int (^Multiply)(int, int) = ^(int num1, int num2) { return num1 * num2; }; int result = Multiply(7, 4); In addition, Session #406 at WWDC 2009 put forth block syntax in the same format (~3:

Re: Tracking multiple NSURLConnections

2010-06-29 Thread Dave DeLong
If you're spawning dozens of connections, you may want to consider giving each one a separate delegate object and encapsulating that connection's specific logic in that delegate. The url connection delegate might then have a weak pointer back to the original controller to notify when the connec

Re: Tracking multiple NSURLConnections

2010-06-29 Thread Dave DeLong
; > On Jun 29, 2010 2:11pm, Dave DeLong wrote: > > If you're spawning dozens of connections, you may want to consider giving > > each one a separate delegate object and encapsulating that connection's > > specific logic in that delegate. The url connection delegat

Re: class_respondsToSelector() in runtime.h?

2010-06-30 Thread Dave DeLong
#import Dave Sent from my iPhone On Jun 30, 2010, at 1:43 PM, Laurent Daudelin wrote: > I need to check for backward compatibility whether a given class object > responds to a selector. I found the function 'class_respondsToSelector()' > which the doc says is defined in 'runtime.h'. However

Re: class_respondsToSelector() in runtime.h?

2010-07-01 Thread Dave DeLong
For more information: http://stackoverflow.com/questions/3107213 Dave On Jul 1, 2010, at 10:05 AM, Michael Ash wrote: > On Wed, Jun 30, 2010 at 5:44 PM, Dave Carrigan wrote: >> >> On Jun 30, 2010, at 2:35 PM, Laurent Daudelin wrote: >> >>> Well, isn't -respondsToSelector: an instance method?

Re: [iPhone] Terminating iPhone App programatically

2010-07-05 Thread Dave DeLong
Apple strongly discourages programmatically quitting your application. That's what the home button is for. http://developer.apple.com/iphone/library/qa/qa2008/qa1561.html Dave Sent from my iPhone On Jul 5, 2010, at 10:08 AM, Tharindu Madushanka wrote: > Hi, > > If I use following code to e

[iPhone] Detecting FaceTime capability

2010-07-05 Thread Dave DeLong
Hi everyone, I'm working on an app that depends on the presence of FaceTime functionality in order to be useful. Currently, FaceTime is only present on the iPhone 4, but we are strongly discouraged from tying app functionality to device models. The overwhelming recommended way to do this is t

Re: [iPhone] Detecting FaceTime capability

2010-07-05 Thread Dave DeLong
I'm not looking to interact with FaceTime; I just need to know that the device can handle it. Dave On Jul 5, 2010, at 12:52 PM, Kyle Sluder wrote: > On Jul 5, 2010, at 10:51 AM, Dave DeLong wrote: > >> Hi everyone, >> >> I'm working on an app that d

Re: How to properly print a SEL type variable?

2010-07-06 Thread Dave DeLong
All of these juicy little functions can be found on the Foundation Functions reference page: http://developer.apple.com/mac/library/documentation/Cocoa/Reference/Foundation/Miscellaneous/Foundation_Functions/Reference/reference.html Cheers, Dave On Jul 6, 2010, at 11:15 PM, vincent habchi wrot

Re: Sanity Check

2010-07-07 Thread Dave DeLong
Why are you retaining self? Other than that, yes it looks fine (assuming you're assigning the results of [[SewAndColorController alloc] init...] into a variable). Dave On Jul 7, 2010, at 2:07 PM, k...@highrolls.net wrote: > Does this code make sense? Where > > [[ SewAndColorController alloc]

  1   2   3   4   5   6   >