Re: Rendering big PDF into thumbnail bitmap - too blurry

2008-09-24 Thread Oleg Krupnov
Eurica!

Two things were wrong:

1) There was a 0.5 pixel shift transform in my graphics context
imposed earlier in the stack. I use this to render bezier curves to
integer pixels, but for rendering bitmaps this offset needs to be
reset. After fixing this, however, there was still a little blur, but
way less than before.

2) I switched to using NSBitmapImageRep and +[NSGraphicsContext
graphicsContextWithBitmapImageRep] instead of the offscreen NSImage
and lockFocus. The latter is obsolete BTW. See the example:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Images/chapter_7_section_5.html#//apple_ref/doc/uid/TP40003290-CH208-BCICHFGA
 (the Drawing Directly to a Bitmap section)



On Wed, Sep 24, 2008 at 8:48 AM, Oleg Krupnov [EMAIL PROTECTED] wrote:
 Yes, I tried it and it doesn't seem to have any effect.

 I have just double-checked regarding - [NSBitmapImageRep
 initWithFocusedViewRect]. For an experiment I saved the bitmap to a
 tiff file right after capturing the bitmap from screen, and it appears
 that the tiff is sharp, not blurry.

 It looks like the temporary thumbnail NSImage spoils the whole thing,
 but I can't figure out how to bypass it.



 On Wed, Sep 24, 2008 at 8:41 AM, Ken Thomases [EMAIL PROTECTED] wrote:
 On Sep 24, 2008, at 12:33 AM, Oleg Krupnov wrote:

 What could be the problem?

 Have you tried using -[NSGraphicsContext setImageInterpolation:] after
 locking focus?

 Cheers,
 Ken



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Rendering big PDF into thumbnail bitmap - too blurry

2008-09-24 Thread Uli Kusterer

On 24.09.2008, at 08:24, Oleg Krupnov wrote:

The latter is obsolete BTW. See the example:
http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Images/chapter_7_section_5.html#/ 
/apple_ref/doc/uid/TP40003290-CH208-BCICHFGA

(the Drawing Directly to a Bitmap section)



 What, specifically, are you referring to? I see nowhere that it says  
anything was obsolete. Just suggest certain solutions for certain OS  
versions. Or am I missing something here?


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Converting from Carbon Event Manager to NSTimer

2008-09-24 Thread Uli Kusterer

On 24.09.2008, at 01:20, Dan Birns wrote:
My application needs to set a timer that causes a function to be  
called at a time in the future.  This is non-repeating, and  
sometimes has be immediate.  I need it to be as efficient as  
possible, because it's called frequently.


 Have you checked out the various performSelector: methods available?  
Particularly performSelector:withObject:afterDelay: seems to be a  
shorthand that might work much better. In any case though, watch out  
for Cocoa's run loop modes. By default, timers only get scheduled on  
NSDefaultRunLoopMode, so if you want your timer to also fire in  
NSModalPanelRunLoopMode or NSTrackingRunLoopMode (names from memory,  
may vary slightly), you may need to use the appropriate calls (the  
inModes: variant, or do an addTimer for the additional modes).



self.timer = [NSTimer scheduledTimerWithTimeInterval:   t   
// seconds
  target:   self
selector:   @selector 
(mainLoopTimer:)
userInfo:   nil 
 repeats:   NO];

This is working fine, but our performance is poor.  It's not so poor  
that it's obviously broken, but I'm looking for ways to improve it.   
I've been try to alloc one NSTimer that I reuse, and I've had no  
success doing so.


 How did you measure this? What value is 't' ?


I've tried

timer = [NSTimer alloc];
   [timer initWithFireDate:[NSDate date] interval:t target:self  
selector:@selector(mainLoopTimer:) userInfo:halTimer repeats:NO];
   [[NSRunLoop currentRunLoop] addTimer:timer  
forMode:NSDefaultRunLoopMode];


 Why are you discarding the result of initWithFireDate:? You could be  
talking to the completely wrong object here. You really should use the  
ObjC [[NSClass alloc] init] idiom here, everything is engineered  
towards that, and timer is not guaranteed to be valid after the init  
call, you're supposed to re-set it to whatever the init returned.






Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How make a cocoa lib wich create a window ?

2008-09-24 Thread rouanet brice
Hi,

thanks, when I launch a simple app with this code it works :

#import Cocoa/Cocoa.h
#import MyOgView.h

int main(int argc, char *argv[])
{


//use TransformProcessType to transform non gui processs in gui process

//voir -[NSApplication runModalForWindow:].
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
NSWindow *window;
MyOgView *ogView;
ogView = [[MyOgView alloc] initWithFrame:NSMakeRect(0,100,500,375) ];
window = [[NSWindow alloc]
initWithContentRect:NSMakeRect(50,100,640,480)
 styleMask:NSTitledWindowMask |
NSResizableWindowMask
   backing:NSBackingStoreBuffered
 defer:TRUE];

const ProcessSerialNumber psn = { 0, kCurrentProcess };
TransformProcessType(psn, kProcessTransformToForegroundApplication);


SetFrontProcess(psn);

//add title to the window
[window setTitle:@toto gl];


//attach glview on the window
[[window contentView] addSubview:ogView];
//[[window contentView] addSubview:button];


[NSApplication sharedApplication];
[window makeKeyAndOrderFront: nil];
[pool release];

[NSApp run];
return 0;
}

But when I use this code in a dynamic library it not work, I can't see the
window, have you got an idea ?

Regards,
tmator.

2008/9/19 Ken Thomases [EMAIL PROTECTED]

 On Sep 18, 2008, at 11:38 PM, rouanet brice wrote:

  I work on a projetc where the executable haven't GUI but I can launch
 somme
 gui window with plugins.

 test - no gui application
  -plugin
   -triangle - this plugin display a triangle in a cocoa window
   -rectangle - this plugin display a rectangle in a cocoa window

 All plugins works in standolone applications, but when I launch test, I
 cant
 see the window.


 You need a couple of things.  First, you will need to use
 TransformProcessType to turn your non-GUI process into a GUI process.
  Second, you will need to initialize an NSApplication and its connection to
 the window server.  Read the class overview for NSApplication.  You will
 also need to run the event loop somehow.  Normally, this would be done using
 -[NSApplication run], but you may be able to get away with just
 -[NSApplication runModalForWindow:].

 Cheers,
 Ken


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CGLayer questions

2008-09-24 Thread Jean-Daniel Dupas


Le 24 sept. 08 à 06:04, Alex Reynolds a écrit :

Is it possible to take a CGLayer and turn it into a bitmap  
representation?


Create a CGBitmapContext and draw you layer into it.



Also, is it possible to grab a CGRect subset of a CGLayer and  
append that to a new CGLayer, so that it isn't necessary to  
recalculate the entirety of a new CGLayer?




CGContextRef ctxt = CGLayerGetContext(mySecondLayer);
CGContextClipToRect(ctxt, …)
CGContextDrawLayerInRect(ctxt, myFirstLayer, …);


Thanks,
Alex



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Rendering big PDF into thumbnail bitmap - too blurry

2008-09-24 Thread Oleg Krupnov
Well, it's my interpretation that because the new technique was
introduced in Mac OS 10.4 and later, the older technique has become
obsolete. Not deprecated or invalid though.

Here's the original quote:

In Mac OS X v10.4 and later, it is possible to create a bitmap image
representation object and draw to it directly. This technique is
simple and does not require the creation of any extraneous objects,
such as an image or window. If your code needs to run in earlier
versions of Mac OS X, however, you cannot use this technique.



On Wed, Sep 24, 2008 at 9:59 AM, Uli Kusterer
[EMAIL PROTECTED] wrote:
 On 24.09.2008, at 08:24, Oleg Krupnov wrote:

 The latter is obsolete BTW. See the example:

 http://developer.apple.com/documentation/Cocoa/Conceptual/CocoaDrawingGuide/Images/chapter_7_section_5.html#//apple_ref/doc/uid/TP40003290-CH208-BCICHFGA
 (the Drawing Directly to a Bitmap section)


  What, specifically, are you referring to? I see nowhere that it says
 anything was obsolete. Just suggest certain solutions for certain OS
 versions. Or am I missing something here?

 Cheers,
 -- Uli Kusterer
 The Witnesses of TeachText are everywhere...
 http://www.zathras.de






___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Rendering big PDF into thumbnail bitmap - too blurry

