Re: NSComboBox in NSTableView behaving strangely

2011-07-06 Thread Quincey Morris
On Jul 5, 2011, at 04:11, Devarshi Kulshreshtha wrote:

 When I am selecting a value in dropdown list of combobox cell, it is
 changing the value of previously selected value to newly selected value, as
 shown in below figure(s) -

A combo box is a kind of text field, not a kind of menu, so yes it's going to 
edit the property that it's bound to.

Use a NSPopUpButton instead.


___

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: finder eject images

2011-07-06 Thread Matt Gough
  As everyone else has been saying, NSWorkspace image for
 type/file APIs and +[NSImage imageNamed:] are the API, and if it isn't
 there, you can file a bug but should use your own artwork. (As it says in
 the NSImage header.)

Even if it isn't available via imageNamed, you might still be able to find it 
by using IconServices.

That contains a lot more icons (lots of which are long obsolete)
See IconsCore.h. I'm not sure how you'd go about converting an IconRef to an 
NSImage, but maybe you don't need to. You can just draw them directly using 
PlotIconRefInContext.

Matt


On 6 Jul 2011, at 03:31:57, Ken Ferry wrote:

 On Tue, Jul 5, 2011 at 7:34 AM, Patrick Robertson 
 robertson.patr...@gmail.com wrote:
 
 This is extremely fragile. You have no guarantee this image will continue
 to exist, that it will always be in ICNS format, or that the CoreTypes
 bundle will even continue to exist.
 
 True, but this method has been working for our app for 8 years now, no
 problems :)
 If you have any better suggestions, feel free to let me know!
 
 
 You know, people really like to use this excuse. And then when it stops
 working, they're like it's been working for so long!
 
 This is not part of the API, and it is not supported.  Not every piece of
 artwork the OS uses can be considered supported API - we'd never be able to
 change anything.  As everyone else has been saying, NSWorkspace image for
 type/file APIs and +[NSImage imageNamed:] are the API, and if it isn't
 there, you can file a bug but should use your own artwork. (As it says in
 the NSImage header.)
 
 Ken Ferry
 Cocoa Frameworks
 
 
 
 
 
 For those hoping to use the CoreTypes.bundle ICNS, I have not seen any of
 them disappear or change name in over 8 years with OS updates. No changes
 is
 Lion either as far as I can tell.
 
 On 5 July 2011 15:20, Kyle Sluder kyle.slu...@gmail.com wrote:
 
 On Jul 5, 2011, at 5:20 AM, Patrick Robertson 
 robertson.patr...@gmail.com
 wrote:
 
 I wasn't suggesting that be done. Here's the code I use in my apps:
 
 - (NSImage *)sysIconNamed:(NSString *)name {
 
 NSString *path = [[NSBundle bundleWithPath:
 @/System/Library/CoreServices/CoreTypes.bundle] pathForResource:name
 ofType:@icns];
 
 This is extremely fragile. You have no guarantee this image will continue
 to exist, that it will always be in ICNS format, or that the CoreTypes
 bundle will even continue to exist.
 
 --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/kenferry%40gmail.com
 
 This email sent to kenfe...@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/devlists.mg%40googlemail.com
 
 This email sent to devlists...@googlemail.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: NSComboBox in NSTableView behaving strangely

2011-07-06 Thread Devarshi Kulshreshtha
same problem exists in NSPopUpButtonCell, it is changing the value in list
which appears on clicking it, as shown -

Original list: http://dl.dropbox.com/u/259/unique%20data.png

Changed list: http://dl.dropbox.com/u/259/redundant%20data.png

Bindings used in case of NSPopUpButtonCell are:

TableColumn with NSPopUpButtonCell -

Value Selection : Selected Value bind to - Transactions, Controller
Key - arrangedObjects,
Model Key Path - relatedEntity.name

NSPopUpButtonCell

Value Selection : Content Values Bind to: Entities, Controller Key -
arrangedObjects,
Model Key Path - name

Note: code can be found here -
http://dl.dropbox.com/u/259/TableWithComboBoxExperi.zip

On Wed, Jul 6, 2011 at 11:44 AM, Quincey Morris quinceymor...@earthlink.net
 wrote:

 On Jul 5, 2011, at 04:11, Devarshi Kulshreshtha wrote:

  When I am selecting a value in dropdown list of combobox cell, it is
  changing the value of previously selected value to newly selected value,
 as
  shown in below figure(s) -

 A combo box is a kind of text field, not a kind of menu, so yes it's going
 to edit the property that it's bound to.

 Use a NSPopUpButton instead.





-- 
Thanks,

Devarshi
___

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


Dynamically loading NIB files with a common stem

2011-07-06 Thread Vincent Habchi
Hi there,

I'm, as we say in French, tearing my hair away with this little problem: 
Briefly, I have an object in a NIB file, and I'd like it to load further NIB 
files (through +[NSBundle loadNibNamed:owner:] calls), all of them ending with 
the same suffix (ex: onefoo, twofoo, threefoo).

I just can't seem to find a way to enumerate all NIB files in the main bundle. 
Has somebody a clue?

Thanks a lot,
Vincent

PS : If you wonder why, let's say the main object is a NSArray, and the NIB 
files I'd like to load contain objects that register themselves into this 
array, so they can be retrieved and used 
afterwards.___

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: QTMovie not playing in new window

2011-07-06 Thread Michael Babin
On Jul 4, 2011, at 4:21 AM, Paolo Franzetti wrote:

 - (IBAction) playButtonClicked: (id) sender
 {
  MoviePlayerController *moviePlayerWindow = [[MoviePlayerController alloc] 
 initWithWindowNibName:@MoviePlayer];
  [moviePlayerWindow showWindow:self];
 
  NSError *error;
  NSString *moviePath = [[NSBundle mainBundle] 
 pathForResource:@sample_iTunes ofType:@mov];
  QTMovie *movie = [QTMovie movieWithFile:moviePath error:error];
  if (error) {
  NSLog(@%@, [error localizedDescription]);
  } else {
  [movie gotoBeginning];
  [moviePlayerWindow.movieViewer setMovie:movie];
  [moviePlayerWindow.movieViewer play:nil];
  }
 
 }
 
 movieViewer is a QTMovieViewer outlet inside the new window.

In addition to Kyle's observations, I would also point out that your method of 
checking for failure in +[QTMovie movieWithFile:error:] is incorrect. The 
primary check for failure is the return value (did it return nil?). Only if it 
returns nil should you then pay any attention to the error value.

QTMovie *movie = [QTMovie movieWithFile:moviePath error:error];
if (movie == nil) {
if (error) {
/* log or otherwise handle error */
}
}
else {
/* use movie */
}

___

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: Dynamically loading NIB files with a common stem

2011-07-06 Thread Alexander Reichstadt
Try:
NSArray *sometest = [[NSBundle mainBundle] pathsForResourcesOfType:@nib 
inDirectory:@.];
for (id thisOne in sometest){
NSLog(@This is a path:%@,thisOne);
}


Am 06.07.2011 um 14:04 schrieb Vincent Habchi:

 Hi there,
 
 I'm, as we say in French, tearing my hair away with this little problem: 
 Briefly, I have an object in a NIB file, and I'd like it to load further NIB 
 files (through +[NSBundle loadNibNamed:owner:] calls), all of them ending 
 with the same suffix (ex: onefoo, twofoo, threefoo).
 
 I just can't seem to find a way to enumerate all NIB files in the main 
 bundle. Has somebody a clue?
 
 Thanks a lot,
 Vincent
 
 PS : If you wonder why, let's say the main object is a NSArray, and the NIB 
 files I'd like to load contain objects that register themselves into this 
 array, so they can be retrieved and used 
 afterwards.___
 
 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/lxr%40mac.com
 
 This email sent to l...@mac.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: Animating a flickering display

2011-07-06 Thread douglas welton
Have you looked at using Quartz Composer as a solution to accomplish this?

On Jul 4, 2011, at 2:31 PM, Dr. Scott Steinman wrote:

 My program needs to display counterphase flickering test, i.e., one display 
 is white text on a black background, and the other is black text on a white 
 background, and the two displays are switched back and forth. I have 
 concluded that there are two options to do this:
 
 1. Draw each display into two NSViews, then switch back and forth between 
 between them (via replaceSubview:with:) with an NSTimer to time the switches.
 2. Use Core Animation to fade in one display and fade in the other.
 
 In each case, I don't know how to avoid blocking a button presses whose 
 action would stop the animation.
 
 Which is the better way to proceed?  How do I keep the user interface 
 responsive?
 
 Please point me in the right direction.
 
 Thank you.
 
 Scott

___

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


Question about MPMediaQuery

2011-07-06 Thread Eric E. Dolecki
I am wondering if I need to recreate MPMediaQuery each time I want to
use it and am changing grouping type and filter predicates... or can I
simply create that once and then change filters, etc. on it. Wondering
if it would speed my code up.

Thanks,
Eric
___

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: Dynamically loading NIB files with a common stem

2011-07-06 Thread vincent habchi
Le 6 juil. 2011 à 14:27, Alexander Reichstadt l...@mac.com a écrit :

 Try:
 NSArray *sometest = [[NSBundle mainBundle] pathsForResourcesOfType:@nib 
 inDirectory:@.];
 for (id thisOne in sometest){
   NSLog(@This is a path:%@,thisOne);
 }

Thanks for the hint, I'll do that right away.

Viel Dank
Vincent___

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: How to resolve bulk warning Creating selector for nonexistent method ...?

2011-07-06 Thread Steve Christensen
You mentioned switching between debug and release configurations, so that would 
be a good first place to look since individual build settings can be set on a 
per-configuration basis.


On Jul 5, 2011, at 3:59 PM, arri wrote:

 Hi Steve,
 
 Thanks for your reply! Usually i would be tempted to get to the bottom
 of this and understand where/what mistakes were made (and by who;).
 But other than switching between Debug/Release i hadn't touched the
 build-settings at all, so i figured the problem couldn't be there..
 
 But meanwhile i did managed to 'fix' the issue by clearing Xcode's
 caches ( XCode-app-menu  Empry Caches ).
 Appearanly some things got corrupted and/or confused on that level. As
 a nice bonus, i also got about 10Gb of diskspace back.
 
 So i have no clue what the real problem was, but it's fixed.
 
 thanks,
 arri
 
 
 On Tue, Jul 5, 2011 at 9:17 PM, Steve Christensen puns...@mac.com wrote:
 For the nonexistent method warnings, your project- or target-level settings 
 likely have Undeclared Selector checked in the GCC warnings section of the 
 build settings.
 
 For the multiple selectors warnings, look at the Strict Selector Matching 
 item in the same section. It says this will pop up if you're trying to send 
 the message to a variable of type id, vs to an explicit class type.
 
 
 On Jul 3, 2011, at 6:16 PM, arri wrote:
 
 Hi Motti,
 
 I would be very interested to know how you resolved this issue, if at all.
 
 I'm suddenly facing the same issue, out of no-where. Instead of trying
 to find the source of the problem, I just reverted to the last known
 working version (svn), but the warnings persist.
 This surprises me a bit, because earlier today i had cleaned the
 project and made a release-build for distribution to the client, and
 this went fine.
 
 I'm sure i'm overlooking something very obvious and stupid. Does
 anyone have an idea what that could be?
 
 thanks,
 arri
 
 
 On Mon, Jan 25, 2010 at 12:04 PM, Motti Shneor mot...@waves.com wrote:
 Hi everyone.
 
 I'm building static library, whose outward API is plain C, and whose 
 implementation is Cocoa-based.
 
 It was building and working alright, until (yesterday) something changed, 
 and any attempt to clean/build/rebuild it produces huge amount of 
 compilation warnings, on EVERY Obj-C message.
 
 First, there's a bulk of warnings like this:
 
 /Volumes/Data/.../FileManager_GUI_Mac.mm:224: warning: creating selector 
 for nonexistent method 'openPanel'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:196: warning: creating selector 
 for nonexistent method 'release'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:193: warning: creating selector 
 for nonexistent method 'code'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:190: warning: creating selector 
 for nonexistent method 'savePanel'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:190: warning: creating selector 
 for nonexistent method 'alloc'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:171: warning: creating selector 
 for nonexistent method 'stringWithFormat:'
 /Volumes/Data/.../FileManager_GUI_Mac.mm:160: warning: creating selector 
 for nonexistent method 'getCString:maxLength:encoding:'
 
 Then another bulk of warnings, complaining about DOUBLE definitions for 
 Cocoa methods
 
 /Volumes/Data/.../FileManager_GUI_Mac.mm:244:0
 /Volumes/Data/.../FileManager_GUI_Mac.mm:244: warning: multiple selectors 
 named '+isVertical' found
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSplitView.h:30:0
  
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSplitView.h:30:
  warning: found '-(BOOL)isVertical'
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSliderCell.h:59:0
  
 /Developer/SDKs/MacOSX10.5.sdk/System/Library/Frameworks/AppKit.framework/Headers/NSSliderCell.h:59:
  warning: also found '-(NSInteger)isVertical'
 
 
 
 Notes:
 The project is building Intel-only Universal (32/64bit, architectures i386 
 and x86_64
 I only #import Cocoa/Cocoa.h once, in a single source file (an interface 
 header file).
 I added (linked) the Cocoa Framework once in the project, referencing the 
 Current SDK.
 The project DOES compile, and even works.
 If i turn on the  Build Active Architecture Only build option for the 
 project (ONLY_ACTIVE_ARCH = YES) then I only get the warnings when I 
 compile 32bit. 64bit compilation is free of warnings.
 
 
 These warnings worry me, as I might be using a wrong framework, and the 
 code may break on a user machine.
 
 Any idea will be greatly appreciated.
 
 
 Motti Shneor
 --
 Senior Software Engineer
 Waves Audio ltd.
 
 

___

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:

NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)

