tableview, button with view and bindings

2011-07-01 Thread R
Can anyone give me some guidance on adding a button w/ image to a
tableview using bindings.  I've had good luck adding buttons to a
tableview by dropping in a button cell.  But adding the image is
giving me some problems.  The image will be retrieved from the object
represented on the row of the tableview.  I'm populating the content
array and tableview via an arrayController.

thanks
___

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

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

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

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


How to get the applicaiton name that loads bundle

2011-07-01 Thread Chen, Jeff (SDCC)
Dear All,

Now I'm developing the printer driver, and I want to realize the following 
specificaiton:
1, If the current applicaiton loading my PDE is TextEdit or Preview, do 
actionA
2, If the current application loading my PDE is another application, do actionB.

But I don't know how to get the information of the application loading my PDE.
I checked the document about NSBundle and PDEPluginCallback, but can't find 
any API about it.

Is there anyone who knows this?

Best Regards
Jeff Chen
___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread R
Clarification:  a button with an image in a tableview.


On Jul 1, 12:13 am, R r4eem...@gmail.com wrote:
 Can anyone give me some guidance on adding a button w/ image to a
 tableview using bindings.  I've had good luck adding buttons to a
 tableview by dropping in a button cell.  But adding the image is
 giving me some problems.  The image will be retrieved from the object
 represented on the row of the tableview.  I'm populating the content
 array and tableview via an arrayController.

 thanks
 ___

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

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

 Help/Unsubscribe/Update your 
 Subscription:http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev-garchive-9...

 This email sent to cocoa-dev-garchive-98...@googlegroups.com
___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread Quincey Morris
On Jun 30, 2011, at 23:13, R wrote:

 Can anyone give me some guidance on adding a button w/ image to a
 tableview using bindings.  I've had good luck adding buttons to a
 tableview by dropping in a button cell.  But adding the image is
 giving me some problems.  The image will be retrieved from the object
 represented on the row of the tableview.  I'm populating the content
 array and tableview via an arrayController.

In IB, drill down to the level of the button cell -- either keep clicking on 
the top row of the column in the layout view until just the cell is selected, 
or select the cell directly in the outline view. Once the cell is selected, you 
should see the Image and Alternate Image bindings in the Bindings 
inspector. Bind the one(s) that you want to a NSImage property of 
arrangedObjects, and that should be all you need to do.

Alternately, you can do this programmatically by implementing the 
tableView:willDisplayCell:forTableColumn:row: delegate method. After matching 
on the row, column and (for robustness) cell class, just set the cell's image 
to the desired image. I guess this doesn't meet your using bindings 
requirement, but sometimes it's easier to do it this way than to derive a 
KVO-compliant image property to use with bindings.


___

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

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

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

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


Re: How to get the applicaiton name that loads bundle

2011-07-01 Thread Scott Ribe
On Jul 1, 2011, at 12:25 AM, Chen, Jeff (SDCC) wrote:

 Is there anyone who knows this?

Haven't done it from a PDE specifically, but in general [NSBundle mainBundle] 
will give you the bundle of the executing application, and you can go from 
there.

-- 
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.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 arch...@mail-archive.com


RE: How to get the applicaiton name that loads bundle

2011-07-01 Thread Chen, Jeff (SDCC)
Dear Scott,

Thank you so much!
mainBundle() works well.

Best Regards
Jeff Chen

-Original Message-
From: Scott Ribe [mailto:scott_r...@elevated-dev.com]
Sent: Friday, July 01, 2011 2:46 PM
To: Chen, Jeff (SDCC)
Cc: 'cocoa-dev@lists.apple.com'
Subject: Re: How to get the applicaiton name that loads bundle

On Jul 1, 2011, at 12:25 AM, Chen, Jeff (SDCC) wrote:

 Is there anyone who knows this?

Haven't done it from a PDE specifically, but in general [NSBundle mainBundle] 
will give you the bundle of the executing application, and you can go from 
there.

--
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.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 arch...@mail-archive.com


How to cancel an asynchronous GCD block?

2011-07-01 Thread Oleg Krupnov
Hi,

I am migrating my code to use GCD blocks instead of NSOperations.

NSOperation has a -cancel method to thread-safely notify the
NSOperation thread that it needs to be canceled.

How do you do this for an async GCD block?

I.e. suppose I have the following code:

@implementation MyClass
- (void)myMethod
{
dispatch_async(
   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
   ^{
do_some_lengthy_cancelable_operation();
   });
}
@end

I need to be able to cancel do_some_lengthy_cancelable_operation() at
some point.

The first solution that comes to my mind is the following.

@interface MyClass MyCancellableOperation
{
  bool m_isCancelled
}
- (bool)isCancelled;
@end

@implementation MyClass
- (void)myMethod
{
dispatch_async(
   dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0),
   ^{
do_some_lengthy_cancelable_operation(self);
   });
}
@end

void do_some_lengthy_cancelable_operation (idMyCancellableOperation operation)
{
  for (int i = 0; i BIG_NUMBER; ++i)
  {
   if ([operation isCancelled])
   {
 break;
   }
  }
}

But this seems a bit clunky (compared to the elegance of GCD code),
and also I'm not sure if it will be thread-safe to set m_isCancelled
from the main thread, while the async block may be racing to query it
(though it should be fine, setting a boolean variable should be
atomic).

Is there a better solution?

Thanks,

Oleg.
___

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

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

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

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


Re: How to cancel an asynchronous GCD block?

2011-07-01 Thread Charles Srstka
On Jul 1, 2011, at 2:54 AM, Oleg Krupnov wrote:

 But this seems a bit clunky (compared to the elegance of GCD code),
 and also I'm not sure if it will be thread-safe to set m_isCancelled
 from the main thread, while the async block may be racing to query it
 (though it should be fine, setting a boolean variable should be
 atomic).
 
 Is there a better solution?

You can declare the boolean as an atomic property and synthesize it. Then, it 
will be sure to be atomic, no matter what.

