RE: NSServices

2009-09-03 Thread Colin Deasy

Ive tried it with the required context as well, no luck. I even tried building 
it with 10.6 SDK.

> From: kyle.slu...@gmail.com
> To: colde...@hotmail.com
> Subject: Re: NSServices
> Date: Wed, 2 Sep 2009 20:41:33 -0700
> CC: cocoa-dev@lists.apple.com
> 
> Re-read the docs. Your plist needs to specify an array (possibly  
> empty) of valid contexts. Otherwise Snow Leopard assumes you haven't  
> updated your service for 10.6.
> 
> --Kyle Sluder

_
With Windows Live, you can organize, edit, and share your photos.
http://www.microsoft.com/ireland/windows/windowslive/products/photo-gallery-edit.aspx___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


mdimporter architecture problem on 10.6

2009-09-03 Thread Gideon King
Hi, I am trying to get our metadata importer to run under Snow  
Leopard, but no matter what I do, when I try to run it, I get a  
message saying that the architecture doesn't match the current 64 bit  
architecture, like this:


Gideons-Home-Mac-Pro:Frameworks gideon$ /usr/bin/mdimport -d2 /Users/ 
gideon/Downloads/Creed.nmind
2009-09-03 19:04:35.331 mdimport[91358:903] Imported '/Users/gideon/ 
Downloads/Creed.nmind' of type 'com.novamind.app.novamind' with  
plugIn /Users/gideon/Library/Spotlight/ 
NovaMindMetadataImporter.mdimporter.

2009-09-03 19:04:35.333 mdimport[91358:903] Attributes: (null)
Plugin '/Users/gideon/Library/Spotlight/ 
NovaMindMetadataImporter.mdimporter' does not match current 64 bit  
architecture to import type 'com.novamind.app.novamind'.
'/Users/gideon/Library/Spotlight/NovaMindMetadataImporter.mdimporter'  
should be updated.  'arch -i386 mdimport' may work as a work-around.


I have tried all sorts of combinations of build settings, including  
just building for 64 bit intel, 10.6 SDK, 10.6 deployment target just  
to make sure, and even with a single architecture 64 bit importer, it  
still gives me this message!


If I use the arch -i386 command it does work.

The only frameworks it links against are cocoa, corefoundation, and  
coreservices, and it's a pretty straightforward thing that just un- 
gzips and untars the file into a temp folder, and wanders through the  
XML in a file picking out the relevant info, returns it in the  
dictionary, and deletes the temp file.


My deployment needs to be 10.4+.

What build settings do I need to make this still work on those  
systems, and work on 64 bit 10.6?


Thanks

Gideon
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Fonts that are always there

2009-09-03 Thread Gabriel Zachmann
Does anyone know which fonts are always there on every Mac OS X 10.5  
system?

(besides the base 14 fonts from Adobe)

Or is there somewhere a list?

(Of course, I should always have a second alternative.)

Best regards,
Gabriel.



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 arch...@mail-archive.com

Re: Trouble with NSButtonCell

2009-09-03 Thread Reinhard Segeler
Don't know anything about the toolkit you're using, but I would use  
setAction: for single click and setDoubleAction: for double click,...

Hope this helps.

Reinhard

Am 03.09.2009 um 05:41 schrieb Dave DeLong:


Hi everyone,

I'm using Brandon's excellent BWToolkit in a project of mine right  
now.  I'm specifically using the BWTransparentTableView and  
BWTransparentCheckBoxCell classes.  I'd like to customize the  
CheckBoxCell to fulfill the following requirements:


1. Only invoke the target's action when the user single-clicks the  
actual checkbox.
2. Invoke the target's action when the user double-clicks anywhere  
in the cell.


I've tried subclassing BWTransparentCheckBoxCell and implementing  
stopTracking:at:inView:mouseIsUp: to invoke the target's action  
appropriately, but this method is never getting executed.  I've  
tried implementing the tableView's delegate method  
(tableView:shouldTrackCell:...), to no effect.  I've toyed with the  
possibility of implementing a custom  
trackMouse:inRect:ofView:untilMouseUp:, but that seems hopelessly  
complex.


Any ideas on why my tracking method isn't getting called, or a  
better approach I could be taking to this?


Thanks!

Dave DeLong
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin 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/macmeideln%40googlemail.com

This email sent to macmeid...@googlemail.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Core Data dog-slow when using first time after boot

2009-09-03 Thread Ruotger Skupin


Am 26.08.2009 um 01:21 schrieb Ben Trumbull:


When I use setRelationshipKeyPathsForPrefetching the fetch throws:

-[NSSQLAttribute inverseRelationship]: unrecognized selector sent  
to instance 0x10ee150


Can you provide the entire stack trace at this point ?  gdb use  
future-break objc_exception_throw





Thanks.  What is the actual set of keypaths you set in the fetch  
request ?  setRelationshipKeyPathsForPrefetching expects all the  
keypaths to terminate in a relationship object, not the attribute  
off that related object.

Yes, that was the problem.





|-|
| Transaction |
|-| ||
|net  | --> | Amount | <<-- (one other entity)
|gross| --> ||
|fee  | --> |value   | <<-
|account  | <<- |currency||
|...  |||||
|-||  |
   |  |
 --   |
| |
|||   |
|| Account|   |
|||   |
||balances| --
 --> |transactions|
 |... |
 ||

So basically I use Amount only as a container for a currency  
descriptor and a value. I would have to model 7 inverse  
relationships on that entity to make all relationships two-way.


Hmm.  I'd recommend consider whether or not it makes sense to de- 
normalize Amount into Transaction instead of making it a separate  
entity.  I assume the net/gross/fee are all going to be in the same  
currency, yes ?  Amount is very fine grained, and not (apparently)  
offering very much value for the abstraction cost.

Will do that. At least for the amounts in Transaction.



Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if  
you've run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original  
post, but since I use Smart Folders predicates can look a lot  
different (i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)





You'll want to prefetch additionalInfo and account.


Hm. Problem here is: As mentioned I use the predicate for a smart  
group. So the predicate can vary wildly and can reference basically  
any entity in the model. So what is the best strategy here?  
"Decompile" the predicate (which is built by an NSPredicateEditor) and  
prefetch the keypaths it takes? Prefetch "everything"?


Kind Regards
Ruotger

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread jon

Hi Joey,

On Sep 3, 2009, at 12:15 AM, Joey Hagedorn wrote:

Please do not discuss unreleased software on this list. You have  
access to the developer forums which are an appropriate place to  
discuss issues you may have. The issue you're discussing applies to  
iPhone OS 3.0 as well, so I'll continue to answer.


opps,  that should have said 3.0 only  (i did file a bug report,   
i should have also said i had filed a bug report  in the listing,   i  
only put it on the list, because i also mentioned a work around)



he springs and struts are disabled on views with simulated user  
interface attributes, so this is expected...In this case, it  
sounds like you expect the view provided in the UIViewController  
Subclass with XIB file template to have the autosizing parameters  
set differently.


if this were not a bug,   then why is the First XIB created (which is  
a UIView class also)  set differently than the Second XIB which is  
also the same Class??  ( I should have mentioned in the steps that  
this is not a UIViewController subclass,  that option should be left  
off to create a regular "UIView" Class...)and should provide  
exactly the same start point,  since they after all should be the  
same, yet they are not the same???
one has the struts/springs set differently than the other
worse,  disabled, so that no one can change them to be correct.


 on the first XIB,  the Simulated Status Bar is not disabled either  
in any case,  yet the size options (struts and springs) are set  
differently than the second XIB


(a second related thing is:)  setting the Simulated Status Bar to  
disabled,  does not actually disable the status bar,  (it does inside  
of IB,  but inside the iPhone simulator after it is compiled, it does  
not)  one has to also edit the XIB to actually turn off the Status  
bar??  (maybe  i am missing something there)


this can be verified by simply creating a new project of "View based"  
class,   then inside IB,   set status bar to "none" on the UIView  
XIB,   then compile and run in simulator,   the status bar is still  
there.  even if it is disabled on the main XIB too.  (unless i am  
confused about the option of disabling the status bar).



which brings up another question?  why does it matter that the status  
bar be there or not?   shouldn't you be able to adjust struts and  
springs no matter if it is there or not?   if one rotates the view,   
the status bar rotates in the iphone simulator,   shouldn't the view  
also rotate and adjust it's view appropriately?  right now that is not  
happening  shouldn't it for the second XIB view,  just like the  
first XIB view does correctly.  (even if the status bar is there, the  
first one is set correctly)


Thanks,
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 arch...@mail-archive.com


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread jon


On Sep 3, 2009, at 6:21 AM, jon wrote:

 I should have mentioned in the steps that this is not a  
UIViewController subclass,  that option should be left off to create  
a regular "UIView" Class...)


correction, that should have said:   "that this is not a  
UITableViewController subclass,  that option should be left off to  
create a regular "UIView" Class..."

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread Roland King


(a second related thing is:)  setting the Simulated Status Bar to  
disabled,  does not actually disable the status bar,  (it does  
inside of IB,  but inside the iPhone simulator after it is compiled,  
it does not)  one has to also edit the XIB to actually turn off the  
Status bar??  (maybe  i am missing something there)




No it's just there to let you design your screen for an iphone app  
where the status bar is turned off, it's a design tool. I'm sort of  
amazed that it's even possible to edit a XIB and remove the status  
bar, I didn't know the status bar was in there, either way that's not  
the way you do it. Type 'status bar hidden' into the documentation  
viewer and it should give you both a link to UIApplication's  
statusBarHidden: method and the PropertyListKeyReference which tells  
you to set a UIStatusBarHidden property in your plist file. If you  
edit the plist file it should even give you a list of possible keys in  
english, I think this one says "Status Bar is initially hidden' or  
something like that. Just set it and run your app. 
___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


hud panel possible bug?

2009-09-03 Thread Rick C.
hello again,

i have noticed in snow leopard only if you are using the standard hud panel in 
IB and you will run your project then taking the resize handle of the panel and 
drag it down and away quickly it will create vertical lines at the top part of 
the panel.  i have noticed this even in a new project that doesn't yet have 
code and just simulating in IB.  If you will resize your panel out slowly they 
don't appear but if you will drag your panel out quickly they will.  anyone 
experience this?

thanks,

rick


  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread jon


On Sep 3, 2009, at 6:37 AM, Roland King wrote:

 I didn't know the status bar was in there, either way that's not  
the way you do it


I realize after you just reminded me,  that i had said that wrong,   I  
did edit the plist file,  rather than the XIB file to disable the  
status bar.it would seem though, that setting the status bar to  
"none"  in IB should somehow make this change for you, so running it  
in the simulator,  you would get the expected behavior that is present  
in IB...   but I guess it just is not yet a perfect world.  I think  
version 7 of the SDK will become the perfect world :0)


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 arch...@mail-archive.com


[iphone] ebook

2009-09-03 Thread Dragos Ionel
Hi,
I am trying to build a book reader for iPhone.

If any of have any experience, can you please guide me?

For example

- should I use a UITextView or UIWebView?

- how can the page flip effect can be achieved?

No need to go to details, just direct me into the right direction.

Thanks a lot,
Dragos
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Fonts that are always there

2009-09-03 Thread I. Savant

On Sep 3, 2009, at 6:57 AM, Gabriel Zachmann wrote:

Does anyone know which fonts are always there on every Mac OS X 10.5  
system?

(besides the base 14 fonts from Adobe)

Or is there somewhere a list?



  Do you really want a list of fonts or do you mean to find a safe,  
system-provided font? If you're looking for a font that is always  
there (a system font), you should ask the system. There are these  
NSFont methods:


+systemFontOfSize:
+boldSystemFontOfSize:
+userFontOfSize:
+userFixedPitchFontOfSize:

  There's also +label... +controlContent... +menu... +menuBar...  
+message... +palette... +titleBar... +toolTips...


  These are guaranteed to yield "a font" in the desired category.  
This is the "safe fallback" if you prefer a named font but it's  
unavailable (you *are* checking availability and handling the  
negative, right?).


  IMO, if you're allowing the selection of fonts such that you need  
to be able to fall back to a system font, the default should be a  
system font anyway.



(Of course, I should always have a second alternative.)


  No, you should fall back on the system as mentioned above. Always.

--
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 arch...@mail-archive.com


Re: [iphone] ebook

2009-09-03 Thread I. Savant

On Sep 3, 2009, at 9:05 AM, Dragos Ionel wrote:


- should I use a UITextView or UIWebView?

  A text view adds a lot of editing perks but limited styling perks.  
A web view allows attaching stylesheets so that the actual content is  
pure HTML (an established markup language). Since you're looking for  
display and not editing, I'd suggest that the web view is the better  
choice.




- how can the page flip effect can be achieved?

  Animation? Read all the relevant iPhone documentation regarding  
animation and come back with more specific questions about this.




No need to go to details, just direct me into the right direction.


  http://developer.apple.com/iphone/

  http://mattgemmell.com/2008/12/08/what-have-you-tried

--
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 arch...@mail-archive.com


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread Roland King


