Re: Threading - How its done?

2008-05-08 Thread Michael Vannorsdel
I was speaking for a programmer's own code.  When you're using someone  
else's classes that modify their own data or internal state, then it's  
not just reading memory and therefore neither is the program.  But if  
you truly are just reading then synchronization is not necessary.


The point I was driving at is that shared data could, as in the  
example I made, be shared without worrying about synchronization  
problems; shared data does not always need locks simply because it's  
shared.  When to lock and when not to lock is always one of the first  
things a beginner should learn because of the performance penalties  
locking incurs.




On May 8, 2008, at 12:45 AM, Chris Hanson wrote:

What I'm saying is that in the general case you cannot assume that  
just because you're reading you're "safe."


This gets people into a lot of trouble with Core Data, for example,  
because simply accessing a property of an object will cause the  
framework to do things that require state.  You cannot thus simply  
share Core Data managed objects between multiple threads without  
being extremely careful to lock the object graph.


Similarly, if you are given an arbitrary object, unless it makes  
explicit guarantees about the safety of doing so — whether as part  
of the language standard, such as the example you give above, or via  
documentation — you cannot assume that it is safe to access from  
multiple threads at once.


For example, consider an immutable object that has a property which  
is expensive to calculate.  It could easily cache this value behind  
the scenes.  It's still immutable from its users' perspective, but  
it's likely to behave incorrectly in some way if used from multiple  
threads at once.  And unless the object's class documentation says  
instances are safe to share across multiple threads, you'd be  
violating its API contract by doing so.


There is nothing that causes more bugs in writing threaded code than  
assumptions about what is and isn't safe at any given instant.  You  
can't assume, you must know.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSStream blocking behavior?

2008-05-08 Thread Stefan Haller
Michael Ash <[EMAIL PROTECTED]> wrote:

> NSStream matches the semantics of the UNIX read/write calls. In both
> cases, if you are informed that data or space is available, you can
> issue a read or write for an arbitrary amount of data and be
> guaranteed that it will not block.

I would have thought so too, but the NSStream documentation seems to
disagree (this is from the "Stream Programming Guide for Cocoa"
document):

: It should be pointed out that neither the polling nor run-loop
: scheduling approaches are airtight defenses against blocking. If the
: NSInputStream hasBytesAvailable method or the NSOutputStream
: hasSpaceAvailable method returns NO, it means in both cases that the
: stream definitely has no available bytes or space. However, if either
: of these methods returns YES, it can mean that there is available
: bytes or space or that the only way to find out is to attempt a read
: or a write operation (which could lead to a momentary block). The
: NSStreamEventHasBytesAvailable and NSStreamEventHasSpaceAvailable
: stream events have identical semantics.

I'm not sure exactly what "momentary block" means here.


-- 
Stefan Haller
Ableton
http://www.ableton.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Quadratic curves in NSBezierPath

2008-05-08 Thread Nick Zitzmann
I searched the archives about this, and didn't find anything helpful  
(only examples that did the opposite of what I want to do, or include  
sample code that was published a year ago and is now gone). How do I  
do something resembling a quadratic curve using NSBezierPath instead  
of a cubic curve?


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


Creating zip using cocoa framework

2008-05-08 Thread parag vibhute
Hi,

I want to create zip file using Cocoa framework. I know I can do it using
shell/apple scripting but want to know that is there any framework in Cocoa
for creating zip file?

Thanks,
Palav

-- 

There are many things in your life that will catch your eye but only a few
will catch your heartpursue those'.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Saving only required files in a file wrapper?

2008-05-08 Thread Keith Blount
Many thanks again for your replies; much appreciated.

On the surface, it look as though Graham's suggested 
-writeToURL:ofType:forSaveOperation:originalContentsURL:error: would be the 
ideal solution, allowing me to write just individual files for an 
NSSaveOperation or copy the whole project for an NSSaveAsOperation.

The trouble is that the documentation is really unclear on this. It seems to 
say that you should use this method for exactly what I want but then it says 
that you can't rely on the URLs passed in!

Firstly, the docs say the following about this method:

"You can override this method instead of one of the three simple writing 
methods... if your document writing machinery needs access to the on-disk 
representation of the document revision that is about to be overwritten."

Which is exactly what I want - I want access to the on-disk package where I 
know all of the contents are safe so that I can only save a handful of changed 
files within the package, without having to overwrite the entire package (which 
could take a long time for large packages).

However, it then goes on to say:

"The value of absoluteURL is often not the same as [self fileURL]. Other times 
it is not the same as the URL for the final save destination. Likewise, 
absoluteOriginalContentsURL is often not the same value as [self fileURL]."

Huh? It adds that "If absoluteOriginalContentsURL is nil, either the document 
has never been saved or the user deleted the document file since it was 
opened." That bit makes sense. It is the above sentence that is worrying. I can 
see why absoluteURL wouldn't be the same as [self fileURL] if the save 
operation was NSSaveAsOperation (though the docs don't go into this). But 
outside of the document never having been saved or it having been deleted so 
that absoluteOriginalContentsURL is nil, why wouldn't 
absoluteOriginalContentsURL be the same as [self fileURL]?

On the other hand, if absoluteOriginalContentsURL represents a copy the OS has 
made of the package, then everything should be there and I should still be able 
to write to it and have the OS write everything back safely. Right? I hope. 
That is, I would expect this method - given that it says that you can use this 
method "if your document writing machinery needs access to the on-disk 
representation of the document revision that is about to be overwritten" - to 
at least provide a copy of the entire package at absoluteOriginalContentsURL 
even if that is not the original -fileURL. (To be really safe I could always 
check inside absoluteOriginalContentsURL to ensure that a file I know should be 
in every package is there...)

My experience certainly suggests that -fileURL will generally be the same as 
the passed-in URL. In my -readFromURL:... method, I have just realised that I'm 
calling -fileURL instead of absoluteURL, which I absolutely shouldn't be doing. 
But in two years not one of the thousands of users of my app has complained 
that their project wouldn't open. In the case of my app, though, the package is 
guaranteed to be on disk before -readFromURL: is ever called (you can't create 
a blank project without it already having a package on disk), so it seems that 
-absoluteURL in -readFromURL: only differs from [self fileURL] if the document 
is  a blank, unsaved one. (Obviously I can't rely on this behaviour and will be 
changing it to use -absoluteURL forthwith.)

Sorry for the long, rambling reply. I'm just trying to get my head around the 
best way of doing this, and the (usually excellent) docs seem a little obtuse 
in this area.

Many thanks again,
Keith
- Original Message 
From: Ken Thomases <[EMAIL PROTECTED]>
To: Graham Cox <[EMAIL PROTECTED]>
Cc: Keith Blount <[EMAIL PROTECTED]>; Cocoa-Dev List 
Sent: Thursday, May 8, 2008 3:36:05 AM
Subject: Re: Saving only required files in a file wrapper?

On May 7, 2008, at 9:06 PM, Graham Cox wrote:

> On 8 May 2008, at 10:26 am, Keith Blount wrote:
>
>> The trouble with all of these methods is that they tell you not to  
>> rely on fileURL
>
> My interpretation of that advice is that at the time the read... and  
> write... methods are called, the document hasn't set up -fileURL, so  
> in that sense you can't rely on it (i.e. don't call -fileURL from  
> within these methods). But the URL passed to the methods themselves  
> as a parameter is definitely reliable. So provided you use the  
> parameter you'll be fine.

I think it means more than that.  NSDocument tries to be smart about  
atomic writes and backups.  The URL passed into the write... methods  
is not expected to be the same as the document's current location on  
disk.  You are to write the document, in whole, to the temporary  
location provided to you (about which no assumptions should be made),  
and then NSDocument will take care of swapping the newly-written  
document with the old document and deleting the old document.

Obviously, this runs directly counter to Keith's desires.  
Unfor

Re: Creating zip using cocoa framework

2008-05-08 Thread Scott Anguish


On May 8, 2008, at 4:49 AM, parag vibhute wrote:


Hi,

I want to create zip file using Cocoa framework. I know I can do it  
using
shell/apple scripting but want to know that is there any framework  
in Cocoa

for creating zip file?

Thanks,
Palav




check google. this is asked at least weekly

or try www.cocoabuilder.com to do the search
___

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

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

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

This email sent to [EMAIL PROTECTED]


How to send email without using email client

2008-05-08 Thread vinitha ks

Hi,
I'm working with mac 10.5 and xcode3.0.I've to send email from an
application with out using any email client.When i try to use message
framework,It doesn't work.(deliverMessage always returns no)Is there any
any way to send email from my application without using any email
client,and i've to send attachments also.

My other question is about vector graphics,Is there any way to implement
SVG in my cocoa application?Is there anyway to draw vector graphics other
than using GCDrawKit (because still it doesn't provide any
documentation).As a beginner i found it is really difficult to work with
GCDrawKit without documentation.

thanks


   
-
 Best Jokes, Best Friends, Best Food. Get all this and more on  Best of Yahoo! 
Groups.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: self registering NSValueTransformer and bindings

2008-05-08 Thread Torsten Curdt


On May 7, 2008, at 19:32, I. Savant wrote:


I have a self registering NSValueTransformer that requires a binding.


 Did you mean it's required for use in a binding?


Well, maybe it's language barrier as a non-native speaker ...but in  
order for the transformer to do its job it requires a reference to the  
NSTabView to be set. And I was trying to inject that reference through  
a binding.  That's what I wanted to say.



@interface MyValueTransformer : NSValueTransformer {
   IBOutlet NSTabView *tabView;
}


 That's probably not going to work out ... (see below)


// from http://www.gigliwood.com/weblog/
+ (void)load
{
   NSLog(@"registered %@", NSStringFromClass([self class]));

   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   NSValueTransformer *theTransformer = [[[self alloc] init]  
autorelease];

   [NSValueTransformer setValueTransformer:theTransformer
forName:NSStringFromClass([self class])];
   [pool release];
}


 See:
 
http://developer.apple.com/documentation/Cocoa/Conceptual/ValueTransformers/Concepts/Registration.html


Read that :)


 Here you're instantiating an instance of the generic
NSValueTransformer class and letting the NSValueTransformer class know
that it should use that generic transformer any time
"MyValueTransformer" is requested.


That does not seem to be true. But to be 100% sure I've changed it to

   NSValueTransformer *theTransformer = [[[MyValueTransformer alloc]  
init] autorelease];


...and still get the same behavior. The correct instance is always a  
MyValueTransformer and no NSValueTransformer as you said.


I've instantiate it through the NIB. Which works fine! I do see the  
NSLog

lines and all.


 I'm not sure how that's happening, given the above. I would expect
your transform method not to be called at all, given the above. I
could be wrong, then again it's not working right for you, so it's
worth checking out. ;-)


No, that's all working fine. See above.

Unfortunately the IBOutlet stays nil ...but in the bindings  
inspector I can

see the proper binding on the transformer.


 I don't know what you mean about 'the proper binding', but no, I
wouldn't expect the outlet to be anything but nil. The *instance* you
*instantiated* in your nib is not the same one you're passing when
registering the transformer for the name "MyValueTransformer". In
*that* instance, the outlet is nil.


Doh! ...now here I was really stupid. But then again I would think  
changing it to


- (void) awakeFromNib
{
NSLog(@"registered %@", NSStringFromClass([self class]));

[NSValueTransformer setValueTransformer:self  
forName:NSStringFromClass([self class])];

}

would solve it. Turns out this is not enough. From looking at the  
stacktrace it seems like the framework seems to create another  
instance. So the only way I could get it to work was to register the  
transformer in the init.


