Command line tool using NSImage?

2010-08-21 Thread Jaime Magiera
Hello,

I've got a OSX command line tool that I wish to run in a shell and via a 
WebObjects application. The binary tool is linked to a framework I wrote which 
contains NSImage manipulations. It seems the [NSApplication sharedApplication] 
trick isn't working. I'm still getting... 

Aug 21 02:56:45 node2 MyApp[28773]: An uncaught exception was raised
Aug 21 02:56:45 node2 MyApp[28773]: Error (1002) creating CGSWindow
Aug 21 02:56:45 node2 MyApp[28773]: *** Terminating app due to uncaught 
exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating 
CGSWindow'

The binary is running on Leopard. Are there any ways to run NSImage methods in 
a command line app run remotely? Did I perhaps miss a step?

thanks for any info,

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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

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

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

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


Re: Command line tool using NSImage?

2010-08-21 Thread Ken Thomases
On Aug 21, 2010, at 2:26 AM, Jaime Magiera wrote:

 I've got a OSX command line tool that I wish to run in a shell and via a 
 WebObjects application. The binary tool is linked to a framework I wrote 
 which contains NSImage manipulations. It seems the [NSApplication 
 sharedApplication] trick isn't working. I'm still getting... 
 
 Aug 21 02:56:45 node2 MyApp[28773]: An uncaught exception was raised
 Aug 21 02:56:45 node2 MyApp[28773]: Error (1002) creating CGSWindow
 Aug 21 02:56:45 node2 MyApp[28773]: *** Terminating app due to uncaught 
 exception 'NSInternalInconsistencyException', reason: 'Error (1002) creating 
 CGSWindow'
 
 The binary is running on Leopard. Are there any ways to run NSImage methods 
 in a command line app run remotely? Did I perhaps miss a step?

A web server is a form of daemon.  A remote shell has some of the same 
restrictions as a daemon or agent.  In either case, the Execution Contexts 
section of TN2083 will probably be helpful:

http://developer.apple.com/mac/library/technotes/tn2005/tn2083.html#SECEXECUTIONCONTEXTS

In short, you can't reliably use AppKit (including NSImage) from a daemon or 
remote shell.

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: Core Animation. issue with scaling

2010-08-21 Thread Ahsan Shafiq
Yes, you are right but now I am unable to handle touches.
As I said in my previous post, I also want to update the model. Simply
scaling as you mentioned does scale down or scale up the sublayers as well
but how to update the model. In Scaling both the position and bounds get
changed!! and after animation I just can not get the updated position and
bounds of a layer and also of it's sublayers.


doing basic animation (explicit animation)

On Fri, Aug 20, 2010 at 7:16 PM, Eric Wing ewmail...@gmail.com wrote:

  CABasicAnimation *animation =
   [CABasicAnimation animationWithKeyPath:@bounds];
  CGRect orgVal = CGRectMake(0, 0,
  firstWheelLayer.bounds.size.width, firstWheelLayer.bounds.size.height);
  CGRect newVal = CGRectMake(0, 0,
  firstWheelLayer.bounds.size.width+100,
 firstWheelLayer.bounds.size.height);
 
   [animation setFromValue:[NSValue
 valueWithCGRect:orgVal]];
   [animation setToValue:[NSValue valueWithCGRect:newVal]];
   [animation setDuration:5.0];
   [firstWheelLayer setBounds:newVal];
   [firstWheelLayer addAnimation:animation forKey:@
 flag];
 
  The problem here is that the sublayers do not scale horizontaly like the
  firstWheelLayer should I set their bounds here too?

 I'm a little rusty on my Core Animation, but have you tried using the
 actual scale property in Core Animation instead of using the bounds
 property? I think the problem with using bounds is you are only
 setting the dimensions of the specific layer, not the transformation
 matrix. Since layers may be used as containers to contain other layers
 and they do not clip, I wouldn't expect setting the bounds on a layer
 would cause its children to transform.

 -Eric

___

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

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

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

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


Re: CoreAnimation - Resizing sublayers along with superlayer animation

2010-08-21 Thread Ahsan Shafiq
Hi
You can use scale, but if you also want to detect touches on these layers
you have to update the model as well which is nearly impossible to do if you
are doing scalling.
But apart from this scaling will work just fine.