On 03-Sep-2009, at 8:49 PM, jon wrote:



On Sep 3, 2009, at 6:37 AM, Roland King wrote:

I didn't know the status bar was in there, either way that's not  
the way you do it


I realize after you just reminded me,  that i had said that wrong,
I did edit the plist file,  rather than the XIB file to disable the  
status bar.it would seem though, that setting the status bar to  
"none"  in IB should somehow make this change for you, so running it  
in the simulator,  you would get the expected behavior that is  
present in IB...   but I guess it just is not yet a perfect world.   
I think version 7 of the SDK will become the perfect world :0)


Jon.


I don't think so. The status bar is an application-level attribute,  
not a window-level attribute. IB is just being kind to you, you could  
just have a line in the documentation which tells you if your  
application has a status bar then you must remember to make all your  
windows 20 pixels smaller in whatever direction you choose to be 'y'  
for your application but instead it puts a bar in there, and even lets  
you colour it so you can see how ugly your window looks, and believe  
me, mine are vile. In app you can have a mixture of portrait,  
landscape, with and without status bar views and windows, you can even  
make the views 1000 pixels in each direction .. none of this has any  
bearing on your app which is responsible for configuring itself  
appropriately for the view it's displaying, sizing it, rotating it  
and, if necessary, turning the status bar on and off.


IB is a design tool, much like DrawIt which I use for making the  
terrible graphics I use to go with my vile looking windows (my fault  
entirely, not DrawIt!s, I'm just artistically challenged). Just  
because I draw and import an image of a cow doesn't mean my  
application will automatically go moo.


Anyway I'm sorry I wandered off the original topic and I don't have an  
answer to that, but I've sure never needed to edit a XIB by hand. Be  
interested to hear what reply you get to your bug report. 
___


Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


PDFView caching issue?

2009-09-03 Thread DairyKnight
Hi,

I'm trying to do some customized drawing in a PDFView, so I overrided
'drawPage' as follows:

- (void)drawPage:(PDFPage *)page
{
int width = [page boundsForBox:kPDFDisplayBoxMediaBox].size.width;
int height = [page boundsForBox:kPDFDisplayBoxMediaBox].size.height;
int x = [page boundsForBox:kPDFDisplayBoxMediaBox].origin.x;
int y = [page boundsForBox:kPDFDisplayBoxMediaBox].origin.y;
NSRect bounds;
NSBezierPath *path;

[super drawPage:page];

bounds = NSMakeRect(x, y + height, x + 100, y + height - 100);
path = [NSBezierPath bezierPathWithRect: bounds];
[[NSColor colorWithDeviceRed: 1.0 green: 0.0 blue: 0.0 alpha: 0.1] set];
[path fill];
[[NSColor redColor] set];
[path stroke];
}

The problem here is that if the filled path is very big, say covers most of
the page, and the user scrolls the PDFView very fast,
the path is sometimes only partially drawn. My guess is due to the NSView
caching facility. Anyone sees a solution to this?

Thanks.

DairyKnight
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


How does launchAppWithBundleIdentifier work?

2009-09-03 Thread Gregory Weston
Specifically, I note that the documentation for the fourth parameter,  
the launch identifier, reads:


"On input, a pointer to a number object variable. On return, the  
variable contains a number object with a unique identifier for the  
launch attempt. You can use this value to distinguish individual  
launch requests."


How? Or when? What are the circumstances under which I can use that  
NSNumber?


Greg
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


bad behavior from unlockFocus on 10.6

2009-09-03 Thread Robert Clair


I have this piece of code in my drawing program:


 [image lockFocus];

  NSBitmapImageRep* bitmapRep =
  [[NSBitmapImageRep alloc] initWithFocusedViewRect:
  NSMakeRect( 0.0, 0.0, width, height) ];

  [image unlockFocus];

image is an NSImage with a single representation, either an  
NSBitmapImageRep containing a high resolution bitmap or an  
NSPDFImageRep. The pixels from the bitmapRep created here are  
thresholded and used to make a low resolution mask  that is held  
separately for use in picking.


This all worked fine until 10.6. The original NSImage object was left  
unmolested. But now when this code is executed, -unlockFocus  replaces  
the original representation held by the NSImage object with an  
NSCGImageSnapshotRep. There is no documentation that I can find on a  
NSCGImageSnapshotRep, but it's a bitmap.  (I assume it's a screen res  
bitmap object backed by a CGImage). This causes data loss with the  
program. If, for example, a user opens a file with a pdf object in it  
to continue working on it , and then saves the file, all the vector  
information is lost in any pdf objects is lost.


I understand that a pdf has to be rasterized for this to work. But  
since I didn't draw anything on the NSImage, I really expect this code  
to discard the temporary rasterized version when it is done and leave  
my original object unchanged.


The quick fix is easy, just save the original representation and then  
restore it. But, is this a bug or is there some point to this?


Bob Clair


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Image Thresholding

2009-09-03 Thread Steve Christensen

On Sep 2, 2009, at 10:29 PM, fawad shafi wrote:


I want to convert grayscale or RGB image to Binary Image.
Please provide sample code.


Requests to "please provide sample code" sounds like you want other  
people to do your work for you. There is plenty of information on how  
to do that if you just spend some time doing your own research.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


lazy bound problem

2009-09-03 Thread Donnie Lee
Hello!

I build a bundle's code which I build with "-undefined dynamic_lookup" option:
@interface test
@end
@implementation test (testCategory)

- (void)test
{
NSLog(@"Hello");
}

@end

...and I call this test method in bundle's code.

`nm -mg` for bundle executable for i386:
...
(undefined [lazy bound]) external .objc_class_name_test (dynamically looked up)
...
When I build for x86_64 I got:
(undefined) external _OBJC_CLASS_$_test (dynamically looked up)

The question: Why it is not lazy anymore? How can I build it with
'lazy bound' for x86_64, what options should I pass to linker? I use
default Xcode 10.6 configuration. Thanks id advance.

Regards,
Donnie
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Context menus into services

2009-09-03 Thread Gregory Weston
I know and agree with the rationale, but it's really looking like a  
premature move. I've got a context menu item that operates on general  
file system objects, but not on volumes and not on a couple of  
specific "special" folder types. In the process of converting to a  
service for 10.6, I'd come to terms with the fact that there was no  
way to suppress the appearance of the command for those special  
folders. But I've got one question:


What genius decided that public.volume should be a child of  
public.folder in the UTI tree, instead of a sibling (and a child of  
directory) like package and bundle are?



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: hud panel possible bug?

2009-09-03 Thread Corbin Dunn

Hi Rick,

On Sep 3, 2009, at 5:49 AM, Rick C. wrote:


hello again,

i have noticed in snow leopard only if you are using the standard  
hud panel in IB and you will run your project then taking the resize  
handle of the panel and drag it down and away quickly it will create  
vertical lines at the top part of the panel.  i have noticed this  
even in a new project that doesn't yet have code and just simulating  
in IB.  If you will resize your panel out slowly they don't appear  
but if you will drag your panel out quickly they will.  anyone  
experience this?


Please log a bug on this issue:

http://developer.apple.com/bugReporter/

corbin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Overriding NSTextTable behaviour in NSTextView

2009-09-03 Thread Keith Blount
Hello,

I would like to make a minor adjustment to the way tables work in an 
NSTextView, but as the tables panel is a bit of a black box and as the table 
classes - NSTextTable and NSTextTableBlock - aren't the easiest thing to use 
(they are straightforward if you just want to create a table programmatically, 
but messing around with them live gets tricky), I am having difficulties 
finding a way of doing what I want.

What I would like to do is this: if the user is in the last column in the last 
row of a table and hits the tab key, another row should be created below and 
the cursor placed in the first cell. This would be the equivalent of the user 
clicking in the table panel to create an extra row and then hitting tab, so in 
theory, this is what I would like to achieve programmatically to override the 
current behaviour:

1) Override NSTextView's -insertTab: to containing the following.
2) Inside -insertTab:, detect if the typing attributes' paragraph style has a 
text table block associated with it.
3) If so, detect if it is the last cell in the last row (I'd probably have to 
account for R-to-L text here).
4) If so, somehow simulate the user clicking on the "add new row" button in the 
tables panel.
5) Continue with super's -insertTab: so that the cursor moves to the first cell 
in the new row.

Needless to say, steps 3 and 4 are the difficult parts here, as all the actions 
for things such as "add extra table row" seem to be private, and there doesn't 
seem to be an obvious way of detecting whether a given cell is in the last 
column or row.

Has anyone had any experience with overriding NSTextView's standard 
table-creation behaviour, or has anyone got any ideas about how I might achieve 
the above?

Many thanks and all the best,
Keith


  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Roland King
Is that *all* the code? Your output has two 'ar 1' lines but you only  
NSLog() with that pattern once. The output doesn't match the code.


On 03-Sep-2009, at 10:21 PM, Horst Jäger wrote:



Hi,

yesterday I stumbled upon something strange concerning the  
autorelease pool.


Please consinder the following lines of code:


NSLog(@"devel");  

	NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc]  
init];


NSDictionary *di = [[NSDictionary alloc] init];
NSArray  *ar = [di allKeys];

// if ar were a member of di, it would be deallocated here
[di release];

	// if ar were a constructed and autoreleased, it would be  
deallocated here

[autoreleasePool release];

// but it is not; it is still present
NSLog(@"ar %i ", [ar retainCount]);   

// adding the following line leads to a crash
//[ar release];

NSLog(@"/devel"); 


They yield: 

[Session started at 2009-09-03 13:32:56 +0200.]
2009-09-03 13:32:58.837 KalaHoTi[3180:207] devel
2009-09-03 13:32:58.841 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] /devel


I dont't unserstand, how ar mgiht be released:

1. If [ar autorelease] were called upon it in nthe process of  
creation (and so the name "allKeys"
suggests), it were released as soon as the embracing autoreleasepool  
is. But it is apparently not.


2. If ar were a member of di, it would be deallocated when di is  
releaed. Apparenly, that isn't the

case either.

3. But if you try to release ar yourself, the program crashes.


Any explanation?

Thanks in advance

Horst


___

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/rols%40rols.org

This email sent to r...@rols.org


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Horst Jäger


Hi,

yesterday I stumbled upon something strange concerning the autorelease  
pool.


Please consinder the following lines of code:


NSLog(@"devel");  

NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc] init];

NSDictionary *di = [[NSDictionary alloc] init];
NSArray  *ar = [di allKeys];

// if ar were a member of di, it would be deallocated here
[di release];

	// if ar were a constructed and autoreleased, it would be deallocated  
here

[autoreleasePool release];

// but it is not; it is still present
NSLog(@"ar %i ", [ar retainCount]);   

// adding the following line leads to a crash
//[ar release];

NSLog(@"/devel"); 


They yield: 

[Session started at 2009-09-03 13:32:56 +0200.]
2009-09-03 13:32:58.837 KalaHoTi[3180:207] devel
2009-09-03 13:32:58.841 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] /devel


I dont't unserstand, how ar mgiht be released:

1. If [ar autorelease] were called upon it in nthe process of creation  
(and so the name "allKeys"
suggests), it were released as soon as the embracing autoreleasepool  
is. But it is apparently not.


2. If ar were a member of di, it would be deallocated when di is  
releaed. Apparenly, that isn't the

case either.

3. But if you try to release ar yourself, the program crashes.


Any explanation?

Thanks in advance

Horst


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Graham Cox


On 04/09/2009, at 12:21 AM, Horst Jäger wrote:


Any explanation?



Relying on retain counts to tell you an object's state is not a good  
idea. What I'm guessing is that the code internally looks something  
along the lines of:


- (void) release
{
   if( retainCount == 1 )
[self dealloc];
   else
   --retainCount;
}


- (void) dealloc
{
mem_manager_put_on_free_list( self );
}

Nowhere is the retain count actually decremented to zero as it's just  
a wasted operation. You hold a stale pointer to a freed object, so it  
logs the stale retain count, which is 1. But sending it an actual  
release is an error, as it's already been freed. No doubt this is one  
of the many reasons why peeking at retain counts is widely discouraged.


--Graham


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Trouble with NSButtonCell

2009-09-03 Thread Dave DeLong
Unfortunately, "setDoubleAction:" is not a method on NSCell or any of  
its subclasses (except NSPathCell).


Really all the BWToolkit is doing is skinning.  As far as I can tell  
from browsing through the code, it's not actually changing  
functionality of the controls.


Dave

On Sep 3, 2009, at 5:33 AM, Reinhard Segeler wrote:

Don't know anything about the toolkit you're using, but I would use  
setAction: for single click and setDoubleAction: for double click,...

Hope this helps.

Reinhard

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Scott Andrew
"ar" is not a member of "d"i. allKeys creates an autoreleased NSArray  
with the keys values retained in indexes. "ar" is placed in the auto  
release pool when it is created in the allKeys call.


When you call [autorelease release] the items are freed when you since  
the pool is released and freed. By the time you call [ar release] the  
items no longer exist. As Cocoa documentation states all items  
returned from a message are autoreleased unless otherwise stated in  
the documentation for the API call.