- (id) init
{
self = [super init];

if (self != nil) {
NSLog(@"new %@ (%@)", NSStringFromClass([self class]), self);

[NSValueTransformer setValueTransformer:self  
forName:NSStringFromClass([self class])];

}

return self;

}

This way I end up just with the one instance created from the NIB.


 Perhaps in some -awakeFromNib method you could ask
NSValueTransformer for the transformer for the name
"MyValueTransformer" and set its outlet then (you'd need a 'setter'
accessor method) ... but what you're doing is strange.

 A value transformer really shouldn't know anything about a tab view.


Well, that depends ...see below


Its sole job is to transform one value to another. A number to a
string, or a class name to an image, etc. and possibly vice-versa
(reverse transformations). Why does yours care about a tab view?
Perhaps all you want is a few constants that's included into your
transformer via a header include ...


That is one way and I've already got it working like that.


...



That header can be included in your
AccountTypeToSelectedTabTransformer ... where it gives the correct tab
index depending on whether the passed value is kNormalAccountType or
kSuperHappyFunLuckyMegaAccountType or some other ridiculous example.
Keeps everything simple, straight-forward, and easy to read months
later when you decide to modify it.


Well, my account types have declarative names instead of defined  
numbers. So the transformer basically does


- (id)transformedValue:(id)value
{
if ([@"accountType1" isEqualToString:value]) {
return [NSNumber numberWithInt:1];
}
...

And I think this could be quite neatly be abstracted away if the  
transformer had access to the NSTabView. The name of the tab would be  
the name of the account type the transformer is mapping to. Not such a  
weird idea IMO. But it requires the transformer to have a reference to  
the NSTabView. I could manually inject it - but using a NIB and using  
bindings felt more natural (to me). It would make the transformer much  
more re-usable  ...so I was trying


I w

Re: Saving only required files in a file wrapper?

2008-05-08 Thread Keith Blount
Apologies for so soon a follow up, but I've just been experimenting with 
-writeToURL:ofType:forSaveOperation:originalContentsURL:error: and the results 
are disastrous. It turns out that *every single time* it is invoked, 
absoluteURL is a temporary location and *not* the original URL. So to use this 
method successfully I would need to copy the whole file package across to that 
location every time, which is exactly what I _don't_ want to do. This seems a 
little insane to me. There must be a mechanism in place that just lets you save 
into a package folder without having to write the whole thing out every time...

Thanks again and all the best,
Keith

- Original Message 
From: Ken Thomases <[EMAIL PROTECTED]>
To: Graham Cox <[EMAIL PROTECTED]>
Cc: Keith Blount <[EMAIL PROTECTED]>; Cocoa-Dev List 
Sent: Thursday, May 8, 2008 3:36:05 AM
Subject: Re: Saving only required files in a file wrapper?

On May 7, 2008, at 9:06 PM, Graham Cox wrote:

> On 8 May 2008, at 10:26 am, Keith Blount wrote:
>
>> The trouble with all of these methods is that they tell you not to  
>> rely on fileURL
>
> My interpretation of that advice is that at the time the read... and  
> write... methods are called, the document hasn't set up -fileURL, so  
> in that sense you can't rely on it (i.e. don't call -fileURL from  
> within these methods). But the URL passed to the methods themselves  
> as a parameter is definitely reliable. So provided you use the  
> parameter you'll be fine.

I think it means more than that.  NSDocument tries to be smart about  
atomic writes and backups.  The URL passed into the write... methods  
is not expected to be the same as the document's current location on  
disk.  You are to write the document, in whole, to the temporary  
location provided to you (about which no assumptions should be made),  
and then NSDocument will take care of swapping the newly-written  
document with the old document and deleting the old document.

Obviously, this runs directly counter to Keith's desires.  
Unfortunately, I don't know how to override these smarts in  
NSDocument, other than perhaps what I described earlier with  
NSFileWrapper.

-Ken



  

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

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

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

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

This email sent to [EMAIL PROTECTED]


How to send email without using email client

2008-05-08 Thread vinitha
Hi,
I'm working with mac 10.5 and xcode3.0.I've to send email from an
application with out using any email client.When i try to use message
framework,It doesn't work.(deliverMessage always returns no)Is there any
any way to send email from my application without using any email
client,and i've to send attachments also.

My other question is about vector graphics,Is there any way to implement
SVG in my cocoa application?Is there anyway to draw vector graphics other
than using GCDrawKit (because still it doesn't provide any
documentation).As a beginner i found it is really difficult to work with
GCDrawKit without documentation.

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


Re: self registering NSValueTransformer and bindings

2008-05-08 Thread I. Savant


Well, maybe it's language barrier as a non-native speaker ...but in  
order for the transformer to do its job it requires a reference to  
the NSTabView to be set. And I was trying to inject that reference  
through a binding.  That's what I wanted to say.


  Perhaps, but for clarity, in the Cocoa world there's an important  
distinction: IBOutlet and IBAction connections are referred to as  
connections. A "binding" refers to the Cocoa Bindings mechanism.



That does not seem to be true. But to be 100% sure I've changed it to

  NSValueTransformer *theTransformer = [[[MyValueTransformer alloc]  
init] autorelease];


...and still get the same behavior. The correct instance is always a  
MyValueTransformer and no NSValueTransformer as you said.




  I would not have expected that to be the case, but ... :-)


In
*that* instance, the outlet is nil.


Doh! ...now here I was really stupid. But then again I would think  
changing it to


- (void) awakeFromNib
<...>
would solve it. Turns out this is not enough. From looking at the  
stacktrace it seems like the framework seems to create another  
instance. So the only way I could get it to work was to register the  
transformer in the init.


  Well no, because the transformer needs to have been registered  
before the object graph in the nib is fully realized (because the  
connections and bindings that are being (re)established at that stage  
will need your transformer).



- (id) init



  Likewise with this. There's no guarantee this will work as expected  
as your project (and the OS X environment) changes.


  The documentation's example of doing this from within some class's  
+initialize method has always worked perfectly for me. I really  
suggest you use that approach unless you truly know another will work.  
It's one of those things where the behavior (and reasons for that  
behavior) depend on a lot of other factors.


And I think this could be quite neatly be abstracted away if the  
transformer had access to the NSTabView. The name of the tab would  
be the name of the account type the transformer is mapping to. Not  
such a weird idea IMO.


  I suppose that's a good argument; I just don't think it buys you  
anything in return for the trouble it's causing you ...


One thing that is still missing is to get multiple instances  
working. So basically getting rid of "NSStringFromClass([self  
class])" and replace that with data from the object's interface  
builder identity. But somehow I doubt that's easily accessible ...is  
it?


  This is what I mean - you should really have only one instance.  
Every binding you establish references this instance by its registered  
name. I may be getting confused by your explanation of your approach,  
but it still seems wrong.


  If you had this "entirely working" by taking a different approach  
than usual, I'd graciously bow to you for having found "Another Way"  
and I'd shut my trap. However, you're still saying this is mostly- 
working-but-not-quite, so I'm pointing out that your somewhat  
unconventional approach seems to be the cause of your problems. :-)


  I reserve the right to be entirely wrong and eat 'humble pie', but  
still ... simple is best (especially when 'unconventional' is causing  
issues). To put this into perspective, with experience your goal is a  
two-minute job using the approach I mentioned.


  If you're just doing this as a learning experiment, I fully  
understand, however it's best to learn the 'usual' way first, then  
experiment with other solutions. Overall, you appear to be fighting  
the frameworks, IMO.


--
I.S.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: expose - the algorithm

2008-05-08 Thread John Clayton
Yes, agreed that its almost impossible to be very optimal with many  
windows in a sensible time frame (i.e. within 10-300 ms).  I'm new to  
the packing problem and it appears over the last 40 years that lots of  
people have been banging their heads against it.  Google showed me  
quite a few approaches and research papers about it.


My idea was to improve the Expose concept - but as Jens already  
pointed out, Apple have patented the method of showing windows in a 2d  
space without overlap, including the selection of one item within the  
set of windows, the animation and about another 30 different things.


I suspect that if I progressed with any program that used the concept  
of: 'laying out windows without overlap and then selecting one', that  
Apple would be within rights to declare patent infringement, correct?   
In which case, as a small indy developer for Mac, there's no way I'm  
gonna fight that - a sad but true reality.


Comments?

Thanks
--
John Clayton
Skype: johncclayton




On May 8, 2008, at 8:58 AM, Thomas Davie wrote:



On 8 May 2008, at 06:04, Jens Alfke wrote:



On 7 May '08, at 8:50 PM, John Clayton wrote:

Does anyone know of literature or code / algorithms that I can  
look at to learn about how this is done or which approaches are  
possible?


The good news is that some of the details must be public, since  
this is patented. You can look up the patent online.
The bad news is that you'd have to license the patent from Apple to  
implement anything similar...


Some more good/bad news:
Bad: It's impossible to come up with an optimal algorithm to do this  
in sensible time.  If you do, you've solved the packing problem!
Good: There's plenty of easy to imagine simplistic aproaches that  
will have varying degrees of success.  Try maybe comparing the  
centre positions of windows to find out whether they're slightly to  
the left/right of each other, and moving them slowly in that  
direction, while shrinking them slowly until they stop overlapping.   
That one's really naïve, and won't give you as good results as  
exposé, but it's a start, and can  lead to some further playing.


Bob


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Serge Cohen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello;

One thing I don't understand, is that in MCPKit, you're supposed to  
"prepare" (that is hexcode) the BLOB when you perform the INSERT, but  
when using a query and fetch a row, the column containing a BLOB  
should already be returned as NSData... This NSData should represent  
the exact binary replicate of the INSERTED NSData (before it was hex- 
coded) ...


In other words, to my knowledge one would need to use the - 
[MCPConnection prepareBinaryData:] method at the time of the insert,  
but there should be NO need to any back conversion when getting the  
result of a QUERY.


Is there something I'm missing here ? (unless you are indeed storing  
your BLOB as a TEXT, in which case MySQL would store the hex-coded  
text rather than the binary represented by it, and in which case it  
would return the TEXT which you would have to UN-hexcode yourself ...  
if this is the case, then the problem lies in the table definition,  
you "just" have to make sure to declare the column as BLOB rather than  
TEXT, right ?)


Serge.


Le 8 mai 08 à 02:16, Ben Einstein a écrit :


Hi All,

I have an enterprise DB application that once used DO to move some  
files around (images and zip files, mostly). After some serious  
testing and lots of reading, I decided to move this to a few  
different BLOB fields in the database. Despite major warnings from  
people, I've found that images work great (specifically, NSData/ 
NSImage). I can notice a very minor speed drop a few milliseconds,  
but being able to drop DO and it's woes is completely worth it.


Unfortunately, I didn't quite test the zip files, figuring it would  
be the same. I'm using Serge Cohen's MCPKit (aka SMySQL), which has  
a nifty little function to convert NSData to a MySQL-legal NSString.  
On the other end, someone on the Apple list posted a few lines of  
code to bump returned data into it's original NSData object. With  
the zip files (no larger then 600kb) that method takes 30 - 40  
seconds to run. On an image of a similar size, it takes 0.1 seconds  
on a slow day.


Does anyone know why this would be? Is there an easy way to get  
around this? I suppose my understating of hex is lacking, but I  
always thought a hex string was a hex string was a hex string;  
length was all that mattered.


