Re: getting last accessed date

2011-07-08 Thread Stephen J. Butler
On Fri, Jul 8, 2011 at 1:53 AM, Rick C.  wrote:
> Well I am using iconForFile if I remember correctly.  Since I'm on the iPhone 
> let me double-check everything you all have suggested and I'll post back. 
> Thanks again!

Didn't know you were on iOS. But yes, I would expect iconForFile: to
modify the atime.

> On Jul 8, 2011, at 1:52 PM, "Stephen J. Butler"  
> wrote:
>
>> On Fri, Jul 8, 2011 at 12:31 AM, Scott Ribe  
>> wrote:
>>> On Jul 7, 2011, at 11:19 PM, Rick C. wrote:
>>>
 One more note, seems in terminal "stat aFile" works so I suppose I could 
 use nstask to do this as well?
>>>
>>> It does seem odd that the two would produce different results...
>>
>> They don't, at least not in my test. For all six loops of a given file
>> this code gives the same output:
>>
>>
>> #include 
>> #include 
>> #include 
>>
>> #import 
>>
>> int main( int argc, char **argv )
>> {
>>    struct stat st;
>>    int i;
>>
>>    for (i = 0; i < 3; ++i)
>>    {
>>        if (stat( argv[1], &st ) != 0)
>>            return 1;
>>        printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
>>        sleep( 10 );
>>    }
>>
>>    NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>    NSString *file = [NSString stringWithUTF8String:argv[1]];
>>
>>    for (i = 0; i < 3; ++i)
>>    {
>>        if (stat( [file fileSystemRepresentation], &st ) != 0)
>>            return 1;
>>        printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
>>        sleep( 10 );
>>    }
>>
>>    [pool drain];
>>
>>    return 0;
>> }
>>
>> I was testing the Obj-C version just in case fileSystemRepresentation
>> was in some odd way changing the atime.
>>
>> I think something else in your code is going wrong. Are you asking
>> Launch Services for an icon or anything like that?
>> ___
>>
>> 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
>>
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
>>
>> This email sent to rickcort...@gmail.com
>
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMapTable on iOS?

2011-07-08 Thread Dave Keck
> Kind of surprised to discover that NSMapTable doesn’t exist on iOS (even the 
> older procedural form of the API). I need a non-retaining dictionary — do I 
> need to drop down to CFDictionary or is there some higher-level alternative?

I was surprised by this too, but found the CFDictionary alternative palatable:

// weak opaque-pointer keys
// strong object values
NSMutableDictionary *b = (id)CFDictionaryCreateMutable(nil, 0,
nil, &kCFTypeDictionaryValueCallBacks);

// strong object keys
// weak opaque-pointer values
NSMutableDictionary *a = (id)CFDictionaryCreateMutable(nil, 0,
&kCFTypeDictionaryKeyCallBacks, nil);

// weak opaque-pointer keys
// weak opaque-pointer values
NSMutableDictionary *c = (id)CFDictionaryCreateMutable(nil, 0, nil, nil);

Unfortunately the NSMapTable omission means code that's shared between
iOS and OS X can't take advantage of zeroing weak references in the OS
X GC case, but perhaps that's a limited use case.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: App Delegate Methods

2011-07-08 Thread Andy Lee
On Jul 7, 2011, at 5:59 PM, koko wrote:
> So, is there really an  NSApplicationWillFinishLaunchingNotification or is 
> Apple just pulling my leg?

Works for me. You should be able to confirm too by creating a new project.

--Andy


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting last accessed date

2011-07-08 Thread Rick C.
Sorry about that no I'm on Mac OS I was just sending the email from my iPhone 
:-)

Ok I double-checked and I think I am getting the same results as you are.  But 
iconForFile does not modify the Last Opened date that shows in Finder.  So the 
question is how do I get that besides using the spotlight metadata?


On Jul 8, 2011, at 3:24 PM, Stephen J. Butler wrote:

> On Fri, Jul 8, 2011 at 1:53 AM, Rick C.  wrote:
>> Well I am using iconForFile if I remember correctly.  Since I'm on the 
>> iPhone let me double-check everything you all have suggested and I'll post 
>> back. Thanks again!
> 
> Didn't know you were on iOS. But yes, I would expect iconForFile: to
> modify the atime.
> 
>> On Jul 8, 2011, at 1:52 PM, "Stephen J. Butler"  
>> wrote:
>> 
>>> On Fri, Jul 8, 2011 at 12:31 AM, Scott Ribe  
>>> wrote:
 On Jul 7, 2011, at 11:19 PM, Rick C. wrote:
 
> One more note, seems in terminal "stat aFile" works so I suppose I could 
> use nstask to do this as well?
 
 It does seem odd that the two would produce different results...
>>> 
>>> They don't, at least not in my test. For all six loops of a given file
>>> this code gives the same output:
>>> 
>>> 
>>> #include 
>>> #include 
>>> #include 
>>> 
>>> #import 
>>> 
>>> int main( int argc, char **argv )
>>> {
>>>struct stat st;
>>>int i;
>>> 
>>>for (i = 0; i < 3; ++i)
>>>{
>>>if (stat( argv[1], &st ) != 0)
>>>return 1;
>>>printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
>>>sleep( 10 );
>>>}
>>> 
>>>NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
>>>NSString *file = [NSString stringWithUTF8String:argv[1]];
>>> 
>>>for (i = 0; i < 3; ++i)
>>>{
>>>if (stat( [file fileSystemRepresentation], &st ) != 0)
>>>return 1;
>>>printf( "%s #%d atime = %d\n", argv[1], i, st.st_atimespec.tv_sec );
>>>sleep( 10 );
>>>}
>>> 
>>>[pool drain];
>>> 
>>>return 0;
>>> }
>>> 
>>> I was testing the Obj-C version just in case fileSystemRepresentation
>>> was in some odd way changing the atime.
>>> 
>>> I think something else in your code is going wrong. Are you asking
>>> Launch Services for an icon or anything like that?
>>> ___
>>> 
>>> 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
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
>>> 
>>> This email sent to rickcort...@gmail.com
>> 
> ___
> 
> 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
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/rickcorteza%40gmail.com
> 
> This email sent to rickcort...@gmail.com

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting last accessed date