Scott

On Sep 3, 2009, at 7:21 AM, Horst Jäger wrote:



Hi,

yesterday I stumbled upon something strange concerning the  
autorelease pool.


Please consinder the following lines of code:


NSLog(@"devel");  

	NSAutoreleasePool *autoreleasePool = [[NSAutoreleasePool alloc]  
init];


NSDictionary *di = [[NSDictionary alloc] init];
NSArray  *ar = [di allKeys];

// if ar were a member of di, it would be deallocated here
[di release];

	// if ar were a constructed and autoreleased, it would be  
deallocated here

[autoreleasePool release];

// but it is not; it is still present
NSLog(@"ar %i ", [ar retainCount]);   

// adding the following line leads to a crash
//[ar release];

NSLog(@"/devel"); 


They yield: 

[Session started at 2009-09-03 13:32:56 +0200.]
2009-09-03 13:32:58.837 KalaHoTi[3180:207] devel
2009-09-03 13:32:58.841 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] ar 1
2009-09-03 13:32:58.842 KalaHoTi[3180:207] /devel


I dont't unserstand, how ar mgiht be released:

1. If [ar autorelease] were called upon it in nthe process of  
creation (and so the name "allKeys"
suggests), it were released as soon as the embracing autoreleasepool  
is. But it is apparently not.


2. If ar were a member of di, it would be deallocated when di is  
releaed. Apparenly, that isn't the

case either.

3. But if you try to release ar yourself, the program crashes.


Any explanation?

Thanks in advance

Horst


___

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/scottandrew%40roadrunner.com

This email sent to scottand...@roadrunner.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Trouble with NSButtonCell

2009-09-03 Thread Scott Andrew
I think you need to create a subclass of NSButton that uses your cell.  
Then use setAction and setDoubleAction.


Scott

On Sep 3, 2009, at 7:41 AM, Dave DeLong wrote:

Unfortunately, "setDoubleAction:" is not a method on NSCell or any  
of its subclasses (except NSPathCell).


Really all the BWToolkit is doing is skinning.  As far as I can tell  
from browsing through the code, it's not actually changing  
functionality of the controls.


Dave

On Sep 3, 2009, at 5:33 AM, Reinhard Segeler wrote:

Don't know anything about the toolkit you're using, but I would use  
setAction: for single click and setDoubleAction: for double click,...

Hope this helps.

Reinhard

___

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/scottandrew%40roadrunner.com

This email sent to scottand...@roadrunner.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Greg Guerin

Horst Jäger wrote:


NSDictionary *di = [[NSDictionary alloc] init];
NSArray *ar = [di allKeys];



di is an empty NSDictionary.  Therefore, ar will always be an empty  
immutable NSArray.  Consequently, it's possible to return a singleton  
empty NSArray that's never released.  I'm not saying this *is*  
happening, just that it *could* happen under the memory mgmt rules.


The code is fatally flawed because it doesn't follow the memory mgmt  
rules.  All observed effects (like NSLog'ing the retainCount) rely on  
unspecified side-effects.  You shouldn't be surprised when  
unspecified side-effects occur, nor should you count on them always  
occurring in the same way.


  -- GG

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


What about revamping OpenUp.app for Snow Leopard?

2009-09-03 Thread Giulio Cesare Solaroli
Hello,

I may sound a little bit old fashioned, but I still much prefer Scott
Anguish's (of Stepwise.com fame) OpenUp.app application
(http://www.stepwise.com/Software/OpenUp/) instead of the MacOS X
built in Archive Utility (the default application used to open zip,
tar, etc...).

OpenUp.app has been languishing in the last few years, and it embeds
PowerPC only versions of the core tools used to do the actual
processing; this resulted in much slower performances on Leopard.

Snow Leopard still has Rosetta, but only as a extra package available
as a custom install option.

Is there anyone interested in helping fixing the XCode project file
and rebuild the whole application for Snow Leopard? :D

Scott was so nice to leave the source code here:
http://homepage.mac.com/sanguish/OpenUp/

Cheers,

Giulio Cesare
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen

Hello,

I have a base object that needs to know when any of it's properties or  
subclasses properties have changed and set a dirty flag on itself. Is  
there a way to do this?


thx

AC
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Trouble with NSButtonCell

2009-09-03 Thread Corbin Dunn


On Sep 3, 2009, at 7:58 AM, Scott Andrew wrote:

I think you need to create a subclass of NSButton that uses your  
cell. Then use setAction and setDoubleAction.


Creating a subclass of NSButton isn't necessary; the custom cell can  
be set in IB (Leopard+).


Dave needs to subclass NSButtonCell and provide a custom  
trackMouse:inRect:ofView:untilMouseUp:, since the superclass will  
always call the -action, even for a doubleclick, and there is no way  
to prevent that.


An optional "easy hack", might be to look at [NSApp currentEvent]'s  
clickCount (first making sure it is a mouse event). You could do this  
in the action itself. If it is a double click, then do something  
different. If it is a single click, make sure it is where you want it  
to be (hit test the event location) before doing the work you want.


A subclass is more reusable and the best approach, but probably more  
work.


corbin



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: bad behavior from unlockFocus on 10.6

2009-09-03 Thread Kyle Sluder
Check the AppKit release notes. Sounds like one if the common mistake  
cases covered there.


--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Handling NSApplicationDefined events

2009-09-03 Thread McLaughlin, Michael P.
The relevant docs make it clear how to send an NSApplicationDefined NSEvent,
e.g., to NSApp, but I cannot find anything, esp. no examples, about how to
handle events of this type.

I was assuming that it could be done in AppDelegate.  Perhaps not -- but I'd
really like to see a description and one example if there is one somewhere.

Must I revert to Carbon events for this?

Thanks for any tips.

-- 
Mike McLaughlin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Fonts that are always there

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 3:57 AM, Gabriel Zachmann wrote:

Does anyone know which fonts are always there on every Mac OS X 10.5  
system?

(besides the base 14 fonts from Adobe)


Apple has some Knowledge-Base articles listing the installed fonts,  
but I don't have a link handy.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


change in launch services binding behavior?

2009-09-03 Thread Matt Neuburg
I wonder whether someone (preferably from Apple) could provide details on
how Snow Leopard has changed its algorithm for how a document is bound to an
application, esp. when double-clicking the doc in the Finder.

In the past, where many apps could claim a file type / extension, such as
plain text / .txt, an app could say, "Yes, but this particular file is still
mine" by attaching its creator code to the file. BBEdit does this, for
example, when you use it to create a new .txt file. So that file, although
it is .txt, has BBEdit's icon and opens with BBEdit when double-clicked.

In Snow Leopard that is no longer true. The user can of course specify (with
Get Info in the Finder) that this file opens with BBEdit, but the app itself
appears to be powerless to do the same thing.

The last word on the subject is in a fairly old document on Launch Services:

> Preferred Application for a Document

> For individual document files (whether specified by a file-system reference or
> a URL with scheme file), the criteria are as follows:
> 
> If the user has specified an explicit binding for the document (or for the
> entire document type to which it belongs), the preferred application is the
> one the user has specified.

> If the document has a filename extension (or if one has been specified as a
> parameter to LSGetApplicationForInfo), find all applications in the Launch
> Services database that claim to accept documents with that extension.

> If the document carries a four-character file type (or if one has been
> specified as a parameter), find all applications that claim to accept files of
> that type.

> If more than one application has been found as a result of steps 2­3, apply
> the following criteria in the order shown:

> If the document carries a four-character creator signature (or if one has been
> specified as a parameter), give preference to any application that claims to
> accept documents with that signature (typically the application to which the
> signature belongs).

[etc.]

That sounds like it means: If there's an extension it has priority, but if
there's a conflict for that extension (more than one app has been found that
claims .txt) then give priority to the app whose creator code is the doc's
creator code. And indeed, that is how LS behaved in Leopard.

But in Snow Leopard, it doesn't. Yet the documentation has not been changed;
indeed, there are no Snow Leopard release notes for Launch Services. So
what's going on exactly?

m.

-- 
matt neuburg, phd = m...@tidbits.com, 
A fool + a tool + an autorelease pool = cool!
AppleScript: the Definitive Guide - Second Edition!
http://www.tidbits.com/matt/default.html#applescriptthings



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: bad behavior from unlockFocus on 10.6

2009-09-03 Thread Ken Ferry
Hi Bob,
> This all worked fine until 10.6. The original NSImage object was left
unmolested.

Nope. :-)  Clearly you're seeing behavior change somewhere, but this
attribution is not correct.

-[NSImage lockFocus] is a commonly misunderstood method.  It is and always
has been lossy.

Lock/unlock focus prior to 10.6 does this:

(1) Gets an offscreen window.
(2) Draws the image in the window.
(3) Sets up the current NSGraphicsContext such that further drawing is
directed to that window, restoring the original state in unlockFocus.
(4) *Replaces* the original representations of the image with the drawing
from the window.

In 10.6, it's similar, but there's no actual window.  It's just a buffer of
memory.

For more on the 10.6 changes to NSImage and company, see <
http://developer.apple.com/mac/library/releasenotes/Cocoa/AppKit.html>.

-Ken

On Thu, Sep 3, 2009 at 6:50 AM, Robert Clair  wrote:

>
> I have this piece of code in my drawing program:
>
>
>  [image lockFocus];
>
>  NSBitmapImageRep* bitmapRep =
>  [[NSBitmapImageRep alloc] initWithFocusedViewRect:
>  NSMakeRect( 0.0, 0.0, width, height) ];
>
>  [image unlockFocus];
>
> image is an NSImage with a single representation, either an
> NSBitmapImageRep containing a high resolution bitmap or an NSPDFImageRep.
> The pixels from the bitmapRep created here are thresholded and used to make
> a low resolution mask  that is held separately for use in picking.
>
> This all worked fine until 10.6. The original NSImage object was left
> unmolested. But now when this code is executed, -unlockFocus  replaces the
> original representation held by the NSImage object with an
> NSCGImageSnapshotRep. There is no documentation that I can find on a
> NSCGImageSnapshotRep, but it's a bitmap.  (I assume it's a screen res bitmap
> object backed by a CGImage). This causes data loss with the program. If, for
> example, a user opens a file with a pdf object in it to continue working on
> it , and then saves the file, all the vector information is lost in any pdf
> objects is lost.
>
> I understand that a pdf has to be rasterized for this to work. But since I
> didn't draw anything on the NSImage, I really expect this code to discard
> the temporary rasterized version when it is done and leave my original
> object unchanged.
>
> The quick fix is easy, just save the original representation and then
> restore it. But, is this a bug or is there some point to this?
>
> Bob Clair
>
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: iPhone-detecting call event...

2009-09-03 Thread David Duncan

On Sep 2, 2009, at 10:20 AM, Farooq zaman wrote:

Is it possible to detect phone-call event on iPhone? If yes, what  
are the available APIs?



No, it is not. The only interaction possible with the Phone is to  
request it to dial a number via a URL.

--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread David Duncan
This is essentially correct. Why bother to decrement the retain count  
when the object is going away after all...


On Sep 3, 2009, at 7:29 AM, Graham Cox wrote:

Relying on retain counts to tell you an object's state is not a good  
idea. What I'm guessing is that the code internally looks something  
along the lines of:


- (void) release
{
  if( retainCount == 1 )
[self dealloc];
  else
  --retainCount;
}


--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 8:24 AM, Alexander Cohen wrote:

I have a base object that needs to know when any of it's properties  
or subclasses properties have changed and set a dirty flag on  
itself. Is there a way to do this?


No, not in general. Key-value observing requires knowing the exact  
property name(s) in advance. You'll need to set the 'dirty' flag  
manually.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Fonts that are always there

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 6:07 AM, I. Savant wrote:


(Of course, I should always have a second alternative.)


 No, you should fall back on the system as mentioned above. Always.


Why? It's perfectly reasonable to look for, say, Tahoma but fall back  
to Helvetica, then use the system font as a last resort. Web pages use  
these sorts of chains all the time, it's a core part of CSS.


(There are a lot of fonts that many, but not all, Macs have: for  
example, the ones installed along with iWork or MS Office.)


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Fonts that are always there

2009-09-03 Thread I. Savant

On Sep 3, 2009, at 12:26 PM, Jens Alfke wrote:


No, you should fall back on the system as mentioned above. Always.


Why? It's perfectly reasonable to look for, say, Tahoma but fall  
back to Helvetica, then use the system font as a last resor


  The term "fall back on" means exactly what you described. :-)

  To be clear, I'm saying one should look for the desired font(s),  
but if they're not found, ask the system for the appropriate font for  
the situation via one of the methods I listed.


--
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 arch...@mail-archive.com


Re: Handling NSApplicationDefined events

2009-09-03 Thread Quincey Morris

On Sep 3, 2009, at 08:58, McLaughlin, Michael P. wrote:

The relevant docs make it clear how to send an NSApplicationDefined  
NSEvent,
e.g., to NSApp, but I cannot find anything, esp. no examples, about  
how to

handle events of this type.