Charles___

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

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

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

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


Re: How to cancel an asynchronous GCD block?

2011-07-01 Thread Ken Thomases
On Jul 1, 2011, at 2:54 AM, Oleg Krupnov wrote:

 I am migrating my code to use GCD blocks instead of NSOperations.

Why?

 But this seems a bit clunky (compared to the elegance of GCD code),

It's pretty much your only option.  GCD doesn't have a notion of canceling a 
task, so you can only set a flag and check it.

 and also I'm not sure if it will be thread-safe to set m_isCancelled
 from the main thread, while the async block may be racing to query it
 (though it should be fine, setting a boolean variable should be
 atomic).

Setting a boolean will be atomic on any likely architecture.  However, the 
technique is safe even if setting the boolean were not atomic.  The only 
transition is from false to true.  You're sure it starts out as false.  If at 
any point it evaluates to true, then you know somebody has set it or is in the 
process of setting it, which means it really is supposed to be true.  In 
theory, yes, the code which is setting it may not have completed, but you don't 
care.

Atomicity is about avoiding an incomplete or internally-inconsistent result, 
but that's not possible with a boolean that just transitions once.  (It's 
important that it only transitions once.)

Regards,
Ken

___

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

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

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

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


Re: How to cancel an asynchronous GCD block?

2011-07-01 Thread Oleg Krupnov
 I am migrating my code to use GCD blocks instead of NSOperations.

 Why?

I should have said, I'm writing a new app and I am migrating my
knowledge of implementing multi-threading from NSOperation to GCD :)

(And I should say, I'm beginning to like the easiness of GCD, even
though I was initially reluctant to use blocks, because they seem
harder to read, less encapsulated and easier to make scope mistakes.)

 But this seems a bit clunky (compared to the elegance of GCD code),

 It's pretty much your only option.  GCD doesn't have a notion of canceling a 
 task, so you can only set a flag and check it.

Thanks, now I know.

 If at any point it evaluates to true, then you know somebody has set it or is 
 in the process of setting it, which means it really is supposed to be true.  
 In theory, yes, the code which is setting it may not have completed, but you 
 don't care.

I undersand that, but I just wanted to be a purist :) Well, I will do
as Charles suggested: I will declare the property as atomic and
synthesize it.

Thanks to everyone!
___

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

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

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

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


CIImage directly to CALayer contents?

2011-07-01 Thread Oleg Krupnov
Hi,

I'm a little shaky in this area, so I beg your pardon.

CALayer has a contents property which is a CGImageRef, i.e. a Core
Graphic image. CGImages are stored in RAM.

CALayer is built on top of OpenGL and uses VRAM to store its bitmap
image internally (a texture).

Now suppose that I have a CIImage constructed with
+imageWithContentsOfURL. The image is loaded (lazily) directly to
VRAM.

So, If I go the suggested route, and first create a CGImage from
CIImage, then assign it to CALayer's contents, I will effectively copy
the image from VRAM to RAM and then again back to VRAM, which is slow,
memory consuming, and generally unnecessary.

Am I correct?

If so, is there a way to pass a CIImage directly to CALayer without
going beyond VRAM?

Thanks!

Oleg.
___

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

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

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

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


Windows cryptography

