NSTextField keyboard event

2008-03-05 Thread peiyuan
Hi all,

Situation:
I have a window which contains several NSTextField. In these NSTextField, I 
want that when a user presses a key which is not a number ( 0-9), the active 
NSTextField will not accept the key input (that is, it does nothing).

What I find on the list:
I find several posts similar to my situation. However, after reading these 
posts, I got much confused.
1, Some posts said that I should implement the method:
 - (BOOL)textView:(NSTextView *)aTextView doCommandBySelector:(SEL)aSelector;

2, Some posts said that I should inherit from NSWindow or NSTextField and 
implement the method:
- (void)keydown: ( event *)et;

My Questions:

1. If 1 is right, where should I implement the method ? Inherit from NSWindow? 
Inherit from NSTextField and use it to replace NSTextField? And How? Could 
someone show me some examples?

Also, there is no selector like: insertOne:, insertTwo ... etc. How should I 
know the user is pressing a number key?

2. If 2 is right, how to do it?
I have tried to inherit from NSTextField. The keyDown event is not called when 
I press any key.


3. Any other methods to achieve?

Thank you.

Pei-Yuan
@KCodes

___

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 [EMAIL PROTECTED]


Re: mysterious crash in [NSCell menu]

2008-03-05 Thread John C. Randolph


On Mar 5, 2008, at 5:45 AM, Hendrik Schreiber wrote:

a customer of mine experiences a crash that I cannot reproduce and  
that I have no idea where its coming from.
He is trying to export some photos from iPhoto using our export  
plugin (iP2F) and at some point always gets a Bus Error. I pasted a  
partial crash log below.
This person apparently has a few InputManager based plugins and all  
kinds of other stuff installed.


My bet is that the crashes are due to the haxies he's installed.  Ask  
him to check whether the  problem persists when he removes them.


-jcr
___

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 [EMAIL PROTECTED]


Re: how to monitor the system status?

2008-03-05 Thread Ken Thomases

On Mar 5, 2008, at 4:13 PM, Scott.D.R wrote:


As the titled mentioned, How to monitor the system status?
Mac OS X provided a very powerful application Activity Monitor,  
which can let you inspect the system status such as CPU usage, disk  
usage, network usage and so on. But how to retrieve these  
information using APIs?


Mostly through the sysctl() routines.  For an example, see http://developer.apple.com/qa/qa2001/qa1123.html 
.


See the man page, and search for sysctl at developer.apple.com for  
more.


-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 [EMAIL PROTECTED]


Re: how to monitor the system status?

2008-03-05 Thread Phil

On Mar 5, 2008, at 5:13 PM, Scott.D.R wrote:


Hi everyone.
As the titled mentioned, How to monitor the system status?
Mac OS X provided a very powerful application Activity Monitor,  
which can let you inspect the system status such as CPU usage, disk  
usage, network usage and so on. But how to retrieve these  
information using APIs?




There are various API's depending on what you want to monitor.  You  
might want to take a look at a project like MenuMeters (http://www.ragingmenace.com/software/menumeters/ 
) which provides a fairly comprehensive overview of system status and  
provides source code so you can see how it was done.  I'm sure there's  
also some Apple example code that demonstrates aspects of this but I  
can't recall anything that does it all in one project like MenuMeters.


Phil
___

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 [EMAIL PROTECTED]


NSPopUpButton under Leopard?

2008-03-05 Thread Bazyli Zygan
Hello!

Sorry to bother with such a lame question, but neither google or my own
research came up with any specific answers.

I'm struggling to create an app, that uses NSPopUpButton. Under Tiger, with
old XCode and IB, when I've associated the menu with NSPopUpButton,
I could change selected item manually and user could select new item from
the UI without any problems.

Now, when I've migated my project to XCode 3.0 and new IB, it seems not to
work.
When I'm selecting new item from the UI, still the old item stays selected
(only change selector is called). Also selectItem: and selectItemAtIndex:
does not seem to work.

Have any of you had this kind of the situation before?
What such a lame programmer as I could do wrong in here? :-)

Thank you in advance.

b.
___

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 [EMAIL PROTECTED]


Re: NSOutlineView slow update w Core Data

2008-03-05 Thread David
I figured out a way around it. I added code in the controller to send the
processPendingChanges message to the ManagedObjectContext. That flushes
pending changes, but I still don't understand why this is needed.

On Wed, Mar 5, 2008 at 12:14 AM, David Melgar [EMAIL PROTECTED] wrote:

 I have an NSOutlineView subclass bound to a NSTreeController subclass
 which is bound to a simple data model representing a hierarchical tree
 structure.
 I've implemented drag and drop by having the view send a custom message to
 my NSTreeController subclass who then updates the model. The problem is that
 there is then a delay of about 1 second before the view displays the added
 node.

 I've noticed that if I move the mouse out of the OutlineView, then it
 seems to update immediately. Any idea what I maybe doing wrong? Is it
 possible that core data and all the observing patterns are really taking
 this long to percolate the change back to the view? Am I supposed to do
 something to wake up the view faster?

 I'm using Leopard (10.5.2), XCode 3, Objective-C 2.0. I don't have any
 code to deal with memory management. If I run with garbage collection
 unsupported, the OutlineView never updates UNTIL I move the mouse out of the
 OutlineView. If garbage collection is enabled, there is the 1 second delay.
 With garbage collection supported, there are no errors or exceptions listed
 in the console.

 MyOutlineView has the following method

 - (BOOL)performDragOperation:(id NSDraggingInfo)sender {

 NSPasteboard *pboard;

 NSDragOperation sourceDragMask;

  sourceDragMask = [sender draggingSourceOperationMask];

 pboard = [sender draggingPasteboard];

  if ( [[pboard types] containsObject:NSFilenamesPboardType] ) {

 NSArray *files = [pboard propertyListForType:NSFilenamesPboardType
 ];

 if (myTreeController != NULL) {

 [myTreeController addFiles:files];

 }

 }

 return YES;

 }

 MyTreeController method is as follows:

 - (void)addFiles:(NSArray *)droppedFilenames {

 NSManagedObjectContext *moc = [self managedObjectContext];

 for (NSString *name in droppedFilenames) {

 NSManagedObject *bfile = [NSEntityDescription
 insertNewObjectForEntityForName:@bFiles inManagedObjectContext:moc];

 [bFile setName: name];

 }

 }


 The model is:

 Entity name: bFiles

 Attribute: name

 relationship: parent, optional, bFiles

 relationship: child,  optional, bFiles


 I have MyTreeController nib configured with the following attributes

 Keypaths: children = children

 Options: avoid empty selection, preserve selection, select inserted
 objects

 ObjectController:

 Mode=Entity

 Entity name = bFiles

 Prepares content, editable


 I have MyTreeController bound as follows:

 Parameters, ManagedObjectContext

 bind to File's Owner

 Model key path = managedObjectContext

 Raises for not applicable keys


 I don't have my NSOutlineView bound to anything but I do have the
 contained TableColumn bound as follows:

 Value: bind to: Tree Controller

 Controller Key = arrangedObjects

 Model Key Path = name

 Allows editing multiple value selection

 Creates sort descriptor

 Raises for not applicable keys


 Thats about everything pertinent that I can think of. Any suggestions
 appreciated.

___

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 [EMAIL PROTECTED]


Deinterlacing QTCaptureDecompressedVideoOutput

2008-03-05 Thread Bram Loogman
Hi,

When I use QTCaptureDecompressedVideoOutput to capture a still image
from a QTCaptureSession with a DV camera as input device, the image is
interlaced. Which looks very ugly for moving objects. I basically use
the code from the 'Creating a QTKit Stop or Still Motion Application'
tutorial in the QTKit Capture Programming Guide to get an image buffer
and than store it as a jpeg image.
I looked at the camera settings but it's not possible to change the
shutter speed or something like that. Is there a way to deinterlace
the output from the QTCaptureSession?

Thanks,
Bram
___

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 [EMAIL PROTECTED]


Re: Localise between different versions of English

2008-03-05 Thread Christopher Nebel

On Mar 4, 2008, at 9:36 PM, Jens Alfke wrote:


On 4 Mar '08, at 3:23 PM, Sean McBride wrote:


There's also Canadian English (en_CA), and perhaps others too...


The ISO is in the process of adding en_LOL for Lolcat, aka Kitteh  
or Cat Pidgin[1]. (If you don't think there's a need for this,  
consider what HTTP Language: header value should be used by  
daringfurball.org or icanhascheezburger.com.)


I presume Jens was joking, but for a chuckle, go to Google web search,  
hit Preferences and check out the Interface Language preference.   
There are lots of real ones (be careful experimenting, you may have  
trouble getting back to English!), but a few fakes as well.  LOLcat  
is, regrettably, not one of them, but they do have Klingon, Hacker  
(notice what Hacker is when written natively), and my personal  
favorite, Elmer Fudd.