2008-09-24 Thread Uli Kusterer

On 24.09.2008, at 09:50, Oleg Krupnov wrote:

Well, it's my interpretation that because the new technique was
introduced in Mac OS 10.4 and later, the older technique has become
obsolete. Not deprecated or invalid though.



 Ah! Sorry, brain-freeze there... somehow I ended up in 'creating a  
bitmap'... thanks.


Cheers,
-- Uli Kusterer
The Witnesses of TeachText are everywhere...
http://www.zathras.de





___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Very basic Bindings question

2008-09-24 Thread Jason Coco


On Sep 24, 2008, at 04:21 , Adil Saleem wrote:


Hi,

I am trying to use bindings for the first time. So this is a pretty  
basic question.


As an example what i am trying to do is that i have a NSTextField in  
which user enters some numeric value. I have a int type variable in  
my class that is binded to the value field of this text field. I get  
the value in the variable correctly. But the problem is that the  
accessor method that i have written are not called. If i print  
something in the accessor methods, it is not printed on the console.


Here is the code.


I have declared in myClass.h

@interface myClass: NSObject {

 int Var;
}

-(void)setVar:(int)aNumber;
-(int)getVar;


Don't use getVar (also, don't start a variable with a capital  
letter)... the correct naming convention is this:


@interface MyClass : NSObject {	// the convention is to start class  
names with a capital letter

int var;
}

-(void)setVar:(int)aNumber;		// the setter message should be the word  
set + [capital first letter] + rest of variable name
-(int)var;			// the getter message should have the same name as  
the variable


HTH, Jason

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: Very basic Bindings question

2008-09-24 Thread Raphael Sebbe
file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Compliant.htmlfile:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Compliant.html
Hi,
here is how accessors should be defined. Watch the case too.

file:///Developer/Documentation/DocSets/com.apple.ADC_Reference_Library.CoreReference.docset/Contents/Resources/Documents/documentation/Cocoa/Conceptual/KeyValueCoding/Concepts/Compliant.html

HTH

Raphael

On Wed, Sep 24, 2008 at 10:21 AM, Adil Saleem [EMAIL PROTECTED]wrote:

 Hi,

 I am trying to use bindings for the first time. So this is a pretty basic
 question.

 As an example what i am trying to do is that i have a NSTextField in which
 user enters some numeric value. I have a int type variable in my class
 that is binded to the value field of this text field. I get the value in the
 variable correctly. But the problem is that the accessor method that i have
 written are not called. If i print something in the accessor methods, it is
 not printed on the console.

 Here is the code.


 I have declared in myClass.h

 @interface myClass: NSObject {

  int Var;
 }

 -(void)setVar:(int)aNumber;
 -(int)getVar;

 In the myClass.m i have

 @implementation myClass

 -(void)setVar:(int)aNumber {

Var = aNumber;
 }

 -(int)getVar
 {
 return Var;
 }


  Why are these functions not being called ? Am i missing something in the
 syntax or is it something else.


 Thanx






 ___

 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/raphael.sebbe%40gmail.com

 This email sent to [EMAIL PROTECTED]

___

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

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

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

This email sent to [EMAIL PROTECTED]


Image processing in Cocoa

2008-09-24 Thread Christian Giordano
Hi guys, is there some good tutorial around about how to manipulate
bitmaps in Cocoa?

I would be interested on:

- copy portion of image over another with a mask (this should be
pretty straight forward with quartz2d)
- apply threshold
- apply effects like blur

Not sure if some of this, like the blur, is recommended to do from an
higher level instead of doing it pixel by pixel. In case of the
latter, how to get the bytearray with all the pixels info?

Thanks a lot, chr
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lauchd and svnserve

2008-09-24 Thread Stéphane Sudre


On Sep 24, 2008, at 10:24 AM, René v Amerongen wrote:


[...]
1.)While svnserve is running, in my Subversion_SVNserve.log log I see.
svnserve: Root path '/Volumes/Development_Current/_CodeRepository'  
does not exist or is not a directory.
svnserve: Root path '/Volumes/Development_Current/_CodeRepository'  
does not exist or is not a directory.

svnserve: Can't bind server socket: Address already in use
svnserve: Can't bind server socket: Address already in use
svnserve: Can't bind server socket: Address already in use
...

and at the console I see the Launchd log

24-09-08 10:06:36 com.apple.launchd[1] (subversion.svnserve[684])  
Exited with exit code: 1
24-09-08 10:06:36 com.apple.launchd[1] (subversion.svnserve)  
Throttling respawn: Will start in 10 seconds
24-09-08 10:06:46 com.apple.launchd[1] (subversion.svnserve[685])  
Exited with exit code: 1
24-09-08 10:06:46 com.apple.launchd[1] (subversion.svnserve)  
Throttling respawn: Will start in 10 seconds

.

Yesterday I did have a huge PID number a little scary.
Why is it trying to start again?


Because that's launchd designed behavior.


How can I stop that?


Remove your launchd script and restart the Mac.

or use the launchctl(1) tool

2.) When I unmount the drive, then the svnserve keeps running. I  
thought the the daemon will get killed.
However it restart when the drive is mounted back online. But how  
can I get this killed when unmounting the drive.



3.) Actualy I would like to have it start at demand and kills after  
10 minutes. I notice that the OnDemand key is gone in 10.5. But how  
should I do it now?


4.) I did see a few sample script with ip socket info in the plist,  
what is that for? Do I need that?


You should probably ask these questions on the darwin-dev mailing  
list. Cocoa-dev is for Cocoa-MacOnly questions.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Image processing in Cocoa

2008-09-24 Thread Mike Abdullah


On 24 Sep 2008, at 10:50, Christian Giordano wrote:


Hi guys, is there some good tutorial around about how to manipulate
bitmaps in Cocoa?

I would be interested on:

- copy portion of image over another with a mask (this should be
pretty straight forward with quartz2d)


[[NSImage alloc] initWithSize:]
[image lockFocus]
[sourceImage drawAtPoint:point fromRect:imagePortionRect  
operation:operation fraction:1.0]

[image unlockFocus]



- apply threshold
- apply effects like blur


Core Image is your friend



Not sure if some of this, like the blur, is recommended to do from an
higher level instead of doing it pixel by pixel. In case of the
latter, how to get the bytearray with all the pixels info?

Thanks a lot, chr
___

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lauchd and svnserve

2008-09-24 Thread Roland King
don't run it like that. the 'd' argument means daemon-ize and it's a  
requirement of launchd that processes do NOT do that. What's happening  
is the process is starting, it immediately backgrounds itself, which  
means the process launchd starts dies, then launchd tries to start it  
up again but it can't because there is a background daemon process  
(the one you just started) hogging the socket. Eventually launchd  
gives up trying to respawn it and the error messages in the console  
stop, and the daemon one is still there. launchd cannot control  
processes which do that.


You're also clearly trying to start it up too early, so the first few  
really do actually just die and launchd starts them up again, but it  
doesn't really know what it's doing.


You could run it in foreground mode by changing that '-d' to '-- 
foreground'. That will stop launchd going totally nuts trying to keep  
starting it up again because it will stay up, and if it does fall  
down, launchd will correctly start it for you again.


however a much better idea is to put it into inetd mode and only start  
up on demand when someone asks for it, I don't know about you but I  
don't use my repository very much. For that you need the file which  
follows. That will start one in inetd mode when someone makes a  
request on the svn port. In that way the process will be down most of  
the time which is less strain on the server and it won't start until  
someone asks for it, which means you shouldn't have all those volume  
mounting issues.


?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
  keyDisabled/key
  false/
  keyLabel/key
  stringorg.tigris.subversion.svnserve/string
  keyProgramArguments/key
  array
  string/usr/local/bin/svnserve/string
  string--inetd/string
  string--root=Volumes/Development_Current/_CodeRepository/ 
string

  /array
  keyServiceDescription/key
  stringSubversion Standalone Server/string
  keySockets/key
  dict
keyListeners/key
array
  dict
keySockFamily/key
stringIPv4/string
keySockServiceName/key
stringsvn/string
keySockType/key
stringstream/string
  /dict
/array
  /dict
keyinetdCompatibility/key
  dict
keyWait/key
false/
  /dict
/dict
/plist


On Sep 24, 2008, at 4:24 PM, René v Amerongen wrote:


Dear list