Thanks,
Ben Einstein

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgi+Y0ACgkQlz6UVQtc2uw04wCfR77KlokLWAk533hza8gF3WqQ
X4EAoOMlMyytSQdFArPkOZ+uITE9OtI5
=aw++
-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 [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Serge Cohen

-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello;

One thing I don't understand, is that in MCPKit, you're supposed to  
"prepare" (that is hexcode) the BLOB when you perform the INSERT, but  
when using a query and fetch a row, the column containing a BLOB  
should already be returned as NSData... This NSData should represent  
the exact binary replicate of the INSERTED NSData (before it was hex- 
coded) ...


In other words, to my knowledge one would need to use the - 
[MCPConnection prepareBinaryData:] method at the time of the insert,  
but there should be NO need to any back conversion when getting the  
result of a QUERY.


Is there something I'm missing here ? (unless you are indeed storing  
your BLOB as a TEXT, in which case MySQL would store the hex-coded  
text rather than the binary represented by it, and in which case it  
would return the TEXT which you would have to UN-hexcode yourself ...  
if this is the case, then the problem lies in the table definition,  
you "just" have to make sure to declare the column as BLOB rather than  
TEXT, right ?)


Serge.


Le 8 mai 08 à 02:16, Ben Einstein a écrit :


Hi All,

I have an enterprise DB application that once used DO to move some  
files around (images and zip files, mostly). After some serious  
testing and lots of reading, I decided to move this to a few  
different BLOB fields in the database. Despite major warnings from  
people, I've found that images work great (specifically, NSData/ 
NSImage). I can notice a very minor speed drop a few milliseconds,  
but being able to drop DO and it's woes is completely worth it.


Unfortunately, I didn't quite test the zip files, figuring it would  
be the same. I'm using Serge Cohen's MCPKit (aka SMySQL), which has  
a nifty little function to convert NSData to a MySQL-legal NSString.  
On the other end, someone on the Apple list posted a few lines of  
code to bump returned data into it's original NSData object. With  
the zip files (no larger then 600kb) that method takes 30 - 40  
seconds to run. On an image of a similar size, it takes 0.1 seconds  
on a slow day.


Does anyone know why this would be? Is there an easy way to get  
around this? I suppose my understating of hex is lacking, but I  
always thought a hex string was a hex string was a hex string;  
length was all that mattered.


Thanks,
Ben Einstein

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgi+Y0ACgkQlz6UVQtc2uw04wCfR77KlokLWAk533hza8gF3WqQ
X4EAoOMlMyytSQdFArPkOZ+uITE9OtI5
=aw++
-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 [EMAIL PROTECTED]


Re: self registering NSValueTransformer and bindings

2008-05-08 Thread Torsten Curdt


On May 8, 2008, at 13:59, I. Savant wrote:



Well, maybe it's language barrier as a non-native speaker ...but in  
order for the transformer to do its job it requires a reference to  
the NSTabView to be set. And I was trying to inject that reference  
through a binding.  That's what I wanted to say.


 Perhaps, but for clarity, in the Cocoa world there's an important  
distinction: IBOutlet and IBAction connections are referred to as  
connections. A "binding" refers to the Cocoa Bindings mechanism.


My bad ...always keep thinking if there is a connection it is also  
bound. I'll be more specific next time.



That does not seem to be true. But to be 100% sure I've changed it to

 NSValueTransformer *theTransformer = [[[MyValueTransformer alloc]  
init] autorelease];


...and still get the same behavior. The correct instance is always  
a MyValueTransformer and no NSValueTransformer as you said.




 I would not have expected that to be the case, but ... :-)


:-)


In
*that* instance, the outlet is nil.


Doh! ...now here I was really stupid. But then again I would think  
changing it to


- (void) awakeFromNib
<...>
would solve it. Turns out this is not enough. From looking at the  
stacktrace it seems like the framework seems to create another  
instance. So the only way I could get it to work was to register  
the transformer in the init.


 Well no, because the transformer needs to have been registered  
before the object graph in the nib is fully realized (because the  
connections and bindings that are being (re)established at that  
stage will need your transformer).


Yeah ...I would love to learn a bit more about the inner workings of  
NIB loading and the object graph establishment. Are there docs on that?

Or can one turn on a flag to get some debugging output for it?


- (id) init



 Likewise with this. There's no guarantee this will work as expected  
as your project (and the OS X environment) changes.


Hm ...that might be true. Really does depend on the inner workings.

 The documentation's example of doing this from within some class's  
+initialize method has always worked perfectly for me. I really  
suggest you use that approach unless you truly know another will  
work. It's one of those things where the behavior (and reasons for  
that behavior) depend on a lot of other factors.


But then I would have to inject the reference manually :-/ ...and the  
NSTabView is in a differnt NIB and so on. No big deal - but quite  
clumsy.


And I think this could be quite neatly be abstracted away if the  
transformer had access to the NSTabView. The name of the tab would  
be the name of the account type the transformer is mapping to. Not  
such a weird idea IMO.


 I suppose that's a good argument; I just don't think it buys you  
anything in return for the trouble it's causing you ...


Well, I would not have to care about the order of the tabs. No need to  
deal with index numbers at all. I think that's a big win for  
maintenance.


One thing that is still missing is to get multiple instances  
working. So basically getting rid of "NSStringFromClass([self  
class])" and replace that with data from the object's interface  
builder identity. But somehow I doubt that's easily  
accessible ...is it?


 This is what I mean - you should really have only one instance.  
Every binding you establish references this instance by its  
registered name. I may be getting confused by your explanation of  
your approach, but it still seems wrong.


Well, I now have a general TabIndexTransformer that finds the correct  
tab index from the tab.


- (id)transformedValue:(id)value
{
...
NSArray *items = [tabView tabViewItems];
int i = [items count];
while(i--) {
NSTabViewItem *item = [items objectAtIndex:i];
if ([[item label] isEqualToString:value]) {
return [NSNumber numberWithInt:i];
}
}
...

Right now the NSValueTransformer registration mapping is based on the  
class name


TabIndexTransformer -> instance 1 of TabIndexTransformer

but for it be of general value you would need to be able to have

 NameA -> instance 1 of TabIndexTransformer
 NameB -> instance 2 of TabIndexTransformer

Now the key would need to come from IB ...which instantiates the  
transformer.


 If you had this "entirely working" by taking a different approach  
than usual, I'd graciously bow to you for having found "Another Way"  
and I'd shut my trap. However, you're still saying this is mostly- 
working-but-not-quite, so I'm pointing out that your somewhat  
unconventional approach seems to be the cause of your problems. :-)


Well, it *is* working. At least on 10.5 ...and with the restriction  
that you can only have a single instance ...while you probably want to  
be able to have different instances for different NSTabViews. So the  
question is whether it is possible to get metadata from IB injected  
into the created object.


In IB3 there is a "Interface Builder Ide

Re: How to send email without using email client

2008-05-08 Thread August Trometer
NSMailDelivery (in the Message framework) has been deprecated in 10.5.  
Even so, it still uses Mail.app to send email.


The only way I believe you can send email (without writing your own  
SMTP client) is to use the Scripting Bridge to send the email via  
Mail.app. Apple has recently posted sample code that does just that.


-- August




On May 8, 2008, at 5:52 AM, [EMAIL PROTECTED] wrote:


Hi,
I'm working with mac 10.5 and xcode3.0.I've to send email from an
application with out using any email client.When i try to use message
framework,It doesn't work.(deliverMessage always returns no)Is there  
any

any way to send email from my application without using any email
client,and i've to send attachments also.

My other question is about vector graphics,Is there any way to  
implement
SVG in my cocoa application?Is there anyway to draw vector graphics  
other

than using GCDrawKit (because still it doesn't provide any
documentation).As a beginner i found it is really difficult to work  
with

GCDrawKit without documentation.

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: 8 Digit random number

2008-05-08 Thread Mr. Gecko
Yeah I knew that before in the days that I made c programs but it been  
so long that I forgot.


On May 8, 2008, at 6:57 AM, Gregory Weston wrote:

Since neither the question nor the answer is particularly Cocoa- 
related, I'm following up off-list. I just wanted to make sure that  
you understood that using % to scale your raw result into the range  
you want messes with the uniformity of the sequence. Consider, as a  
degenerate case, that you had a random number generator that gave  
you back a number from 0 to 15 and you wanted a number between 0 and  
11. If you did RND % 12, 0-3 will show up twice as often as any  
other result. The closer the range of the random function is to an  
integer multiple of the range you actually want, the less absolute  
impact that has but there will almost always be some skewing  
introduced. To alleviate that, you want to scale the raw result to a  
number in [0,1), multiply that by the range of your desired result  
and then add your minimum.


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Graham Cox
A cubic bezier with the two control points set to the same value is  
equivalent to a quadratic bezier. In other words the cubic is a  
superset of the quadratic.


Why do you need quadratics specifically?

G.


On 8 May 2008, at 6:06 pm, Nick Zitzmann wrote:

I searched the archives about this, and didn't find anything helpful  
(only examples that did the opposite of what I want to do, or  
include sample code that was published a year ago and is now gone).  
How do I do something resembling a quadratic curve using  
NSBezierPath instead of a cubic curve?


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/graham.cox%40bigpond.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: expose - the algorithm

2008-05-08 Thread Graham Cox
By the way, has anyone else noticed that Leopard's implementation of  
Exposé is broken slightly compared to Tiger's? I have my middle mouse  
button set to invoke Exposé, and when I do that, drag to the window I  
want, it highlights... then probably 6 times in ten it activates a  
completely different (apparently random) window. It's worse when there  
are more windows (I typically have ten or more open after a while;  
some are Java-based apps), and I'm also using several Spaces. But I  
can't reliably set up a case that always reproduces it. It works  
correctly just often enough that I haven't dropped the habit yet.


If I can get confirmation it's not just me, I'll file a bug.


G.

On 8 May 2008, at 10:41 pm, John Clayton wrote:

Apple have patented the method of showing windows in a 2d space  
without overlap, including the selection of one item within the set  
of windows


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Keys dependent on NSArrayController's selection

2008-05-08 Thread Sean McBride
On 5/8/08 1:53 AM, Dave Dribin said:

>> The docs for keyPathsForValuesAffectingValueForKey say
>> keyPaths are ok, but mmalc has mentioned on this list "provided that
>> the
>> path doesn't include to-many relationships".  This appears to be
>> true in
>> your case, so probably explains it.  The docs don't mention this
>> caveat. :(
>
>I don't believe this falls under the to-many case.  That would be
>doing something like observing "arrangedObjects.firstName" to watch
>when any first name in the array changes.  That is not supported.  You
>have to observer every object in the array.

Ah yes, quite right.

>For kicks, I did try
>"peopleController.selectionIndex" as well as
>"peopleController.selectedObjects" to no avail.

So it seems you have observed the same as I: that
keyPathsForValuesAffectingValueForKey does not seem to work with key
paths, despite the docs saying it should.

>> Also, I seem to remember reading that doing willChange/didChange
>> back-to-
>> back without actually changing anything is a no-no.  You might check
>> the
>> archives to confirm my shoddy memory.
>
>Unfortunately, my search foo must be weak.  Searching on {will/
>did}ChangeValueForKey turns up way to many hits.

This is what I was remembering:


--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: How to send email without using email client

2008-05-08 Thread Sherm Pendley
On Thu, May 8, 2008 at 5:52 AM, <[EMAIL PROTECTED]> wrote:


> I'm working with mac 10.5 and xcode3.0.I've to send email from an
> application with out using any email client.When i try to use message
> framework,It doesn't work.(deliverMessage always returns no)Is there any
> any way to send email from my application without using any email
> client,and i've to send attachments also.


Have a look at Pantomime:



sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.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 [EMAIL PROTECTED]


regarding fxPlug plugins

2008-05-08 Thread Shashi Kumar
Hey all,
   I am new to fxplug. And I wanted to create an fxplug plugin from a 
cocoa application. What should be the right way to do this ? I have fxPlug SDK 
installed. The specification is:
I have an cocoa application with UI having effects and image. And I 
want to create fxplug as output on any button event.

OR

   How can I create a fxplug as output with cocoa application. And I 
don't wanna use Xocde template for fxplug. That fxplug should get created by 
cocoa or carbon application. 


Can anyone explain it in simple and step wise manner giving some links and 
hints.

thanx a lot in advance for assistance.

with regards,
shashi.


  

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

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to send email without using email client

2008-05-08 Thread Torsten Curdt


On May 8, 2008, at 16:26, Sherm Pendley wrote:


On Thu, May 8, 2008 at 5:52 AM, <[EMAIL PROTECTED]> wrote:



I'm working with mac 10.5 and xcode3.0.I've to send email from an
application with out using any email client.When i try to use message
framework,It doesn't work.(deliverMessage always returns no)Is  
there any

any way to send email from my application without using any email
client,and i've to send attachments also.



Have a look at Pantomime:

   


...which s LGPL - just to be aware of


There is also MailCore

 http://www.theronge.com/mailcore/

and EdMessage

 http://www.mulle-kybernetik.com/software/EDFrameworks/

No clue which one of those is most complete or has the nicest API.  
Anyone more experiences with the various frameworks?


Kind of sucks one has to manage the SMTP server in every app  
now ...but well.


cheers
--
Torsten
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setting frequency using CoreAudio (like iTunes - Equalizer )

2008-05-08 Thread Jens Alfke


On 7 May '08, at 11:44 PM, Rajeswar Rao wrote:

I am trying to implement iTunes-Equalizer kind of functionality to  
my mp3 playback.

Can any body direct me how to do this.
I started looking into CoreAudio frameworks.


You'll need to use CoreAudio, specifically an AUGraph of AudioUnits.

Be warned: CoreAudio is very hard to learn. Probably the most  
difficult OS X API I've used. At least there are a number of example  
applications — look in /Developer/Examples/CoreAudio/. There are a few  
that use AudioUnits to play files, which is where you'd want to start  
from.


Also, CoreAudio is off-topic for this list. Please use coreaudio-api  
instead.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: How to send email without using email client

2008-05-08 Thread Jens Alfke


On 8 May '08, at 3:10 AM, vinitha ks wrote:

My other question is about vector graphics,Is there any way to  
implement

SVG in my cocoa application?


Use a WebView and load an SVG document into it.


Is there anyway to draw vector graphics other
than using GCDrawKit (because still it doesn't provide any
documentation).


You shouldn't need a 3rd party framework just to do drawing. CoreData  
draws vector graphics, and Cocoa has wrappers like NSBezierPath.


—Jens

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Threading - How its done?

2008-05-08 Thread Scott Ribe
> What is sounds like you're saying is something like:

No, not exactly, because you know that str is constant and its value is set
at load time, so multiple readers without locks will be safe.

However, what he was responding to was much more broad, and not correct:

> Now if two threads are just reading the same piece of data it's ok
> for them to do so at the same time,

When was the data written? Unless you're dealing with const data, then you
still require synchronization primitives ON THE READS, to make sure that the
cache of the processor executing the reads is refreshed from main memory as
needed. Unless, of course, you know the exact details of the processor
you're running on and that this is not necessary.

-- 
Scott Ribe
[EMAIL PROTECTED]
http://www.killerbytes.com/
(303) 722-0567 voice


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Ben Einstein

Hi Serge,

It's really quite strange. MySQL does return an NSData object, but  
there's a byte level problem. Again, I really don't know much about  
this stuff but NSImage instances fail to be unarchived and zip files  
can't be unpacked. From what I understand, MySQL is giving us back  
hex. So I used your prepareBinaryData: method, but any time I got a  
query back with that data, it was no good unless I ran Hayden's hex  
conversion loop. My columns I'm writing to are of type LONGBLOB.


In regards to the Shark testing: I knew what loop was getting caught  
up, I never, ever knew that Shark could get so specific as I've now  
discovered. I shouldn't have dismissed that suggestion so soon. Most  
of my experience with optimization is with Instuments (and their pre- 
leopard counterparts), which can't get that specific (again, as far as  
I know).


Ben

On May 8, 2008, at 9:01 AM, Serge Cohen wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello;

One thing I don't understand, is that in MCPKit, you're supposed to  
"prepare" (that is hexcode) the BLOB when you perform the INSERT,  
but when using a query and fetch a row, the column containing a BLOB  
should already be returned as NSData... This NSData should represent  
the exact binary replicate of the INSERTED NSData (before it was hex- 
coded) ...


In other words, to my knowledge one would need to use the - 
[MCPConnection prepareBinaryData:] method at the time of the insert,  
but there should be NO need to any back conversion when getting the  
result of a QUERY.


Is there something I'm missing here ? (unless you are indeed storing  
your BLOB as a TEXT, in which case MySQL would store the hex-coded  
text rather than the binary represented by it, and in which case it  
would return the TEXT which you would have to UN-hexcode  
yourself ... if this is the case, then the problem lies in the table  
definition, you "just" have to make sure to declare the column as  
BLOB rather than TEXT, right ?)


Serge.


Le 8 mai 08 à 02:16, Ben Einstein a écrit :


Hi All,

I have an enterprise DB application that once used DO to move some  
files around (images and zip files, mostly). After some serious  
testing and lots of reading, I decided to move this to a few  
different BLOB fields in the database. Despite major warnings from  
people, I've found that images work great (specifically, NSData/ 
NSImage). I can notice a very minor speed drop a few milliseconds,  
but being able to drop DO and it's woes is completely worth it.


Unfortunately, I didn't quite test the zip files, figuring it would  
be the same. I'm using Serge Cohen's MCPKit (aka SMySQL), which has  
a nifty little function to convert NSData to a MySQL-legal  
NSString. On the other end, someone on the Apple list posted a few  
lines of code to bump returned data into it's original NSData  
object. With the zip files (no larger then 600kb) that method takes  
30 - 40 seconds to run. On an image of a similar size, it takes 0.1  
seconds on a slow day.


Does anyone know why this would be? Is there an easy way to get  
around this? I suppose my understating of hex is lacking, but I  
always thought a hex string was a hex string was a hex string;  
length was all that mattered.


Thanks,
Ben Einstein

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgi+Y0ACgkQlz6UVQtc2uw04wCfR77KlokLWAk533hza8gF3WqQ
X4EAoOMlMyytSQdFArPkOZ+uITE9OtI5
=aw++
-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 [EMAIL PROTECTED]


Re: Core Data with NSArrayController Confusion

2008-05-08 Thread Sean McBride
On 4/8/08 3:53 PM, I. Savant said:

>On Tue, Apr 8, 2008 at 3:34 PM, Michael Burns <[EMAIL PROTECTED]> wrote:
>> Interestingly enough, I started looking back to figure out where I had read
>> that and realized it had come up in a thread I started back in September
>> (http://www.cocoabuilder.com/archive/message/cocoa/2007/9/21/189533).  The
>> only way I have found to accomplish what I need to is by putting the
code in
>> my CellMapWindowController -- linking the "New Cell" button to my own
custom
>> insert cell code which handles all the object creation/fetching I mentioned
>> in my previous post.
>
>  I hadn't seen that thread but I disagree with the assertion that
>-awakeFromInsert is a bad place to fetch just because "it happens from
>within one of the disallowed methods". Sure, certain situations can
>cause problems, but not all.

I have to disagree with your disagreement. :)

I am finding calling executeFetchRequest during awakeFromInsert quite
problematic.  I'd be interested to know more about how you do it
successfully.  What are the "certain situations"?

In my case, creating a new Foo requires finding existing Bars and
setting up relationships between them.  It seemed to me that doing this
in the model layer was better than doing it in the controller layer, so
in Foo's awakeFromInsert I do a fetch to find the Bars.  But this
results in bizarre problems, like the new Foo appearing twice in a
tableview (as Michael reported at the start of this thread).  Even if I
do the fetch but don't actually use the results it's still problematic.
Commenting out the one line that calls executeFetchRequest fixes it.

(Yes, this is a reply to a month-old thread...)


--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: regarding fxPlug plugins

2008-05-08 Thread Steve Christensen

On May 8, 2008, at 7:10 AM, Shashi Kumar wrote:


I am new to fxplug. And I wanted to create an fxplug plugin from a
cocoa application. What should be the right way to do this ? I have
fxPlug SDK installed. The specification is: I have an cocoa  
application
with UI having effects and image. And I want to create fxplug as  
output

on any button event.

OR

How can I create a fxplug as output with cocoa application. And I  
don't

wanna use Xocde template for fxplug. That fxplug should get created by
cocoa or carbon application.

Can anyone explain it in simple and step wise manner giving some links
and hints.


Your description above didn't make it clear to me exactly what you want
to do, but here's I understood it:

"I want to create a Cocoa application that will allow a user to
define an effect. When the user pushes a button in the UI, the
application will then create a FxPlug plugin that will implement
the effect."

Is that correct?

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Saving only required files in a file wrapper?

2008-05-08 Thread Michael Nickerson


On May 8, 2008, at 7:30 AM, Keith Blount wrote:

Apologies for so soon a follow up, but I've just been experimenting  
with -writeToURL:ofType:forSaveOperation:originalContentsURL:error:  
and the results are disastrous. It turns out that *every single  
time* it is invoked, absoluteURL is a temporary location and *not*  
the original URL. So to use this method successfully I would need to  
copy the whole file package across to that location every time,  
which is exactly what I _don't_ want to do. This seems a little  
insane to me. There must be a mechanism in place that just lets you  
save into a package folder without having to write the whole thing  
out every time...


Thanks again and all the best,
Keith



I went through some of this recently - I'm using a helper tool to  
actually save the files, and I had to figure some of this out to get  
that working right.


absoluteURL is going to always be a temp location because that's how  
the document system works - it writes to the temp location, then  
overwrites the original location if that's successful.  Keeps file  
corruption to a minimum.


absoluteOriginalContentsURL should probably be the original URL.  The  
only time it's not likely to be the original path (what's returned by  
[self fileURL]) is if the user has moved / renamed the original file  
in between when it was opened and when it's being saved.  (I'm fairly  
certain this is why you're told not to use -fileURL when writing -  
because that's not updated if the user moves / renames the file while  
it's being edited.)