--Chris N.
___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread Jim Turner
Chris,

On Tue, Mar 4, 2008 at 9:47 PM, Chris Suter [EMAIL PROTECTED] wrote:


  On 05/03/2008, at 2:10 PM, Kyle Sluder wrote:

   On Tue, Mar 4, 2008 at 11:49 AM, Jim Turner
   [EMAIL PROTECTED] wrote:
   In attempting to use a custom setter for a object, I'm getting the
   following message in the console the first time that object is
   instantiated:
  
   KVO autonotifying only supports -setKey: methods that return void.
   Autonotifying will not be done for invocations of -[MyObject
   setValue:]
  
   [snip]
  
   -(void) setValueForBindings:(id)_value
   {
  [self willChangeValueForKey:@value];
  {
  BOOL didSetOK = [self setStringValue:(NSString
   *)_value];
  // Do something with didSetOK
  }
  [self didChangeValueForKey:@value];
   }
  
   Please re-read the second sentence of that error again.  You are
   manually invoking -willChangeValueForKey: and -didChangeValueForKey:
   and KVO is complaining I've already done that!.  Either stop doing
   that, or implement -automaticallyNotifiesObserversForKey: to return NO
   for the bindings key.

Actually, these were never getting called at all.  Read below.


  Implementing -automaticallyNotifiesObserversForKey: will solve the
  problem but just removing the calls to -willChangeValueForKey: and -
  didChangeValueForKey: won't.

  I suspect the real cause of the problem is that there's a setValue:
  method defined in the superclass that returns something.

Actually, there was a -(BOOL) setValue: method in the object itself
that was getting called, I simply didn't see it in there.  KVO/KVC was
finding it instead of my defined setter method, as it should have.

Having +automaticallyNotifiesObserversForKey: return NO for value
stopped the warning, but observation stopped as well, regardless if I
posted will/didChangeValueForKey because my custom setter still wasn't
getting called (the ivar was getting accessed directly)

When I implement +accessInstanceVariablesDirectly and have it return
NO, KVO then complains that my object is now no longer compliant even
though I have valid values for getter and setter defined in the
property declaration.  The object responds to my custom methods but is
missing the connection that the property should be using those as well
instead of the default.

I filed a bug (rdar://problems/5781977) as this doesn't appear to be
proper behavior.  I'd be happy to be told I'm wrong if you can point
out what I'm missing.


  If you're going to be using KVO/KVC on your objects, you should
  probably reconsider whether it's a good idea for your setter/getter
  methods to use non-default names. Obviously, you can change the name
  of your property if it clashes with methods in your superclass.

  - Chris



Thanks

-- 
Jim
http://nukethemfromorbit.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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread mmalc crawford


On Mar 5, 2008, at 9:34 AM, Jim Turner wrote:


I filed a bug (rdar://problems/5781977) as this doesn't appear to be
proper behavior.  I'd be happy to be told I'm wrong if you can point
out what I'm missing.


I believe this behaves correctly.
As stated in http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_5.html# 
, Key-value coding and declared properties are orthogonal  
technologies.
KVC doesn't know about any custom setter you may have defined for a  
property.


mmalc

___

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 [EMAIL PROTECTED]


Re: Deinterlacing QTCaptureDecompressedVideoOutput

2008-03-05 Thread Robert Douglas
I  ran in to a similar problem while analyzing incoming HDV images and  
I didn't find any simple solution.  My approach now is to create a  
second CVPixelBuffer with half the number of lines and copy every  
second line into that buffer.  Or two buffers to get better temporal  
resolution.   I haven't yet gotten around to writing the field images  
to a file so there may be issues with rectangular pixels, but output  
to a CIImage-based view works well.

I'd be interested in hearing of other solutions,
Rob


On 5-Mar-08, at 9:11 AM, Bram Loogman wrote:


Hi,

When I use QTCaptureDecompressedVideoOutput to capture a still image
from a QTCaptureSession with a DV camera as input device, the image is
interlaced. Which looks very ugly for moving objects. I basically use
the code from the 'Creating a QTKit Stop or Still Motion Application'
tutorial in the QTKit Capture Programming Guide to get an image buffer
and than store it as a jpeg image.
I looked at the camera settings but it's not possible to change the
shutter speed or something like that. Is there a way to deinterlace
the output from the QTCaptureSession?

Thanks,
Bram
___

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/rdouglas%40mac.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


[Job Posting] Full Time Cocoa Developer

2008-03-05 Thread Brett Karopczyc
There is a position available for a full-time Cocoa Developer with  
Bristol Capital, Inc. in Montvale, NJ.  We provide information  
services to the enterprise telecommunications industry under the  
InfoPlus brand.


NOTE: The position requires an intimate knowledge of our internal  
frameworks and applications, as well as frequent discussions with  
other in-house developers, so please only apply if you're willing to  
work in Montvale, NJ.


Primary Responsibilities: (Full Time Position)
Maintain and extend existing codebase of internal Cocoa (Objective-C)  
frameworks and applications, PostgreSQL databases, and web resources.


Required Knowledge/Experience:
 - Mac OS X (from both a user’s and developer’s prospective)
 - XCode Development Environment
 - Objective-C Programming Language
 - Cocoa frameworks and design paradigms
 - SQL and RDBMS design (PostgreSQL or similar)
 - Object-oriented design principles (MVC)

Helpful Knowledge/Skills:
 - Enterprise Telecommunications concepts
 - DocBook XML workflows

If you are someone who takes initiative, apply here. We need a self- 
motivator, who possesses an uncanny willingness to be creative and  
participate in the product development process. We want someone who  
feels good about making a difference and contributing his or her  
proven talents to the continued growth of a company, while having fun  
at the same time. A sense of humor helps!


To learn more about what we do, visit http://www.infoplusonline.com
Salary is commensurate with experience.
If you meet the above criteria, please email your résumé to personnel  
(at) infoplusonline [d0t] com
PLEASE DIRECT ALL REPLIES OFF-LIST TO personnel (at) infoplusonline  
[d0t] 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 [EMAIL PROTECTED]


Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Jens Alfke


On 5 Mar '08, at 9:15 AM, I. Savant wrote:


 Okay, well that sucks. So now the question is this: does Core Data
implicitly run VACUUM? If so, when? How often? Unfortunately googling
and archive-searching did not produce any obvious answers to this
particular question. My guess is that the answer is, Yes, at every
save,


I don't know the answer; but it probably doesn't vacuum at every save.  
Vacuuming can be quite slow if the database is at all large,  
especially if there's already a lot of disk I/O going on. (The vacuum  
algorithm has to read and write every page of the database.)


—Jens

smime.p7s
Description: S/MIME cryptographic 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 [EMAIL PROTECTED]

Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread Jim Turner
On Wed, Mar 5, 2008 at 12:00 PM, mmalc crawford [EMAIL PROTECTED] wrote:

  On Mar 5, 2008, at 9:34 AM, Jim Turner wrote:

   I filed a bug (rdar://problems/5781977) as this doesn't appear to be
   proper behavior.  I'd be happy to be told I'm wrong if you can point
   out what I'm missing.

  I believe this behaves correctly.
  As stated in 
 http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_5.html#
   , Key-value coding and declared properties are orthogonal
  technologies.
  KVC doesn't know about any custom setter you may have defined for a
  property.

  mmalc



Hmm, it appears the developer documentation I have locally on my
machine is slightly out of date.  After reading that link (and the
updated description of setter= and getter=), I see now why what I'm
doing isn't working.  Properties and KVO/KVC aren't complimentary to
each other... although it'd be nice if they were.  I'll have to
re-work my object to get it to be properly compliant.

But, I still appear to have an issue with defining a custom
getter/setter.  Defining a property as

@property (setter=mySetMethod:,getter=myMethod) id valueTest;

and sending my object a valueTest message, I get the unrecognized
selector sent to instance warning.  Reading (and re-reading several
times) 
http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW17
it appears that I don't need to define anything other than the
@property but unless I also place

-(id) valueTest;
-(void) setValueTest:(id)_value;

in the interface, the object can't find a method signature.

This is a little more confusing that I originally thought. I
appreciate all the help, though.

-- 
Jim
http://nukethemfromorbit.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 [EMAIL PROTECTED]


Re: regexkit [Using NSPredicate to parse strings]

2008-03-05 Thread John Engelhart


On Mar 5, 2008, at 1:03 AM, Jens Alfke wrote:


On 4 Mar '08, at 8:55 PM, John Engelhart wrote:


The ICU Regex C API (the one I need to use for RegexKit, not the C+ 
+ one, which I haven't really looked at) is very multi-threading  
unfriendly.  Basically, the 'compiled' regex, the string being  
matched, and the current match state are all wrapped up in the same  
opaque compiled regex pointer.


Well, I'm pretty multi-threading unfriendly myself, so that hasn't  
been a concern for me ;-)
But seriously, IIRC there is a way to cheaply clone an ICU regex  
object, so you can compile it once and peel off a new copy for every  
string you need to match. (I wrote, but never finished, a Cocoa ICU  
wrapper before I left Apple, and I think that was my solution to the  
state problem.)


Yes, the uregex_clone() function.  The way I'm probably going to  
tackle it is to create the 'master' compiled regex and then each  
thread will demand populate its thread local cache by cloning the  
master one.  Not terribly pretty.


For example, Safari AdBlock (http://safariadblock.sourceforge.net/)  
uses RegexKit as its regex matching engine.  This involves a list  
of about 500 regexes (depending on which adblock lists you've  
subscribed to) that need to be executed for every URL.


Um, can't you merge those together into a single regex by joining  
them together with or operators? (That's a fairly typical trick  
that lexers use.)


In theory, yes.  In practice, no.  It all comes down to the details of  
how the regex engine performs its matching.  For regex engines that  
use a NFA matching system, your suggestion is deathly slow.  If the  
regex engine uses a DFA matching system, then your suggestion is the  
right one, allowing essentially constant execution time (dependent on  
the length of the string to match) irregardless of the number of  
individual regexes you've joined together.  The older ATT `lex` and  
the newer `flex` use a DFA matching system, but as a general rule of  
thumb general purpose regex matching engines use a NFA matching  
system.  It's a classic time/space/efficiency trade-off, the 'regex  
program' for a NFA system are easier to construct and much smaller  
than their DFA counterparts.  Most DFA matchers usually build an NFA  
system first, then perform the expensive NFA - DFA conversion step.


I did try what you suggested just to see how PCRE would respond  
(something like a componentsJoinedByString:@|).  After about 10-15  
seconds of waiting, it was obvious that it was a solution that was not  
going to work.  :)


My zero-order approximation read on the ICU vs. PCRE on this issue  
leads me to think that they are essentially equal.  However, PCRE  
and ICU define 'word' and 'non-word' (the regex escape sequence \w  
and \W), and consequently the '(non-)word break' (escape sequence  
\b and \B) very differently.  Specifically, PCRE defines word and  
non-word in terms of ASCII encoding ONLY, whereas ICU does not


What you're saying is that they're essentially equal, except for non- 
ascii characters :)


ICU takes Unicode very, very seriously; that's its raison d'être.  
It's the International Components for Unicode. Regexes are just one  
of the things it does.


Translated to: A positive look-behind (the character just before  
this point in the regex) must be a Unicode Character and a positive  
look-ahead (the next character, without 'consuming' the input, must  
not be a unicode character).  Definitely not as elegant, but I  
suspect passable.


Nope. As I said, several languages (including Japanese) have word- 
break rules that are more complex than this. Multiple words run  
together without any non-word characters in between. You have to use  
per-language heuristics to find the breaks. (My understanding is  
that Thai is especially nasty, practically requiring the use of a  
dictionary to tweeze apart the individual words.)


Ah, I did some digging, and I think you're referring to the the ICU  
UREGEX_UWORD regex compile time option for enhanced Unicode word  
boundaries.  From the ICU header:


 UREGEX_UWORD= 256  // Unicode word boundaries. If  
set, \b uses the Unicode TR 29 definition of word boundaries. Warning:  
Unicode word boundaries are quite different from traditional regular  
expression word boundaries.  See http://unicode.org/reports/tr29/#Word_Boundaries


Even this enhanced functionality seems to be a better, but still  
crude approximation for true word breaking.  The ICU Regex  
documentation seems to recommend that if you want proper word  
breaking, you use the actual ICU word breaking system, and not  
regexes, precisely for the reasons you outlined above.  PCRE does not  
have this optional enhanced \b behavior, though I think the 'simpler,  
traditional' \b behavior can still be approximated with \p{L} like  
matching, but this would obviously fall far short of what's listed in  
the Unicode TR29 recommendation.  Looking at the 

Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread I. Savant
  I don't know the answer; but it probably doesn't vacuum at every save.
  Vacuuming can be quite slow if the database is at all large,
  especially if there's already a lot of disk I/O going on. (The vacuum
  algorithm has to read and write every page of the database.)

  That certainly makes sense and I've wondered about it, but I'd love