2011-07-08 Thread Chris Ridd

On 8 Jul 2011, at 09:54, Rick C. wrote:

> Sorry about that no I'm on Mac OS I was just sending the email from my iPhone 
> :-)
> 
> Ok I double-checked and I think I am getting the same results as you are.  
> But iconForFile does not modify the Last Opened date that shows in Finder.  
> So the question is how do I get that besides using the spotlight metadata?

Does the resource fork (where the icon lives) have a different set of 
timestamps from the data fork?

Chris
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
Hi all.

I put an MKMapView in my UI and tried to declare an IBOutlet for it,
but compilation fails with this error, in MKGeometry.h:

"'isinf' was not declared in this scope"

The line it's griping about is

UIKIT_STATIC_INLINE BOOL MKMapRectIsNull(MKMapRect rect) {
return isinf(rect.origin.x) || isinf(rect.origin.y);
}

I've imported  where I declare the MKMapView, and
included MapKit.framework in the project.

Anybody know what could be wrong?  Thanks!

Gavin
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Linebreaks ignored in custom cell

2011-07-08 Thread Alexander Reichstadt
Hi,

my cell doesn't display newline chars. It returns YES in the wraps-override. I 
tried all newline chars including the unicode one. Nothing shows. Please, can 
someone help?

Thanks

- (void)drawWithFrame:(NSRect)cellFrame inView:(NSView *)controlView
{







[style setAlignment:NSLeftTextAlignment];
attr = [NSDictionary 
dictionaryWithObjectsAndKeys:style,NSParagraphStyleAttributeName,topLineFont,NSFontAttributeName,topLineColor,NSForegroundColorAttributeName,nil];
[displayID drawInRect:bgRectLineAContent withAttributes:attr];

NSRect lineBodyFrame = cellFrame;
lineBodyFrame.origin.x = 0;
lineBodyFrame.size.height -= bgRectLineA.size.height;
lineBodyFrame.origin.y = cellFrame.origin.y+bgRectLineA.size.height;

NSMutableString *displayString = [NSMutableString string];
//[displayID appendString:[[self objectValue] objectForKey:@"source"]];
//[displayID appendString:@" "];
sortedArray = [NSArray arrayWithArray:[[self objectValue] allKeys]];
sortedArray = [sortedArray 
sortedArrayUsingSelector:@selector(localizedCaseInsensitiveCompare:)];
for (NSString *thisOne in sortedArray){
if ([thisOne length]>6 && [[thisOne substringToIndex:6] 
isEqualToString:@"qdesc_"]){
if ([[[self objectValue] objectForKey:thisOne] length]>0){
//  if ([displayString length]>0) 
[displayID appendString:@"\r"];
[displayString appendString:[[self objectValue] 
objectForKey:thisOne]];
}

}
}

[style setAlignment:NSLeftTextAlignment];
attr = [NSDictionary 
dictionaryWithObjectsAndKeys:style,NSParagraphStyleAttributeName,bodyFont,NSFontAttributeName,topLineColor,NSForegroundColorAttributeName,NSLineBreakByClipping,NSParagraphStyleAttributeName,nil];
[displayString drawInRect:lineBodyFrame withAttributes:attr];
}

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Chris Ridd

On 8 Jul 2011, at 13:39, G S wrote:

> Hi all.
> 
> I put an MKMapView in my UI and tried to declare an IBOutlet for it,
> but compilation fails with this error, in MKGeometry.h:
> 
> "'isinf' was not declared in this scope"
> 
> The line it's griping about is
> 
> UIKIT_STATIC_INLINE BOOL MKMapRectIsNull(MKMapRect rect) {
>return isinf(rect.origin.x) || isinf(rect.origin.y);
> }
> 
> I've imported  where I declare the MKMapView, and
> included MapKit.framework in the project.
> 
> Anybody know what could be wrong?  Thanks!

The man page for "isinf" says you will need to #include  and link with 
-lm. 

Chris
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
> The man page for "isinf" says you will need to #include  and link 
> with -lm.

Thanks, but this is in Apple's code (MKGeometry.h).  If I right-click
on isinf in the flagged line and jump to the definition, it finds it
in math.h.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting last accessed date

2011-07-08 Thread Rick C.
I'll have to check this Chris.  And actually I can disable the icon fetching 
for testing purposes.  The main thing is I have a list of files which I want to 
show the equivalent of Last Opened date in Finder.  I'll post back about this 
thanks!


On Jul 8, 2011, at 5:38 PM, Chris Ridd wrote:

> 
> On 8 Jul 2011, at 09:54, Rick C. wrote:
> 
>> Sorry about that no I'm on Mac OS I was just sending the email from my 
>> iPhone :-)
>> 
>> Ok I double-checked and I think I am getting the same results as you are.  
>> But iconForFile does not modify the Last Opened date that shows in Finder.  
>> So the question is how do I get that besides using the spotlight metadata?
> 
> Does the resource fork (where the icon lives) have a different set of 
> timestamps from the data fork?
> 
> Chris

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Linebreaks ignored in custom cell

