Re: Stealing settings from Mail.app

2010-05-30 Thread Jn
Would you have the API code to retrieve it?  Not sure what to pass to get the 
mobile me password.

--
Chris

On 31/05/2010, at 2:43 AM, Jens Alfke  wrote:


On May 30, 2010, at 12:55 AM, Chris Idou wrote:

OK, I see. So is Mobile-Me the only special case, or is there a more general 
rule about other places to find smtp server passwords?

AFAIK it’s the only special case. In general, an SMTP server’s password is 
stored under that server name in the keychain, as you’d expect.

—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: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Markus Spoettl
On May 31, 2010, at 12:46 AM, Quincey Morris wrote:
> Your two proposals are both viable, and, in fact, neither of these solutions 
> violates the MVC paradigm in any way. The property that you create doesn't 
> add any knowledge of the actual UI to your data model, nor does it establish 
> any special or privileged line of communication between the model and the 
> view. It's just a property of the model -- "a color suitable for representing 
> the current state of this object" -- that's available to any "client" of the 
> model for whatever purpose. The returned color could (for example) be used as 
> a key to a NSDictionary, if that happened to be useful somewhere else in the 
> application.
> 
> If having a color property is nevertheless distasteful, solution (a) is an 
> equally valid alternative.


While that is all true it still adds a property to the model that only is 
necessary because someone would like to display an certain aspect of it in a 
some way.

That way it makes a connection of the model to a potential method of 
visualization. And that - in my opinion - generally* is the purpose of a view 
or controller (or maybe a category on the original class).

As I said I'm happy to give up that position when there's need for it, but I 
feel guilty all the time :)

Regards
Markus

(*) All kinds of exceptions apply.
--
__
Markus Spoettl

___

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

Please do not post admin requests or moderator comments to the list.
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: Notification of file system modification arrives too early?

2010-05-30 Thread James Bucanek
Jens Alfke  wrote (Sunday, May 30, 
2010 9:51 AM

-0700):


On May 30, 2010, at 7:57 AM, James Bucanek wrote:


When a change occurs, I attempt to open the file using the FS API specifying
exclusive read + exclusive write access. If it fails, it's

likely because some other process still has the file open. I delay a half
second or so and try again.

That sounds like a good approach, but it’s not 100% reliable. If the creating
process opened the file without requesting an exclusive lock, then your open
call will succeed even though the file is still open.


It isn't 100%, but not for that reason. When you call FSOpenFork 
and specify fsWrDenyPerm, it will fail if another process 
currently has that fork open for writing. The other process does 
not have to request exclusive write access, just write access, 
which is probably the case for a file that's being written. From 
the API docs for fsWrDenyPerm: "... the path cannot be opened if 
you request deny-write permission, but some other path already 
has write access."


It isn't "100%" because not all volumes support deny-read and 
deny-write modes. See bHasOpenDeny.


--
James Bucanek

___

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

Please do not post admin requests or moderator comments to the list.
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: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Quincey Morris
On May 30, 2010, at 18:11, Markus Spoettl wrote:

> What I usually do in such situations is create an artificial property on the 
> model object that combines the state of multiple properties into one value. 
> In your case that properties could return 
> 
> (a) another value that you transform into a color or 
> 
> (b) it could return the color directly. 
> 
> I know that violates the MVC paradigm, but it's a very simple and efficient 
> solution - meaning least amount of code necessary.

Your two proposals are both viable, and, in fact, neither of these solutions 
violates the MVC paradigm in any way. The property that you create doesn't add 
any knowledge of the actual UI to your data model, nor does it establish any 
special or privileged line of communication between the model and the view. 
It's just a property of the model -- "a color suitable for representing the 
current state of this object" -- that's available to any "client" of the model 
for whatever purpose. The returned color could (for example) be used as a key 
to a NSDictionary, if that happened to be useful somewhere else in the 
application.

If having a color property is nevertheless distasteful, solution (a) is an 
equally valid alternative.


___

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

Please do not post admin requests or moderator comments to the list.
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: Notification of file system modification arrives too early?

2010-05-30 Thread Dave Keck
> Unfortunately you probably can’t do any better than that, since there’s no
cheap way to find out if another process has the file open.

proc_listpidspath() is meant for this, but it is indeed quite expensive. In
my testing, it takes about a second to complete this call; furthermore, its
status as a supported API is unclear. Nonetheless, here's some
somewhat-tested code of how to use it:

==

#import 

- (NSSet *)pidsAccessingPath: (NSString *)path
{

const char *pathFileSystemRepresentation = nil;
int listpidspathResult = 0;
size_t pidsSize = 0;
pid_t *pids = nil;
NSUInteger pidsCount = 0,
   i = 0;
NSMutableSet *result = nil;

NSParameterAssert(path && [path length]);

pathFileSystemRepresentation = [path GCSafeFileSystemRepresentation];
listpidspathResult = proc_listpidspath(PROC_ALL_PIDS, 0,
pathFileSystemRepresentation, PROC_LISTPIDSPATH_EXCLUDE_EVTONLY, nil, 0);

ALAssertOrPerform(listpidspathResult >= 0, goto cleanup);

pidsSize = (listpidspathResult ? listpidspathResult : 1);
pids = malloc(pidsSize);

ALAssertOrPerform(pids, goto cleanup);

listpidspathResult = proc_listpidspath(PROC_ALL_PIDS, 0,
pathFileSystemRepresentation, PROC_LISTPIDSPATH_EXCLUDE_EVTONLY, pids,
pidsSize);

ALAssertOrPerform(listpidspathResult >= 0, goto cleanup);

pidsCount = (listpidspathResult / sizeof(*pids));
result = [NSMutableSet set];

for (i = 0; i < pidsCount; i++)
[result addObject: [NSNumber numberWithInt: pids[i]]];

cleanup:
{

if (pids)
free(pids),
pids = nil;

}

return result;

}
___

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

Please do not post admin requests or moderator comments to the list.
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: Which color space?

2010-05-30 Thread Seth Willits
On May 29, 2010, at 7:09 AM, Simon Raisin wrote:

> I would like to create an 8-bit grayscale image but I cannot find a color
> space that uses only 1 8-bit value per pixel.  Everything seems to either be
> RGB, RGBA, or one color *plus* an alpha channel.