2011-07-06 Thread Vincent Habchi
Re-hi,

implementing Alexander's idea, I wrote this code to load Nibs ending with 
Connector:

- (void)fetchAndInitializeConnectors {
// Search all NIB files ending with connector and load them
for (NSString * path in [[NSBundle mainBundle] 
pathsForResourcesOfType:@nib inDirectory:@.]) {
NSString * name = [[path lastPathComponent] 
stringByDeletingPathExtension];
if ([name hasSuffix:@Connector]) {
[NSBundle loadNibNamed:name owner:self];
}
}
}

However, I end up in a cycle, whereby the call to [NSBundle loadNibNamed:name 
owner:self] generates a (unexpected) callback to -awakeFromNib. How come? Is 
this normal behavior?

This is not the case if I substitute nil to self in [NSBundle loadNibNamed:name 
owner:self];

Thanks a lot!
Vincent___

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: NSDatePicker weirdness with time.

2011-07-06 Thread Fritz Anderson
On 6 Jul 2011, at 12:16 AM, Trygve Inda wrote:

 It seems that NSDateFormatters instantiated in my nibs get their zone set to
 PDT (because of my time settings), despite having called
 
 [NSTimeZone setDefaultTimeZone:[NSTimeZone
 timeZoneWithAbbreviation:@GMT]];
 
 Before any nibs are loaded.