to get a definitive answer. Perhaps mmalc knows since he seems to be
the resident Core Data expert? ;-)

--
I.S.
___

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 [EMAIL PROTECTED]


NSStream SSL Help

2008-03-05 Thread Eric Scharff
var YAHOO = {'Shortcuts' : {}};
YAHOO.Shortcuts.hasSensitiveText = false;
YAHOO.Shortcuts.sensitivityType = [];
YAHOO.Shortcuts.doUlt = false;
YAHOO.Shortcuts.location = us;
YAHOO.Shortcuts.document_id = 0;
YAHOO.Shortcuts.document_type = ;
YAHOO.Shortcuts.document_title = Does NSStream\x5c\x27s SSL or TLS support 
work?;
YAHOO.Shortcuts.document_publish_date = ;
YAHOO.Shortcuts.document_author = [EMAIL PROTECTED];
YAHOO.Shortcuts.document_url = ;
YAHOO.Shortcuts.document_tags = ;
YAHOO.Shortcuts.annotationSet = {
lw_1204748497_0: {
text: www.apple.com,
extended: 0,
startchar: 468,
endchar: 480,
start: 468,
end: 480,
extendedFrom: ,
predictedCategory: ,
predictionProbability: 0,
weight: 1,
type: [shortcuts:/us/place/virtual/web_site],
category: [IDENTIFIER],
context: to a site who I know has a valid certificate (www.apple.com port 
443),  I get the error code NSUnknownErrorDomain error -9843 },
lw_1204748497_1: {
text: http://www.yahoo.com/r/hs;,
extended: 0,
startchar: 3345,
endchar: 3369,
start: 3345,
end: 3369,
extendedFrom: ,
predictedCategory: ,
predictionProbability: 0,
weight: 1,
type: [shortcuts:/us/instance/identifier/hyperlink/http],
category: [IDENTIFIER],
context: Eric

 Never miss a thing.  Make Yahoo your home page.  http://www.yahoo.com/r/hs;,
metaData: {
linkHref: http://www.yahoo.com/r/hs;,
linkProtocol: http,
linkTarget: _blank
}
 }I am trying to get a basic test of NSStream TLS support working. Eventually, 
I want to send TLS encrypted data over an arbitrary port, but to test, I 
figured I'd try to make an SSL connection as an example.

Even if I connect to a site who I know has a valid certificate (www.apple.com 
port 443),  I get the error code NSUnknownErrorDomain error -9843. sent to my 
callback.  This error seems to correspond to errSSLHostNameMismatch in 
SecureTransport.h (peer host name mismatch).  This doesn't make sense because 
TLS shouldn't require host name verification anyway, and I'm sure that the 
server's SSL certificate is valid.

Has anyone successfully used NSStream to talk SSL?  I'd really like to use this 
non-blocking API rather than relying, for example, on a blocking OpenSSL based 
API.

My initialization code is below:

[NSStream getStreamsToHost: [NSHost hostWithName: [serverName 
stringValue]] port: [serverPort intValue] inputStream: fileInStream 
outputStream: fileOutStream];
if ((fileInStream != nil)  (fileOutStream != nil)) {
[fileInStream retain];
[fileOutStream retain];

[fileInStream setProperty: NSStreamSocketSecurityLevelTLSv1 forKey: 
NSStreamSocketSecurityLevelKey];
[fileOutStream setProperty: NSStreamSocketSecurityLevelTLSv1 
forKey: NSStreamSocketSecurityLevelKey];
//[fileInStream setProperty: 
NSStreamSocketSecurityLevelNegotiatedSSL forKey: 
NSStreamSocketSecurityLevelKey];
//[fileOutStream setProperty: 
NSStreamSocketSecurityLevelNegotiatedSSL forKey: 
NSStreamSocketSecurityLevelKey];

[fileInStream setDelegate: self];
[fileOutStream setDelegate: self];
[fileInStream scheduleInRunLoop: [NSRunLoop currentRunLoop] 
forMode: NSDefaultRunLoopMode];
[fileOutStream scheduleInRunLoop: [NSRunLoop currentRunLoop] 
forMode: NSDefaultRunLoopMode];
[fileInStream open];
[fileOutStream open];
}


Any help would be GREATLY appreciated.

Thanks,

-Eric









  

Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  
http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ 

___

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 [EMAIL PROTECTED]


Re: Custom View drawn twice?