On Fri, Aug 20, 2010 at 3:54 AM, Ignacio Enriquez nach...@gmail.com wrote:

 Hi,

 I have a subclass of CALayer (below self) and it has a sublayer
 (textLayer).
 I want self to be shrank and enlarges, so I created animations like
 the following:

 CABasicAnimation *fadeInAnimation;
 fadeInAnimation=[CABasicAnimation animationWithKeyPath:@opacity];
 fadeInAnimation.repeatCount = 1;
 fadeInAnimation.autoreverses = NO;
 fadeInAnimation.fromValue = [NSNumber numberWithFloat:1.0];
 fadeInAnimation.toValue = [NSNumber numberWithFloat:0.0];

 CABasicAnimation *shrinkAnimation;
 shrinkAnimation = [CABasicAnimation animationWithKeyPath:@bounds.size];
 shrinkAnimation.repeatCount = 1;
 shrinkAnimation.autoreverses = NO;
 shrinkAnimation.timingFunction = [CAMediaTimingFunction
 functionWithName:kCAMediaTimingFunctionEaseIn];
 shrinkAnimation.toValue = [NSValue valueWithCGSize:CGSizeMake(0, 0)];

 aniGroupOFF = [[CAAnimationGroup animation] retain];
 aniGroupOFF.delegate = self;
 aniGroupOFF.duration = ANI_DURATION;
 aniGroupOFF.animations = [NSArray arrayWithObjects:shrinkAnimation,
 fadeInAnimation, nil];

 then I commit the animation

 [self addAnimation:aniGroupOFF forKey:@shrinkAndFadeOff];

 self is animated as expected but sublayer textLayer is not resized, it
 just changes its position according to the new bounds of self

 I would like to have the same effect when animation view, they resize
 automatically their subviews and/or sublayers

 Thanks in advance.

 BTW: I tried also:
 [self setNeedsDisplayOnBoundsChange:YES];
 and overriding
 -(void)layoutSublayers{[textLayer setFrame:accordingFrame];}
 but didn't work ;(


 Ignacio
 ___

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

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

 Help/Unsubscribe/Update your Subscription:

 http://lists.apple.com/mailman/options/cocoa-dev/ahsan.shafiq786%40gmail.com

 This email sent to ahsan.shafiq...@gmail.com

___

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

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

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

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


Re: [iPhone] How to change Default.png Image Dynamically

2010-08-21 Thread Tharindu Madushanka
Hi,

But it seems like iPhone Phone app has some different Default.png images..
When you exit from Keypad menu.. it will load one image..

When you exit from other tabs, Default image is some other.. Is it possible
to do similar thing ???

Keeping several Default images..

Thanks and Kind Regards,

Tharindu

On Fri, Aug 20, 2010 at 8:24 PM, Hunter Hillegas li...@lastonepicked.comwrote:

 It is not, no. You're not allowed to replace anything in the bundle.

 You could start with a black Default.png and then very quickly load your
 own shot into an image view while the rest of your apps loads. Probably
 depends on your use case.

 On Aug 20, 2010, at 5:15 AM, Tharindu Madushanka wrote:

  Is it possible to save a screen shot of last running application screen
 as
  the app loading screen next time..
 
  I see may be Maps iPhone application does something similar to that
 instead
  loading static Default.png image.
 
  Could someone kindly clarify this ??


___

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

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

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

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


Re: [iPhone] How to change Default.png Image Dynamically

2010-08-21 Thread Ricky Sharp

On Aug 21, 2010, at 7:39 AM, Tharindu Madushanka wrote:

 But it seems like iPhone Phone app has some different Default.png images..
 When you exit from Keypad menu.. it will load one image..
 
 When you exit from other tabs, Default image is some other.. Is it possible
 to do similar thing ???
 
 Keeping several Default images..


As others have pointed out already, this is _not_ possible.

The whole point of the default image is to make it look like your app is 
launching quickly. For some apps, this is simply a blank background image.  For 
my own app, this also includes buttons and other controls that are void of text.