Which makes sense. The model is that objects in XIBs/NIBs are instantiated when 
Interface Builder archives them, not when the NIBs are loaded. Your attempt to 
initialize them from a runtime default has no effect because they've already 
been initialized.

— F

___

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? (sequel to: Dynamically loading NIB files with a common stem)

2011-07-06 Thread Ken Thomases
On Jul 6, 2011, at 9:08 AM, Vincent Habchi wrote:

 implementing Alexander's idea, I wrote this code to load Nibs ending with 
 Connector:
 
 - (void)fetchAndInitializeConnectors {
   // Search all NIB files ending with connector and load them
   for (NSString * path in [[NSBundle mainBundle] 
 pathsForResourcesOfType:@nib inDirectory:@.]) {
   NSString * name = [[path lastPathComponent] 
 stringByDeletingPathExtension];
   if ([name hasSuffix:@Connector]) {
   [NSBundle loadNibNamed:name owner:self];
   }
   }
 }
 
 However, I end up in a cycle, whereby the call to [NSBundle loadNibNamed:name 
 owner:self] generates a (unexpected) callback to -awakeFromNib. How come? Is 
 this normal behavior?
 
 This is not the case if I substitute nil to self in [NSBundle 
 loadNibNamed:name owner:self];

The NIB's owner is effectively an object in the NIB, via the File's Owner 
stand-in.  Therefore, it gets an -awakeFromNib call.

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: Delay in reading cookie using NSHttpCookieStorage

2011-07-06 Thread Fritz Anderson
On 5 Jul 2011, at 7:57 AM, Hirendra Rathor wrote:

 I experimented further and waited for few seconds after the 'alert' dialog 
 box was displayed. Since I did not dismiss the dialog box, my application was 
 also not launched. After a while I saw the content of the cookie in 
 Cookies.plist changed to Cookie-B. I dismissed the dialog and let the 
 application launch. I saw the application receiving correct value of the 
 cookie.
 
 Why does it take this long for the cookie value to change in Cookies.plist 
 file? Is this delay also responsible for application to receive stale cookie 
 or is it just coincidental?