NSCalibratedWhiteColorSpace / NSDeviceWhiteColorSpace


--
Seth Willits



___

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

Please do not post admin requests or moderator comments to the list.
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


ANN: Accessorizer 2.0 released - Configuration Sets, custom formatting ... more intelligent view detection

2010-05-30 Thread Kevin Callahan
Accessorizer 2.0 is now available.

Update includes a flexible Configuration Sets panel allowing you to save, load 
and export configuration files from project to project or client to client; 
custom formatting for @property statements independent of your formatting for 
methods and explicit accessors; more intelligent view detection; new custom 
pragma marks panel;  more smarts when overriding accessors for classes that 
conform to NSCopying and NSMutableCopying protocols, plus numerous other 
enhancements.

Main page:  http://www.kevincallahan.org/software/accessorizer.html

What's New: http://www.kevincallahan.org/software/whatsNew.html
(if you plan to use Configuration Sets, the What's new and the new QuickStart 
Guide 2 will get you started)

*** Big thanks to many members on this list for suggesting features and 
providing feedback during implementation.

-Kevin Callahan
http://www.kevincallahan.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


Re: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Markus Spoettl
On May 30, 2010, at 3:51 PM, Mikael Wämundson wrote:
> I want to set the color of the text in each line in a TableView depending on 
> two attributes of the object: one boolean and one integer. If the boolean is 
> true all text for that line in the TableView is to be colored blue, if the 
> integer is zero all text is to be colored red.
> In IB i've bound the TableColumns Text Color using the boolean as Model Key 
> Path and a Value Transformer setting the text color to blue.
> 
> Now, how do I setup a Value Transformer bound to the integer attribute and a 
> Value Transformer?


I don't think you can solve this with just one value transformer because you 
have multiple values influencing the outcome. What I usually do in such 
situations is create an artificial property on the model object that combines 
the state of multiple properties into one value. In your case that properties 
could return 

(a) another value that you transform into a color or 

(b) it could return the color directly. 

I know that violates the MVC paradigm, but it's a very simple and efficient 
solution - meaning least amount of code necessary. If you absolutely must 
maintain MVC you could create a proxy object that replicates all your model 
objects' properties + the calculated properties for display. Then you fill the 
table with proxies instead of the original objects.

Regards
Markus
--
__
Markus Spoettl

___

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

Please do not post admin requests or moderator comments to the list.
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: NSFormatter: get default values

2010-05-30 Thread Graham Cox
I think the problem is that collection views make a copy of the 'prototype' 
view for each view they create. They do this using archiving/dearchiving, and 
they have no way to make connections of the sort you've made because they are 
application dependent.

Have a look and see if there is a hook you can use to manually remake the 
connection as each view instance comes into being.

Otherwise you could change your design a bit. For example, I have a class of 
formatter that scales its values according to a scaling factor set in each 
document. Each formatter instance picks up this common setting from a class 
variable in its own class, and as each document is activated and deactivated, 
it sets the appropriate class-level value. That way each formatter doesn't need 
to know about documents, only its own class. The only gotcha with this is that 
when the class setting changes it needs to tell the formatters to refresh, 
which is awkward as they are not views and do not have a connection to the view 
they're attached to. So I added a back-connection to the immediate textfield to 
deal with that - that connection should be OK as it's internal to the copied 
collection view instance.

--Graham


On 31/05/2010, at 9:45 AM, Rainer Standke wrote:

> Hello,
> 
> I have a custom formatter that needs to to look up a default value based on 
> the current document. The textfield the formatter sits on is part of a 
> collection view. In the nib the formatter has a connection (via IBOutlet) to 
> the object that holds the value that is to be looked up. The problem is that 
> the formatter instances that belong to the collection view instances don't 
> connect to anything. 
> 
> How can I get around this? I guess a solution could be either be in the 
> formatter, where I have no idea what to do with it, or with the the message 
> flow from the collectionviewitem to the document.
> 
> Any help would be appreciated.
> 
> Rainer
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/graham.cox%40bigpond.com
> 
> This email sent to graham@bigpond.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: UTI strings

2010-05-30 Thread John Joyce

On May 30, 2010, at 5:15 PM, julius wrote:

> John hi
> On 30 May 2010, at 19:47, John Joyce wrote:
> 
>> That's not how these constants work.
>> These are intended to be constants that return the correct type for the 
>> current build of the system.
>> This protects your software from a change in the actual UTI of a common type.
>> 
> 
> I can understand the use of constants to such a purpose. 
> Hence for instance my ability to write a file as NSRTFTextDocumentType when 
> in the Save panel I have opted to save it as com.apple.rtfd or as a document 
> having no UTI at all.
> 
> If I read a document for which I have declared no UTI then the ofType 
> parameter in the readFromData:ofType:error: displays the Name I have used to 
> describe that document type. On the other hand if I have used a UTI then it 
> is the UTI that is passed as the ofType parameter.
> 
> So if I have this correctly, in the case of files that will only ever be read 
> by my application it really does not matter what extension or UTI I give them 
> since it is the responsibility of my code to make sense of them. However, if 
> I want to  write files that other applications can read I have not only to 
> provide the correct format but also the correct extension or UTI . Is it 
> therefore the case that when writing files to be read by other applications I 
> need not only write using the correct NSDocumentTypeDocumentAttribute but 
> also provide the correct UTI (or extension)? If so then surely I need to have 
> an idea of which UTI's (if any) go with a given 
> NSDocumentTypeDocumentAttribute?
> 
> Thanks
> Julius
> 
> 
> http://juliuspaintings.co.uk
> 
Your application declares the types of files it can read and/or edit. 
It declares these types by UTI.

If an application declares that it can read files of type x, then you can 
definitely open files of type x with that application.

Not all UTIs are built in the OS. 
They're "registered" with the OS.
The OS does not know about many (most?) file types out of the box.

The OS can attempt to identify a file's type.
It doesn't always know 100% what app should or could open a file or edit it.
It will then give you a choice of "Recommended applications", that is, apps 
that are declared to read or edit a file of the UTI that the OS thinks this 
file might be. The OS does allow the user to choose from "All Applications" 
also, because the OS cannot realistically know about all file types ahead of 
time.