Not sure where to put this question, but I did see here more of  
launchd questions.


I got svnserve running with the following plist.

?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
keyKeepAlive/key
dict
keyPathState/key
dict
key/Volumes/Development_Current/_CodeRepository/key
true/
/dict
/dict
keyLabel/key
stringsubversion.svnserve/string
keyProgramArguments/key
array
string/usr/local/bin/svnserve/string
string-d/string
string-r/string
string/Volumes/Development_Current/_CodeRepository/string
/array
keyRunAtLoad/key
true/
keyStandardErrorPath/key
string/Library/Logs/Subversion_SVNserve.log/string
/dict
/plist

My Volumes/Development_Current/ volume is a firewire disk and when  
the plist get fired the drive isn't ready yet.
But when it comes up the svnserve starts up en works ok. Just a  
second but with two or three does not exist or is not a directory  
lines


Some questions however.

1.)While svnserve is running, in my Subversion_SVNserve.log log I see.
svnserve: Root path '/Volumes/Development_Current/_CodeRepository'  
does not exist or is not a directory.
svnserve: Root path '/Volumes/Development_Current/_CodeRepository'  
does not exist or is not a directory.

svnserve: Can't bind server socket: Address already in use
svnserve: Can't bind server socket: Address already in use
svnserve: Can't bind server socket: Address already in use
...

and at the console I see the Launchd log

24-09-08 10:06:36 com.apple.launchd[1] (subversion.svnserve[684])  
Exited with exit code: 1
24-09-08 10:06:36 com.apple.launchd[1] (subversion.svnserve)  
Throttling respawn: Will start in 10 seconds
24-09-08 10:06:46 com.apple.launchd[1] (subversion.svnserve[685])  
Exited with exit code: 1
24-09-08 10:06:46 com.apple.launchd[1] (subversion.svnserve)  
Throttling respawn: Will start in 10 seconds

.

Yesterday I did have a huge PID number a little scary.
Why is it trying to start again? How can I stop that? what is wrong  
with my plist?



2.) When I unmount the drive, then the svnserve keeps running. I  
thought the the daemon will get killed.
However it restart when the drive is mounted back online. But how  
can I get this killed when 

Re: lauchd and svnserve

2008-09-24 Thread René v Amerongen

Hi Roland,

thanks for the explaining.
Your script is allmost 100% that what I did use with 10.4, except I  
did have also ipv6 sockets there. But it did stop working under 10.5.


I will try yours. Otherwise I will fall back with the foreground option.

thanks

René

Op 24 sep 2008, om 12:49 heeft Roland King het volgende geschreven:

don't run it like that. the 'd' argument means daemon-ize and it's a  
requirement of launchd that processes do NOT do that. What's  
happening is the process is starting, it immediately backgrounds  
itself, which means the process launchd starts dies, then launchd  
tries to start it up again but it can't because there is a  
background daemon process (the one you just started) hogging the  
socket. Eventually launchd gives up trying to respawn it and the  
error messages in the console stop, and the daemon one is still  
there. launchd cannot control processes which do that.


You're also clearly trying to start it up too early, so the first  
few really do actually just die and launchd starts them up again,  
but it doesn't really know what it's doing.


You could run it in foreground mode by changing that '-d' to '-- 
foreground'. That will stop launchd going totally nuts trying to  
keep starting it up again because it will stay up, and if it does  
fall down, launchd will correctly start it for you again.


however a much better idea is to put it into inetd mode and only  
start up on demand when someone asks for it, I don't know about you  
but I don't use my repository very much. For that you need the file  
which follows. That will start one in inetd mode when someone makes  
a request on the svn port. In that way the process will be down most  
of the time which is less strain on the server and it won't start  
until someone asks for it, which means you shouldn't have all those  
volume mounting issues.


?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
 keyDisabled/key
 false/
 keyLabel/key
 stringorg.tigris.subversion.svnserve/string
 keyProgramArguments/key
 array
 string/usr/local/bin/svnserve/string
 string--inetd/string
 string--root=Volumes/Development_Current/_CodeRepository/ 
string

 /array
 keyServiceDescription/key
 stringSubversion Standalone Server/string
 keySockets/key
 dict
   keyListeners/key
   array
 dict
   keySockFamily/key
   stringIPv4/string
   keySockServiceName/key
   stringsvn/string
   keySockType/key
   stringstream/string
 /dict
   /array
 /dict
keyinetdCompatibility/key
 dict
   keyWait/key
   false/
 /dict
/dict
/plist


On Sep 24, 2008, at 4:24 PM, René v Amerongen wrote:


Dear list



2.) When I unmount the drive, then the svnserve keeps running. I  
thought the the daemon will get killed.
However it restart when the drive is mounted back online. But how  
can I get this killed when unmounting the drive.



Thanks in advance

René



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: lauchd and svnserve

2008-09-24 Thread Patrick Mau

I hope you don't mind sharing my plist.

Please note the 'PathState', that avoids the mentioned mount issues.
In addition, I use User/Group settings and decimal umask 23 (027  
octal).


?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
keyDebug/key
false/
keyGroupName/key
string_svn/string
keyKeepAlive/key
dict
keyPathState/key
string/opt/sw/var/lib/svn/string
/dict
keyLabel/key
stringlocal.svnserve/string
keyOnDemand/key
false/
keyProgramArguments/key
array
string/opt/sw/bin/svnserve/string
string--daemon/string
string--foreground/string
string--root/string
string/opt/sw/var/lib/svn/string
string--listen-host/string
string0.0.0.0/string
/array
keyRunAtLoad/key
true/
keyUserName/key
string_svn/string
keyUmask/key
integer23/integer
/dict
/plist

On 24.09.2008, at 12:49, Roland King wrote:

don't run it like that. the 'd' argument means daemon-ize and it's a  
requirement of launchd that processes do NOT do that. What's  
happening is the process is starting, it immediately backgrounds  
itself, which means the process launchd starts dies, then launchd  
tries to start it up again but it can't because there is a  
background daemon process (the one you just started) hogging the  
socket. Eventually launchd gives up trying to respawn it and the  
error messages in the console stop, and the daemon one is still  
there. launchd cannot control processes which do that.


You're also clearly trying to start it up too early, so the first  
few really do actually just die and launchd starts them up again,  
but it doesn't really know what it's doing.


You could run it in foreground mode by changing that '-d' to '-- 
foreground'. That will stop launchd going totally nuts trying to  
keep starting it up again because it will stay up, and if it does  
fall down, launchd will correctly start it for you again.


however a much better idea is to put it into inetd mode and only  
start up on demand when someone asks for it, I don't know about you  
but I don't use my repository very much. For that you need the file  
which follows. That will start one in inetd mode when someone makes  
a request on the svn port. In that way the process will be down most  
of the time which is less strain on the server and it won't start  
until someone asks for it, which means you shouldn't have all those  
volume mounting issues.


?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
keyDisabled/key
false/
keyLabel/key
stringorg.tigris.subversion.svnserve/string
keyProgramArguments/key
array
string/usr/local/bin/svnserve/string
string--inetd/string
string--root=Volumes/Development_Current/_CodeRepository/ 
string

/array
keyServiceDescription/key
stringSubversion Standalone Server/string
keySockets/key
dict
  keyListeners/key
  array
dict
  keySockFamily/key
  stringIPv4/string
  keySockServiceName/key
  stringsvn/string
  keySockType/key
  stringstream/string
/dict
  /array
/dict
keyinetdCompatibility/key
dict
  keyWait/key
  false/
/dict
/dict
/plist


On Sep 24, 2008, at 4:24 PM, René v Amerongen wrote:


Dear list

Not sure where to put this question, but I did see here more of  
launchd questions.


I got svnserve running with the following plist.

?xml version=1.0 encoding=UTF-8?
!DOCTYPE plist PUBLIC -//Apple//DTD PLIST 1.0//EN http://www.apple.com/DTDs/PropertyList-1.0.dtd 


plist version=1.0
dict
keyKeepAlive/key
dict
keyPathState/key
dict
key/Volumes/Development_Current/_CodeRepository/key
true/
/dict
/dict
keyLabel/key
stringsubversion.svnserve/string
keyProgramArguments/key
array
string/usr/local/bin/svnserve/string
string-d/string
string-r/string
string/Volumes/Development_Current/_CodeRepository/string
/array
keyRunAtLoad/key
true/
keyStandardErrorPath/key
string/Library/Logs/Subversion_SVNserve.log/string
/dict
/plist