The same problem came up in 
http://lists.apple.com/archives/macnetworkprog/2007/Apr/msg1.html. Jerry 
Krinock seemed not to get any answer, and resorted to having the consuming 
application delay for 10 seconds before reading a cookie.

When information is cached by one process, it's not uncommon to coalesce 
changes by accumulating them into one big update, rather than incur the expense 
of flushing each one into the persistent store as it occurs. It doesn't 
surprise me that there's a delay.

Your problem looks to me like a common use case for the policy hurting 
functionality. File a bug at bugreport.apple.com and ask that it be changed.

(devforums.apple.com does not disappoint: When I searched for 
NSHTTPCookieStorage delay it came up with no matches, but offered Shortcakes 
delay. Developer-forum discussions can't get beyond three or four messages 
without shortcakes coming up one way or another.)

— F

___

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: Question about MPMediaQuery

2011-07-06 Thread Fritz Anderson
On 6 Jul 2011, at 7:38 AM, Eric E. Dolecki wrote:

 I am wondering if I need to recreate MPMediaQuery each time I want to
 use it and am changing grouping type and filter predicates... or can I
 simply create that once and then change filters, etc. on it. Wondering
 if it would speed my code up.

MPMediaQuery seems to be mutable. You can add and remove filters. The ability 
to remove filters doesn't make sense to me unless you can reuse the query. I 
don't know from experience. Maybe if you tried it, and checked for accuracy, 
leaks, and zombies, you'd know.

But if you're wondering whether it would speed your code up, you can find out 
for yourself: Have Instruments profile it as-is. If it turns out that the 
alloc/init of queries takes up a significant part of your execution time (I'd 
be surprised it it did), then you can try caching instances, and seeing for 
yourself whether it helps.

Don't waste your time guessing what your app needs. Measure.

— F

___

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: Question about MPMediaQuery

2011-07-06 Thread Eric E. Dolecki
Thanks for your answer - I'll check it out.

Eric


On Wed, Jul 6, 2011 at 10:54 AM, Fritz Anderson fri...@manoverboard.org wrote:
 On 6 Jul 2011, at 7:38 AM, Eric E. Dolecki wrote:

 I am wondering if I need to recreate MPMediaQuery each time I want to
 use it and am changing grouping type and filter predicates... or can I
 simply create that once and then change filters, etc. on it. Wondering
 if it would speed my code up.

 MPMediaQuery seems to be mutable. You can add and remove filters. The ability 
 to remove filters doesn't make sense to me unless you can reuse the query. I 
 don't know from experience. Maybe if you tried it, and checked for accuracy, 
 leaks, and zombies, you'd know.

 But if you're wondering whether it would speed your code up, you can find out 
 for yourself: Have Instruments profile it as-is. If it turns out that the 
 alloc/init of queries takes up a significant part of your execution time (I'd 
 be surprised it it did), then you can try caching instances, and seeing for 
 yourself whether it helps.

 Don't waste your time guessing what your app needs. Measure.

        — F


___

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: NSDatePicker weirdness with time.

2011-07-06 Thread Kyle Sluder
On Wed, Jul 6, 2011 at 7:11 AM, Fritz Anderson fri...@manoverboard.org wrote:
 On 6 Jul 2011, at 12:16 AM, Trygve Inda wrote:

 It seems that NSDateFormatters instantiated in my nibs get their zone set to
 PDT (because of my time settings), despite having called

 [NSTimeZone setDefaultTimeZone:[NSTimeZone
 timeZoneWithAbbreviation:@GMT]];

 Before any nibs are loaded.

 Which makes sense. The model is that objects in XIBs/NIBs are instantiated 
 when Interface Builder archives them, not when the NIBs are loaded. Your 
 attempt to initialize them from a runtime default has no effect because 
 they've already been initialized.

Well, it makes sense insofar as this is a plausible explanation for
this behavior. But it would make much more sense for NSDateFormatter
to implement -awakeFromNib and configure itself according to the
locale it's loaded into.

--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: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)

2011-07-06 Thread Kyle Sluder
On Wed, Jul 6, 2011 at 7:08 AM, Vincent Habchi vi...@macports.org wrote:
 However, I end up in a cycle, whereby the call to [NSBundle loadNibNamed:name 
 owner:self] generates a (unexpected) callback to -awakeFromNib. How come? Is 
 this normal behavior?

This is normal behavior on Mac OS X. It is not normal behavior on iOS.

On Mac OS X, all top-level objects get an -awakeFromNib. On iOS,
top-level objects do not get -awakeFromNib.

--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: NIB loading cycle? (sequel to: Dynamically loading NIB files with a common stem)

2011-07-06 Thread Vincent Habchi
Le 6 juil. 2011 à 17:09, Kyle Sluder a écrit :

 On Wed, Jul 6, 2011 at 7:08 AM, Vincent Habchi vi...@macports.org wrote:
 However, I end up in a cycle, whereby the call to [NSBundle 
 loadNibNamed:name owner:self] generates a (unexpected) callback to 
 -awakeFromNib. How come? Is this normal behavior?
 
 This is normal behavior on Mac OS X. It is not normal behavior on iOS.
 
 On Mac OS X, all top-level objects get an -awakeFromNib. On iOS,
 top-level objects do not get -awakeFromNib.

Thanks Kyle. I simply wasn't expecting that -awakeFromNib would be called from 
inside the NIB being loaded. I hadn't figured out that the File's owner 
placeholder was considered to be a *real* object, and not just, as the name 
implied, a mere placeholder (or link).

Have a nice day!
Vincent___

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: Delay in reading cookie using NSHttpCookieStorage

2011-07-06 Thread Jens Alfke
I don’t think the cookie storage is guaranteed to be 100% in sync across apps 
all the time. WebKit is probably batching up changes in memory before writing 
them out to disk. You should probably find a different way to do what you’re 
doing.