I was assuming that it could be done in AppDelegate.  Perhaps not --  
but I'd
really like to see a description and one example if there is one  
somewhere.


It's straightforward. Subclass NSApplication and override sendEvent:  
to test for NSApplicationDefined.


Don't forget to specify your subclass as the "Principal Class" in your  
target's properties.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Distinguishing between return and enter in NSTextField

2009-09-03 Thread Rick Mann
Hi. I'd like to insert a new line when the user presses return in an  
NSTextField, but take completely custom action when they press Enter.  
Is the only way to do this to subclass NSTextField and override the  
NSResponder keyDown: method?


TIA,
Rick

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread Scott Lahteine

On Sep 2, 2009, at 9:02 PM, Scott Lahteine wrote:

My preference pane uses Gestalt(gestaltUserVisibleMachineName,
&mySInt32), coercing the SInt32 into a StringPtr to get the Machine
Name. On 64-bit I get a warning because StringPtr is a 64-bit
pointer on that architecture. Does Gestalt() ensure that the
returned pointer is in the low 4 gigs of RAM, or is there a more
appropriate way to get the Machine Name that is 64-bit compatible?


On Sep 2, 2009, at 11:13 PM Jim Correia wrote:
extern CFStringRef CSCopyMachineName(void)
AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
- Jim

On Sep 2, 2009, at 11:43 PM, Kyle Sluder wrote:
NSHost now does this.
--Kyle Sluder



Your answers were too quick, Jim and Kyle!

CSCopyMachineName() returns the name of the computer as set by the  
user in the Sharing preference pane, which is not the same thing as  
the gestaltUserVisibleMachineName. The "Machine Name" I want is the  
Apple-defined identifier for the type of computer, which (as of this  
date) begins with one of the following strings:


"AAPL 
","iMac 
","PowerBook 
","PowerMac","RackMac","Macmini","MacPro","MacBookPro","MacBook"


For example, my computer is identified by Gestalt() as a "MacBook2,1"

At this point, as far as I can tell Gestalt() is still a viable  
solution, and the returned pointer is just guaranteed to be in the low  
4GB of RAM. I mean, Apple wouldn't break Gestalt!


On the other hand, I see that same string through ioreg on the command  
line, so perhaps there's a way to get it from the IO Registry??


- Scott Lahteine
  Thinkyhead Software
  http://thinkyhead.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


NSImage with multiple representation sizes

2009-09-03 Thread Benjamin Rister
(Apologies if this ends up a duplicate…I sent the original over a week  
ago, and as far as I can see it's not in either Apple's or  
Cocoabuilder's archives, so I don't see any other explanation besides  
it just being eaten by something.)


The core question:
Is it still the best practice to have conceptually same images of  
different sizes in different files, e.g. Foo9x9.tiff, Foo32x32.tiff?   
icns isn't an option because they aren't all the standard icns sizes,  
and several places in the docs seem to discourage lumping them  
together (e.g. with tiffutil) anyway.



The details:

We have several images that are displayed at different sizes at  
various places in an application.  Our artist has generated several  
bitmaps for these different scales.  Modeling on the concept of  
an .icns file, my inclination would be to try and lump them all  
together in one multi-representation file and let NSImage figure out  
what the best representation is to draw from at any given point.  This  
not only is convenient for the various usages around the app, but also  
for resolution independence (...maybe...see below).


However, man tiffutil says:
-cat allows combining multiple TIFF files into one. ... If the real  
sizes (pixel size
 divided by dpi) of the images being combined are not the same,  
a warning
 will be generated. This makes sure that NSImage can  
successfully choose

 the right size image out of the generated TIFF file.


And Cocoa Drawing Guide: Images, "How an Image Representation Is  
Chosen" gives rules about color space, dpi, and bit depth, but there's  
no rule about choosing representations based on size.  (But there's  
icns, right?  How is that supposed to work, then?)


I'm also concerned for resolution independence that the system might  
not choose the 32x32px rep to fill a 16x16pt space at a 2x scale  
factor, because everything I've seen in the resolution independence  
docs only talks about representations with different dpi.  It would be  
rather inelegant to have to have multiple representations with the  
same pixels and just different metadata.


So between the resolution independence concern, and the docs seemingly  
discouraging having different sized images in one file, this raises  
the core question above.  What's the best way to arrange this for both  
drawing the image at different sizes in different places and  
resolution independence?


Best,
Benjamin Rister___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Distinguishing between return and enter in NSTextField

2009-09-03 Thread Rick Mann
I would like to use the delegate, but it sends me insertNewLine: for  
both keys.


Is there another method I can implement?

On Sep 3, 2009, at 11:14:20, Douglas Davidson wrote:

Short answer:  no. Stay away from keyDown: and look at delegate  
methods instead. I have a standard rant on this topic; I don't have  
it handy but it should be in the list archives.


Douglas Davidson



On Sep 3, 2009, at 10:54 AM, Rick Mann  wrote:

Hi. I'd like to insert a new line when the user presses return in  
an NSTextField, but take completely custom action when they press  
Enter. Is the only way to do this to subclass NSTextField and  
override the NSResponder keyDown: method?


TIA,
Rick




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread mmalc Crawford


On Sep 3, 2009, at 7:56 AM, Scott Andrew wrote:

As Cocoa documentation states all items returned from a message are  
autoreleased unless otherwise stated in the documentation for the  
API call.



The documentation emphatically does not state that.

The basic rules are given here:
	


The rest of the document gives further details.

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 arch...@mail-archive.com


Re: Distinguishing between return and enter in NSTextField

2009-09-03 Thread Douglas Davidson
Short answer:  no. Stay away from keyDown: and look at delegate  
methods instead. I have a standard rant on this topic; I don't have it  
handy but it should be in the list archives.


Douglas Davidson



On Sep 3, 2009, at 10:54 AM, Rick Mann  wrote:

Hi. I'd like to insert a new line when the user presses return in an  
NSTextField, but take completely custom action when they press  
Enter. Is the only way to do this to subclass NSTextField and  
override the NSResponder keyDown: method?


TIA,
Rick


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread David Duncan

On Sep 3, 2009, at 10:56 AM, Scott Lahteine wrote:

CSCopyMachineName() returns the name of the computer as set by the  
user in the Sharing preference pane, which is not the same thing as  
the gestaltUserVisibleMachineName. The "Machine Name" I want is the  
Apple-defined identifier for the type of computer, which (as of this  
date) begins with one of the following strings:


"AAPL 
","iMac 
","PowerBook 
","PowerMac","RackMac","Macmini","MacPro","MacBookPro","MacBook"


For example, my computer is identified by Gestalt() as a "MacBook2,1"

On the other hand, I see that same string through ioreg on the  
command line, so perhaps there's a way to get it from the IO Registry?



First the question is "Why do you need to know?" If your basing  
feature decisions on this info, then you should probably go another  
route.


But if you must know this for other reasons, the way to get it  
programmatically is via sysctlbyname using "hw.model".

--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Ok, thats what i thought. But just for implementation ideas, how does  
CoreData know when one of it's @dynamic properties is changed? It must  
set some sort of flag somewhere in order to know what to write out  
when it needs to save. How does it handle that?


thx

AC

On Sep 3, 2009, at 12:27 PM, Jens Alfke wrote:



On Sep 3, 2009, at 8:24 AM, Alexander Cohen wrote:

I have a base object that needs to know when any of it's properties  
or subclasses properties have changed and set a dirty flag on  
itself. Is there a way to do this?


No, not in general. Key-value observing requires knowing the exact  
property name(s) in advance. You'll need to set the 'dirty' flag  
manually.


—Jens


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Scott Andrew
I could have sworn in either the apple docs (or one of the cocoa  
books, maybe this board). I maybe thinking of the general rule that  
you don't own the object until you retain it and its only valid or the  
within the method that its recieved. My bad.


Scott

On Sep 3, 2009, at 11:29 AM, mmalc Crawford wrote:



On Sep 3, 2009, at 7:56 AM, Scott Andrew wrote:

As Cocoa documentation states all items returned from a message are  
autoreleased unless otherwise stated in the documentation for the  
API call.



The documentation emphatically does not state that.

The basic rules are given here:
	


The rest of the document gives further details.

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 arch...@mail-archive.com


Re: NSImage with multiple representation sizes

2009-09-03 Thread Ken Ferry
Hi Benjamin,
I think there's some confusion here between size and pixel size.

The "size" of an image is the default size of the rect in which it's drawn
when the person drawing it doesn't have any more specific information.
 That's a concept that there can only be one of for the entire image, so
it's confusing if the -size for contained reps doesn't match that of the
image itself.

The -size is unrelated to the number of pixels in a rep.  The ratio
determines resolution.  Reps can definitely have different numbers of
pixels.

It's pretty common for people to hit cases where they feel like their image
has no intrinsic size it wants to be drawn at.  Like, it might be equally
natural at 32x32 vs 128x128.  That's okay, it just means you're going to
ignore the size.  There still is one, you just don't care what it is.

-size is not used in representation selection.  Rep selection is based on
the number of pixels to be filled in the context and the number of pixels in
each candidate rep.

So it's perfectly fine to pack in different representations with different
numbers of pixels.  What the docs encourage is setting the metadata so that
the -size of each representation is the same.

-Ken

On Thu, Sep 3, 2009 at 11:00 AM, Benjamin Rister  wrote:

> (Apologies if this ends up a duplicate…I sent the original over a week ago,
> and as far as I can see it's not in either Apple's or Cocoabuilder's
> archives, so I don't see any other explanation besides it just being eaten
> by something.)
>
> The core question:
> Is it still the best practice to have conceptually same images of different
> sizes in different files, e.g. Foo9x9.tiff, Foo32x32.tiff?  icns isn't an
> option because they aren't all the standard icns sizes, and several places
> in the docs seem to discourage lumping them together (e.g. with tiffutil)
> anyway.
>
>
> The details:
>
> We have several images that are displayed at different sizes at various
> places in an application.  Our artist has generated several bitmaps for
> these different scales.  Modeling on the concept of an .icns file, my
> inclination would be to try and lump them all together in one
> multi-representation file and let NSImage figure out what the best
> representation is to draw from at any given point.  This not only is
> convenient for the various usages around the app, but also for resolution
> independence (...maybe...see below).
>
> However, man tiffutil says:
>
>> -cat allows combining multiple TIFF files into one. ... If the real sizes
>> (pixel size
>> divided by dpi) of the images being combined are not the same, a
>> warning
>> will be generated. This makes sure that NSImage can successfully
>> choose
>> the right size image out of the generated TIFF file.
>>
>
> And Cocoa Drawing Guide: Images, "How an Image Representation Is Chosen"
> gives rules about color space, dpi, and bit depth, but there's no rule about
> choosing representations based on size.  (But there's icns, right?  How is
> that supposed to work, then?)
>
> I'm also concerned for resolution independence that the system might not
> choose the 32x32px rep to fill a 16x16pt space at a 2x scale factor, because
> everything I've seen in the resolution independence docs only talks about
> representations with different dpi.  It would be rather inelegant to have to
> have multiple representations with the same pixels and just different
> metadata.
>
> So between the resolution independence concern, and the docs seemingly
> discouraging having different sized images in one file, this raises the core
> question above.  What's the best way to arrange this for both drawing the
> image at different sizes in different places and resolution independence?
>
> Best,
> Benjamin Rister___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 11:32 AM, Alexander Cohen wrote:

Ok, thats what i thought. But just for implementation ideas, how  
does CoreData know when one of it's @dynamic properties is changed?  
It must set some sort of flag somewhere in order to know what to  
write out when it needs to save. How does it handle that?


@dynamic properties are assigned implementations on the fly at  
runtime. NSManagedObject's implementation of the setter method  
includes setting the dirty flag, I suppose.


So actually my "no" wasn't strictly true. You can track changes to  
arbitrary dynamic properties, including those defined in subclasses,  
because they all funnel through a common implementation.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 11:40 AM, Scott Andrew wrote:

I could have sworn in either the apple docs (or one of the cocoa  
books, maybe this board). I maybe thinking of the general rule that  
you don't own the object until you retain it and its only valid or  
the within the method that its recieved. My bad.


Here's an example of a return value that isn't autoreleased:

- (Foo*) foo {
static Foo* sharedFoo;
if (!sharedFoo) sharedFoo = [[Foo alloc] init];
return _sharedFoo;
}

Another example is a simple getter that simply returns an instance  
variable (which is the way I still choose to write most of my getters.)


The general principle is that returned object references are not  
guaranteed to stick around, unless you retain them. Autoreleasing is  
just one way for the called method to do that.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Distinguishing between return and enter in NSTextField

2009-09-03 Thread Douglas Davidson

Try taking a look at the current event.

Douglas Davidson


On Sep 3, 2009, at 11:18 AM, Rick Mann  wrote:

I would like to use the delegate, but it sends me insertNewLine: for  
both keys.


Is there another method I can implement?

On Sep 3, 2009, at 11:14:20, Douglas Davidson wrote:

Short answer:  no. Stay away from keyDown: and look at delegate  
methods instead. I have a standard rant on this topic; I don't have  
it handy but it should be in the list archives.