2008-03-05 Thread Ben Lachman
displayIfNeededIgnoringOpacity goes back up the view hierarchy  
looking for an opaque superview to start drawing with. Doing so was  
causing an infinite drawing loop.  I'm pretty sure this is because  
you're not really supposed to be calling setNeedsDisplay...: and  
displayIfNeeded...: within your drawRect: method.  In any case it was  
a nasty hack to get correct looking functionality and I'm actually  
more interested in figuring out what is causing the double drawing  
than hack a fix on top of it.


-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



On Mar 3, 2008, at 5:38 AM, Uli Kusterer wrote:


Am 29.02.2008 um 20:55 schrieb Ben Lachman:

[self displayIfNeededIgnoringOpacity];



 Is there a particular reason why you're calling this method? Won't  
plain old -displayIfNeeded do the job?


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de







___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread mmalc crawford


On Mar 5, 2008, at 11:40 AM, Jim Turner wrote:


But, I still appear to have an issue with defining a custom
getter/setter.  Defining a property as
@property (setter=mySetMethod:,getter=myMethod) id valueTest;
and sending my object a valueTest message, I get the unrecognized
selector sent to instance warning.


Again this behaves correctly.
You've specified that the getter and setter are myMethod and  
mySetMethod: respectively.
If you ask the compiler to synthesise the methods, those are what  
you'll get, and they'll access the 'valueTest' instance variable.

You haven't specified a valueTest method anywhere...

mmalc

___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread mmalc crawford


On Mar 5, 2008, at 1:40 PM, Adam P Jenkins wrote:

If you define a @property in the interface, then in the  
implementation you either need use @synthesize to have the compiler  
automatically generate a getter and setter, or use @dynamic to  
inform the compiler that you will provide the appropriately named  
getter and setter methods.


There is no *need* to specify @dynamic.  In fact, doing so will  
conceal a bug (at least until runtime...) if you don't intend to  
create the appropriate methods at runtime (as do, for example, managed  
objects) but forget to provide an implementation.  If you don't  
specify @dynamic, then the compiler will warn you if you don't supply  
appropriate methods at compile time.


If you need to define the accessors yourself because the auto- 
generated ones don't do what you want, then use @dynamic instead  
like this:

@implementation Person
@dynamic firstName;

- (NSString*)firstName { ... }
- (void)setFirstName:(NSString *)newName { ... }
@end


It's perfectly reasonable also to do either:


@implementation Person

- (NSString*)firstName { ... }
- (void)setFirstName:(NSString *)newName { ... }
@end


or, for example:


@implementation Person
@synthesize firstName;

- (void)setFirstName:(NSString *)newName { ... }
@end


In the latter case, the compiler will just synthesise -firstName.


One further issue for the sake of raising it:

@property (setter=mySetMethod:,getter=myMethod) id valueTest;