Keep in mind that with fast-app switching on iOS4, your app may come back into 
view exactly how it was when it was suspended.  Note that is only a _may_ and 
not a guarantee.  Should the OS have to terminate your app (to free up 
resources), the next time your app is launched, it will display the original 
default image (since it's once more doing a normal launch).

I highly recommend viewing Sessions 105 and 109 from WWDC 2010 (Adopting 
Multitasking Parts 1 and 2).  They list some tips on how to keep your app 
resident in memory as long as possible.

___
Ricky A. Sharp mailto:rsh...@instantinteractive.com
Instant Interactive(tm)   http://www.instantinteractive.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


iOS and Oracle Databases

2010-08-21 Thread Stefan Nobis
Hi.

A customer is interested in utilizing the iPad. One feature request
is to get direct access to the in-house Oracle database (via VPN). I
searched a little bit but was unable to find any useful
information. Therefore I assume something like the Oracle Client
package or just liboci oder something is not available for iOS. Is
this correct or missed I something?

So I think the best way to go is via some kind of application server,
right?

-- 
Until the next mail...,
Stefan.


pgpHm4TwOfDn3.pgp
Description: PGP signature
___

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

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

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

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

Re: [iPhone] How to change Default.png Image Dynamically

2010-08-21 Thread Tharindu Madushanka
Hi,

ah. ok. Yep. I realized that in iOS4. Then it's an OS feature.. Thanks a
lot. I was confused with that :)

Tharindu
___

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

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

2010-08-21 Thread Jaime Magiera

On Aug 21, 2010, at 5:33 AM, Ken Thomases wrote:

 In short, you can't reliably use AppKit (including NSImage) from a daemon or 
 remote shell.


Thanks for the link. Interesting read.

In short, that's really a bummer. It totally negates a chunk of functionality 
from my framework. I'll have to resort to something like keeping a client app 
running on the server that communicates with the webapp/shell via webservice (a 
security risk in itself). Also, it removes a lot of functionality from the API. 
There are a myriad of useful shell/server tools that could be created with that 
Cocoa functionality. 

Has anyone heard of Apple coming up with a solution to this conundrum? Or is it 
Bug Report time? There has to be some way to do it securely. 

thanks again Ken,

Jaime Magiera

Sensory Research, Inc.
http://www.sensoryresearch.net







___

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

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

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

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


Re: Core Data Lightweight Migration Woes

2010-08-21 Thread Jack Nutting
On Fri, Aug 20, 2010 at 8:46 PM, Brad Gibbs bradgi...@mac.com wrote:
 I highlighted the .xcdatamodel and did a Design  Data Model   Add New
 Version.  That created the Config.xcdatamodeld with an unnumbered version of
 the datamodel (Config.xcdatamodel) and a numbered copy named Config
 2.xcdatamodel.
 I go into Config.xcdatamodel and add a single string attribute to one
 entity, Clean and Build  Go.  I get the missing source model error.

I think you're looking at the versioning the wrong way around! The
data model with the 2 in its name is the new one, THAT's where you
should add new attributes etc. When your app runs, it will find the
existing data store which is version 1, both model files (the old
one is 1, the new one is 2), and do the conversion for you.

I don't have it in front of me, but I think that if you bring up the
info window for each of the model files, you'll see that each shows a
version number. Core Data will always work to bring lower-versioned
data stores up to whatever you've marked as the current version.


-- 
// jack
// http://nuthole.com
// http://learncocoa.org
___

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

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

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

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


Re: Core Data Lightweight Migration Woes

2010-08-21 Thread Brad Gibbs
Well, that's the way I started doing things, but, on pages 130-131 of the book 
More iPhone 3 Development (written by Dave Mark  Jeff LaMarche -- your 
co-authors for Learn Cocoa on the Mac) make a point of saying that the new 
version is the unnumbered version.

In some ways, I wouldn't think it would matter.  When first created, they're 
exact replicas, and you can change the names of both of these files.  What the 
compiler(?) is looking for are the version hashes for each of the entities.  As 
long as it can find both the version marked current and another version with 
entity hashes that match those stored in the data file to be migrated, I would 
think it would be able to decide which is the old version, and which is the new.

My classes are organized into folders on my desktop (and in Git).  I pulled all 
four data models out of folders and put them at the top level of the folder 
hierarchy.  This *seems* to have helped.  Although I've still gotten the 
missing source model error since then, it seems to be happening less frequently.