Douglas Davidson



On Sep 3, 2009, at 10:54 AM, Rick Mann  wrote:

Hi. I'd like to insert a new line when the user presses return in  
an NSTextField, but take completely custom action when they press  
Enter. Is the only way to do this to subclass NSTextField and  
override the NSResponder keyDown: method?


TIA,
Rick





___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: bad behavior from unlockFocus on 10.6

2009-09-03 Thread Robert Clair

Hi Ken -



> This all worked fine until 10.6. The original NSImage object was  
left unmolested.


Nope. :-)  Clearly you're seeing behavior change somewhere, but this  
attribution is not correct.


-[NSImage lockFocus] is a commonly misunderstood method.  It is and  
always has been lossy.


Not to be disputatious, but nope on your nope, for a couple of reasons:

1) If that were the case, the code wouldn't have worked for the last 5  
years.


2) The even better reason is that I just made a fresh build on a 10.5  
machine and stepped through it. The NSImage has the same single  
NSPDFImageRep after the -unlockFocus as it before the -lockFocus


By accident I may have been relying on unintended behavior but it  
definitely worked before and changed with 10.6


Bob



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread Clark Cox
On Thu, Sep 3, 2009 at 10:56 AM, Scott Lahteine wrote:
>> On Sep 2, 2009, at 9:02 PM, Scott Lahteine wrote:
>>>
>>> My preference pane uses Gestalt(gestaltUserVisibleMachineName,
>>> &mySInt32), coercing the SInt32 into a StringPtr to get the Machine
>>> Name. On 64-bit I get a warning because StringPtr is a 64-bit
>>> pointer on that architecture. Does Gestalt() ensure that the
>>> returned pointer is in the low 4 gigs of RAM, or is there a more
>>> appropriate way to get the Machine Name that is 64-bit compatible?
>>
>> On Sep 2, 2009, at 11:13 PM Jim Correia wrote:
>> extern CFStringRef CSCopyMachineName(void)
>> AVAILABLE_MAC_OS_X_VERSION_10_0_AND_LATER;
>> - Jim
>>
>> On Sep 2, 2009, at 11:43 PM, Kyle Sluder wrote:
>> NSHost now does this.
>> --Kyle Sluder
>
>
> Your answers were too quick, Jim and Kyle!
>
> CSCopyMachineName() returns the name of the computer as set by the user in
> the Sharing preference pane, which is not the same thing as the
> gestaltUserVisibleMachineName. The "Machine Name" I want is the
> Apple-defined identifier for the type of computer, which (as of this date)
> begins with one of the following strings:
>
> "AAPL","iMac","PowerBook","PowerMac","RackMac","Macmini","MacPro","MacBookPro","MacBook"
>
> For example, my computer is identified by Gestalt() as a "MacBook2,1"

If you *really* need this information, you can get it from
sysctlbyname(), but I would think long and hard about what you need it
for. If you are basing any decisions on this value you're setting
yourself up for problems with newly released machines (or even old
machines with user-installed upgrades).

> At this point, as far as I can tell Gestalt() is still a viable solution,
> and the returned pointer is just guaranteed to be in the low 4GB of RAM.

Not possible. On 64-bit Intel (at least with the default settings),
there is no such thing as a valid pointer in the low 4GB of RAM. *All*
valid pointers are outside of that first 4GB; in fact, trying to
dereference such a pointer is treated in exactly the same manner as
trying to dereference NULL.

-- 
Clark S. Cox III
clarkc...@gmail.com
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Ah, ok, this is more like what i wanted to hear! :) I understand how  
@dynamic works, but how to I get to funnel all calls to @dynamic  
properties to the same call such as setValue:forKey: or something like  
that where i can parse the key and update my internal data and set the  
flags i need to set.


thx

AC

On Sep 3, 2009, at 2:43 PM, Jens Alfke wrote:



On Sep 3, 2009, at 11:32 AM, Alexander Cohen wrote:

Ok, thats what i thought. But just for implementation ideas, how  
does CoreData know when one of it's @dynamic properties is changed?  
It must set some sort of flag somewhere in order to know what to  
write out when it needs to save. How does it handle that?


@dynamic properties are assigned implementations on the fly at  
runtime. NSManagedObject's implementation of the setter method  
includes setting the dirty flag, I suppose.


So actually my "no" wasn't strictly true. You can track changes to  
arbitrary dynamic properties, including those defined in subclasses,  
because they all funnel through a common implementation.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to alexco...@toomuchspace.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Ben Trumbull
Well, @dynamic doesn't have anything to do with KVO.  It's just  
storage and accessors for properties.  Core Data knows when non- 
dynamic modeled properties change too.  It sets a dirty flag, just as  
you would have to.  Most of that happens in -willChangeValueForKey:.   
Unfortunately, overriding that method was deprecated in 10.5.  KVO no  
longer guarantees overrides will be called.


In terms of knowing what to save, Core Data only tracks that at an  
object level, and uses snapshot deltas to compute the changed property  
set at the end.


Some people invert the observing relationship to work around this.   
You can add code in your setters to set a dirty flag, or within your  
setters manually call a notify method on another object.  If you have  
fewer objects, you could just use NSNotifications.


Almost certainly worth filing an enhancement request at bugreport.apple.com

- Ben


Ok, thats what i thought. But just for implementation ideas, how does
CoreData know when one of it's @dynamic properties is changed? It must
set some sort of flag somewhere in order to know what to write out
when it needs to save. How does it handle that?

thx

AC

On Sep 3, 2009, at 12:27 PM, Jens Alfke wrote:



On Sep 3, 2009, at 8:24 AM, Alexander Cohen wrote:


I have a base object that needs to know when any of it's properties
or subclasses properties have changed and set a dirty flag on
itself. Is there a way to do this?


No, not in general. Key-value observing requires knowing the exact
property name(s) in advance. You'll need to set the 'dirty' flag
manually.

˜Jens



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSServices

2009-09-03 Thread Peter Ammon

Hi Colin,

Adding the NSRequiredContext is the right way to make it appear by  
default.


Note that after adding it, you will have to run /System/Library/ 
CoreServices/pbs (or log out and back in) to make the Service appear.   
If you are unsure if the system is recognizing the context, run pbs  
with the -dump_pboard flag


/System/Library/CoreServices/pbs -dump_pboard

find your app's entry and make sure it shows the NSRequiredContext.   
Post again if that doesn't work.


-Peter

On Sep 3, 2009, at 12:48 AM, Colin Deasy wrote:



Ive tried it with the required context as well, no luck. I even  
tried building it with 10.6 SDK.



From: kyle.slu...@gmail.com
To: colde...@hotmail.com
Subject: Re: NSServices
Date: Wed, 2 Sep 2009 20:41:33 -0700
CC: cocoa-dev@lists.apple.com

Re-read the docs. Your plist needs to specify an array (possibly
empty) of valid contexts. Otherwise Snow Leopard assumes you haven't
updated your service for 10.6.

--Kyle Sluder




___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread Scott Lahteine

On Sep 3, 2009, at 3:14 PM, Clark Cox wrote:
At this point, as far as I can tell Gestalt() is still a viable  
solution,
and the returned pointer is just guaranteed to be in the low 4GB of  
RAM.


Not possible. On 64-bit Intel (at least with the default settings),
there is no such thing as a valid pointer in the low 4GB of RAM. *All*
valid pointers are outside of that first 4GB; in fact, trying to
dereference such a pointer is treated in exactly the same manner as
trying to dereference NULL.


Fascinating information. Thank you for the insight. And sysctlbyname()  
works just great.


As it turns out Gestalt(gestaltUserVisibleMachineName) returns error  
-5551 in a 64 bit binary anyway. I wasn't seeing this because  
apparently my build architecture - "Standard Universal (32/64 bit)" -  
was/is for some reason launching the 32 bit binary. I had to  
explicitly specify "64-bit Intel" to get it to launch exactly the  
binary I wanted. Maybe this is because my system is booted into the 32- 
bit kernel...?


Anyhow, thanks for the help!

--
  Scott Lahteine
  Thinkyhead Software
  http://thinkyhead.com/

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Quincey Morris

On Sep 3, 2009, at 12:14, Alexander Cohen wrote:

Ah, ok, this is more like what i wanted to hear! :) I understand how  
@dynamic works, but how to I get to funnel all calls to @dynamic  
properties to the same call such as setValue:forKey: or something  
like that where i can parse the key and update my internal data and  
set the flags i need to set.


No, you're barking up the wrong tree.

There's no "how @dynamic works". @dynamic is a compiler directive  
telling it that getter/setter method implementations exist, but just  
not in the current compilation unit. There no standard general  
mechanism for supplying the implementation.


In the case of Core Data specifically, the built-in implementations  
(call them "dynamic" if you want, but that's the same as their being  
compiled as "@dynamic") are simply efficient versions of what you  
would otherwise have to hand-code. We don't know if they're funneled  
through one funnel, several funnels, or a different function for every  
property -- that's an implementation detail.


(IAC, Core Data doesn't mark objects as changed in *those* dynamic  
methods, but (presumably -- another implementation detail) in the  
primitive dynamic methods.)


I don't how you're ever going to be able to have a class detect  
invocations of its subclasses' properties, unless you have the class  
muck around in the runtime, replacing methods on the fly.


A better solution, IMO, is to realize that you're considering a design  
requirement for your data model, and to design the solution right into  
the model. For example, if this is a self-contained class hierarchy  
that you're implementing, you could make it a requirement of  
subclasses that they invoke something (a superclass method) or inform  
something (a controller of some kind) when they modify data values.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: [Workaround] Re: My NSUndoManager subclass is broken on SL - how to fix?

2009-09-03 Thread Jayson Adams


On Sep 2, 2009, at 9:48 PM, Graham Cox wrote:

For anyone interested (doesn't seem like anyone is, unfortunately) I  
have worked out a solution which can only be described as an  
inglorious hack. I have submitted a bug report requesting that  
NSUndoManager is made (optionally) backwards compatible with earlier  
subclasses of it. Bug# 7193398.


I am interested - sorry I didn't see your original message.  I too  
apparently have an NSUndoManager that no longer operates correctly as  
of 10.6.  What is completely ridiculous is that this framework change  
affects my 10.4-compiled app.  So much for binary compatibility.


Best,


__jayson

Circus Ponies NoteBook - Organization for a Creative Mind
www.circusponies.com



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread David Duncan

On Sep 3, 2009, at 12:35 PM, Scott Lahteine wrote:

As it turns out Gestalt(gestaltUserVisibleMachineName) returns error  
-5551 in a 64 bit binary anyway. I wasn't seeing this because  
apparently my build architecture - "Standard Universal (32/64 bit)"  
- was/is for some reason launching the 32 bit binary. I had to  
explicitly specify "64-bit Intel" to get it to launch exactly the  
binary I wanted. Maybe this is because my system is booted into the  
32-bit kernel...?



The kernel you are booted into has no effect on the binaries that will  
launch. However, your project settings will determine what build is  
launched, and older projects will often have i386 as default (a newly  
created project shows that x86_64 is shown by default on my machine).

--
David Duncan
Apple DTS Animation and Printing

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: bad behavior from unlockFocus on 10.6

2009-09-03 Thread Ken Ferry
Well, please file a bug with a test case that shows the behavior change.  I
still think there's something else going on.

-Ken
Cocoa Frameworks
NSImage owner


On Thu, Sep 3, 2009 at 11:53 AM, Robert Clair  wrote:

> Hi Ken -
>
>
>> > This all worked fine until 10.6. The original NSImage object was left
>> unmolested.
>>
>> Nope. :-)  Clearly you're seeing behavior change somewhere, but this
>> attribution is not correct.
>>
>> -[NSImage lockFocus] is a commonly misunderstood method.  It is and always
>> has been lossy.
>>
>
> Not to be disputatious, but nope on your nope, for a couple of reasons:
>
> 1) If that were the case, the code wouldn't have worked for the last 5
> years.
>
> 2) The even better reason is that I just made a fresh build on a 10.5
> machine and stepped through it. The NSImage has the same single
> NSPDFImageRep after the -unlockFocus as it before the -lockFocus
>
> By accident I may have been relying on unintended behavior but it
> definitely worked before and changed with 10.6
>
> Bob
>
>
>
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Quincey Morris

On Sep 3, 2009, at 12:44, Quincey Morris wrote:

(call them "dynamic" if you want, but that's the same as their being  
compiled as "@dynamic")


I meant, "... that's *not* the same as ...", of course.

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Core Data dog-slow when using first time after boot

2009-09-03 Thread Ben Trumbull


On Sep 3, 2009, at 4:49 AM, Ruotger Skupin wrote:

Since it's not a many to many, you can perform the prefetching  
effectively by hand using a fetch request to preload the relevant  
destination rows with an IN query based on the data you initially  
fetched for the source entity.  You shouldn't have to, but if  
you've run into a bug, that's how you could workaround it.


You still haven't described the NSPredicate you were using with  
filteredArrayUsingPredicate.  Being more forthcoming about the  
context and details of your problem will help us get you answers  
more quickly.
This is the predicate I was using for the test of the original  
post, but since I use Smart Folders predicates can look a lot  
different (i.e.: complex):