My Volumes/Development_Current/ volume is a firewire disk and when  
the plist get fired the drive isn't ready yet.
But when it comes up the svnserve starts up en works ok. Just a  
second but with two or three does not exist or is not a directory  
lines


Some questions however.

1.)While svnserve is running, in my Subversion_SVNserve.log log I  
see.
svnserve: Root path 

How to track Slider's value while dragging the mouse?

2008-09-24 Thread Oleg Krupnov
NSSlider only changes its value (and fires its target/action and the
binding) when the user releases the mouse button.

Whereas I need to track the current value of the slider while the
mouse is being dragged, with the button held down -- like thumbnail
size in iPhoto.

I can't believe I have to implement my own slider to get this
behavior. Neither I can find the property of NSSlider that would make
it behave like this. Am I missing something?
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: How to track Slider's value while dragging the mouse?

2008-09-24 Thread Greg Titus

Hi Oleg,

The property you want is setContinuous:YES, or check the Continuous  
checkbox in Interface Builder. (The method is defined on NSSilder's  
superclass, NSControl.)


Hope this helps,
- Greg

On Sep 24, 2008, at 7:08 AM, Oleg Krupnov wrote:


NSSlider only changes its value (and fires its target/action and the
binding) when the user releases the mouse button.

Whereas I need to track the current value of the slider while the
mouse is being dragged, with the button held down -- like thumbnail
size in iPhoto.

I can't believe I have to implement my own slider to get this
behavior. Neither I can find the property of NSSlider that would make
it behave like this. Am I missing something?
___

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/greg%40omnigroup.com

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating alias programatically

2008-09-24 Thread Michael Ash
On Wed, Sep 24, 2008 at 1:43 AM, Charles Srstka
[EMAIL PROTECTED] wrote:
[source appendFormat:@set theAlias to make alias at POSIX file \[EMAIL 
 PROTECTED] to
 POSIX file \[EMAIL PROTECTED]\n, NSTemporaryDirectory(), originalPath];

Please never do anything like this. This will fail horribly if either
one of these two paths contains certain perfectly legal characters,
such as . It's best to use something like the scripting bridge or
objc-appscript. If you must use AppleScript,  then you should write
the script as a subroutine which takes the paths as parameters, then
invoke it using something like the code on this page:

http://www.cocoadev.com/index.pl?CallAppleScriptFunction

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


Re: How to track Slider's value while dragging the mouse?

2008-09-24 Thread Erik Buck
- setContinuous:
 
setContinuous:
Sets whether the receiver’s cell sends its action message continuously to its 
target during mouse tracking.
- (void)setContinuous:(BOOL)flag
Parameters

flag 

YES if the action message should be sent continuously; otherwise, NO.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: CALayers inside NSSplitView (clipping issue)

2008-09-24 Thread John Clayton

Hi All,

Someone kindly suggested that I post the question again, but that this  
time I make some sense :-)  Good idea I say...


So - step by step, first a series of facts to set the scene:

1. i have an NSSplitView
2. both of the views that this split view contains use CALayer instances
3. in the lower view is a track-view style control, it allows one to  
drag tracks up and down
4. the track view in the lower part of the NSSplitView is contained in  
an NSScrollView instance (which is usual for splitters of course -  
nothing abnormal so far).


next: here's a screen shot of the app working properly - in this  
screenshot, I've started the app but not resized anything or moved  
anything yet.

http://skitch.com/johnclayton/s5fr/picture-1

now, imagine that I take the mouse, and I use it to drag that horribly  
purple coloured track straight down.  the desired effects are:

- the layer is moved downwards
- the view expands in the vertical direction (gets larger, but thats  
ok right - cos its in a scrollview)

- the vertical scrollbar should appear in the NSScrollView
- the NSScrollView / NSClipView should clip the contents view

now, here's a screenshot of the bug:
http://skitch.com/johnclayton/s5fa/picture-3

so I wonder what is causing the calayer instance to NOT be clipped in  
this case.  The NSClipView inside the scrollview should be clipping,  
right?


Thanks
--
John Clayton
Skype: johncclayton




On 24/09/2008, at 5:58 AM, John Clayton wrote:


Hi All,

I have a vertically laid out NSSplitView which is hosting two  
NSViews, both of which contain CALayer instances.  In the bottom  
view, there's a scroll view - and I can drag stuff within the view -  
which in turn causes the view to grow.


Sometimes, the splitview doesn't clip the CALayer *at all*, and I  
see this:

http://skitch.com/johnclayton/s4gc/picture-2

I resize the contents of the split-view during mouseDragged: (along  
with its layers), does anyone know of issues with this or perhaps  
has an idea of whats going wrong?


Thanks
--
John Clayton
Skype: johncclayton




___

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


This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Image processing in Cocoa

2008-09-24 Thread Christian Giordano
Thanks Mike, I can't use NSImage (guess why) but a subset. Btw, the
problem I have is that I have a view which contains an image. I would
like to draw in the image, not in the container view so I need to
provide to the draw method the image context. Is this a good approach
or all the drawing should happen in the view context? Should I extend
the image view and handle the routing internally?

Thanks, chr


On Wed, Sep 24, 2008 at 11:08 AM, Mike Abdullah
[EMAIL PROTECTED] wrote:

 On 24 Sep 2008, at 10:50, Christian Giordano wrote:

 Hi guys, is there some good tutorial around about how to manipulate
 bitmaps in Cocoa?

 I would be interested on:

 - copy portion of image over another with a mask (this should be
 pretty straight forward with quartz2d)

 [[NSImage alloc] initWithSize:]
 [image lockFocus]
 [sourceImage drawAtPoint:point fromRect:imagePortionRect operation:operation
 fraction:1.0]
 [image unlockFocus]


 - apply threshold
 - apply effects like blur

 Core Image is your friend


 Not sure if some of this, like the blur, is recommended to do from an
 higher level instead of doing it pixel by pixel. In case of the
 latter, how to get the bytearray with all the pixels info?

 Thanks a lot, chr
 ___

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


___

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

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

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

This email sent to [EMAIL PROTECTED]


What does @loader_path refer to when loading ibplugins from a linked-in framework?

2008-09-24 Thread Dalzhim Dalzhim
Greetings,

I have followed the Interface Builder Plug-in Programmation Guide in order
to make my first ibplugin and there is one problem I haven't been able to
solve yet.  It is stated that when opening a nib file, interface builder
looks at every linked-in framework from the associated xcode project and
automatically loads all the ibplugins located in the resources folder of
these frameworks.  And this is the only behaviour which I can't reproduce.

I have already searched a lot in order to make this work and up to now, I am
using @loader_path/../Frameworks as the installation directory for my
framework.  I have added a run script build phase which creates a symbolic
link in the Contents folder of my ibplugin file so that it points to the
location where my Framework resides (6 folders higher in the folder
hierarchy: ../../../../../..) and this way I have been able to load up my
plugin both in my application and through the plugins tab in Interface
Builder's preferences.  Although, if I start Interface Builder without
having the plugin already installed and that I open up a nib from a xcode
project which links with my framework, it fails to load the nib file saying
that the required plug-ins aren't installed.  I have tried running Interface
Builder from the command line in order to see any error messages but nothing
is being printed to the console unlike what happens if I try to manually
install the plug-in.  In fact I used these console errors to figure out how
to create my symbolic link.

Now that I've presented my problem, here is my question.  Is it possible
that @loader_path is different when Interface Builder loads up ibplugins
from linked-in frameworks than when one manually adds a plugin through the
preferences window?  If that is the case, maybe another well placed symbolic
link could finally allow my plugin to work in every use case I can imagine.


thanks



-Dalzhim
___

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

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

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

This email sent to [EMAIL PROTECTED]


NSOperation NSOperationQueue

2008-09-24 Thread Sandro Noel

Greetings.

I need a clarification about the NSOpration ans NSOperationQueue

I read in the documentation that the NSOperation itself is non  
concurrent.
and that i can program it to be, if I override this and that method.  
and configure the runtime env.

I assume that means create my own threads(NSTasks).

But the NSOperationQueue can be set to execute X number of  
NSOperations at the same time.
in fact you have to set a limit to this guy or else he executes all of  
them at the same time.
when execute and look at my logs strings they are all mixed up as if  
everything was running concurrently.