The other thing I did was to create a new set of data while the section of code 
that merges the second data model in with the main data model was commented 
out.  After the model was created, I uncommented that code and made changes to 
the first model and everything seems ok.  It made me realize that I don't know 
whether the app is having a hard time finding the source model for the first 
model, or, if it thinks that there should be two versions of the second model.  
Since there's only a single version of the second model (.mom), it may be 
getting hung-up there, although that would seem to be more of a bug than user 
error.

I wish I could submit a simplified version to Apple, but, since I have no idea 
what's actually causing the problem and I can't seem to replicate it in the 
little test apps I've been making, I don't know how I'd do that.  I do live 
about 45 minutes from Cupertino.  Maybe it's time to pester Chris Hanson at the 
next NSCoder Night...


On Aug 21, 2010, at 7:37 AM, Jack Nutting wrote:

 On Fri, Aug 20, 2010 at 8:46 PM, Brad Gibbs bradgi...@mac.com wrote:
 I highlighted the .xcdatamodel and did a Design  Data Model   Add New
 Version.  That created the Config.xcdatamodeld with an unnumbered version of
 the datamodel (Config.xcdatamodel) and a numbered copy named Config
 2.xcdatamodel.
 I go into Config.xcdatamodel and add a single string attribute to one
 entity, Clean and Build  Go.  I get the missing source model error.
 
 I think you're looking at the versioning the wrong way around! The
 data model with the 2 in its name is the new one, THAT's where you
 should add new attributes etc. When your app runs, it will find the
 existing data store which is version 1, both model files (the old
 one is 1, the new one is 2), and do the conversion for you.
 
 I don't have it in front of me, but I think that if you bring up the
 info window for each of the model files, you'll see that each shows a
 version number. Core Data will always work to bring lower-versioned
 data stores up to whatever you've marked as the current version.
 
 
 -- 
 // jack
 // http://nuthole.com
 // http://learncocoa.org

___

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

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

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

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


app with quick-entry dialog

2010-08-21 Thread Martin Hewitson
Dear list,

I'm building an app which supports a quick-entry dialog triggered by a global 
hot-key so that the user can make entries while working in another app. I have 
this all working fine except for one thing. When the quick-entry dialog is 
dismissed, the main app window is made active, and even the Spaces space is 
switched. What I'd like is to return focus to the app that was running before 
the user pressed the global hot-key. The quick-entry window is shown as modal 
from the app delegate class.

Has anyone got any hints how I might achieve the desired effect?

Best wishes,

Martin



Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer 
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: martin.hewit...@aei.mpg.de
WWW: http://www.aei.mpg.de/~hewitson






___

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

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

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

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


Re: [iPhone] How to change Default.png Image Dynamically

2010-08-21 Thread Michael Ash
On Sat, Aug 21, 2010 at 8:39 AM, Tharindu Madushanka
tharindu...@gmail.com wrote:
 Hi,

 But it seems like iPhone Phone app has some different Default.png images..
 When you exit from Keypad menu.. it will load one image..

 When you exit from other tabs, Default image is some other.. Is it possible
 to do similar thing ???

 Keeping several Default images..

In addition to what Ricky said, note that Apple apps occupy a place of
special privilege on the iPhone, and can do a lot more than what our
apps can do. For example, Apple apps have been able to multitask since
the very beginning, and are still able to do so without the
limitations imposed on third-party apps by iOS 4 multitasking. There
are many other examples. So, unfortunately, that an Apple app can do
it doesn't mean anything for whether we can do it too.

Mike
___

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

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


NSMatrix selectedRow, selectedColumn

2010-08-21 Thread koko
Below is the implementation of  an NSMatrix subclass. What I do not  
understand is the NSLog output from -mouseDown.
No matter which cell I click I always get the following, i.e row and  
column are always -1.


2010-08-21 11:16:48.705 Customize It[965:813] mouse down
2010-08-21 11:16:48.706 Customize It[965:813] r -1 c -1

What fundamental concept am I missing?

-koko

@implementation FramesMatrix

/* initWithFrame */
- (id) initWithFrame:(NSRect)frameRect {

id aClass = [FramesCell class];
	return [super initWithFrame:frameRect mode:NSRadioModeMatrix  
cellClass:aClass numberOfRows:1 numberOfColumns:1];

}