If you don't want to rely on that, there's nothing stopping you from  
creating a new ivar to save the URL passed in when you read the file.   
Though that can break if the user moves / renames the file while it's  
being edited.  I know, not likely, but you can't be 100% certain on  
that.  If you'd like to do this, but want to be certain, you could get  
the original path when you read and convert it to a file alias, then  
resolve the alias when you're writing - then you're guaranteed to have  
the correct path (this is what I actually decided to do).  The only  
way that would break is if the user moves the file to a different hard  
drive, and I believe the normal NSDocument methods wouldn't work  
correctly in that case anyway (I believe the user gets shown a dialog  
saying the original file couldn't be found).


Once you have the original path (whichever way you choose to get it),  
you can do what you were before to save the files in the wrapper.  Or,  
if you want to, you can save it to the temp location, and then  
overwrite the individual files yourself using NSFileManager.  Though  
if you do that, *make sure to delete the temp file* before returning  
(if you use the same path as absoluteURL for the temp file, anyway).   
If you don't, the document system will copy it over anyway and you'll  
wind up with your original problem. I had an interesting time figuring  
that last part out.  In my case, the original files aren't actually  
writable by anyone but root, and it would "fail" when it tried to copy  
the temp files over the original files (even though my helper tool had  
actually already done that).  Made for an interesting case where the  
file was actually saved but the app didn't think so.


Hope that helps out some.


--
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.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 [EMAIL PROTECTED]


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Nick Zitzmann


On May 8, 2008, at 7:33 AM, Graham Cox wrote:

A cubic bezier with the two control points set to the same value is  
equivalent to a quadratic bezier. In other words the cubic is a  
superset of the quadratic.


Why do you need quadratics specifically?



I'm reading in a file format that uses only a single control point for  
curved edges.


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


Re: Saving only required files in a file wrapper?

2008-05-08 Thread Keith Blount
Hi,

Many thanks for your reply, much appreciated - it all helps. I've spent the 
last couple of hours digging deeper into this, and I think what I'm going to 
try to do next is override at a slightly lower level, by overriding 
-writeSafelyToURL:ofType:forSaveOperation:error:. I found the part of the 
documentation that shows a diagram of the sequence of save events, and it turns 
out that this is the method that sets up the temporary folders and URLs that 
get passed into -writeToURL:... If I override and do my writing inside the 
package there, I think it should work. The docs say that you should always call 
super inside that method, but I found an Apple sample project, 
QTKitCreateMovie, that doesn't, and which shows this method being overridden to 
do something similar to what I want to do. Certainly that is the method that 
creates the behaviour that I want to change, so I am hopeful...

Thanks again and all the best,
Keith

- Original Message 
From: Michael Nickerson <[EMAIL PROTECTED]>
To: Keith Blount <[EMAIL PROTECTED]>
Cc: Cocoa-Dev List 
Sent: Thursday, May 8, 2008 5:45:10 PM
Subject: Re: Saving only required files in a file wrapper?


On May 8, 2008, at 7:30 AM, Keith Blount wrote:

> Apologies for so soon a follow up, but I've just been experimenting  
> with -writeToURL:ofType:forSaveOperation:originalContentsURL:error:  
> and the results are disastrous. It turns out that *every single  
> time* it is invoked, absoluteURL is a temporary location and *not*  
> the original URL. So to use this method successfully I would need to  
> copy the whole file package across to that location every time,  
> which is exactly what I _don't_ want to do. This seems a little  
> insane to me. There must be a mechanism in place that just lets you  
> save into a package folder without having to write the whole thing  
> out every time...
>
> Thanks again and all the best,
> Keith
>

I went through some of this recently - I'm using a helper tool to  
actually save the files, and I had to figure some of this out to get  
that working right.

absoluteURL is going to always be a temp location because that's how  
the document system works - it writes to the temp location, then  
overwrites the original location if that's successful.  Keeps file  
corruption to a minimum.

absoluteOriginalContentsURL should probably be the original URL.  The  
only time it's not likely to be the original path (what's returned by  
[self fileURL]) is if the user has moved / renamed the original file  
in between when it was opened and when it's being saved.  (I'm fairly  
certain this is why you're told not to use -fileURL when writing -  
because that's not updated if the user moves / renames the file while  
it's being edited.)

If you don't want to rely on that, there's nothing stopping you from  
creating a new ivar to save the URL passed in when you read the file.  
Though that can break if the user moves / renames the file while it's  
being edited.  I know, not likely, but you can't be 100% certain on  
that.  If you'd like to do this, but want to be certain, you could get  
the original path when you read and convert it to a file alias, then  
resolve the alias when you're writing - then you're guaranteed to have  
the correct path (this is what I actually decided to do).  The only  
way that would break is if the user moves the file to a different hard  
drive, and I believe the normal NSDocument methods wouldn't work  
correctly in that case anyway (I believe the user gets shown a dialog  
saying the original file couldn't be found).

Once you have the original path (whichever way you choose to get it),  
you can do what you were before to save the files in the wrapper.  Or,  
if you want to, you can save it to the temp location, and then  
overwrite the individual files yourself using NSFileManager.  Though  
if you do that, *make sure to delete the temp file* before returning  
(if you use the same path as absoluteURL for the temp file, anyway).  
If you don't, the document system will copy it over anyway and you'll  
wind up with your original problem. I had an interesting time figuring  
that last part out.  In my case, the original files aren't actually  
writable by anyone but root, and it would "fail" when it tried to copy  
the temp files over the original files (even though my helper tool had  
actually already done that).  Made for an interesting case where the  
file was actually saved but the app didn't think so.

Hope that helps out some.


--
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.net


  

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

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

Please do not post adm

Re: NSStream blocking behavior?

2008-05-08 Thread Michael Gardner
Okay, then next question: what will happen if I call -write:maxLength:  
on an NSOutputStream without having received a  
NSStreamEventHasSpaceAvailable event? Is is guaranteed to block until  
it has written at least one byte (assuming we're not dealing with a  
fixed-length stream that has reached its capacity)?


I ask because, given that run-loop scheduling is not a guarantee  
against blocking, I plan to put my NSOutputStream writing code in a  
separate thread. It would be nice if I can ignore the stream events  
entirely and just call -write:maxLength: whenever the thread receives  
data to write, with something like:


- (void)sendLine: (NSString*)line {
NSUInteger bytesWritten = 0;
	NSUInteger bytesToWrite = [line lengthOfBytesUsingEncoding:  
NSUTF8StringEncoding];

char const * bytes = [line UTF8String];
while (bytesWritten < bytesToWrite) {
		NSInteger result = [outputStream write: bytes + bytesWritten  
maxLength: bytesToWrite - bytesWritten];

if (result <= 0)
			@throw [NSException exceptionWithName: @"WriterThreadException"  
reason: @"Error writing to output stream" userInfo: nil];

bytesWritten += result;
}
}

I would then use -performSelector:onThread:withObject:waitUntilDone:  
from my main thread to queue data for sendLine to write. Is this a  
viable approach?


-Michael

On May 8, 2008, at 2:58 AM, Stefan Haller wrote:


Michael Ash <[EMAIL PROTECTED]> wrote:


NSStream matches the semantics of the UNIX read/write calls. In both
cases, if you are informed that data or space is available, you can
issue a read or write for an arbitrary amount of data and be
guaranteed that it will not block.


I would have thought so too, but the NSStream documentation seems to
disagree (this is from the "Stream Programming Guide for Cocoa"
document):

: It should be pointed out that neither the polling nor run-loop
: scheduling approaches are airtight defenses against blocking. If the
: NSInputStream hasBytesAvailable method or the NSOutputStream
: hasSpaceAvailable method returns NO, it means in both cases that the
: stream definitely has no available bytes or space. However, if  
either

: of these methods returns YES, it can mean that there is available
: bytes or space or that the only way to find out is to attempt a read
: or a write operation (which could lead to a momentary block). The
: NSStreamEventHasBytesAvailable and NSStreamEventHasSpaceAvailable
: stream events have identical semantics.

I'm not sure exactly what "momentary block" means here.


--
Stefan Haller
Ableton
http://www.ableton.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/gardnermj%40gmail.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Avoiding NSAccessibilityException?

2008-05-08 Thread Gerd Knops


On May 7, 2008, at 8:31 PM, Martin Wierschin wrote:

When access for assistive devices is enabled in the system  
preferences, the exception handler in my application catches  
bunches of NSAccessibilityExceptions when a panel is opened.


Any way to avoid that?


You can have your NSExceptionHandler delegate methods ignore  
accessibility exceptions, eg:


- (BOOL) exceptionHandler:(NSExceptionHandler*)handler  
shouldHandleException:(NSException*)exception mask:(unsigned)mask

{
return ! [[exception name] isEqualToString:NSAccessibilityException];
}

I don't know how effective this is though.


Doohhh... I was focussed on trying to deal with the cause (probably  
inside Cocoa) that it didn't occur to me to just treat the symptom  
which appears appropriate in this case.


Thanks

Gerd

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-08 Thread Gary L. Wade
Sorry, I misread your suggested method, but, as Adam points out, it still isn't 
adequate for someone who has free-styled 8-bit text with no idea what the 
original encoding was.

> 
>On Wednesday, May 07, 2008, at 12:37PM, "Jean-Daniel Dupas" 
><[EMAIL PROTECTED]> wrote:
>>What make you think this function assumes an exact encoding ? This  
>>method is not the same than +[NSString  
>>stringWithContentsOfFile:encoding:error:].
>>
>>The method +stringWithContentsOfFile:usedEncoding:error: returns the  
>>sniffed encoding by reference using the second argument. At least  
>>that's what the documentation says: “ This method attempts to  
>>determine the encoding of the file at path.”
>>This method was introduced in Tiger, that's maybe why you never see it  
>>before.
>
>Unfortunately, that method doesn't work unless you have UTF-16 or UTF-32 with 
>a BOM on Tiger, which makes it less useful than it might be.  On Leopard it 
>reads xattrs, then tries UTF-8 if it's not UTF-16/32, but it certainly doesn't 
>sniff encodings like TEC.  I was never motivated enough to figure out TEC, so 
>basically ended up checking for BOM, trying UTF-8, and then using MacRoman if 
>all else failed.
>
>-- 
>adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Chris Williams
I'm doing exactly what you are describing, using Serge's great stuff, and it
works perfectly.  I'm not sure what your problem is...  I just put it in
with the "prepare..." function, and when I get the thing back from MySQL,
pump it into an NSImage, and voila, it works fine.  If it's stored in a
blob, MySQL is going to give you back byte data, not hex.

> From: Ben Einstein <[EMAIL PROTECTED]>
> Date: Thu, 8 May 2008 12:11:46 -0400
> To: Serge Cohen <[EMAIL PROTECTED]>
> Cc: cocoa dev 
> Subject: Re: BLOBs, MySQL, hex. Oh my
> 
> Hi Serge,
> 
> It's really quite strange. MySQL does return an NSData object, but
> there's a byte level problem. Again, I really don't know much about
> this stuff but NSImage instances fail to be unarchived and zip files
> can't be unpacked. From what I understand, MySQL is giving us back
> hex. So I used your prepareBinaryData: method, but any time I got a
> query back with that data, it was no good unless I ran Hayden's hex
> conversion loop. My columns I'm writing to are of type LONGBLOB.
> 
> In regards to the Shark testing: I knew what loop was getting caught
> up, I never, ever knew that Shark could get so specific as I've now
> discovered. I shouldn't have dismissed that suggestion so soon. Most
> of my experience with optimization is with Instuments (and their pre-
> leopard counterparts), which can't get that specific (again, as far as
> I know).
> 
> Ben
> 
> On May 8, 2008, at 9:01 AM, Serge Cohen wrote:
> 
>> -BEGIN PGP SIGNED MESSAGE-
>> Hash: SHA1
>> 
>> Hello;
>> 
>> One thing I don't understand, is that in MCPKit, you're supposed to
>> "prepare" (that is hexcode) the BLOB when you perform the INSERT,
>> but when using a query and fetch a row, the column containing a BLOB
>> should already be returned as NSData... This NSData should represent
>> the exact binary replicate of the INSERTED NSData (before it was hex-
>> coded) ...
>> 
>> In other words, to my knowledge one would need to use the -
>> [MCPConnection prepareBinaryData:] method at the time of the insert,
>> but there should be NO need to any back conversion when getting the
>> result of a QUERY.
>> 
>> Is there something I'm missing here ? (unless you are indeed storing
>> your BLOB as a TEXT, in which case MySQL would store the hex-coded
>> text rather than the binary represented by it, and in which case it
>> would return the TEXT which you would have to UN-hexcode
>> yourself ... if this is the case, then the problem lies in the table
>> definition, you "just" have to make sure to declare the column as
>> BLOB rather than TEXT, right ?)
>> 
>> Serge.
>> 
>> 
>> Le 8 mai 08 à 02:16, Ben Einstein a écrit :
>> 
>>> Hi All,
>>> 
>>> I have an enterprise DB application that once used DO to move some
>>> files around (images and zip files, mostly). After some serious
>>> testing and lots of reading, I decided to move this to a few
>>> different BLOB fields in the database. Despite major warnings from
>>> people, I've found that images work great (specifically, NSData/
>>> NSImage). I can notice a very minor speed drop a few milliseconds,
>>> but being able to drop DO and it's woes is completely worth it.
>>> 
>>> Unfortunately, I didn't quite test the zip files, figuring it would
>>> be the same. I'm using Serge Cohen's MCPKit (aka SMySQL), which has
>>> a nifty little function to convert NSData to a MySQL-legal
>>> NSString. On the other end, someone on the Apple list posted a few
>>> lines of code to bump returned data into it's original NSData
>>> object. With the zip files (no larger then 600kb) that method takes
>>> 30 - 40 seconds to run. On an image of a similar size, it takes 0.1
>>> seconds on a slow day.
>>> 
>>> Does anyone know why this would be? Is there an easy way to get
>>> around this? I suppose my understating of hex is lacking, but I
>>> always thought a hex string was a hex string was a hex string;
>>> length was all that mattered.
>>> 
>>> Thanks,
>>> Ben Einstein
>> -BEGIN PGP SIGNATURE-
>> Version: GnuPG v1.4.8 (Darwin)
>> 
>> iEYEARECAAYFAkgi+Y0ACgkQlz6UVQtc2uw04wCfR77KlokLWAk533hza8gF3WqQ
>> X4EAoOMlMyytSQdFArPkOZ+uITE9OtI5
>> =aw++
>> -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/chris%40clwill.com
> 
> This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Keys dependent on NSArrayController's selection