2011-07-01 Thread Daniel Wambold
Hello. I have an iPhone app (SDK 4.3) that uses symmetric key encryption (AES 
256, through the CommonCrypto library). I have the parameters set to use pkcs7 
padding, and an iv of all zeros (CBC mode). My question (somewhat off the 
lists's topic, I'm afraid) is that I need to help our IT people get a file 
encrypted in this format on a Windows system. I was wondering if anyone has 
accomplished this task. I strongly prefer that they use open-source code (or 
something from a major developer, but it'll have to be free, then) if possible, 
for obvious security reasons, but they don't seem to be able to compile stuff, 
so I'm hoping to find an open source project that comes with a precompiled 
binary. Any thoughts? Thanks for any help you might provide!
-Dan___

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

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

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

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


Re: Windows cryptography

2011-07-01 Thread Jeff Kelley
I would have a look at what's available through Cygwin. With any luck
something like OpenSSL is available and has the features you're
looking for.

Jeff Kelley

On Friday, July 1, 2011, Daniel Wambold wambo...@gmail.com wrote:
 Hello. I have an iPhone app (SDK 4.3) that uses symmetric key encryption (AES 
 256, through the CommonCrypto library). I have the parameters set to use 
 pkcs7 padding, and an iv of all zeros (CBC mode). My question (somewhat off 
 the lists's topic, I'm afraid) is that I need to help our IT people get a 
 file encrypted in this format on a Windows system. I was wondering if anyone 
 has accomplished this task. I strongly prefer that they use open-source code 
 (or something from a major developer, but it'll have to be free, then) if 
 possible, for obvious security reasons, but they don't seem to be able to 
 compile stuff, so I'm hoping to find an open source project that comes with a 
 precompiled binary. Any thoughts? Thanks for any help you might provide!
 -Dan___

-- 
Jeff Kelley
___

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

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

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

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


Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-07-01 Thread Gregory Weston
Dave DeLong wrote:

 You can just do:
 
 NSArray *objectsArray = [theArray valueForKey:key];
 
 And it'll do pretty much the same thing (except that it'll call -valueForKey: 
 on each item in the array, and not objectForKey:.  However, if the objects 
 are NSDictionaries, that's pretty much the same thing).

Pretty much. But just this week I ran across a situation where sending 
objectForKey: worked while valueForKey: said the dictionary wasn't 
KVC-compliant for the specified key.

___

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

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

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

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


Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-07-01 Thread Mike Abdullah

On 1 Jul 2011, at 12:59, Gregory Weston wrote:

 Dave DeLong wrote:
 
 You can just do:
 
 NSArray *objectsArray = [theArray valueForKey:key];
 
 And it'll do pretty much the same thing (except that it'll call 
 -valueForKey: on each item in the array, and not objectForKey:.  However, if 
 the objects are NSDictionaries, that's pretty much the same thing).
 
 Pretty much. But just this week I ran across a situation where sending 
 objectForKey: worked while valueForKey: said the dictionary wasn't 
 KVC-compliant for the specified key.

I believe this would be when the key begins with an @ symbol.

___

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

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

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

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


Re: [Q] Will the be any problem in implementing an NSArray method using fast enumeration?

2011-07-01 Thread Mike Abdullah

On 30 Jun 2011, at 22:41, Quincey Morris wrote:

 
 On Jun 30, 2011, at 13:51, JongAm Park wrote:
 
 The rationale behind enumerator pattern is to unify the way to access 
 collection classes no matter what they actually look like.
 So, enumerator pattern is actually written in index based iteration wrapped 
 with enumerator pattern.
 Similarly, I guessed fast enumeration was based on either index iteration or 
 enumerator pattern.
 
 No, not necessarily, if by index iteration you mean 'objectAtIndex:'.
 
 NSArray has 2 primitive methods (count and objectAtIndex:) that a concrete 
 subclass must implement. It also conforms to NSFastEnumeration, so a concrete 
 subclass must also implement 'countByEnumeratingWithState:objects:count:'. 
 That's three primitive methods you know for sure are implemented in any 
 concrete subclass.

No, the first two are the primitive methods, and that's it. They are all you 
need to implement. You may choose to implement other methods for performance, 
but they are not essential.

NSArray itself implements first enumeration by calling through to the primitive 
methods automatically for you. (So yes, that's not actually any faster than 
calling -objectAtIndex: yourself repeatedly; it's more the convenience that 
buys you).

NSArray's concrete subclasses that you generally work with — NSCFArray etc. — 
then re-implement fast enumeration to be truly fast and avoid the 
-objectAtIndex: bottleneck.
 
 There's no way of knowing (in general) whether these primitive 
 implementations make use of each other. I'm virtually certain, for example, 
 that in NSCFArray (the standard but private concrete subclass of NSArray), 
 countByEnumeratingWithState:objects:count: doesn't use objectAtIndex:, 
 because part of the point of fast enumeration is to eliminate per-object 
 method calls if possible. I'm also virtually certain that NSCFArray's 
 enumerator uses the fast enumeration method 
 countByEnumeratingWithState:objects:count: directly, rather than using 
 objectAtIndex:.
 
 The method you wrote is non-primitive. However, you know that all of the 
 primitive methods and protocols are implemented, so it's safe to use those 
 directly (as others already replied). It's also safe to use all of the 
 standard non-primitive methods, because the abstract NSArray class provides 
 default implementations of all of them, regardless of whether a subclass 
 overrides them for performance reasons.
 
 Also, fast enumeration is a language feature. So, if Objective-C without 
 fast enumerator is used, methods written with fast enumerator would not work.
 
 If an older Objective-C runtime is used, you'll get an invalid selector 
 exception for 'countByEnumeratingWithState:objects:count:', so yes it would 
 not work in that sense.
___

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

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

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

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


Re: Quicklook thumbnails vs previews, API for previews?

2011-07-01 Thread Mike Abdullah
Have a look at QLPreviewPanel.

On 30 Jun 2011, at 07:04, Oleg Krupnov wrote:

 Hi,
 
 The QuickLook API documentation defines and contrasts thumbnails and
 previews, but all I see on the client side is the only function
 QLThumbnailImageCreate. I assume this is for creating thumbnails,
 isn't it? In that case, how do I create previews on the client side?
 Alternatively, if this function is meant for creating both thumbnails
 and previews, is there a way to force create thumbnail or preview?
 
 Thanks.
 
 Oleg.
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/cocoadev%40mikeabdullah.net
 
 This email sent to cocoa...@mikeabdullah.net

___

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

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

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

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


Placing NSComparator into Dictionary

2011-07-01 Thread Appa Rao Mulpuri
Is there any way to put the NSComparator pointers into Dictionary? I have
tried put NSValue using [NSValue valueWithPointer:] , but giving me nil in
get operation.

Apparao Mulpuri


This email is sent for and on behalf of Ivy Comptech Private Limited. Ivy 
Comptech Private Limited is a limited liability company.  

This email and any attachments are confidential, and may be legally privileged 
and protected by copyright. If you are not the intended recipient dissemination 
or copying of this email is prohibited. If you have received this in error, 
please notify the sender by replying by email and then delete the email 
completely from your system. 
Any views or opinions are solely those of the sender.  This communication is 
not intended to form a binding contract on behalf of Ivy Comptech Private 
Limited unless expressly indicated to the contrary and properly authorised. Any 
actions taken on the basis of this email are at the recipient's own risk.

Registered office:
Ivy Comptech Private Limited, Cyber Spazio, Road No. 2, Banjara Hills, 
Hyderabad 500 033, Andhra Pradesh, India. Registered number: 37994. Registered 
in India. A list of members' names is available for inspection at the 
registered office.

___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread R
Thanks.  I'm currently displaying an image with success.  I want to
use a button and an image instead.  I did what you said and am covered
up with errors.  Will dig deeper.

Much thanks

On Jul 1, 12:44 am, Quincey Morris quinceymor...@earthlink.net
wrote:
 On Jun 30, 2011, at 23:13, R wrote:

  Can anyone give me some guidance on adding a button w/ image to a
  tableview using bindings.  I've had good luck adding buttons to a
  tableview by dropping in a button cell.  But adding the image is
  giving me some problems.  The image will be retrieved from the object
  represented on the row of the tableview.  I'm populating the content
  array and tableview via an arrayController.

 In IB, drill down to the level of the button cell -- either keep clicking on 
 the top row of the column in the layout view until just the cell is selected, 
 or select the cell directly in the outline view. Once the cell is selected, 
 you should see the Image and Alternate Image bindings in the Bindings 
 inspector. Bind the one(s) that you want to a NSImage property of 
 arrangedObjects, and that should be all you need to do.

 Alternately, you can do this programmatically by implementing the 
 tableView:willDisplayCell:forTableColumn:row: delegate method. After matching 
 on the row, column and (for robustness) cell class, just set the cell's image 
 to the desired image. I guess this doesn't meet your using bindings 
 requirement, but sometimes it's easier to do it this way than to derive a 
 KVO-compliant image property to use with bindings.

 ___

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

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

 Help/Unsubscribe/Update your 
 Subscription:http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev-garchive-9...

 This email sent to cocoa-dev-garchive-98...@googlegroups.com
___

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

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

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

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


Re: Windows cryptography

2011-07-01 Thread Daniel Wambold
OpenSSL is available for Windows, but I can't see how to feed it an encryption 
key, just a passphrase which is (apparently) converted to a key. However, since 
CommonCrypto's CCCrypt uses the key directly, that's what I've got.
I'll check Cygwin out. Thanks. (Anyone know how to feed OpenSSL a key rather 
than a passphrase, or at least how to take a passphrase and generate the key?)
-Dan___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread R
throwing exceptions when the binding controller key is
arrangeObjects.  Note that all other data is using arrangedObjects
fine.  But, placing an image on the button with this config is
failing.

I can get an image to display using the selection controller key.
But of course the wrong image will display when changing rows.

On Jul 1, 12:44 am, Quincey Morris quinceymor...@earthlink.net
wrote:
 On Jun 30, 2011, at 23:13, R wrote:

  Can anyone give me some guidance on adding a button w/ image to a
  tableview using bindings.  I've had good luck adding buttons to a
  tableview by dropping in a button cell.  But adding the image is
  giving me some problems.  The image will be retrieved from the object
  represented on the row of the tableview.  I'm populating the content
  array and tableview via an arrayController.

 In IB, drill down to the level of the button cell -- either keep clicking on 
 the top row of the column in the layout view until just the cell is selected, 
 or select the cell directly in the outline view. Once the cell is selected, 
 you should see the Image and Alternate Image bindings in the Bindings 
 inspector. Bind the one(s) that you want to a NSImage property of 
 arrangedObjects, and that should be all you need to do.

 Alternately, you can do this programmatically by implementing the 
 tableView:willDisplayCell:forTableColumn:row: delegate method. After matching 
 on the row, column and (for robustness) cell class, just set the cell's image 
 to the desired image. I guess this doesn't meet your using bindings 
 requirement, but sometimes it's easier to do it this way than to derive a 
 KVO-compliant image property to use with bindings.

 ___

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

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

 Help/Unsubscribe/Update your 
 Subscription:http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev-garchive-9...

 This email sent to cocoa-dev-garchive-98...@googlegroups.com
___

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

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

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

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


Re: How Do I get informed when -showHelp: has been called?

2011-07-01 Thread Matt Neuburg
On Wed, 29 Jun 2011 16:06:36 +0100, Angus Hardie 
angus.har...@malcolmhardie.com said:

On 29 Jun 2011, at 14:22, Ulf Dunkel wrote:

 Am 27.06.2011 22:58, schrieb Ulf Dunkel:
 In a simple app of mine, I use the standard Help menu and MyApp Help
 menu item, which is bound to -showHelp:.
 
 I would like to have my AppDelegate being informed when the Help Viewer
 has been launched and opened from this menu item.
 
 It seems as if the method -showHelp: cannot be overridden. Which other
 way can I use to receive any information when -showHelp: has been called?
 

My first thought was that you could change the target of the menu item
so that it calls your own method, then call the original 
showHelp method with something like:

 [NSApp showHelp:sender]

I routinely repoint the showHelp: action from the Help menu item so that my 
own code runs in response. Usually, however, this is because I *don't* want the 
Help View launched and opened from this menu item. :) m.