2011-07-08 Thread Alexander Reichstadt
Never mindDoh.

Am 08.07.2011 um 15:00 schrieb Alexander Reichstadt:


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Can we get command line arguments in applicationShouldHandleReopen?

2011-07-08 Thread Hirendra Rathor
I have written an .app which is launched many times until the running instance 
shuts down finally. The code
to start it looks like this:

NSTask* task = [[NSTask alloc] init];
[task setLaunchPath: @"/usr/bin/open"];
NSString* app = [NSString stringWithFormat:@"%s", launchApp]; // launchApp 
is the app name
NSArray* arguments = [NSArray arrayWithObjects: app, nil];
NSLog(@"==%@", arguments);
[task setArguments: arguments];
[task launch];
   ...

Like regular GUI applications, a new instance of my application does not come 
up when above code
Is executed. The application delegate has implemented 
applicationShouldHandleRepoen:hasVisibleWindows:
This method returns 'NO' in the end. I want to access the command line 
arguments passed to the application
in this method implementation. Is it possible? If yes, could someone point me 
to the relevant API please?
I tried NSProcessInfo but it (correctly) gives me the arguments passed to the 
running instance.

The idea is to launch the application with different arguments so that it can 
do different
stuff every time. This design is inspired as a result of porting this code from 
other platforms, so I
would be willing to look at other design alternatives if it does not work well 
in the Mac world. However
I would like to give existing solution a try before I do that.

Thanks in advance
Hirendra

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: App Delegate Methods

2011-07-08 Thread Shawn Erickson
On Fri, Jul 8, 2011 at 12:34 AM, Andy Lee  wrote:
> On Jul 7, 2011, at 5:59 PM, koko wrote:
>> So, is there really an  NSApplicationWillFinishLaunchingNotification or is 
>> Apple just pulling my leg?
>
> Works for me. You should be able to confirm too by creating a new project.

Yeah it also has always worked for me. I cannot explain the behavior
you are seeing.

-Shawn
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can we get command line arguments in applicationShouldHandleReopen?

2011-07-08 Thread Shawn Erickson
On Fri, Jul 8, 2011 at 7:13 AM, Hirendra Rathor  wrote:

> The idea is to launch the application with different arguments so that it can 
> do different
> stuff every time.

That isn't going to work. If the application is always running it
cannot be relaunched with new command line parameters. Also command
line parameters are seldom the right way to do something on Mac OS X
with bundled applications (.app).

You likely want to look at using AppleEvents and/or URL handlers for
this... or maybe more advanced launch agent / launch daemon with IPC.

-Shawn
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


User Defaults Controller Binding

2011-07-08 Thread Richard Somers
I have a binding to the User Defaults Controller in Interface Builder in Xcode 
4. The binding entries look like this.

 Controller Key

  values

 Model Key Path

  MyProperty

At the end of the MyProperty entry there is a round dark circle with an 
exclamation mark. I think this indicates an error.

How do I get rid of the round dark circle with the exclamation mark?

--Richard

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Can we get command line arguments in applicationShouldHandleReopen?

2011-07-08 Thread Jens Alfke

On Jul 8, 2011, at 7:13 AM, Hirendra Rathor wrote:

> I have written an .app which is launched many times until the running 
> instance shuts down finally. The code
> to start it looks like this:
> 
>NSTask* task = [[NSTask alloc] init];
>[task setLaunchPath: @"/usr/bin/open"];

That’s pretty awkward! The preferred way to launch an app is to use the 
NSWorkspace methods, or LaunchServices (a lower-level procedural API that gives 
you more options.)

> The idea is to launch the application with different arguments so that it can 
> do different
> stuff every time. This design is inspired as a result of porting this code 
> from other platforms, so I
> would be willing to look at other design alternatives if it does not work 
> well in the Mac world. However
> I would like to give existing solution a try before I do that.

Don’t use command-line args for this. To send parameters when launching an 
application, use AppleEvents. LaunchServices supports sending an 
arbitrary/custom AppleEvent to an app while launching it.

—Jens___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSMapTable on iOS?

2011-07-08 Thread James Montgomerie
On 8 Jul 2011, at 00:30, Dave Keck wrote:

>> Kind of surprised to discover that NSMapTable doesn’t exist on iOS (even the 
>> older procedural form of the API). I need a non-retaining dictionary — do I 
>> need to drop down to CFDictionary or is there some higher-level alternative?
> 
> I was surprised by this too, but found the CFDictionary alternative palatable:
> 
>// weak opaque-pointer keys
>// strong object values
>NSMutableDictionary *b = (id)CFDictionaryCreateMutable(nil, 0,
> nil, &kCFTypeDictionaryValueCallBacks);
> 
>// strong object keys
>// weak opaque-pointer values
>NSMutableDictionary *a = (id)CFDictionaryCreateMutable(nil, 0,
> &kCFTypeDictionaryKeyCallBacks, nil);
> 
>// weak opaque-pointer keys
>// weak opaque-pointer values
>NSMutableDictionary *c = (id)CFDictionaryCreateMutable(nil, 0, nil, nil);

Watch out - if you use toll-free-bridged NSMutableDictionary methods to set 
objects in a mutable CFDictionary with custom key callbacks, the key will be 
copied even if you've specified a custom key callback when creating the 
dictionary.  To not copy the keys (i.e. work as I, at least, would expect), you 
must use the CFDictionary functions to add items.

More information: 
http://www.cocoabuilder.com/archive/cocoa/163407-using-nsimages-as-keys-to-dictionary.html#163439

Jamie.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Custom Colors as UITableViewCell background colors