- (void)awakeFromNib {

NSSize cellSize;
cellSize.width = cellSize.height = 160;
[self setCellSize:cellSize];
NSSize spacing = NSSizeFromString(@{8,16});
[self setIntercellSpacing:spacing];
[self setDrawsBackground:YES];
[self setBackgroundColor:[NSColor whiteColor]];
[self setAutoscroll:YES];
NSScrollView* sv = [self enclosingScrollView];
[sv setDrawsBackground:YES];
[sv setBackgroundColor:[NSColor whiteColor]];
}

- (void)reloadMatrix:(int)itemCnt {

NSScrollView* sv = [self enclosingScrollView];

NSRect svf = [sv frame];
NSRect sr = [self frame];

int cols = sr.size.width / 160;
int rows = (itemCnt / cols) +1;

sr.size.height = (rows * 176);
[self setFrame:sr];

[self renewRows:rows columns:cols];

[self setNeedsDisplay:YES];
}

- (bool)preservesContentDuringLiveResize { return YES; }

- (void)mouseDown:(NSEvent *)theEvent {


NSLog(@r %d c %d, [self selectedRow], [self selectedColumn]);
}

@end

___

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

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

2010-08-21 Thread Graham Cox

On 21/08/2010, at 7:19 PM, k...@highrolls.net wrote:

 - (void)mouseDown:(NSEvent *)theEvent {
 
 
   NSLog(@r %d c %d, [self selectedRow], [self selectedColumn]);
 }


Since you've completely overridden the standard -mouseDown: event handling, 
NSMatrix is unable to process the click into a selected row and column, Try 
calling super's implementation prior to logging the result. It's also possible 
that the result is not available until mouseUp.

--Graham


___

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

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

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

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


Re: Command line tool using NSImage?

2010-08-21 Thread Alastair Houghton
On 21 Aug 2010, at 14:35, Jaime Magiera wrote:

 On Aug 21, 2010, at 5:33 AM, Ken Thomases wrote:
 
 In short, you can't reliably use AppKit (including NSImage) from a daemon or 
 remote shell.
 
 Thanks for the link. Interesting read.
 
 In short, that's really a bummer. It totally negates a chunk of functionality 
 from my framework. I'll have to resort to something like keeping a client app 
 running on the server that communicates with the webapp/shell via webservice 
 (a security risk in itself). Also, it removes a lot of functionality from the 
 API. There are a myriad of useful shell/server tools that could be created 
 with that Cocoa functionality. 
 
 Has anyone heard of Apple coming up with a solution to this conundrum? Or is 
 it Bug Report time? There has to be some way to do it securely. 

The particular problem with NSImage is that it uses the window server to 
provide buffer space for image caches.  That isn't going to work from a non-GUI 
session.

I don't see why NSBitmapImageRep wouldn't work, though, OTOH, though Ken is 
right that using any part of AppKit is potentially problematic.

You can, of course, drop down to the Quartz/Core Image/ImageIO layer(s) and do 
things there, which should work just fine.

Kind regards,

Alastair.

--
http://alastairs-place.net




___

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

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

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

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


Re: Command line tool using NSImage?

2010-08-21 Thread Ken Thomases
On Aug 21, 2010, at 8:35 AM, Jaime Magiera wrote:

 Has anyone heard of Apple coming up with a solution to this conundrum? Or is 
 it Bug Report time? There has to be some way to do it securely.

What exactly are you trying to do?  For some tasks, there may be a safe 
mechanism.  For example, are you aware of the sips tool?
http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/sips.1.html

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: NSMatrix selectedRow, selectedColumn

2010-08-21 Thread koko

Do I have egg on my face or what ... thanks Graham
On Aug 21, 2010, at 11:37 AM, Graham Cox wrote:



On 21/08/2010, at 7:19 PM, k...@highrolls.net wrote:


- (void)mouseDown:(NSEvent *)theEvent {


NSLog(@r %d c %d, [self selectedRow], [self selectedColumn]);
}



Since you've completely overridden the standard -mouseDown: event  
handling, NSMatrix is unable to process the click into a selected  
row and column, Try calling super's implementation prior to logging  
the result. It's also possible that the result is not available  
until mouseUp.


--Graham





___

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

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

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

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