This data is covered, but you may want to explore further the docs, a few books 
on cocoa, and sample apps from apple.
Look at how they handle this.
Ideally, look at open source or sample apps that handle similar file types to 
yours.

___

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

Please do not post admin requests or moderator comments to the list.
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: posted notifications are sent twice

2010-05-30 Thread Reinhard Segeler
Thank you for that advice. But that was not the problem.

-- Reinhard

2010/5/31 Greg Guerin 

> Reinhard Segeler wrote:
>
>  I post notifications to interchange infos between classes. They are always
>> posted twice, even though they are surely only posted once. Does anybody
>> know why?
>>
>
>
> Make sure you haven't registered two listeners, or a single listener twice.
>
>  -- 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/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: NSFormatter: get default values

2010-05-30 Thread Reinhard Segeler
It's not clear, waht you mean. A formatter is a formatter, that does  
not contain values on itself. Or do you mean with "value" the format  
to use?


-- Reinhard 

Am 31.05.2010 um 01:45 schrieb Rainer Standke:


Hello,

I have a custom formatter that needs to to look up a default value  
based on the current document. The textfield the formatter sits on  
is part of a collection view. In the nib the formatter has a  
connection (via IBOutlet) to the object that holds the value that is  
to be looked up. The problem is that the formatter instances that  
belong to the collection view instances don't connect to anything.


How can I get around this? I guess a solution could be either be in  
the formatter, where I have no idea what to do with it, or with the  
the message flow from the collectionviewitem to the document.


Any help would be appreciated.

Rainer



___

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

Please do not post admin requests or moderator comments to the list.
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: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Reinhard Segeler
Okay. I usually create a new class and copy the code (.h, .m) from  
another NSConversion Class.


- (id)transformedValue:(id)value
{
// You should this code, because this assures that you are feeding the  
desired NSObject - here an NSNumber and is independent from your  
returned value, because your method uses (id)

if ( value == nil )
{
return @"Not defined";
}
if (![ value respondsToSelector: @selector(integerValue)] )
{
[NSException raise: NSInternalInconsistencyException
format: @"Value does not respond to - 
integerValue.  No idea what to do. (Value is an instance of %@).",

 [value class]];
}
// this assures that you are using the desired values - end comment

// add here your code that "knows" which color to use.
// Don't forget to set up in IB the new class name for the desired  
column(s)
// You must return an NSNumber object NOT the integer itself, if you  
return an integer, but in your case return the NSColor, of course!

// That's all.

}

-- Reinhard 

Am 31.05.2010 um 00:27 schrieb Mikael Wämundson:


- (id)transformedValue:(id)value
{   
BOOL theBoolean = [value boolValue];

   if (theBoolean) {
return [NSColor blueColor];
   }
   return [NSColor blackColor];
}


___

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

Please do not post admin requests or moderator comments to the list.
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


NSFormatter: get default values

2010-05-30 Thread Rainer Standke
Hello,

I have a custom formatter that needs to to look up a default value based on the 
current document. The textfield the formatter sits on is part of a collection 
view. In the nib the formatter has a connection (via IBOutlet) to the object 
that holds the value that is to be looked up. The problem is that the formatter 
instances that belong to the collection view instances don't connect to 
anything. 

How can I get around this? I guess a solution could be either be in the 
formatter, where I have no idea what to do with it, or with the the message 
flow from the collectionviewitem to the document.

Any help would be appreciated.

Rainer
 


___

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

Please do not post admin requests or moderator comments to the list.
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: posted notifications are sent twice

2010-05-30 Thread Reinhard Segeler

Hi Nick,

thank you very much. Your answer helped immediately. I initialized the  
responsible class in my code and added it later to a nib file, that  
was loaded also later...


Thanks

--  Reinhard

Am 30.05.2010 um 23:34 schrieb Nick Zitzmann:



On May 30, 2010, at 3:19 PM, Reinhard Segeler wrote:

I post notifications to interchange infos between classes. They are  
always
posted twice, even though they are surely only posted once. Does  
anybody

know why?


What do you mean by "posted twice"? Is the debugger breaking twice  
on the same observer after the notification is posted? If so, are  
you sure the object is the same twice ("self" has the same address  
when both breakpoints are hit)?


Nick Zitzmann






___

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

Please do not post admin requests or moderator comments to the list.
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: Which color space?

2010-05-30 Thread Steve Christensen
Is either NSCalibratedWhiteColorSpace or NSDeviceWhiteColorSpace not  
working for you?


Also, just a style note, but you don't need to cast every parameter  
passed to a function; the compiler typically figures that out. The  
only time you really need to do it is if there could be confusion of  
type or if you're specifically changing the type, e.g., malloc'd  
memory (void*) passed to something looking for a char*; in either case  
the compiler is typically good enough to let you know something's amiss.



On May 29, 2010, at 7:09 AM, Simon Raisin wrote:

I would like to create an 8-bit grayscale image but I cannot find a  
color
space that uses only 1 8-bit value per pixel.  Everything seems to  
either be

RGB, RGBA, or one color *plus* an alpha channel.

Am I going about this the wrong way?

Thank you in advance,
Simon

   NSBitmapImageRep* outputImageRep = [[NSBitmapImageRep alloc]
initWithBitmapDataPlanes: 
(unsigned char **)NULL
pixelsWide:(int) 
[inputImageRep pixelsWide]
pixelsHigh:(int) 
[inputImageRep pixelsHigh]

bitsPerSample:(int)8
samplesPerPixel:(int)1
hasAlpha:(BOOL)NO
isPlanar:(BOOL)NO
colorSpaceName:(NSString  
*) ??? ***???
bytesPerRow:(int) 
([inputImageRep pixelsWide] * sizeof(unsigned char))

bitsPerPixel:(int)0];


___

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

Please do not post admin requests or moderator comments to the list.
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: posted notifications are sent twice

2010-05-30 Thread Greg Guerin

Reinhard Segeler wrote:

I post notifications to interchange infos between classes. They are  
always
posted twice, even though they are surely only posted once. Does  
anybody

know why?