2011-07-08 Thread Jeff Kelley
Hello all,

We’re creating a custom UIColor pattern (using +[UIColor
colorWithPatternImage:]) and setting it as the background color of our table
view cell. This works great—and avoids several headaches with rounded
corners and grouped table views—except for one thing: when dragging a cell
from one row to another, there’s a momentary flash on the selected cell and
its neighbors. The flash appears to be whatever color is at the bottom-left
of the cell, so probably at point (0,0) in the graphics context. Is there a
method we can override to prevent this from occurring, or a better way to
set a custom background color/image for a cell and keep its rounded corners
in grouped style table views?

Jeff Kelley
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data Predicate Question

2011-07-08 Thread Jerry Krinock

On 2011 Jul 07, at 10:38, Indragie Karunaratne wrote:

> I'm sure there's a better way to simplify this instead of using a giant 
> compound AND predicate

On the contrary, I don't trust that predicateWithFormat: stuff.  It's too easy 
to type mistakes into the format string; in particular it tempts me to get lazy 
and type symbols into the format string literally instead of using NSString 
constants.

I think that giant compound predicates are better.

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data Predicate Question

2011-07-08 Thread The Karl Adam
Well, when I said ANY, I really meant "IN termsArray", but for the
partial matches that you want your approach is fine, you'll just want
to use > & <= with character evaluations to speed this up. Check the
2010 CoreData Performance session from WWDC for more details, but it's
a standard SQL trick to speed up string comparisons.

_Karl

On Thu, Jul 7, 2011 at 10:38 AM, Indragie Karunaratne
 wrote:
> I came up with this code earlier:
> NSArray *searchTerms = [cleanedQuery componentsSeparatedByString:@" "];
>     NSPredicate *basePredicate = [NSPredicate
> predicateWithFormat:@"SUBQUERY(keywords, $keyword, $keyword.name BEGINSWITH
> $QUERY).@count != 0"];
>     NSMutableArray *subpredicates = [NSMutableArray array];
>     for (NSString *searchTerm in searchTerms) {
>         NSDictionary *sub = [NSDictionary
> dictionaryWithObjectsAndKeys:searchTerm, @"QUERY", nil];
>         NSPredicate *termPredicate = [basePredicate
> predicateWithSubstitutionVariables:sub];
>         [subpredicates addObject:termPredicate];
>     }
>     NSPredicate *combinedPredicate = [NSCompoundPredicate
> andPredicateWithSubpredicates:subpredicates];
>
> This doesn't use "ANY" as you mentioned (not sure exactly how I would use
> that) but it works. However, I'm sure there's a better way to simplify this
> instead of using a giant compound AND predicate to match each one of the
> search terms. Is there any way to simplify this?
> Thanks
> On 2011-07-07, at 11:23 AM, The Karl Adam wrote:
>
> You want to be using SUBQUERY() to match ANY keywords. Check the docs
> for the predicate reference details for this.
>
> _Karl
>
> On Wed, Jul 6, 2011 at 8:23 PM, Indragie Karunaratne
>  wrote:
>
> Hi all,
>
> I have a Core Data object model that I'm trying to write a fetch predicate
> for (to use for search). Quick explanation of the model:
>
> We'll call the main entity "Book".  There's also a "Keyword" entity. The
> Book entity has a to-many relationship with the Keyword entity called
> "keywords". In turn, the Keyword entity has an inverse relationship with the
> Book entity called "book".  The Keyword entity has a single attribute called
> "name". So basically, each Book has Keywords that describe it.
>
> For my search, I have an array of search terms. I need a predicate that I
> can use on fetch requests for the Book entity that will evaluate to TRUE if
> ALL of the search terms have a corresponding Keyword in that the "name"
> property begins with the search term.
>
> For example:
>
> There are three books:
>
> Book1 - keywords: {"fiction", "scifi"}
>
> Book2 - keywords: {"nonfiction"}
>
> If the search terms were {"fic", "nonfic", "sci"} the resulting fetched
> array would contain NOTHING because none of the books have keywords that
> begin with all 3 of those search terms..
>
> However, if the search terms were {"fic", "sci"}, the resulting fetched
> array would contain Book1 since its keywords "fiction" and "scifi" begin
> with the two search terms "fic" and "sci".  The key part here is that ALL of
> the search terms have to have a corresponding keyword as demonstrated above
> for the predicate to evaluate to true.
>
> I hope I've explained this problem well enough, it's hard to put this stuff
> into words ;-)
>
> Any help is appreciated,
>
> Indragie___
>
> 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
>
> Help/Unsubscribe/Update your Subscription:
>
> http://lists.apple.com/mailman/options/cocoa-dev/karl.adam%40gmail.com
>
> This email sent to karl.a...@gmail.com
>
>
>
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
This is ridiculous.  The whole project is at a standstill because of
this nonsense.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 7/8/11 1:45 PM, G S wrote:
> This is ridiculous.  The whole project is at a standstill because of 
> this nonsense.

Just breathe...

I have used MKMapView just as you described: add the framework, import
the header, go.  It works.

It seems likely that there is something amiss in your situation.  This
doesn't mean it's YOUR fault, merely that it's probably NOT the
framework's fault.

I guess I'd start by trying the following:

1) If you haven't already done so, do a clean build (including dumping
any precompiled headers).  I don't know why, but I've seen this fix all
sorts of strange problems.

2) If that doesn't work, try building a MapKit sample code project.

3) If #2 succeeds, then it must be your code (or, less likely, something
in your build settings) and we would need to see more to understand.

4) If #2 fails, your development environment is probably damaged in some
way and you might need to do an Xcode reinstall.