--
matt neuburg, phd = m...@tidbits.com, http://www.apeth.net/matt/
A fool + a tool + an autorelease pool = cool!
Programming iOS 4!
http://www.apeth.net/matt/default.html#iosbook___

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

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

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

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


Re: Windows cryptography

2011-07-01 Thread Jeffrey Walton
On Fri, Jul 1, 2011 at 7:30 AM, Daniel Wambold wambo...@gmail.com wrote:
 Hello. I have an iPhone app (SDK 4.3) that uses symmetric key encryption (AES 
 256, through the CommonCrypto library). I have the parameters set to use 
 pkcs7 padding, and an iv of all zeros (CBC mode). My question (somewhat off 
 the lists's topic, I'm afraid) is that I need to help our IT people get a 
 file encrypted in this format on a Windows system. I was wondering if anyone 
 has accomplished this task. I strongly prefer that they use open-source code 
 (or something from a major developer, but it'll have to be free, then) if 
 possible, for obvious security reasons, but they don't seem to be able to 
 compile stuff, so I'm hoping to find an open source project that comes with a 
 precompiled binary. Any thoughts? Thanks for any help you might provide!
Either OpenSSL or Crypto++ should be fine for the job. For OpenSSL,,
use the EVP_* functions. For Crypto++, use an CBC_ModeAES as
documented at http://www.cryptopp.com/wiki/CBC_Mode (use FileSource
and FileSink rather than a StringSource and StringSink). Crypto++ also
has iOS porting notes at http://www.cryptopp.com/wiki/IOS.