Make sure you haven't registered two listeners, or a single listener  
twice.


  -- GG

___

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

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

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

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


Re: Notification of file system modification arrives too early?

2010-05-30 Thread Antonio Nunes

On 30 May 2010, at 17:51, Jens Alfke wrote:

>> When a change occurs, I attempt to open the file using the FS API specifying 
>> exclusive read + exclusive write access. If it fails, it's likely because 
>> some other process still has the file open. I delay a half second or so and 
>> try again.
> 
> That sounds like a good approach, but it’s not 100% reliable. If the creating 
> process opened the file without requesting an exclusive lock, then your open 
> call will succeed even though the file is still open. 
> 
> Unfortunately you probably can’t do any better than that, since there’s no 
> cheap way to find out if another process has the file open.

Thanks guys, that makes it sound like my previously mentioned 
solution/work-around of trying to create a PDFDocument from the URL is the 
safest solution. The attempt will fail until the file has been fully written, 
and I only need to read the data, not write to it. Also, as far as I can tell, 
reading a PDFDocument with initWithURL: (and immediately discarding it if it 
succeeds) is a fairly cheap operation.

António

-
Forgiveness is not an occasional act;
it is a permanent attitude.

--Martin Luther King, Jr
-




___

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

Please do not post admin requests or moderator comments to the list.
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: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Mikael Wämundson
Yes, this is my implementation:

@implementation TextColorValueTransformer

+ (Class)transformedValueClass
{
return [NSColor class];
}

+ (BOOL)allowsReverseTransformation
{
return NO;
}

- (id)transformedValue:(id)value
{   
BOOL theBoolean = [value boolValue];

if (theBoolean) {
return [NSColor blueColor];
}
return [NSColor blackColor];
}

@end

30 maj 2010 kl. 23.13 skrev Reinhard Segeler:

> Did you subclass the NSValueTransformer class for that purpose?
> 
> 
> -- Reinhard   
> 
> Am 30.05.2010 um 21:51 schrieb Mikael Wämundson:
> 
>> Hi,
>> 
>> Problem is the following:
>> I want to set the color of the text in each line in a TableView depending on 
>> two attributes of the object: one boolean and one integer. If the boolean is 
>> true all text for that line in the TableView is to be colored blue, if the 
>> integer is zero all text is to be colored red.
>> In IB i've bound the TableColumns Text Color using the boolean as Model Key 
>> Path and a Value Transformer setting the text color to blue.
>> 
>> Now, how do I setup a Value Transformer bound to the integer attribute and a 
>> Value Transformer?
>> 
>> Thank you!
>> /Mikael
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> 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


Fwd: UIView retain past drawing?

2010-05-30 Thread Brad Garton
To answer my own question:  draw to a bitmap offscreen, and then draw that into 
the UIView rect.  The bitmap isn't cleared (unless done explicitly).

brad
http://music.columbia.edu/~brad


On May 30, 2010, at 2:36 PM, Brad Garton wrote:

> Hello cocoa-dev list:
> 
> My apologies if this is incorrect and/or totally misinformed for this list, 
> but I seem to be missing something obvious.  In my application I've 
> subclassed UIView and use the -drawRect:/-setNeedsDisplay approach to draw 
> lines into the view.  Is there a way to set up the drawing such that it adds 
> to the existing image instead of redrawing all of it?  For example, if I 
> generate a random line in each -setNeedsDisplay invocation of -drawRect, I'd 
> like to retain in the resulting image the lines previously drawn.
> 
> thanks--
> 
> brad
> http://music.columbia/edu/~brad
> 


___

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

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

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

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


UIView retain past drawing?

2010-05-30 Thread Brad Garton
Hello cocoa-dev list:

My apologies if this is incorrect and/or totally misinformed for this list, but 
I seem to be missing something obvious.  In my application I've subclassed 
UIView and use the -drawRect:/-setNeedsDisplay approach to draw lines into the 
view.  Is there a way to set up the drawing such that it adds to the existing 
image instead of redrawing all of it?  For example, if I generate a random line 
in each -setNeedsDisplay invocation of -drawRect, I'd like to retain in the 
resulting image the lines previously drawn.

thanks--

brad
http://music.columbia/edu/~brad

___

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

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

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

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


Which color space?

2010-05-30 Thread Simon Raisin
I would like to create an 8-bit grayscale image but I cannot find a color
space that uses only 1 8-bit value per pixel.  Everything seems to either be
RGB, RGBA, or one color *plus* an alpha channel.

Am I going about this the wrong way?

Thank you in advance,
Simon

NSBitmapImageRep* outputImageRep = [[NSBitmapImageRep alloc]

initWithBitmapDataPlanes:(unsigned
char **)NULL

pixelsWide:(int)[inputImageRep
pixelsWide]

pixelsHigh:(int)[inputImageRep
pixelsHigh]

bitsPerSample:(int)8

samplesPerPixel:(int)1

hasAlpha:(BOOL)NO

isPlanar:(BOOL)NO

colorSpaceName:(NSString *) ??? ***
???

bytesPerRow:(int)([inputImageRep
pixelsWide] * sizeof(unsigned char))

bitsPerPixel:(int)0];
___

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

Please do not post admin requests or moderator comments to the list.
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


kCGLCPSurfaceBackingSize and enterFullScreenMode:withOptions:

2010-05-30 Thread Martin Plicht
Hi,

I have a custom NSView that manages an NSOpenGLContext. From the window 
controller I use the following code to switch to fullscreen mode:

// let opengl view enter fullscreen mode
CGDisplayFadeReservationToken token;
[self fadeOut:&token];
[openGLView enterFullScreenMode:[self.window screen] 
withOptions:[NSDictionary dictionary]];
[openGLView.window setDelegate:self];
[openGLView enableEvents];

[openGLView display];
[NSCursor hide]; // hide completely
[self fadeIn:token];

// enable custom backing store size
NSOpenGLContext* fullscreenContext = 
pGL->GetMainCtx()->GetCocoaContext();
GLint dim[2] = {Config.Graphics.ResX, 
Config.Graphics.ResY};
CGLSetParameter((CGLContextObj)[fullscreenContext 
CGLContextObj], kCGLCPSurfaceBackingSize, dim);
CGLEnable((CGLContextObj)[fullscreenContext 
CGLContextObj], kCGLCESurfaceBackingSize);