warning: initialization from distinct Objective-C type

2010-08-21 Thread koko
How should I make the assignment to 'fm' below to get rid of this  
warning?


warning: initialization from distinct Objective-C type



/* drawWithFrame:inView */
- (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView  
*)controlView {


FramesMatrix* fm = controlView;

___

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

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

2010-08-21 Thread Michael Ash
On Sat, Aug 21, 2010 at 12:16 PM, Martin Hewitson
martin.hewit...@aei.mpg.de wrote:
 Dear list,

 I'm building an app which supports a quick-entry dialog triggered by a global 
 hot-key so that the user can make entries while working in another app. I 
 have this all working fine except for one thing. When the quick-entry dialog 
 is dismissed, the main app window is made active, and even the Spaces space 
 is switched. What I'd like is to return focus to the app that was running 
 before the user pressed the global hot-key. The quick-entry window is shown 
 as modal from the app delegate class.

 Has anyone got any hints how I might achieve the desired effect?

Before you activate your own application, find out which application
is currently active using e.g. GetFrontProcess(). Stash the result in
a variable somewhere. When finished, reactivate the previous
application by calling e.g. SetFrontProcessWithOptions(). Be sure to
gracefully handle the case where that application is no longer
running, although that should be rare enough to not need to be *too*
graceful.

Mike
___

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

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

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

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


Re: Core Animation. issue with scaling

2010-08-21 Thread Eric Wing
On 8/21/10, Ahsan Shafiq ahsan.shafiq...@gmail.com wrote:
 Yes, you are right but now I am unable to handle touches.
 As I said in my previous post, I also want to update the model. Simply
 scaling as you mentioned does scale down or scale up the sublayers as well
 but how to update the model. In Scaling both the position and bounds get
 changed!! and after animation I just can not get the updated position and
 bounds of a layer and also of it's sublayers.

I'm not sure how you are detecting touches now, but you should look at
using CALayer's hitTest: method to determine if/what layer was
clicked/touched. If the animation is still moving, you definitely need
to be querying the presentationLayer and not the modelLayer.

hitTest should account for a layer that has been transformed by a
matrix. Another example of needing hitTest is if your layer is rotated
in 3D. Other Cocoa hit mechanisms won't be able to detect that
'skewed' hit area.


Otherwise, your alternative is to manually change the bounds and
positions for each and every one of your layers. As I said, changing
the bounds of a parent layer will not change the bounds of a child
layer. Bounds is not a scale property. They are subtly different
things.

-Eric
-- 
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: warning: initialization from distinct Objective-C type

2010-08-21 Thread Jean-Daniel Dupas

Le 21 août 2010 à 23:52, k...@highrolls.net a écrit :

 How should I make the assignment to 'fm' below to get rid of this warning?
 
 warning: initialization from distinct Objective-C type
 
 
 
 /* drawWithFrame:inView */
 - (void)drawInteriorWithFrame:(NSRect)cellFrame inView:(NSView *)controlView {
   
   FramesMatrix* fm = controlView;

FramesMatrix *fm = (FramesMatrix *)controlView;


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


[iPhone] NSPredicate formatting questions

2010-08-21 Thread Sandro Noël

Greetings.

i'm trying to set a predicate to query some deep object in my model.
my model is as so.

member is part of a category
the category has a name.


while in a member resultset i want to filter the content on category names.

[NSPredicate predicateWithFormat:@(caregory.name IN %@),[selections 
objectForKey:kPredicateFieldNamesArray]]; 

I crash with:
'unimplemented SQL generation for predicate : (caregory.name IN {Boutiques})'

I've otherwise tried:
[NSPredicate predicateWithFormat:@(carego...@name IN %@),[selections 
objectForKey:kPredicateFieldNamesArray]];
'Unsupported KVC aggregate in keypath: carego...@name'

Am I missing something?
I thought KVC was part of the Predicates.

any pointers are welcome.
Sandro___

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

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


bind:toObject:withKeyPath:options: being called twice

2010-08-21 Thread Charles Srstka
My custom view implements -optionDescriptionsForBinding: as follows:

- (NSArray *)optionDescriptionsForBinding:(NSString *)binding {
NSMutableArray *descs = [NSMutableArray arrayWithArray:[super 
optionDescriptionsForBinding:binding]];
 
if([binding isEqualToString:@“foo]) {
NSAttributeDescription *desc = [[[NSAttributeDescription alloc] init] 
autorelease];

[desc setName:NSConditionallySetsHiddenBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:NO]];
[descs addObject:desc];

desc = [[[NSAttributeDescription alloc] init] autorelease];
[desc setName:NSConditionallySetsEnabledBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:NO]];
[descs addObject:desc];

desc = [[[NSAttributeDescription alloc] init] autorelease];
[desc setName:NSConditionallySetsEditableBindingOption];
[desc setAttributeType:NSBooleanAttributeType];
[desc setDefaultValue:[NSNumber numberWithBool:YES]];
[descs addObject:desc];
}

return descs;
}

