Re: Seeding random() randomly

2011-05-27 Thread Michael Hall

On May 26, 2011, at 8:00 PM, Graham Cox wrote:

> I'm using random(), but every time I run my app I get the same sequence, 
> despite having this code in my app delegate's -appDidFinishLaunching method. 
> Clearly I'm not seeding it right, though I can't see why - I get a different 
> value for seed every time. What gives?
> 
> 
>   unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
> 1.0);
>   
>   NSLog(@"launched, seed = %ld", seed );
>   srandom( seed );

unsigned seed = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
1.0);
sleep(2);
unsigned seed2 = (unsigned)([NSDate timeIntervalSinceReferenceDate] * 
.0);
if (seed == seed2)
NSLog(@"match %u %u",seed,seed2);
else 
NSLog(@"mismatch %u %u",seed,seed2);

2011-05-26 21:24:23.339 SRandom[885:80f] match 4294967295 4294967295

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Adding HTML data to the general pasteboard

2011-05-27 Thread Patrick Robertson
Dear all,

I currently have an application which pastes objects from a given list of
saved objects (basically strings) to wherever the mouse if focused.
What I'm looking to do is paste these objects in RT format into various text
editors. Most notably - URL strings (e.g. http://example.com) such that they
are formatted as clickable links.

In order to paste the objects (I'll concentrate on URLs), I add them to the
generalPasteboard with a type 'Apple URL pasteboard type'. Then I use some
carbon to simulate ⌘V.
Now the 'Apple URL pasteboard type' works well for pasting in apps such as
TextEdit - TextEdit format's the URL as RTF and makes it a clickable link. I
have problems with other text editors, such as Gmail's email editor (that
most likely do not understand the Apple URL pasteboard type).

My question is - how should I go about adding the correct types to the URL
(e.g. NSHTMLPboardType) before I add it to the generalPasteboard? - such
that text editors that do not undersand the 'Apple URL pasteboard type'
(Gmail's editor) can still paste the object.

I have tried giving the URL object the NSHTMLPboardType, but I get messages
in the console saying 'bad data for ...' where ... is, for example
public.rtf or public.html
I'm assuming I need to first convert the string into a HTML type string?

Thanks
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Seeding random() randomly

2011-05-27 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 5/26/11 9:52 PM, Graham Cox wrote:
> 
> On 27/05/2011, at 2:42 PM, Clark Cox wrote:
> 
>> No. 'unsigned' is the same size on both 32- and 64-bit The only 
>> built-in types that are different between 32- and 64-bits are:
>> 
>> signed long long (which is really the same as "signed long") 
>> unsigned long and any pointer type
>> 
>> All other built-in types remain the same size between the two.
> 
> 
> Thankyou - a definitive answer. I will print it out and frame it :)

This is also why you should probably use NSInteger/NSUInteger and
CGFloat, where appropriate (though perhaps not here).  They are
typedef'd (in NSObjCRuntime.h/CGBase.h) on a per-architecture basis.

> This suggest that Conrad's analysis is not quite right then, since
> even if I'm overflowing the 32-bit integer, there's still enough
> variation in what remains to give a valid and usable seed:
> 
> 2011-05-27 14:25:14.689 Squaresgame[83159:a0f] seed: 276132753 
> 2011-05-27 14:25:14.691 Squaresgame[83159:a0f] random: 1826068185 
> 2011-05-27 14:49:36.081 Squaresgame[83217:a0f] seed: 290746671 
> 2011-05-27 14:49:36.083 Squaresgame[83217:a0f] random: 162579918

Them are fightin' words.  (Just kidding.)

When I ran my sample code on my machine, I got constant results, not
what you observed above.  I would presume that long int is converted to
unsigned int by chopping off the excess bits on the left, as you
indicated, but my C implementation knowledge is too shallow to be
certain.  Don't know why I got the results I did.

There is also the issue that I mentioned in my previous message: at
least the documentation indicate that srandom() expects an unsigned int
(NOT a long, or an NSUInteger, or something else).  I'm frankly a little
confused by this (and this is the first time I noticed that), but if
that's the case, then who knows that srandom() is going to do internally
if handed something wacky?  (I do realize that you are declaring
unsigned, so this presumably is not the problem in this case, but is
something to be aware of.)

I guess what I conclude from all this from this is: the fact that we are
having this conversation indicates that you probably shouldn't be going
this route.  Even if the behavior you are seeing is the correct result
(say, defined in the C spec), relying on these idiosyncrasies leads to
potentially confusing and hard to read code.  And if the behavior is NOT
consistent (there are certainly plenty of type conversions out there
that give "undefined result"), then the situation is even worse.

As far as you current problem goes, though, it seems like more than
enough people have chimed in with good approaches.

- -- 
Conrad Shultz

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

iEYEARECAAYFAk3fTocACgkQaOlrz5+0JdVpsgCfU9gXPDY+wpU8i2dSFNUo0cSS
NvoAoIVKvXYmn9luGqetCvNhQFrX5+2x
=t3tC
-END PGP SIGNATURE-
___

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

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

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

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


Re: Cocoa Touch (iPhone/iPad): List of notifications?

2011-05-27 Thread Jodischlange

Am 20. mai 2011 um 09.21 schrieb Jeffrey Walton:
> I have an application with UIFileSharingEnabled. If the device is
> tethered, a user can use iTunes (or other programs) to drop new files
> or delete existing files. I would like to detect the changes.
> 
> Is there a 'directory change' (or similar) notification? 'Notification
> Programming Topics' [1] does not appear to have a comprehensive list
> of notifications.

I don't have too much experience with iTunes file sharing either but am working 
on an app that uses it as well. And as far as I can tell iTunes starts a short 
synchronization process to transfer the files if the user choose to add a file 
to an app. Thus I would expect the app to receive some becomeInactive or 
went-to-background notifications. Maybe it is enough to check for those? Didn't 
try it yet, though.___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: QuickTime Player - like application

2011-05-27 Thread Jodischlange

Am 21. mai 2011 um 13.19 schrieb Nick:

> Do you think that would be a bad idea to make it look identically (only
> appearance, the functionality is completely different) to the original
> QuickTime player?

That sounds like a bad idea, indeed. Depends on what you mean by "the 
functionality is completely different". But if your control is actually doing 
something semantically different (not just do the same thing but in another way 
on the programming level) it should look different.
Otherwise the user will probably be confused by the different behavior.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Seeding random() randomly

2011-05-27 Thread Michael Hall

On May 26, 2011, at 10:32 PM, Jens Alfke wrote:

> 
> On May 26, 2011, at 7:15 PM, Kevin Bracey wrote:
> 
>> srandom(time(NULL));
> 
> It’s never a good idea to seed a RNG with something guessable like this. (An 
> old exploit against the Netscape browser’s SSL implementation was made 
> possible in part by doing exactly that.)
> 
> All you have to do is call srandomdev() once; that will seed the generator 
> used by random() with some extremely random (“high-entropy”) data read from 
> /dev/random, which is generated by the kernel through all kinds of black 
> magic.

It lacks 'good' confusion.
http://en.wikipedia.org/wiki/Confusion_and_diffusion

Sort of like the OP's seed multiply, which just led to 'bad' confusion.


___

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

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

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

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


How to see a video from YouTube on Iphone

2011-05-27 Thread Guillermo Moral
Which is the best way to show a video from YouTube on iphone like you see
when you implement MoviePlayerCotroller?

Does anyone have an example?


Thanking you in advance


An Example using MoviePlayerController

- (IBAction)playVideo:(id)sender {

[playButton setImage:playButtonImage forState:UIControlStateNormal];

NSString *filepath   =   [[NSBundle mainBundle]
pathForResource:@"myVideo" ofType:@"mov"];
NSURL*fileURL=   [NSURL fileURLWithPath:filepath];
MPMoviePlayerController *moviePlayerController =
[[MPMoviePlayerController alloc] initWithContentURL:fileURL];

[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(moviePlaybackComplete:)
name:MPMoviePlayerPlaybackDidFinishNotification
object:moviePlayerController];


[moviePlayerController.view setFrame:CGRectMake(31, 130, 477, 360)];

[self.view addSubview:moviePlayerController.view];

[moviePlayerController play];


}


- (void)moviePlaybackComplete:(NSNotification *)notification {

MPMoviePlayerController *moviePlayerController = [notification object];

[[NSNotificationCenter defaultCenter] removeObserver:self
name:MPMoviePlayerPlaybackDidFinishNotification
 object:moviePlayerController];

[moviePlayerController stop];
[moviePlayerController.view removeFromSuperview];

[moviePlayerController autorelease];

}



Willy Moral
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Seeding random() randomly

2011-05-27 Thread Todd Heberlein
Regarding format specifiers, there is the "String Format Specifiers" section of 
the "String Programming Guide" in Apple's Developer Documentation. Here is a 
link to the web version:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/Strings/Articles/formatSpecifiers.html%23//apple_ref/doc/uid/TP40004265-SW1

Todd

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Seeding random() randomly

2011-05-27 Thread Jens Alfke

On May 26, 2011, at 9:04 PM, Scott Ribe wrote:

>> It’s never a good idea to seed a RNG with something guessable like this.
> 
> Not all applications of random() have anything to do with security…

Agreed. But I didn’t say it was always a bad idea, just never a good one. :) 
Seeding with something like a timestamp gives you results that are neither 
repeatable nor truly unguessable, and I can’t think of any situation where that 
would be a benefit. Especially when it’s more work than just calling 
srandomdev().