Also see Peter Guttman's cryptlib and Botan (open source, but I don't
use them). You can also use Windows' built in gear (CAPI) - use it
raw, or use a wrapper (such as
http://www.codeproject.com/KB/security/WinAES.aspx).

Jeff
___

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

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

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

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


Re: CIImage directly to CALayer contents?

2011-07-01 Thread David Duncan
On Jul 1, 2011, at 3:16 AM, Oleg Krupnov wrote:

 Now suppose that I have a CIImage constructed with +imageWithContentsOfURL. 
 The image is loaded (lazily) directly to VRAM.

Not quite. There is still a trip through RAM that is necessary to get to VRAM 
(basically it is nearly impossible to go directly to VRAM, primarily because 
the CPU can't see it directly).

 If so, is there a way to pass a CIImage directly to CALayer without going 
 beyond VRAM?


I'm fairly certain that CALayer doesn't support a CIImage as its contents, but 
you can assign a CGImageRef to it, and then assign all of the filters you used 
to generate that CIImage to the layer. In the case you outline however, there 
is no advantage to be had – just assign the CGImageRef to the CALayer's 
contents and you are likely to be as optimal as possible.
--
David Duncan

___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread Quincey Morris
On Jul 1, 2011, at 07:33, R wrote:

 throwing exceptions when the binding controller key is
 arrangeObjects.  Note that all other data is using arrangedObjects
 fine.  But, placing an image on the button with this config is
 failing.
 
 I can get an image to display using the selection controller key.
 But of course the wrong image will display when changing rows.

Yes, sorry, I misled you. I looked at a similar thing in one of my own NIB 
files, but didn't notice that it wasn't similar enough.

You can bind from a cell's bindings in a table view, but you can't (AFAIK) bind 
in a row-dependent manner. This transparent binding through rows is a feature 
only of table columns, and isn't available from the cells.

You'll need to use the tableView:willDisplayCell:forTableColumn:row: delegate 
method. Retrieve the object value for the row, then get the object's image and 
set the cell's image property to the image.


___

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

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

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

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


Re: Instance Variables of NSManagedObject Subclasses

2011-07-01 Thread Jerry Krinock

On 2011 Jun 30, at 15:36, Allen Ingling wrote:

 Am I not supposed to add instance variables to NSManagedObject sublcasses?

There is no problem in adding instance variables to NSManagedObject subclasses. 
 I have done so many times.

___

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

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

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

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


Re: Placing NSComparator into Dictionary

2011-07-01 Thread Jens Alfke

On Jul 1, 2011, at 5:50 AM, Appa Rao Mulpuri wrote:

 Is there any way to put the NSComparator pointers into Dictionary? I have
 tried put NSValue using [NSValue valueWithPointer:] , but giving me nil in
 get operation.

An NSComparator is a type of block, and blocks can be directly used as 
Objective-C objects. The only thing is that you have to copy the block first, 
if you’re going to use it after the containing function exits. So:

NSComparator cCopy = [comparator copy];
[myDict setObject: cCopy forKey: @“comparator”];
[cCopy release];

—Jens___

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

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

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

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


How to tell if NSServices launched my app

2011-07-01 Thread Mark Munz
Is there any way to know (at app startup) if my app's launch was
initiated because a user invoked one of my NSServices items?
Any insight into this would be much appreciated.

-- 
Mark Munz
unmarked software
http://www.unmarked.com/
___

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

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

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

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


Re: Windows cryptography

2011-07-01 Thread Daniel Wambold
Hello. After further pain, I found the solution: openSSL allows -K (for the key 
in hex) and -iv (for the initialization vector in hex). (BOTH must be supplied 
if -K is used.) Consider this thread closed. Thanks to those who assisted. 
-Dan___

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

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

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

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


From a view rect to a screen rect

2011-07-01 Thread Development
I am sure I am missing something simple but I've tried everything I can find


I need to convert a rectangle in a NSView to a corresponding rectangle in 
screen coordinates.

originally I was using this code: 

selected.origin.x = selection.origin.x / ([imageView 
frame].size.width/screen.size.width);
selected.origin.y = selection.origin.y / ([imageView 
frame].size.height/screen.size.height)+25;
selected.size.height = selection.size.height / ([imageView 
frame].size.height/screen.size.height);
selected.size.width = selection.size.width / ([imageView 
frame].size.width/screen.size.width);


and it worked. However I have had to change the means by which I was capturing 
the screen to CGDisplayCreateImageForRect

I want to select an area in a view that represents the entire screen. I need 
that rectangle then to be translated to the correct size and origin in screen 
coordinates.

The above code creates a rectangle of the correct size but the origin is so far 
off I cannot image how to fix it. 

I have tried having the view itself use convertRectToBase passing the screen 
bounds. This creates a rectangle of the correct size but the origin is always, 
no matter what, 15,183. 
I'm totally lost here and don't even know what to search for now that my other 
attempts have failed.
Could some one help me out?
I'm hoping to find something with low overhead as clicks are a 
factor.___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Jeff Kelley
UIView has some convenience methods you can use to convert a CGRect to and
from different views’ coordinate systems. Look at the documentation for
-convertRect:fromView:http://developer.apple.com/library/ios/documentation/uikit/reference/UIView_Class/UIView/UIView.html#//apple_ref/doc/uid/TP40006816-CH3-BBCDBGGGfor
an example. Now,
UIScreen isn’t a view, but you can probably combine its
-applicationFrameinstance method with the
UIWindow (which *is* a view) to get something approximating the screen’s
frame relative to your view’s coordinate system (which is what I think
you’re asking for).

Jeff Kelley


On Fri, Jul 1, 2011 at 2:43 PM, Development developm...@fornextsoft.comwrote:

 I am sure I am missing something simple but I've tried everything I can
 find


 I need to convert a rectangle in a NSView to a corresponding rectangle in
 screen coordinates.

 originally I was using this code:

selected.origin.x = selection.origin.x / ([imageView
 frame].size.width/screen.size.width);
selected.origin.y = selection.origin.y / ([imageView
 frame].size.height/screen.size.height)+25;
selected.size.height = selection.size.height / ([imageView
 frame].size.height/screen.size.height);
selected.size.width = selection.size.width / ([imageView
 frame].size.width/screen.size.width);


 and it worked. However I have had to change the means by which I was
 capturing the screen to CGDisplayCreateImageForRect

 I want to select an area in a view that represents the entire screen. I
 need that rectangle then to be translated to the correct size and origin in
 screen coordinates.

 The above code creates a rectangle of the correct size but the origin is so
 far off I cannot image how to fix it.

 I have tried having the view itself use convertRectToBase passing the
 screen bounds. This creates a rectangle of the correct size but the origin
 is always, no matter what, 15,183.
 I'm totally lost here and don't even know what to search for now that my
 other attempts have failed.
 Could some one help me out?
 I'm hoping to find something with low overhead as clicks are a factor.
___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Andy Lee
On Jul 1, 2011, at 2:43 PM, Development wrote:
 I have tried having the view itself use convertRectToBase passing the screen 
 bounds.

That method doesn't do what you think it does. The docs say pretty clearly you 
should pass it a rect in the receiver’s coordinate system. This is a method 
of NSView, so the receiver is the view, and question is what is the rect being 
converted to?

I *partly* blame the docs and/or the method name, because it isn't clear what 
base means in the method name. This has always bugged me. As far as I can 
tell it means the window's coordinate system, so I don't know why they didn't 
name the method convertRectToWindow:.

Anyway, check out NSView's window method, and NSWindow's convertBaseToScreen: 
method. See the docs for what these methods return.

--Andy


 This creates a rectangle of the correct size but the origin is always, no 
 matter what, 15,183. 
 I'm totally lost here and don't even know what to search for now that my 
 other attempts have failed.
 Could some one help me out?
 I'm hoping to find something with low overhead as clicks are a 
 factor.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
 
 This email sent to ag...@mac.com

___

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

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

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

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


Getting Image from plist

2011-07-01 Thread Fernando Aureliano
Hi,

I'm reading data from an plist, and I'm having problems for get the image.

The code for text look like this:

cell.auhorLabel.text = [[data objectAtIndex:index] objectForKey:@author];

Works fine.


The code to get a image em put in uiimageview look like this:

cell.coverAuthor.image = [UIImage imageWithContentsOfFile:[data
objectAtIndex:index] objectForKey:@cover];


yeah, I know, this last line is strange.

How is the right way?


Thanks!


-- 
*Fernando Aureliano*
___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Lee Ann Rucker

On Jul 1, 2011, at 1:14 PM, Andy Lee wrote:

 On Jul 1, 2011, at 2:43 PM, Development wrote:
 I have tried having the view itself use convertRectToBase passing the screen 
 bounds.
 
 That method doesn't do what you think it does. The docs say pretty clearly 
 you should pass it a rect in the receiver’s coordinate system. This is a 
 method of NSView, so the receiver is the view, and question is what is the 
 rect being converted to?
 
 I *partly* blame the docs and/or the method name, because it isn't clear what 
 base means in the method name. This has always bugged me. As far as I can 
 tell it means the window's coordinate system, so I don't know why they didn't 
 name the method convertRectToWindow:.


http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/6b989dcbb79e9ba/029eeb633c5287cc

Quote:
If you want to convert to/from the window's base coordinate system, use the 
original -convert[xx]:[to|from]View: and pass in a nil view. 

What those base calls do is a conversion to the base coordinate system 
which isn't the window base coordinate system. This will not get you the 
coordinates you want. Don't use them. (The base coordinate system has to 
do with resolution independence; go look it up.) 


 
 Anyway, check out NSView's window method, and NSWindow's convertBaseToScreen: 
 method. See the docs for what these methods return.
 
 --Andy
 
 
 This creates a rectangle of the correct size but the origin is always, no 
 matter what, 15,183. 
 I'm totally lost here and don't even know what to search for now that my 
 other attempts have failed.
 Could some one help me out?
 I'm hoping to find something with low overhead as clicks are a 
 factor.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
 
 This email sent to ag...@mac.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com

___

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

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

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

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


Re: tableview, button with view and bindings

2011-07-01 Thread R
Quincey,

Thanks!  All now working as planned.  I had to learn about tableview
column identifiers to make sure I was adding the image to the correct
column.

Thanks again for taking the time to respond.  Hopefully I'll soon be
able to help more than beHelped!

Have a great weekend -- Ron

On Jul 1, 11:07 am, Quincey Morris quinceymor...@earthlink.net
wrote:
 On Jul 1, 2011, at 07:33, R wrote:

  throwing exceptions when the binding controller key is
  arrangeObjects.  Note that all other data is using arrangedObjects
  fine.  But, placing an image on the button with this config is
  failing.

  I can get an image to display using the selection controller key.
  But of course the wrong image will display when changing rows.

 Yes, sorry, I misled you. I looked at a similar thing in one of my own NIB 
 files, but didn't notice that it wasn't similar enough.

 You can bind from a cell's bindings in a table view, but you can't (AFAIK) 
 bind in a row-dependent manner. This transparent binding through rows is a 
 feature only of table columns, and isn't available from the cells.

 You'll need to use the tableView:willDisplayCell:forTableColumn:row: delegate 
 method. Retrieve the object value for the row, then get the object's image 
 and set the cell's image property to the image.

 ___

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

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

 Help/Unsubscribe/Update your 
 Subscription:http://lists.apple.com/mailman/options/cocoa-dev/cocoa-dev-garchive-9...

 This email sent to cocoa-dev-garchive-98...@googlegroups.com
___

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

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

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

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


Re: Getting Image from plist

2011-07-01 Thread Jens Alfke

On Jul 1, 2011, at 1:55 PM, Fernando Aureliano wrote:

 cell.coverAuthor.image = [UIImage imageWithContentsOfFile:[data 
 objectAtIndex:index] objectForKey:@cover];

That’s not going to compile. You probably want the RHS to be:

[UIImage imageWithContentsOfFile:[[data objectAtIndex:index] 
objectForKey:@“cover”]]

That should work, assuming that the value of the “cover” property is a valid 
file path.

—Jens___

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

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

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

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


Re: Getting Image from plist

2011-07-01 Thread Wayne Packard
Hi,

What is stored in the cover object?

If it's the name of a file that is bundled with the app, you can use

cell.coverAuthor.image = [UIImage imageNamed:[[data objectAtIndex:index] 
objectForKey:@cover]];

If it's the name of a file stored on disk some place (e.g., the Application 
Support directory) you'll need to build up a string with the complete path for 
it using something like