As expected, this causes Interface Builder to show the checkboxes for these 
three options. However, if I try to click one of them, 
bind:toObject:withKeyPath:options: gets called twice — the first time with 
these three options properly present in the options dictionary, but the second 
time with the options dictionary set to nil (or to a dictionary containing 
nothing but the value transformer, if there is one). The result of this is that 
trying to click one of the check boxes causes the checkbox to change 
momentarily but then flicker back to the default setting, and there’s no way to 
actually set these binding options.

Has anyone seen this before? What might be causing it?

Thanks,
Charles___

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

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

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

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


Re: [iPhone] NSPredicate formatting questions

2010-08-21 Thread Wyatt Webb

On Aug 21, 2010, at 3:40 PM, Sandro Noël wrote:

 while in a member resultset i want to filter the content on category names.
 
 [NSPredicate predicateWithFormat:@(caregory.name IN %@),[selections 
 objectForKey:kPredicateFieldNamesArray]];   
 
 I crash with:
 'unimplemented SQL generation for predicate : (caregory.name IN 
 {Boutiques})'
 
 I've otherwise tried:
 [NSPredicate predicateWithFormat:@(carego...@name IN %@),[selections 
 objectForKey:kPredicateFieldNamesArray]];  
 'Unsupported KVC aggregate in keypath: carego...@name'
 
 Am I missing something?
 I thought KVC was part of the Predicates.

Not to state the obvious, but you did notice that your code has misspelled 
category, right? Is the property name correct?

Wyatt___

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

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

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

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


Re: [iPhone] NSPredicate formatting questions

2010-08-21 Thread Sandro Noël
Oh my god, I feel ashamed...
that's what I get for working late.

I'm sorry.



On 2010-08-21, at 11:38 PM, Wyatt Webb wrote:

 
 On Aug 21, 2010, at 3:40 PM, Sandro Noël wrote:
 
 while in a member resultset i want to filter the content on category names.
 
 [NSPredicate predicateWithFormat:@(caregory.name IN %@),[selections 
 objectForKey:kPredicateFieldNamesArray]];  
 
 I crash with:
 'unimplemented SQL generation for predicate : (caregory.name IN 
 {Boutiques})'
 
 I've otherwise tried:
 [NSPredicate predicateWithFormat:@(carego...@name IN %@),[selections 
 objectForKey:kPredicateFieldNamesArray]]; 
 'Unsupported KVC aggregate in keypath: carego...@name'
 
 Am I missing something?
 I thought KVC was part of the Predicates.
 
 Not to state the obvious, but you did notice that your code has misspelled 
 category, right? Is the property name correct?
 
 Wyatt___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 http://lists.apple.com/mailman/options/cocoa-dev/apple.lists%40gestosoft.com
 
 This email sent to apple.li...@gestosoft.com

___

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

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

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

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


Re: [iPhone] NSPredicate formatting questions

2010-08-21 Thread Wyatt Webb

On Aug 21, 2010, at 9:15 PM, Sandro Noël wrote:

 Oh my god, I feel ashamed...
 that's what I get for working late.
 
 I'm sorry.

No worries. It happens to us all. Better than chasing it for another couple of 
hours!___

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

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


Making an NSMethodInvocation from the current method

2010-08-21 Thread Roland King
Is there a built-in function to make an NSMethodInvocation from 'the current 
method I'm in with all current parameters', or does anyone have any code 
they've written to do this? 