This works on an iMac7,1 with an ATI Radeon HD 2600 but fails to work on a 
Macbook Pro7,1 13inch with an Nvidia Geforce 320M. The Macbook screen just 
stays grey without OpenGL commands getting to it. So, is there any better way 
preferably using Cocoa APIs to activate a custom backing store 
size?___

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

Please do not post admin requests or moderator comments to the list.
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: UTI strings

2010-05-30 Thread julius
Ken hi,
thanks for responding.
On 30 May 2010, at 20:21, Ken Thomases wrote:

> On May 30, 2010, at 1:04 PM, julius wrote:
> 
>> unless of course there's a way of specifying the constants for 
>> NSAttributedString using the kUTTypes that I've not found yet
> 
> The Snow Leopard AppKit release notes 
>  
> include this:
> 
>> NSAttributedString Constants
>> 
>> The existing NSDocumentTypeDocumentAttribute and 
>> NSDocumentTypeDocumentOption express document types in terms of a set of 
>> constants particular to NSAttributedString. In Snow Leopard, there are new 
>> constants, NSFileTypeDocumentAttribute and NSFileTypeDocumentOption, that 
>> express the same information in terms of system-wide UTIs. Where these are 
>> used for output, in expressing the type of a document that has been read, 
>> both file type and document type will be provided; as input, however, when 
>> indicating the type to be written or the type to be forced on loading, the 
>> two are mutually exclusive.
> 
I'm sorry but I've read and re-read this paragraph, in the original, a number 
of times including the relevant NSFileAttributeOption and 
NSFileTypeDocumentAttribute entries in NSAttributedString application kit 
additions reference and can't make head or tail of what is being talked about. 
Maybe it's something to do with the grammar. For me it does not parse.
http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/Reference/Reference.html#//apple_ref/doc/c_ref/NSFileTypeDocumentOption

I am totally bemused.
Julius

> Cheers,
> Ken
> 

--
http://juliuspaintings.co.uk



___

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

Please do not post admin requests or moderator comments to the list.
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: UTI strings

2010-05-30 Thread julius
John hi
On 30 May 2010, at 19:47, John Joyce wrote:

> That's not how these constants work.
> These are intended to be constants that return the correct type for the 
> current build of the system.
> This protects your software from a change in the actual UTI of a common type.
> 

I can understand the use of constants to such a purpose. 
Hence for instance my ability to write a file as NSRTFTextDocumentType when in 
the Save panel I have opted to save it as com.apple.rtfd or as a document 
having no UTI at all.

If I read a document for which I have declared no UTI then the ofType parameter 
in the readFromData:ofType:error: displays the Name I have used to describe 
that document type. On the other hand if I have used a UTI then it is the UTI 
that is passed as the ofType parameter.

So if I have this correctly, in the case of files that will only ever be read 
by my application it really does not matter what extension or UTI I give them 
since it is the responsibility of my code to make sense of them. However, if I 
want to  write files that other applications can read I have not only to 
provide the correct format but also the correct extension or UTI . Is it 
therefore the case that when writing files to be read by other applications I 
need not only write using the correct NSDocumentTypeDocumentAttribute but also 
provide the correct UTI (or extension)? If so then surely I need to have an 
idea of which UTI's (if any) go with a given NSDocumentTypeDocumentAttribute?

Thanks
Julius


http://juliuspaintings.co.uk



___

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

Please do not post admin requests or moderator comments to the list.
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: posted notifications are sent twice

2010-05-30 Thread Nick Zitzmann

On May 30, 2010, at 3:19 PM, Reinhard Segeler wrote:

> I post notifications to interchange infos between classes. They are always
> posted twice, even though they are surely only posted once. Does anybody
> know why?

What do you mean by "posted twice"? Is the debugger breaking twice on the same 
observer after the notification is posted? If so, are you sure the object is 
the same twice ("self" has the same address when both breakpoints are hit)?

Nick Zitzmann




___

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

Please do not post admin requests or moderator comments to the list.
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


posted notifications are sent twice

2010-05-30 Thread Reinhard Segeler
I post notifications to interchange infos between classes. They are always
posted twice, even though they are surely only posted once. Does anybody
know why?

Thanks

--  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: Value Transformer with multiple Model Key Paths

2010-05-30 Thread Reinhard Segeler

 Did you subclass the NSValueTransformer class for that purpose?


-- Reinhard 

Am 30.05.2010 um 21:51 schrieb Mikael Wämundson:


Hi,

Problem is the following:
I want to set the color of the text in each line in a TableView  
depending on two attributes of the object: one boolean and one  
integer. If the boolean is true all text for that line in the  
TableView is to be colored blue, if the integer is zero all text is  
to be colored red.
In IB i've bound the TableColumns Text Color using the boolean as  
Model Key Path and a Value Transformer setting the text color to blue.


Now, how do I setup a Value Transformer bound to the integer  
attribute and a Value Transformer?


Thank you!
/Mikael

___

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

Please do not post admin requests or moderator comments to the list.
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


Value Transformer with multiple Model Key Paths

2010-05-30 Thread Mikael Wämundson
Hi,

Problem is the following:
I want to set the color of the text in each line in a TableView depending on 
two attributes of the object: one boolean and one integer. If the boolean is 
true all text for that line in the TableView is to be colored blue, if the 
integer is zero all text is to be colored red.
In IB i've bound the TableColumns Text Color using the boolean as Model Key 
Path and a Value Transformer setting the text color to blue.

Now, how do I setup a Value Transformer bound to the integer attribute and a 
Value Transformer?

Thank you!
/Mikael

___

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

Please do not post admin requests or moderator comments to the list.
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: UTI strings

2010-05-30 Thread Ken Thomases
On May 30, 2010, at 1:04 PM, julius wrote:

> unless of course there's a way of specifying the constants for 
> NSAttributedString using the kUTTypes that I've not found yet

The Snow Leopard AppKit release notes 
 include 
this:

> NSAttributedString Constants
> 
> The existing NSDocumentTypeDocumentAttribute and NSDocumentTypeDocumentOption 
> express document types in terms of a set of constants particular to 
> NSAttributedString. In Snow Leopard, there are new constants, 
> NSFileTypeDocumentAttribute and NSFileTypeDocumentOption, that express the 
> same information in terms of system-wide UTIs. Where these are used for 
> output, in expressing the type of a document that has been read, both file 
> type and document type will be provided; as input, however, when indicating 
> the type to be written or the type to be forced on loading, the two are 
> mutually exclusive.

Cheers,
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: UTI strings

2010-05-30 Thread John Joyce
That's not how these constants work.
These are intended to be constants that return the correct type for the current 
build of the system.
This protects your software from a change in the actual UTI of a common type.


On May 30, 2010, at 1:04 PM, julius wrote:

> Mike 
> Thanks, that's a great diagram but as far as I can see it's not the kUTTypes 
> that are for me the problem but rather just determining which UTI goes with 
> which of the 
> 
> NSPlainTextDocumentType
> NSRTFTextDocumentType
> NSRTFDTextDocumentType
> NSMacSimpleTextDocumentType
> NSHTMLTextDocumentType
> NSDocFormatTextDocumentType
> NSWordMLTextDocumentType
> NSOfficeOpenXMLTextDocumentType
> NSOpenDocumentTextDocumentType
> 
> unless of course there's a way of specifying the constants for 
> NSAttributedString using the kUTTypes that I've not found yet
> Thanks again
> Julius
> 
> 
> 
> 
> On 30 May 2010, at 18:33, Mike Abdullah wrote:
> 
>> This should give a decent overview of the main system types:
>> http://www.mikeabdullah.net/utis_diagram/
>> 
>> On 30 May 2010, at 17:47, julius wrote:
>> 
>>> Kyle Thanks
>>> 
>>> I'm obviously missing something, what type for instance maps onto 
>>> NSPlainTextDocumentType? 
>>> I'm currently working my way down the UTI list by a process of elimination, 
>>> i.e. put a UTI into the Info.plist then try to save a document as that type 
>>> and see if my choice of document type raises an error. But that's slow, e.g.
>>> 
>>> zDict = [NSDictionary 
>>> dictionaryWithObjectsAndKeys:NSRTFDTextDocumentType, 
>>> NSDocumentTypeDocumentAttribute, nil];
>>> NSData * zData = [self.nsTextStorageObj dataFromRange:zRange
>>>
>>> documentAttributes:zDict
>>> 
>>> error:outError];
>>> Julius
>>> 
>>> On 30 May 2010, at 17:29, Kyle Sluder wrote:
>>> 
 On Sun, May 30, 2010 at 9:22 AM, julius  
 wrote:
> I'm having difficulties finding the Uniform Type Identifier strings that 
> correspond to the document types associated with the 
> NSDocumentTypeDocumentAttribute key as specified in the 
> NSAttributedString Application Kit Additions Reference
 
 /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/UTCoreTypes.h
 
 --Kyle Sluder
>>> 
>>> --
>>> http://juliuspaintings.co.uk
>>> 
>>> 
>>> ___
>>> 
>>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>> 
>>> Please do not post admin requests or moderator comments to the list.
>>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>>> 
>>> Help/Unsubscribe/Update your Subscription:
>>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>>> 
>>> This email sent to cocoa...@mikeabdullah.net
>> 
> 
> --
> http://juliuspaintings.co.uk
> I'm looking for comments re: http://juliuspaintings.co.uk/physics-of-thought
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jjoyce%40apple.com
> 
> This email sent to jjo...@apple.com

___

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

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

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

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


Re: UTI strings

2010-05-30 Thread julius
Mike 
Thanks, that's a great diagram but as far as I can see it's not the kUTTypes 
that are for me the problem but rather just determining which UTI goes with 
which of the 

NSPlainTextDocumentType
NSRTFTextDocumentType
NSRTFDTextDocumentType
NSMacSimpleTextDocumentType
NSHTMLTextDocumentType
NSDocFormatTextDocumentType
NSWordMLTextDocumentType
NSOfficeOpenXMLTextDocumentType
NSOpenDocumentTextDocumentType

unless of course there's a way of specifying the constants for 
NSAttributedString using the kUTTypes that I've not found yet
Thanks again
Julius




On 30 May 2010, at 18:33, Mike Abdullah wrote:

> This should give a decent overview of the main system types:
> http://www.mikeabdullah.net/utis_diagram/
> 
> On 30 May 2010, at 17:47, julius wrote:
> 
>> Kyle Thanks
>> 
>> I'm obviously missing something, what type for instance maps onto 
>> NSPlainTextDocumentType? 
>> I'm currently working my way down the UTI list by a process of elimination, 
>> i.e. put a UTI into the Info.plist then try to save a document as that type 
>> and see if my choice of document type raises an error. But that's slow, e.g.
>> 
>>  zDict = [NSDictionary 
>> dictionaryWithObjectsAndKeys:NSRTFDTextDocumentType, 
>> NSDocumentTypeDocumentAttribute, nil];
>>  NSData * zData = [self.nsTextStorageObj dataFromRange:zRange
>> 
>> documentAttributes:zDict
>>  
>> error:outError];
>> Julius
>> 
>> On 30 May 2010, at 17:29, Kyle Sluder wrote:
>> 
>>> On Sun, May 30, 2010 at 9:22 AM, julius  
>>> wrote:
 I'm having difficulties finding the Uniform Type Identifier strings that 
 correspond to the document types associated with the 
 NSDocumentTypeDocumentAttribute key as specified in the NSAttributedString 
 Application Kit Additions Reference
>>> 
>>> /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/UTCoreTypes.h
>>> 
>>> --Kyle Sluder
>> 
>> --
>> http://juliuspaintings.co.uk
>> 
>> 
>> ___
>> 
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>> 
>> Please do not post admin requests or moderator comments to the list.
>> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>> 
>> Help/Unsubscribe/Update your Subscription:
>> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
>> 
>> This email sent to cocoa...@mikeabdullah.net
> 

--
http://juliuspaintings.co.uk
I'm looking for comments re: http://juliuspaintings.co.uk/physics-of-thought


___

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

Please do not post admin requests or moderator comments to the list.
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: UTI strings