2008-05-08 Thread Dave Dribin

On May 8, 2008, at 9:22 AM, Sean McBride wrote:

On 5/8/08 1:53 AM, Dave Dribin said:

For kicks, I did try
"peopleController.selectionIndex" as well as
"peopleController.selectedObjects" to no avail.


So it seems you have observed the same as I: that
keyPathsForValuesAffectingValueForKey does not seem to work with key
paths, despite the docs saying it should.


Yeah, I'm confused.  I think this *should* work.  Is it broken, or are  
the docs just not pointing out a known limitation?



This is what I was remembering:



That's pretty clear, and I'm understanding that I *shouldn't* do  
willChange/didChange.  What I'm lacking is information of how to do it  
the "proper" way.  If keyPathsForValuesAffectingValueForKey: is not  
effective, what are my options?


I guess another option is to not use bindings for the button's enabled  
state, and just do it the "old fashioned way" with an outlet to the  
button, along with manual KVO:


- (void)updateButtonEnabled {
[button setEnabled: self.canEnableButton];
}

- (void) awakeFromNib {
[peopleController addObserver:self
   forKeyPath:@"selectionIndexes"
  options:0
  context:SelectionIndexesContext];
}

- (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object  
change:(NSDictionary *)change context:(void *)context

{
if (context == SelectionIndexesContext)
[self updateButtonEnabled];
}

-Dave

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Keys dependent on NSArrayController's selection

2008-05-08 Thread Sean McBride
On 5/8/08 1:45 PM, Dave Dribin said:

>On May 8, 2008, at 9:22 AM, Sean McBride wrote:
>> On 5/8/08 1:53 AM, Dave Dribin said:
>>> For kicks, I did try
>>> "peopleController.selectionIndex" as well as
>>> "peopleController.selectedObjects" to no avail.
>>
>> So it seems you have observed the same as I: that
>> keyPathsForValuesAffectingValueForKey does not seem to work with key
>> paths, despite the docs saying it should.
>
>Yeah, I'm confused.  I think this *should* work.  Is it broken, or are
>the docs just not pointing out a known limitation?

It seems to me it should work too.  Perhaps someone from Apple can
enlighten us?  :)

Otherwise, I suggest you make a sample app and file a Radar.  This is on
my long and growing list of things to pester people about at WWDC. :)

--

Sean McBride, B. Eng [EMAIL PROTECTED]
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 [EMAIL PROTECTED]


Re: How to convert UInt8 array to NSString

2008-05-08 Thread Joe Goh
Hi Marc,

Wish this thread existed 2 years ago.  :-)  But I digress..

You may also consider using the alternative approach of getting the
user to select the most readable encoding (after you've tried
automatically detecting it) and floating the most appropriate/most
frequently used encodings on top.

A screenshot of that approach in action in my app:
http://funkeemonk.cachefly.net/international.png

Good luck!
Joe Goh
FunkeeMonk Technology
http://www.funkeemonk.com/

On 5/9/08, "Gary L. Wade" <[EMAIL PROTECTED]> wrote:
>  Sorry, I misread your suggested method, but, as Adam points out, it still 
> isn't
> adequate for someone who has free-styled 8-bit text with no idea what the 
> original
> encoding was.
>
>  >
>  >On Wednesday, May 07, 2008, at 12:37PM, "Jean-Daniel Dupas"
>  ><[EMAIL PROTECTED]> wrote:
>  >>What make you think this function assumes an exact encoding ? This
>  >>method is not the same than +[NSString
>  >>stringWithContentsOfFile:encoding:error:].
>  >>
>  >>The method +stringWithContentsOfFile:usedEncoding:error: returns the
>  >>sniffed encoding by reference using the second argument. At least
>  >>that's what the documentation says: “ This method attempts to
>  >>determine the encoding of the file at path.â€
>  >>This method was introduced in Tiger, that's maybe why you never see it
>  >>before.
>  >
>  >Unfortunately, that method doesn't work unless you have UTF-16 or UTF-32 
> with
>  >a BOM on Tiger, which makes it less useful than it might be.  On Leopard it
>  >reads xattrs, then tries UTF-8 if it's not UTF-16/32, but it certainly 
> doesn't
>  >sniff encodings like TEC.  I was never motivated enough to figure out TEC, 
> so
>  >basically ended up checking for BOM, trying UTF-8, and then using MacRoman 
> if
>  >all else failed.
>  >
>  >--
>  >adam
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Ben Einstein
I was very surprised that exactly what you're describing didn't work  
for me. I never tested it with an NSImage but it definitely fails with  
a zip archive. I get an "unable to read pkzip package" error from ditto.


I'll try it with an image and see what happens. I still don't know why  
there would be a difference.


Ben

On May 8, 2008, at 2:25 PM, Chris Williams wrote:

I'm doing exactly what you are describing, using Serge's great  
stuff, and it
works perfectly.  I'm not sure what your problem is...  I just put  
it in
with the "prepare..." function, and when I get the thing back from  
MySQL,
pump it into an NSImage, and voila, it works fine.  If it's stored  
in a

blob, MySQL is going to give you back byte data, not hex.


From: Ben Einstein <[EMAIL PROTECTED]>
Date: Thu, 8 May 2008 12:11:46 -0400
To: Serge Cohen <[EMAIL PROTECTED]>
Cc: cocoa dev 
Subject: Re: BLOBs, MySQL, hex. Oh my

Hi Serge,

It's really quite strange. MySQL does return an NSData object, but
there's a byte level problem. Again, I really don't know much about
this stuff but NSImage instances fail to be unarchived and zip files
can't be unpacked. From what I understand, MySQL is giving us back
hex. So I used your prepareBinaryData: method, but any time I got a
query back with that data, it was no good unless I ran Hayden's hex
conversion loop. My columns I'm writing to are of type LONGBLOB.

In regards to the Shark testing: I knew what loop was getting caught
up, I never, ever knew that Shark could get so specific as I've now
discovered. I shouldn't have dismissed that suggestion so soon. Most
of my experience with optimization is with Instuments (and their pre-
leopard counterparts), which can't get that specific (again, as far  
as

I know).

Ben

On May 8, 2008, at 9:01 AM, Serge Cohen wrote:


-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

Hello;

One thing I don't understand, is that in MCPKit, you're supposed to
"prepare" (that is hexcode) the BLOB when you perform the INSERT,
but when using a query and fetch a row, the column containing a BLOB
should already be returned as NSData... This NSData should represent
the exact binary replicate of the INSERTED NSData (before it was  
hex-

coded) ...

In other words, to my knowledge one would need to use the -
[MCPConnection prepareBinaryData:] method at the time of the insert,
but there should be NO need to any back conversion when getting the
result of a QUERY.

Is there something I'm missing here ? (unless you are indeed storing
your BLOB as a TEXT, in which case MySQL would store the hex-coded
text rather than the binary represented by it, and in which case it
would return the TEXT which you would have to UN-hexcode
yourself ... if this is the case, then the problem lies in the table
definition, you "just" have to make sure to declare the column as
BLOB rather than TEXT, right ?)

Serge.


Le 8 mai 08 à 02:16, Ben Einstein a écrit :


Hi All,

I have an enterprise DB application that once used DO to move some
files around (images and zip files, mostly). After some serious
testing and lots of reading, I decided to move this to a few
different BLOB fields in the database. Despite major warnings from
people, I've found that images work great (specifically, NSData/
NSImage). I can notice a very minor speed drop a few milliseconds,
but being able to drop DO and it's woes is completely worth it.

Unfortunately, I didn't quite test the zip files, figuring it would
be the same. I'm using Serge Cohen's MCPKit (aka SMySQL), which has
a nifty little function to convert NSData to a MySQL-legal
NSString. On the other end, someone on the Apple list posted a few
lines of code to bump returned data into it's original NSData
object. With the zip files (no larger then 600kb) that method takes
30 - 40 seconds to run. On an image of a similar size, it takes 0.1
seconds on a slow day.

Does anyone know why this would be? Is there an easy way to get
around this? I suppose my understating of hex is lacking, but I
always thought a hex string was a hex string was a hex string;
length was all that mattered.

Thanks,
Ben Einstein

-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.8 (Darwin)

iEYEARECAAYFAkgi+Y0ACgkQlz6UVQtc2uw04wCfR77KlokLWAk533hza8gF3WqQ
X4EAoOMlMyytSQdFArPkOZ+uITE9OtI5
=aw++
-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/chris%40clwill.com

This email sent to [EMAIL PROTECTED]




___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mail

An Example NSStatusItem with a menu

2008-05-08 Thread J. Todd Slack

Hi All,

Does anyone have an example os a NSStatusitem that programatically  
creates the menu and menu items below it?


-Jason

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Thomas Engelmeier


On 08.05.2008, at 21:27, Ben Einstein wrote:

I was very surprised that exactly what you're describing didn't work  
for me. I never tested it with an NSImage but it definitely fails  
with a zip archive. I get an "unable to read pkzip package" error  
from ditto.


I'll try it with an image and see what happens. I still don't know  
why there would be a difference.


The "why" is the secondary issue. The first question should be "what +  
where" is the difference. Dump both data to a binary file and compare  
them with a file comparison tool / binary diff.


Every time I had a similar problem that was the first step to finding  
a solution.


Regards,
Tom_E
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: BLOBs, MySQL, hex. Oh my

2008-05-08 Thread Chris Williams
That would make me suspect the way in which you are unzipping it, not the
way it's stored.  I assume you are writing it to a file, and passing that to
your unzip routine?  Is the issue there?


> From: Ben Einstein <[EMAIL PROTECTED]>
> Subject: Re: BLOBs, MySQL, hex. Oh my
> 
> I was very surprised that exactly what you're describing didn't work
> for me. I never tested it with an NSImage but it definitely fails with
> a zip archive. I get an "unable to read pkzip package" error from ditto.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to send email without using email client

2008-05-08 Thread Jim Turner
On Thu, May 8, 2008 at 5:10 AM, vinitha ks <[EMAIL PROTECTED]> wrote:
>
> Hi,
> I'm working with mac 10.5 and xcode3.0.I've to send email from an
> application with out using any email client.When i try to use message
> framework,It doesn't work.(deliverMessage always returns no)Is there any
> any way to send email from my application without using any email
> client,and i've to send attachments also.
>