NSSearchPathForDirectoriesInDomains(NSApplicationSupportDirectory, 
NSUserDomainMask, YES).

Then pass that full path to [UIImage imageWithContentsOfFile:].

If it's an NSData object containing the actual image, you could use

[UIImage imageWithData:[[data objectAtIndex:index] objectForKey:@cover]];

wp


On Jul 1, 2011, at 1:55 PM, Fernando Aureliano wrote:

 Hi,
 
 I'm reading data from an plist, and I'm having problems for get the image.
 
 The code for text look like this:
 
 cell.auhorLabel.text = [[data objectAtIndex:index] objectForKey:@author];
 
 Works fine.
 
 
 The code to get a image em put in uiimageview look like this:
 
 cell.coverAuthor.image = [UIImage imageWithContentsOfFile:[data
 objectAtIndex:index] objectForKey:@cover];
 
 
 yeah, I know, this last line is strange.
 
 How is the right way?
 
 
 Thanks!
 
 
 -- 
 *Fernando Aureliano*
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/wpackard%40mac.com
 
 This email sent to wpack...@mac.com

___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Development
These don't seem to work. The origin is still way way way off


NSRect n1=[imageView convertRect:selection toView:nil];
NSPoint p1 = [window convertBaseToScreen:n1.origin];

Does any one know how to take a selected area within a view and translate it so 
that it resizes itself and then adjusts it's origin. 
Maybe I didn't explain well enough.