(additionalInfo.onTheFlyIsInternal == 0 AND  
additionalInfo.isSuppressed != 1) AND (account.uniqueID IN  
{"D1AB3788-00DF-4475-A979-CE3EFC3987B5"} OR FALSEPREDICATE)





You'll want to prefetch additionalInfo and account.


Hm. Problem here is: As mentioned I use the predicate for a smart  
group. So the predicate can vary wildly and can reference basically  
any entity in the model. So what is the best strategy here?  
"Decompile" the predicate (which is built by an NSPredicateEditor)  
and prefetch the keypaths it takes? Prefetch "everything"?



Prefetching everything is usually undesirable.  The easiest  
approximate solution is to just track the hot button relationships for  
each of your core entities, and look up which keypaths to prefetch by  
entity name.  Of course, you can also do a lot less filtering in  
memory if you pass the predicates to the database with the fetch  
request.  You only need to prefetch relationships you are going to use  
in memory.  You don't need to prefetch anything that's simply used as  
part of the predicate in the fetch request itself.


Walking through the predicate and gathering up the keypaths used is  
very tedious, but not especially difficult, if you find yourself  
wanting a complete solution.


- 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 arch...@mail-archive.com


Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen
Overriding willChangeValueForKey: was one of the first things i tried  
before posting and I noticed it was not being called, i thought it was  
weird but nothing more. Good to know that overriding it was  
deprecated. Thx for the info on how CoreData manages it's saves. I was  
hoping to not have to create setters for all the values that can  
change my dirty flag but i guess ill have to. I guess what i'm looking  
for is a method like setSelector:forChangesOnProperties:.


thx

AC

On Sep 3, 2009, at 3:30 PM, Ben Trumbull wrote:

Well, @dynamic doesn't have anything to do with KVO.  It's just  
storage and accessors for properties.  Core Data knows when non- 
dynamic modeled properties change too.  It sets a dirty flag, just  
as you would have to.  Most of that happens in - 
willChangeValueForKey:.  Unfortunately, overriding that method was  
deprecated in 10.5.  KVO no longer guarantees overrides will be  
called.


In terms of knowing what to save, Core Data only tracks that at an  
object level, and uses snapshot deltas to compute the changed  
property set at the end.


Some people invert the observing relationship to work around this.   
You can add code in your setters to set a dirty flag, or within your  
setters manually call a notify method on another object.  If you  
have fewer objects, you could just use NSNotifications.


Almost certainly worth filing an enhancement request at bugreport.apple.com

- Ben


Ok, thats what i thought. But just for implementation ideas, how does
CoreData know when one of it's @dynamic properties is changed? It  
must

set some sort of flag somewhere in order to know what to write out
when it needs to save. How does it handle that?

thx

AC

On Sep 3, 2009, at 12:27 PM, Jens Alfke wrote:



On Sep 3, 2009, at 8:24 AM, Alexander Cohen wrote:


I have a base object that needs to know when any of it's properties
or subclasses properties have changed and set a dirty flag on
itself. Is there a way to do this?


No, not in general. Key-value observing requires knowing the exact
property name(s) in advance. You'll need to set the 'dirty' flag
manually.

˜Jens



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

This email sent to alexco...@toomuchspace.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


NSControlTextDidChangeNotification - What key pressed?

2009-09-03 Thread jeffs87

Hi,

I added an NSControlTextDidChangeNotification for a text field and I 
was wondering if there is a way to see what key was pressed when the 
selector is called?


thanks
Jeff

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Alexander Cohen


On Sep 3, 2009, at 3:44 PM, Quincey Morris wrote:


On Sep 3, 2009, at 12:14, Alexander Cohen wrote:

Ah, ok, this is more like what i wanted to hear! :) I understand  
how @dynamic works, but how to I get to funnel all calls to  
@dynamic properties to the same call such as setValue:forKey: or  
something like that where i can parse the key and update my  
internal data and set the flags i need to set.


No, you're barking up the wrong tree.

There's no "how @dynamic works". @dynamic is a compiler directive  
telling it that getter/setter method implementations exist, but just  
not in the current compilation unit. There no standard general  
mechanism for supplying the implementation.


In the case of Core Data specifically, the built-in implementations  
(call them "dynamic" if you want, but that's the same as their being  
compiled as "@dynamic") are simply efficient versions of what you  
would otherwise have to hand-code. We don't know if they're funneled  
through one funnel, several funnels, or a different function for  
every property -- that's an implementation detail.


(IAC, Core Data doesn't mark objects as changed in *those* dynamic  
methods, but (presumably -- another implementation detail) in the  
primitive dynamic methods.)


I don't how you're ever going to be able to have a class detect  
invocations of its subclasses' properties, unless you have the class  
muck around in the runtime, replacing methods on the fly.


A better solution, IMO, is to realize that you're considering a  
design requirement for your data model, and to design the solution  
right into the model. For example, if this is a self-contained class  
hierarchy that you're implementing, you could make it a requirement  
of subclasses that they invoke something (a superclass method) or  
inform something (a controller of some kind) when they modify data  
values.


I'm with you. I've realized that's the way to go. Concerning CoreData,  
i was looking for info or ideas on the implementation details. thx for  
the info.


AC
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSDictionary, allKeys and the NSAutoreleasePool

2009-09-03 Thread Greg Parker

On Sep 3, 2009, at 11:47 AM, Jens Alfke wrote:

On Sep 3, 2009, at 11:40 AM, Scott Andrew wrote:
I could have sworn in either the apple docs (or one of the cocoa  
books, maybe this board). I maybe thinking of the general rule that  
you don't own the object until you retain it and its only valid or  
the within the method that its recieved. My bad.


Here's an example of a return value that isn't autoreleased:

- (Foo*) foo {
static Foo* sharedFoo;
if (!sharedFoo) sharedFoo = [[Foo alloc] init];
return _sharedFoo;
}


Something similar is exactly what happens in the original code. On  
Snow Leopard at least, both NSDictionary and NSArray have  
optimizations for the "empty immutable collection" case. In both  
classes there's a single shared instance that lives forever, so it  
won't be destroyed even after every retain count that you are  
responsible for has been released.


Try this:

{
NSDictionary *di = [[NSDictionary alloc] init];
NSArray  *ar = [di allKeys];
NSDictionary *di2 = [[NSDictionary alloc] init];
NSArray  *ar2 = [di allKeys];

NSLog(@"di %p, di2 %p", di, di2);
NSLog(@"ar %p, ar2 %p", ar, ar2);
}

You'll see that there's only one NSDictionary object and one NSArray  
object, even though you called +alloc twice.


Then try your original test with a non-empty NSDictionary. You'll see  
the memory management behave more like you expect. (Of course, `[ar  
retainCount]` is likely to crash if called after `ar` is deallocated.)



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


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


RE: NSServices

2009-09-03 Thread Colin Deasy

Hey Peter,
Thanks for the response.
Ya I had gone through all that process, and my app was showing up in the 
output. When I debugged it against textedit it said that it was disabled!
I've got it working now, it was caused by 1 of the following:
 - Duplicate applications ( e.g both a debug and release version ) - Empty 
return types declaration
However I don't fancy trying to recreate the problem but if I had to guess to 
instigator I would say the first on that list.
CheersColin

> Subject: Re: NSServices
> From: pam...@apple.com
> Date: Thu, 3 Sep 2009 12:35:12 -0700
> CC: cocoa-dev@lists.apple.com
> To: colde...@hotmail.com
> 
> Hi Colin,
> 
> Adding the NSRequiredContext is the right way to make it appear by  
> default.
> 
> Note that after adding it, you will have to run /System/Library/ 
> CoreServices/pbs (or log out and back in) to make the Service appear.   
> If you are unsure if the system is recognizing the context, run pbs  
> with the -dump_pboard flag
> 
> /System/Library/CoreServices/pbs -dump_pboard
> 
> find your app's entry and make sure it shows the NSRequiredContext.   
> Post again if that doesn't work.
> 
> -Peter
> 
> On Sep 3, 2009, at 12:48 AM, Colin Deasy wrote:
> 
> >
> > Ive tried it with the required context as well, no luck. I even  
> > tried building it with 10.6 SDK.
> >
> >> From: kyle.slu...@gmail.com
> >> To: colde...@hotmail.com
> >> Subject: Re: NSServices
> >> Date: Wed, 2 Sep 2009 20:41:33 -0700
> >> CC: cocoa-dev@lists.apple.com
> >>
> >> Re-read the docs. Your plist needs to specify an array (possibly
> >> empty) of valid contexts. Otherwise Snow Leopard assumes you haven't
> >> updated your service for 10.6.
> >>
> >> --Kyle Sluder
> >
> 

_
What can you do with the new Windows Live? Find out
http://www.microsoft.com/windows/windowslive/default.aspx___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSControlTextDidChangeNotification - What key pressed?

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 1:03 PM, jeff...@aol.com wrote:

I added an NSControlTextDidChangeNotification for a text field and I  
was wondering if there is a way to see what key was pressed when the  
selector is called?


Nope — this notification is higher level and happens after any user- 
driven change; it's not directly related to a particular input event.  
Text can be changed without keystrokes. For example, the user might  
have used drag-and-drop to insert or move text in the field, without  
any keystroke at all. Or they might have used mouse clicks in an input- 
method panel to create a CJK character.


What precisely are you trying to do? If you really need to look at  
every keystroke, you'll probably have to override keyDown:, but this  
is tricky to do because the view you have to override it in is the  
window's field editor, not the control itself.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSControlTextDidChangeNotification - What key pressed?

2009-09-03 Thread Andy Lee

On Sep 3, 2009, at 4:03 PM, jeff...@aol.com wrote:
I added an NSControlTextDidChangeNotification for a text field and I  
was wondering if there is a way to see what key was pressed when the  
selector is called?


Maybe look at [NSApp currentEvent]?

(This comes to mind because it was suggested in answer to another  
question.)


--Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Handling NSApplicationDefined events

2009-09-03 Thread McLaughlin, Michael P.
Quincey Morris wrote:

>It's straightforward. Subclass NSApplication and override sendEvent:
>to test for NSApplicationDefined.
>
>Don't forget to specify your subclass as the "Principal Class" in your
>target's properties.

The one example I found like that passed the event on even though it had
been handled.

Is

@interface MyApplication : NSApplication
{
}

@implementation MyApplication
-(void)sendEvent:(NSEvent *)evt
{
if ([evt type] == NSApplicationDefined)

else
[super sendEvent:evt];
}
@end

better?

-- 
Mike McLaughlin

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: watch changes to any properties on an object

2009-09-03 Thread Ben Trumbull

On Sep 3, 2009, at 12:14, Alexander Cohen wrote:
Ah, ok, this is more like what i wanted to hear! :) I understand how
@dynamic works, but how to I get to funnel all calls to @dynamic
properties to the same call such as setValue:forKey: or something
like that where i can parse the key and update my internal data and
set the flags i need to set.


No, you're barking up the wrong tree.

There's no "how @dynamic works". @dynamic is a compiler directive
telling it that getter/setter method implementations exist, but just
not in the current compilation unit. There no standard general
mechanism for supplying the implementation.

In the case of Core Data specifically, the built-in implementations
(call them "dynamic" if you want, but that's the same as their being
compiled as "@dynamic") are simply efficient versions of what you
would otherwise have to hand-code. We don't know if they're funneled
through one funnel, several funnels, or a different function for every
property -- that's an implementation detail.

(IAC, Core Data doesn't mark objects as changed in *those* dynamic
methods, but (presumably -- another implementation detail) in the
primitive dynamic methods.)

I don't how you're ever going to be able to have a class detect
invocations of its subclasses' properties, unless you have the class
muck around in the runtime, replacing methods on the fly.

A better solution, IMO, is to realize that you're considering a design
requirement for your data model, and to design the solution right into
the model. For example, if this is a self-contained class hierarchy
that you're implementing, you could make it a requirement of
subclasses that they invoke something (a superclass method) or inform
something (a controller of some kind) when they modify data values.


Good advice.

Also, instead of worrying about how Core Data does this, you could  
just leverage Core Data's change tracking, whether via inheritance or  
composition, and respond to the  
NSManagedObjectContextObjectsDidChangeNotification. You don't have to  
save to one of Core Data's persistence mechanisms just to create a  
bunch of managed objects to hold some properties.


- 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 arch...@mail-archive.com


Re: Handling NSApplicationDefined events

2009-09-03 Thread Quincey Morris

On Sep 3, 2009, at 13:39, McLaughlin, Michael P. wrote:

The one example I found like that passed the event on even though it  
had

been handled.

Is

@interface MyApplication : NSApplication
{
}

@implementation MyApplication
-(void)sendEvent:(NSEvent *)evt
{
   if ([evt type] == NSApplicationDefined)
   
   else
   [super sendEvent:evt];
}
@end

better?


Yes. I didn't want to risk insulting you by telling you what you  
already knew. As you did know. :)