2010-05-30 Thread Mike Abdullah
This should give a decent overview of the main system types:
http://www.mikeabdullah.net/utis_diagram/

On 30 May 2010, at 17:47, julius wrote:

> Kyle Thanks
> 
> I'm obviously missing something, what type for instance maps onto 
> NSPlainTextDocumentType? 
> I'm currently working my way down the UTI list by a process of elimination, 
> i.e. put a UTI into the Info.plist then try to save a document as that type 
> and see if my choice of document type raises an error. But that's slow, e.g.
> 
>   zDict = [NSDictionary 
> dictionaryWithObjectsAndKeys:NSRTFDTextDocumentType, 
> NSDocumentTypeDocumentAttribute, nil];
>   NSData * zData = [self.nsTextStorageObj dataFromRange:zRange
>  
> documentAttributes:zDict
>   
> error:outError];
> Julius
> 
> On 30 May 2010, at 17:29, Kyle Sluder wrote:
> 
>> On Sun, May 30, 2010 at 9:22 AM, julius  wrote:
>>> I'm having difficulties finding the Uniform Type Identifier strings that 
>>> correspond to the document types associated with the 
>>> NSDocumentTypeDocumentAttribute key as specified in the NSAttributedString 
>>> Application Kit Additions Reference
>> 
>> /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/UTCoreTypes.h
>> 
>> --Kyle Sluder
> 
> --
> http://juliuspaintings.co.uk
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
> 
> This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Re: Notification of file system modification arrives too early?

2010-05-30 Thread Jens Alfke

On May 30, 2010, at 7:57 AM, James Bucanek wrote:

> When a change occurs, I attempt to open the file using the FS API specifying 
> exclusive read + exclusive write access. If it fails, it's likely because 
> some other process still has the file open. I delay a half second or so and 
> try again.

That sounds like a good approach, but it’s not 100% reliable. If the creating 
process opened the file without requesting an exclusive lock, then your open 
call will succeed even though the file is still open. 

Unfortunately you probably can’t do any better than that, since there’s no 
cheap way to find out if another process has the file open.

—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: UTI strings

2010-05-30 Thread julius
Kyle Thanks

I'm obviously missing something, what type for instance maps onto 
NSPlainTextDocumentType? 
I'm currently working my way down the UTI list by a process of elimination, 
i.e. put a UTI into the Info.plist then try to save a document as that type and 
see if my choice of document type raises an error. But that's slow, e.g.

zDict = [NSDictionary 
dictionaryWithObjectsAndKeys:NSRTFDTextDocumentType, 
NSDocumentTypeDocumentAttribute, nil];
NSData * zData = [self.nsTextStorageObj dataFromRange:zRange
   
documentAttributes:zDict

error:outError];
Julius

On 30 May 2010, at 17:29, Kyle Sluder wrote:

> On Sun, May 30, 2010 at 9:22 AM, julius  wrote:
>> I'm having difficulties finding the Uniform Type Identifier strings that 
>> correspond to the document types associated with the 
>> NSDocumentTypeDocumentAttribute key as specified in the NSAttributedString 
>> Application Kit Additions Reference
> 
> /System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/UTCoreTypes.h
> 
> --Kyle Sluder

--
http://juliuspaintings.co.uk


___

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

Please do not post admin requests or moderator comments to the list.
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: Clicking links in webview does nothing

2010-05-30 Thread Jens Alfke

On May 30, 2010, at 5:00 AM, Nava Carmon wrote:

> I have a webView in my cocoa application. For some reason clicking on 
> hyperlinks there does nothing. I created it in IB and it loads and show the 
> remote html properly. When I roll over links, the cursor changes to hand, but 
> when i click on them nothing happens.

I’m guessing that the page’s HTML specifies that the links should open in a new 
window. The WebView can’t do that itself, so it calls a delegate method to tell 
you to create a new window. If you haven’t implemented that delegate method, 
nothing happens. I can’t remember offhand which of the many WebView delegate 
APIs it is; look through them in the reference and it should be pretty clear 
which one.

> Actually I'd like to open them in default browser window. What is the way to 
> do that?

It’s trivial: the delegate method will hand you an NSURL, so just tell 
NSWorkspace to open it for you.

—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: Stealing settings from Mail.app

2010-05-30 Thread Jens Alfke

On May 30, 2010, at 12:55 AM, Chris Idou wrote:

> OK, I see. So is Mobile-Me the only special case, or is there a more general 
> rule about other places to find smtp server passwords?

AFAIK it’s the only special case. In general, an SMTP server’s password is 
stored under that server name in the keychain, as you’d expect.

—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: UTI strings

2010-05-30 Thread Kyle Sluder
On Sun, May 30, 2010 at 9:22 AM, julius  wrote:
> I'm having difficulties finding the Uniform Type Identifier strings that 
> correspond to the document types associated with the 
> NSDocumentTypeDocumentAttribute key as specified in the NSAttributedString 
> Application Kit Additions Reference

/System/Library/Frameworks/CoreServices.framework/Frameworks/LaunchServices.framework/Headers/UTCoreTypes.h

--Kyle Sluder
___

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

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

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

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


UTI strings

2010-05-30 Thread julius
Hi
I'm having difficulties finding the Uniform Type Identifier strings that 
correspond to the document types associated with the 
NSDocumentTypeDocumentAttribute key as specified in the NSAttributedString 
Application Kit Additions Reference
http://developer.apple.com/Mac/library/documentation/Cocoa/Reference/ApplicationKit/Classes/NSAttributedString_AppKitAdditions/Reference/Reference.html#//apple_ref/doc/uid/2167-SW1

I want them so I know which of these document types goes with the Uniform Type 
Identifier strings I want to include in my application's info.plist.

The UTI reference tells me the system defined UTI strings and i can use the 
mdls command in the terminal to find the UTI  of a given file but so far I have 
found nothing to tell me which of these UTI strings maps onto which of the 
Document Type strings I'm looking for.

Thanks
Julius


--
http://juliuspaintings.co.uk
I'm looking for comments re: http://juliuspaintings.co.uk/physics-of-thought


___

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

Please do not post admin requests or moderator comments to the list.
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: Notification of file system modification arrives too early?