I have a 800X600 rectangle which contains an image capture of the full screen. 
Within the 800X600 rectangle you can select a smaller area. 
This smaller selection should then become the area of the actual full screen 
that is captured.

Right now, nothing I do will allow me to capture the correct area. And although 
my conversion creates a rectangle of the correct size.

Is this possibly a case where my coordinates are upside down?
And if this is the case, how to I apply a transform to flip the origin's x 
coordinate?
I attempted an affine transform however it doesn't work the same in Mac as 
iPhone so I'm clueless on how to use affine transform




On Jul 1, 2011, at 1:52 PM, Lee Ann Rucker wrote:

 
 On Jul 1, 2011, at 1:14 PM, Andy Lee wrote:
 
 On Jul 1, 2011, at 2:43 PM, Development wrote:
 I have tried having the view itself use convertRectToBase passing the 
 screen bounds.
 
 That method doesn't do what you think it does. The docs say pretty clearly 
 you should pass it a rect in the receiver’s coordinate system. This is a 
 method of NSView, so the receiver is the view, and question is what is the 
 rect being converted to?
 
 I *partly* blame the docs and/or the method name, because it isn't clear 
 what base means in the method name. This has always bugged me. As far as I 
 can tell it means the window's coordinate system, so I don't know why they 
 didn't name the method convertRectToWindow:.
 
 
 http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/6b989dcbb79e9ba/029eeb633c5287cc
 
 Quote:
 If you want to convert to/from the window's base coordinate system, use the 
 original -convert[xx]:[to|from]View: and pass in a nil view. 
 
 What those base calls do is a conversion to the base coordinate system 
 which isn't the window base coordinate system. This will not get you the 
 coordinates you want. Don't use them. (The base coordinate system has to 
 do with resolution independence; go look it up.) 
 
 
 
 Anyway, check out NSView's window method, and NSWindow's 
 convertBaseToScreen: method. See the docs for what these methods return.
 
 --Andy
 
 
 This creates a rectangle of the correct size but the origin is always, no 
 matter what, 15,183. 
 I'm totally lost here and don't even know what to search for now that my 
 other attempts have failed.
 Could some one help me out?
 I'm hoping to find something with low overhead as clicks are a 
 factor.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
 
 This email sent to ag...@mac.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/lrucker%40vmware.com
 
 This email sent to lruc...@vmware.com
 

___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Andy Lee
On Jul 1, 2011, at 4:52 PM, Lee Ann Rucker wrote:
 http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/6b989dcbb79e9ba/029eeb633c5287cc
 
 Quote:
 If you want to convert to/from the window's base coordinate system, use the 
 original -convert[xx]:[to|from]View: and pass in a nil view. 
 
 What those base calls do is a conversion to the base coordinate system 
 which isn't the window base coordinate system. This will not get you the 
 coordinates you want. Don't use them. (The base coordinate system has to 
 do with resolution independence; go look it up.) 
 

Good to know, thanks!

--Andy

___

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

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

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

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


key equivalents question

2011-07-01 Thread Brian Gardner
Newbie, here...
hope I'm posting to the correct list.

In Interface Builder of Xcode 4, I set a key equivalent
for my menu items. Sometimes they work, but sometimes they don't.
What am I doing wrong?

For Example, setting a key equivalent of command-6 
for my View-Full Screen menu item works.
But, setting the key equivalent to command-f
or option-f or command-space does not work.

Is there something that I need to do, in addition to 
setting the key equivalent in Interface Builder?
And why does that work for some choices of keys but not other choices?

 -- Brian

___

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

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

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

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


Re: From a view rect to a screen rect

2011-07-01 Thread Andy Lee
On Jul 1, 2011, at 5:47 PM, Development wrote:
 These don't seem to work. The origin is still way way way off
 
 
   NSRect n1=[imageView convertRect:selection toView:nil];
   NSPoint p1 = [window convertBaseToScreen:n1.origin];
 
 Does any one know how to take a selected area within a view and translate it 
 so that it resizes itself and then adjusts it's origin. 
 Maybe I didn't explain well enough.
 
 I have a 800X600 rectangle which contains an image capture of the full 
 screen. 
 Within the 800X600 rectangle you can select a smaller area. 
 This smaller selection should then become the area of the actual full screen 
 that is captured.