This is all pretty generic absent more information...

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFOF2/CaOlrz5+0JdURAkP1AJ9uqdaNkHSs2BdA5hBRIsylpGnqKQCaApHG
A9KwsPWxODnJSi4yVc4MKK0=
=AgcW
-END PGP SIGNATURE-
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread koko
I think you need to #include   to get the isinf macro.




On Jul 8, 2011, at 2:45 PM, G S wrote:

> This is ridiculous.  The whole project is at a standstill because of
> this nonsense.
> ___
> 
> 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
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/koko%40highrolls.net
> 
> This email sent to k...@highrolls.net
> 

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Gary L. Wade
On 07/08/2011 5:39 AM, "G S"  wrote:

>I've imported  where I declare the MKMapView...

Do you mean this literally?  If you put an import within an interface's
variables section, I'd be surprised you don't find lots of other errors.

Try showing your exact code.


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Kyle Sluder
On Fri, Jul 8, 2011 at 1:45 PM, G S  wrote:
> This is ridiculous.  The whole project is at a standstill because of
> this nonsense.

Since nobody else is appearing to have this problem, you might do best
to whittle down your configuration into the smallest possible case
that reproduces the bug.

But my gut says that something that's getting included before
MKMapKit.h is at fault. Maybe a missing semicolon in another include
file?

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Conrad Shultz
As the OP noted, the error is in MapKit code and it is thus MapKit's 
responsibility to include requisite headers. 

There is some more fundamental problem at play.

(Sent from my iPhone.)

--
Conrad Shultz
www.synthetiqsolutions.com

On Jul 8, 2011, at 14:30, koko  wrote:

> I think you need to #include   to get the isinf macro.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Kyle Sluder
On Fri, Jul 8, 2011 at 4:00 PM, Conrad Shultz
 wrote:
> As the OP noted, the error is in MapKit code and it is thus MapKit's 
> responsibility to include requisite headers.
>
> There is some more fundamental problem at play.

Well, CoreFoundation.h includes  according to my copy of the
4.2 SDK, and isinf is defined in both the simulator's and the device's
math.h.

CoreFoundation.h is #imported by Foundation.h. Gavin, have you somehow
omitted Foundation.h from your prefix header (or whatever code is
#importing MapKit.h)?

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
First of all, thanks a lot for the responses.

I have compiled a couple of examples, and they do build. That makes
this all the more perplexing. The MapCallouts tutorial is one that I
tried.
In their file that uses MKMapView, these are the import statements:

#import 
#import 

Now the import statements in my file that uses MKMapView:

#import 
#import 

Yep, identical.

Now let's take a look at the included frameworks:

http://farm7.static.flickr.com/6136/5917058068_14504106f4_z.jpg

I link in everything they do.

I refer to math.h in one file in my project (which works, and is not
included in the problematic file).  If I comment out that inclusion,
compilation still fails with the same complaint.

I've tried removing and re-adding the frameworks to the project (most
of us have probably seen this fix things before).  I cleaned the
project and restarted Xcode.  Still no dice.

Harumph.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Gary L. Wade
On 07/08/2011 4:27 PM, "G S"  wrote:

>First of all, thanks a lot for the responses.
>I have...
>Yep, identical.
>Now let's ...
>I link in everything they do.
>I refer to math.h ...
>I've tried ...  Still no dice.

I've occasionally seen problems similar to this where the only recourse
was either a new Xcode project from scratch, a low-level editing of the
project file itself, or a restore from an earlier version and re-addition
of later changes.


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Greg Parker

On Jul 8, 2011, at 4:27 PM, G S wrote:

> First of all, thanks a lot for the responses.
> 
> I have compiled a couple of examples, and they do build. That makes
> this all the more perplexing. The MapCallouts tutorial is one that I
> tried.
> In their file that uses MKMapView, these are the import statements:
> 
> #import 
> #import 
> 
> Now the import statements in my file that uses MKMapView:
> 
> #import 
> #import 
> 
> Yep, identical.
> 
> Now let's take a look at the included frameworks:
> 
> http://farm7.static.flickr.com/6136/5917058068_14504106f4_z.jpg
> 
> I link in everything they do.
> 
> I refer to math.h in one file in my project (which works, and is not
> included in the problematic file).  If I comment out that inclusion,
> compilation still fails with the same complaint.
> 
> I've tried removing and re-adding the frameworks to the project (most
> of us have probably seen this fix things before).  I cleaned the
> project and restarted Xcode.  Still no dice.
> 
> Harumph.

Try #import  as the very first thing in your file.

Try disabling precompiled headers.

Try preprocessing your file and the example file and look for differences.

Check the deployment target of your project and the example project; 
MKGeometry's inline function will be ifdef'ed out depending on the deployment 
target.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
A search reveals that there are 29 math.h files on my system.  Of
those, these don't clearly include isinf:

/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/c++/4.2.1/tr1
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/c++
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/usr/include/c++/4.2.1/tr1/4.2.1/tr1
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/c++/4.2.1/tr1
/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/tr1
/Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/tr1
/Developer/SDKs/MacOSX10.6.sdk/usr/include/wx-2.8/wx
/usr/include/c++/4.2.1/tr1
/usr/include/wx-2.8/wx

So I tried: echo $PATH
/usr/local/boost:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin

Nothing obvious there.  My project's header search paths include:
/usr/local/include

but the only thing under there is Boost, and it doesn't have a math.h.