Note that this implies that the accessor methods are atomic.  It's  
comparatively rare (unless you're using GC) that Cocoa developers  
implement atomic accessor methods, so you'd typically specify:


@property (nonatomic, setter=mySetMethod:,getter=myMethod) id valueTest;


mmalc

___

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 [EMAIL PROTECTED]


Re: Best way to hook up Font Panel to floater (that isn't first responder)?

2008-03-05 Thread Graham

Thanks for that...

I thought this seemed a bit too obvious to have overlooked and sure  
enough, it's new for 10.5. I should have mentioned I need a solution  
for 10.4 or later. Any ideas?




S.O.S.



On 05/03/2008, at 3:17 AM, Benjamin Stiglitz wrote:

Is there a way to hook up the Font Panel directly? This needs to  
be spring loaded so that the Font Panel follows the user's focus  
most of the time, but switches to my panel when the user clicks  
the Font button but returns to the original 1stR when they go back  
to the main document. Or maybe my thinking is just wrong?


Check out -[NSFontManager setTarget:].

-Ben


___

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 [EMAIL PROTECTED]


re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Ben Trumbull

 ... so that's fine, but SQLite's documentation says of auto_vacuum:

When the auto-vacuum flag is 1 (full), the freelist pages are moved
to the end of the file and the file is truncated to remove the
freelist pages at every commit. Note, however, that auto-vacuum only
truncates the freelist pages from the file. Auto-vacuum does not
defragment the database nor repack individual database pages the way
that the VACUUM command does. In fact, because it moves pages around
within the file, auto-vacuum can actually make fragmentation worse.

  Okay, well that sucks. So now the question is this: does Core Data
implicitly run VACUUM? If so, when? How often? Unfortunately googling
and archive-searching did not produce any obvious answers to this
particular question. My guess is that the answer is, Yes, at every
save, but I'd like to be sure and I'm not familiar enough with SQLite
to know how to test this myself. Any takers?


No, Core Data does not implicitly run a manual vacuum.  Such a vacuum 
recreates the database file from scratch and then (conceptually) 
swaps it for the current database file.  It can be extremely 
expensive for large files or files on network mounts, although for 
most files it's reasonable but slow.


The framework can't really know when it's an acceptable time for your 
app to pause for several to many seconds to do this kind of house 
keeping.  Also, small to medium sized databases with proper indices 
are very fast, and the benefit to a vacuum back to a clean state is 
low.


Running a manual vacuum at every save would be crazy.  Even if you 
were running very large saves for a gigantic import operation, you'd 
rather vacuum at the end of the application specific import.  That 
way you could have multiple threads/processes running the import, and 
the added concurrency would utterly overwhelm any small benefit to 
defragmentation.


For larger databases, reducing internal fragmentation can make a 
significant difference, especially on lower end hardware/laptops. 
Laptops typically use much slower drives, and often have less RAM, so 
they pay a heavy penalty for fragmentation.  On modern desktop 
hardware, the kernel does a pretty amazing job so it can be 
challenging to observe this problem.  Even a vanilla config Mac Pro 
is a monster compared to most laptops.


Since the vacuum command recreates the file, it also reduces external 
fragmentation which is usually a more significant problem (i.e. 
fragmentation of the file across the device).


If you have any performance data showing problems with internal db 
fragmentation (i.e. sqlite3 dbname 'vacuum' fixes it, but cp 
doesn't), we'd love to hear about it.


bugreport.apple.com

--

-Ben
___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread Bill Garrison


On Mar 5, 2008, at 5:14 PM, mmalc crawford wrote:


One further issue for the sake of raising it:

@property (setter=mySetMethod:,getter=myMethod) id valueTest;



Note that this implies that the accessor methods are atomic.  It's  
comparatively rare (unless you're using GC) that Cocoa developers  
implement atomic accessor methods, so you'd typically specify:


@property (nonatomic, setter=mySetMethod:,getter=myMethod) id  
valueTest;


So for most non-GC code, properties should be specified using  
@property (nonatomic, ...)?


I've seen a lot of Apple sample code that doesn't.  Should we be  
filing docs/sample code bugs, or just enabling GC?


Bill
___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread mmalc crawford


On Mar 5, 2008, at 2:56 PM, Bill Garrison wrote:

Note that this implies that the accessor methods are atomic.  It's  
comparatively rare (unless you're using GC) that Cocoa developers  
implement atomic accessor methods, so you'd typically specify:


@property (nonatomic, setter=mySetMethod:,getter=myMethod) id  
valueTest;


So for most non-GC code, properties should be specified using  
@property (nonatomic, ...)?
I've seen a lot of Apple sample code that doesn't.  Should we be  
filing docs/sample code bugs, or just enabling GC?


If the documentation/sample code is not for GC and does not specify  
nonatomic and there is a provided implementation that is not atomic,  
then yes you should file a bug.


A couple of examples to illustrate: If the sample defines

@property (copy) NSString *string;

then

@synthesize string;

that's fine.


If it defines:

@property (copy) NSMutableString *string;

then

@synthesize string;

- (void)setString:(NSString *)newString {
if (string != newString) {
[string release];
string = [newString mutableCopy];
}
}

that would not be OK (the declaration should include nonatomic).

mmalc


___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread mmalc crawford


On Mar 5, 2008, at 2:56 PM, Bill Garrison wrote:

So for most non-GC code, properties should be specified using  
@property (nonatomic, ...)?


To address this separately as a general point: see performance and  
threading considerations discussed at http://developer.apple.com/documentation/Cocoa/Conceptual/ObjectiveC/Articles/chapter_5_section_3.html#//apple_ref/doc/uid/TP30001163-CH17-SW12 
.


mmalc

___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread Jim Turner
On Wed, Mar 5, 2008 at 4:14 PM, mmalc crawford [EMAIL PROTECTED] wrote:

  On Mar 5, 2008, at 1:40 PM, Adam P Jenkins wrote:

   If you define a @property in the interface, then in the
   implementation you either need use @synthesize to have the compiler
   automatically generate a getter and setter, or use @dynamic to
   inform the compiler that you will provide the appropriately named
   getter and setter methods.
  
  There is no *need* to specify @dynamic.  In fact, doing so will
  conceal a bug (at least until runtime...) if you don't intend to
  create the appropriate methods at runtime (as do, for example, managed
  objects) but forget to provide an implementation.  If you don't
  specify @dynamic, then the compiler will warn you if you don't supply
  appropriate methods at compile time.


   If you need to define the accessors yourself because the auto-
   generated ones don't do what you want, then use @dynamic instead
   like this:
   @implementation Person
   @dynamic firstName;
  
   - (NSString*)firstName { ... }
   - (void)setFirstName:(NSString *)newName { ... }
   @end

  It's perfectly reasonable also to do either:


  @implementation Person


  - (NSString*)firstName { ... }
  - (void)setFirstName:(NSString *)newName { ... }
  @end


  or, for example:


  @implementation Person
  @synthesize firstName;


  - (void)setFirstName:(NSString *)newName { ... }
  @end


  In the latter case, the compiler will just synthesise -firstName.


  One further issue for the sake of raising it:

  @property (setter=mySetMethod:,getter=myMethod) id valueTest;
  

  Note that this implies that the accessor methods are atomic.  It's
  comparatively rare (unless you're using GC) that Cocoa developers
  implement atomic accessor methods, so you'd typically specify:

  @property (nonatomic, setter=mySetMethod:,getter=myMethod) id valueTest;


  mmalc


Ok first, mmalc, thank you for taking the time to point out exactly
what I needed to see to understand where I was going wrong.  My
problem stemmed from the misguided idea that properties were required
for KVC/KVO.  Chris' comment about using non-default names makes
much more sense now.

Second, for my situation, I ended up with an interface that looks like this:

@property (getter=getValueForBindings, setter=setValueForBindings:,
assign, nonatomic) id value;

And an implementation:

-(void) setValueForBindings:(id)_value
{
[self willChangeValueForKey:@value];
{
 BOOL didSetOK = [self setStringValue:(NSString *)_value];
   // Do something with didSetOK
}
[self didChangeValueForKey:@value];
}

-(id) getValueForBindings
{
return( value );
}

Then binding my interface to the key 'valueForBindings'.  Not the
prettiest, but it's required for my situation.

Thanks again to everyone for all the help.

-- 
Jim
http://nukethemfromorbit.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 [EMAIL PROTECTED]


large documents with doc based app

2008-03-05 Thread Torsten Curdt

Hey guys,

Using the document based skeleton there is the method

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
or
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error: 
(NSError **)outError;


that gets called when files get loaded. But according to the docs  
NSData is limited to 2GB.

What I am wondering is... How can one handle files larger than 2GB?

Pointers?

cheers
--
Torsten
___

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 [EMAIL PROTECTED]


Re: large documents with doc based app

2008-03-05 Thread j o a r


On Mar 6, 2008, at 12:19 AM, Torsten Curdt wrote:


But according to the docs NSData is limited to 2GB.
What I am wondering is... How can one handle files larger than 2GB?



Override the path / URL based methods from NSDocument instead, and  
read the interesting portions of the files piece-by-piece. You  
typically don't want to load all of it into RAM at once.


j o a r


___

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 [EMAIL PROTECTED]


Re: KVO autonotifying complaining about custom setter return value

2008-03-05 Thread Chris Suter


On 06/03/2008, at 10:10 AM, Jim Turner wrote:


Ok first, mmalc, thank you for taking the time to point out exactly
what I needed to see to understand where I was going wrong.  My
problem stemmed from the misguided idea that properties were required
for KVC/KVO.  Chris' comment about using non-default names makes
much more sense now.

Second, for my situation, I ended up with an interface that looks  
like this:


@property (getter=getValueForBindings, setter=setValueForBindings:,
assign, nonatomic) id value;

And an implementation:

-(void) setValueForBindings:(id)_value
{
[self willChangeValueForKey:@value];
{
 BOOL didSetOK = [self setStringValue:(NSString *)_value];
  // Do something with didSetOK
}
[self didChangeValueForKey:@value];
}

-(id) getValueForBindings
{
return( value );
}

Then binding my interface to the key 'valueForBindings'.  Not the
prettiest, but it's required for my situation.

Thanks again to everyone for all the help.


Why have you got calls to -willChangeValueForKey: and - 
didChangeValueForKey:? It should probably be done wherever value is  
changed, if it's not automatic. It's also not clear to me why you  
can't just name the methods setValue and value (and rename your other  
methods).


On a separate note, I would personally avoid using identifiers  
beginning with underscores. I'm pretty sure they are reserved but even  
if they're not, I would avoid it.


Kind regards,

Chris



smime.p7s
Description: S/MIME cryptographic 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 [EMAIL PROTECTED]

Re: NSPreferencePane with my own private framework?

2008-03-05 Thread Ryan
Thanks for the reply.  I tried changing the installation directory on  
my framework to use @loader_path and re-built it, but I'm still  
getting the same error message when trying to open the preference pane.


I imagine I have to change something in the build settings for the  
preference pane project itself (rather than just in the framework  
project), but I'm not sure what to change.  Any tips?  Perhaps I  
should forward this over to the Xcode users list.


Thanks.

-Ryan

On Mar 5, 2008, at 2:14 PM, Nick Zitzmann wrote:
That won't work because @executable_path points to the path of  
System Preferences, not your preference pane. Try using @loader_path  
instead, or make a static version of your framework if possible.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread I. Savant
If you have any performance data showing problems with internal db  
fragmentation (i.e. sqlite3 dbname 'vacuum' fixes it, but cp  
doesn't), we'd love to hear about it.


  Thanks, Ben, for this informative response. So what you're saying,  
in summary is:


1 - Vacuuming on every save is inefficient to the point of silliness.
2 - For anything but very large databases and/or running on slow  
hardware, the benefits of vacuuming is minimal anyway.


  To that, I pose another question: Why, then, does it make such a  
huge difference when I run the vacuum command against Mail's database?  
After just a month of usage, Mail seems sluggish when switching  
between various folders, but once I run the vacuum command, it is once  
again snappy?


  Incidentally, it was the Mail vacuum trick that prompted me to  
check into this to begin with. You may thank b.bum. :-)


--
I.S.



___

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 [EMAIL PROTECTED]


Re: large documents with doc based app

2008-03-05 Thread Nick Zitzmann


On Mar 5, 2008, at 4:19 PM, Torsten Curdt wrote:


But according to the docs NSData is limited to 2GB.
What I am wondering is... How can one handle files larger than 2GB?



In addition to what has been said, if you can afford to target only  
Leopard and only 64-bit Macs, then this limitation does not exist in  
64-bit architectures. However, it'll be really slow to load, unless  
your users have lots of RAM.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: large documents with doc based app

2008-03-05 Thread Kyle Sluder
On Wed, Mar 5, 2008 at 6:40 PM, Torsten Curdt [EMAIL PROTECTED] wrote:
  I though NSData would handle the access just transparently. Otherwise
  that would be good to keep in mind also for files slightly smaller
  than 2GB :)

While NSData certainly has the capability to do memory-mapped IO, it
would be rather useless if that was all it can do.

Look into +[NSData dataWithContentsOfMappedFile:].

--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 [EMAIL PROTECTED]


Re: NSPreferencePane with my own private framework?

2008-03-05 Thread Nick Zitzmann


On Mar 5, 2008, at 4:44 PM, Ryan wrote:

Thanks for the reply.  I tried changing the installation directory  
on my framework to use @loader_path and re-built it, but I'm still  
getting the same error message when trying to open the preference  
pane.



Are you sure it's being set, and the bundle is looking for it there?  
You can verify by using the otool program with the -L option.


If it's not being set, then have you tried changing it with the  
install_name_tool program? IIRC, Tiger's linker didn't support setting  
the installation directory to @loader_path for some reason, but  
install_name_tool worked.


BTW, IANTM (I Am Not The Moderator), but this is more of an xcode- 
users question than a cocoa-dev question...


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


RE: large documents with doc based app

2008-03-05 Thread Gary L. Wade
Try overriding readFromFile:ofType: and other similar messages for unique file 
needs.

Hey guys,

Using the document based skeleton there is the method

- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
or
- (BOOL)readFromData:(NSData *)data ofType:(NSString *)typeName error: 
(NSError **)outError;

that gets called when files get loaded. But according to the docs  
NSData is limited to 2GB.
What I am wondering is... How can one handle files larger than 2GB?

Pointers?

cheers
--
Torsten
___

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 [EMAIL PROTECTED]


Why [NSApplication _deallocHardCore:] crash in my Safari Plug In

2008-03-05 Thread Joe Jones
Hi all,

I have an NPAPI based plug in and I am trying to use a Cocoa window to create a 
full screen window that the plug in can use when it wants to take over the 
screen. All works as expected, The window displays and goes away as required 
and all is joy. Until you quit the application.

At that point we get a crash with the NSApplication. From reading around it 
looks like there is something on the apps autorelease pool that doesn't exist 
anymore. The problem is that nothing that I am creating is being autoreleased! 
At least not that I can tell by overriding autorelease and adding a breakpoint 
there to check.

I am going insane with this oh so simple seeming task. I've tried a Carbon 
window but for some reason I get no mouse move events (Instead we pool on an 
event loop timer and call GetMouse...) in the window and drawing is, well, not 
performant. The cocoa approach gives me all I need as far as perf and eventing 
goes but this crash is a real deal breaker.

Any ideas on how I can see what is getting on the autorelease pool? Or how to 
stop this from happening?

TIA,
Joe

___

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 [EMAIL PROTECTED]


Re: NSStream SSL Help

2008-03-05 Thread Jens Alfke


On 5 Mar '08, at 12:24 PM, Eric Scharff wrote:

 This doesn't make sense because TLS shouldn't require host name  
verification anyway, and I'm sure that the server's SSL certificate  
is valid.


The cert does look valid, and matches the domain name, so that doesn't  
seem to be the problem.


But host name verification is important — otherwise you don't know  
you've connected to the right site. Instead of paypal.com, a poisoned  
DNS server might have given you the IP address of shady-operator.com,  
which has a valid cert and is running a phishing scam. Without host  
verification there'd be no way for the user to tell they weren't at  
the real site.


   [fileInStream setProperty:  
NSStreamSocketSecurityLevelTLSv1 forKey:  
NSStreamSocketSecurityLevelKey];
//[fileInStream setProperty:  
NSStreamSocketSecurityLevelNegotiatedSSL forKey:  
NSStreamSocketSecurityLevelKey];


Are you sure that both of these properties need to be set? Have you  
tried one without the other?


—Jens

smime.p7s
Description: S/MIME cryptographic 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 [EMAIL PROTECTED]

Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Jens Alfke


On 5 Mar '08, at 3:49 PM, I. Savant wrote:

 To that, I pose another question: Why, then, does it make such a  
huge difference when I run the vacuum command against Mail's  
database? After just a month of usage, Mail seems sluggish when  
switching between various folders, but once I run the vacuum  
command, it is once again snappy?


Mail [which does not use CoreData, btw] might not have enabled  
auto_vacuum. IIRC, there were bugs in auto_vacuum in the version of  
sqlite that shipped in Tiger.


(On Leopard I don't think Mail has this issue anymore. Most likely  
they turned on auto_vacuum.)


—Jens

smime.p7s
Description: S/MIME cryptographic 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 [EMAIL PROTECTED]

Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread I. Savant
Mail [which does not use CoreData, btw] might not have enabled  
auto_vacuum. IIRC, there were bugs in auto_vacuum in the version of  
sqlite that shipped in Tiger.


  I thought I remembered reading that Mail does not use Core Data. It  
does, however, use SQLite and auto_vacuum is a problem because, as I  
previously posted, it does not defragment the database (and can  
actually cause fragmentation). Therefore, if the problem has been  
solved in Mail under Leopard, I don't believe it was done simply by  
enabling auto_vacuum.


--
I.S.


___

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 [EMAIL PROTECTED]


Deferring a selector until later, but before painting

2008-03-05 Thread John Stiles
There are many times in my code where I want to defer a selector's 
execution until the next time the event loop runs, which is a perfect 
match for -performSelector:withObject:afterDelay:, passing a delay of 
0.0. However, this executes after the app has repainted all the windows. 
Is there a way to get a selector called later, but before windows paint?


Right now in my app, there are some controls which appear and then their 
state changes a fraction of a second later, and I'd like to avoid the 
visually jarring pop effect of a control which changes itself right 
after first appearing, but I can't find an easy way to avoid deferring 
some operations.


___

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 [EMAIL PROTECTED]


Re: Localise between different versions of English

2008-03-05 Thread Jonathan Dann


On 5 Mar 2008, at 17:25, Christopher Nebel wrote:


On Mar 4, 2008, at 9:36 PM, Jens Alfke wrote:


On 4 Mar '08, at 3:23 PM, Sean McBride wrote:


There's also Canadian English (en_CA), and perhaps others too...


The ISO is in the process of adding en_LOL for Lolcat, aka Kitteh  
or Cat Pidgin[1]. (If you don't think there's a need for this,  
consider what HTTP Language: header value should be used by  
daringfurball.org or icanhascheezburger.com.)


I presume Jens was joking, but for a chuckle, go to Google web  
search, hit Preferences and check out the Interface Language  
preference.  There are lots of real ones (be careful experimenting,  
you may have trouble getting back to English!), but a few fakes as  
well.  LOLcat is, regrettably, not one of them, but they do have  
Klingon, Hacker (notice what Hacker is when written natively), and  
my personal favorite, Elmer Fudd.



--Chris N.



Even Leopard (and Tiger, not sure about further back) has Klingon  
(tlhlngan Hol)!  Don't know about the ISO code for it though.


Jon

___

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 [EMAIL PROTECTED]


Re: Why [NSApplication _deallocHardCore:] crash in my Safari Plug In

2008-03-05 Thread Peter Ammon


On Mar 5, 2008, at 4:52 PM, Joe Jones wrote:


Hi all,

I have an NPAPI based plug in and I am trying to use a Cocoa window  
to create a full screen window that the plug in can use when it  
wants to take over the screen. All works as expected, The window  
displays and goes away as required and all is joy. Until you quit  
the application.




Hi Joe,

Windows by default release themselves when closed, and when an app  
quits, every window receives a close message.  This will cause a  
crash at application quit if your retains and releases do not account  
for that.


Make sure that, if you do not want the window to be released on  
application quit, you call [window setReleasedWhenClosed:NO].


-Peter

___

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 [EMAIL PROTECTED]


Re: NSStream SSL Help

2008-03-05 Thread Eric Scharff
[fileInStream setProperty:  
 NSStreamSocketSecurityLevelTLSv1 forKey:  
 NSStreamSocketSecurityLevelKey];
 //[fileInStream setProperty:  
 NSStreamSocketSecurityLevelNegotiatedSSL forKey:  
 NSStreamSocketSecurityLevelKey];

Are you sure that both of these properties need to be set? Have you  
tried one without the other?

I tried setting each of these four individually and got the same results, -9843.

-Eric





  

Never miss a thing.  Make Yahoo your home page. 
http://www.yahoo.com/r/hs
___

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 [EMAIL PROTECTED]


Re: Core Data, SQLite, and Housekeeping

2008-03-05 Thread Ben Trumbull
If you have any performance data showing problems with internal db 
fragmentation (i.e. sqlite3 dbname 'vacuum' fixes it, but cp 
doesn't), we'd love to hear about it.


  Thanks, Ben, for this informative response. So what you're saying, 
in summary is:


1 - Vacuuming on every save is inefficient to the point of silliness.


Yup.  Kinda defeats the point of having incremental load/saves in a 
transactional persistent store.


2 - For anything but very large databases and/or running on slow 
hardware, the benefits of vacuuming is minimal anyway.


Your mileage may vary as to what exactly constitutes a large 
database, but for smaller databases and faster hardware there is a 
diminishing return.


Certainly, there are cases where vacuuming makes sense.  One might 
perform a manual vacuum after a initial import, especially for a 
large database (i.e. the cost for the vacuum is balanced by many 
future queries) or after a significant operation like upgrading to a 
new version.


  To that, I pose another question: Why, then, does it make such a 
huge difference when I run the vacuum command against Mail's 
database? After just a month of usage, Mail seems sluggish when 
switching between various folders, but once I run the vacuum 
command, it is once again snappy?


Well, many people run Mail constantly so the database is experiencing 
a significant amount of churn over a month, and the envelope index is 
often quite large.  A month of incessant use is a nice chunk of 
uptime.


You can see I/O performance using the fs_usage command.  If you're 
experiencing a large amount of fragmentation, the response times on 
the I/Os will increase as the drive has to seek more.


You can compare the performance gain from vacuuming the Mail index to 
simply using cp to create a new index file.  If the drive has a nice 
chunk of free space, OSX will try to keep the file's blocks close 
together when creating the copy.


The point at which a manual vacuum pays for the cost of rewriting the 
file depends on a lot of factors.

--

-Ben
___

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 [EMAIL PROTECTED]


Re: NSTextField keyboard event

2008-03-05 Thread Aki Inoue
Look at http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFormatter_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSFormatter/ 
isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription 
:


Aki

On 2008/03/05, at 17:34, peiyuan wrote:


Not exactly.

Can NSFormatter monitor user's key input?
I don't find any docs about monitoring user input in NSFormatter.
I supposed that what the NSFormatter does is after you finish  
editing, it would change the content.


This is not the way I want. I want a real time feedback, that is,  
even user press a number key, the textfield will not show the number  
at all (without leaving the focus of the textfield).


Pei-Yuan



I have a window which contains several NSTextField. In these  
NSTextField, I want that when a user presses a key which is not a   
number ( 0-9), the active NSTextField will not accept the key  
input  (that is, it does nothing).


 This looks like a job for NSFormatter ...

--
I.S.

___

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/aki%40apple.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Localise between different versions of English

2008-03-05 Thread Deborah Goldsmith
Even Leopard (and Tiger, not sure about further back) has Klingon  
(tlhlngan Hol)!  Don't know about the ISO code for it though.


tlh is the ISO code for Klingon (tlhIngan Hol). Note that fictional  
languages and scripts are considered perfectly acceptable for ISO and  
Unicode as long as there is a real user community (which there is for  
Klingon, oddly enough: http://www.amazon.com/Klingon-Hamlet-Lawrence-Schoen/dp/0671035789/) 
. For another example, see: http://std.dkuug.dk/JTC1/SC2/WG2/docs/n1641/n1641.htm


In order to give this post *some* redeeming value, I should point out  
that Mac OS X language tags are not (merely) ISO language codes. They  
are BCP 47 (RFC 4646) language tags. ISO doesn't deal with variants  
like en-GB or en-LOL -- those get registered with IANA.


I would think that Hacker would be en-l33t or something like that.  
One could argue whether it's just a dialect, or a different script as  
well.


OK, I think that's been enough of a waste of time for this topic...

Deborah Goldsmith
Apple Inc.
[EMAIL PROTECTED]

On Mar 5, 2008, at 5:35 PM, Jonathan Dann wrote:



On 5 Mar 2008, at 17:25, Christopher Nebel wrote:


On Mar 4, 2008, at 9:36 PM, Jens Alfke wrote:


On 4 Mar '08, at 3:23 PM, Sean McBride wrote:


There's also Canadian English (en_CA), and perhaps others too...


The ISO is in the process of adding en_LOL for Lolcat, aka  
Kitteh or Cat Pidgin[1]. (If you don't think there's a need for  
this, consider what HTTP Language: header value should be used  
by daringfurball.org or icanhascheezburger.com.)


I presume Jens was joking, but for a chuckle, go to Google web  
search, hit Preferences and check out the Interface Language  
preference.  There are lots of real ones (be careful experimenting,  
you may have trouble getting back to English!), but a few fakes as  
well.  LOLcat is, regrettably, not one of them, but they do have  
Klingon, Hacker (notice what Hacker is when written natively),  
and my personal favorite, Elmer Fudd.



--Chris N.



Even Leopard (and Tiger, not sure about further back) has Klingon  
(tlhlngan Hol)!  Don't know about the ISO code for it though.


Jon

___

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/goldsmit%40apple.com

This email sent to [EMAIL PROTECTED]


___

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 [EMAIL PROTECTED]


Re: Why [NSApplication _deallocHardCore:] crash in my Safari Plug In

2008-03-05 Thread Joe Jones
Yeah, did that. Even took the step of not calling close or ever manually 
releasing the window. It doesn't matter. At the time where my close occurs 
the retain count is 2 so how it is going away I don't know. I never get called 
on dealloc nor does the window get called on autorelease which I would assume 
would be happening if it was being put into an AR pool.


On 3/5/08 5:37 PM, Peter Ammon [EMAIL PROTECTED] wrote:



On Mar 5, 2008, at 4:52 PM, Joe Jones wrote:

 Hi all,

 I have an NPAPI based plug in and I am trying to use a Cocoa window
 to create a full screen window that the plug in can use when it
 wants to take over the screen. All works as expected, The window
 displays and goes away as required and all is joy. Until you quit
 the application.


Hi Joe,

Windows by default release themselves when closed, and when an app
quits, every window receives a close message.  This will cause a
crash at application quit if your retains and releases do not account
for that.

Make sure that, if you do not want the window to be released on
application quit, you call [window setReleasedWhenClosed:NO].

-Peter


___

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 [EMAIL PROTECTED]


Re: Undo and Core Data issue

2008-03-05 Thread Ben Trumbull

At 6:58 PM -0800 3/5/08, Michael Latta wrote:
The calls are on the Will/Did undo/redo notifications not the KVO 
callbacks on object changes.


Ah, okay.  There shouldn't be any need to call -processPendingChanges 
there, unless you're programmatically working with your own undo 
groups.


What I am seeing is that my code changes a managed object property, 
I undo, and no change occurs in the managed object.  The property 
affected is a binary attribute (a CATransform3D as bytes).


Does your code changing the property trigger a KVO event (i.e. are 
you missing a call to -willChangeValueForKey:) ?  Do you see 
notifications from the MOC when you initially make the change ?


Are you undoing programmatically or as a user ?

The undo behaves the same as before I added any notification 
processing however.


That suggests the problem lies elsewhere.
--

-Ben
___

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 [EMAIL PROTECTED]


Re: NSTextField keyboard event

2008-03-05 Thread peiyuan

Big thanks.

The answer is the  
isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription.


Thank you again.

Pei-Yuan
@KCodes



--
From: Aki Inoue [EMAIL PROTECTED]
Sent: Thursday, March 06, 2008 10:51 AM
To: peiyuan [EMAIL PROTECTED]
Cc: I. Savant [EMAIL PROTECTED]; Cocoa 
cocoa-dev@lists.apple.com

Subject: Re: NSTextField keyboard event

Look at 
http://developer.apple.com/documentation/Cocoa/Reference/Foundation/Classes/NSFormatter_Class/Reference/Reference.html#/ 
/apple_ref/occ/instm/NSFormatter/ 
isPartialStringValid:proposedSelectedRange:originalString:originalSelectedRange:errorDescription 
:


Aki

On 2008/03/05, at 17:34, peiyuan wrote:


Not exactly.

Can NSFormatter monitor user's key input?
I don't find any docs about monitoring user input in NSFormatter.
I supposed that what the NSFormatter does is after you finish  editing, 
it would change the content.


This is not the way I want. I want a real time feedback, that is,  even 
user press a number key, the textfield will not show the number  at all 
(without leaving the focus of the textfield).


Pei-Yuan



I have a window which contains several NSTextField. In these 
NSTextField, I want that when a user presses a key which is not a 
number ( 0-9), the active NSTextField will not accept the key  input 
(that is, it does nothing).


 This looks like a job for NSFormatter ...

--
I.S.

___

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/aki%40apple.com

This email sent to [EMAIL PROTECTED] 


___

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 [EMAIL PROTECTED]


Re: NSPreferencePane with my own private framework?

2008-03-05 Thread Adam Leonard
In your preference pane project, make sure @loader_path/../Frameworks  
is in the target's Framework Search Paths.


If that doesn't work, you might also try @bundle_path (set in both the  
preference pane and framework)


Adam Leonard

On Mar 5, 2008, at 3:44 PM, Ryan wrote:

Thanks for the reply.  I tried changing the installation directory  
on my framework to use @loader_path and re-built it, but I'm still  
getting the same error message when trying to open the preference  
pane.


I imagine I have to change something in the build settings for the  
preference pane project itself (rather than just in the framework  
project), but I'm not sure what to change.  Any tips?  Perhaps I  
should forward this over to the Xcode users list.


Thanks.

-Ryan

On Mar 5, 2008, at 2:14 PM, Nick Zitzmann wrote:
That won't work because @executable_path points to the path of  
System Preferences, not your preference pane. Try using  
@loader_path instead, or make a static version of your framework if  
possible.


Nick Zitzmann
http://www.chronosnet.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/adam%40caffeinatedcocoa.com

This email sent to [EMAIL PROTECTED]



___

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 [EMAIL PROTECTED]


Re: Send an event to another app

2008-03-05 Thread Nick Zitzmann


On Mar 5, 2008, at 9:20 PM, Alex Kac wrote:

I realize that under OS X things are different and they simply don't  
work that way. I also know that menus do have a handler and I  
*assume* that even if a menu is greyed out or a sheet is open (which  
I understand is modal) that the main window can still handle events  
or messages. So what I want to do under OS X is write my own app  
that periodically will force this app to save its document by  
calling the same handler as what the Save menu command would call.  
Again, I do realize that bad things may happen, but for this app  
we are using its worth trying for me.



Typically you'd do this by issuing an AppleScript command, which you  
can do with the NSAppleScript class. Something like tell application  
MyApp to save document in front of documents ought to work if the  
hypothetical MyApp is an NSDocument-based application.


Nick Zitzmann
http://www.chronosnet.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 [EMAIL PROTECTED]


Re: Send an event to another app

2008-03-05 Thread Alex Kac
I actually thought of that first - even though I'm a Win32 dev, I am a  
constant Mac user since 1994. But I'm not an AppleScript expert and I  
kept getting errors saying it didn't understand the message. I do know  
the app I'm working with is Cocoa based so I would assume its  
NSDocument based. Lots of assumptions.


On Mar 5, 2008, at 10:40 PM, Nick Zitzmann wrote:


On Mar 5, 2008, at 9:20 PM, Alex Kac wrote:

I realize that under OS X things are different and they simply  
don't work that way. I also know that menus do have a handler and I  
*assume* that even if a menu is greyed out or a sheet is open  
(which I understand is modal) that the main window can still handle  
events or messages. So what I want to do under OS X is write my own  
app that periodically will force this app to save its document by  
calling the same handler as what the Save menu command would call.  
Again, I do realize that bad things may happen, but for this app  
we are using its worth trying for me.



Typically you'd do this by issuing an AppleScript command, which you  
can do with the NSAppleScript class. Something like tell  
application MyApp to save document in front of documents ought to  
work if the hypothetical MyApp is an NSDocument-based application.


Nick Zitzmann
http://www.chronosnet.com/



Alex Kac - President and Founder
Web Information Solutions, Inc. -  Central Texas Microsoft Certified  
Partner


If at first you don't succeed, skydiving is not for you.
-- Francis Roberts




___

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 [EMAIL PROTECTED]


Re: Send an event to another app

2008-03-05 Thread Kyle Sluder
On Wed, Mar 5, 2008 at 11:47 PM, Alex Kac [EMAIL PROTECTED] wrote:
 I actually thought of that first - even though I'm a Win32 dev, I am a
  constant Mac user since 1994. But I'm not an AppleScript expert and I
  kept getting errors saying it didn't understand the message. I do know
  the app I'm working with is Cocoa based so I would assume its
  NSDocument based. Lots of assumptions.

Unless the app you're trying to control exposes itself through
AppleScript, Apple Events (which AppleScript is a pretty interface
for), or some other IPC mechanism, you can't cause things to happen in
it from another application.

--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 [EMAIL PROTECTED]


Re: Undo and Core Data issue

2008-03-05 Thread Michael Latta

Here are the accessor methods I use for the property:


- (NSData*)transform {
[self willAccessValueForKey:@transform];
NSData *result = [self primitiveValueForKey:@transform];
[self didAccessValueForKey:@transform];
return result;
}

- (void)setTransform:(NSData*)value_ {
[self willChangeValueForKey:@transform];
[self setPrimitiveValue:value_ forKey:@transform];
[self didChangeValueForKey:@transform];
}

These were generated by mogen.  I will try to see what is up with the  
managed object context notifications though.


The undo is by the user from the menu or keyboard.  I do create some  
undo groups to batch up related changes.  The undo group logic was  
lifted from an earlier application.  If I fail to close a group would  
that cause this?  Are there things to worry about when mixing calls to  
the undo manager and Core Data?


Michael



On Mar 5, 2008, at 7:53 PM, Ben Trumbull wrote:


At 6:58 PM -0800 3/5/08, Michael Latta wrote:
The calls are on the Will/Did undo/redo notifications not the KVO  
callbacks on object changes.


Ah, okay.  There shouldn't be any need to call - 
processPendingChanges there, unless you're programmatically working  
with your own undo groups.


What I am seeing is that my code changes a managed object property,  
I undo, and no change occurs in the managed object.  The property  
affected is a binary attribute (a CATransform3D as bytes).


Does your code changing the property trigger a KVO event (i.e. are  
you missing a call to -willChangeValueForKey:) ?  Do you see  
notifications from the MOC when you initially make the change ?


Are you undoing programmatically or as a user ?

The undo behaves the same as before I added any notification  
processing however.


That suggests the problem lies elsewhere.
--

-Ben


___

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 [EMAIL PROTECTED]


Re: Undo and Core Data issue

2008-03-05 Thread Michael Latta
I just ran a test where I commented out the calls that start/end  
grouping.  Now the undo menu item is not enabled.  This suggests that  
either the UI is not using the same undo manager as CoreData, or the  
changes are not being recorded.  Back to the documentation.


Michael


On Mar 5, 2008, at 7:53 PM, Ben Trumbull wrote:


At 6:58 PM -0800 3/5/08, Michael Latta wrote:
The calls are on the Will/Did undo/redo notifications not the KVO  
callbacks on object changes.


Ah, okay.  There shouldn't be any need to call - 
processPendingChanges there, unless you're programmatically working  
with your own undo groups.


What I am seeing is that my code changes a managed object property,  
I undo, and no change occurs in the managed object.  The property  
affected is a binary attribute (a CATransform3D as bytes).


Does your code changing the property trigger a KVO event (i.e. are  
you missing a call to -willChangeValueForKey:) ?  Do you see  
notifications from the MOC when you initially make the change ?


Are you undoing programmatically or as a user ?

The undo behaves the same as before I added any notification  
processing however.


That suggests the problem lies elsewhere.
--

-Ben


___

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 [EMAIL PROTECTED]


Re: Undo and Core Data issue

2008-03-05 Thread Michael Latta
It was separate undo managers.  I overrid the undoManager method of  
the view to use the one from the document and things are working now.   
Thanks for the help in what to check.


Michael


On Mar 5, 2008, at 7:53 PM, Ben Trumbull wrote:


At 6:58 PM -0800 3/5/08, Michael Latta wrote:
The calls are on the Will/Did undo/redo notifications not the KVO  
callbacks on object changes.


Ah, okay.  There shouldn't be any need to call - 
processPendingChanges there, unless you're programmatically working  
with your own undo groups.


What I am seeing is that my code changes a managed object property,  
I undo, and no change occurs in the managed object.  The property  
affected is a binary attribute (a CATransform3D as bytes).


Does your code changing the property trigger a KVO event (i.e. are  
you missing a call to -willChangeValueForKey:) ?  Do you see  
notifications from the MOC when you initially make the change ?


Are you undoing programmatically or as a user ?

The undo behaves the same as before I added any notification  
processing however.


That suggests the problem lies elsewhere.
--

-Ben


___

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 [EMAIL PROTECTED]


Need help with NSToolbarItem subclass and custom view

2008-03-05 Thread Matthew Delves

Greetings,
I've been reading through some of the apple documentation and have a  
basic understanding of what needs to be done when creating an  
NSToolbarItem subclass that contains a custom view.


What I'm not sure about is how to pass any mouse click events through  
to the custom view rather than have them handled by the NSToolbarItem.


Currently the custom view contains an NSSlider and an NSTextField.

Any help is greatly appreciated.

Thanks,
Matthew Delves
___

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 [EMAIL PROTECTED]


Re: Need help with NSToolbarItem subclass and custom view

2008-03-05 Thread Jens Alfke


On 4 Mar '08, at 12:47 AM, Matthew Delves wrote:

What I'm not sure about is how to pass any mouse click events  
through to the custom view rather than have them handled by the  
NSToolbarItem.

Currently the custom view contains an NSSlider and an NSTextField.


AppKit's regular event-dispatching system sends events to the views,  
just like any other views in the window.


—Jens

smime.p7s
Description: S/MIME cryptographic 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 [EMAIL PROTECTED]

Re: Deferring a selector until later, but before painting

2008-03-05 Thread Ken Ferry

On Mar 5, 2008, at 5:41 PM, j o a r [EMAIL PROTECTED] wrote:



On Mar 6, 2008, at 2:12 AM, John Stiles wrote:

Right now in my app, there are some controls which appear and then  
their state changes a fraction of a second later, and I'd like to  
avoid the visually jarring pop effect of a control which changes  
itself right after first appearing, but I can't find an easy way to  
avoid deferring some operations.



How about delaying adding the control until the value you want to  
display in the control is ready?


Or can you do your final setup in -viewWillDraw?

For some kinds of problems, you could synchronously mark whatever  
state you're interested as invalid, then resolve any invalidated state  
in -viewWillDraw.  This would be an appropriate way to do deferred  
layout, for example.


-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 [EMAIL PROTECTED]


CoreData fed ImageView blank on first run.

2008-03-05 Thread Ben Lachman
I have an NSImageView subclass that displays thumbnails of a CoreData  
attribute via its value binding.  The thumbnail (an NSImage) is  
stored as a transient attribute and updated lazily as needed.  This  
all works and looks great except for the first time the app is  
launched(and sets up a lot of state).  Throughout this run the  
ImageView is blank white.  Debugging leads me to believe that the  
bindings seem to be intact and that the data is correct coming out of  
coredata, however the ImageView never gets a drawRect: call even when  
it's direct superview does.  Anyone run into something like this or  
have any pointers?


Thanks,
-Ben
--
Ben Lachman
Acacia Tree Software

http://acaciatreesoftware.com

[EMAIL PROTECTED]
740.590.0009



___

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 [EMAIL PROTECTED]