so is this the right assumption:)

If I use NSOperation, override only the main method, I get a non  
concurrent object to run a particular piece of code.
Stack these lovely objects in an operationQueue and set  
setMaxConcurrentOperationCount to 4.
The Queue itself is the one managing the concurrency. and I will have  
4 operations runing at the same time?


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


Re: binding to static text

2008-09-24 Thread Negm-Awad Amin


Am Do,11.09.2008 um 02:38 schrieb James Walker:

I have a static text item whose value is bound to an  
NSUserDefaultsController.  It correctly shows the value stored as a  
default.  However, if I programmatically change the text (with - 
[NSControl setStringValue:]), the new value does not get saved.   
What am I missing?

--
 James W. Walker, Innoventive Software LLC
 http://www.frameforge3d.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/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]



The bound property (stringValue) of the bound object (instance of  
NSControl) is set automatically, when the observed property (dont'  
know) of the observed object (instance of NSUserDefaultsController)  
changes.


Nothing is done in the opposite direction (changing the bound property  
programmatically)


cheers,

Amin Negm-Awad
[EMAIL PROTECTED]




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperation NSOperationQueue

2008-09-24 Thread I. Savant
On Wed, Sep 24, 2008 at 11:56 AM, Sandro Noel [EMAIL PROTECTED] wrote:

 I need a clarification about the NSOpration ans NSOperationQueue
 ...
 If I use NSOperation, override only the main method, I get a non concurrent
 object to run a particular piece of code.
 Stack these lovely objects in an operationQueue and set
 setMaxConcurrentOperationCount to 4.
 The Queue itself is the one managing the concurrency. and I will have 4
 operations runing at the same time?

  I'm not sure exactly what you're asking, but might it have something
to do with the topic covered in the Concurrent Versus Non-Concurrent
Operations section here?

http://developer.apple.com/documentation/Cocoa/Reference/NSOperation_class/Reference/Reference.html

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperation NSOperationQueue

2008-09-24 Thread Shawn Erickson
On Wed, Sep 24, 2008 at 8:56 AM, Sandro Noel [EMAIL PROTECTED] wrote:
 Greetings.

 I need a clarification about the NSOpration ans NSOperationQueue

 I read in the documentation that the NSOperation itself is non concurrent.
 and that i can program it to be, if I override this and that method. and
 configure the runtime env.
 I assume that means create my own threads(NSTasks).

I am not sure if the last sentence above shows some confusion on
thread and task or was just noting either could be used but just in
case...

NSTasks are processes each of which may have one or more threads.
NSThreads are threads each of which has a thread stack, thread context, etc.

A concurrent operation is called from the managing thread of the
operation queue and it is left up to the operation on how it wants to
execute its operation. For example it could do the computation
directly when main is called but that would prevent the operation
queue from moving on to another operation (likely defeats the purpose
of using a queue and run contrary to the intent of returning true to
isConcurrent). Or it could startup a thread or task to do the
operation or fire off an async request, etc (more inline with the
intent of isConcurrent) and return back to the operation queue
(allowing it to move onto the next operation).

A non-concurrent operation is called by a worker thread that the
operation queue manages. This operation will then run in this worker
thread and the operation queue can move onto other operations (since
the operation queue managing thread isn't blocked).

It basically means does the operation manage its own concurrency
(isConcurrent = YES) or does the operation queue need to do it for the
operation (isConcurrent = NO).

 If I use NSOperation, override only the main method, I get a non concurrent
 object to run a particular piece of code.
 Stack these lovely objects in an operationQueue and set
 setMaxConcurrentOperationCount to 4.
 The Queue itself is the one managing the concurrency. and I will have 4
 operations runing at the same time?

Correct assuming your operations don't state dependencies that
prevent concurrency, the system has the ability to execute 4 threads
(enough physical or virtual cores, aka hyper threading) and current
system pressure doesn't prevent reaching max concurrency.

-Shawn
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating alias programatically

2008-09-24 Thread Rainer Brockerhoff
At 18:15 -0500 23/09/08, Ken Thomases wrote:
On Sep 23, 2008, at 5:54 PM, Rainer Brockerhoff wrote:
That's news to me... I really can't recall right now where the alias file 
format was officially documented, but in the Classic days it was quite 
acceptable to create them yourself...

From the legacy Inside Macintosh 
http://developer.apple.com/documentation/mac/Toolbox/Toolbox-459.html:
...
From legacy Technical Note TB535: Finder QAa 
http://developer.apple.com/technotes/tb/tb_535.html:
...
Once again, DTS urges that you not create alias files from within an 
application.

Just because the format was documented doesn't mean that Apple supported the 
creation of alias files by third-party applications.

Thanks for setting me straight on that (also to Charles Srstka).

I dug out my paper copy of Inside Mac VI from last millenium's stratum in my 
office, and indeed it confirms what you say. However, it also says storing 
alias records in files for private use was already generally allowed. Since the 
format of the alias record itself isn't documented, even today, this indicates 
that Apple still can introduce new formats (as they have done since then), but 
on the other hand, for all practical purposes, stored records should work until 
alias records become completely unsupported. In other words, the Finder may 
even change its current implementation of alias files, but the old format 
should still work.

In Mac OS X 10.1.x days and up to now, my XRay utility had commands to create 
alias files in various formats; no problems ever were reported. In the present 
situation, where the legacy resource file format, etc. is for all intents set 
in stone, but many things still depend on it (custom icons, icon badges, alias 
files, and so forth), I would say that, for most purposes, _today_ it's safe to 
create an alias file on HFS volumes, despite those old warnings.

I hasten to add this is my personal, perhaps cynically pragmatic, view. ;-)
-- 
Rainer Brockerhoff  [EMAIL PROTECTED]
Belo Horizonte, Brazil
In the affairs of others even fools are wise
 In their own business even sages err.
Weblog: http://www.brockerhoff.net/bb/viewtopic.php
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSOperation NSOperationQueue

2008-09-24 Thread Sandro Noel

Shawn.

Very clear, thank you 

Sandro.
On 24-Sep-08, at 12:18 PM, Shawn Erickson wrote:

On Wed, Sep 24, 2008 at 8:56 AM, Sandro Noel [EMAIL PROTECTED]  
wrote:

Greetings.

I need a clarification about the NSOpration ans NSOperationQueue

I read in the documentation that the NSOperation itself is non  
concurrent.
and that i can program it to be, if I override this and that  
method. and

configure the runtime env.
I assume that means create my own threads(NSTasks).


I am not sure if the last sentence above shows some confusion on
thread and task or was just noting either could be used but just in
case...

NSTasks are processes each of which may have one or more threads.
NSThreads are threads each of which has a thread stack, thread  
context, etc.


A concurrent operation is called from the managing thread of the
operation queue and it is left up to the operation on how it wants to
execute its operation. For example it could do the computation
directly when main is called but that would prevent the operation
queue from moving on to another operation (likely defeats the purpose
of using a queue and run contrary to the intent of returning true to
isConcurrent). Or it could startup a thread or task to do the
operation or fire off an async request, etc (more inline with the
intent of isConcurrent) and return back to the operation queue
(allowing it to move onto the next operation).