No idea at this point.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Kyle Sluder
On Fri, Jul 8, 2011 at 5:30 PM, G S  wrote:
> A search reveals that there are 29 math.h files on my system.  Of
> those, these don't clearly include isinf:
>
> /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS4.3.sdk/usr/include/c++/4.2.1/tr1
> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.0.sdk/usr/include/c++
> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.1.sdk/usr/include/c++/4.2.1/tr1/4.2.1/tr1
> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.2.sdk/usr/include/c++/4.2.1/tr1
> /Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator4.3.sdk/usr/include/c++/4.2.1/tr1
> /Developer/SDKs/MacOSX10.6.sdk/usr/include/c++/4.2.1/tr1
> /Developer/SDKs/MacOSX10.6.sdk/usr/include/wx-2.8/wx
> /usr/include/c++/4.2.1/tr1
> /usr/include/wx-2.8/wx

Are you compiling this file as Objective-C++?

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
> Are you compiling this file as Objective-C++?

Yes, the implementation is an mm file.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Kyle Sluder
On Fri, Jul 8, 2011 at 5:45 PM, G S  wrote:
>> Are you compiling this file as Objective-C++?
>
> Yes, the implementation is an mm file.
>

Okay, that's important.

Look at $SDKROOT/usr/include/c++/4.2.1/cmath and you'll see that it
#undefines isinf and declares std::isinf as a wrapper. So if you
happen to #include  before #importing
, the compiler will dutifully complain.