I *did* risk insulting you by reminding you to change the Principal  
Class, because that's easy to overlook even when you know it needs to  
be done.



___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Does -[NSFileManager attributesOfItemAtPath:error:] traverse symlinks?

2009-09-03 Thread Charles Srstka
Okay, the documentation for -[NSFileManager  
attributesOfItemAtPath:error:] states the following:


In Mac OS X v 10.6 and earlier, if the last component of the path is  
a symbolic link (the value of the NSFileType key in the attributes  
dictionary isNSFileTypeSymbolicLink), it will be traversed. This  
behavior may change in a future version of the Mac OS X.


However, the header states this:

/* attributesOfItemAtPath:error: returns an NSDictionary of key/ 
value pairs containing the attributes of the item (file, directory,  
symlink, etc.) at the path in question. If this method returns  
'nil', an NSError will be returned by reference in the 'error'  
parameter. This method does not traverse a terminal symlink.


This method replaces fileAttributesAtPath:traverseLink:.
 */


So the docs say it will traverse the link, and the header says it  
won't. In my testing, the header appears to be correct - the  
dictionary I get back contains the attributes of the symlink, not the  
original file. This is good, since this is actually the behavior that  
I want, but the discrepancy between documentation and actual behavior  
makes me nervous that this could change in the future and that I  
should not rely on it (especially since the documentation flat-out  
states as much).


I was wondering if any of the Apple insiders here could provide any  
Word of God on this. Is this simply an error in the documentation, and  
can I rely on this method to get the file attributes of a symbolic  
link? Or am I better off implementing my own equivalent method as a  
category on NSFileManager, using lstat and Carbon to get the relevant  
information and then populating the appropriate fields of an  
NSDictionary, in order to get deterministic behavior?