A non-concurrent operation is called by a worker thread that the
operation queue manages. This operation will then run in this worker
thread and the operation queue can move onto other operations (since
the operation queue managing thread isn't blocked).

It basically means does the operation manage its own concurrency
(isConcurrent = YES) or does the operation queue need to do it for the
operation (isConcurrent = NO).

If I use NSOperation, override only the main method, I get a non  
concurrent

object to run a particular piece of code.
Stack these lovely objects in an operationQueue and set
setMaxConcurrentOperationCount to 4.
The Queue itself is the one managing the concurrency. and I will  
have 4

operations runing at the same time?


Correct assuming your operations don't state dependencies that
prevent concurrency, the system has the ability to execute 4 threads
(enough physical or virtual cores, aka hyper threading) and current
system pressure doesn't prevent reaching max concurrency.

-Shawn


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Receiving mouseEnter and mouseExit events.

2008-09-24 Thread Mattias Arrelid
On Tue, Aug 19, 2008 at 23:50, David Alter [EMAIL PROTECTED] wrote:
 I just realized that NSTrackingArea is 10.5 and up. I need to support 10.4.
 mouseEntered and mouseExited have been part of NSResponder from 10.0. To
 receive these events in 10.4 what should I do?

Sorry for the very late reply, but you might still be interested in
MATrackingArea, which can be found at http://mattgemmell.com/source.
It's almost identical in functionality to NSTrackingArea, and supports
10.4+ (which seems to be just be what you need).

Regards
Mattias
___

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

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

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

This email sent to [EMAIL PROTECTED]


Handling User Generated Tablet Events

2008-09-24 Thread Daniele Basile

Hi,
I am develop an application that must manage tablet event. For exactly  
I have a wacom tablet, and I read and study all possible documentation  
that I found.
I am able to manage the tablet event, but I could not disable cursor  
moving from tablet.

In other word I want:
- receive tablet event (proximity, point tablet event)
- disable mouse movement from tablet.

I find this doc :
http://www.wacomeng.com/devsupport/downloads/mac/macosx/EN0056-NxtGenImpGuideX.pdf

that explain how talk with tablet driver and change settings, but I  
have some trouble like:

- I must send and apple event to wacom driver
- I want use cocoa..

Thanks.


--
|  [D]-o Ing. Daniele Basile - [EMAIL PROTECTED]
|   ||}-o  Develer S.r.l., RD dept.
|  [B]-o  http://www.develer.com - http://www.bertos.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 [EMAIL PROTECTED]


Just how accurate is timeIntervalSinceReferenceDate ?

2008-09-24 Thread André Berg

Hi,

NSDate's timeIntervalSinceReferenceDate returns a double value, that has 
changing decimal places up to 10e-23, but we all know that is not possible, 
because that would be even more than attoseconds precision. And the docs 
just speak of sub-milliseconds precision.


So, just how accurate is it?

Can it be used as replacement for counting nanoseconds/per instruction as 
with UpTime() ?


André
___

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

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

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

This email sent to [EMAIL PROTECTED]


unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Jason Bobier

Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?


Thanks,

Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unable to launch about panel for the 2nd time

2008-09-24 Thread I. Savant
On Wed, Sep 24, 2008 at 6:17 AM, Arun [EMAIL PROTECTED] wrote:

 First time i am to see the panel being launched and if i close the panel and
 try yo launch it one more time, the panel is not vsible.

  Your question was answered yesterday ... check the archives or your
spam filter.

--
I.S.
___

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

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

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

This email sent to [EMAIL PROTECTED]


setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
Hi all,

Apple's documentation[1] on -setPrimitiveValue:forKey: is vague in two
ways when using it to manage to-many relationships.

First they state:

If you try to set a to-many relationship to a new NSMutableSet object,
it will (eventually) fail.

Eventually?! What does that even mean? Will it fail later during -
[NSManagedObjectContext save:]? When an managed object is turned into a
fault and then paged back in? When? Can I write a test case to
consistently recreate the failure on-demand?

Second, providing sample code to correctly handle this case, they write:

first get the existing set using primitiveValueForKey: (ensure the
method does not return nil)...

What should I do if/when the method does return nil? assert() it and
fail immediately because that means the entire object graph is corrupted
and saving will lead to data loss? NSAssert() on it as a warning to the
caller but press on (silently doing nothing)?

Right now I'm simply directly assigning my desired NS[Mutable]Set in
that case, like so:

- (void)setChildren:(NSSet*)value_
{
[self willChangeValueForKey:@children];
NSMutableSet *mutableRelationshipSet = [[[self
primitiveValueForKey:@children] mutableCopy] autorelease];
if (mutableRelationshipSet) {
[mutableRelationshipSet setSet:value_];
[self setPrimitiveValue:mutableRelationshipSet forKey:@children];
} else {
[self setPrimitiveValue:value_ forKey:@children];
}
[self didChangeValueForKey:@children];
}

Is that wrong?

Thanks,

[1] http://developer.apple.com/documentation/Cocoa/Reference/
CoreDataFramework/Classes/NSManagedObject_Class/Reference/
NSManagedObject.html#//apple_ref/occ/instm/NSManagedObject/
setPrimitiveValue:forKey:
--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Nick Zitzmann


On Sep 24, 2008, at 1:15 PM, Jason Bobier wrote:


Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?



Don't run it until the distant future; that'll cause the call to block  
until some time in 400X, by which time you probably won't be using  
your current Mac anymore. :) Instead, you should run shorter intervals  
(like a second from now), and if you need NSEvents to trigger during  
the time, then you should probably use -[NSApplication  
nextEventMatchingMask:...] instead with dequeueing. That method also  
runs the specified run loop.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Creating alias programatically

2008-09-24 Thread Charles Srstka

On Sep 24, 2008, at 9:19 AM, Michael Ash wrote:


On Wed, Sep 24, 2008 at 1:43 AM, Charles Srstka
[EMAIL PROTECTED] wrote:
  [source appendFormat:@set theAlias to make alias at POSIX file  
\[EMAIL PROTECTED] to

POSIX file \[EMAIL PROTECTED]\n, NSTemporaryDirectory(), originalPath];


Please never do anything like this. This will fail horribly if either
one of these two paths contains certain perfectly legal characters,
such as . It's best to use something like the scripting bridge or
objc-appscript. If you must use AppleScript,  then you should write
the script as a subroutine which takes the paths as parameters, then
invoke it using something like the code on this page:


Agh, you're right, I hadn't thought about that. :-/

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


Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Jason Bobier
Thanks Nick. I'm trying to avoid polling tho (since that is the whole  
point of runloops and mach ports).


Jason

On Sep 24, 2008, at 3:38 PM, Nick Zitzmann wrote:



On Sep 24, 2008, at 1:15 PM, Jason Bobier wrote:


Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?



Don't run it until the distant future; that'll cause the call to  
block until some time in 400X, by which time you probably won't be  
using your current Mac anymore. :) Instead, you should run shorter  
intervals (like a second from now), and if you need NSEvents to  
trigger during the time, then you should probably use - 
[NSApplication nextEventMatchingMask:...] instead with dequeueing.  
That method also runs the specified run loop.


Nick Zitzmann
http://www.chronosnet.com/



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Dave Dribin

On Sep 24, 2008, at 3:35 PM, Jason Bobier wrote:
Thanks Nick. I'm trying to avoid polling tho (since that is the  
whole point of runloops and mach ports).


Take a look a message I posted a few days ago that uses a Mach port to  
wake up the run loop:


  http://lists.apple.com/archives/Cocoa-dev/2008/Sep/msg01155.html

I never got any replies, but it's working well for me.  What you'd do  
is install a DDRunLoopPoker and then call -pokeRunLoop in your timer  
callback.  That'll force

runMode:beforeDate: to return.

-Dave

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Unable to launch about panel for the 2nd time

2008-09-24 Thread Jason Coco


On Sep 24, 2008, at 15:16 , I. Savant wrote:


On Wed, Sep 24, 2008 at 6:17 AM, Arun [EMAIL PROTECTED] wrote:

First time i am to see the panel being launched and if i close the  
panel and

try yo launch it one more time, the panel is not vsible.


 Your question was answered yesterday ... check the archives or your
spam filter.


Yeah, how rude :)

J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Jason Coco


On Sep 24, 2008, at 15:15 , Jason Bobier wrote:


Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?


The run loop only returns from this call when one of the following  
happens: 1) it has no input sources or timers left; 2) the
beforeDate: date expires; or 3) an input source has been triggered and  
processed.


Timers don't count as input sources, they are handled at a different  
part of the event loop. Also, even if you haven't added
any timers or input sources to the run loop, many of the high-level  
frameworks (like AppKit) do, so you can't be sure that

the call will return just because you haven't put anything.

Your options, then, are to use a shorter date, as was suggested, or to  
have an actual input source that gets triggered (the Mach Port Poke),  
also

suggested already. I just wanted to let you know why this happens :)

HTH, J

smime.p7s
Description: S/MIME cryptographic signature
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris

On Sep 24, 2008, at 12:34, Sean McBride wrote:


First they state:

If you try to set a to-many relationship to a new NSMutableSet  
object,

it will (eventually) fail.

Eventually?! What does that even mean? Will it fail later during -
[NSManagedObjectContext save:]? When an managed object is turned  
into a

fault and then paged back in? When? Can I write a test case to
consistently recreate the failure on-demand?


Why would you do that? The documentation says you must NOT call  
setPrimitiveValue with an arbitrary set, if the property is a to-many  
relationship.