Also, launching an applet to launch your app seems cumbersome — the usual way 
to have the browser launch a custom app is to make up a custom URL scheme, 
register the app as handling that scheme, and then have the browser navigate to 
a URL of that scheme. This has the advantage that you can pass information to 
the app in that URL (which might remove your need to read the cookie?)

—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: Dynamically loading NIB files with a common stem

2011-07-06 Thread Douglas Davidson

On Jul 6, 2011, at 5:27 AM, Alexander Reichstadt wrote:

 NSArray *sometest = [[NSBundle mainBundle] pathsForResourcesOfType:@nib 
 inDirectory:@.];

It isn't necessary to use @. here; you should be able to pass nil for that 
argument if the resources in question are not in a subdirectory.  From the 
header comments:  subpath is a relative path to a subdirectory inside the 
relevant global or localized resource directory, and should be nil if the 
resource file in question is not in a subdirectory.

Douglas Davidson

___

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: NSDatePicker weirdness with time.

2011-07-06 Thread Raleigh Ledet
This conversation started about NSDatePicker. Now you are referring to 
NSDateFormatter. Which one are you dealing with? My test shows that a nib 
instantiated NSDatePicker has a nil timeZone value.

-raleigh

On Jul 6, 2011, at 8:05 AM, Kyle Sluder wrote:

 On Wed, Jul 6, 2011 at 7:11 AM, Fritz Anderson fri...@manoverboard.org 
 wrote:
 On 6 Jul 2011, at 12:16 AM, Trygve Inda wrote:
 
 It seems that NSDateFormatters instantiated in my nibs get their zone set to
 PDT (because of my time settings), despite having called
 
 [NSTimeZone setDefaultTimeZone:[NSTimeZone
 timeZoneWithAbbreviation:@GMT]];
 
 Before any nibs are loaded.
 
 Which makes sense. The model is that objects in XIBs/NIBs are instantiated 
 when Interface Builder archives them, not when the NIBs are loaded. Your 
 attempt to initialize them from a runtime default has no effect because 
 they've already been initialized.
 
 Well, it makes sense insofar as this is a plausible explanation for
 this behavior. But it would make much more sense for NSDateFormatter
 to implement -awakeFromNib and configure itself according to the
 locale it's loaded into.
 
 --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/ledet%40apple.com
 
 This email sent to le...@apple.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: iOS: AVFoundation, AVAssetWriter and caching

2011-07-06 Thread Steve Christensen
With the caveat that I haven't actually tried it, would it make more sense to 
be streaming the movie data to a local file, then specifying the URL/path to 
the file in the initializer method of one of the movie player classes? If the 
player can handle the case where not all the movie data is present then it 
should just do the right thing. The benefit is that you can use the same code 
to play the movie, no matter how much of it is local.


On Jul 5, 2011, at 8:03 PM, John Michael Zorko wrote:

 I'm interested in caching a movie as I play it from the internet, so that the 
 next time the user asks for the movie, it can play it from the device 
 filesystem. I'm thinking capturing frames and audio and using an 
 AVAssetWriter like I would when recording from the camera, but i'm not sure 
 if this will work when recording from a playing asset. Would anyone 
 illuminate me as to whether this is possible, or if I need to explore other 
 ways of doing this (which would probably be a lot less cool and efficient 
 than doing it this way, alas)?

___

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: iOS: AVFoundation, AVAssetWriter and caching

2011-07-06 Thread Heath Borders
I'm pretty sure someone else on the list tried exactly that, and it didn't work.

-Heath Borders
heath.bord...@gmail.com
Twitter: heathborders
http://heath-tech.blogspot.com



On Wed, Jul 6, 2011 at 11:40 AM, Steve Christensen puns...@mac.com wrote:
 With the caveat that I haven't actually tried it, would it make more sense to 
 be streaming the movie data to a local file, then specifying the URL/path to 
 the file in the initializer method of one of the movie player classes? If the 
 player can handle the case where not all the movie data is present then it 
 should just do the right thing. The benefit is that you can use the same 
 code to play the movie, no matter how much of it is local.


 On Jul 5, 2011, at 8:03 PM, John Michael Zorko wrote:

 I'm interested in caching a movie as I play it from the internet, so that 
 the next time the user asks for the movie, it can play it from the device 
 filesystem. I'm thinking capturing frames and audio and using an 
 AVAssetWriter like I would when recording from the camera, but i'm not sure 
 if this will work when recording from a playing asset. Would anyone 
 illuminate me as to whether this is possible, or if I need to explore other 
 ways of doing this (which would probably be a lot less cool and efficient 
 than doing it this way, alas)?

 ___

 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/heath.borders%40gmail.com

 This email sent to heath.bord...@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


Using a Soundex category...

2011-07-06 Thread Eric E. Dolecki
I found a Soundex NSString category here:

http://www.cocoadev.com/index.pl?NSStringSoundex

However, when I tried it out I get strange results...

//someString is set to different strings each time tested
BOOL test = [someString soundsLikeString:@Face];
NSLog(@sounds like Face: %d,test);

Place = 0
Ace = 0
Mace = 0
Fake = 1
Testing = 0
Brake = 0

It would seem something is off to get negatives on Place, Ace  Mace.

Any ideas or perhaps a different Soundex implementation I could try? I
am already using Levenstein distance, but on it's own it's not good
enough.
___

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: Using a Soundex category...

2011-07-06 Thread Douglas Davidson

On Jul 6, 2011, at 11:23 AM, Eric E. Dolecki wrote:

 I found a Soundex NSString category here:
 
 http://www.cocoadev.com/index.pl?NSStringSoundex
 
 However, when I tried it out I get strange results...
 
 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);
 
 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0
 
 It would seem something is off to get negatives on Place, Ace  Mace.
 
 Any ideas or perhaps a different Soundex implementation I could try? I
 am already using Levenstein distance, but on it's own it's not good
 enough.