The Cocoa methods we have been talking about use different coordinate systems 
to specify the same physical point on screen. Look at the period in the 
previous sentence, which is being displayed by a view. It has (x,y) coordinates 
within the view's coordinate system. That same period has *different* 
coordinates within the window's coordinate system, and still different 
coordinates in the screen's coordinate system. Same point -- it didn't move 
anywhere. Different coordinates. That's what the convert methods are for.

You don't want that. You want to calculate the physical point on the screen (in 
display coordinates as it turns out, not screen coordinates) that 
corresponds proportionally to a physical point in your view (given in view 
coordinates). This is almost always a *different* physical point. You can put a 
finger on one of these points and a different finger on the other.

 Right now, nothing I do will allow me to capture the correct area. And 
 although my conversion creates a rectangle of the correct size.
 
 Is this possibly a case where my coordinates are upside down?
 And if this is the case, how to I apply a transform to flip the origin's x 
 coordinate?
 I attempted an affine transform however it doesn't work the same in Mac as 
 iPhone so I'm clueless on how to use affine transform

I don't think this has anything to do with affine transform.

You implied that your original code was generating the proper screen 
coordinates. You mentioned that you changed to using 
CGDisplayCreateImageForRect and that's what broke the code.

* What coordinate system does CGDisplayCreateImageForRect use?
* Where is the origin in that coordinate system?
* Where is the origin in the screen coordinate system?

I *think* you can fix the problem by fixing the math in your original post, 
which generated a result in screen coordinates. I suggest you draw a picture.

--Andy

 
 
 
 
 On Jul 1, 2011, at 1:52 PM, Lee Ann Rucker wrote:
 
 
 On Jul 1, 2011, at 1:14 PM, Andy Lee wrote:
 
 On Jul 1, 2011, at 2:43 PM, Development wrote:
 I have tried having the view itself use convertRectToBase passing the 
 screen bounds.
 
 That method doesn't do what you think it does. The docs say pretty clearly 
 you should pass it a rect in the receiver’s coordinate system. This is a 
 method of NSView, so the receiver is the view, and question is what is the 
 rect being converted to?
 
 I *partly* blame the docs and/or the method name, because it isn't clear 
 what base means in the method name. This has always bugged me. As far as 
 I can tell it means the window's coordinate system, so I don't know why 
 they didn't name the method convertRectToWindow:.
 
 
 http://groups.google.com/a/chromium.org/group/chromium-dev/browse_thread/thread/6b989dcbb79e9ba/029eeb633c5287cc
 
 Quote:
 If you want to convert to/from the window's base coordinate system, use the 
 original -convert[xx]:[to|from]View: and pass in a nil view. 
 
 What those base calls do is a conversion to the base coordinate system 
 which isn't the window base coordinate system. This will not get you the 
 coordinates you want. Don't use them. (The base coordinate system has to 
 do with resolution independence; go look it up.) 
 
 
 
 Anyway, check out NSView's window method, and NSWindow's 
 convertBaseToScreen: method. See the docs for what these methods return.
 
 --Andy
 
 
 This creates a rectangle of the correct size but the origin is always, no 
 matter what, 15,183. 
 I'm totally lost here and don't even know what to search for now that my 
 other attempts have failed.
 Could some one help me out?
 I'm hoping to find something with low overhead as clicks are a 
 factor.___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/aglee%40mac.com
 
 This email sent to ag...@mac.com
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 

-[NSManagedObjectContext save:] takes 30 minutes, then crashes out of memory

2011-07-01 Thread Jerry Krinock
I have an app which writes a log to a Core Data SQLite store.  I just got a 
Logs.sql file from a user.  It is 270 KB, containing 1251 log entries.  Upon 
launch, the app finds that 284 entries are expired and deletes them.  Nothing 
out of the ordinary so far.

App then executes -[NSManagedObjectContext save:].  This method thrashes for 30 
minutes, with memory usage increasing slowly, until system won't give any more 
and then it crashes.

Is there any programming error by which I could make a Core Data store 
unsaveable like this?

I don't think so.  Probably I should report this as a bug if it does it in Lion.

More generally, can anyone suggest how to recover when an Apple method won't 
return on the main thread?  If it was on a secondary thread, I could kill it 
with a timeout (leaks, I know), but anyhow I've never considered myself smart 
enough to do Core Data on secondary threads.  Usually this little task takes a 
few milliseconds, and I slip it in during idle time.

Jerry Krinock

___

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

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

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

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


Re: key equivalents question

2011-07-01 Thread Jerry Krinock

On 2011 Jul 01, at 17:12, Brian Gardner wrote:

 Is there something that I need to do, in addition to 
 setting the key equivalent in Interface Builder?

No.

 And why does that work for some choices of keys but not other choices?

The short answer is: that's the way it is, and you need to restrict yourself to 
key equivalents that work.

Here's a longer answer, which probably has some errors which someone will 
please correct.

Some key equivalents are handled by prior objects in the responder chain, or 
trapped by lower levels of the system.

• ⌘space is swallowed by Spotlight.
• ⌘F may be swallowed by a text view, to Find text.  Look in the Edit menu and 
see if ⌘F is assigned there.
• I think that ⌥-anything is swallowed by the text input system, for alternate 
characters.  For example, when I type ⌥F I get the character ƒ.

Does anyone know a document sets forth all the restrictions?

I know that some apps override the restrictions.  For example, LaunchBar 
hijacks ⌘space from Spotlight and QuicKeys can assign shortcuts to ⌥whatever.  
Does anyone know how they do that?

Some of the answers may be in here:

http://developer.apple.com/library/mac/#documentation/Cocoa/Conceptual/EventOverview/EventArchitecture/EventArchitecture.html%23//apple_ref/doc/uid/1060i-CH3-SW10

although they seem to concentrate mostly on what happens assuming that the key 
event makes it to your app.

___

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

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

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

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