Second, providing sample code to correctly handle this case, they  
write:


The sample code isn't handling this case. It's showing you how to  
avoid this case (how to create a set that you can validly use with  
setPrimitiveValue).



first get the existing set using primitiveValueForKey: (ensure the
method does not return nil)...

What should I do if/when the method does return nil? assert() it and
fail immediately because that means the entire object graph is  
corrupted
and saving will lead to data loss? NSAssert() on it as a warning to  
the

caller but press on (silently doing nothing)?


primitiveValueForKey might fail and return nil; mutableCopy might fail  
and return nil; your method might do other things that can fail. Since  
there's no error return, there's not a lot you can do. Either log an  
error and exit early, or throw an exception.



Right now I'm simply directly assigning my desired NS[Mutable]Set in
that case, like so:

- (void)setChildren:(NSSet*)value_
{
   [self willChangeValueForKey:@children];
   NSMutableSet *mutableRelationshipSet = [[[self
primitiveValueForKey:@children] mutableCopy] autorelease];
   if (mutableRelationshipSet) {
   [mutableRelationshipSet setSet:value_];
   [self setPrimitiveValue:mutableRelationshipSet  
forKey:@children];

   } else {
   [self setPrimitiveValue:value_ forKey:@children];
   }
   [self didChangeValueForKey:@children];
}

Is that wrong?


I think so. Your else statement does what the documentation tells  
you not to do.


IAC, it's not clear why you need to use setPrimitiveValue: at all. Why  
not something like:


- (void)setChildren:(NSSet*)value_
{
[[self mutableSetValueForKey:@children] removeAllObjects];
[[self mutableSetValueForKey:@children] unionSet: value_];
}

or:

@dynamic addChildren;
@dynamic removeChildren;
- (void)setChildren:(NSSet*)value_
{
[self removeChildren: [NSSet setWithSet: self.children]];
[self addChildren: value_];
}

both of which have the advantage of maintaining the inverse  
relationship properly, which your original (according to the  
documentation) does not.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: unable to break out of runloop because timers are fired and then the loop waits

2008-09-24 Thread Muraviev Dmitry

This works fine:


NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
mTimer = [[NSTimer alloc] initWithFireDate: ... interval: ...  
target:self selector:@selector(...:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSModalPanelRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSEventTrackingRunLoopMode];
while (...) [[NSRunLoop currentRunLoop] runUntilDate:[NSDate  
dateWithTimeIntervalSinceNow:1.]];

[pool release];




On 24.09.2008, at 23:15, Jason Bobier wrote:


Hey folks, I have a runloop on a thread that looks like this:

while (! _cancelled) {
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];

	[runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
distantFuture]];

[pool release];
}

And I put a timer in the loop that sets _cancelled to true, the  
runloop never stops. What's the proper way to do this?


Thanks,

Jason
___

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

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

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

This email sent to [EMAIL PROTECTED]


___

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

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

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

This email sent to [EMAIL PROTECTED]


Merging 3 JPG images into one panoramic image

2008-09-24 Thread Paul Brown
I'm extremely new to Cocoa - I'm going through Aaron Hillegass's book now,
actually, so I thought I would come here to ask for some hints.

I have thousands of worship background images that are single 1024x768 JPG
images and they come in sets of 3 to form triptychs when placed side by
side. I am submitting these images to sell through a stock photography
distributor, and we want to distribute them as 3072x768 single images.
Instead of merging the 3 images into 1 using photoshop (I did this already
with 133 triptychs and it was a pain), I figured I could take advantage of
Cocoa and the CoreImage technology.

So my question is this: How easy would this task be for a total n00b at
Cocoa and Objective-C programming? If y'all think it is a simple task, could
someone provide me with perhaps some high-level guidance to get me started
in the right direction? Also, would this potentially noticeably damage my
images due to JPG artifacts?

Thanks!
Paul Brown
___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: unable to break out of runloop because timers are fired andthen the loop waits

2008-09-24 Thread jason . coco
He said in another message that he didn't want to poll... In that case the only 
option is to ensure an input source fires or to use a CFRunLoop instead.

Sent via BlackBerry from T-Mobile

-Original Message-
From: Muraviev Dmitry [EMAIL PROTECTED]

Date: Wed, 24 Sep 2008 23:30:45 
To: Jason Bobier[EMAIL PROTECTED]
Cc: Cocoa Developerscocoa-dev@lists.apple.com
Subject: Re: unable to break out of runloop because timers are fired and
then the loop waits


This works fine:


NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init];
mTimer = [[NSTimer alloc] initWithFireDate: ... interval: ...  
target:self selector:@selector(...:) userInfo:nil repeats:YES];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSDefaultRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSModalPanelRunLoopMode];
[[NSRunLoop currentRunLoop] addTimer:mAudioIdleTimer  
forMode:NSEventTrackingRunLoopMode];
while (...) [[NSRunLoop currentRunLoop] runUntilDate:[NSDate  
dateWithTimeIntervalSinceNow:1.]];
[pool release];




On 24.09.2008, at 23:15, Jason Bobier wrote:

 Hey folks, I have a runloop on a thread that looks like this:

 while (! _cancelled) {
   NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
   
   [runloop runMode:NSDefaultRunLoopMode beforeDate:[NSDate  
 distantFuture]];
   [pool release];
 }

 And I put a timer in the loop that sets _cancelled to true, the  
 runloop never stops. What's the proper way to do this?

 Thanks,

 Jason
 ___

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

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

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

 This email sent to [EMAIL PROTECTED]

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/jason.coco%40gmail.com

This email sent to [EMAIL PROTECTED]
___

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

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

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

This email sent to [EMAIL PROTECTED]

Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
On 9/24/08 3:56 PM, Quincey Morris said:

 Is that wrong?

I think so. Your else statement does what the documentation tells
you not to do.

Indeed.

IAC, it's not clear why you need to use setPrimitiveValue: at all.

Thank you for your fresh perspective.  That did not occur to me, no
doubt due to looking at this for too long. :)

Why
not something like:

   - (void)setChildren:(NSSet*)value_
   {
   [[self mutableSetValueForKey:@children] removeAllObjects];
   [[self mutableSetValueForKey:@children] unionSet: value_];
   }

or:

   @dynamic addChildren;
   @dynamic removeChildren;
   - (void)setChildren:(NSSet*)value_
   {
   [self removeChildren: [NSSet setWithSet: self.children]];
   [self addChildren: value_];
   }

both of which have the advantage of maintaining the inverse
relationship properly, which your original (according to the
documentation) does not.

Those look good.  After looking at Custom To-Many Relationship Accessor
Methods yet again, another implementation comes to mind, which fits
nicely with Apple's examples:

- (void)setChildren:(NSSet *)value_
{
  [self willChangeValueForKey:@children
withSetMutation:NSKeyValueSetSetMutation
usingObjects:value_];
  [[self primitiveChildren] setSet:value];
  [self didChangeValueForKey:@children
withSetMutation:NSKeyValueSetSetMutation
usingObjects:value_];
}

The reason I bring this up, is because I noticed that mogenerator 1.10
is generating code that incorrectly uses setPrimitiveValue:forKey: as
originally described.

Thanks Quincey!

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris

On Sep 24, 2008, at 16:34, Sean McBride wrote:


- (void)setChildren:(NSSet *)value_
{
 [self willChangeValueForKey:@children
   withSetMutation:NSKeyValueSetSetMutation
   usingObjects:value_];
 [[self primitiveChildren] setSet:value];
 [self didChangeValueForKey:@children
   withSetMutation:NSKeyValueSetSetMutation
   usingObjects:value_];
}


This is more direct than either of my suggestions. However, my guess  
is that [[self primitiveChildren] setSet:value] does not maintain the  
inverse relationship, if you have one.



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: Merging 3 JPG images into one panoramic image

2008-09-24 Thread Nick Zitzmann


On Sep 24, 2008, at 5:25 PM, Paul Brown wrote:

So my question is this: How easy would this task be for a total n00b  
at

Cocoa and Objective-C programming?


Easy, and you don't need CoreImage for that.


If y'all think it is a simple task, could
someone provide me with perhaps some high-level guidance to get me  
started

in the right direction?


Create a new NSImage with three times the width of each image, lock  
focus on the image, composite each sub-image into the appropriate  
point in the final image, and unlock focus.



Also, would this potentially noticeably damage my
images due to JPG artifacts?