Besides, people tend to search for snippets of existing code and paste them 
into new code, and it would be sad if code like the above got moved from, say, 
a game to, say, a password generator.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: How to see a video from YouTube on Iphone

2011-05-27 Thread Jens Alfke

On May 27, 2011, at 6:58 AM, Guillermo Moral wrote:

> Which is the best way to show a video from YouTube on iphone like you see
> when you implement MoviePlayerCotroller?

The hard part is determining the URL of the H.264-encoded video file, given the 
URL of the YouTube page. I have no idea how to do that; that’s a question 
YouTube might have documentation for.

Once you have that URL, put it into an NSURL object and create an 
MPMoviePlayerController on it, as in the sample code.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: TransformProcessType() still doesn't show menu (Bug ID# 5905139)

2011-05-27 Thread Jerry Krinock
Thank you, Jim.  Unfortunately your workaround doesn't work in my app either.

I presume it will work in a simple app.  I'm tired of poking, so I'll have to 
do the usual drill of rebuilding a replica of my app from a simple app piece by 
piece and see where it breaks :(

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Application Design

2011-05-27 Thread Dan Hopwood
Hi all,

I have been writing iPhone applications for a while now, with not too many
problems but I feel like I haven't fully grasped how an application should
be structured in terms of storing application objects. e.g. up to now, I've
created a header file, declared all the main objects e.g. app delegate, view
controllers, utilities and initialised them in the app delegate. For each
class, I then just include the header file, which gives me access to all the
objects, should I need to send them messages on certain UI events.

Another option I have considered is storing them all in the app delegate
instead and creating utility methods in the app delegate that delegate out
to the objects from one place. E.g. a VC would then call the app delegate
each time it needs to interact with another VC.

If neither of these options is valid, which I suspect is the case (certainly
global pointers is considered to be bad practise), then how do you store
these pointers to that they are accessible in some way by all the VCs.
Sending in the required pointers on initialisation of each VC (and storing a
copy in each class) is the only other option I can think of but this seems
annoyingly unelegant.

Thoughts and suggestions much appreciated.

Dan
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Application Design

2011-05-27 Thread Steve Christensen
A view controller controls a specific view hierarchy so it shouldn't be 
reaching explicitly out to other view controllers to tell them to do something.

Depending on your specific situation, interested objects could register for 
notifications when certain things change in the world, then one object could 
just broadcast that something changed and not worry about what other objects 
care. Or you could synch a controller's state (and possibly its view(s)) in its 
-viewWillAppear: method since in many cases only a single controller's view 
hierarchy is visible at any one time.


On May 27, 2011, at 11:13 AM, Dan Hopwood wrote:

> I have been writing iPhone applications for a while now, with not too many
> problems but I feel like I haven't fully grasped how an application should
> be structured in terms of storing application objects. e.g. up to now, I've
> created a header file, declared all the main objects e.g. app delegate, view
> controllers, utilities and initialised them in the app delegate. For each
> class, I then just include the header file, which gives me access to all the
> objects, should I need to send them messages on certain UI events.
> 
> Another option I have considered is storing them all in the app delegate
> instead and creating utility methods in the app delegate that delegate out
> to the objects from one place. E.g. a VC would then call the app delegate
> each time it needs to interact with another VC.
> 
> If neither of these options is valid, which I suspect is the case (certainly
> global pointers is considered to be bad practise), then how do you store
> these pointers to that they are accessible in some way by all the VCs.
> Sending in the required pointers on initialisation of each VC (and storing a
> copy in each class) is the only other option I can think of but this seems
> annoyingly unelegant.
> 
> Thoughts and suggestions much appreciated.

___

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

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

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

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


-usedRectForTextContainer: and attachments

2011-05-27 Thread Nick Zitzmann
Short version: How do I get -[NSLayoutManager usedRectForTextContainer:] to 
quit ignoring attachments?

Long version: I'm using -usedRectForTextContainer: to calculate the drawing 
height of a line of text that has already been laid out using 
-glyphRangeForTextContainer:. I've found that, when the last character is an 
attachment, and the width of the text container wraps the attachment on to a 
separate line from the rest of the text, then instead of 
-usedRectForTextContainer: returning a rect with enough height to display the 
text on one line and the attachment on another line, it just ignores the 
attachment, and returns a rect with only enough height to display the one line 
of text.

If I resize the text container so that the text before the attachment gets 
wrapped onto a second line, then -usedRectForTextContainer: returns the 
expected result, which makes me wonder if it's ignoring the attachment in the 
returned rect. I already tried changing the typesetter behavior, and that 
didn't resolve the problem. What can I do here, if anything?

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: TransformProcessType() still doesn't show menu (Bug ID# 5905139)

2011-05-27 Thread Mark Munz
Yes, this is an every increasingly annoying bug. I filed a similar
issue (#9402554) and based on the duplicate bug # referenced, it
appears it has been around a while.

I've tried most of the solutions offered by developers before (from
AppleScripts to setting focus on the dock) and none have worked for
me. I then took a very inelegant approach to this:

Launch a new instance of same app (you could add a special arg to
indicate launch as foreground app).
Then quit the old agent.
In applicationWillFinishLaunching: if your arg is there,  call
TransformProcessType(). It seems that applicationWillFinishLaunching:
is early enough in the launch that the menubar will update properly
when you transform the process type.

If you needed to keep data, you could put it up on a private
NSPasteboard and grab it again.

This has been the most reliable way of converting an agent to a
foreground app that I've found. But, IMHO, it is also the ugliest
approach.

I really hope Apple just fixes this issue once and for all.

Mark

On Fri, May 27, 2011 at 11:01 AM, Jerry Krinock  wrote:
> Thank you, Jim.  Unfortunately your workaround doesn't work in my app either.
>
> I presume it will work in a simple app.  I'm tired of poking, so I'll have to 
> do the usual drill of rebuilding a replica of my app from a simple app piece 
> by piece and see where it breaks :(
>
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/unmarked%40gmail.com
>
> This email sent to unmar...@gmail.com
>



-- 
Mark Munz
unmarked software
http://www.unmarked.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: TransformProcessType() still doesn't show menu (Bug ID# 5905139)

2011-05-27 Thread Eric Schlegel

On May 27, 2011, at 12:30 PM, Mark Munz wrote:

> Yes, this is an every increasingly annoying bug. I filed a similar
> issue (#9402554) and based on the duplicate bug # referenced, it
> appears it has been around a while.
> 
> I really hope Apple just fixes this issue once and for all.

If you have access to the Lion seed, please test on any recent build. It's 
believed to be fixed in Lion. If the problem still occurs there, please file a 
new bug.

-eric

___

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

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

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

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


Blue highlight on NSMenuItems stops appearing

2011-05-27 Thread Hunter, Craig A. (LARC-D301)
I am seeing a strange problem in a new app, where the standard blue highlight 
which appears when mousing over NSMenuItems in NSMenus will suddenly stop 
appearing in the app.  So there is no longer visible feedback about which menu 
item the mouse is over in any of the menus (including the main menu and menus 
of popup buttons).  Sometimes the highlight will eventually come back after 
clicking around in the app and doing various things, but other times it's just 
plain gone. 

To learn more, I setup a delegate to one NSMenu and implemented "menu: 
willHighlightItem:".  I wanted to see if this was still fired once the 
highlights stopped visibly showing up.  It is fired, so obviously the proper 
mouseover/highlight event is being registered.  This suggests to me that 
there's instead some sort of drawing/display issue with the highlight.  The 
fact that it affects every menu in the app has got to mean something

Anybody have any ideas?

thanks,
Craig

--
Dr. Craig Hunter
NASA Langley Research Center
Configuration Aerodynamics Branch
craig.hun...@nasa.gov
(757) 864-3020
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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


Comprehensible tutorial for Accessorizer?

2011-05-27 Thread Jens Alfke
I admit it: I’ve never gotten into Accessorizer. I’m sure it does a lot of 
useful stuff that would save me a lot of time, but every time I try to use it I 
look at its insanely busy window, start to feel dizzy, look at the 
documentation, start to get really anxious and confused, and put it all away 
again for a few years.

Has anyone else written any tutorials that are more approachable?

(Pretty much what I want is this: a tool that will read the .h file I’ve just 
written, parse out the ivars and properties and methods, and spit out a 
skeletal .m file with property implementations and empty methods. Accessorizer 
doesn’t seem to do this, though, AFAICT.)

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Properly comparing file NSURLs for equality?

2011-05-27 Thread Sean McBride
Hi all,

What is the correct way to test if two NSURLs refer to the same file
system object?

I've just learnt the hard way that one can have two URLs that refer to
the same file system object but because they are subtly different,
isEqual: returns NO:

ex:


vs


isEqual: returns NO.  I guess this makes some sense, but it's not the
kind of equality I'm looking for.

What would best practice be?  Convert to full path, and compare those?
Note: I'm not concerned about resolving symlinks or aliases.

(Aside: I was surprised to see that there is no isEqualToURL:, analogous
to isEqualToString, isEqualToSet, etc.  I wonder why...)

Thanks,

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Jens Alfke

On May 27, 2011, at 4:13 PM, Sean McBride wrote:

> What would best practice be?  Convert to full path, and compare those?
> Note: I'm not concerned about resolving symlinks or aliases.

Yeah, I think so. First test -isFileURL, then compare the -path properties.

Comparing paths has its own set of pitfalls: even if you’re not concerned about 
symlinks, there’s case-insensitivity to deal with. I’m not sure what the best 
way is to deal with that. You could canonicalize each path; or you could 
convert each URL to an FSRef and then compare those for equality.

—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

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


Re: Properly comparing file NSURLs for equality?

2011-05-27 Thread Kyle Sluder
On Fri, May 27, 2011 at 4:13 PM, Sean McBride  wrote:
> Note: I'm not concerned about resolving symlinks or aliases.

Jeez, I can read.

--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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Peter Lübke
[ [someURL absoluteURL] isEqual:[otherURL absoluteURL]] should return  
correct results.


Cheers,
Peter


Am 28.05.2011 um 01:13 schrieb Sean McBride:


Hi all,

What is the correct way to test if two NSURLs refer to the same file
system object?

I've just learnt the hard way that one can have two URLs that refer to
the same file system object but because they are subtly different,
isEqual: returns NO:

ex:


vs


isEqual: returns NO.  I guess this makes some sense, but it's not the
kind of equality I'm looking for.

What would best practice be?  Convert to full path, and compare those?
Note: I'm not concerned about resolving symlinks or aliases.

(Aside: I was surprised to see that there is no isEqualToURL:,  
analogous

to isEqualToString, isEqualToSet, etc.  I wonder why...)

Thanks,

--


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Dave Keck
> What is the correct way to test if two NSURLs refer to the same file
> system object?

I would lstat() the file paths and compare their inodes (st_ino) and
residing device inodes (st_dev).
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread James Walker

On 5/27/2011 4:35 PM, Jens Alfke wrote:


Comparing paths has its own set of pitfalls: even if you’re not
concerned about symlinks, there’s case-insensitivity to deal with. I’m
not sure what the best way is to deal with that. You could canonicalize
each path; or you could convert each URL to an FSRef and then compare
those for equality.


If you were going to compare FSRefs (FSCompareFSRefs), you wouldn't need 
to convert to a path, just use CFURLGetFSRef via toll-free bridging.

--
  James W. Walker, Innoventive Software LLC
  
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Douglas Davidson

On May 27, 2011, at 4:45 PM, James Walker wrote:

> On 5/27/2011 4:35 PM, Jens Alfke wrote:
> 
>> Comparing paths has its own set of pitfalls: even if you’re not
>> concerned about symlinks, there’s case-insensitivity to deal with. I’m
>> not sure what the best way is to deal with that. You could canonicalize
>> each path; or you could convert each URL to an FSRef and then compare
>> those for equality.
> 
> If you were going to compare FSRefs (FSCompareFSRefs), you wouldn't need to 
> convert to a path, just use CFURLGetFSRef via toll-free bridging.

It shouldn't be necessary to go to FSRefs for this now that we have resource 
properties such as 
NSURLFileResourceIdentifierKey/kCFURLFileResourceIdentifierKey.  For other 
usages of FSRefs, consider file reference URLs instead.

Douglas Davidson

___

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

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

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

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


Re: Properly comparing file NSURLs for equality?

2011-05-27 Thread Mike Abdullah
It is a bit of a knotty problem. I've ended up with:

- (BOOL)ks_isEqualToURL:(NSURL *)otherURL;
{
BOOL result = [self isEqual:otherURL];

   // For file: URLs the default check might have failed because they reference 
the host differently. If so, fall back to checking paths
if (!result && [self isFileURL] && [otherURL isFileURL])
{
result = [[self path] isEqualToString:[otherURL path]];
}

return result;
}

From here: 
https://github.com/karelia/KSFileUtilities/blob/master/KSURLUtilities.m

Part of the problem really is expressing what equality you actually want to 
test. For example, it's perfectly legal for a file URL to have a query or 
fragment. But the filesystem will ignore that, rendering it obsolete for a URL 
comparison. Thus the only safe way to test equality as you want here is to 
compare paths.

On 28 May 2011, at 00:13, Sean McBride wrote:

> Hi all,
> 
> What is the correct way to test if two NSURLs refer to the same file
> system object?
> 
> I've just learnt the hard way that one can have two URLs that refer to
> the same file system object but because they are subtly different,
> isEqual: returns NO:
> 
> ex:
> 
> 
> vs
> 
> 
> isEqual: returns NO.  I guess this makes some sense, but it's not the
> kind of equality I'm looking for.
> 
> What would best practice be?  Convert to full path, and compare those?
> Note: I'm not concerned about resolving symlinks or aliases.
> 
> (Aside: I was surprised to see that there is no isEqualToURL:, analogous
> to isEqualToString, isEqualToSet, etc.  I wonder why...)
> 
> Thanks,
> 
> --
> 
> Sean McBride, B. Eng s...@rogue-research.com
> Rogue Researchwww.rogue-research.com
> Mac Software Developer  Montréal, Québec, Canada
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Mike Abdullah

On 28 May 2011, at 00:57, Douglas Davidson wrote:

> 
> On May 27, 2011, at 4:45 PM, James Walker wrote:
> 
>> On 5/27/2011 4:35 PM, Jens Alfke wrote:
>> 
>>> Comparing paths has its own set of pitfalls: even if you’re not
>>> concerned about symlinks, there’s case-insensitivity to deal with. I’m
>>> not sure what the best way is to deal with that. You could canonicalize
>>> each path; or you could convert each URL to an FSRef and then compare
>>> those for equality.
>> 
>> If you were going to compare FSRefs (FSCompareFSRefs), you wouldn't need to 
>> convert to a path, just use CFURLGetFSRef via toll-free bridging.
> 
> It shouldn't be necessary to go to FSRefs for this now that we have resource 
> properties such as 
> NSURLFileResourceIdentifierKey/kCFURLFileResourceIdentifierKey.  For other 
> usages of FSRefs, consider file reference URLs instead.

I can't find these documented – link?

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Shane Stanley
On 28/5/11 9:57 AM, "Douglas Davidson"  wrote:

> It shouldn't be necessary to go to FSRefs for this now that we have resource
> properties such as
> NSURLFileResourceIdentifierKey/kCFURLFileResourceIdentifierKey.


When you say "now", you mean 10.6? Because neither appears in a search of
the docs. 

-- 
Shane Stanley 
'AppleScriptObjC Explored' 


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Lee Ann Rucker

On May 27, 2011, at 5:06 PM, Mike Abdullah wrote:

> It is a bit of a knotty problem. I've ended up with:
> 
> - (BOOL)ks_isEqualToURL:(NSURL *)otherURL;
> {
>BOOL result = [self isEqual:otherURL];
> 
>   // For file: URLs the default check might have failed because they 
> reference the host differently. If so, fall back to checking paths
>if (!result && [self isFileURL] && [otherURL isFileURL])
>{
>result = [[self path] isEqualToString:[otherURL path]];
>}
> 
>return result;
> }

That can fail in the circumstances from my code's comment:

   /*
* [NSURL isEqualTo:] fails when a path has a trailing slash and
* an otherwise matching one doesn't. Standardize the path first
* and use localizedCompare in case the characters were composited 
differently.
*/
   if ([[[self path] stringByStandardizingPath]
 localizedCompare:[[inURL path] stringByStandardizingPath]] == 
NSOrderedSame) {
  return YES;
   }

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Sean McBride
On May 27, 2011, at 19:57, Douglas Davidson wrote:

>> If you were going to compare FSRefs (FSCompareFSRefs), you wouldn't need to 
>> convert to a path, just use CFURLGetFSRef via toll-free bridging.
> 
> It shouldn't be necessary to go to FSRefs for this now that we have resource 
> properties such as 
> NSURLFileResourceIdentifierKey/kCFURLFileResourceIdentifierKey.  For other 
> usages of FSRefs, consider file reference URLs instead.

Douglas,

That's perfect!  But for, shall we say, older cats :), would be next best thing 
be CFURLGetFSRef() & FSCompareFSRefs()? It seems ideal since it solves the 
problem of needing to canonicalize paths.

Peter, I tried absoluteURL but it doesn't change the result when the difference 
is only the 'localhost' part. :(

Thanks to all for your insightful replies!

Sean

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Peter Lübke

Douglas,

That's perfect!  But for, shall we say, older cats :), would be  
next best thing be CFURLGetFSRef() & FSCompareFSRefs()? It seems  
ideal since it solves the problem of needing to canonicalize paths.


Peter, I tried absoluteURL but it doesn't change the result when  
the difference is only the 'localhost' part. :(



Yes I know.
( [myAnswer wasAbsolutelyPointless] == YES );


Am 28.05.2011 um 01:38 schrieb Peter Lübke:

[ [someURL absoluteURL] isEqual:[otherURL absoluteURL]] should  
return correct results.


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Comprehensible tutorial for Accessorizer?

2011-05-27 Thread Andy Lee
I've been meaning for a while to make a video on the One True Way to use 
Accessorizer, but until then there's my blog:



As it happens, Kevin today tweeted a page he put together called "Accessorizer 
Made Simple":



But I think everyone in the world should *first* go to my page and do exactly 
what I do (because, you know, I'm so incredibly right :)), *then* visit Kevin's 
page for more in-depth stuff.

I've also been tempted to tell people to wait until after WWDC to buy 
Accessorizer, since it's on sale and I want them to pay full price. But I'm not 
sure Kevin would appreciate my interfering with his sales methods. :)

--Andy


On May 27, 2011, at 5:34 PM, Jens Alfke wrote:

> I admit it: I’ve never gotten into Accessorizer. I’m sure it does a lot of 
> useful stuff that would save me a lot of time, but every time I try to use it 
> I look at its insanely busy window, start to feel dizzy, look at the 
> documentation, start to get really anxious and confused, and put it all away 
> again for a few years.
> 
> Has anyone else written any tutorials that are more approachable?
> 
> (Pretty much what I want is this: a tool that will read the .h file I’ve just 
> written, parse out the ivars and properties and methods, and spit out a 
> skeletal .m file with property implementations and empty methods. 
> Accessorizer doesn’t seem to do this, though, AFAICT.)
> 
> —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: Properly comparing file NSURLs for equality?

2011-05-27 Thread Ken Thomases
On May 27, 2011, at 7:51 PM, Sean McBride wrote:

> That's perfect!  But for, shall we say, older cats :), would be next best 
> thing be CFURLGetFSRef() & FSCompareFSRefs()?

We just had another thread about this subject.  For pre-10.6, yes, I think that 
FSCompareFSRefs() is good.  For 10.6, I believe you can convert the URLs to 
file-reference URLs and then compare with -isEqual:.

I also mentioned that one can use NSFileManager to get the attributes and 
compare both NSFileDeviceIdentifier and NSFileSystemFileNumber, which is 
basically equivalent to the earlier suggestion to use lstat() and compare 
st_dev and st_ino.

Apparently, the NSURLFileResourceIdentifierKey/kCFURLFileResourceIdentifierKey 
suggestion comes to us from the future. ;)

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: Comprehensible tutorial for Accessorizer?

2011-05-27 Thread Kevin Callahan

On May 27, 2011, at 7:12 PM, Andy Lee wrote:

> I've been meaning for a while to make a video on the One True Way to use 
> Accessorizer, but until then there's my blog:
> 
> 
> 
> As it happens, Kevin today tweeted a page he put together called 
> "Accessorizer Made Simple":
> 
> 
> 
> But I think everyone in the world should *first* go to my page and do exactly 
> what I do (because, you know, I'm so incredibly right :)), *then* visit 
> Kevin's page for more in-depth stuff.
> 
> I've also been tempted to tell people to wait until after WWDC to buy 
> Accessorizer, since it's on sale and I want them to pay full price. But I'm 
> not sure Kevin would appreciate my interfering with his sales methods. :)
> 
> --Andy
> 
> 
> On May 27, 2011, at 5:34 PM, Jens Alfke wrote:
> 
>> I admit it: I’ve never gotten into Accessorizer. I’m sure it does a lot of 
>> useful stuff that would save me a lot of time, but every time I try to use 
>> it I look at its insanely busy window, start to feel dizzy, look at the 
>> documentation, start to get really anxious and confused, and put it all away 
>> again for a few years.
>> 
>> Has anyone else written any tutorials that are more approachable?
>> 
>> (Pretty much what I want is this: a tool that will read the .h file I’ve 
>> just written, parse out the ivars and properties and methods, and spit out a 
>> skeletal .m file with property implementations and empty methods. 
>> Accessorizer doesn’t seem to do this, though, AFAICT.)
>> 
>> —Jens


You can do what you want (and more) with a couple of code gen actions.  Next 
update will allow you to do it in one fell swoop.  

In one gen, you can get all your synth, dealloc, viewDidUnload, init, initWith, 
keyPaths, observing.  In another gen, you can get mehtod stubs, delegate stubs 
etc
You can see this in the 4th video at this page; 


I'll offer the combo in the next update.

Definitely check out Andy's page as well.

-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/kcall%40mac.com
> 
> This email sent to kc...@mac.com





___

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

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

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

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


Re: Adding HTML data to the general pasteboard

2011-05-27 Thread Patrick Robertson
OK, so after a bit more looking into this, it seems I need to convert a
string:

@"http://example.com"; into two NSData objects. One for RTF and one for HTML,
then add these to the pasteboard as different types.

What would you all suggest as the best way of converting the above string
into RTF and HTML?

On 27 May 2011 16:43, Patrick Robertson  wrote:

> Dear all,
>
> I currently have an application which pastes objects from a given list of
> saved objects (basically strings) to wherever the mouse if focused.
> What I'm looking to do is paste these objects in RT format into various
> text editors. Most notably - URL strings (e.g. http://example.com) such
> that they are formatted as clickable links.
>
> In order to paste the objects (I'll concentrate on URLs), I add them to the
> generalPasteboard with a type 'Apple URL pasteboard type'. Then I use some
> carbon to simulate ⌘V.
> Now the 'Apple URL pasteboard type' works well for pasting in apps such as
> TextEdit - TextEdit format's the URL as RTF and makes it a clickable link. I
> have problems with other text editors, such as Gmail's email editor (that
> most likely do not understand the Apple URL pasteboard type).
>
> My question is - how should I go about adding the correct types to the URL
> (e.g. NSHTMLPboardType) before I add it to the generalPasteboard? - such
> that text editors that do not undersand the 'Apple URL pasteboard type'
> (Gmail's editor) can still paste the object.
>
> I have tried giving the URL object the NSHTMLPboardType, but I get messages
> in the console saying 'bad data for ...' where ... is, for example
> public.rtf or public.html
> I'm assuming I need to first convert the string into a HTML type string?
>
> Thanks
>
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Adding HTML data to the general pasteboard

2011-05-27 Thread Kyle Sluder
On Thu, May 26, 2011 at 11:43 PM, Patrick Robertson
 wrote:
> I currently have an application which pastes objects from a given list of
> saved objects (basically strings) to wherever the mouse if focused.
> What I'm looking to do is paste these objects in RT format into various text
> editors. Most notably - URL strings (e.g. http://example.com) such that they
> are formatted as clickable links.
>
> In order to paste the objects (I'll concentrate on URLs), I add them to the
> generalPasteboard with a type 'Apple URL pasteboard type'. Then I use some
> carbon to simulate ⌘V.

1. If you're running on 10.6, you should use the new pasteboard API.
NSURL conforms to NSPasteboardWriting, and all you have to do is write
your NSURL to the pasteboard using -[NSPasteboard writeObjects:]. It
will use all the correct representations.

2. You're seriously simulating keystrokes to paste things in places?
This is fraught with peril. I know a number of users who re-map Cmd-V
to "Paste and Match Style" using System Preferences.

--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: Adding HTML data to the general pasteboard

2011-05-27 Thread Kyle Sluder
On Fri, May 27, 2011 at 11:06 PM, Patrick Robertson
 wrote:
>> 1. If you're running on 10.6
> I may go this way, and just leave it as it is for 10.5 users.
>> 2. You're seriously simulating keystrokes to paste things in places?...
> Yep, if you can come up with a better alternative, I'd be impressed :)
> Thanks for your help. I was actually in the process of adding a
> `htmlForString` method to my NSString class that would convert a URL into
> its HTML representation (...url...
>
> I guess there won't be a need for that now.

Bringing this back on-list…

If you're supporting 10.5 users, then stick with the old API. Use
NSAttributedString to generate RTF and HTML versions of the link and
put them on the pasteboard.

--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