I've had pretty good success with jwSMTP
(http://johnwiggins.net/jwsmtp/).  It's a C++ library but it's been
pretty simple to wrap some basic Cocoa around it.  Does attachments
although I've never used it for that.

-- 
Jim
http://nukethemfromorbit.com
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to send email without using email client

2008-05-08 Thread Shawn Erickson
On Thu, May 8, 2008 at 8:10 AM, Jens Alfke <[EMAIL PROTECTED]> wrote:

> You shouldn't need a 3rd party framework just to do drawing. CoreData draws
> vector graphics, and Cocoa has wrappers like NSBezierPath.

Think you meant Core Graphics.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Dictionary Enumeration

2008-05-08 Thread Western Botanicals
I am getting the following error that seems to be happening because I  
am enumerating through a dictionary while it is being edited. I really  
need these things to happen simultaneously. What can I do?


2008-05-08 17:02:58.558 TimeKeeper[1641:813] *** NSDistantObject  
initWithCoder: 0x4d not given away for conn 0x16d150
2008-05-08 17:02:58.559 TimeKeeper[1641:813] *** -[NSConcretePortCoder  
decodeInvocation]: no local target
2008-05-08 17:03:10.729 TimeKeeper[1641:813] *** Collection  
 was mutated while being enumerated.'


Justin Giboney





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: expose - the algorithm

2008-05-08 Thread Gary L. Wade
Google TreeMap and look at the links for space-constrained visualization of 
hierarchies as a method of doing something similar to what Expose does.

> Hi All,
> 
> I have a task to move windows around and fit them into a defined space, 
> almost 
> exactly like Expose. I.e. the space to fit all the windows to is defined 
> (i.e. 
> its your display), but I can scale windows in order to make my space 
> allocation more efficient as required.
> 
> Does anyone know of literature or code / algorithms that I can look at to 
> learn about how this is done or which approaches are possible?
> 
>  Cheers!
> 
>  --
> John Clayton
> http://www.coderage-software.com/
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dictionary Enumeration

2008-05-08 Thread Nick Zitzmann


On May 8, 2008, at 5:05 PM, Western Botanicals wrote:

I am getting the following error that seems to be happening because  
I am enumerating through a dictionary while it is being edited. I  
really need these things to happen simultaneously. What can I do?



You cannot edit an NSMutableDictionary while enumerating it. You can  
operate on a copy, or batch changes until enumeration is over, but you  
cannot directly edit an object that is being enumerated.


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


Re: Dictionary Enumeration

2008-05-08 Thread Western Botanicals

How can I lock it then?

Justin Giboney
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSNumberFormatter behavior [Solved]

2008-05-08 Thread Chataka

F. Testuz,
Thank you very much for your reply. My both problems were fixed.

I guess the second problem was the same error. I guess the alert panel
is shown only when nil is set through an IB element, and is not shown
when it is set within the code.

-Chataka

On 2008/05/08, at 4:06, Frédéric Testuz wrote:


Le 6 mai 08 à 03:29, Chataka a écrit :


Hello,

My app has a NSTextField on a UI window to accept user input and to  
display a NSNumber
in a model object. The NSTextField and the NSNumber are bound using  
Cocoa Bindings,
and the NSTextField is set a NSNumberFormatter. It is a very simple  
UI but I have two
problems regarding this NSTextField (NSNumberFormatter) which I  
don't know how to fix.


One is that the NSTextField can't be blank. When I enter a number  
in the NSTextField then
delete the number, an alert panel appears to show "Format error"  
and require to fill a number
in the NSTextField. I would like to leave the NSTextField blank  
when the number is deleted,
would like to set nil to the NSNumber bound in the model object,  
and would like to disable

the alert panel but I don't know how.

The other problem may be the same problem as the first one. I have  
a method which
handles the NSNumber in the model object and after all computations  
using the NSNumber
finishes, the NSNumber is set nil at the end of the method. But the  
NSTextField bound to this
NSNumber isn't cleared and continue to have the same number before  
the computation, while
the NSNumber in the model object becomes nil. This breaks a  
synchronization between
the UI and the model object and I would like to know how to fix  
this too.


In the 10.4 behaviour of NSNumberFormatter use

[myNumberFormatter setNilSymbol:@""];

You can also fix it in IB. Select the formatter, in the attribute  
palette go to the nil symbole, type a letter then delete it.


If you have the same problem with NSDateFormatter, the only solution  
I found is to subclass NSDateFormatter.


It must fix the problem for the first part, I'm not sure for the  
second part.


F. Testuz


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Saving/restoring PDFAnnotationTextWidget stringValues with PDFKit 10.5

2008-05-08 Thread Joel Norvell
This is roughly the recipe Antonio suggested, although I'm shoehorning the
widget data into the pdf itself; probably heretical, but it seemed like the
practical thing to do.

Synchronistically, I'd written this before posting my question :-) 

http://frameworker.wordpress.com/2008/05/06/a-cocoa-recipe-to-edit-pdf-forms/




  

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

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Dictionary Enumeration

2008-05-08 Thread Ken Thomases

On May 8, 2008, at 6:05 PM, Western Botanicals wrote:
I am getting the following error that seems to be happening because  
I am enumerating through a dictionary while it is being edited. I  
really need these things to happen simultaneously.


I doubt you do.  If you think about it, the very idea of enumeration  
breaks down if the dictionary is changing.  Should newly added keys  
appear in the enumeration?




What can I do?


That depends on what you're actually trying to accomplish.  One  
possible strategy is to use the -allKeys method to get a snapshot of  
the keys in the dictionary prior to the operation.  Enumerate over  
that array and mutate the dictionary with what you find.


Heh.  I wrote the above and then took a moment to look at the  
documentation.  In the description of the -keyEnumerator method, I  
found this text which is so close to what I wrote that it's funny:


"If you use this method with instances of mutable subclasses of  
NSDictionary, your code should not modify the entries during  
enumeration. If you intend to modify the entries, use the allKeys  
method to create a “snapshot” of the dictionary’s keys. Then use  
this snapshot to traverse the entries, modifying them along the way."



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


Re: Dictionary Enumeration

2008-05-08 Thread David Wilson
On Thu, May 8, 2008 at 7:19 PM, Western Botanicals
<[EMAIL PROTECTED]> wrote:
> How can I lock it then?

If you just want to lock it for synchronization, use an NSLock if
you're multithreaded.

Actually, if you're multithreaded, you should really be aware that
none of the containers are thread-safe and they should always be
wrapped in synchronization primitives.

If your problem is single threaded, then just don't edit during your
enumeration- save your edits somewhere and apply them after the
enumeration.

-- 
- David T. Wilson
[EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]


command-period doesn't close NSComboBox popup window

2008-05-08 Thread [EMAIL PROTECTED]
by subclassing NSComboBox and providing a subclass of NSTextView as 
its field editor, i am able to support the home/end/page down/page up 
keys in the popped up window. (i'm surprised this isn't the default 
behavior!)


however, i haven't been able to figure out how to support 
command-period (to be equivalent to the escape key and i'm even more 
surprised that this doesn't "just work").


any suggestions?

ken

ps to avoid any/lots of requests for code, here is what i do. my 
field editor overrides/provides methods for scrollPageDown, 
scrollPageUp, scrollToEndOfDocument, scrollToBeginningOfDocument and 
passes this on to its delegate--my NSComboBox subclass. MyComboBox 
keeps track of whether or not the popup window (by using the 
appropriate notifications) is up, and if so acts accordingly. all 
very straight-forward.

___

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

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

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

This email sent to [EMAIL PROTECTED]


F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle
I'm trying to install F-Script Anywhere, but it can't install my  
developer account into the procmod group.  It says "not a known  
DirStatus."  I don't speak Unix, but I tried finding some terminal  
commands on the internet for installing a user into the procmod group  
via terminal, but I can't find the right command.  For example, in one  
case Terminal responded that niutil was not recognized, so that  
command must be outdated.


Any suggestions?  I have an Intel iMac with OS 10.5.2.  F-Script  
Anywhere version 1.3.2.


I note F-Script is often recommended here for analyzing Cocoa programs.

DC


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread Dave Dribin

On May 8, 2008, at 7:31 PM, David Carlisle wrote:
I'm trying to install F-Script Anywhere, but it can't install my  
developer account into the procmod group.  It says "not a known  
DirStatus."  I don't speak Unix, but I tried finding some terminal  
commands on the internet for installing a user into the procmod  
group via terminal, but I can't find the right command.  For  
example, in one case Terminal responded that niutil was not  
recognized, so that command must be outdated.


Any suggestions?  I have an Intel iMac with OS 10.5.2.  F-Script  
Anywhere version 1.3.2.


I note F-Script is often recommended here for analyzing Cocoa  
programs.


procmod and niutil are only needed for 10.4 on Intel.  Use Robert  
Chin's FSA, Leopard Edition:


  

It uses code signing for the deprecated procmod group.  It's only  
version 1.3.1, though.  Where did you find version 1.3.2?


-Dave

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle
My file directory name says "FScriptBin-20070421"  My startup warning  
message says I got it Jan 8, 2008, from www.fscript.org.


But if ignore the procmod installation message, it still fails to  
install in, for example, Stickies.  In that case I get:



F-Script Anywhere was unable to install itself in the selected  
application (process ID 392), because F-Script Anywhere must be  
installed in a Cocoa application running as the current user.


You may be attempting to install in a setuid application, which is not  
supported.


The application may have crashed; restart it if needed.


On May 8, 2008, at 6:40 PM, Dave Dribin wrote:


On May 8, 2008, at 7:31 PM, David Carlisle wrote:
I'm trying to install F-Script Anywhere, but it can't install my  
developer account into the procmod group.  It says "not a known  
DirStatus."  I don't speak Unix, but I tried finding some terminal  
commands on the internet for installing a user into the procmod  
group via terminal, but I can't find the right command.  For  
example, in one case Terminal responded that niutil was not  
recognized, so that command must be outdated.


Any suggestions?  I have an Intel iMac with OS 10.5.2.  F-Script  
Anywhere version 1.3.2.


I note F-Script is often recommended here for analyzing Cocoa  
programs.


procmod and niutil are only needed for 10.4 on Intel.  Use Robert  
Chin's FSA, Leopard Edition:


 

It uses code signing for the deprecated procmod group.  It's only  
version 1.3.1, though.  Where did you find version 1.3.2?


-Dave

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/davidcar1%40mstarmetro.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread Dave Dribin

On May 8, 2008, at 7:53 PM, David Carlisle wrote:
My file directory name says "FScriptBin-20070421"  My startup  
warning message says I got it Jan 8, 2008, from www.fscript.org.


I think you may have to downgrade to Robert's FSA 1.3.1 as it looks  
like the code signing stuff hasn't made it into the official version.


-Dave

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to send email without using email client

2008-05-08 Thread Chris Suter


On 08/05/2008, at 8:10 PM, vinitha ks wrote:


I'm working with mac 10.5 and xcode3.0.I've to send email from an
application with out using any email client.When i try to use message
framework,It doesn't work.(deliverMessage always returns no)Is there  
any

any way to send email from my application without using any email
client,and i've to send attachments also.


Why do you wish to bypass an e-mail client? That doesn't sound very  
user friendly.


- Chris

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread John Stiles
I think they are focusing on polishing up 2.0. I submitted an 
enhancement for FSA a while back and that seemed to be where all the 
focus was.



Dave Dribin wrote:

On May 8, 2008, at 7:53 PM, David Carlisle wrote:
My file directory name says "FScriptBin-20070421"  My startup warning 
message says I got it Jan 8, 2008, from www.fscript.org.


I think you may have to downgrade to Robert's FSA 1.3.1 as it looks 
like the code signing stuff hasn't made it into the official version.


-Dave

___

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

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

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

This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: F-Script Anywhere can't add to procmod group

2008-05-08 Thread David Carlisle

I got 1.3.1, and that solved the installation problem.

There is some confusion in the version numbers that made me think I  
didn't need 1.3.1:


FSA Version 1.3 (1.3.2) dated May 30, 2006

FSA Version 1.3.1 (1.3.1) dated Oct 12, 2007.

Thanks,
DC

On May 8, 2008, at 6:57 PM, Dave Dribin wrote:


On May 8, 2008, at 7:53 PM, David Carlisle wrote:
My file directory name says "FScriptBin-20070421"  My startup  
warning message says I got it Jan 8, 2008, from www.fscript.org.


I think you may have to downgrade to Robert's FSA 1.3.1 as it looks  
like the code signing stuff hasn't made it into the official version.


-Dave

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/davidcar1%40mstarmetro.net

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Kyle Sluder
On Thu, May 8, 2008 at 12:51 PM, Nick Zitzmann <[EMAIL PROTECTED]> wrote:
> I'm reading in a file format that uses only a single control point for
> curved edges.

So create two control points for each one in your data file, just make
them equal.

--Kyle Sluder
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Graham Cox

If you can use Core Graphics, there is: CGPathAddQuadCurveToPoint

If using NSBezierPath, some simple maths will get you the needed  
control points, this googled up from http://fontforge.sourceforge.net/bezier.html


Any quadratic spline can be expressed as a cubic (where the cubic term  
is zero). The end points of the cubic will be the same as the  
quadratic's.


CP0 = QP0
CP3 = QP2
The two control points for the cubic are:

CP1 = QP0 + 2/3 *(QP1-QP0)
CP2 = CP1 + 1/3 *(QP2-QP0)


where the quadratic curve is QP0-QP1-QP2
and the cubic is CP0-CP1-CP2-CP3



hth,

G.

On 9 May 2008, at 2:51 am, Nick Zitzmann wrote:



On May 8, 2008, at 7:33 AM, Graham Cox wrote:

A cubic bezier with the two control points set to the same value is  
equivalent to a quadratic bezier. In other words the cubic is a  
superset of the quadratic.


Why do you need quadratics specifically?



I'm reading in a file format that uses only a single control point  
for curved edges.


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


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Graham Cox
That doesn't actually yield precisely the same curve - see my other  
message.


G.


On 9 May 2008, at 11:26 am, Kyle Sluder wrote:

On Thu, May 8, 2008 at 12:51 PM, Nick Zitzmann <[EMAIL PROTECTED]>  
wrote:
I'm reading in a file format that uses only a single control point  
for

curved edges.


So create two control points for each one in your data file, just make
them equal.

--Kyle Sluder


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Quadratic curves in NSBezierPath

2008-05-08 Thread Nick Zitzmann


On May 8, 2008, at 7:28 PM, Graham Cox wrote:


If you can use Core Graphics, there is: CGPathAddQuadCurveToPoint

If using NSBezierPath, some simple maths will get you the needed  
control points, this googled up from http://fontforge.sourceforge.net/bezier.html



Thank you. I did try Google but didn't find that site. I'll give it a  
shot, and resort to CGPath only if necessary.


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


NSPopUpButton again

2008-05-08 Thread Johnny Lundy
Hi, still having no luck with NSPopUpButton and getting the selected  
item in the popup back into my model string.


Simplified down to the bone, here's my class Popup:

//  Popup.h
//  TestPopup

#import 
@interface Popup : NSObject
{
NSArray *popupArray;
NSString *selectedGame;
}
- (void) debug;
@property (readwrite, copy) NSArray *popupArray;
@property (readwrite, copy) NSString *selectedGame;
@end



//  Popup.m
//  TestPopup

#import "Popup.h"

@implementation Popup: NSObject
@synthesize popupArray;
@synthesize selectedGame;

- (void) awakeFromNib
{
[self setPopupArray: [NSArray arrayWithObjects:@"C9", @"F11", nil]];
[self setSelectedGame:@""];
}
- (void) debug //Something to set a breakpoint on
{
return;
}
@end

Bindings:
1. My NSPopUpButton is bound with its Content, Content Objects, and  
Content Values to the NSArrayController's arrangedObjects.self.


2. The NSArrayController's Content is bound to Popup.popupArray  
through an instance of the class Popup in IB (see #3).


3. An NSObject "popup", instantiated from within IB, has its Class set  
to "Popup." Binding to that to get the array content works fine  
(popup.popupArray).


I can't figure out what to bind the NSPopUpButton's "selection"  
bindings to, to get the instance variable "selectedGame" to be set to  
whichever of the two items in the popup is selected by the user.


I have read all 400+ messages on this list about NSPopUpButton, and  
watched the WWDC session (I'm a Select member of ADC) on bindings.


View-Controller-Model. I want the selection of the popup to set the  
model string "selectedGame." That's all I need.


Can anyone 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/archive%40mail-archive.com

This email sent to [EMAIL PROTECTED]


Superview and Subview Implementation Question

2008-05-08 Thread Kip Nicol

Hello all,

I've run into an implementation issue regarding the best way to  
implement a view and its subviews. Maybe someone here can push me in  
the right direction :)


I currently have a custom superview which holds custom subviews. These  
subviews can be selected and moved around by clicking and dragging  
them. The subviews also have a subview: a subclass of an NSMatrix. The  
cells within the matrix can be selected by clicking and dragging the  
mouse over the cells. So essentially my view hierarchy is:


SuperView ---> Subview ---> NSMatrix (subclass)

Currently the code to determine when the Subview is selected, how it  
is moved about, and when and how the NSMatrix subclass's cells are  
selected is distributed throughout the three views. It is now apparent  
that this way is not modular and is creating a big headache in getting  
things to work correctly.


I was wondering if anyone thought that it would be better to implement  
all of the control code (when subviews are selected, moved, cells  
selected, etc) solely within the custom superclass? This way sounds  
like it may be more work up front, but in the long run it may make  
more sense to do it this way.


Thanks.

Kip
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSPopUpButton again

2008-05-08 Thread Ken Thomases

On May 8, 2008, at 8:56 PM, Johnny Lundy wrote:

Bindings:
1. My NSPopUpButton is bound with its Content, Content Objects, and  
Content Values to the NSArrayController's arrangedObjects.self.


2. The NSArrayController's Content is bound to Popup.popupArray  
through an instance of the class Popup in IB (see #3).


3. An NSObject "popup", instantiated from within IB, has its Class  
set to "Popup." Binding to that to get the array content works fine  
(popup.popupArray).


I can't figure out what to bind the NSPopUpButton's "selection"  
bindings to, to get the instance variable "selectedGame" to be set  
to whichever of the two items in the popup is selected by the user.


I haven't tested, but my understanding is that you bind the  
NSPopUpButton's selectedObject to popup.selectedGame.  Since the  
Content Objects and Content Values are both bound to the same thing,  
you could bind selectedValue to popup.selectedGame, too.


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


Crashes with NSOpenPanel and garbage collection

2008-05-08 Thread Daniel Parnell

Hi All,

  I'm having an interesting problem.  I'm trying to use NSOpenPanel  
to select some files (as one usually does), however if I compile with  
garbage collection on and then try to use the Music, Photos or Movies  
areas in the open panel I get very strange crashes.  If I've  
previously opened a file from one of these areas and the open panel is  
now defaulting to them then simply using Command-O will also cause the  
same crash.


Is there some special magic I need to use to allow me to use  
NSOpenPanel and the special Photo, Music and Movies areas with garbage  
collection turned on?


I'm able to replicate this crash in a simple little app I threw  
together containing the following code.


- (IBAction) doIt:(id)sender {
NSOpenPanel* panel = [NSOpenPanel openPanel];
[panel setAllowsMultipleSelection: YES];
[panel setPrompt: NSLocalizedString(@"Insert", @"Insert Prompt")];
[panel setAllowedFileTypes: [NSImage imageTypes]];

	[panel beginSheetForDirectory: nil file: nil modalForWindow: window  
modalDelegate: self  
didEndSelector:@selector(insertPanelDidEnd:returnCode:contextInfo:)  
contextInfo: nil];

}

- (void)insertPanelDidEnd:(NSOpenPanel *)panel returnCode: 
(int)returnCode  contextInfo:(void  *)contextInfo {

if(returnCode==NSOKButton) {
NSLog(@"got files=%@", [panel filenames]);
}
}


Daniel

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Threading - How its done?

2008-05-08 Thread Michael Vannorsdel
Casting something as const doesn't automatically make a section of  
memory synchronized.  In the end it's a compiler hint and doesn't  
change the fact the data is still going to live in the same RAM and  
cpu caches as everything else.


Also, cache/data coherency is an industry accepted standard (maybe  
even a requirement now by vendors) with multiprocessing.  Without it  
the CPUs will have to force cache commits very frequently and in the  
correct ordering, especially for something like a spin lock or context  
switch.  This would greatly degrade performance and would frankly be  
something of a hack to make two non-compliant processors work  
together.  I can't imagine how properly committing a cache line would  
even work when part of the line contains old data.


Cache coherency is usually done through bus snooping or a directory  
system to ensure that loading a memory operand will get the correct  
mutation even if it lives on another CPU's cache.  Some architectures  
like the Intel Core use special bus features to enforce data coherency  
(avoiding traditional cache coherency methods).  This all happens  
transparently to the program.


Because of cache/data coherency adherence, after the data has been  
stored to cache or main memory, multiple processors can immediately  
load the same address without the need for program locking and  
retrieve consistent values.  Therefore after data has been stored  
(written), it can be loaded (read) from main memory or a cache by  
multiple processors in any order, at any time, and get the same value  
each time.


I suggest reading up on cache coherency and checking out protocols  
like MERSI to see how data coherency is maintained on multiprocessor  
architectures.  Also the IBM 750 series (G3) struggle to become SMP  
compliant.  It might help anyone who reads and understands it to  
choose when locking is necessary and when it's not.  There's nothing  
wrong with over locking, but performance will needlessly suffer.



On May 8, 2008, at 9:33 AM, Scott Ribe wrote:

No, not exactly, because you know that str is constant and its value  
is set

at load time, so multiple readers without locks will be safe.

However, what he was responding to was much more broad, and not  
correct:


When was the data written? Unless you're dealing with const data,  
then you
still require synchronization primitives ON THE READS, to make sure  
that the
cache of the processor executing the reads is refreshed from main  
memory as

needed. Unless, of course, you know the exact details of the processor
you're running on and that this is not necessary.

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Crashes with NSOpenPanel and garbage collection

2008-05-08 Thread Antonio Nunes

On May 9, 2008, at 3:12 AM, Daniel Parnell wrote:

 I'm having an interesting problem.  I'm trying to use NSOpenPanel  
to select some files (as one usually does), however if I compile  
with garbage collection on and then try to use the Music, Photos or  
Movies areas in the open panel I get very strange crashes.  If I've  
previously opened a file from one of these areas and the open panel  
is now defaulting to them then simply using Command-O will also  
cause the same crash.


This is a known bug in 10.5.2, which a.f.a.i.k. affects all garbage  
collected apps. To solve your immediate issue where just bringing up  
the open panel will crash your app simply remove its preferences file  
(or the pertinent entry in the file that remembers the state of the  
panel).


António

---
Some things have to be believed to be seen.

--Ralph Hodgson
---



___

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

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

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

This email sent to [EMAIL PROTECTED]