Only if the final image is being saved as a JPEG or in some other  
lossy format.


Nick Zitzmann
http://www.chronosnet.com/

___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Sean McBride
On 9/24/08 5:01 PM, Quincey Morris said:

 - (void)setChildren:(NSSet *)value_
 {
  [self willChangeValueForKey:@children
withSetMutation:NSKeyValueSetSetMutation
usingObjects:value_];
  [[self primitiveChildren] setSet:value];
  [self didChangeValueForKey:@children
withSetMutation:NSKeyValueSetSetMutation
usingObjects:value_];
 }

This is more direct than either of my suggestions. However, my guess
is that [[self primitiveChildren] setSet:value] does not maintain the
inverse relationship, if you have one.

You're suspicion may be correct, but considering how this doc implements
addEmployee: I'm not so sure:

http://developer.apple.com/documentation/Cocoa/Conceptual/CoreData/
Articles/cdAccessorMethods.html#//apple_ref/doc/uid/TP40002154-SW6

Surely their example would not screw up inverse relationships, since
they also recommend one always have inverses...

--

Sean McBride, B. Eng [EMAIL PROTECTED]
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Quincey Morris

On Sep 24, 2008, at 17:30, Sean McBride wrote:


Surely their example would not screw up inverse relationships, since
they also recommend one always have inverses...


I guess [self primitiveChildren] could be some kind of proxy instead  
of a plain set, which might explain it. That would also explain why  
'setPrimitiveChildren: aPlainSet' isn't allowed.


Let us know the answer if you find it during your testing.




___

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

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

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

This email sent to [EMAIL PROTECTED]


re: setPrimitiveValue:forKey: and to-many relationships

2008-09-24 Thread Ben Trumbull

Sean, Jon,

The documentation is correct for 10.4.  On 10.5, things are more  
forgiving, and you can call -setPrimitiveValue:forKey: with a public  
set.  We won't use that object, but we will use its contents.  It does  
no inverse maintenance, so unless it's part of the public setter for  
the relationship, it's a pretty awful idea.


If you try to set a to-many relationship to a new NSMutableSet  
object,

it will (eventually) fail.

Eventually?! What does that even mean? Will it fail later during -
[NSManagedObjectContext save:]? When an managed object is turned  
into a

fault and then paged back in? When? Can I write a test case to
consistently recreate the failure on-demand?



The to-many relationship object is itself a private subclass of NSSet,  
so eventually will occur when someone gets back the improperly  
assigned set, and tries to use it.  With -mutableSetValueForKey: or  
any number of other operations.  eventually == implementation  
dependent behavior == answer is still no I suppose you could write a  
test case on Tiger that failed on-demand.


On Leopard, it's important to realize that you won't get back the  
object you assigned if you try to do this.  In general, the Xcode  
template generation in the Design menu is the recommended form.


Second, providing sample code to correctly handle this case, they  
write:


first get the existing set using primitiveValueForKey: (ensure the
method does not return nil)...

What should I do if/when the method does return nil? assert() it and
fail immediately because that means the entire object graph is  
corrupted
and saving will lead to data loss? NSAssert() on it as a warning to  
the

caller but press on (silently doing nothing)?



It should never return nil, unless you do something very wrong, like  
try to set values in the faulting callbacks (will or  
didTurnIntoFault).  Within the scope of turning the object into a  
fault, you should send such messages to nil (e.g. /dev/null )



Right now I'm simply directly assigning my desired NS[Mutable]Set in
that case, like so:

- (void)setChildren:(NSSet*)value_
{
   [self willChangeValueForKey:@children];
   NSMutableSet *mutableRelationshipSet = [[[self
primitiveValueForKey:@children] mutableCopy] autorelease];
   if (mutableRelationshipSet) {
   [mutableRelationshipSet setSet:value_];
   [self setPrimitiveValue:mutableRelationshipSet  
forKey:@children];

   } else {
   [self setPrimitiveValue:value_ forKey:@children];
   }
   [self didChangeValueForKey:@children];
}

Is that wrong?


The recommended form of implementing a custom accessor with a Core  
Data property can be created in Xcode using the Design menu - Data  
Model - Copy ObjC 2.0 Method Implementation when you have that  
property(ies) selected in the model view.


You are strongly encouraged to use the built in accessor methods, and  
the templates provided as much as possible.  For example, this setter  
will cause a lot of KVO notifications to get generated.  It is very  
inefficient compared to -addChildren, -removeChildren, and - 
addChildrenObject, and -removeChildrenObject.  Examining the template  
generation for those methods should give you an idea why.


In this case, you're not doing anything custom at all, and should just  
use Core Data's default -setChildren method, which you will get with a  
dynamic property declaration.  Actually, you get it anyway, the  
property declaration just tells the compiler not to warn.


Quincey's suggestions are apt.

As repeated in the Core Data documentation, the primitive accessor  
methods are intended exclusively as building blocks for the creation  
of custom public accessors, and should not be used for other  
purposes.  The relationship maintenance (inverses) may be maintained  
via KVO, so directly using the primitive setter on a relationship  
without issuing the correct KVO notifications is dangerous and wrong.


- Ben



___

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

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

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

This email sent to [EMAIL PROTECTED]


NSDate/Tokens for Calendar Format String Question

2008-09-24 Thread Eric Lee
I have a problem. Basically, I want to take the time, and set the text  
field to that time, only the time with 12 Hours. How do you do 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 [EMAIL PROTECTED]


Re: NSDate/Tokens for Calendar Format String Question

2008-09-24 Thread Sean McBride
Eric Lee ([EMAIL PROTECTED]) on 2008-9-24 10:21 PM said:

I have a problem. Basically, I want to take the time, and set the text
field to that time, only the time with 12 Hours. How do you do this?

Have you read about NSDateFormatter?



___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: NSDate/Tokens for Calendar Format String Question

2008-09-24 Thread Eric Lee

Wow...never saw that...can't believe it

Thanks! I'll look into it
On Sep 24, 2008, at 10:13 PM, Sean McBride wrote:


Eric Lee ([EMAIL PROTECTED]) on 2008-9-24 10:21 PM said:

I have a problem. Basically, I want to take the time, and set the  
text

field to that time, only the time with 12 Hours. How do you do this?


Have you read about NSDateFormatter?




___

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

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

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

This email sent to [EMAIL PROTECTED]


Re: What does @loader_path refer to when loading ibplugins from a linked-in framework?

2008-09-24 Thread Michael Ash
On Wed, Sep 24, 2008 at 11:15 AM, Dalzhim Dalzhim
[EMAIL PROTECTED] wrote:
 Greetings,

 I have followed the Interface Builder Plug-in Programmation Guide in order
 to make my first ibplugin and there is one problem I haven't been able to
 solve yet.  It is stated that when opening a nib file, interface builder
 looks at every linked-in framework from the associated xcode project and
 automatically loads all the ibplugins located in the resources folder of
 these frameworks.  And this is the only behaviour which I can't reproduce.

 I have already searched a lot in order to make this work and up to now, I am
 using @loader_path/../Frameworks as the installation directory for my
 framework.  I have added a run script build phase which creates a symbolic
 link in the Contents folder of my ibplugin file so that it points to the
 location where my Framework resides (6 folders higher in the folder
 hierarchy: ../../../../../..) and this way I have been able to load up my
 plugin both in my application and through the plugins tab in Interface
 Builder's preferences.  Although, if I start Interface Builder without
 having the plugin already installed and that I open up a nib from a xcode
 project which links with my framework, it fails to load the nib file saying
 that the required plug-ins aren't installed.  I have tried running Interface
 Builder from the command line in order to see any error messages but nothing
 is being printed to the console unlike what happens if I try to manually
 install the plug-in.  In fact I used these console errors to figure out how
 to create my symbolic link.

 Now that I've presented my problem, here is my question.  Is it possible
 that @loader_path is different when Interface Builder loads up ibplugins
 from linked-in frameworks than when one manually adds a plugin through the
 preferences window?  If that is the case, maybe another well placed symbolic
 link could finally allow my plugin to work in every use case I can imagine.

I would have thought that @loader_path would be the same thing each
time, namely the path of the plugin binary (minus the last path
component, of course).

I'm not sure exactly what your problem might be, but if you type 'man
dyld' you'll find a bunch of debugging environment variables you can
set which might help you track it down.

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