Those results sound perfectly reasonable based on the versions of Soundex that 
I have seen.  Perhaps you are looking for something different?

Douglas Davidson

___

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: Using a Soundex category...

2011-07-06 Thread glenn andreas

On Jul 6, 2011, at 1:23 PM, Eric E. Dolecki wrote:

 I found a Soundex NSString category here:
 
 http://www.cocoadev.com/index.pl?NSStringSoundex
 
 However, when I tried it out I get strange results...
 
 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);
 
 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0
 
 It would seem something is off to get negatives on Place, Ace  Mace.
 
 Any ideas or perhaps a different Soundex implementation I could try? I
 am already using Levenstein distance, but on it's own it's not good
 enough.

Soundex is based on having the first character providing a unique sound, with 
the rest of the character mapped together.

If you wanted to ignore that first character distinction, prepend your strings 
with a character like X that is unlikely to be a first character (since 
otherwise you'll get into trouble with its drop double letters step). The 
code appears to not care what the first character is (i.e., doesn't test for 
alphabetic characters), so you could probably use something like #.


Glenn Andreas  gandr...@gandreas.com 
The most merciful thing in the world ... is the inability of the human mind to 
correlate all its contents - HPL

___

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: Using a Soundex category...

2011-07-06 Thread Wim Lewis

On 6 Jul 2011, at 11:23 AM, Eric E. Dolecki wrote:
 However, when I tried it out I get strange results...
 
 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);
 
 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0
 
 It would seem something is off to get negatives on Place, Ace  Mace.


Soundex (by design) does an exact match of the first character, and a sort of 
rough phonetic match of the rest of the string--- it was developed for matching 
surnames. You probably want a different algorithm if you want Ace to match 
Place. The Wikipedia article on Soundex has some links that might serve as 
starting points.


___

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: Using a Soundex category...

2011-07-06 Thread Lars Sonchocky-Helldorf

Am 06.07.2011 um 20:23 schrieb Eric E. Dolecki:

 I found a Soundex NSString category here:
 
 http://www.cocoadev.com/index.pl?NSStringSoundex
 
 However, when I tried it out I get strange results...
 
 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);
 
 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0
 
 It would seem something is off to get negatives on Place, Ace  Mace.
 
 Any ideas or perhaps a different Soundex implementation I could try? I
 am already using Levenstein distance, but on it's own it's not good
 enough.

You should be aware that the whole soundex algorithm is a rough hack that only 
works for the english language. If you want to localize your app forget about 
soundex, it is absolutely not working for let's say french or german.


cheers,

Lars___

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: Using a Soundex category...

2011-07-06 Thread Eric E. Dolecki
Thanks for the feedback. I now see how this works.

I am using the Nuance iOS SDK to verbally search an iPhone's music
library and play music based on what the user asked for (with and
without keywords). The Levenstein stuff sometimes works, now going to
add this to see if it can fill in some of the holes.

I tried this which worked

