Re: Formatting elapsed time

2012-09-07 Thread Dave DeLong
This isn't quite correct. "j:mm" is a template, not an actual format string. When you run it through every possible locale, you get this output: http://pastie.org/4683032 The presence of the colon in the template is incidental. It would work just fine if you used "jmm" as well. With the res

Re: Formatting elapsed time

2012-09-07 Thread Dave DeLong
Run @"j:mm" through +[NSDateFormatter dateFormatFromTemplate:options:locale:] and the strip the "a" character out of the resulting string. Dave Sent from Jane On Sep 7, 2012, at 3:33 PM, Jens Alfke wrote: > > On Sep 7, 2012, at 3:00 PM, Dennis wrote: > >> How do you eliminate the am/pm? T

Re: Ensuring UIDatePicker shows 24-hour clock?

2012-08-22 Thread Dave DeLong
There is, unfortunately, no reliable way to do this. What you could try doing is setting the locale of the UIDatePicker to something like en_GB, where the preferred time format is "HH:mm" and hope that the date picker recognizes this. However, depending on which version of iOS your app is runn

Re: How to make Obj-C collection subscripting work on iOS 5?

2012-08-20 Thread Dave DeLong
Tough question. At a syntactic level, you could always download a recent version of Clang that you can use to compile your applications. This would allow you to use the syntax. Unfortunately, as you've observed, this would still stick you with the missing method problem: objectAtIndexedSubscr

Re: Simple date format problem? iOS 5

2012-08-09 Thread Dave DeLong
I'm going to venture out on a limb and say you shouldn't be using NSDateFormatter for this. NSDateFormatter is really only useful when you're converting a date to-and-from a human-readable form. The way you're using it, it's not human-readable, and will cause you problems in very subtle ways.

Re: How to display tool-tip on demand

2012-08-05 Thread Dave DeLong
I saw some hits on Google mentioning NSHelpManager. I've never used it, but you could try poking around in there for stuff. Dave On Aug 5, 2012, at 7:23 PM, Michael Crawford wrote: > NSPopover it is. > > -Michael > > On Aug 5, 2012, at 8:58 PM, Gary L. Wade wrote: > >> No, I couldn't find

Re: +bundleForClass: category question

2012-07-16 Thread Dave DeLong
The answer is simple, and it's answered by the name of the method: -bundleForClass: Graham's framework does not define the class. Therefore, it is not the bundle that is returned from the method. This method returns the bundle that defines the class. In Graham's example, it would be the syst

Re: How to implement an object whose properties are really dictionary entries.