Motivation, I'm writing a display class which can get updated from a background 
thread, it has a whole load of methods, some of which don't lend themselves to 
performSelectorOnMainThread (some take more than two arguments, some take 
primitives and I don't really want to wrap and unwrap into NSNumbers all over 
the place). What I really would like is in each method to be able to write 
something like

if( ![ NSThread isMainThread ] )
[ NSMagicFunctionReturningAnInvocationForThisCurrentFunction() 
performSelectorOnMainThread:@selector( invoke ) withObject:nil waitUntilDone:NO 
];
else
{
// method performing code here
}

but there is of course no such function I'm aware of nor can I easily think how 
I'd write such a thing. 

I have a current solution for those methods which are properties using 
forwarding because forwardInvocation: is the only function I know of which 
gives me a pre-packaged invocation object but I find it a bit inelegant and it 
only works for properties. That method briefly works as follows, if I want a 
property 'foo', I declare it, then use @dynamic to suppress the compiler 
warnings. In the class continuation I declare the same property prepended with 
an given prefix (I'm using TS_ for threadsafe) and implement it. I then 
override forwardInvocation: and methodSignatureForSelector: to check for the 
existance of a method TS_called selector and if it exists I switch the 
selector in the NSInvocation forwardInvocation: gives me and invoke it if I'm 
on the main thread or forward it to the main thread if I'm not. 

eg setFoo:123 is not implemented so methodSignatureForSelector: is called for 
setFoo: and I return the signature for TS_setFoo:. Then forwardInvocation: is 
called with a prepacked NSInvocation, I switch the selector to that for 
TS_setFoo: and invoke it. 

This only works for properties because I can only use @dynamic to suppress the 
warnings on those, other declared methods in the interface need to be 
implemented (or is there a way to suppress that warning) and the whole TS_ 
prefix thing seems a bit hokey to me so I was looking for a more direct way to 
make an NSInvocation. ___

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

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

2010-08-21 Thread Tony Romano
Use GCD.

   dispatch_sync(dispatch_get_main_queue(), ^{
// Call your function here
MyFunction (param 1, param2, ...);
});

Tony Romano
http://www.cocoaegghead.com




On Aug 21, 2010, at 10:03 PM, Roland King wrote:

Is there a built-in function to make an NSMethodInvocation from 'the current 
method I'm in with all current parameters', or does anyone have any code 
they've written to do this? 

Motivation, I'm writing a display class which can get updated from a background 
thread, it has a whole load of methods, some of which don't lend themselves to 
performSelectorOnMainThread (some take more than two arguments, some take 
primitives and I don't really want to wrap and unwrap into NSNumbers all over 
the place). What I really would like is in each method to be able to write 
something like

if( ![ NSThread isMainThread ] )
[ NSMagicFunctionReturningAnInvocationForThisCurrentFunction() 
performSelectorOnMainThread:@selector( invoke ) withObject:nil waitUntilDone:NO 
];
else
{
// method performing code here
}

but there is of course no such function I'm aware of nor can I easily think how 
I'd write such a thing. 

I have a current solution for those methods which are properties using 
forwarding because forwardInvocation: is the only function I know of which 
gives me a pre-packaged invocation object but I find it a bit inelegant and it 
only works for properties. That method briefly works as follows, if I want a 
property 'foo', I declare it, then use @dynamic to suppress the compiler 
warnings. In the class continuation I declare the same property prepended with 
an given prefix (I'm using TS_ for threadsafe) and implement it. I then 
override forwardInvocation: and methodSignatureForSelector: to check for the 
existance of a method TS_called selector and if it exists I switch the 
selector in the NSInvocation forwardInvocation: gives me and invoke it if I'm 
on the main thread or forward it to the main thread if I'm not. 

eg setFoo:123 is not implemented so methodSignatureForSelector: is called for 
setFoo: and I return the signature for TS_setFoo:. Then forwardInvocation: is 
called with a prepacked NSInvocation, I switch the selector to that for 
TS_setFoo: and invoke it. 

This only works for properties because I can only use @dynamic to suppress the 
warnings on those, other declared methods in the interface need to be 
implemented (or is there a way to suppress that warning) and the whole TS_ 
prefix thing seems a bit hokey to me so I was looking for a more direct way to 
make an NSInvocation. ___

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

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

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

This email sent to tony...@hotmail.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