I don't know what the recommended solution would be here, since I
don't work with C++. Possible solutions that come to mind are
splitting your C++ code and Objective-C code into separate files, and
only including the bare minimum of glue in an Objective-C++ file; or
#importing  after whatever it is that #includes , but
before #importing ; or inserting a `using namespace
std;` before #importing .

But it's clear this is a result of using Objective-C++, not a fault in MapKit.

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Greg Parker
On Jul 8, 2011, at 5:51 PM, Kyle Sluder wrote:
> But it's clear this is a result of using Objective-C++, not a fault in MapKit.

You should file a bug report anyway, because MapKit's headers should be 
compatible with Objective-C++.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


NSArrayController - how?

2011-07-08 Thread William Squires
Here's what I have

plist file -> NSMutableArray of NSDictionary instances

NSDictionary instances all have the same keys, but different values (like a 
database record)

each NSDictionary maps to another class, RBSStore, that has properties that map 
to the keys of the NSDictionary's, and that has 2 methods:

-(id)initWithDictionary:(NSDictionary *)aDic;
-(NSDictionary *)storeDictionary;

so that I can go from NSDictionary<->RBSStore. I've got the UI laid out, 
including the  NSTableView (for displaying the NSDictionarys in the 
NSMutableArray, NSTextFields for each individual column (so that when you 
select a row, that row's info shows up in the NSTextField's, and one 
NSSearchField (not implemented yet.)

Mostly, this is all done via code. How can I transform this into a design that 
uses bindings and an NSArrayController to eliminate most of the tedious BS, and 
allow the table view, text fields, and so on to all be linked together so when 
you update a field, the appropriate row in the table view (and the 
corresponding NSMutableArray model) all stay in sync?

Mostly, what I don't understand is: what part of the work does the 
NSArrayController perform? Am I going to need an NSObjectController also to 
manage the individual rows (which are NSDictionary instances) and their 
corresponding NSTextFields? The big problem is the docs just describe the 
programmatic interface to the CoreFoundation classes, but not how to use them 
in real-world situations, or how to use them within IB.


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
Thanks very much for that analysis, Kyle.

This blows. All of our business logic is written in C++, which I'd
think is a common scenario (the paucity of "business" logic in the app
store notwithstanding). This problem is occurring in a UI controller
that needs to show information from a C++ object. It's full of code to
exchange information between the screen and object and validate it, so
writing some hokey workaround using an intermediary is pretty
unpalatable.

Weird that explicitly importing  right before the MapKit
import doesn't work, though.  I can't see where cmath is being
included.  Any suggestions on tracking that down?

Gavin
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Core Data Predicate Question

2011-07-08 Thread Indragie Karunaratne
Awesome, thank you. For anyone else who stumbles upon this question looking for 
something similar, check out Apple's DerivedProperty example:

http://developer.apple.com/library/mac/#samplecode/DerivedProperty/Introduction/Intro.html

It has examples on using the <= & > string comparison trick as well as 
normalizing strings for indexing.

On 2011-07-08, at 2:40 PM, The Karl Adam wrote:

> Well, when I said ANY, I really meant "IN termsArray", but for the
> partial matches that you want your approach is fine, you'll just want
> to use > & <= with character evaluations to speed this up. Check the
> 2010 CoreData Performance session from WWDC for more details, but it's
> a standard SQL trick to speed up string comparisons.
> 
> _Karl
> 
> On Thu, Jul 7, 2011 at 10:38 AM, Indragie Karunaratne
>  wrote:
>> I came up with this code earlier:
>> NSArray *searchTerms = [cleanedQuery componentsSeparatedByString:@" "];
>> NSPredicate *basePredicate = [NSPredicate
>> predicateWithFormat:@"SUBQUERY(keywords, $keyword, $keyword.name BEGINSWITH
>> $QUERY).@count != 0"];
>> NSMutableArray *subpredicates = [NSMutableArray array];
>> for (NSString *searchTerm in searchTerms) {
>> NSDictionary *sub = [NSDictionary
>> dictionaryWithObjectsAndKeys:searchTerm, @"QUERY", nil];
>> NSPredicate *termPredicate = [basePredicate
>> predicateWithSubstitutionVariables:sub];
>> [subpredicates addObject:termPredicate];
>> }
>> NSPredicate *combinedPredicate = [NSCompoundPredicate
>> andPredicateWithSubpredicates:subpredicates];
>> 
>> This doesn't use "ANY" as you mentioned (not sure exactly how I would use
>> that) but it works. However, I'm sure there's a better way to simplify this
>> instead of using a giant compound AND predicate to match each one of the
>> search terms. Is there any way to simplify this?
>> Thanks
>> On 2011-07-07, at 11:23 AM, The Karl Adam wrote:
>> 
>> You want to be using SUBQUERY() to match ANY keywords. Check the docs
>> for the predicate reference details for this.
>> 
>> _Karl
>> 
>> On Wed, Jul 6, 2011 at 8:23 PM, Indragie Karunaratne
>>  wrote:
>> 
>> Hi all,
>> 
>> I have a Core Data object model that I'm trying to write a fetch predicate
>> for (to use for search). Quick explanation of the model:
>> 
>> We'll call the main entity "Book".  There's also a "Keyword" entity. The
>> Book entity has a to-many relationship with the Keyword entity called
>> "keywords". In turn, the Keyword entity has an inverse relationship with the
>> Book entity called "book".  The Keyword entity has a single attribute called
>> "name". So basically, each Book has Keywords that describe it.
>> 
>> For my search, I have an array of search terms. I need a predicate that I
>> can use on fetch requests for the Book entity that will evaluate to TRUE if
>> ALL of the search terms have a corresponding Keyword in that the "name"
>> property begins with the search term.
>> 
>> For example:
>> 
>> There are three books:
>> 
>> Book1 - keywords: {"fiction", "scifi"}
>> 
>> Book2 - keywords: {"nonfiction"}
>> 
>> If the search terms were {"fic", "nonfic", "sci"} the resulting fetched
>> array would contain NOTHING because none of the books have keywords that
>> begin with all 3 of those search terms..
>> 
>> However, if the search terms were {"fic", "sci"}, the resulting fetched
>> array would contain Book1 since its keywords "fiction" and "scifi" begin
>> with the two search terms "fic" and "sci".  The key part here is that ALL of
>> the search terms have to have a corresponding keyword as demonstrated above
>> for the predicate to evaluate to true.
>> 
>> I hope I've explained this problem well enough, it's hard to put this stuff
>> into words ;-)
>> 
>> Any help is appreciated,
>> 
>> Indragie___
>> 
>> 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
>> 
>> Help/Unsubscribe/Update your Subscription:
>> 
>> http://lists.apple.com/mailman/options/cocoa-dev/karl.adam%40gmail.com
>> 
>> This email sent to karl.a...@gmail.com
>> 
>> 
>> 

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
> You should file a bug report anyway, because MapKit's headers should be 
> compatible with Objective-C++.

I will.  The problem is that they're just going to bounce it back to
me with "please provide a project that demonstrates this", and since I
don't know where cmath is coming in, I don't know how to create a
project to repro the problem.  I guess I'll just have to hack away at
mine and turn that in when I have the time.

I took the MapCallouts example project and changed its controller
file's name extension to mm, but it still compiled.  BUT, if I put

#import 

at the top, BINGO.  I get the isinf error.  So Kyle's analysis was
right on the money.

Is there some kind of include-file-chaining analysis tool that works
on Objective-C files? I'd think this would be one of the most useful
programmer's tools that an IDE could offer.
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Greg Parker
On Jul 8, 2011, at 6:58 PM, G S wrote:
>> You should file a bug report anyway, because MapKit's headers should be 
>> compatible with Objective-C++.
> 
> I will.  The problem is that they're just going to bounce it back to
> me with "please provide a project that demonstrates this", and since I
> don't know where cmath is coming in, I don't know how to create a
> project to repro the problem.  I guess I'll just have to hack away at
> mine and turn that in when I have the time.
> 
> I took the MapCallouts example project and changed its controller
> file's name extension to mm, but it still compiled.  BUT, if I put
> 
> #import 
> 
> at the top, BINGO.  I get the isinf error.  So Kyle's analysis was
> right on the money.

Well, that sounds like a reproducing project to me.


> Is there some kind of include-file-chaining analysis tool that works
> on Objective-C files? I'd think this would be one of the most useful
> programmer's tools that an IDE could offer.

If you preprocess your source file, the output will show every include and 
where it came from. Not easy to interpret, but it's all there.


-- 
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
> If you preprocess your source file, the output will show every include and 
> where it came from. Not easy to interpret, but it's all there.

How do you do that?
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread Kyle Sluder
On Fri, Jul 8, 2011 at 7:19 PM, G S  wrote:
>> If you preprocess your source file, the output will show every include and 
>> where it came from. Not easy to interpret, but it's all there.
>
> How do you do that?

If you're running Xcode 3, there's a Preprocess command in the menus.

If you're running Xcode 4.0, someone at Apple decided you don't need a
Preprocess command. So you need to copy-paste the command line from
the Build Log and add the -E argument.

This may or may not be the case for newer beta versions of Xcode.

--Kyle Sluder
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Why won't iOS app using MKMapView compile?

2011-07-08 Thread G S
Good grief.

Anyway, thanks for all the help and time it took.  I really appreciate it!

For now, my workaround was to paste

#define isinf(x)\
(sizeof (x) == sizeof(float )?__inline_isinff((float)(x))\
:sizeof (x) == sizeof(double)?__inline_isinfd((double)(x))\
:__inline_isinf ((long double)(x)))

right before the MapKit import.  It compiles now.  If my app gets
rejected, I'll just have to point them to bug 9748279 (which I just
filed on this issue).

Regards,
Gavin
___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: NSArrayController - how?

2011-07-08 Thread Ken Thomases
On Jul 8, 2011, at 8:16 PM, William Squires wrote:

> Here's what I have
> 
> plist file -> NSMutableArray of NSDictionary instances

Don't focus on the array object.  Focus on the object which has a to-many 
relationship property which is implemented via the array.

> NSDictionary instances all have the same keys, but different values (like a 
> database record)
> 
> each NSDictionary maps to another class, RBSStore

You might consider making the to-many relationship property (and thus the 
actual array) contain RBSStore objects instead of dictionaries.  That is, maybe 
just use dictionaries on the way in and out of the plist (until the day you 
decide to move away from a plist as your storage format).


> I've got the UI laid out, including the  NSTableView (for displaying the 
> NSDictionarys in the NSMutableArray, NSTextFields for each individual column 
> (so that when you select a row, that row's info shows up in the 
> NSTextField's, and one NSSearchField (not implemented yet.)

I assume you mean that the table columns use NSTextFieldCell as their cell 
type.  Right?


> Mostly, this is all done via code. How can I transform this into a design 
> that uses bindings and an NSArrayController to eliminate most of the tedious 
> BS, and allow the table view, text fields, and so on to all be linked 
> together so when you update a field, the appropriate row in the table view 
> (and the corresponding NSMutableArray model) all stay in sync?

The cornerstone of bindings is Key-Value Observing which is built on Key-Value 
Coding.  So, the to-many relationship property has to be KVO-compliant for 
changes to its content.  Plus, each item in the relationship has to be 
KVO-compliant for changes to the properties that you will be binding to.

To make a to-many relationship property KVO-compliant, you should implement the 
mutating indexed accessors and use those accessors when you need to add, 
remove, or replace elements of the relationship.
http://developer.apple.com/library/ios/#documentation/cocoa/conceptual/KeyValueCoding/Articles/AccessorConventions.html

You can use the -mutableArrayValueForKey: method to get an object that you can 
treat just like a mutable array but will go through the KVO-compliant methods 
for you, but that's just a convenience.  Generally, it's plenty convenient to 
simply call your mutating accessors.

After everything is KVO-compliant, you would create an NSArrayController and 
bind its contentArray binding to the object with the to-many relationship 
property and to that property.  Then, bind each NSTableColumn's value binding 
to the array controller, with the key path going through "arrangedObjects" and 
then the property from the dictionary (or RBSStore) that you want that column 
to show.  So, something like @"arrangedObjects.firstName" if the column is to 
show the firstName property of each element.


> Mostly, what I don't understand is: what part of the work does the 
> NSArrayController perform?

You can't do Key-Value Observing _through_ an NSArray or NSMutableArray.  
NSArrayController and its arrangedObjects property allow for that.  It also 
tracks selection for you.  Plus it can do a bunch of other stuff if you want it 
to, but that should be relatively clear from the API.

> Am I going to need an NSObjectController also to manage the individual rows 
> (which are NSDictionary instances) and their corresponding NSTextFields?

No.

> The big problem is the docs just describe the programmatic interface to the 
> CoreFoundation classes, but not how to use them in real-world situations, or 
> how to use them within IB.

Have you read the Cocoa Bindings Programming Topics?
http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/CocoaBindings/CocoaBindings.html

Also see mmalc's Cocoa Bindings Examples and Hints page:
http://homepage.mac.com/mmalc/CocoaExamples/controllers.html

Here's another tutorial:
http://cocoadevcentral.com/articles/80.php

To the extent that you're setting up bindings in code while these discuss 
setting things up in Interface Builder, it should be straightforward to just 
translate from the IB stuff directly to code.  IB is just a visual shorthand 
for the same sort of thing you'd do in code.

Regards,
Ken

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: getting last accessed date

2011-07-08 Thread Rick C.
Ok I have double-checked and the icon isn't actually the issue since I call 
iconForFile: after using stat.  With the original code I posted it just gives 
me today's date.  I can go into Finder and as an example I found a file that 
has a Last Opened date of 2009 and when I run stat it gives me today's date.  
So it looks like stat is definitely not working...

Is there not an older Carbon method that was used for this before?  Is the only 
way by using spotlight metadata?

On a related note...I just updated one of my drives to Lion GM and on that 
drive I had a hard time to find a file with a different Last Opened date vs. 
Last Modified.  Makes me think the Last Opened date in Finder is coming from 
spotlight metadata could that be true?  If so then it looks like using the 
spotlight metadata and just falling back on the modification date might be the 
right way to go anyways???


On Jul 8, 2011, at 5:38 PM, Chris Ridd wrote:

> 
> On 8 Jul 2011, at 09:54, Rick C. wrote:
> 
>> Sorry about that no I'm on Mac OS I was just sending the email from my 
>> iPhone :-)
>> 
>> Ok I double-checked and I think I am getting the same results as you are.  
>> But iconForFile does not modify the Last Opened date that shows in Finder.  
>> So the question is how do I get that besides using the spotlight metadata?
> 
> Does the resource fork (where the icon lives) have a different set of 
> timestamps from the data fork?
> 
> Chris

___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com


Re: Nib loading cycle

2011-07-08 Thread Dale Miller
On July 7, Manfred Schwind wrote:"On OS X all objects of the nib  
including the file's owner get an awakeFromNib." I don't think I ever  
found the doc for that, either, but I did learn the hard way. I was  
instantiating a NIB multiple times with  
"InstantiateNibWithOwner:topLevelObjects", but I inadvertently used  
the same object which owned the nib when it was loaded. I ultimately  
found doc that said each instance had to have a unique owner, but no  
reason was given. My owning object got multiple "awakeFromNib" calls.  
Eventually, I pieced the two together.


Dale Miller




___

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com