2012-07-12 Thread Dave DeLong
Sent from Jane On 2012-07-12, at 7:05 AM, Keary Suska wrote: > The forwardInvocation implementation would be easy. It would also be slow. > In theory, all you need to distinguish is the setX vs X pattern, determine > the actual key name (really just extracting and formatting when you get a

Re: How to implement an object whose properties are really dictionary entries.

2012-07-11 Thread Dave DeLong
On Jul 11, 2012, at 4:54 PM, Keary Suska wrote: > On Jul 11, 2012, at 2:45 PM, Motti Shneor wrote: >> Of what I read from everyone, and after examining the suggested code from >> Jens Alfke, I think I'm inclined to something simpler, hinted by Keary >> Suska. Could you spare a few more words

Re: How to implement an object whose properties are really dictionary entries.

2012-07-11 Thread Dave DeLong
On Jul 11, 2012, at 1:45 PM, Motti Shneor wrote: > Wow, and thanks, everyone. BTW, what does "OP" stand for? (obviously, its > me...) OP = original poster > Of what I read from everyone, and after examining the suggested code from > Jens Alfke, I think I'm inclined to something simpler, hinte

Re: How to implement an object whose properties are really dictionary entries.

2012-07-11 Thread Dave DeLong
It sounds like the OP is looking for a model object that uses an NSMutableDictionary as the backing store for its properties, as opposed to individual ivars. You can do this. You declare all your properties, and you declare a single NSMutableDictionary ivar. All of the properties should be imp

Re: Equation style display

2012-07-02 Thread Dave DeLong
Hi Jean, In terms of parsing, I've written a library to help with that: https://github.com/davedelong/DDMathParser/ You'll probably want to do something like this: NSString *equation = @"(9/10) * sin( $x/(2*$t) )"; // note that variables need a $ in front of them, for simplicity NSError *er

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-25 Thread Dave DeLong
Yes, you can do this, because ARC is a compile-time option and files are compiled individually. To compile with ARC, you'll need to use the -fobjc-arc flag. Cheers, Dave Sent from Jane On Jun 25, 2012, at 6:20 PM, Graham Cox wrote: > > On 26/06/2012, at 7:42 AM, Greg Parker wrote: > >>

Re: Why do we use -fobjc-arc instead of removing code with #define?

2012-06-23 Thread Dave DeLong
Yep, you can do this. The #if you're looking for is: #if __has_feature(objc_arc) ... #endif You can just scatter that everywhere in code, or you could do something like this: #if __has_feature(objc_arc) #define DD_RETAIN(_o) (_o) #define DD_RELEASE(_o) #define DD_AUTORELEASE(_o) (_o) #els

Re: Simple question driving me CRAZY

2012-06-16 Thread Dave DeLong
From http://developer.apple.com/library/mac/releasenotes/ObjectiveC/RN-TransitioningToARC/Introduction/Introduction.html#//apple_ref/doc/uid/TP40011226-CH1-SW17: > Which classes don’t support weak references? > You cannot currently create weak references to instances of the following > classes:

Re: WWDC registration on Sunday

2012-06-09 Thread Dave DeLong
https://developer.apple.com/wwdc/news/ 9am - 7pm Dave On Jun 9, 2012, at 5:46 PM, Eric E. Dolecki wrote: > I'm getting in late on Sunday (7PM) - anyone know how late the registration > runs? Would like to avoid Monday morning for it if I can. > > Thanks. > Eric > > > Google Voice: (508) 656

Re: Color Panel oddity

2012-06-08 Thread Dave DeLong
Try this: http://www.apptree.net/images/colourpanel.png On Jun 8, 2012, at 7:10 PM, Kyle Sluder wrote: > On Jun 8, 2012, at 5:55 PM, Graham Cox wrote: > >> >> >> A user is reporting this strange state of the Color Panel: >> >> http://ftp.apptree.net/images/colourpanel.png >> > > I get a 40

Re: Exclude or Negate NSComparisonPredicate

2012-05-21 Thread Dave DeLong
You'd keep most of what you have, but just add in the negation: On May 21, 2012, at 11:47 AM, Chris Paveglio wrote: > I'm doing an NSMetadataQuery something like this: > > NSPOT = NSLikePredicateOperatorType; > myPredicate = [NSComparisonPredicate > predicateWithLeftExpression:[NSExpressionexpre

Re: Basic Question

2012-05-09 Thread Dave DeLong
On May 9, 2012, at 1:12 PM, H. Miersch wrote: > what does "grok" mean? It's a term that roughly means "to completely understand something". http://en.wikipedia.org/wiki/Grok Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not

Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong
On Apr 21, 2012, at 3:14 AM, Ken Thomases wrote: > On Apr 20, 2012, at 1:32 PM, vinayak pai wrote: > >> Yes. I am facing the same problem. I am updating the menu in >> performSelectorOnMainThread. If the menu is kept open without any >> event then there is menu refreshing issue ie. sometimes som

Re: Updating NSMenu while it's open

2012-04-24 Thread Dave DeLong
Yes. As I answered before, you have to get things scheduled in the right runloop mode. But once you do, it's quite easy: - (void)applicationDidFinishLaunching:(NSNotification *)aNotification { NSStatusItem *item = [[[NSStatusBar systemStatusBar] statusItemWithLength:24] retain]; [i

Re: Updating NSMenu while it's open

2012-04-18 Thread Dave DeLong
On Apr 18, 2012, at 7:43 PM, Andy Lee wrote: > On Apr 18, 2012, at 9:47 PM, Graham Cox wrote: >> On 19/04/2012, at 10:04 AM, Jerry Krinock wrote: >> >>> [...] >>> You must redesign your app to not require refreshing a menu while it is >>> open. >> >> >> Not true - the system's WiFi menu updat

Re: Updating NSMenu while it's open

2012-04-18 Thread Dave DeLong
Nothing nearly so complicated. You just have to realize that the runloop is in a different mode while the menu is open. If you have a timer to periodically update your menu, then you have to add the timer to the runloop under the NSEventTrackingRunLoopMode. From there, add or update whatever NSM

Re: NSAffineTransform on iOS

2012-04-09 Thread Dave DeLong
I think the major source of confusion is that NSAffineTransform is an object, and CGAffineTransform is not; it's a struct. This is really important. :) > CGAffineTransform transform; > CGAffineTransformTranslate(transform, CGRectGetMidX(tileFrame), > CGRectGetMidY(tileFrame)); The first line

Re: Determining user's clock preference on iOS

2012-02-23 Thread Dave DeLong
On Feb 23, 2012, at 8:21 AM, Kyle Sluder wrote: > On Feb 22, 2012, at 10:50 PM, Rick Mann wrote: > >> I have a need to format times as either >> >> 24:mm >> >> or >> >> 12:mm >> am >> >> That is, if the user prefers a 24-hour clock, I want it to appear on a >> single line. If the u

Re: NSFetchRequest Problem Under iOS 4.3.5

2012-01-24 Thread Dave DeLong
NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] init]; NSEntityDescription *entity = [NSEntityDescription entityForName:@"Relationship" inManagedObjectContext:context]; [fetchRequest setEntity:entity]; Dave On Jan 24, 2012, at 11:40 AM, Laurent Daudelin wrote: > Given the following

Re: Core Audio Help

2011-12-23 Thread Dave DeLong
"Beginning iPhones Game Development" (http://playcontrol.net/iphonegamebook/) has a few chapters on Core Audio and OpenAL. HTH, Dave On Dec 23, 2011, at 9:44 AM, Phil Hystad wrote: > Yes, I know of that "promised" book. It seems to have been in the works for > a long time. I just checked A

Re: How to get the phone number use ios sdk in iphone.

2011-12-22 Thread Dave DeLong
http://developer.apple.com/library/IOs/documentation/UIKit/Reference/UIDevice_Class/DeprecationAppendix/AppendixADeprecatedAPI.html#//apple_ref/doc/uid/TP40006902-AppendixA-DontLinkElementID_47 Cheers, Dave On Dec 22, 2011, at 6:08 PM, 吴明 wrote: > I dont found about this in iOS5.0 Api diffs and

Re: How to get the phone number use ios sdk in iphone.

2011-12-22 Thread Dave DeLong
FYI, the DeviceID was deprecated in iOS 5. Dave Sent from Jane On Dec 22, 2011, at 4:50 PM, 吴明 wrote: > Thanks > I will use the UUID or DeviceID instead of the phone number. > ___ > > Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) > > Please d

Re: Calling a Cocoa library from C

2011-11-11 Thread Dave DeLong
Here's a hint: What does every main() function do in every iOS and Mac app? Dave Sent from Jane On Nov 11, 2011, at 5:49 PM, Nathan Sims wrote: > Newb question. I need to create an OS X Cocoa library that is going to be > called from a C program. The C program's interface will be simple, alo

Re: NSDateFormatter -initWithDateFormat:: vs. -init

2011-11-11 Thread Dave DeLong
I think you've misunderstood the documentation. -init is the preferred method for creating 10.4+ date formatters. http://developer.apple.com/library/mac/documentation/Cocoa/Reference/Foundation/Classes/NSDateFormatter_Class/Reference/Reference.html#//apple_ref/occ/instm/NSDateFormatter/initWithDa

Re: Getting weekday name from weekday number?

2011-10-18 Thread Dave DeLong
Quick idea off the top of my head: Ask an NSDateFormatter for its shortWeekdaySymbols (returns an NSArray of NSStrings) and index into that with your weekday number. Other than that, the correct way to do this is to construct an NSDate with the appropriate weekday and then use a date format of

Re: Best way to parse a time today?

2011-10-13 Thread Dave DeLong
Yep, this is what I was referring to. I'm not sure there's anything you can do about this, since it's technically the input that is incorrect. However, it's still good to be aware that these edge cases exist. Dave On Oct 13, 2011, at 10:39 AM, Rick Mann wrote: > I think the concern is this.

Re: Best way to parse a time today?

2011-10-12 Thread Dave DeLong
Be careful with this approach, since there are some weird edge cases where that time may not exist on the proposed day (think DST boundaries). Dave Sent from my iPhone On Oct 12, 2011, at 6:46 PM, Roger Dalal wrote: > Rick: > > The following code, which is likely what you are doing, will re

Re: How to create an expression?

2011-09-26 Thread Dave DeLong
I don't think it's possible without a format string. "$x.firstName" gets turned into an expression of type NSFunctionExpression. The operator is a variable expression, and the first argument is an expression with a private type (10). gdb shows that the class of that argument is "NSKeyPathSp

Re: How to subscribe to Xcode users list?

2011-09-14 Thread Dave DeLong
It looks like the page has been moved: http://lists.apple.com/mailman/listinfo2 Dave On Sep 14, 2011, at 8:10 AM, Gerriet M. Denkmann wrote: > Several Apple pages have links to > or > , but when I try to op

Re: determine whether an ancillary program/task can run

2011-09-01 Thread Dave DeLong
You could probably catch this before attempting to launch the task. Create a new NSBundle object pointing at the executable path, and then ask the bundle for the -executableArchitectures, and see if one of the returned values matches the architecture of the machine you're running. If it matches

Re: Finding the UITableViewCells that intersect a rect?

2011-08-15 Thread Dave DeLong
-[UITableView indexPathsForRowsInRect:] Dave Sent from my iPhone On Aug 15, 2011, at 4:59 PM, Rick Mann wrote: > Is there any way to get a list of UITableView cells that intersect a rect? Or > will I have to iterate the cells myself? > > -- > Rick > > _

Re: NSLog() without the timestamp?

2011-08-09 Thread Dave DeLong
Try something like this: http://cocoaheads.byu.edu/wiki/different-nslog Cheers, Dave On Aug 9, 2011, at 9:30 AM, William Squires wrote: > Is there a function like NSLog() that doesn't print the timestamp (and other > crap) and doesn't automatically append a '\n' at the end? If not, what would

Re: Subclassing UIWebview a show-stopper?

2011-08-08 Thread Dave DeLong
Hi Arri, Subclassing UIWebView is probably not going to get your app rejected (though I have no insight in to the approval process). However from a architecture point-of-view, it "smells" bad. UIWebView is one of those views that's not intended to be subclassed. Sure you can, since you can d

Re: ARC and Singletons

2011-08-01 Thread Dave DeLong
That would work. However, you lose out on being able to declare "foo" as an @property (not a big deal) and have to write the accessors yourself (annoying, since the compiler knows how to do this already but can't in this case). Dave On Aug 1, 2011, at 9:05 AM, Dave Zarzycki wrote: > The simpl

Re: Return causes EXC_BAD_ACCESS

2011-07-28 Thread Dave DeLong
ever even expected that to happen. Adding a local > variable and setting it to the value before releasing it and returning that > variable fixes the issue. I am still looking to an link to explanation in > detail as to why this happens. If it's as I said, then I do not think I need

Re: Return causes EXC_BAD_ACCESS

2011-07-28 Thread Dave DeLong
It kind of looks like foundCookieJar is an ivar, which means that "return foundCookieJar" is really going to be "return self->foundCookieJar". Since you set "self" to "nil", you're trying to dereference a NULL pointer, which is a great way to crash your app. HTH, Dave On Jul 28, 2011, at 2:3

Re: Does anyone else dislike Xcode 4?

2011-07-25 Thread Dave DeLong
That was brought up several times before and totally ignored. Dave On Jul 25, 2011, at 11:30 AM, JongAm Park wrote: > Oh... BTW who started this thread in cocoa-dev mailing list? > It should be go to xcode-users! > ___ > > Cocoa-dev mailing list (Coco

Re: Does anyone else dislike Xcode 4?

2011-07-24 Thread Dave DeLong
This discussion is not appropriate for this forum. If you'd like to gripe about the changes in Xcode 4, please use a more appropriate forum, such as: - the Xcode Users list - http://bugreport.apple.com - http://devforums.apple.com This list is for technical discussions about the Cocoa and Cocoa

Re: Does anyone else dislike Xcode 4?

2011-07-24 Thread Dave DeLong
Perhaps it's just me, but it seems like this discussion would be much more appropriate on the Xcode Users list: http://lists.apple.com/mailman/listinfo/xcode-users Cheers, Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not pos

CocoaHeads Silicon Valley tonight!

2011-07-21 Thread Dave DeLong
Hi everyone, I haven't seen a posting about this yet, so I thought I'd throw it out there. CocoaHeads Silicon Valley is meeting TONIGHT at 7pm in the "Bodega Bay" tech talk room at Google in Mountain View. More information, including the physical address, are available here: http://cocoahead

Re: Trimming certain patterns from NSString?

2011-07-18 Thread Dave DeLong
Regular Expression find and replace? Basically, replace something like @"^\\d+ - " with @"". Dave On Jul 18, 2011, at 10:46 AM, Eric E. Dolecki wrote: > I am collecting track information (titles) and I would like to trim off > certain things > > 01 - Barracuda > becomes Barracuda > > 02 - Lo

Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-06-30 Thread Dave DeLong
Yeah, that should be fine, but it's unnecessary. You can just do: NSArray *objectsArray = [theArray valueForKey:key]; And it'll do pretty much the same thing (except that it'll call -valueForKey: on each item in the array, and not objectForKey:. However, if the objects are NSDictionaries, tha

Re: How to assign a method for touch event to a UIImageView?

2011-06-24 Thread Dave DeLong
On Jun 24, 2011, at 1:36 PM, Fritz Anderson wrote: > UIImageView is not a control, so it doesn't have built-in handlers for > touches that would feed a target-action pair. You'll have to make a subclass > of UIImageView (in my experience it tolerates subclassing well), and add your > own touch

Re: Writing extremely large RTF or .doc files

2011-06-19 Thread Dave DeLong
Thanks for the suggestions, everyone. I ended up generating HTML files, and they seem to be working fine. Cheers, Dave On Jun 18, 2011, at 8:06 AM, Douglas Davidson wrote: > I might point out that NSAttributedString has a facility for writing out HTML > that has options flexible enough to do

Re: Synthesised properties and additional actions

2011-06-19 Thread Dave DeLong
On Jun 19, 2011, at 11:01 AM, Matt Neuburg wrote: > I provide a good (I think) technique for doing this in my book (p. 275, > example 12-5 "Overriding synthesized accessors"). You can also download > sample code here: > > https://github.com/mattneub/Programming-iOS-4-Book-Examples/tree/master/

Re: Synthesised properties and additional actions

2011-06-18 Thread Dave DeLong
For the most part, yes. You may keep it around if your property is readwrite and you don't want to write the setter yourself as well. :) Dave On Jun 18, 2011, at 10:43 PM, Graham Cox wrote: > Thanks, I understand. > > Seems to me if you are going to do this the advantages of @synthesize are

Re: Synthesised properties and additional actions

2011-06-18 Thread Dave DeLong
The instance variable is synthesized as well and has the same name as the property, so you should use that: -(void)setFoo:(id)newFoo { if (foo != newFoo) { [foo release]; foo = [newFoo retain]; [self doSomethingElseAsWell]; } } Dave On Jun 18, 2011, at 10:12 PM, Graham Cox wrote

Re: Writing extremely large RTF or .doc files

2011-06-17 Thread Dave DeLong
e: > > On Jun 18, 2011, at 1:18 AM, Dave DeLong wrote: > >> It needs to be editable after the fact. >> >> Dave >> > > It is. If you open such a file in Word, it just looks like styled text. You > can edit it and save it as html or RTF. Whichever you

Re: Writing extremely large RTF or .doc files

2011-06-17 Thread Dave DeLong
On Jun 17, 2011, at 10:15 PM, Ken Tozier wrote: > Is there some reason the text needs to be RTF? Is it just that you want to > view this text formatted nicely at a future date? Or do you plan on > distributing the monster RTF? It needs to be editable after the fact. Dave _

Writing extremely large RTF or .doc files

2011-06-17 Thread Dave DeLong
Hey List, I'm writing a little app for myself to take a database full of text and format it into either a Word Document or an RTF document (either one is fine for my purposes). I've got it working for small datasets, but I'm running in to performance issues when trying to generate files larger

Re: Animating NSSplitPane position

2011-06-15 Thread Dave DeLong
I have no special insights into this other than that the BWSplitView (part of BWToolkit) also does animated resizing, so it may be worth a poke around in the BWToolkit source: https://bitbucket.org/bwalkin/bwtoolkit HTH, Dave On Jun 15, 2011, at 7:48 PM, Graham Cox wrote: > Does anyone know

Re: ObjC stdin equivalent? and other questions

2011-06-10 Thread Dave DeLong
On Jun 10, 2011, at 7:56 PM, William Squires wrote: > 1st question: > In regular C, you have the functions for reading/writing to stdio; > printf(), scanf(), etc... > In C++, you have cin/cout and the overridden '>>' and '<<' operators. > What does ObjC have (besides NSLog() anyway) that C/C

Re: Code style (was: Notify With Parameters)

2011-06-02 Thread Dave DeLong
On Jun 2, 2011, at 11:56 AM, Nathan Sims wrote: > On Jun 2, 2011, at 11:38 AM, Jens Alfke wrote: >> >> On Jun 2, 2011, at 1:17 AM, Conrad Shultz wrote: >> >>> Google's Objective-C style guide >>> (http://google-styleguide.googlecode.com/svn/trunk/objcguide.xml) >>> directs that spaces in method

Re: Archiving / Unarchiving Question

2011-06-01 Thread Dave DeLong
Your archive includes an instance of "DataObject", but the process doing the unarchiving does not have that class definition. Dave On Jun 1, 2011, at 6:40 PM, Tony S. Wu wrote: > NSInvalidUnarchiveOperationException, reason is *** -[NSKeyedUnarchiver > decodeObjectForKey:]: cannot decode objec

Re: Fuzzy string matching

2011-05-31 Thread Dave DeLong
I've used this in the past with pretty good results: http://weblog.wanderingmango.com/?pg=2 HTH, Dave Sent from my iPad On May 31, 2011, at 9:32 AM, "Eric E. Dolecki" wrote: > Wondering if anyone knows of or has an Obj-C Class that can provide levels > of fuzzy string matching... looking for

Re: AOP

2011-05-24 Thread Dave DeLong
I've heard good things about this one: https://github.com/tomdalling/AspectObjectiveC Dave On May 24, 2011, at 3:05 PM, Guillermo Moral wrote: > Which *Aspect-Oriented Programming *framework* is *recommended to work with > Cocoa? > > I tried MGAOP but I am not sure it is the right one. > > Gu

Re: Autorotation of toolbar?

2011-05-13 Thread Dave DeLong
Configure your autoresizing springs and struts correctly? Dave On May 13, 2011, at 2:42 PM, Nathan Sims wrote: > Hi, I have a very basic iPhone app. It consists of an MKMapView and a > UIToolBar at the top. It works, but when I rotate the iPhone, the toolbar > goes off to parts unknown and a b

Re: Read-Write Lock is Available?

2011-05-12 Thread Dave DeLong
There's a simple wrapper around the pthread_rwlock_t here: http://cocoaheads.byu.edu/wiki/locks Cheers, Dave On May 12, 2011, at 11:23 AM, Bing Li wrote: > Dear Stephen and Lance, > > I appreciate so much for your reply! > > I am exactly sure if my approach is fine. I plan to protect the dat

Re: prevent multiple instances of a program

2011-05-11 Thread Dave DeLong
There are a bunch of ways to do this, but the general principle is that when an instance of the app starts, it makes its presence known somehow (touching a file, broadcasting a distributed notification, vending a distributed object, etc). Then when a second instance starts, it tries to find a p

Re: Documentation generation

2011-05-08 Thread Dave DeLong
AppleDoc produces Apple-like docsets: https://github.com/tomaz/appledoc Cheers, Dave Sent from my iPhone On May 8, 2011, at 4:42 AM, Thomas Davie wrote: > Heya, > > I'm working on improving my CoreParse > (http://www.github.com/beelsebob/CoreParse) framework by actually documenting > it p

Re: Changing UISwitch text

2011-04-29 Thread Dave DeLong
On Apr 29, 2011, at 4:29 PM, Jon Sigman wrote: > Is there a straightforward way to change the text on the UISwitch ("ON" and > "OFF") to something else? No, there is not. UISwitch is not customizable. > Alternatively, is there a way for a UIButton to act > like a toggle (it stays highlighted

Re: sort array of dictionaries by multiple critera

2011-04-27 Thread Dave DeLong
In that array of sort descriptors, you'd need to pass two of them. The first to sort by type and the second to sort by date. The second sort descriptor would only be used if two objects are sorted as equal by the first descriptor. Dave Sent from my iPhone On Apr 27, 2011, at 6:59 AM, Martin B

Re: How to detect string encoding before reading a file in NSString?

2011-04-26 Thread Dave DeLong
You'd have to guess (by reading the first few bytes of the file, seeing what they are and how they're laid out, etc), or use the initWithContentsOfFile:usedEncoding:error: variant to let NSString guess for you. Dave On Apr 26, 2011, at 11:13 AM, Laurent Daudelin wrote: > I've found different

Re: UI Design on iPad

2011-04-21 Thread Dave DeLong
http://en.wikipedia.org/wiki/Windows_Presentation_Foundation It's a windows thing. Dave On Apr 21, 2011, at 1:17 PM, Roni Music wrote: > >> Message: 6 >> Date: Thu, 21 Apr 2011 12:23:46 +0800 >> From: Bing Li >> Subject: UI Design on iPad >> To: Cocoa-dev@lists.apple.com >> Message-ID: >> Co

Re: NSArrayController & image in column

2011-04-19 Thread Dave DeLong
On Apr 19, 2011, at 3:06 PM, Quincey Morris wrote: > On Apr 19, 2011, at 14:26, Todd Heberlein wrote: > > ... > Another alternative (and a slightly better one, I'd suggest, since it's more > direct) is to provide the NSImage* directly via a data source. It works fine > to use a data source for

Re: NSArrayController & image in column

2011-04-19 Thread Dave DeLong
You could use a custom NSValueTransformer. Subclass NSValueTransformer and have the -transformValue accept one of the objects from your NSArray, and then uses that object to return the appropriate NSImage. Then when you're setting up your bindings, simply type in the name of your NSValueTransf

Re: Proper way to create a singleton without @synchronized ?

2011-04-16 Thread Dave DeLong
This is a truly strange question. If you interpret a singleton to be "one and only one", then it doesnt make much sense to ask about subclassing it, because that would imply that you could instantiate one of the base type and one of the sub type, thus making it not fit the definition of a single

Re: Proper way to create a singleton without @synchronized ?

2011-04-16 Thread Dave DeLong
There are a whole bunch of ways to make singletons. Some are much more work than others... Here's how I would modify your code: // MySingleton.h: #import @interface MySingleton: NSObject { NSUInteger someInteger_; } @property (nonatomic) NSUInteger someInteger; + (MySingleton*) sharedI

Re: Global Shortcuts

2011-04-16 Thread Dave DeLong
On Apr 16, 2011, at 2:57 PM, Bavarious wrote: > On 16 Apr 2011, at 13:02, Eric Schlegel wrote: >> On Apr 16, 2011, at 2:59 AM, Florian Pilz wrote: >> >>> However the Carbon API for global shortcuts (RegisterEventHotKey) is >>> marked as 'Legacy'. I am not sure if thats the same as 'deprecated' i

Re: Error validating email addresses in Core Data

2011-04-15 Thread Dave DeLong
Are you sure you want to be matching against self? Dave Sent from my iPhone On Apr 15, 2011, at 6:30 AM, Michael Crawford wrote: > I'm trying to validate email addresses in Core Data but the regular > expression I'm using doesn't seem to work even though it looks correct. I'm > using the fo

Re: Localized.strings is being ignored

2011-04-12 Thread Dave DeLong
The best way to discover these sorts of errors is to run "plutil /path/to/file.plist". It uses the default option (-lint), which checks the file for syntax errors. This works because a .strings file is really just a plist in the old school non-xml format. If it finds an error, it'll tell you:

Re: Localized.strings is being ignored

2011-04-12 Thread Dave DeLong
I'm pretty sure the file should be called "Localizable.strings", not "Localized.strings". Dave Sent from my iPhone On Apr 12, 2011, at 8:23 AM, Michael Crawford wrote: > I'm trying to localize an app that I have currently selling on the Mac > app-store. I have taken the following steps: >

Re: Storing a block in a CF/NSMutableDictionary?

2011-04-08 Thread Dave DeLong
Please post your code. Dave Sent from my iPhone On Apr 8, 2011, at 5:25 PM, Rick Mann wrote: > Hi. In my garbage collection-required app, I'm trying to store a code block > (void (^)(void)) in a CFMutableDictionary. The docs says copy/retain/release > can be sent to a block, suggesting this

Re: Best way to find files

2011-04-06 Thread Dave DeLong
What sort of files do you want to find? What do you want to do with them? Both things you tried work just fine, depending on the answers to those questions. Dave On Apr 6, 2011, at 1:24 PM, Dominic Dauer wrote: > Hi, > I would like to know which is the best way to find files in the file syste

Re: Book for expert programmer about cocoa and Objective-C

2011-04-03 Thread Dave DeLong
Having been an avid reader of his blog, I highly recommend Mike Ash's "The Complete Friday Q&A: Volume 1", though I'm not sure if it's available in printed form: http://www.amazon.com/dp/B004KZQ0LO Dave On Apr 1, 2011, at 1:40 PM, Rodrigo Zanatta Silva wrote: > Hi. I need to have a good book

NSCollectionView and firstResponder madness

2011-03-23 Thread Dave DeLong
Hi everyone, I have an NSCollectionView in a sheet. The NSCV does not allow selection and is used for displaying a list (so maxNumberOfColumns = 1) of views. These views have things like NSComboBoxes and NSTextFields in them. I'm trying to figure out how to be able to tab from textfield to t

Re: (no subject)

2011-03-22 Thread Dave DeLong
Subclass NSSliderCell and override the appropriate methods: http://developer.apple.com/library/mac/#documentation/Cocoa/Reference/ApplicationKit/Classes/NSSliderCell_Class/Reference/Reference.html Then change the cell type of you NSSlider to your custom subclass. Cheers, Dave On May 7, 2009, a

Re: Creating an NSExpression with a keypath and variable

2011-03-16 Thread Dave DeLong
On Mar 16, 2011, at 11:28 AM, Dave DeLong wrote: > - If you want to use a keypath with a variable, you could do: > > FUNCTION($x, 'text') CONTAINS[cd] $searchString Or put another way: FUNCTION($x, 'valueForKeyPath:', 'foo.bar.baz') Dave ___

Re: Creating an NSExpression with a keypath and variable

2011-03-16 Thread Dave DeLong
Directly, yes. NSExpression stores a keypath as a single string, whereas variables are store in their own kind of NSExpression object. When you replace variables with new values, it's only looking for the certain kinds of NSExpression objects to replace. Everything else stays the same. Some

Re: Unique strings array

2011-03-11 Thread Dave DeLong
u can also use an NSMutableDictionary - just > > for (NSString* word in wordsArray) >[dict setObject:anything forKey:word]; > > NSArray* uniqueWords = [dict allKeys]; > > -Stevo > > > On Mar 11, 2011, at 6:19 PM, Dave DeLong wrote: > >> Use

Re: Unique strings array

2011-03-11 Thread Dave DeLong
Use an NSMutableSet instead. That should have constant lookup time instead of linear (like an array usually is). Dave Sent from my iPhone On Mar 11, 2011, at 6:11 PM, Leonardo wrote: > Hi, > I have to extract a list of "unique words" from an array of hundred > thousands words and put them in

Re: get a dictionary out of an array of dictionaries by a criterion

2011-03-09 Thread Dave DeLong
Load the array into memory. Create an NSPredicate with the predicateFormat: @"ID = %d", myID Use filteredArrayUsingPredicate: The resulting array contains the dictionaries you're looking for. OR Loop through the array and find it yourself. Dave On Mar 9, 2011, at 9:18 AM, Martin Batholdy wrote:

Re: easy way to store table-like data

2011-03-07 Thread Dave DeLong
If you have an array of dictionaries, you can use -filteredArrayUsingPredicate, and pass in the NSPredicate with the format string of @"type = 'website'". You'll get back all the dictionaries where [[dictionary objectForKey:@"type"] isEqual:@"website"]; But if you're using these dictionaries f

Re: iPad widget question

2011-02-26 Thread Dave DeLong
I'd start with AQGridView: https://github.com/AlanQuatermain/AQGridView Cheers, Dave On Feb 26, 2011, at 7:10 PM, Lightning Duck wrote: > Hello, I have an iPad widget question (hence the subject) > > I need to make something like a 2D grid of icons where each icon is tappable. > This seems

Re: On NSClassFromString method

2011-02-24 Thread Dave DeLong
On Feb 24, 2011, at 7:24 PM, Graham Cox wrote: > Are you absolutely, definitely without a doubt certain that you spelled the > class name correctly? With the proper capitalization? Dave ___ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please

Re: Cocoa Application without any menu, dock, etc.

2011-02-12 Thread Dave DeLong
Pretty easy: - add an entry to your Info.plist: "LSUIElement" => true (this is the "Application is agent" entry) It's not necessary to delete the menu from MainMenu.xib, because I believe that's only used when your app lives in the Dock. Leaving it in allows your app to still respond to thin

Re: Get ProcessSerialNumber of last front application

2011-02-09 Thread Dave DeLong
Alternative: instead of bringing another process forwards, tell yours to hide. Then the previously-frontmost app will be frontmost again. Dave Sent from my iPhone On Feb 9, 2011, at 7:23 AM, "Mr. Gecko" wrote: > Hello, I am wondering how I can get the last front application > ProcessSerialN

Re: Global HotKey

2011-02-09 Thread Dave DeLong
On Feb 8, 2011, at 11:20 PM, Andy Lee wrote: > On Feb 9, 2011, at 12:56 AM, Daniel Ketel wrote: >> Looks like I have to use Carbon and hope Apple will continue to support it. >> Thank you for your help. > > You might be interested in Dave DeLong's Objective-C wrapper, called DDHotKey: > >

Re: Predicate Help

2011-01-12 Thread Dave DeLong
If you want to make sure the todoCompletedDate isn't NULL as well, you would change the SUBQUERY predicate to: $t.todoCompletedDate != nil && $t.todoCompletedDate >= %@ Dave On Jan 12, 2011, at 4:05 PM, Dave DeLong wrote: > SUBQUERY! :) > > NSArray *objec

Re: Predicate Help

2011-01-12 Thread Dave DeLong
SUBQUERY! :) NSArray *objects = ...; //your array of SRIndexObjects NSPredicate * f = [NSPredicate predicateWithFormat:@"SUBQUERY(todos, $t, $t.todoCompletedDate >= %@)@count > 0", aParticularDate]; NSArray *filteredObjects = [objects filteredArrayUsingPredicate:f]; Explanation: SUBQUERY()

Re: Close System Preferences programmatically

2011-01-04 Thread Dave DeLong
s/installer/uninstaller/ Dave On Jan 4, 2011, at 2:14 PM, Dave DeLong wrote: > Another option would be to have your preference pane launch a little > installer that won't proceed until the user quits System Preferences. > Something like "In order to uninstall MyAwesomeFoo,

Re: Close System Preferences programmatically

2011-01-04 Thread Dave DeLong
Another option would be to have your preference pane launch a little installer that won't proceed until the user quits System Preferences. Something like "In order to uninstall MyAwesomeFoo, please quit System Preferences". Then wait until the app quits, then dismiss the dialog and proceed. Y

Re: UITableView with only 1 row selectable

2010-12-24 Thread Dave DeLong
NSTableView ≠ UITableView On Dec 24, 2010, at 9:29 AM, Andy Lee wrote: > Are you looking in the delegate docs? > > > > Search the page for tableView:shouldSelectRow: ___

  1   2   3   4   5   6   >