(apologies if this has already been asked - I did a search but  
couldn't find anything.)


Thanks,
Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


NSUserDefaults

2009-09-03 Thread Oftenwrong Soong
Hi all,

Why does NSUserDefaults provide method stringForKey but not a method 
setString:forKey (akin to setBool:forKey, setFloat:forKey, etc.)? This does not 
seem symmetric.

I'm using setObject:forKey when saving a NSString to the defaults database. Is 
this correct?

Thanks,
Soong



  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSUserDefaults

2009-09-03 Thread Steven Degutis
As NSString, NSData, NSDictionary, etc are derived from NSObject, they can
be easily set with -setObject:forKey:, whereas int, float, NSInteger, etc
are scalar types and thus cannot be set with this method. Thus, they have
convenient setters/getters, whereas object types have convenient getters
only. (Why they aren't balanced is beyond me.)
-- 
Steven Degutis
http://www.thoughtfultree.com/
http://www.degutis.org/


On Thu, Sep 3, 2009 at 4:05 PM, Oftenwrong Soong
wrote:

> Hi all,
>
> Why does NSUserDefaults provide method stringForKey but not a method
> setString:forKey (akin to setBool:forKey, setFloat:forKey, etc.)? This does
> not seem symmetric.
>
> I'm using setObject:forKey when saving a NSString to the defaults database.
> Is this correct?
>
> Thanks,
> Soong
>
>
>
>
> ___
>
> 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/steven.degutis%40gmail.com
>
> This email sent to steven.degu...@gmail.com
>
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSControlTextDidChangeNotification - What key pressed?

2009-09-03 Thread jeffs87
That worked...

if (([[NSApp currentEvent] type] == NSKeyDown)
&& ([[NSApp currentEvent] keyCode] == 0x1b))
{

}

thanks
Jeff

>Maybe look at [NSApp currentEvent]?
>
>(This comes to mind because it was suggested in answer to
>another question.)
>
>-Andy

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSUserDefaults

2009-09-03 Thread Andy Lee

On Sep 3, 2009, at 5:05 PM, Oftenwrong Soong wrote:
Why does NSUserDefaults provide method stringForKey but not a method  
setString:forKey (akin to setBool:forKey, setFloat:forKey, etc.)?  
This does not seem symmetric.


I'm using setObject:forKey when saving a NSString to the defaults  
database. Is this correct?


Yes.  setObject:forKey: is for values that are objects -- not just  
NSString but NSNumber, NSDate, and the other classes mentioned in the  
method's documentation.  Notice the other setXXX:forKey: methods take  
values that are not objects.


Going in the other direction, the reason there are stringForKey:,  
dateForKey:, etc. methods is that you might want to use stringForKey:  
(for example) even if you originally put an integer/date/float/etc.  
into the user defaults, or vice versa.


--Andy


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: a bug in iphone SDK's creation of view based xib files.

2009-09-03 Thread Joey Hagedorn

On Sep 3, 2009, at 5:21 AM, jon wrote:

Thanks for reporting a bug, this is the best way to get problems fixed.

the springs and struts are disabled on views with simulated user  
interface attributes, so this is expected...In this case,  
it sounds like you expect the view provided in the UIViewController  
Subclass with XIB file template to have the autosizing parameters  
set differently.


if this were not a bug,   then why is the First XIB created (which  
is a UIView class also)  set differently than the Second XIB which  
is also the same Class??  ( I should have mentioned in the steps  
that this is not a UIViewController subclass,  that option should be  
left off to create a regular "UIView" Class...)and should  
provide exactly the same start point,  since they after all should  
be the same, yet they are not the same???
one has the struts/springs set differently than the other
worse,  disabled, so that no one can change them to be correct.


I am not disagreeing with you, I'm trying to clearly identify the  
problem. The issue here is that the autoresizing options for the view  
created with the UIViewController File Template does not match the  
configuration of the XIB included in the UIViewController based  
Application's view XIB file, that is it isn't set to autoresize height  
and width.


Fortunately, if you turn off the simulated status bar on the view, you  
can toggle the autoresizing freely from within Interface Builder.


(a second related thing is:)  setting the Simulated Status Bar to  
disabled,  does not actually disable the status bar,  (it does  
inside of IB,  but inside the iPhone simulator after it is compiled,  
it does not)  one has to also edit the XIB to actually turn off the  
Status bar??  (maybe  i am missing something there)


I cannot stress this enough; do not edit the XIB file by hand.

As Roland said, the Simulated Status Bar is just that, simulated, and  
present to aid in designing your view. The XIB file contains objects  
that are archived and at run time are recreated from the nib. The  
status bar is not in a nib and is drawn as part of the system, so  
controlling it is achieved by an API call or editing the Info.plist  
file.


Perhaps you will find the Simulated Tab Bar more relevant. In each of  
the view XIB files used in your app, it will make sense to turn on the  
Simulated UITabBar at the bottom of the screen. In the root view  
controller of the navigation controller, you'll also want to turn on a  
simulated navigation bar. This way you can see how much space will be  
taken up by a tab bar. In other contexts, it will give you a context  
to edit a navigation item or tab bar item as well. Note that a tab bar  
is not added to each of your view XIB files, but the layout metrics  
are available for you to design your interface taking the height of  
the tab bar into account.


which brings up another question?  why does it matter that the  
status bar be there or not?   shouldn't you be able to adjust struts  
and springs no matter if it is there or not?   if one rotates the  
view,  the status bar rotates in the iphone simulator,   shouldn't  
the view also rotate and adjust it's view appropriately?  right now  
that is not happening  shouldn't it for the second XIB view,   
just like the first XIB view does correctly.  (even if the status  
bar is there, the first one is set correctly)


A view that has a Simulated Status Bar enabled is intended to be  
controlled by a UIViewController. When you turn on the simulated  
status bar, the view is sized to fit the screen and locked to that  
size. Because the view is locked in its size, the controls for the  
autoresizing behavior are disabled as well. I see the usability  
concern here, but I hope the workaround of turning off the simulated  
user interface elements will be sufficient for the time being.


Thanks,
Joey


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSUserDefaults

2009-09-03 Thread Steven Riggs
That's how I do it.  I also use setValue:forKey: when passing  
NSLocalizedString()


-Steve

On Sep 3, 2009, at 5:05 PM, Oftenwrong Soong wrote:


Hi all,

Why does NSUserDefaults provide method stringForKey but not a method  
setString:forKey (akin to setBool:forKey, setFloat:forKey, etc.)?  
This does not seem symmetric.


I'm using setObject:forKey when saving a NSString to the defaults  
database. Is this correct?


Thanks,
Soong




___

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/steven.riggs%40me.com

This email sent to steven.ri...@me.com


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Does -[NSFileManager attributesOfItemAtPath:error:] traverse symlinks?

2009-09-03 Thread Kyle Sluder
Get out of my OmniFocus inbox!   I noticed this the other day and
was about to file a Radar on it today.  You should do the same.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Getting a StringPtr from Gestalt on 64-bit

2009-09-03 Thread Kyle Sluder
On Thu, Sep 3, 2009 at 12:47 PM, David Duncan wrote:
> The kernel you are booted into has no effect on the binaries that will
> launch. However, your project settings will determine what build is
> launched, and older projects will often have i386 as default (a newly
> created project shows that x86_64 is shown by default on my machine).

To elaborate a bit more on this (cause it bit me a few weeks ago):

On x86_64, the $(NATIVE_ARCH) macro expands to i386.  This is
documented in the Xcode 3.0 release notes (I think) to maintain
compatibility with older Xcode projects.  Otherwise you'd open an
Xcode 2.5 project in Xcode 3.0 and get different behavior.  Nowadays
$(NATIVE_ARCH_ACTUAL) is the macro you want to use for "no, really, I
want 64-bit if you can do it".

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Does -[NSFileManager attributesOfItemAtPath:error:] traverse symlinks?

2009-09-03 Thread Charles Srstka

On Sep 3, 2009, at 4:36 PM, Kyle Sluder wrote:


Get out of my OmniFocus inbox!   I noticed this the other day and
was about to file a Radar on it today.  You should do the same.

--Kyle Sluder


I filed one a while ago, although it was on the lack of a documented  
method to get the attributes of a symlink. I just updated it with the  
information that the documentation is apparently incorrect. I'd still  
like some word from Apple employees on whether I can rely on the  
current behavior, though - if they end up changing the actual  
implementation to match the documentation rather than the other way  
around, it would cause problems if I were depending on the current  
behavior. Also, I no longer have Leopard installed to verify that this  
behaved the same way there, so at this point I'm still pondering  
whether this method is safe to use or not.


Charles
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Does -[NSFileManager attributesOfItemAtPath:error:] traverse symlinks?

2009-09-03 Thread Kyle Sluder
The header file describes the correct behavior.  rdar://problem/7196143

It has been stated that the header files are as valid sources of
documentation as the docset.  The current behavior is the only one
that makes sense.

--Kyle Sluder
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


restoring NSSplitView divider's position

2009-09-03 Thread kvic...@pobox.com
i have a multi-document, multi-window app and i'm getting ready to 
use NSSplitView for the first time.


from reading the docs and searching at cocoadev, i don't see how to 
get the current position of the divider so that i can save it, and 
later restore it on subsequent launches of my app/document/windows.


i can't use autoSave as this is a document/window attribute and not 
an attribute of the app. ie, each window for each doc can and should 
remember the divider's position.


thanx,
ken

ps. i do see the method for setting the divider's position... i just 
don't see how to get the current position for saving.


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Default authorization dialog text in Snow Leopard misleading

2009-09-03 Thread Kevin Wojniak
In Snow Leopard, the default dialog text is now "Type your password to  
allow MyApp to make changes." In Leopard it was "MyApp.app requires  
that you type your password." The SL version is slightly misleading,  
at least from a user's perspective. In our app we aren't making any  
direct changes, we're just launching a process. I know we can tack on  
text to the front of the dialog via kAuthorizationEnvironmentPrompt  
but this will have to take into account the text changes from Leopard  
and Snow Leopard to make sense.


Is there any workaround for this? It'd be nice to give the  
authorization dialog a "type" so it can display a different message  
based on the context. I realize this is a "security feature" for not  
allowing the text to be changed, but it's fairly important to let the  
user know why their password is being requested.


Kevin
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


NSBundle from an URL.

2009-09-03 Thread Erik Österlund

Hello.

I just wanted to check out NSBundle's + bundleFromURL. I looked in the  
documentation and said nothing about only some protocols working, so I  
thought I could load a bundle via HTTP which would be awesome, but  
that seemed to fail. Is this a bug, or am I being stupid?


Here is my code:

#import 

int main(int argc, char *argv[])
{
NSAutoreleasePool* pool = [NSAutoreleasePool new];
[NSApplication sharedApplication];
NSURL* url = [NSURL URLWithString:@"http://localhost/TestServer2.bundle 
"];

NSBundle* bundle = [NSBundle bundleWithURL:url];
NSString* nib = [bundle  
objectForInfoDictionaryKey:@"NSMainNibFile"];

[NSBundle loadNibNamed:nib owner:NSApp];
[NSApp run];
[pool drain];
return 0;
}

and here are my errors:

2009-09-04 00:33:52.657 TestClient[90551:a0f] An uncaught exception  
was raised
2009-09-04 00:33:52.659 TestClient[90551:a0f] *** -[NSBundle  
initWithURL:]: non-file URL argument
2009-09-04 00:33:52.663 TestClient[90551:a0f] *** Terminating app due  
to uncaught exception 'NSInvalidArgumentException', reason: '*** - 
[NSBundle initWithURL:]: non-file URL argument'


It doesn't seem to like the fact that the bundle URL is a directory,  
but what else would it be?!

(and yes I have a webserver, and yes the URL is correct)

- Fisk
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSBundle from an URL.

2009-09-03 Thread Jens Alfke


On Sep 3, 2009, at 3:36 PM, Erik Österlund wrote:

I just wanted to check out NSBundle's + bundleFromURL. I looked in  
the documentation and said nothing about only some protocols  
working, so I thought I could load a bundle via HTTP which would be  
awesome, but that seemed to fail. Is this a bug, or am I being stupid?


A lot of system APIs use file: URLs as a standard way of specifying a  
filesystem path. (Even more have been added in 10.6.) That doesn't  
mean these operate on other URL schemes like http: or ftp:! In  
general, unless the documentation for a function/method says it  
operates on any URL scheme, it only takes files.


—Jens___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Crash in CFRunLoopWakeUp

2009-09-03 Thread Mark Allan

Hi all,

I've been battling with this intermittent crash for about two weeks  
now and can't figure it out for the life of me.  I've got try/catch  
blocks around nearly all my code, and definitely around any code which  
runs in a separate thread, but it's not catching whatever causes this  
crash.  Also, I'm not even convinced it's my threads causing the crash  
as this one happened while a modal sheet was being displayed, before  
any of my external threads got started.


I'm fairly sure it's not a leak or a double-free - I've tried running  
with NSZombieEnabled, NSDebugEnabled, Malloc Guard, run the Clang  
Static Analyser over it and it's not showing anything up.


If I set NSExceptionHandlingMask to 63 in the terminal before  
launching my app, I get the following lines appearing in the console  
when a crash would have happened, and the application keeps running.   
The problem is, I can't seem to catch the exception anywhere.


NSExceptionHandler has recorded the following exception:
NSUncaughtSystemExceptionException -- Uncaught system exception:  
signal 5

Stack trace:  0x94f340a9  0x95294e3b  0x94f33b11  0xc0f2a  0xc121e
0x911502bb  0x  0x932e2556  0x91115155  0x91115012


Here's the crash log I mentioned earlier.  It's an intermittent crash  
and I'm going crazy trying to debug it.  Can anyone offer me any  
insight at all please?  Should I just burn an ADC support ticket and  
be done with it?


Many thanks for any help or suggestions you can give me.

Mark


Version: 2.0 (200)
Code Type:   PPC (Native)
Parent Process:  launchd [65]

Date/Time:   2009-08-27 11:32:25.003 -0700
OS Version:  Mac OS X 10.5.8 (9L30)
Report Version:  6
Anonymous UUID:

Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0001, 0x90d5c02c
Crashed Thread:  6

Thread 0:
0   libSystem.B.dylib   0x95ece1f8 mach_msg_trap + 8
1   libSystem.B.dylib   0x95ed511c mach_msg + 56
2   com.apple.CoreFoundation  	0x90d61394 CFRunLoopRunSpecific +  
1812
3   com.apple.HIToolbox   	0x938a3b14  
RunCurrentEventLoopInMode + 264
4   com.apple.HIToolbox   	0x938a3938 ReceiveNextEventCommon +  
412
5   com.apple.HIToolbox   	0x938ead04  
IsUserStillTracking(MenuSelectData*, unsigned char*) + 472
6   com.apple.HIToolbox   	0x938d47a0  
TrackMenuCommon(MenuSelectData&, unsigned char*) + 3180
7   com.apple.HIToolbox   	0x938cf854  
MenuSelectCore(MenuData*, Point, double, unsigned long,  
OpaqueMenuRef**, unsigned short*) + 228
8   com.apple.HIToolbox   	0x938cf3bc _HandleMenuSelection2 +  
388
9   com.apple.AppKit  	0x93147c54 _NSHandleCarbonMenuEvent  
+ 188

10  com.apple.AppKit0x930bd728 _DPSNextEvent + 1848
11  com.apple.AppKit  	0x930bcbfc -[NSApplication  
nextEventMatchingMask:untilDate:inMode:dequeue:] + 112

12  com.apple.AppKit0x930b689c -[NSApplication run] + 744
13  com.apple.AppKit0x93087298 NSApplicationMain + 440
14  uk.co.markallan.myapp   0x27f8 _start + 756
15  uk.co.markallan.myapp   0x24fc start + 44

Thread 1:
0   libSystem.B.dylib 	0x95ece278  
semaphore_timedwait_signal_trap + 8

1   libSystem.B.dylib   0x95f11368 _pthread_cond_wait + 1320
2   com.apple.Foundation  	0x9037f1a0 -[NSCondition  
waitUntilDate:] + 384
3   com.apple.Foundation  	0x9037efcc -[NSConditionLock  
lockWhenCondition:beforeDate:] + 268
4   com.apple.AppKit  	0x931189cc -[NSUIHeartBeat  
_heartBeatThread:] + 664

5   com.apple.Foundation0x90341d84 __NSThread__main__ + 1004
6   libSystem.B.dylib   0x95f100c4 _pthread_start + 316

Thread 2:
0   libSystem.B.dylib   0x95ece1f8 mach_msg_trap + 8
1   libSystem.B.dylib   0x95ed511c mach_msg + 56
2   com.apple.CoreFoundation  	0x90d61394 CFRunLoopRunSpecific +  
1812
3   com.apple.Foundation  	0x90398d50 + 
[NSURLConnection(NSURLConnectionReallyInternal) _resourceLoadLoop:] +  
280

4   com.apple.Foundation0x90341d84 __NSThread__main__ + 1004
5   libSystem.B.dylib   0x95f100c4 _pthread_start + 316

Thread 3:
0   libSystem.B.dylib   0x95ece1f8 mach_msg_trap + 8
1   libSystem.B.dylib   0x95ed511c mach_msg + 56
2   com.apple.CoreFoundation  	0x90d61394 CFRunLoopRunSpecific +  
1812
3   com.apple.CFNetwork   	0x94de63b0  
CFURLCacheWorkerThread(void*) + 288

4   libSystem.B.dylib   0x95f100c4 _pthread_start + 316

Thread 4:
0   libSystem.B.dylib   0x95f31d74 select$DARWIN_EXTSN + 12
1   com.apple.CoreFoundation0x90d6c808 __CFSocketManager + 764

Thread 5:
0   libSystem.B.dylib   0x95f0f904 kevent + 12
1   com.apple.CoreFoundation  	0x90d38a48  
__monitor_file_descriptor__ + 240


Thread 6

Re: NSBundle from an URL.

2009-09-03 Thread Randall Meadows

On Sep 3, 2009, at 4:36 PM, Erik Österlund wrote:

2009-09-04 00:33:52.657 TestClient[90551:a0f] An uncaught exception  
was raised
2009-09-04 00:33:52.659 TestClient[90551:a0f] *** -[NSBundle  
initWithURL:]: non-file URL argument
2009-09-04 00:33:52.663 TestClient[90551:a0f] *** Terminating app  
due to uncaught exception 'NSInvalidArgumentException', reason: '***  
-[NSBundle initWithURL:]: non-file URL argument'


It doesn't seem to like the fact that the bundle URL is a directory,  
but what else would it be?!

(and yes I have a webserver, and yes the URL is correct)


Well, that may be a "correct" URL, but it is not a "file" URL, which  
the exception is all about.


I think you need the URL to be of the form 
"file://...".___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: NSBundle from an URL.

2009-09-03 Thread Ken Thomases

On Sep 3, 2009, at 5:36 PM, Erik Österlund wrote:

I just wanted to check out NSBundle's + bundleFromURL. I looked in  
the documentation and said nothing about only some protocols  
working, so I thought I could load a bundle via HTTP which would be  
awesome, but that seemed to fail. Is this a bug, or am I being stupid?


Here is my code:

#import 

int main(int argc, char *argv[])
{
   NSAutoreleasePool* pool = [NSAutoreleasePool new];
   [NSApplication sharedApplication];
   NSURL* url = [NSURL URLWithString:@"http://localhost/TestServer2.bundle 
"];

   NSBundle* bundle = [NSBundle bundleWithURL:url];
   NSString* nib = [bundle  
objectForInfoDictionaryKey:@"NSMainNibFile"];

   [NSBundle loadNibNamed:nib owner:NSApp];
   [NSApp run];
   [pool drain];
   return 0;
}

and here are my errors:

2009-09-04 00:33:52.657 TestClient[90551:a0f] An uncaught exception  
was raised
2009-09-04 00:33:52.659 TestClient[90551:a0f] *** -[NSBundle  
initWithURL:]: non-file URL argument
2009-09-04 00:33:52.663 TestClient[90551:a0f] *** Terminating app  
due to uncaught exception 'NSInvalidArgumentException', reason: '***  
-[NSBundle initWithURL:]: non-file URL argument'


It doesn't seem to like the fact that the bundle URL is a directory,  
but what else would it be?!

(and yes I have a webserver, and yes the URL is correct)


It's not complaining that the item is not a file (e.g. a directory).   
It's complaining that the URL is not a file scheme URL.


It seems strange that you didn't recognize this, since this was  
exactly what you were testing.


Regards,
Ken

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: change in launch services binding behavior?

2009-09-03 Thread Gregory Weston

Matt Neuburg wrote:

I wonder whether someone (preferably from Apple) could provide  
details on
how Snow Leopard has changed its algorithm for how a document is  
bound to an

application, esp. when double-clicking the doc in the Finder.


I've done a little bit of experimenting on that a couple of days ago,  
after someone at Adobe asserted that 10.6 doesn't support creator  
codes. There's certainly been some shuffling of priorities. Barring  
explicit association, it seems to prefer the app defined for a given  
extension and then the app defined for the type metadata. The creator  
code is recognized, in my experiments, if both of those are absent but  
not reliably respected. For example I created an empty file with the  
creator code for Graphic Converter and no type or extension. When I  
looked at the Get Info window it said it was going to open in  
TextEdit, but when I popped up the menu it listed Graphic Converter  
with an annotation that it was the default. It lied; TextEdit was  
launched when I double-clicked. I consider that discrepancy a Finder  
bug, even if the shuffled priorities are intentional.


G
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: Crash in CFRunLoopWakeUp

2009-09-03 Thread Greg Parker

On Sep 3, 2009, at 3:41 PM, Mark Allan wrote:
I've been battling with this intermittent crash for about two weeks  
now and can't figure it out for the life of me.  I've got try/catch  
blocks around nearly all my code, and definitely around any code  
which runs in a separate thread, but it's not catching whatever  
causes this crash.  Also, I'm not even convinced it's my threads  
causing the crash as this one happened while a modal sheet was being  
displayed, before any of my external threads got started.


Exception Type:  EXC_BREAKPOINT (SIGTRAP)
Exception Codes: 0x0001, 0x90d5c02c
Crashed Thread:  6

Thread 6 Crashed:
0   com.apple.CoreFoundation0x90d5c02c CFRunLoopWakeUp + 156
1   com.apple.Foundation  	0x903ad0e4 _backgroundActivity +  
440


EXC_BREAKPOINT means the process deliberately killed itself (including  
`int3` on i386, `trap` on ppc, `__builtin_trap()` in gcc). In the case  
of CFRunLoopWakeUp(), it's halting because it tried and failed to send  
a Mach message to that run loop. Most likely this means the target run  
loop has already been deleted, but other Mach messaging problems are  
possible.


_backgroundActivity is part of NSFileHandle, to perform things like - 
readInBackgroundAndNotify. Perhaps there's bad memory management of an  
NSFileHandle somewhere.



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


___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Binding table columns that change at runtime

2009-09-03 Thread BareFeet

Hi all,

I'm fairly comfortable with setting up bindings for table columns to  
an NSArrayController. Now I'd like to use bindings where the columns  
change at runtime. Is this possible? I am avoiding using CoreData (so  
I can run on Mac OS X 10.3 ish and upwards).


Any help appreciated.

Thanks,
Tom
BareFeet

___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


Re: hud panel possible bug?

2009-09-03 Thread Rick C.
sure thing corbin thanks!

rick






From: Corbin Dunn 
To: Rick C. 
Cc: cocoa dev 
Sent: Thursday, September 3, 2009 10:14:28 PM
Subject: Re: hud panel possible bug?

Hi Rick,

On Sep 3, 2009, at 5:49 AM, Rick C. wrote:

> hello again,
> 
> i have noticed in snow leopard only if you are using the standard hud panel 
> in IB and you will run your project then taking the resize handle of the 
> panel and drag it down and away quickly it will create vertical lines at the 
> top part of the panel.  i have noticed this even in a new project that 
> doesn't yet have code and just simulating in IB.  If you will resize your 
> panel out slowly they don't appear but if you will drag your panel out 
> quickly they will.  anyone experience this?

Please log a bug on this issue:

http://developer.apple.com/bugReporter/

corbin



  
___

Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

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

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


  1   2   >