NSString *z = [NSString stringWithFormat:@#%@,stringValue];
BOOL test = [z soundsLikeString:@#Face];
NSLog(@sounds like \Face\: %d, test);
//Pace = 1

Not including the 1st character might be okay. With some testing I'll find out.





On Wed, Jul 6, 2011 at 2:34 PM, Wim Lewis w...@omnigroup.com wrote:

 On 6 Jul 2011, at 11:23 AM, Eric E. Dolecki wrote:
 However, when I tried it out I get strange results...

 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);

 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0

 It would seem something is off to get negatives on Place, Ace  Mace.


 Soundex (by design) does an exact match of the first character, and a sort of 
 rough phonetic match of the rest of the string--- it was developed for 
 matching surnames. You probably want a different algorithm if you want Ace to 
 match Place. The Wikipedia article on Soundex has some links that might serve 
 as starting points.


 ___

 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/edolecki%40gmail.com

 This email sent to edole...@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: Using a Soundex category...

2011-07-06 Thread Greg Guerin

Eric E. Dolecki wrote:


http://www.cocoadev.com/index.pl?NSStringSoundex

However, when I tried it out I get strange results...

//someString is set to different strings each time tested
BOOL test = [someString soundsLikeString:@Face];
NSLog(@sounds like Face: %d,test);

Place = 0
Ace = 0
Mace = 0
Fake = 1
Testing = 0
Brake = 0

It would seem something is off to get negatives on Place, Ace  Mace.



There's this comment in the -soundexString method:

	 Replace consonants with digits as follows (but do not change the  
first letter):

 b, f, p, v = 1
 c, g, j, k, q, s, x, z = 2
 d, t = 3
 l = 4
 m, n = 5
 r = 6
 Collapse adjacent identical digits into a single digit of that value.
 Remove all non-digits after the first letter.
	 Return the starting letter and the first three remaining digits. If  
needed, append zeroes to make it a letter and three digits.


Assuming the code works as the comment says, and you should read the  
code to confirm this, then it doesn't change the first letter.  So it  
seems to me that Face won't match place, ace, or mace.


Maybe you could print the value of the -soundexString method instead  
of blindly relying on the boolean of soundsLikeString:.


  -- GG

___

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: Using a Soundex category...

2011-07-06 Thread Eric E. Dolecki
   NSString *z = [NSString stringWithFormat:@#%@,stringValue];
   NSLog(@soundexString: %@, [z soundexString]);
   NSLog(@soundexString2: %@, [stringValue soundexString]);
   NSLog(@soundexString3: %@, [@#Face soundexString]);
   NSLog(@soundexString4: %@, [@Face soundexString]);

   BOOL test = [z soundsLikeString:@#Face];
   NSLog(@sounds like \Face\: %d, test);

For Pace used as stringValue...

soundexString: #120
soundexString2: p200
soundexString3: #120
soundexString4: f200
sounds like Face: 1

On Wed, Jul 6, 2011 at 2:46 PM, Greg Guerin glgue...@amug.org wrote:
 Eric E. Dolecki wrote:

 http://www.cocoadev.com/index.pl?NSStringSoundex

 However, when I tried it out I get strange results...

 //someString is set to different strings each time tested
 BOOL test = [someString soundsLikeString:@Face];
 NSLog(@sounds like Face: %d,test);

 Place = 0
 Ace = 0
 Mace = 0
 Fake = 1
 Testing = 0
 Brake = 0

 It would seem something is off to get negatives on Place, Ace  Mace.


 There's this comment in the -soundexString method:

 Replace consonants with digits as follows (but do not change the
 first letter):
 b, f, p, v = 1
 c, g, j, k, q, s, x, z = 2
 d, t = 3
 l = 4
 m, n = 5
 r = 6
 Collapse adjacent identical digits into a single digit of that
 value.
 Remove all non-digits after the first letter.
 Return the starting letter and the first three remaining digits.
If
 needed, append zeroes to make it a letter and three digits.

 Assuming the code works as the comment says, and you should read the code
to
 confirm this, then it doesn't change the first letter.  So it seems to me
 that Face won't match place, ace, or mace.

 Maybe you could print the value of the -soundexString method instead of
 blindly relying on the boolean of soundsLikeString:.

  -- GG

 ___

 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/edolecki%40gmail.com

 This email sent to edole...@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


Loading Nibs which are self-ref

2011-07-06 Thread Kevin Muldoon
 I'm seeking to do a copyObject class that has it's own progress window. So, 
I'm doing my research and I see a technique for loading a nib with an object, 
like so...

MyDocument *myDocument = [[MyDocument alloc] init];
[NSBundle loadNibNamed:@MyDocument owner:myDocument];
[owner:myDocument doAnInterestingMethodToTheWindow];
Now, this looks like it's the compartmentalization I want when building UI! 

Andrew Stone takes things even father. 
http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html 

So, I've been banging away at this for 10+ hours and things aren't working 
quite as expected. Given all the changes in xCode/Cocoa in the last 2 years, 
I'm wondering if I'm looking at antiquated techniques and need to be looking 
elsewhere for handling multiple windows.



Kevin Muldoon
e: caoimgh...@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: Using a Soundex category...

2011-07-06 Thread Scott Ribe
On Jul 6, 2011, at 12:23 PM, Eric E. Dolecki wrote:

 It would seem something is off to get negatives on Place, Ace  Mace.

That's Soundex. First character is matched literally.

You might want to look at Metaphone, rather than using an algorithm that was 
designed in the 19th century for calculation by hand by census takers ;-) 

Although it too will give you negatives on place, ace  mace because those do 
not really sound like face at all. Rhymes with is a rather low threshold 
for sounds like--first consonant is very important, and it seems highly 
unlikely that someone would think they heard place when face was spoken to 
them.

Personally, I use Metaphone to find similar strings, then modified Levenshtein 
to rank them.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice




___

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: Using a Soundex category...

2011-07-06 Thread Eric E. Dolecki
Funny - I bolted in a Metaphone2 class I found online eariler. Face becomes
fs and place becomes pls.

Then Levenstein comes pretty close.

Thanks!


  Google Voice: (508) 656-0622
  Twitter: eric_dolecki  XBoxLive: edolecki  PSN: eric_dolecki
  http://blog.ericd.net



On Wed, Jul 6, 2011 at 4:17 PM, Scott Ribe scott_r...@elevated-dev.comwrote:

 On Jul 6, 2011, at 12:23 PM, Eric E. Dolecki wrote:

  It would seem something is off to get negatives on Place, Ace  Mace.

 That's Soundex. First character is matched literally.

 You might want to look at Metaphone, rather than using an algorithm that
 was designed in the 19th century for calculation by hand by census takers
 ;-)

 Although it too will give you negatives on place, ace  mace because those
 do not really sound like face at all. Rhymes with is a rather low
 threshold for sounds like--first consonant is very important, and it seems
 highly unlikely that someone would think they heard place when face was
 spoken to them.

 Personally, I use Metaphone to find similar strings, then modified
 Levenshtein to rank them.

 --
 Scott Ribe
 scott_r...@elevated-dev.com
 http://www.elevated-dev.com/
 (303) 722-0567 voice





___

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


How to change font trait and font family for a NSBrowserCell

2011-07-06 Thread Sandeep Mohan Bhandarkar
Hi All,

I am trying to set a particular font for the NSBrowserCell. Basically i want 
some of the cells in the Browser to Appear in bold. I tried the following in 
the browser willDisplayCell method but with no success. can some one please let 
me know what is the correct approach

- (void) browser:(NSBrowser*)theBrowser willDisplayCell:(id)cell 
atRow:(int)rowNumber column:(int)columnNumber

I have tried the following code so far

1) Using NSFont

[cell setFont:[NSFont fontWithName:@Geneva-Boldsize:10]];


2) Using NSFontManager

[cell setFont:[[NSFontManager sharedFontManager] fontWithFamily:@Geneva 
traits:NSBoldFontMask 
 weight:9 
size:10] ];

But in either case the font does not seem to change. Is there any other way in 
which this can be done.

Thanks and Regards,
Sandeep.

___

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: Loading Nibs which are self-ref

2011-07-06 Thread Wim Lewis

On 6 Jul 2011, at 2:43 PM, Kevin Muldoon wrote:
 I'm seeking to do a copyObject class that has it's own progress window. So, 
 I'm doing my research and I see a technique for loading a nib with an object, 
 like so...
 
 MyDocument *myDocument = [[MyDocument alloc] init];
 [NSBundle loadNibNamed:@MyDocument owner:myDocument];
 [owner:myDocument doAnInterestingMethodToTheWindow];
 Now, this looks like it's the compartmentalization I want when building UI! 
 
 Andrew Stone takes things even father. 
 http://www.stone.com/The_Cocoa_Files/Doing_Objects_Right.html 
 
 So, I've been banging away at this for 10+ hours and things aren't working 
 quite as expected. Given all the changes in xCode/Cocoa in the last 2 years, 
 I'm wondering if I'm looking at antiquated techniques and need to be looking 
 elsewhere for handling multiple windows.

That looks right to me (assuming the third line's owner: is a typo). Though as 
Jens Alfke says, if you make your owner object a subclass of 
NS{View,Window}Controller it will take care of some housekeeping for you.

In what way is it not working as expected? Are you checking the results of 
loadNibNamed:, etc? Are your owner object's outlets being set to the correct 
non-nil objects instantiated from the nib?


___

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: Animating a flickering display

2011-07-06 Thread Scott Steinman
Thanks for the help.

I don't know Quartz Composer yet, but I'll take a look at the documentation and 
see if it fits my needs for the current program.  I've been mulling it over, 
and may create a git branch to try Core Animation. First, it may facilitate 
future alternative animated displays such as scrolling test.  Second, I might 
as well have some fun and learn it!

Scott
___

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: NSDatePicker weirdness with time.

2011-07-06 Thread Trygve Inda
 On Wed, Jul 6, 2011 at 7:11 AM, Fritz Anderson fri...@manoverboard.org
 wrote:
 On 6 Jul 2011, at 12:16 AM, Trygve Inda wrote:
 
 It seems that NSDateFormatters instantiated in my nibs get their zone set to
 PDT (because of my time settings), despite having called
 
 [NSTimeZone setDefaultTimeZone:[NSTimeZone
 timeZoneWithAbbreviation:@GMT]];
 
 Before any nibs are loaded.
 
 Which makes sense. The model is that objects in XIBs/NIBs are instantiated
 when Interface Builder archives them, not when the NIBs are loaded. Your
 attempt to initialize them from a runtime default has no effect because
 they've already been initialized.
 
 Well, it makes sense insofar as this is a plausible explanation for
 this behavior. But it would make much more sense for NSDateFormatter
 to implement -awakeFromNib and configure itself according to the
 locale it's loaded into.
 

Exactly.

I have worked around it of course, but there is no logical reason for the
date/time controls to not configure themselves based on the locale.

T.



___

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


Core Data Predicate Question

2011-07-06 Thread Indragie Karunaratne
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/archive%40mail-archive.com

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


[Moderator] Re: Lion's Auto Save Versions

2011-07-06 Thread Scott Anguish
Lion is still under non-disclosure.

Discussion is available at devforums.apple.com, but it is not appropriate here.

Scott
moderator


On Jul 5, 2011, at 4:24 PM, Brad Stone wrote:

 I'm testing my app in Lion with 4.1 and I'd like to play around with Auto 
 Save and Versions 
 (http://developer.apple.com/technologies/mac/whats-new.html).  I've been 
 through the documentation and I can't find anything new about how this works. 
  
 
 Is there any documentation how we implement Auto Save and Versions?  Is the 
 the same old autosave functionality that's been around for a while?
 
 Second question, I have a Core Data document-based app so I've been running 
 under the assumption that it's not recommended use Auto Save.  This may be 
 urban legend.  If it's real does it still apply?
 
 Thanks, Brad___
 
 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/scott%40cocoadoc.com
 
 This email sent to sc...@cocoadoc.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


What is returned from CFLocaleGetSystem?

2011-07-06 Thread Mark Schisler
When attempting to use CFLocaleGetSystem() as a parameter to
CFDateFormatterCreate(), a call to
CFDateFormatterGetAbsoluteTimeFromString() using the created
CFDateFormatterRef seemed to always return false.  However, when I changed
the code to use a locale created by CFLocaleCopyCurrent, formatting was
successful.  See my static C++ function below:

GregorianDate GregorianDate::getFromFormat(
const ReferenceCountedNonMutableString date, const
ReferenceCountedNonMutableString format) {

CFAbsoluteTime absTime;
CFGregorianDate gregDate;
CFLocaleRef locale = CFLocaleGetSystem(); // or
CFLocaleCopyCurrent();

CFDateFormatterRef dateFormatter = CFDateFormatterCreate(
   kCFAllocatorDefault, locale, kCFDateFormatterNoStyle,
kCFDateFormatterNoStyle);

CFDateFormatterSetFormat(dateFormatter, format.getAsCFStringRef());
CFDateFormatterSetProperty(dateFormatter,kCFDateFormatterIsLenient,
kCFBooleanTrue);   

Boolean success =
CFDateFormatterGetAbsoluteTimeFromString(dateFormatter,
date.getAsCFStringRef(), NULL, absTime);

// return an invalid date
if (!success)
{
return GregorianDate(0,0,0);
}

gregDate = CFAbsoluteTimeGetGregorianDate(absTime, NULL);

CFRelease(dateFormatter);
// CFRelease(locale);
   
return GregorianDate(gregDate);
} 


The documentation states CFLocaleGetSystem returns the root, canonical
locale, which contains fixed backstop settings for all locale
information.  Clearly, this appears to be something different from the
current user locale.  My question is: is this a valid locale for anything?
 What is its use-case?

Thanks in advance!
Mark

___

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: Dynamically loading NIB files with a common stem

2011-07-06 Thread vincent habchi
Le 6 juil. 2011 à 18:10, Douglas Davidson a écrit :

 It isn't necessary to use @. here; you should be able to pass nil for that 
 argument if the resources in question are not in a subdirectory.  From the 
 header comments:  subpath is a relative path to a subdirectory inside the 
 relevant global or localized resource directory, and should be nil if the 
 resource file in question is not in a subdirectory.

Yes, you're right. It works like a charm. I am a bit lazy, I never consider 
digging into the header files to get some hints. For me, all the help available 
is (and maybe should be) in the documentation…

Thanks a lot everybody for your help!
Vincent___

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