2010-05-30 Thread James Bucanek
Antonio Nunes  wrote (Friday, 
May 28, 2010 3:05 AM +0100):



My app is set to observe a folder for changes to its contents (using UKKQueue.
Thanks Uli! :-)). When files are dropped into the folder the app is notified
and processes the files. This works well, except for one catch: sometimes we
receive the notification and spawn the worker thread, and trying to load the
file fails ( [[PDFDocument alloc] initWithURL:sourceURL] returns nil). This
seems to happen predominantly with large files. I get the impression the
notification happens as soon as the file transfer into the watched directory
begins, and my worker thread is ready and starts loading the file before it
has been fully transferred. Hence the failure to create a PDFDocument from the
file.

Is there a way to check whether the file has been fully transferred, or, even
better, to get notified only when the file transfer has been completed?


I deal with this in my app by creating a kqueue to watch for 
changes in the enclosing folder. When a change occurs, I attempt 
to open the file using the FS API specifying exclusive read + 
exclusive write access. If it fails, it's likely because some 
other process still has the file open. I delay a half second or 
so and try again.


--
James Bucanek

___

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

Please do not post admin requests or moderator comments to the list.
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: example of a NSScrollView where scrolling is overridden ?

2010-05-30 Thread James Bucanek
Guillaume Laurent  wrote 
(Sunday, May 30, 2010 2:59 AM +0200):



I need to scroll over a potentially very large area, that area has CALayers,
which will themselves "be" very large. That is, they will appear so. So I need
to have control over the scrolling so that those "large" CALayers will appear
to scroll but actually redrawing their content as appropriate.

From what I gather, I need to override NSScrollView:drawRect and from that to
somehow drive the drawing in the underlying NSView, but I'd like to see a
working example or something similar, if anybody has some.


I think you might be approaching this with a greater degree of 
difficulty than is necessary.


An NSScrollView presents, clips, and scrolls around a subset of 
a subview. The subview does the drawing of the content, not 
NSScrollView, so overriding -[NSScrollView drawRect:] isn't 
appropriate. The point being that NSScrollView already does 
exactly what your talking about doing, so I'm not sure why you 
need to reinvent it.


It seems to me that your choices should be (in order of preference)

(1) Override the -drawRect: of your NSView, or the 
-drawInContext: of your CALayer. Both of these calls will be 
passed the exact rectangle to be drawn, which will (by 
definition) be contained within the currently visible area 
within the scroll view. Draw *just* what's inside the draw Rect 
or clipping bounds and Bob's your uncle. In fact, your 
NSView/CALayer should be doing that already, but if it isn't 
fixing that should complete your solution.


(2) Write your own custom NSView to slides around a big CALayer, 
clipped to the NSView's bounds, essentially rolling your own NSScrollView.


The first choice would be good if you want all of the goodies 
(scrollbars, delegate events, ...) that come with NSScrollView 
for free. The second would be the best if you really don't want 
all of the NSScrollView stuff except the subview clipping bit.

--
James Bucanek

___

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

Please do not post admin requests or moderator comments to the list.
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


Clicking links in webview does nothing

2010-05-30 Thread Nava Carmon
Hi,

I have a webView in my cocoa application. For some reason clicking on 
hyperlinks there does nothing. I created it in IB and it loads and show the 
remote html properly. When I roll over links, the cursor changes to hand, but 
when i click on them nothing happens. Actually I'd like to open them in default 
browser window. What is the way to do that?

Thanks for your help.

Nava Carmon
ncar...@mac.com

"Think good and it will be good!"

___

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

Please do not post admin requests or moderator comments to the list.
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


example of a NSScrollView where scrolling is overridden ?

2010-05-30 Thread Guillaume Laurent
OK this isn't very clear so I'll try to explain my problem.

I need to scroll over a potentially very large area, that area has CALayers, 
which will themselves "be" very large. That is, they will appear so. So I need 
to have control over the scrolling so that those "large" CALayers will appear 
to scroll but actually redrawing their content as appropriate.

From what I gather, I need to override NSScrollView:drawRect and from that to 
somehow drive the drawing in the underlying NSView, but I'd like to see a 
working example or something similar, if anybody has some.

Thx,

--
Guillaume
http://telegraph-road.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


Re: Activating application raises windows meant to be invisible

2010-05-30 Thread Reinhard Segeler
There are several delegate methods for NSApplication, e.g.  
applicationWillUnhide and NSWindow e.g. windowWillResize:toSize:, etc.  
If you override them, you should be to intervent the displaying of a  
window by ordering out or iconizing them again...

-- Reinhard 

Am 27.05.2010 um 14:44 schrieb David Reitter:

How can I keep invisible windows invisible when my application is  
raised?


My application can end up with only one NSWindow "A" that is  
invisible ([NSWindow orderOut]).  This window is the key window.   
The application may also have other windows ("B") that are iconified.


I find that when switching back to the application, window A is  
always made visible (provided I am on the same Space as the  
window).  How do I control that?

I would get my application to de-iconify B instead.

Window A is raised even before my  
applicationShouldHandleReopen:hasVisibleWindows: are  
applicationDidBecomeActive: are sent.  I have also unsuccessfully  
tried to implement [NSWindow orderFront] to override the behavior.


How would I got about keeping the window hidden?

Thanks for your help.___

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

Please do not post admin requests or moderator comments to the list.
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: Stealing settings from Mail.app

2010-05-30 Thread Chris Idou


OK, I see. So is Mobile-Me the only special case, or is there a more general 
rule about other places to find smtp server passwords?




- Original Message 
From: Greg Guerin 
To: list-cocoa-dev 
Sent: Sat, 29 May, 2010 2:37:30 AM
Subject: Re: Stealing settings from Mail.app

Chris Idou wrote:

> I've got an app that needs to send out emails. I'm trying to import mail 
> settings from Mail.app. For some reason my keychain has passwords for 
> smtp.gmail.com, but not for smtp.me.com.


AFAIK, there is only the one MobileMe password for all uses.

Double-click your MobileMe password in Keychain Access.app and look at its 
Access Control tab.  Note that Mail.app is always granted access by default.

  -- 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/idou747%40yahoo.com

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