Re: backporting nibs question / Rhapsody license anyone?

2008-08-06 Thread Jean-Daniel Dupas


Le 6 août 08 à 09:50, Bill Bumgarner a écrit :


On Aug 6, 2008, at 12:19 AM, Ralf Edmund Stranzenbach wrote:
because i'm currently facing a comparable situation - i'd like to  
migrate old NeXT style mails and mailboxes and also some old  
NeXTstep based applications for my personal use - i'm really  
interested in any possible solutions.


You'll also likely want to use the TOPS scripts to migrate from  
NeXTSTEP 3.3 and prior APIs to the modern APIS.  In particular, it  
isn't hard to create a TOPS script to migrate between Display  
PostScript and NSBezier*.   That was the bulk of the migration  
required beyond the default set of NX* - NS* migration (pre- 
Foundation to post-Foundation).  Though, there are a number of  
functional APIs that could also be migrated.


I still have access to some of the early Rhapsody CDs, but i lack  
Mac OS releases prior to 10.4.9 (switched lately to Mac). Is there  
any document describing which releases can be obtained from Apple  
and wich of them are really required for such a migration?


Small Dog and various other resellers typically have older versions  
of Mac OS X (and Macintosh hardware) available at reasonable  
prices.  I would check with said source.


Is there any chance to install those releases on a Parallels or  
VMware virtual machine ?


Mac OS X, itself, has never supported a VM style installation, as  
far as I know.  Thus, you might be out of luck on that front.


b.bum


Especially if you considere that all Mac OS X versions prior to 10.4.x  
are PPC only.



___

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

Please do not post admin requests or moderator comments to the list.
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: autorelease CGImageRef?

2008-08-06 Thread Jean-Daniel Dupas
Be carefull when you mix CFType memory management, and obj-c memory  
management.
It works well when you do not use GC, but may become problematic if  
you do not take special care with GC code.


If I'm not wrong, it should be something like this:

[NSMakeCollectable(aCGImageRef) autorelease];


Le 6 août 08 à 12:16, Mike Abdullah a écrit :


Since CGImage is derived from CFType you can just do:

[(id)aCGImageRef autorelease]

The reason being that CFType knows how to handle a -release message,  
and autorelease is just a way of deferring that message.


On 6 Aug 2008, at 09:29, Peter N Lewis wrote:


Given a CGImageRef, how can I autorelease it?

Perhaps this is obvious, or perhaps its impossible, but googling  
hasn't found me the answer yet except for a tantalizing comment in  
the docs for NSBitmapImageRep:


- (CGImageRef)CGImage (added in 10.5)
Returns an autoreleased CGImage object (an opaque type) from the  
receiver's current bitmap data.


For CFStringRef, I know I can cast it to an NSString* and then  
autorelease it, but is there an equivalent for CGImageRef?


Thanks,
 Peter.

--
Keyboard Maestro 3 Now Available!
  Now With Status Menu triggers!

Keyboard Maestro http://www.keyboardmaestro.com/ Macros for your  
Mac
http://www.stairways.com/   http:// 
download.stairways.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/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/devlists%40shadowlab.org

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: autorelease CGImageRef?

2008-08-08 Thread Jean-Daniel Dupas


Le 8 août 08 à 16:17, Thomas Engelmeier a écrit :



Am 07.08.2008 um 17:24 schrieb Chris Hanson:

This appears correct, except for the fact that, for reasons known  
only to Apple, although CFMakeCollectable is available in 10.4,  
the trivial NSMakeCollectable macro is available only in 10.5.


If you build with the Mac OS X 10.5 SDK, you should be able to use  
NSMakeCollectable since it's declared as an inline function.


The earliest release of Mac OS X you're targeting is a function of  
the Mac OS X Deployment Target build setting, not the SDK.



In theory:
- The Xcode 2.4  10.4 SDK allows deployment on ANY 10.4 version,
- The Xcode 2.5 / 3.x  SDKs for  10.4 and 10.5 SDKs allow deployment  
on recently updated 10.4 versions:


 http://www.tom-e.org/2008/04/pimp-my-xcode-sdk/



Only as long as you set the deployment target to 10.4 of course.
An application compiled using 10.5 SDK and deployment target sets to  
10.5 will not run on 10.4.



___

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

Please do not post admin requests or moderator comments to the list.
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: CGImageSourceCreateFromURL failed with error -11

2008-08-08 Thread Jean-Daniel Dupas


Le 8 août 08 à 20:56, Ken Ferry a écrit :


Hi James, Nicholas,

I still bet it's someone holding too many file descriptors open.

Nicholas, when you said this, but I have forced the thumbnail
creation to have at most 10 files opened at the same time, what did
you mean?   You can see what files your process has open using the
lsof command line tool.  Use that to check what files you have open.

lsof -p pid

If you find that the problem is files staying open longer than you
want, you may be able to work around the issue by bringing the data
into the process with a method like +[NSData dataWithContentsOfURL:]
(I don't see a CF equivalent, but I may be going blind)


It's just hidden in the Core Foundation References:

CFURLCreateDataAndPropertiesFromResource() from Core Foundation URL  
Access Utilities Reference


http://developer.apple.com/documentation/CoreFoundation/Reference/CFURLAccessUtils/Reference/reference.html


___

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

Please do not post admin requests or moderator comments to the list.
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 tell whether an executable supports GC?

2008-08-09 Thread Jean-Daniel Dupas
You can also create your own helper tool compiled with GC support and,  
that just preflight the bundle you pass as argument and return the  
result.

It's a little more works, but it's cleaner too.


Le 9 août 08 à 03:32, André Pang a écrit :


On 08/08/2008, at 3:18 PM, Chris Suter wrote:


You want to look at the __image_info section in the __OBJC segment:

struct objc_image_info  {
uint32_tversion;// initially 0
uint32_tflags;
};

#define OBJC_IMAGE_SUPPORTS_GC   2
#define OBJC_IMAGE_GC_ONLY   4


Thanks for the heads-up Chris!  Thanks to your tip, I settled for a  
rather cheap solution that works just fine for me:


/usr/bin/otool -o $PATH | grep -q -2 '__OBJC.__image_info' | grep GC

:)

I'm not 100% sure that otool's installed without the BSD subsystem  
being available, but I think that's mandatory now with Leopard.  The  
GC check is just used for displaying some extra informative text in  
a sheet (which plugins aren't GC supported), so if anything fails,  
it's not a disaster.  I figured it'd be easier than trying to find  
some libraries to read in the Mach-O format... considering the  
tininess of the problem, it was far too much effort!



--
% Andre Pang : trust.in.love.to.save  http://www.algorithm.com.au/



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Using @selector()

2008-08-09 Thread Jean-Daniel Dupas


Le 9 août 08 à 10:34, Christian Giordano a écrit :


Hi guys, I'm a newbie and I'm reading a book which shows the two
different option to link programmatically a control to an action:

SEL mySelector;
mySelector = @selector(methodName:);
[myButton setAction:mySelector];

OR

SEL mySelector;
mySelector = NSSelectorFromString(@methodName:);
[myButton setTarget:someObjectWithTheMethod];
[myButton setAction:mySelector];

On my test, the first syntax doesn't seem to work. This is my  
implementation.


- (void)awakeFromNib
{
NSLog(@awakeFromNib);
   SEL mySelector;
mySelector = @selector(sayIt:); 
[sayItButton setAction:mySelector];
}

If I do the other syntax:

- (void)awakeFromNib
{
NSLog(@awakeFromNib);
   SEL mySelector;
mySelector = NSSelectorFromString(@sayIt:);
[sayItButton setTarget:self];
[sayItButton setAction:mySelector];
}

Works. The sayIt method is in the same class than the awakeFromNib of
course. Any ideas?



Why you do not set the target in the first method ?


___

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

Please do not post admin requests or moderator comments to the list.
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: I don't understand why this is leaking...

2008-08-10 Thread Jean-Daniel Dupas


Le 10 août 08 à 00:48, Cate Tony a écrit :


This code is leaking:

- (void)saveItemExtensions:(id)sender
{
   NSMutableString* itemExtensionsFilePath = [NSMutableString  
stringWithString:@~/Library/Preferences/MyApp/extensions.abc];
   NSDictionary* extensions = [NSDictionary dictionaryWithDictionary: 
[itemDataSource itemExtensions]];


   [itemExtensionsFilePath setString:[itemExtensionsFilePath  
stringByExpandingTildeInPath]];
   [[NSArchiver archivedDataWithRootObject:extensions]  
itemExtensionsFilePath atomically: YES];

}

- (void)encodeWithCoder:(NSCoder *)coder
{
   [coder encodeObject: string1];
   [coder encodeObject: string2];
   [coder encodeObject: string3];
   [coder encodeObject: string4];
   [coder encodeObject: string5];
   [coder encodeObject: string6];
   [coder encodeObject: string7];
   [coder encodeObject: string8];
}
According to MallocDebug, the leak is in the encodeWithCoder method.


MallocDebug is not the best tool to debug Obj-C memory eaks. You  
should use ObjectAlloc instead (an Instrument probe).


___

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

Please do not post admin requests or moderator comments to the list.
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: Non-NSObject object and garbage collection

2008-08-11 Thread Jean-Daniel Dupas


Le 11 août 08 à 14:25, Antonio Nunes a écrit :


On 11 Aug 2008, at 13:14, Antonio Nunes wrote:


Will it cause a memory leak if I treat the Quartz object in the same
way as I do to all my NSObject descendants, i.e. no retains and rely
only on garbage collection?


You either take care of the object's life time manually as you  
would in a non-garbage collected environment, or you explicitly  
move it into the realm of the garbage collector. Lookup  
CFMakeCollectable and NSMakeCollectable in the docs.


I should add: read the Memory Management Semantics in Using Core  
Foundation with Garbage Collection in the Garbage Collection  
Programming Guide, which has a thorough explanation of how to  
handle CF objects under GC.


António


And note also that CoreGraphics objects (CGXxxxRef) are CFTypeRef  
(Core Foundation based objects).




___

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

Please do not post admin requests or moderator comments to the list.
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 check the capital letter?

2008-08-11 Thread Jean-Daniel Dupas


Le 11 août 08 à 15:29, Ron Fleckner a écrit :



On 11/08/2008, at 10:52 PM, Macarov Anatoli wrote:


HI!
Cocoa, Obj-C.
How to check the capital letter?


Hi, I don't remember if there is a Cocoa solution, but of course you  
can use plain C:


NSString *str = @Aa;
char first = [str characterAtIndex:0];
char second = [str characterAtIndex:1];
	NSLog(@%c is [EMAIL PROTECTED], first, isupper(first) ? @uppercase :  
@lowercase);
	NSLog(@%c is [EMAIL PROTECTED], second, isupper(second) ? @uppercase :  
@lowercase);


Result:

A is uppercase.
a is lowercase.


Wrong. characterAtIndex: return an unichar not a char, which is AFAK  
an UTF16 character.




___

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

Please do not post admin requests or moderator comments to the list.
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: Use of AppKit in command-line app on headless node

2008-08-11 Thread Jean-Daniel Dupas


Le 11 août 08 à 22:26, Ken Ferry a écrit :


Hi Rick,

I think you might be misreading that technote.. what it says is that
trying to guess which methods are and are not safe doesn't work,
because a method that does not happen to require the windowserver in
one release may require it in another.  The section you're quoting is
about what to do if you're going to ignore that fact.  It's better not
to ignore it.


That may be even worse. For example, the last time I tried, NSImage  
can be successfully created with most files format, but failed with  
icns files.

So even in one release, some API may not work reliably.


___

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

Please do not post admin requests or moderator comments to the list.
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: Accessing memory of another application?

2008-08-12 Thread Jean-Daniel Dupas


In practice, it's perfectly possible to access other processes memory  
using public functions (it require some privileges since 10.4 intel).
But to do it you have to use the low-level mach API and that's off  
topic here.


And no, code injection is not used only by virus. (see http://rentzsch.com/mach_star/ 
 )



Le 12 août 08 à 19:18, Negm-Awad Amin a écrit :



Am Di,12.08.2008 um 19:01 schrieb Mike Abdullah:


You can't do this. Each application runs in its own protected memory.

Sometimes you can do this:
http://en.wikipedia.org/wiki/Computer_virus
;-)

Serious: There are techniques to get acccess to another application  
memory under some circumstances. None of them is related to Cocoa  
since there is no class named NSVirus.


Amin





On 12 Aug 2008, at 17:04, Josh wrote:


All,

I'm trying to get started w/viewing/editing/interacting with the  
memory of
another running application but I'm not where to get started.  You  
could
think of this as being a simple game trainer - which basically  
allows you

to view and edit values in memory.

Can anyone point me to where I should get started?  Function names/ 
examples
would be a GREAT help - I haven't had experience with hooking into  
another

application's memory.

Thanks
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/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/negm-awad%40cocoading.de

This email sent to [EMAIL PROTECTED]


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/devlists%40shadowlab.org

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: Generate back trace programmatically?

2008-08-12 Thread Jean-Daniel Dupas


Le 13 août 08 à 01:34, Nick Zitzmann a écrit :



On Aug 12, 2008, at 5:28 PM, Joseph Kelly wrote:

is there a known reliable way to generate a back trace from the  
current point in a given thread's call stack?



Yes. (Hint: See the NSException documentation in Leopard, and the  
ExceptionHandling framework in Tiger and earlier.)


Nick Zitzmann



See also man backtrace (require 10.5).



___

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

Please do not post admin requests or moderator comments to the list.
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: Accessing memory of another application?

2008-08-13 Thread Jean-Daniel Dupas


Le 13 août 08 à 15:27, Kyle Sluder a écrit :

On Tue, Aug 12, 2008 at 10:14 PM, Steve Byan [EMAIL PROTECTED]  
wrote:
Actually, the man-page is incomplete and doesn't tell you how to  
read and

write another process's memory.


The manpage also fails to mention the undocumented PT_DENY_ATTACH flag
that applications can pass to force ptrace to fail to attach.  Pro
Tools, for example, does this because the programmers who wrote it
spent twice as much time on the copy protection as on the actual
application.


man ptrace:

PTRACE(2)   BSD System Calls Manual   
PTRACE(2)


NAME
 ptrace -- process tracing and debugging

...

PT_DENY_ATTACH
   This request is the other operation used by the  
traced process; it allows a process that is not currently being traced  
to deny future traces by
   its parent.  All other arguments are ignored.  If  
the process is currently being traced, it will exit with the exit  
status of ENOTSUP; other-
   wise, it sets a flag that denies future traces.   
An attempt by the parent to trace a process which has set this flag  
will result in a segmenta-

   tion violation in the parent.


___

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

Please do not post admin requests or moderator comments to the list.
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: @try @catch

2008-08-14 Thread Jean-Daniel Dupas


Le 14 août 08 à 13:53, Devon Ferns a écrit :



On 14-Aug-08, at 7:21 AM, Graham Cox wrote:



On 14 Aug 2008, at 8:58 pm, Georg Seifert wrote:

is it recommended to use @try .. @catch blocks as flow control  
like it is used in Python. They say explicitly to use it rather  
than do a lot of test before just try if it works to look after it  
only if it fails.



Hmmm, I'll be looking forward to the replies to this question!

My view is absolutely NOT to use try/catch for flow control. They  
were invented to handle exceptional conditions, and that's what  
they should be used for. They are not a substitute for proper  
conditional clauses and properly structured code. I believe the  
Python advice (which I take at face value, not being familiar with  
Python) is misguided at best, though may suit that language better.  
Also, my understanding is that while a try block is very cheap, the  
catch block is not. Since they are only expected to be run once in  
a blue moon, that's reasonable, but if they are used routinely,  
performance is likely to suffer.


cheers, Graham



Many(probably all now) desktop CPUs are optimized for branch  
prediction which would make if blocks more efficient.  You can't  
always say the same about embedded processors though.
My guess is you probably wouldn't notice much difference on a  
desktop between the two without using some profiling to see the  
actual speed difference.  It'd likely be in the range of hundreds of  
milliseconds.


I think it's still a horrible way of flow control.  I think for some  
reason Python must be more optimized for that method of flow control  
but since Objective-C is based on C, it's more likely that the basic  
if/else if will be more efficient.  Message dispatch is not really  
that much overhead.


I believe @try, @catch is faster than it used to be though.


@try / @catch, is still slow on 32 bits runtime and was optimize for  
the 64 bits runtime to reduce the cost of @try, but it increase the  
cost of @catch.
And as each exception have to create an NSException under the hood,  
and to generate and record a stack trace for each exception, I'm not  
sure it's efficient even on 64 bits runtime.


I agree with precedents answers which said you should avoid exceptions  
as much as possible, and using them for control flow is really not a  
good idea.


___

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

Please do not post admin requests or moderator comments to the list.
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: Clearing a Memory Buffer?

2008-08-18 Thread Jean-Daniel Dupas



Le 18 août 08 à 15:19, Dave a écrit :

Hi All,

I'm fairly new to Cocoa and was wondering if there are OS functions  
to Copy and Clear/Fill Memory available?


I've tried searching for obvious names like MemoryZero, ZeroMemory,  
CopyMemory etc. but can't seem to find anything.


Thanks a lot
All the Best
Dave



Just use the libc functions:

memset, bzero, memcpy, and more.

___

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

Please do not post admin requests or moderator comments to the list.
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: Tiger Compatible OpenGL Screenshot Code

2008-08-20 Thread Jean-Daniel Dupas


Le 20 août 08 à 19:54, David Duncan a écrit :


On Aug 20, 2008, at 10:39 AM, Eric Hoaglin wrote:


http://developer.apple.com/samplecode/OpenGLScreenSnapshot/index.html
(Leopard+)



The basic technique from this sample should work on 10.4 (the  
previous version of this sample did) but it wasn't qualified against  
10.4 for the latest release, so it wasn't stated as capable of being  
able to run on 10.4. I would try linking against the 10.4 SDK and  
seeing what you get.

--
David Duncan
Apple DTS Animation and Printing


It links without problem (I don't have a Tiger machine, so I cannot  
test it). Note that the project's Target SDK is 10.4, so you even  
don't have to change that.



___

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

Please do not post admin requests or moderator comments to the list.
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: Control-Click vs Right-Click in NSTableView

2008-08-20 Thread Jean-Daniel Dupas


Le 21 août 08 à 00:02, Matthew Mashyna a écrit :

I have an NSTableView subclass whose only override method is  
rightMouseDown. I override it so I can have it select the table row  
before validating and presenting the context menu (by then passing  
it up to [super rightMouseDown]).


This works nicely but I have found that it does not work for control  
clicks. For a another view item I overrode mouseDown to check for  
the control key and call [self rightMouseDown] if needed.


For NSTableView I can catch rightMouseDown but I can't seem to catch  
mouseDown. When I control click a row the context men comes up over  
a non-selected item which, ironically enough, gives me an out-of- 
context menu.


How can I get control clicks on my NSTableView ?



Instead of trying to catch mouse events, override -[NSView  
menuForEvent:theEvent]




___

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

Please do not post admin requests or moderator comments to the list.
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: !foo vs foo == nil

2008-08-21 Thread Jean-Daniel Dupas




haha gros malin why free (func) does this test?
arf sorry your trusting scale is going to zero


Not sure what you're trying to say. According to the C standard, given
a variable (foo) the following are identical:

if(foo == 0)
if(foo == nil)
if(foo == NULL)
if(!foo)
if(foo == '0')

and any other way you can compare to a literal zero.


I hope this is a typo but '0' != 0, so the last line is not a valid  
way to test for nullity (but foo == '\0' is).



___

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

Please do not post admin requests or moderator comments to the list.
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: !foo vs foo == nil

2008-08-21 Thread Jean-Daniel Dupas


Le 21 août 08 à 10:06, Clark Cox a écrit :

On Thu, Aug 21, 2008 at 12:21 AM, Thomas Davie [EMAIL PROTECTED]  
wrote:


On 21 Aug 2008, at 09:06, Jules Colding wrote:



On 21/08/2008, at 01.56, John C. Randolph wrote:



On Aug 20, 2008, at 4:15 PM, Torsten Curdt wrote:


There was a common perception that NULL is not really the same  
as nil.

But seems like in the end it really is (void*)0.



They differ in type, not in value.

NULL is (void *) 0.
nil is (id) 0.
Nil is (Class) 0.

Personally, I prefer if (!foo) over if (foo == nil), because  
the
latter has the hazard of a typo that compiles.  You can lose a  
fair bit of

time staring at if (foo = nil) before you spot the mistake.


Which is why you should always write if (nil == foo).


Just to add my 2 cents to this discussion, I think there's  
something which

hasn't been brought up (and I guess isn't often brought up by C
programmers).

One of the two options doesn't make sense here.


It may not make sense to those who aren't used to C (or, more
accurately, are *more* used to another language), but it makes perfect
sense to C programmers (just as [foo method: bar] doesn't make sense
to C programmers, but makes perfect sense to Obj-C programmers).
Different languages have different idioms. C programmers likely tend
not to bring it up, because it is second nature to them.

Because of C's weak type system ! works on almost anything you  
throw at it.
However, it is a *boolean* operator.  Boolean negating a pointer is  
a hack

that by happy coincidence works.


This is not a hack or a coincidence, this is by design. A non-NULL
pointer *is* a boolean expression that evaluates to true, just as a
non-zero integer is. Again, it doesn't work by coincidence, it is a
guarantee of the language standard.

Note, that the same is true in C++, which has a much stronger type
system than C.


Agree with that. And remember that the bool type is a recent addition  
and was not defined in the first C language version.
So it's perfectly valid to use the '!' operator on something that is  
not a boolean.




___

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

Please do not post admin requests or moderator comments to the list.
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: !foo vs foo == nil

2008-08-21 Thread Jean-Daniel Dupas


Le 21 août 08 à 19:06, Scott Ribe a écrit :


Wow, don't check the list for a few days and look what happens!


After all, that's why nil (and Nil) exist at all,
rather than just reusing NULL.


Actually nil exists at all because Objective-C was created *before*  
NULL was
in such standard use! (It may have always been part of stdio.h,  
don't recall
for sure, but there definitely was no stddef.h.) Way back when,  
everybody
defined their own macro, and some libraries even called it NIL or  
nil or

null instead of NULL. (Others simply used 0.)


I finally discovered
that one of the headers in this old cross-platform code had defined
NULL to be 0, just a plain integer 0, rather than (void *)0.


Yes, that is allowed. In fact, Stroustrup suggests that it is  
preferred for
C++, because stricter type checking makes ((void*)0) much less  
useful... GCC
(actually g++) gets around this by providing __null, which is a  
magic token

that gets special treatment from the compiler. If you look at stddef.h
and/or _types.h, you'll see a special case for __GNUG__ (GNU C++) that
defines NULL to be __null.

It is a little known fact that when passing NULL (and by extension  
nil
or Nil) as a parameter to a vararg function, you *must* cast it to  
the

appropriate pointer type to guarantee correct behavior.


2 reasons: 1) integer  pointer sizes may not be the same, this is the
common case, and is cured by defining NULL as ((void*)0) and nil as  
((id)0)
instead of just 0, and is why Apple gets away with this usage, and I  
suspect
the g++ magic __null takes care of this as well; 2) The standard  
actually
allows different types of pointers to have different sizes, which I  
think is
very rare, and certainly not the case on any architectures on which  
Cocoa

does (or ever did) run--or any that I've ever worked with.


Boolean negating a
pointer is a hack that by happy coincidence works.


No it is not; it is an explicitly designed and required feature of the
language.


a.)
(int) NULL  is NOT required or guaranteed  0x0 by the standard.


Yes, it is.


Obviously I overlooked that the standard guarantees the
conversion NULL = int results in 0 and vice versa.


OK, close but not quite. The standard says that NULL is 0, and that  
all
pointer - int conversions take care of mapping the machine's null  
address

to the integer 0, if necessary.



Could you tell me which part of the standard states that NULL is 0. I  
don't managed to find it. The only relevant part I found about NULL is  
the section 7.17.


Common definitions stddef.h :

NULL
which expands to an implementation-defined null pointer constant;



___

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

Please do not post admin requests or moderator comments to the list.
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: Implementing isEqual: and hash

2008-08-23 Thread Jean-Daniel Dupas


Le 23 août 08 à 13:41, Graham Cox a écrit :

I have a class for which equality can be defined as having the same  
internal string value (which happens to be a UUID-turned-string). I  
can easily implement isEqual: based on that but the docs say I also  
need to implement -hash. Any pointers on what is a good way to do  
that? Could I just safely defer to the -hash returned by the string  
in question?




Yes, that the way to do it.

To understand what an hash is and how it is used, I suggest you read  
the hash table article in wikipedia.


http://en.wikipedia.org/wiki/Hash_table

Hash tables are used in Cocoa in NSDictionary, NSSet, NSHashTable,  
NSHashMap and maybe more. When you understand how it works, choosing  
the implementation should be obvious.




___

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

Please do not post admin requests or moderator comments to the list.
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: Implementing isEqual: and hash

2008-08-23 Thread Jean-Daniel Dupas


Le 23 août 08 à 15:39, Graham Cox a écrit :



On 23 Aug 2008, at 9:52 pm, Jean-Daniel Dupas wrote:



Le 23 août 08 à 13:41, Graham Cox a écrit :

I have a class for which equality can be defined as having the  
same internal string value (which happens to be a UUID-turned- 
string). I can easily implement isEqual: based on that but the  
docs say I also need to implement -hash. Any pointers on what is a  
good way to do that? Could I just safely defer to the -hash  
returned by the string in question?




Yes, that the way to do it.

To understand what an hash is and how it is used, I suggest you  
read the hash table article in wikipedia.


http://en.wikipedia.org/wiki/Hash_table

Hash tables are used in Cocoa in NSDictionary, NSSet, NSHashTable,  
NSHashMap and maybe more. When you understand how it works,  
choosing the implementation should be obvious.



Thanks for that. I'm pretty familiar with hash tables in general  
(and in quite a bit of theory too) but I wasn't able to find out  
what Cocoa uses for its hashing function or how good this needed  
to be to work well with the built-in classes. However, by deferring  
to the string I can avoid the issue altogether.


For curiosity's sake, I would be interested to know what sort of  
hashing functions Cocoa does use. I haven't come across the need to  
generate one for any of my custom classes before so it's not  
something I need right now, but every bit of knowledge is worth  
having.


For example, here's a very crude hash function I used in a very  
simple symbol table implementation from a long while ago. I imagine  
most hash functions in Cocoa would be more sophisticated.


unsigned long   ZHashTable::Hash( const char* name )
{
register unsigned long  h = 1;
register char*  p = (char*) name;
register char   c;

while(( c = *p++ ) != 0 )
h *= (unsigned long) c;

return h % kHashTableSize;
}


Look into the CoreFoundation sources. as Cocoa primitive are tool free  
bridged, they use the same hash functions. They is even a special case  
for NSString into the CFString.c file.


http://www.opensource.apple.com/darwinsource/10.5.4/CF-476.14/

You can find Integer and double hash function into ForFoundationOnly.h.
And there is another generic hash function into CFData.c

According to the Leopard release notes, we can guess that thoses  
function have been updated into Leopard:


Order of values in hashing-based collections

The CoreFoundation and Foundation framework-provided implementations  
of hashing-based collections such as dictionaries have changed how  
they store elements, so elements may be retrieved in a different order  
than in previous releases. The order of elements in hashing-based  
collections is undefined and can change at any time, so developers  
must never rely on the order that elements are enumerated, or returned  
from a function like CFDictionaryGetKeysAndValues(). This is true even  
for cases where a developer may be trying to manipulate the hash codes  
of the objects in order to achieve some particular ordering.






___

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

Please do not post admin requests or moderator comments to the list.
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 read pixel values of monochrome images

2008-08-24 Thread Jean-Daniel Dupas


Le 24 août 08 à 05:55, John C. Randolph a écrit :



On Aug 23, 2008, at 2:51 PM, Shawn Erickson wrote:


On Fri, Aug 22, 2008 at 2:54 AM, Eduardo Areitio [EMAIL PROTECTED] wrote:
I'm trying to read individual pixel values in a monochrome image  
using

NSReadPixel, but I haven't  been able to.

I would much appreciate anyone's help


It is usually best to post some code or better explain what you tried
and what is going wrong otherwise we have to guess at the difficulty
you are having.

Anyway...

http://developer.apple.com/samplecode/Color_Sampler/listing5.html


You'll notice from the comments in that sample, that NSReadPixel()  
gets a value from the graphics context that has the current drawing  
focus.  If you're trying to read a value from an image, you've got  
to have somewhere to draw it first.


You can get the image context directly using -[NSImage lockFocus].
No need to draw it before.

___

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

Please do not post admin requests or moderator comments to the list.
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: Reading from Streams - Convenience methods

2008-08-24 Thread Jean-Daniel Dupas


Le 24 août 08 à 09:29, Ananda Bollu a écrit :


Hi,

What is the best way to read and write data to a Stream.

In Java, DataInputStream and DataOutputStream classes provide various
serialization methods such as, readInt(), readLong(), readBoolean()
etc.

Is there anything equivalent for serializing and de-serializing in  
cocoa?


Thank you

Ananda


Sometime, Google can be very helpful to find this kind of information:

For example searching for : serialization cocoa
will returns as first result: Archives and Serializations Programming  
Guide for Cocoa.

http://developer.apple.com/documentation/Cocoa/Conceptual/Archiving/Concepts/serializations.html

This guide will explain you the difference between archiving and  
serialization, and will also explain you how to use thoses two way to  
convert objects into data.
As you don't said what you're trying to do, I cannot advice you about  
which way you have to go.



___

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

Please do not post admin requests or moderator comments to the list.
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: Modal window

2008-08-25 Thread Jean-Daniel Dupas


Le 25 août 08 à 12:04, Marcus a écrit :



25 aug 2008 kl. 11.03 skrev Macarov Anatoli:

When modal window is started up the application stops carrying out  
other processes. How to work out this issue?

Cod:
- (void)showCustomDialog: (NSWindow *)window widi:(NSPanel  
*)windowDialog

{

   if (!windowDialog)
   [NSBundle loadNibNamed: @MyCustomDialog owner: self];
   [NSApp beginSheet: windowDialog
   modalForWindow: window
   modalDelegate: nil
   didEndSelector: nil
   contextInfo: nil];
   [NSApp runModalForWindow: windowDialog];
   // Dialog is up here.
   [NSApp endSheet: windowDialog];
   [windowDialog orderOut: self];

}


The problem is that runModalForWindow: blocks background processing.  
I'm not an expert on modal windows but according to the  
documentation you should be able to use runModalSession: instead. I  
think that you could also try to split showCustomDialog:widi: into  
two methods and set didEndSelector to the second method.


Marcus




 If you handle the modal session yourself, it's easy to let the  
background processes do some processing while the modal window is open:
 Replace -[NSApp runModalForWindow:[self window]] by this and it   
should do the trick.


/* Create a modal session, and in each loop,
we process the default runloop event sources (url download,  
network connections, etc.) */
NSModalSession session = [NSApp beginModalSessionForWindow:[self   
window]]; // 1

for (;;) {
  if ((result = [NSApp runModalSession:session]) !=   
NSRunContinuesResponse) // 2

break; // 3
 [[NSRunLoop currentRunLoop] runMode:NSDefaultRunLoopMode   
beforeDate:[NSDate distantFuture]]; // 4

}
[NSApp endModalSession:session];

This snippet creates a modal session.  (//1)
Then it checks the modal session state and processes UI events if some  
events are ready ([NSApp runModalSession:session]) (//2)

Note that runModalSession: does not block and always returns immediatly.

Break if the user stops the modal session (//3)

After that it blocks until something append (network event, ui event,   
etc). (//4)

Each time a network event occurs, the run loop pass it to the handler.
Each time a UI event occurs, the run loop push it on the UI event   
queue and the next call the runModalSession: process it.

Each time an event occurs, runMode:beforeDate: returns.


___

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

Please do not post admin requests or moderator comments to the list.
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: 64-bit = Objc 2.0????

2008-08-25 Thread Jean-Daniel Dupas


Le 25 août 08 à 15:18, Stéphane Sudre a écrit :

Probably a stupid question but I don't see anything in the objc  
headers or in some old slides corroborating this.


When you build a project for a 64-bit architecture (such as x86_64),  
does this imply the Objective-C version for this architecture is  
going to be 2.0?




Yes, it is. The 64 bits runtime is a whole new runtime wrote for  
Leopard, and it supports all the Obj-C 2 features and bring some other  
improvments that are not possible in the 32 bits runtime without  
breaking binary compatibility with previous version (like obj-c  
exceptions compatible with C++ exceptions in obj-c++).




___

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

Please do not post admin requests or moderator comments to the list.
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: Accessing Audio Samples in Cocoa

2008-08-25 Thread Jean-Daniel Dupas


Le 25 août 08 à 16:02, Joseph Ayers a écrit :

I am interested in doing some signal processing on the audio  
channels of a QuickTime Movie. I can retrieve the
buffer using MovieAudioExtractionFillBuffer, but the available  
examples specify the buffer as type Byte*.  I am
interested in decomposing the buffer into the left and right channel  
data sample arrays. I assume that these are 16 bit

audio samples,


Assumptions are evil. It should be either documented as the default  
value, or you have to force it to this format. Personnaly, I use the  
second choice.


but I have yet to find a method that returns the two separate (left  
and right) arrays or the appropriate

Cocoa data type to use with such sample data.  Any ideas or examples?

Thanks,



AFAK, there is no Cocoa API to do audio processing.

You can have stereo channels by setting the appropriate output  
format and channel layout format on your session:


 MovieAudioExtractionSetProperty(ay_session,  
kQTPropertyClass_MovieAudioExtraction_Audio,
  
kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription,

 sizeof(*aFormat), aFormat);

 MovieAudioExtractionSetProperty(ay_session,  
kQTPropertyClass_MovieAudioExtraction_Audio,
  
kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout,

 bytes, aLayout);

Your format should have two channels:

  AudioStreamBasicDescription inasbd;
  inasbd.mChannelsPerFrame = 2; // stereo
  /* 16 bits linear PCM interleaved */
  inasbd.mBitsPerChannel = 16;
  inasbd.mFormatID = kAudioFormatLinearPCM;
  inasbd.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
#if TARGET_RT_BIG_ENDIAN
  inasbd.mFormatFlags |= kAudioFormatFlagIsBigEndian;
#else
  inasbd.mFormatFlags = ~kAudioFormatFlagIsBigEndian;
#endif

  /* 1 frame = 1 packet when using PCM */
  inasbd.mFramesPerPacket = inasbd.mChannelsPerFrame;
  inasbd.mBytesPerFrame = inasbd.mBytesPerPacket = 2 *  
inasbd.mChannelsPerFrame;
  inasbd.mSampleRate = 44100; // choose whatever you want, or  
retreive the default value from your session.


and your layout format should describe a stereo layout:

AudioChannelLayout layout;
layout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;

Your output buffer will contains interleaved audio data, that is one  
integer for the first channel, one integer for the second channel, one  
for the first, …


Note that you have to set the output format before setting the layout  
format. I think it will failed if you do it otherwise.


___

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

Please do not post admin requests or moderator comments to the list.
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: Accessing Audio Samples in Cocoa

2008-08-25 Thread Jean-Daniel Dupas
That's why you have to set the output format. If you set it to be  
Interleaved 16 bits Integer, it will be UInt16 interleaved.
And if you set the channel layout to kAudioChannelLayoutTag_Stereo, it  
will be as you expect: first left, second right, third left, etc…


You cannot make any asusumption about the output format. You have  
either to retreive it from the session or set it to what you expect.


See http://developer.apple.com/quicktime/audioextraction.html for  
other examples and explanation about extraction session configuration.



Le 25 août 08 à 19:35, Joseph Ayers a écrit :


Hi Jean-Daniel:

My issue is with the structure of the actual buffer and how to  
access the individual audio data samples. For example,
is each data sample a UInt16 and can one count on the first sample  
pointed at by the buffer pointer being the left channel, the
second sample the right channel and the next sample being the  
subsequent left sample.


Thanks,
Joseph

Jean-Daniel Dupas wrote:


Le 25 août 08 à 16:02, Joseph Ayers a écrit :

I am interested in doing some signal processing on the audio  
channels of a QuickTime Movie. I can retrieve the
buffer using MovieAudioExtractionFillBuffer, but the available  
examples specify the buffer as type Byte*.  I am
interested in decomposing the buffer into the left and right  
channel data sample arrays. I assume that these are 16 bit

audio samples,


Assumptions are evil. It should be either documented as the default  
value, or you have to force it to this format. Personnaly, I use  
the second choice.


but I have yet to find a method that returns the two separate  
(left and right) arrays or the appropriate
Cocoa data type to use with such sample data.  Any ideas or  
examples?


Thanks,



AFAK, there is no Cocoa API to do audio processing.

You can have stereo channels by setting the appropriate output  
format and channel layout format on your session:


MovieAudioExtractionSetProperty(ay_session,  
kQTPropertyClass_MovieAudioExtraction_Audio,
 
kQTMovieAudioExtractionAudioPropertyID_AudioStreamBasicDescription,

sizeof(*aFormat), aFormat);

MovieAudioExtractionSetProperty(ay_session,  
kQTPropertyClass_MovieAudioExtraction_Audio,
 
kQTMovieAudioExtractionAudioPropertyID_AudioChannelLayout,

bytes, aLayout);

Your format should have two channels:

 AudioStreamBasicDescription inasbd;
 inasbd.mChannelsPerFrame = 2; // stereo
 /* 16 bits linear PCM interleaved */
 inasbd.mBitsPerChannel = 16;
 inasbd.mFormatID = kAudioFormatLinearPCM;
 inasbd.mFormatFlags = kLinearPCMFormatFlagIsSignedInteger;
#if TARGET_RT_BIG_ENDIAN
 inasbd.mFormatFlags |= kAudioFormatFlagIsBigEndian;
#else
 inasbd.mFormatFlags = ~kAudioFormatFlagIsBigEndian;
#endif

 /* 1 frame = 1 packet when using PCM */
 inasbd.mFramesPerPacket = inasbd.mChannelsPerFrame;
 inasbd.mBytesPerFrame = inasbd.mBytesPerPacket = 2 *  
inasbd.mChannelsPerFrame;
 inasbd.mSampleRate = 44100; // choose whatever you want, or  
retreive the default value from your session.


and your layout format should describe a stereo layout:

   AudioChannelLayout layout;
   layout.mChannelLayoutTag = kAudioChannelLayoutTag_Stereo;

Your output buffer will contains interleaved audio data, that is  
one integer for the first channel, one integer for the second  
channel, one for the first, …


Note that you have to set the output format before setting the  
layout format. I think it will failed if you do it otherwise.





--
Joseph Ayers, Professor
Department of Biology and
Marine Science Center
Northeastern University
East Point, Nahant, MA 01908
Phone (781) 581-7370 x309(office), x335(lab)
Cellular (617) 755-7523, FAX: (781) 581-6076 Boston Office 444RI,  
(617) 373-4044

eMail: [EMAIL PROTECTED]
http://www.neurotechnology.neu.edu/


___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: is LSEnvironment working with Leopard?

2008-08-26 Thread Jean-Daniel Dupas

It' works on Leopard, but only as the documentation states:

“These environment variables are set only for applications launched  
through Launch Services. If you run your executable directly from the  
command line, these environment variables are not set.”


And unfortunately, Xcode does not uses Launch Services to launch  
applications. Try to launch your application from the Finder.




Le 26 août 08 à 10:47, Half Activist a écrit :


Hello everyone,

	The subject sums it up: Is the LSEnvironment plist key still  
supported in Leopard?
	I've been trying to set an environment variable this way with no  
luck.
	I've read about the /var/db/.AllowDYLDEnvironmentVariables trick,  
and thought it might enable LSEnvironment, but didn't work either.
	I know about ~/.MacOSX/environment.plist but didn't want to add a  
global environment variable.


Does anybody know if there are other possibilities?

Regards.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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 Interface

2008-08-28 Thread Jean-Daniel Dupas

Le 28 août 08 à 13:24, Christian Giordano a écrit :


Protocols seems definitely the way to go and seems to work, I'm only
getting some warnings. Basically what I did, I pass the instance
implementing the protocol with this syntax:

- (void) addListener:(id MyProtocol *) listener

and I get invalid receiver type 'id MyProtocol*'

Funny enough after I get another warning. I basically want to add the
listener to a NSMutableArray with this syntax:

[listeners addObject:listener]

and I get passing arguments 1 of 'addObject:' from incompatible  
pointer type.


I am new to Objective-C so I thought in my ignorance, maybe id
MyProtocol defines already a pointer and removing the * doesn't
gives those errors but where I was checking for the conformity with:

`
Removing the * is what you need, but that's not MyProtocol that is  
a pointer, but id.





if ( ! [listener conformsToProtocol:@protocol(MyProtocol)]  ) {

I get '-conformsToProtocol:' not found in protocol(s)

Any idea?



When you use the idprotocol syntaxt, the compiler assume your object  
only implements the method declared in your protocol.
If you want to use some other function, you have to use an object type  
that declare thoses functions, for example in your case, NSObject.


- (void) addListener:(NSObject MyProtocol *) listener

there is a nice article that explains it better here:

http://unixjunkie.blogspot.com/2008/03/id-vs-nsobject-vs-id.html


___

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

Please do not post admin requests or moderator comments to the list.
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: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Jean-Daniel Dupas


Le 28 août 08 à 08:15, Gerriet M. Denkmann a écrit :



//	this shows the application default icon if CFBundleIconFile =  
heiß

//  works ok for CFBundleIconFile = hot

- (IBAction)iconForFileN: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSString *bundlePath = [ mainBundle bundlePath ];
	NSImage *image = [ [ NSWorkspace sharedWorkspace ] iconForFile:  
bundlePath ];

[ imageView setImage: image ];
}


//  this always works, regardless of name:
- (IBAction)ImageNameD: sender;
{
NSBundle *mainBundle = [ NSBundle mainBundle ];
NSDictionary *infoDictionary = [ mainBundle infoDictionary ];
	NSString *iconFile = [ infoDictionary objectForKey:  
@CFBundleIconFile ];	

NSImage *image = [ NSImage imageNamed: iconFile ];
[ imageView setImage: image ];
}

Could someone please show me, where the valid values for  
CFBundleIconFile are documented?

Tiger 10.4.11.

Guessing around (name must be American?), (must NOT be German?),  
(may contain only three characters?), (only one vowel allowed?) is  
not really satisfying.



Kind regards,

Gerriet.


What does -[NSApp applicationIconImage] return ?


___

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

Please do not post admin requests or moderator comments to the list.
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: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Jean-Daniel Dupas

I did test with an UTF-8 one (the default encoding).


Le 28 août 08 à 17:44, Shawn Erickson a écrit :


On Thu, Aug 28, 2008 at 8:32 AM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:

Probably the good one, as the Cocoa framework managed to retreive  
the icon

properly.  (the About Box display the icon propertly)


Well my thinking was it could be that some frameworks have broader
support for encodings then others so I was curious on what encoding
was being used.

-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: Quitting all active applications

2008-08-28 Thread Jean-Daniel Dupas


Cocoa Application expects a Quit AppleEvent, not a sigterm.
SIGTERM will kill the app and it will not have any chance to save the  
edited document. Try with TextEdit if you don't belive it ;-)



Actually no, since the default kill signal is TERM, apps will be  
allowed to prompt to save if necessary. This assumes the app is  
handling that signal properly. We could send KILL or ABRT and that  
would just end the processes w/o any save options.


Randall Meadows wrote:

On Aug 28, 2008, at 10:46 AM, Martin Stoufer wrote:

A small app that utilized an NSTask object whose system command  
would be 'killall -u your short username here -m regex'.


And that would be a great way to lose data, if any of the  
applications getting killed had unsaved documents.




--
* Martin C. Stoufer  *
* ISS/IT *
* Lawrence Berkeley National Lab *
* 510-486-5306   *
* MS 937-700 *

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: global key bindings

2008-08-28 Thread Jean-Daniel Dupas


Le 28 août 08 à 14:21, David Reitter a écrit :


On 28 Aug 2008, at 00:27, Eric Schlegel wrote:



Menus contained in NSStatusItems (and displayed on the right side  
of the menubar) don't currently respond to command keys at all.  
This is already reported in Radar.


Thanks, I'll stop looking then.
FWIW, the binding does work once the menu is shown.  Also, Adium  
somehow manages to pull it off, too.


Can you give me a pointer on how to implement global key bindings?   
(Again, the app has no menu / Dock icon and would want to receive  
the event without having focus.  I need something like Hot Keys in  
Carbon.)


So use Carbon Hot Keys.

http://developer.apple.com/samplecode/FunkyOverlayWindow/listing7.html


___

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

Please do not post admin requests or moderator comments to the list.
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: CFBundleIconFile: heiß or hot?

2008-08-28 Thread Jean-Daniel Dupas


Le 28 août 08 à 17:10, Shawn Erickson a écrit :


On Thu, Aug 28, 2008 at 5:38 AM, Gerriet M. Denkmann
[EMAIL PROTECTED] wrote:

But, another problem: when I run my app with CFBundleIconFile =  
heiß the

picture in the dock is just the default app icon.


What encoding is being used for your Info.plist?

-Shawn


Probably the good one, as the Cocoa framework managed to retreive the  
icon properly.  (the About Box display the icon propertly)


I did some test and get the same result.
And I also try to do this:

[NSApp setApplicationIcon:[NSApp applicationIcon]];

and it properly set the Dock icon. (But the Finder continue to display  
the generic Icon of course).


I think this is a bug in LaunchServices (or any other system component  
used to retreive icons).



___

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

Please do not post admin requests or moderator comments to the list.
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: CFBundleIconFile: heiß or hot?

2008-08-29 Thread Jean-Daniel Dupas


Le 28 août 08 à 23:00, Kyle Sluder a écrit :


On Thu, Aug 28, 2008 at 12:50 PM, Gerriet M. Denkmann
[EMAIL PROTECTED] wrote:

It starts with:
?xml version=1.0 encoding=UTF-8?


Just because it *says* it's encoded in UTF-8 doesn't mean it *is*.
For all you know it was saved in MacRoman.

--Kyle Sluder



So, why the Cocoa frameworks parse it correctly and - 
applicationIconImage works as expected.


By default, Info.plist are explicitly mark as UTF-8 in Xcode projects.  
I'm sure this is not an Info.plist encoding issue.





___

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

Please do not post admin requests or moderator comments to the list.
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: NSArray as a static

2008-09-01 Thread Jean-Daniel Dupas

Unlike java, Obj-C does not have the concept of class variable.
Your static variable is a classic C variable, and C variable are not  
automatically initialized to NULL.
The first time you call init, relationshipMatch may contains anything  
and may not be NULL, and so it will never be properly initialized.


Second error, you do not retain you variable. You create it using a  
convenient initializer wich returns an autoreleased array. At the end  
of the event loop, your array is released, and as you never retained  
it, it is deallocated.




Le 1 sept. 08 à 20:29, Richard Good a écrit :

I'm just learning Objective C and need to understand how to declare  
and use a static NSArray.
I think I may be confusing  the Java concept of static and Objective  
C's concept.



What I want is how to use the Java idea of a class static  variable  
in Objective C


Here's the code I'm trying to use:

//class name is Person
static  NSMutableArray* relationshipMatch;

-(id)init {
[super init];
if (relationshipMatch==nil) 
[Person initRelationshipMatch];
return self;
}
+ (void) initRelationshipMatch  {
relationshipMatch = [NSArray arrayWithObjects:
@abc,@def,@hig,nil] ;   
}


When I try to access the array using
NSString* aString = [relationshipMatch objectAtIndex:1];

I get
*** Terminating app due to uncaught exception  
'NSInvalidArgumentException', reason: '***


Any help would be appreciated.

Richard Good

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: NSArray as a static

2008-09-01 Thread Jean-Daniel Dupas


Le 1 sept. 08 à 21:18, Kyle Sluder a écrit :

On Mon, Sep 1, 2008 at 2:29 PM, Richard Good [EMAIL PROTECTED]  
wrote:
What I want is how to use the Java idea of a class static  variable  
in

Objective C


Because Objective-C doesn't have class variables (as Jean-Daniel
noted), you have to use a global variable.  The static keyword in C
means that the variable has file-level scope.  So in your Person.m
file, you would do something like this:

static NSMutableArray *relationshipMatch;
@implementation Person

+ (NSMutableArray *)relationshipMatch
{
   return relationshipMatch;
}

@end

This will expose the file-scoped array using a class method.  If you
want to have direct access to the variable (violating encapsulation,
but often useful for things like constants) then you can put an extern
declaration in your Person.h like so:

extern NSMutableArray *relationshipMatch;

Then any source file that #imports Person.h will know of the existence
of an NSMutableArray *relationshipMatch, which will be defined when
Person.m is compiled.  The linker will resolve all references to this
variable.

This is how constants are usually implemented.  For example, the
NSPasteboard class uses constants to retrieve different
representations of data on the pasteboard.  An application can put a
plain-text representation and an RTF representation on the pasteboard
so other apps can consume the more appropriate representation.  The
consumer then gets the data from the pasteboard using -[NSPasteboard
dataForType:], passing in NSRTFPboardType for the RTF representation,
or NSStringPboardType for an NSString.  These constants are declared
as externs, like so:

extern NSString *NSRTFPboardType;
extern NSString *NSStringPboardType;

You get these declarations by #importing AppKit.h.  The actual
definitions of these constants happens somewhere in the AppKit source
code, which we don't have access to.  They look something like this
(the contents of the strings doesn't matter):

static NSString *NSRTFPboardType = @RTF Pasteboard Type Identifier;
static NSString *NSStringPboardType = @String Pasteboard Type  
Identifier;


At link time, the linker is able to resolve your code's references to
either of these constants to their definition in the AppKit library.



It will not compile:

extern int bar;
static int bar = 5;

foo.c:2: error: static declaration of ‘bar’ follows non-static  
declaration

foo.c:1: error: previous declaration of ‘bar’ was here

To be able to access globals from an other file, they have to be  
global variables and not static variables, and should be defined like  
this (without the static keyword):


NSString *NSRTFPboardType = @RTF Pasteboard Type Identifier;
NSString *NSStringPboardType = @String Pasteboard Type Identifier;












___

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

Please do not post admin requests or moderator comments to the list.
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: NSArray as a static

2008-09-02 Thread Jean-Daniel Dupas


Le 2 sept. 08 à 00:13, Steven Noyes a écrit :



On Sep 1, 2008, at 1:38 PM, Jean-Daniel Dupas wrote:


Unlike java, Obj-C does not have the concept of class variable.
Your static variable is a classic C variable, and C variable are  
not automatically initialized to NULL.
The first time you call init, relationshipMatch may contains  
anything and may not be NULL, and so it will never be properly  
initialized.


Note: In C, all static and global variables are initialized to  
zeros (or NULL pointers).  Local variables (auto variables  from the  
stack) are not initialized.


Steven


Yep, I just saw that static are an exception and are initialized to  
NULL or 0, but I'm not sure about globals.


10 If an object that has automatic storage duration is not initialized  
explicitly, its value is
indeterminate. If an object that has static storage duration is not  
initialized explicitly,

then:
—ifithas pointer type, it is initialized to a null pointer;
—ifithas arithmetic type, it is initialized to (positive orunsigned)  
zero;
—ifitisanaggregate, every member is initialized (recursively)  
according to these rules;
—ifit isaunion, the first named member is initialized (recursively)  
according to these

rules.


___

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

Please do not post admin requests or moderator comments to the list.
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: NSArray as a static

2008-09-02 Thread Jean-Daniel Dupas


Le 2 sept. 08 à 16:29, Clark Cox a écrit :


On Tue, Sep 2, 2008 at 12:33 AM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:


Le 2 sept. 08 à 00:13, Steven Noyes a écrit :



On Sep 1, 2008, at 1:38 PM, Jean-Daniel Dupas wrote:


Unlike java, Obj-C does not have the concept of class variable.
Your static variable is a classic C variable, and C variable are  
not

automatically initialized to NULL.
The first time you call init, relationshipMatch may contains  
anything and

may not be NULL, and so it will never be properly initialized.


Note: In C, all static and global variables are initialized to  
zeros (or
NULL pointers).  Local variables (auto variables  from the stack)  
are not

initialized.

Steven


Yep, I just saw that static are an exception and are initialized to  
NULL or

0, but I'm not sure about globals.


Globals have a static storage duration:

C99 6.2.4:

3 An object whose identifier is declared with external or internal
linkage, or with the
storage-class specifier static has static storage duration. Its
lifetime is the entire
execution of the program and its stored value is initialized only
once, prior to program
startup.


Thank you, it was the paragraph I missed.


___

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

Please do not post admin requests or moderator comments to the list.
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: Font Color In CTLineDraw?

2008-09-03 Thread Jean-Daniel Dupas


Le 3 sept. 08 à 17:17, Mike Rossetti a écrit :


Thanks for clearing that up David.

Apparently one cannot open an NSGraphicsContext within a CGContext,  
but I will experiment more this evening.


I'm discovering that drawing attributed text via CTLineDraw has  
significant limitation, but for my purposes I believe I can live  
within those limitations.


It would be, ahem, illustrative if there was an example or two of  
drawing simple NSAttributedString-based unicode text using CG in a  
CALayer within an NSView.


Thanks again,
Mike



Create an NSGraphicsContext from you CGContext:

+ [NSGraphicsContext graphicsContextWithGraphicsPort:flipped:];

Set it as the current context

+ [NSGraphicsContext setCurrentContext:];

And now you should be able to draw string into your CGContext.



___

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

Please do not post admin requests or moderator comments to the list.
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 autorelease problem

2008-09-03 Thread Jean-Daniel Dupas


Le 3 sept. 08 à 19:02, [EMAIL PROTECTED] a écrit :


Hi,

I'm trying to calculate the elapsed time by calling this twice and  
getting the difference.


double Seconds()
{
  return [[NSDate date] timeIntervalSince1970];
}

This is being called from an audio play back proc which is being  
called about 100 times a second.  I'm getting this error message in  
the log window a whole bunch of times.


2008-09-03 09:39:30.766 App[321] *** _NSAutoreleaseNoPool(): Object  
0x36acd0 of class NSCFDate autoreleased with no pool in place - just  
leaking


What I think is happening is that it's not being released fast  
enough.  I was using AbsoluteToNanoseconds(UpTime()) but that's  
Carbon and that won't work in 10.6.


Any ideas?


CFAbsoluteTimeGetCurrent()
and if you need something with a better precision see this note:
http://developer.apple.com/qa/qa2004/qa1398.html


___

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

Please do not post admin requests or moderator comments to the list.
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: Can I get a FILE* from Cocoa (NSFileHandle )?

2008-09-04 Thread Jean-Daniel Dupas


Le 4 sept. 08 à 19:09, Paul Archibald a écrit :

I have gotten some suggestions on a problem which require access to  
standard C calls. In particular, one poster suggested that I use  
some calls which require a FILE*, when all I have at this point are  
NSTask, NSPipe, and NSFileHandle objects.


Is it possible to get a FILE* from an NSPipe or NSFileHandle? I  
don't see anything in the documentation that looks like that. (I am  
not getting much help from Google either.)


fdopen[[fileHandle fileDescriptor], ...)

See man fdopen for details.


___

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

Please do not post admin requests or moderator comments to the list.
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: Oracle and Objective C++

2008-09-05 Thread Jean-Daniel Dupas



Le 5 sept. 08 à 17:13, Bradley Randy a écrit :



But I get the following errors when I try to compile it.

Line Location occiAQ.h:280: error:
'oracle::occi::aq::Subscription::Protocol' has a previous  
declaration here

Line Location occiAQ.h:280: error:
'oracle::occi::aq::Subscription::Protocol' has a previous  
declaration here

Line Location occiAQ.h:320: error:
'oracle::occi::aq::Subscription::Protocol' referred to as 'struct'
Line Location occiAQ.h:321: error:
'oracle::occi::aq::Subscription::Protocol' referred to as 'struct'




Can anybody tell me if this is because “Protocol” is a reserved word  
in

Objective C?

If so, can anyone think of a work=-around?  The only idea I have is  
to call
the OCCI code as a process with NSTask and pipe queries and results  
results

back and forth.

Thanks all.


Protocol is not a reserved word, it is a type defined in objc/ 
runtime.h


#ifdef __OBJC__
@class Protocol;
#else
typedef struct objc_object Protocol;
#endif

A workaround may be to use a macro to hide the objc variable (untested).

#define Protocol ObjCProtocol
#import Cocoa/Cocoa.h
#undef Protocol

An other workaround is to wrap your oracle calls into a .cpp file that  
includes occiAQ.h, and then call thoses functions from you objcpp  
file.


--- mywrapper.h 

extern
int myOracleFunction();


--- mywrapper.c --

#include mywrapper.h
#include occiAQ.h

int myOracleFunction() {
// perform oracle specific code

}



___

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

Please do not post admin requests or moderator comments to the list.
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: Keyboard accelerators

2008-09-05 Thread Jean-Daniel Dupas


Le 5 sept. 08 à 21:40, Peter Hudson a écrit :

I need to set the combination of  option   +   command   +
up / down  arrow  in the main menu.

It does not seem to be possible to do this in interface builder.

Any suggestions ?

Peter



Yes, doing it in Interface Builder . What do you mean by 'seems not  
possible'. I don't have any problem to set cmd+opt+down arrow as a  
menu shortcut.
I tried directly in the menu and into the inspector, and both works  
for me.





___

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

Please do not post admin requests or moderator comments to the list.
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: Posting Keyboard Events

2008-09-06 Thread Jean-Daniel Dupas


Le 6 sept. 08 à 14:00, Peter N Lewis a écrit :


At 20:15 -0600 5/9/08, Dave DeLong wrote:
How on earth can I post system keyboard events (without getting a  
beep)?


As Ken mentioned, first off make sure the key has somewhere to go.

After that, this is roughly the code I use in Keyboard Maestro  
(extracted bits and pieces, so it wont compile directly).  My  
apologies for the appearance of the code in email, but perhaps it is  
still useful.



verify_noerr( ::CGEnableEventStateCombining( false ) );
	 
verify_noerr 
( ::CGSetLocalEventsFilterDuringSuppressionState 
( kCGEventFilterMaskPermitAllEvents,  
kCGEventSupressionStateSupressionInterval ) );

verify_noerr( ::CGSetLocalEventsSuppressionInterval( 0.0 ) );

PostModifierKeys( inModifiers, true );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, true ) );
verify_noerr( CGPostKeyboardEvent( inChar, inKeyCode, false ) );
PostModifierKeys( inModifiers, false );

verify_noerr( ::CGEnableEventStateCombining( true ) );


with:


void
UCGRemoteControl::PostModifierKeys( const UInt32 inModifiers,  
Boolean inKeyDown )

{
if ( inModifiers( UInt32(shiftKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGShiftKeyCode, inKeyDown ) );

}

if ( inModifiers( UInt32(controlKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGControlKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(optionKey)) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGOptionKeyCode, inKeyDown ) );

}
if ( inModifiers( UInt32(cmdKey) ) ) {
		verify_noerr( ::CGPostKeyboardEvent( (CGCharCode)0,  
kCGCommandKeyCode, inKeyDown ) );

}
}

There is an extra piece of code to release the desired key if it is  
already down (if the user is pressing the A key already, and you try  
to press it again without first releasing it, it wont work).


Also, the key code for A is 0.  6 is Z.


It's true on QWERTY keyboard, but you should not rely on 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: Forcing finalization on the main thread?

2008-09-07 Thread Jean-Daniel Dupas


Le 8 sept. 08 à 00:25, Nick Zitzmann a écrit :

I've got a C data structure in a GC-enabled app. I'm deallocating  
the structure when the parent object is finished, in -dealloc and - 
finalize. I've found out the hard way that the data structure is not  
thread-safe, and eventually causes a crash if deallocated on a  
thread other than the main thread. Of course, when GC is running,  
most deallocations occur on another thread.


So I've looked in the documentation and haven't found anything. Is  
there a way to force a collected object to be finalized on the main  
thread, and nowhere else? If so, then how do I do this?


I already tried:

1. Calling -performSelectorOnMainThread:... in the -finalize method.  
Of course it caused the object to be resurrected, which just made  
the problem worse.
2. Allocating the parent object in an unscanned zone, hoping that  
retain/release would make a comeback, but it didn't.


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


Just a idea like that.
You can use perform on main thread using a class method and pass your  
structure as argument.


+ (void)finalize {
	[[self class]  
performSelectorOnMainThread:@selector(destroyNotThreadSafeStruct:)  
withObject:[NSValue valueWithPointer:myStruct]];

}

+ (void)destroyNotThreadSafeStruct:(id)myStruct {
void *struct = [myStruct pointerValue];
	// perform cleanup. As this is a class method, it does not resurect  
the object.


}


___

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

Please do not post admin requests or moderator comments to the list.
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: BOOL array

2008-09-09 Thread Jean-Daniel Dupas

Le 9 sept. 08 à 12:24, Alex Reynolds a écrit :

I am currently putting 320 to 480 character long NSString *  
instances into an NSMutableArray. The characters are 0 or 1.


I guess I could use an int array, but I'm looking to speed up my app  
and reduce storage. Is it possible to create a BOOL array that can  
be put into an NSMutableArray?




I you don't need to much control over you data, you may use a  
CFBitVector (and mutable counterpart).
As it is a CFTypeRef, it is free-bridged with NSObject and can be  
stored in an NSArray.



___

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

Please do not post admin requests or moderator comments to the list.
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: Cocoa application running very slow under 64 bit

2008-09-11 Thread Jean-Daniel Dupas


Le 11 sept. 08 à 13:01, Frank Illenberger a écrit :




Hi there,

I migrated an existing cocoa application to run under x86_64 with  
Xcode 3.1 / Mac OS 10.5.4. The app still runs fine under 32 bit  
but when started in x86_64 mode, it runs about 3-4 times slower.

A shark profile reveals the following hot traces:

8.9%libgcc_s.1.dylib_Unwind_GetIPInfo   
7.6%libgcc_s.1.dylib_Unwind_GetIPInfo   
7.6%libgcc_s.1.dylib_Unwind_Backtrace   
7.6%libobjc.A.dylib objc_addExceptionHandler
7.5%Unknown Library _CFDoExceptionOperation 

7.2%Unknown Library _NSAppKitLock   
1.5%Unknown Library  
-[NSView nextKeyView]
1.2%Unknown Library  
-[NSView _primitiveSetNextKeyView:]
0.8%Unknown Library  
+[NSControl cellClass] [unknown]   
0.7%Unknown Library 
-[NSCell setMnemonicLocation:]  
0.6%Unknown Library 
SetPlaceholderString
0.5%Unknown Library 
-[NSView previousKeyView]   
0.2%	Unknown Library	  		-[NSControl  
_setControlTextDelegateFromOld:toNew:]



These hot traces do not show up when I profile the app running  
under 32 bit.


Does anybody know why a 64 bit app could be spending so much time  
in these methods?




Is your program throwing a lots of exceptions ? The exception  
handling mechanism is not the same between 32 bits and 64 bits  
runtime. IIRC throwing an exception on the 64 bits runtime os a lot  
more than on the 32 bits one.
With the 64bits runtime, it will properly unwind the stack and call  
C++ dtor when needed (even if a pure objc program does not require  
it), but with the 32bits runtime, it's just a longjmp call.


I am not throwing any exceptions in my code. If there are any, they  
must get thrown from within the Cocoa frameworks. Is there a way to  
track this? I added breakpoints at


objc_exception_throw

and

-[NSException initWithName:reason:userInfo:]

but they were not hit.


You may try to add a break point on objc_addExceptionHandler to find  
where it is call.




___

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

Please do not post admin requests or moderator comments to the list.
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: BOOL array

2008-09-11 Thread Jean-Daniel Dupas


Le 11 sept. 08 à 13:32, dreamcat7 a écrit :



Yes the NSMutableData needs this category method then it work.


@interface  NSMutableData (charArray)
- (char*)char;
@end

@implementation NSMutableData (charArray)
- (char*)char
{
char * foo = self.mutableBytes;
return foo;
}
@end

+ (NSMutableData*)defaultOptions
{
NSMutableData* defaultOptions = [NSMutableData dataWithLength:20];
[defaultOptions char][03] = 0xFF;
[defaultOptions char][11] = 0xFF;
[defaultOptions char][19] = 0xFF;
// [defaultOptions char][] = YES;
	NSLog(@%@:%s defaultOptions = %@, [self class], _cmd,  
defaultOptions);	

return [[defaultOptions retain] autorelease];
}


You can also declare your index numbers as an enum to make them easy  
to remember


enum MyOptions
{
MyOptionsFirstOption  = 00,
/* declare any more BOOL options */
MyOptionsNinteenthOption= 18,
MyOptionsLastOption  = 19,
MyOptionsLength  = 20,
};

which makes the [03] into [MyOption]

+ (NSMutableData*)defaultOptions
{
	NSMutableData* defaultOptions = [NSMutableData  
dataWithLength:MyOptionsLength];

[defaultOptions char][MyOptionsFirstOption] = YES;
[defaultOptions char][MyOptionsNinteenthOption] = YES;

// All other options are (signed char)0x00 = (BOOL)NO;

	NSLog(@%@:%s defaultOptions = %@, [self class], _cmd,  
defaultOptions);	

return [[defaultOptions retain] autorelease];
}


And probably will also want to write kvc-compliant accessor methods
(for the ones which you would like exposed in your class' public  
interface)


- (BOOL)myFirstOption;
- (void)setMyFirstOption:(BOOL)theBool;




That's fine if you love to reinvent the wheel, but that exactly the  
interface provided by CFMutableBitVector.


CFBitVectorCreateMutable()
CFBitVectorSetBitAtIndex()
CFBitVectorGetBitAtIndex()


And it probably does it better as it will not waste 7 bits for each  
option.






___

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

Please do not post admin requests or moderator comments to the list.
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]


Mixing ObjC and C++ STL on same ObjC source file

2008-09-12 Thread Daniel Luis dos Santos

Hello !

I have an objective C class and want to call a method on a class in C+ 
+. As argument to the C++ class is a map instance of the STL.

The ObjC class definition is on a file with a mm extension.

I have std::map *var as a member variable of the ObjC class. When I  
compile the code there is an error saying :


/Users/dlsa/code/Finema/trunk/LiquidSurfaces/src/CVDisplayPipeline.h: 
20: error: using-declaration for non-member at class scope


How do I 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: Mixing ObjC and C++ STL on same ObjC source file

2008-09-13 Thread Daniel Luis dos Santos


On Sep 12, 2008, at 11:21 AM, Daniel Luis dos Santos wrote:

The problem was that in CVDisplayPipeline.h I was declaring the map  
as a return type of a method, but without specifying the template  
types (caused by my relative ignorance of C++).


Now I have another problem, which I wonder if you could help :

On one project I have a target that builds a shared library target  
in C++ exclusively. On another target I have a objC app that uses  
the first as a project dependency.


When I call a method on the library with a pointer to a STL map  
(std::mapstd::string, std::string) as an argument, the linker  
complains it can't find it. I made a test method on the lib that  
takes only a std::string and it works. Passing a std::mapint, int  
fails with the same error. Other methods in the lib that don't use  
STL are found by the linker.


Don't know what is happening, or if there is any limitation because  
of STL.




I looked up the documentation from apple on using the C++ runtime, and  
learned that in practice it is not to be assumed that two C++ runtime  
versions even on the same OS maintain compatibility. Then one should  
not put STL on library boundaries because of portability between  
libstdc++ implementations.


That said, STL can be used only within a library's own code. Then when  
coding a shared library one must implement all kinds of data  
structures that can be used at the boundary. Isn't that like  
reinventing the wheel ?


Having to implement those data structures is a lot of work (at least  
for who's beginning to write C code). Having to do a map  
implementation or a linked list is almost like starting from scratch.  
Is there any implementation of those standardized in the C world (that  
is only C and portable) ?


___

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

Please do not post admin requests or moderator comments to the list.
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: Getting NSTimeZone for a given NSDate

2008-09-15 Thread Jean-Daniel Dupas


Le 15 sept. 08 à 09:56, Jason Coco a écrit :



On Sep 15, 2008, at 03:49 , Markus Spoettl wrote:


Hi List,

I just know it must be there but I can't see it. How can I get to  
the NSTimeZone for a given NSDate. When using -description: the  
date got a time zone, so it's stored in there but how on earth can  
I get to it? I only need the GMT offset (numerically, not as  
string), in case there's a simpler way to obtain this.


All NSDate objects are stored as seconds since the reference date  
(Jan 1 1970 00:00 GMT) and so are always GMT. The description is  
using the default time zone to adjust the date. You can get the  
default time zone with [NSTimeZone defaultTimeZone] and then you can  
get the offset with -(NSTimeInterval)secondsFromGMT.


It's conceptualy right, but just for info, NSDate do not store the  
value as a UNIX timestamp, but as a Core Foundation Absolute Time  
which is a double that represents the number of seconds since the  
reference date which is 00:00:00 1 January 2001



___

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

Please do not post admin requests or moderator comments to the list.
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: Modal dialog without NSApplication

2008-09-18 Thread Jean-Daniel Dupas


Le 18 sept. 08 à 15:12, brodhage a écrit :


Hi,

I am developing application software for Mac and Windows.
Most of the code is developed using ObjectC - this way most of the  
code can be used for both OS. Only the OS depending stuff - like  
showing dialogs, menus... - is separated.


The problem: how can I show and handle a modal dialog for MacOS X  
without NSApplication?


Using NSApplication (and all the other classes) would mean to have a  
lot more code OS depending.


Any ideas?

Cheers
Martin Brodhage


If you just want to show simple dialog, you can use CFUserNotification.

If you want a complexe dialog that require some custom control or  
event handling, you will have to use NSApplication.


I don't understand why using NSApp for this kind of works will have an  
impact on the remaining of you application though.



___

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

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

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

This email sent to [EMAIL PROTECTED]


How to call functions of a C dylib on a C++ dylib

2008-09-18 Thread Daniel Luis dos Santos
I am having trouble getting it to compile. From what I understand  
there must be an extern C before the inclusion of the C lib's header  
files.

I still get a link error. Is there anything else to it ?
___

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

Please do not post admin requests or moderator comments to the list.
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 call functions of a C dylib on a C++ dylib

2008-09-18 Thread Daniel Luis dos Santos
Sorry, I forgot to say that I was already doing that. And it does  
build, my problem is in the link stage.



On Sep 18, 2008, at 3:00 PM, Negm-Awad Amin wrote:



Am Do,18.09.2008 um 15:55 schrieb Daniel Luis dos Santos:

I am having trouble getting it to compile. From what I understand  
there must be an extern C before the inclusion of the C lib's  
header files.

I still get a link error. Is there anything else to it ?
___

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

Please do not post admin requests or moderator comments to the list.
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]
You have to include the headers for your source code (compiling) and  
the lib itself for linking.


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: Modal dialog without NSApplication

2008-09-18 Thread Jean-Daniel Dupas


Le 18 sept. 08 à 16:15, brodhage a écrit :


Hi,

thank you very much for your quick answer, Jean-Daniel.

 If you want a complexe dialog...

Yes. So I guess CFUserNotification does not help.

 I don't understand why using NSApp for this kind of works will  
have an impact on the remaining of you application though.


Just because a lot of my code handles common task - and it is not  
guaranteed that there is a NSApplication at all.


For example let's take a plugin for a carbon application - here  
there is no NSApplication.




In theorie, you can safely call NSApplicationLoad() to instanciate an  
NSApplication before you use it, even in a Carbon App plugin (and then  
create you own auto release pool).
In practice, there is some issues when running a modal Cocoa windows  
in a Carbon App (I remember some carbon-dev messages about it).

But it's worth the try.

And: using NSApplication would mean to bind the code only to  
applications and to name all files .mm instead of .cpp - not  
usable if you want to build that under Win.


You don't have to name all files .mm, only the one that uses Cocoa  
(tthe one that is already Mac OS X specific). And both Visual Studio  
and Xcode provide some options to force the type of the file (to tell  
VS to compile .mm as .cpp or to tell Xcode to compile some cpp file as  
mm).



___

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

Please do not post admin requests or moderator comments to the list.
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 set Document type and its icon programatically

2008-09-20 Thread Jean-Daniel Dupas


Le 19 sept. 08 à 11:22, Nick Rogers a écrit :


Hi,
My cocoa app is not a document based app, but saves a binary file to  
the disk.
I can set this file's name and extension and icon by going to the  
Target properties and adding a new document type there.


It was working fine and the resulting saved file was given the  
required icon.


But then I had to embed my app into another app directory, since  
then its not working (no icon is associated now).


The directory structure is now:
myOuterApp/Contents/MacOS/myInnerApp.app
So the inner app's saved file now doesn't display the required icon.

Will this problem be resolved if I set the icon programatically?
How to go about this?

Thanks,
Nick


Look like LaunchServices does not find you application and does not  
register it.
You may try to register it manually at first launch in you outer app  
using: LSRegisterURL((CFURLRef)myInnerAppNSUrl, false);







___

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

Please do not post admin requests or moderator comments to the list.
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: fullscreen quicktime across multiple monitors

2008-09-21 Thread Jean-Daniel Dupas
You are free to setup a window yourself , add a QTMovieView in it, and  
display it as you need.


 NSRect contents = [aScreen frame];
 contents.origin = NSZeroPoint;
NSWindow *window = [super initWithContentRect:contents
  styleMask:NSBorderlessWindowMask
backing: NSBackingStoreRetained
defer:NO screen:aScreen];
[window setContentView:myMovieView];

SetSystemUIMode(kUIModeAllSuppressed, kUIOptionAutoShowMenuBar);
[window makeKeyAndOrderFront];



Le 21 sept. 08 à 23:58, Memo Akten a écrit :

hmm, yea does seem a bit problematic.  so is it not possible to  
play quicktime across multiple monitors then? those threads seem to  
have not come to a solution...



On 19 Sep 2008, at 17:48, Sean McBride wrote:


It does, doesn't it.  However, it has lots of little problems, and is
only really useful for the simplest of cases.  Search the list  
archives

for enterFullScreenMode.

On 9/19/08 9:42 AM, Memo Akten said:


wow that looks perfect thanks..

On 19 Sep 2008, at 05:10, John C. Randolph wrote:



On Sep 17, 2008, at 12:03 PM, Memo Akten wrote:


Hi All, I'd like to create a little app the runs a quicktime movie
(prores) fullscreen across multiple monitors. I think I can figure
out the QTKit stuff, but couldn't find upto date documentation on
going fullscreen. I've found some code snippets to do it, but they
are all pre-leopard and I have a feeling that its a bit more
straightforward on leopard (i'm hoping). Can anyone point me in  
the

right direction? (or has this already been done?) Its for personal
use and not distribution so min specs 10.5.5 etc. is fine.


Leopard introduced a new API for this.  See NSView's
enterFullScreenMode:withOptions: method.


--

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/devlists%40shadowlab.org

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: 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: How to set up a thread listening to performSelector: messages?

2008-09-25 Thread Jean-Daniel Dupas


Le 25 sept. 08 à 17:53, Oleg Krupnov a écrit :


I actually have tried this. My code looks like this (is it correct?):

@implementation Worker

- (void)threadMain:(id)data
{
 runLoop = [NSRunLoop currentRunLoop];
 [runLoop addPort:[NSMachPort port] forMode:NSDefaultRunLoopMode];
 while(true)
 {
   [runLoop run];
 }
}

- (void)processRequest:(id)sender
{
 NSLog(@hello);
}

@end

Then from the main thread I send:

[[worker runLoop] performSelector:@selector(processRequest:)
target:worker argument:request order:0 modes:[NSArray
arrayWithObject:NSDefaultRunLoopMode]];



NSRunLoop is not known to be thread safe. Calling another thread's  
runloop methods does not works (as you see). You should only use this  
method one the current thread runloop.


Instead you should keep a pointer to the target thread and use [worker  
performSelector:onThread:withObject:waitUntilDone:].

Note that It works only on 10.5.

___

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

Please do not post admin requests or moderator comments to the list.
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]


sizeof(unsigned long long)

2008-09-27 Thread Daniel Luis dos Santos

Hello,

I have a piece of C code that generates an unsigned long long from an  
sequence of unsigned char's.


When I do sizeof(unsigned long long) i get 8.
Afterwards I try to shift each unsigned char into its position along  
the destination unsigned long long variable, but I get a warning from  
the compiler that I am shifting beyond the type's capacity. That is  
not surprising since I am targeting 32 bit.
Then I don't understand why the size of returns 8. Shouldn't it return  
4 ?


I'm running Xcode 3.0 on Leopard.
___

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

Please do not post admin requests or moderator comments to the list.
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: Parsing integers from strings

2008-10-07 Thread Jean-Daniel Dupas


Le 7 oct. 08 à 07:08, Cyrus Najmabadi a écrit :

I've been unsuccessful finding the right class in cocoa to help me  
parse

integers inside NSStrings.
I'm looking for something similar to java's Long.parseInt(string,  
radix).

i.e. something that can understand a stream of numbers along with a
specified radix (which may be 8, 10 or 16 in my use cases).

What is available to help out here?

Thanks!

  -- Cyrus


For base 10, -[NSString integerValue] will do the trick, for other  
bases, you can either use NSScanner, or just fall back to libc function:


strtol([myString UTF8String], NULL, 16);

I don't remember if -UTF8String may returns NULL. If this is the case,  
you should test the value before passing it to strtol.


___

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

Please do not post admin requests or moderator comments to the list.
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: Optimized pixel manipulation

2008-10-08 Thread Jean-Daniel Dupas
CGImage does not provide an efficient way to update , but maybe  
CGImage is not what you want.
Where your image come from, why do you need a CGImageRef and what are  
you trying to do with it ?



Le 8 oct. 08 à 17:01, Christian Giordano a écrit :


I'm modifying frequently the pixels of the images, the way I found is
creating a copy of the data
(CGDataProviderCopyData(CGImageGetDataProvider(image));) modify the
pixels and then create a new one. I'm facing performance issues and I
fear that all this allocating and deallocating is not helping. Is
there a way I could have access and modify the pixels of a CGImage
without copying them?

Thanks, 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/devlists%40shadowlab.org

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: Optimized pixel manipulation

2008-10-08 Thread Jean-Daniel Dupas

I do not understand.
If you just want to display some shapes and images, you don't need to  
draw into a bitmap, you just need to draw in your view.
What do you mean by creating a context. All views already have a  
context where you can draw whatever you want.


Le 8 oct. 08 à 17:43, Christian Giordano a écrit :


At the moment I'm starting creating a context and drawing basic
shapes, is there another way to draw basic shapes on a bitmap?

Cheers, chr


On Wed, Oct 8, 2008 at 4:32 PM, Christian Giordano
[EMAIL PROTECTED] wrote:

I started questioning myself if maybe I need something else, but
clearly I have no idea which other options I have. Maybe using OpenGL
(ES)? The ultimate aim is of course to renderer the result of all the
manipulation, at the moment this happens in a UIView.drawRect.

Cheers, chr


On Wed, Oct 8, 2008 at 4:25 PM, Jean-Daniel Dupas
[EMAIL PROTECTED] wrote:
CGImage does not provide an efficient way to update , but maybe  
CGImage is

not what you want.
Where your image come from, why do you need a CGImageRef and what  
are you

trying to do with it ?


Le 8 oct. 08 à 17:01, Christian Giordano a écrit :

I'm modifying frequently the pixels of the images, the way I  
found is

creating a copy of the data
(CGDataProviderCopyData(CGImageGetDataProvider(image));) modify the
pixels and then create a new one. I'm facing performance issues  
and I

fear that all this allocating and deallocating is not helping. Is
there a way I could have access and modify the pixels of a CGImage
without copying them?

Thanks, 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/devlists%40shadowlab.org

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/devlists%40shadowlab.org

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: Mirror...rorriM : Details Please

2008-10-09 Thread Jean-Daniel Dupas
It does not differenciate bewteen X and Y, but it allows -1. Just use  
the text field to enter the value instead of using the slider.


Le 9 oct. 08 à 10:36, M Pulis a écrit :

OK, I can see one of my problems IB and FH (funhouse) do not  
allow -1 nor differentiate between X and Y scale factors. Hoping  
just some simple settings would do.


Digging deeper before I ask for more.

Thanks

Gary


On Oct 9, 2008, at 1:13 AM, Stephen J. Butler wrote:


On Thu, Oct 9, 2008 at 2:47 AM, M Pulis [EMAIL PROTECTED] wrote:
My apologies for being a bit dense, not asking for details and  
apparently
late to the party, but I have looked at  CIAffineTransform  
(filters, etc)
for hours and can not make sense of it in making a flip. IB  
settings can not
flip.I have used core image fun house and can not flip the image.  
I have
implemented the entire Image Kit tutorial only to be teased by the  
mirror
property in picture taker, performing this magic without appearing  
to bother

with a filter whose only purpose in life is to flip pixels.


I believe using an affine transform with a scale of (X,Y) by
(-1.0,1.0) will work.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/toothpic%40fastq.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/devlists%40shadowlab.org

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: Strategy for naming support folder

2008-10-13 Thread Jean-Daniel Dupas


Le 10 oct. 08 à 20:04, Uli Kusterer a écrit :


On 10.10.2008, at 07:15, Graham Cox wrote:

On 10 Oct 2008, at 11:30 am, j o a r wrote:
Most apps use just the name, but I've never liked that and I  
support your idea of using the bundle identifier. Makes a lot of  
sense.


Yep, seemed to make sense to me too, but I don't think I've ever  
seen it, which is why I hesitated.


I think I'll do it this way unless I hear some good arguments  
against.



I actually think that's Apple's recommendation. That said, I don't  
like using bundle identifiers for this, as I prefer old-Mac-style  
readable file names. And since all apps so far seem to be using the  
readable names for folders in there, so do I.


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



What about using bundle ID as FS name and folder localization to  
change the displayed name to reflect application name.


com.mycompany.myapp/.localized/...

http://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/Articles/LocalizingPathnames.html#/ 
/apple_ref/doc/uid/20002141___


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

Please do not post admin requests or moderator comments to the list.
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: keystroke logger for Mac OS X

2008-10-13 Thread Jean-Daniel Dupas

Note that this technic will not be able to catch secured events:

http://developer.apple.com/technotes/tn2007/tn2150.html



Le 13 oct. 08 à 16:24, Dave DeLong a écrit :

Use a CGEventTap for the keystroke capturing, and the NSWorkspace  
class to get the info you need about the frontmost app.  Writing it  
to a file is trivial.


Dave

On Oct 13, 2008, at 5:16 AM, apple apple wrote:


I need to write a keystroke logger for Mac OS X. I am debating which
architecture to use. Can this be accomplished efficiently from user  
space or

would a KEXT be needed? It needs to be fast and efficient.

Ideally the logger will not impact system performance in any way.  
Also

ideally it should comply with the following:

- Runs under 10.5 and 10.4 would also be nice.


- Must log every keystroke typed to a file.


- Should capture the name of the app in which the keystrokes were  
typed.



- Should capture the title of the window in which the keystrokes  
are typed.



- Ideally the logger should use notifications rather than polling  
so that

the logger code only gets called when an actual keystroke happens.

Any ideas on what the best architecture would be to accomplish this?


Thanks

___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: how to complete c/s app

2008-10-15 Thread Jean-Daniel Dupas

Use Distributed Object, there is plenty of sample codes.

Le 15 oct. 08 à 12:43, han a écrit :


how to complete a c/s app.Is there a sample code?
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Decoding OSStatus values

2008-10-15 Thread Jean-Daniel Dupas


Le 15 oct. 08 à 16:49, Richard Dearlove a écrit :

Is there an easy way to decode the values from OSStatus.  I have  
this #define that I copied from another project but it isnt really  
helping..


This gives me an error such as  Error: \316\377\377\377

#define checkStatus( err) \
if(err) {\
printf(Error: %s -  %s: %d\n, (char *)err,__FILE__, __LINE__);\
fflush(stdout);\
return err; \
}

cheers
RD


An OSStatus is not an OSType (FourCharCode).

OSStatus can be any value and does not generaly contains readable  
characters.


To get an idea about what an OSStatus represent, you can use thoses 2  
functions (from CarbonCore):


const char* GetMacOSStatusErrorString(OSStatus err);
const char* GetMacOSStatusCommentString(OSStatus err);


___

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

Please do not post admin requests or moderator comments to the list.
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: Length of a filename

2008-10-16 Thread Jean-Daniel Dupas


Le 16 oct. 08 à 11:31, Gerriet M. Denkmann a écrit :



How can I check the appositeness of a filename?

This will not work:
if ( [potentialPath length]  255 )  ... error: filename too long
because HFS+ uses some decomposed form.

This might work:
if ( [[ NSString stringWithUTF8String: [potentialPath  
fileSystemRepresentation] ] length]  255 )  ...

but looks kind of convoluted and inefficient.

There are two methods in NSString:
decomposedStringWithCanonicalMapping
decomposedStringWithCompatibilityMapping
but the documentation does not say which (if any) should be used to  
convert a potentialPath into a form used in HFS+.


Kind regards,

Gerriet.


HFS use a special Unicode implementation with some bug or limitation  
that remains for compatibility.  That's why you should never try to


I think you can use this undocumented but public function to try to  
convert your string and check the result code:


OSStatus FSGetHFSUniStrFromString(CFStringRef str, HFSUniStr255  
*uniStr);


As NSString and CFString are toolfree bridged, just pass your string  
as first argument.


But it's probably not a good idea to check to path name youself except  
if you are sure your user target an HFS+ volume.







___

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

Please do not post admin requests or moderator comments to the list.
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: Screen not redrawing

2008-10-18 Thread Jean-Daniel Dupas

Le 18 oct. 08 à 05:50, Russ a écrit :


Check to make sure [window isFlushWindowDisabled] is NO and [window

isAutodisplay] is YES.

Yes, both OK.

Also, try dropping a standard control (e.g. a button) in and see if  
it

redraws to the pressed state when you press it.

When I do this programmatically after creating the main window's  
NSView, it scarfs up the bounding box of the succeeding views, not  
sure why that is.


NSButton *xtra = [[NSButton alloc]  
initWithFrame:NSMakeRect(0,0,100,20)];

[nuvu addSubview:xtra];


Try [NSWindow flushWindow] or flushWindowIfNeeded.


Had no effect. I think the window is already being flushed---  
drawRect is being called



Also note, from the NSView docs:
A view object can draw on-screen if it is not hidden, it is attached

to a view hierarchy in a window (NSWindow), and the window has a
corresponding window device. 

All 3 are confirmed OK (including isHiddenOrHasHiddenAncestor)

Still puzzled, but good set of questions.




My 2 cents. What is your window backing store type ? (What does  
[myWindow backingType] return).

Using something else than Buffered may cause serious redraw glitch.
It should never append in standard Cocoa App as most of the window are  
created in Inerface Builder which set buffered by default, but in your  
case, it look like all windows are created by your UI Toolkit.


___

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

Please do not post admin requests or moderator comments to the list.
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 do you use to make icons and similar?

2008-10-19 Thread Jean-Daniel Dupas

Le 19 oct. 08 à 11:20, Roland King a écrit :

I need a make a few icons and other graphics for my app, simple  
stuff like a small yellow triangle with an invisible background. I'm  
totally and completely graphically challenged which never helps. I  
can't find a simple (preferably free!) drawing program which will  
let me make stuff like this. What does everyone use for these things? 
___




There is Gimp. It can do whatever you need, but you may have to learn  
how to use it (this is not the most intuitive software I know).
If you need simple graphics, you can also use the free vetor graphic  
editor: inkscape.


What do you want to do with your images ? icns are mainly used for  
Desktop Icon, for other application images (toolbar, button, ..), you  
can use tiff that is far more versatile.
If you want to create icns, just create your images in a standard  
format (tiff, png, etc…) and then use Icon Composer (from the Xcode  
tools) to create the icns version.



___

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

Please do not post admin requests or moderator comments to the list.
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 do you use to make icons and similar?

2008-10-19 Thread Jean-Daniel Dupas


Le 19 oct. 08 à 16:32, John Joyce a écrit :


:


I believe png are really what I'm trying to make here, they seem
to be recommended.


PNGs are not resolution independent, although they are perfectly
acceptable. Saving as a TIFF then converting it to PDF with Preview
works well for me.


Please excuse me if I missed something earlier in the thread, but my
understanding of TIFFs (and PNGs and JPEGs) is that they're all
purely raster formats. Thus, how does saving a TIFF as a PDF get you
resolution independence? (At least that's what I read you to be  
saying.)


steve



It doesn't and it cannot. PDF is only a container, that happens to  
support vector art well, but cannot vectorize a raster image. If you  
properly placed some vector art into a pdf you might be able to  
garner some sort of resolution independence, but it's probably not  
worth the effort, and definitely won't look as good in most cases as  
well designed/optimized icons.
Until displays approach something like 300dpi or higher, like print  
media, our eyes will be better served by icons hand-tooled for  
particular sizes.


Your safest bet is to make use of PNG. It supports transparency. If  
you need something in .icns format, make use of Icon Composer.
As for drawing/painting apps, don't be cheap! If you don't have  
skill, pay somebody to do it.


unlike tiff, png does not support multi representations with different  
resolution which is the recommanded way to store raster images  
(vectorial images should be pdf of course).

So, PNG is not recommanded.

See this for details:

http://developer.apple.com/documentation/UserExperience/Conceptual/HiDPIOverview/HiDPIArt/chapter_4_section_5.html


___

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

Please do not post admin requests or moderator comments to the list.
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: Retain

2008-10-24 Thread Jean-Daniel Dupas

All answers you need are in this guide:

http://developer.apple.com/documentation/Cocoa/Conceptual/MemoryMgmt/Concepts/ObjectOwnership.html

Le 24 oct. 08 à 07:24, Ron Green a écrit :


If I call NSString w = [NSString stringWithFormat:@something %i, x];

Am I now suppose to call retain on w?
When I'm done I know I'm suppose to release w.
___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Apple Developer Forums

2008-10-25 Thread Jean-Daniel Dupas


Le 25 oct. 08 à 05:04, Stefan Arentz a écrit :

On Fri, Oct 24, 2008 at 12:15 PM, Randall Meadows [EMAIL PROTECTED] 
 wrote:

It looks like we're legit to discuss now!

http://devforums.apple.com/


Personally I think this is a big joke.

You need to be signed up as a paying developer to access the forum.

The forum is closed. It is not indexed by Google. You need to be
logged in to even read articles. What is up with that? I thought the
NDA was lifted.

The forum is moderated by Apple. Bad. I want to discuss anything. Not
having to worry about Apple the dictator closing my account because I
am saying things they don't want people to discuss.


aren't all [EMAIL PROTECTED] moderated by Apple ? Does it make them  
jokes or useless ?




___

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

Please do not post admin requests or moderator comments to the list.
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 check the number of pending events in the application event queue?

2008-10-27 Thread Jean-Daniel Dupas


Le 27 oct. 08 à 13:54, Oleg Krupnov a écrit :


In my app I'd like to perform some background task without affecting
the responsiveness of the UI. To avoid multi-threading, I just
postpone the task to a moment when the user becomes and stays idle for
a certain time.



Have you a good reason to avoid multi-threading ?

___

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

Please do not post admin requests or moderator comments to the list.
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: Not so long filenames

2008-10-28 Thread Jean-Daniel Dupas


Le 28 oct. 08 à 12:50, Gerriet M. Denkmann a écrit :



On 28 Oct 2008, at 01:39, Jeremy Pereira wrote:



On 26 Oct 2008, at 09:55, Gerriet M. Denkmann wrote:



On 26 Oct 2008, at 00:30, Postmaster wrote:



On 14 Oct 2008, at 21:00, Gerriet M. Denkmann wrote:



On 14 Oct 2008, at 18:07, Jason Coco wrote:



On Oct 14, 2008, at 11:28 , Gerriet M. Denkmann wrote:



HFS+ stores files in decomposed UTF-8.  Checking the system  
headers,
system headers is kind of vague: which file exactly do you have  
in mind?


it can store files with a maximum file name length of 255 bytes.   
How do you get 256 bytes of UTF-8 into 255 bytes?


Checking the system header hfs_format.h for HFSUniStr255 one sees  
that it can store file names with a maximum length of 255 u_int16_t.
And there is no real problem of putting the 128 shorts of Utf-16  
into 255 u_int16_t.


It's actually the VFS layer I was thinking of.  The OS X VFS uses  
UTF-8 (otherwise there would be no backward compatibility for calls  
like open(2) etc).  I got the 255 byte limit by looking at struct  
dirent defined in /usr/include/sys/dirent.h which is the structure  
used in the readdir syscall.


I have just tried getdirentries() which uses the dirent structure  
described in /usr/include/sys/dirent.h .


The result was (for me) quite a surprise.
What I did:
1. created a file in Desktop
2. renamed it in Finder to:  
 
.

(128 Utf-16 shorts, but 256 Utf-8 bytes).
3. ran getdirentries() and got:
file  
(255 
)ЀЀ 
#185D41
4. used open() and read() with this (seemingly garbled) filename -  
and it just works!


But open() and  fopen() also work with the real filename.

And: renaming a file in Finder with this (garbled) name does not  
work: Finder claims that this name is already in use. Which is not  
true: HFS+ has only the real filename stored.


No idea who does the translation between real filename and garbled  
version.


Very strange indeed.


Kind regards,

Gerriet.


This kind of transformation was already done when using long file name  
on OS 9 (where long mean more than 32 characters).
It was a mechanism used to workaround the limit imposed by the OS that  
was more strict that the HFS+ limit.

Look like this feature is always here.




___

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

Please do not post admin requests or moderator comments to the list.
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: Code signing validation

2008-10-28 Thread Jean-Daniel Dupas
You may fill a feature request to ask Apple to publish this API that  
is part of the Security Framework:


http://www.opensource.apple.com/darwinsource/10.5.5/libsecurity_codesigning-33803/lib/SecStaticCode.h



Le 28 oct. 08 à 10:36, [EMAIL PROTECTED] a écrit :


Hello list

Having implemented code signing for my app I wanted to be able to do  
a quick visual check that things were as they should be.
I used the following to display a code signing validation  message  
in the app About window for both the application bundle and a couple  
of auxiliary executables.


Has anyone else done anything similar, or hopefully, better?
It would probably be a good idea to also check the signing identity.


#import Cocoa/Cocoa.h

typedef enum {
CodesignUnrecognised = -2,
CodesignError = -1,
CodesignOkay = 0,
CodesignFail = 1,
CodesignInvalidArgs = 2,
CodesignFailedRequirement = 3,
} CodesignResult;

@interface MGSCodeSigning : NSObject {
NSString *_resultString;
}

@property (copy) NSString *resultString;

- (CodesignResult)validateExecutable;
- (CodesignResult)validatePath:(NSString *)path;
- (CodesignResult)validateApplication;

@end

#import MGSCodeSigning.h
#include dlfcn.h

@implementation MGSCodeSigning

@synthesize resultString = _resultString;

/*

validate executable

*/
- (CodesignResult)validateExecutable
{
   Dl_info info;
int errDlAddr = dladdr( (const void *)__func__, info );
   if(errDlAddr == 0) {
return CodesignError;
   }
char *exec_path = (char *)(info.dli_fname);

	NSString *path = [NSString stringWithCString:exec_path  
encoding:NSUTF8StringEncoding];

return [self validatePath:path];
}
/*

validate this application

*/
- (CodesignResult)validateApplication
{
return [self validatePath:[[NSBundle mainBundle] bundlePath]];
}
/*

validate path

*/
- (CodesignResult)validatePath:(NSString *)path
{
self.resultString = nil;
int status = CodesignError;

@try {
		NSArray *arguments = [NSArray arrayWithObjects: @--verify,  
path,  nil];

NSTask *task = [[NSTask alloc] init];

[task setArguments:arguments];
[task setLaunchPath:@/usr/bin/codesign];
[task setStandardOutput:[NSFileHandle 
fileHandleWithNullDevice]];   
[task setStandardError:[NSFileHandle 
fileHandleWithNullDevice]];
[task launch];
[task waitUntilExit];
status = [task terminationStatus];

switch (status) {
case CodesignOkay:
self.resultString = NSLocalizedString(@Valid, @Codesign  
okay.);

break;

case CodesignFail:
self.resultString = NSLocalizedString(@Invalid, @Codesign  
failed.);

break;

case CodesignInvalidArgs:
self.resultString = NSLocalizedString(@Invalid arguments,  
@Codesign invalid arguments);

break;

case CodesignFailedRequirement:
self.resultString = NSLocalizedString(@Failed requirement,  
@Codesign failed requirement.);

break;

default:
self.resultString = NSLocalizedString(@Unrecognised response,  
@Codesign unrecognised response.);

status = CodesignUnrecognised;
break;

}

if (status != CodesignOkay) {
NSLog(@codesign failure: %@, self.resultString);
}


[EMAIL PROTECTED] (NSException *e) {
NSLog(@Exception launching codesign: %@, [e reason]);
return CodesignError;
}

return status;
}

@end





___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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]


Path handling routines

2008-10-29 Thread Daniel Luis dos Santos

Hello,

Are there in the Foundation framework (or anywhere else on the Cocoa  
platform) path handling routines (directory extraction, path  
decomposition) ?


Cheers
___

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

Please do not post admin requests or moderator comments to the list.
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: Is there an equivalent to std::min/std::max for Cocoa programmer's

2008-10-29 Thread Jean-Daniel Dupas

MIN(), MAX() (from Foundation/NSObjCRuntime.h) ?


Le 29 oct. 08 à 18:26, Michael A. Crawford a écrit :


-Michael___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/devlists%40shadowlab.org

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: Customizing controls: Inheritance bad?

2008-10-30 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 16:51, Brian Williams a écrit :


Hello,



I'm brand new to Cocoa/Obj-C and I'm working on converting an app. to
use Cocoa...



I've heard that, in general, if you are using inheritance in Cocoa,
you're not following the typical standard design pattern.  Is this  
true?




To respond to special keyboard events in an NSTableView, I created a
subclass and provided an implementation for keyDown.

To draw some customized stuff in an NSColorWell, I created a subclass
and provided an implementation for drawRect.

Etc.



In the olden days, this kind of object-oriented approach was perfectly
correct.



And it's always perfectly correct. That's the way to do it.




But I'm told I should be using delegate methods and firstResponders
somehow.


Yes, use them when they provide a way to do what you need (and it's  
often the case), but they do not fit for some kind of customization  
(like custom drawing).





___

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

Please do not post admin requests or moderator comments to the list.
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: Type comparison warning

2008-10-30 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 19:01, Scott Ribe a écrit :


Not true, NSInteger and NSUInteger are typedefs for plain integer
types, *not* Objective-C objects.


Yes, yes, yes. Thanks for pointing that out. I'm not doing 10.5-only
development yet, so I read NSNumber because I'm not used to seeing
NSInteger anywhere.


NSInteger can safely be used for developpement that target any OS 10  
version (it is binary compatible with previous OS X version).


All my projects that target 10.4 already use NSInteger (and are 64  
bits safe).


___

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

Please do not post admin requests or moderator comments to the list.
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: Porting from Windows to Mac

2008-10-31 Thread Jean-Daniel Dupas


Le 30 oct. 08 à 23:49, Stefan Werner a écrit :



I would also recommend that you start over with the design of your  
GUI, for
the sensibilities and design principles of Mac OS X are very  
different. This

difference is exacerbated if you consider the age of MFC...


You are aware that MFC (1992) is younger than NextStep (1988)? ;-)
And if age is a criteria, we should always prefer Carbon over Posix.


Yes, but is older than the OpenStep specification (1993) that is the  
true ancestor of Cocoa.



___

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

Please do not post admin requests or moderator comments to the list.
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: Splitting model I/O for optimization

2008-11-01 Thread Jean-Daniel Dupas


Le 1 nov. 08 à 09:31, Oleg Krupnov a écrit :


In my app all model data are saved in a single file. For the purpose
of optimizing file I/O, I'm looking for a solution that would not
force me to resave the entire model when only a tiny bit of it has
changed, and also allow loading (fetching) the model only partially -
lazily upon request.

A solution for this problem could be saving different parts of the
model in different archive files using
NSKeyedArchiver/NSKeyedUnarchiver. However, this only works when there
are no cross-references between the parts of the model that need to be
saved. AFAIU, upon loading, any saved cross-reference would create a
new copy of the object that would not map to the same model object. Is
there a work around this problem?

Another solution that seems feasible is a kind of file mapping into
memory, i.e. there is a single large file but accessed randomly like
memory. However, I am not sure there is such thing in Cocoa and also
if it really gives any performance gain.


File mapping can be performed using standards libc functions, and you  
can also use -[NSData initWithContentsOfMappedFile:]
I don't know if it solve your problem, but with that, you will be able  
to perform some tests.


___

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

Please do not post admin requests or moderator comments to the list.
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: CGFloat and 64 Bit

2009-02-09 Thread Jean-Daniel Dupas


Le 9 févr. 09 à 06:37, Rob Keniger a écrit :



On 08/02/2009, at 9:52 PM, Gerriet M. Denkmann wrote:

When I build a Cocoa Project with 32/64 bit, this line gets a  
warning:

NSSize a = NSMakeSize( 11.2, 22.4);
which went away using:
NSSize a = NSMakeSize( (CGFloat)11.2, (CGFloat)22.4);
Is this the only and correct way to use NSMakeSize() ? Looks kind  
of ugly.



Try this:

NSSize a = NSMakeSize( 11.2f, 22.4f);

The f suffix is a hint to the compiler that it's a float value.


A very bad idea as it would force usage of float in 64bits  
applications where NSSize expect 64 bits CGFloat.


___

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

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

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

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


Re: CGFloat and 64 Bit

2009-02-09 Thread Jean-Daniel Dupas


Le 9 févr. 09 à 09:50, Rob Keniger a écrit :



On 09/02/2009, at 6:33 PM, Jean-Daniel Dupas wrote:


NSSize a = NSMakeSize( 11.2f, 22.4f);

The f suffix is a hint to the compiler that it's a float value.


A very bad idea as it would force usage of float in 64bits  
applications where NSSize expect 64 bits CGFloat.



So what is the recommendation for 64-bit development? Do we really  
have to litter our code with (CGFloat) casts all over the place, or  
is there some way we can tell the compiler to treat our floating  
point literals as float on 32-bit and double on 64-bit?


--
Rob Keniger



Which warning flag have you enabled to have this warning. I don't see  
it by default ?



___

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

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

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

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


Re: CGFloat and 64 Bit

2009-02-09 Thread Jean-Daniel Dupas


Le 9 févr. 09 à 10:14, Rob Keniger a écrit :



On 09/02/2009, at 7:07 PM, Jean-Daniel Dupas wrote:

Which warning flag have you enabled to have this warning. I don't  
see it by default ?



Hmm, I think it might be Implicit Conversion to 32 bit  
type (GCC_WARN_64_TO_32_BIT_CONVERSION).




IMHO, this flag is recommended only to compile 64 bits code. On 32  
bits arch, as you saw, most of the warnings are irrelevant.


GCC_WARN_64_TO_32_BIT_CONVERSION = NO
GCC_WARN_64_TO_32_BIT_CONVERSION[arch=*64] = YES

___

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

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

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

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


Re: CGFloat and 64 Bit

2009-02-09 Thread Jean-Daniel Dupas


Le 9 févr. 09 à 19:04, Sean McBride a écrit :


On 2/9/09 11:59 AM, Jean-Daniel Dupas said:


Hmm, I think it might be Implicit Conversion to 32 bit
type (GCC_WARN_64_TO_32_BIT_CONVERSION).


IMHO, this flag is recommended only to compile 64 bits code. On 32
bits arch, as you saw, most of the warnings are irrelevant.


I disagree.  It can help catch things like converting off_t and  
fpos_t to int.


I agree with the OP that CGFloat is very annoying in this respect.  My
solution has been to use the 'f' suffix for constants. Similarly,  
there

is no CGFloat version of sin() and other math functions.




You can use tgmath.h to let the compiler chooses sinf() on 32 bits  
platform and sin() on 64 bits platform.



___

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

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

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

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


Re: NSScreen order?

2009-02-10 Thread Jean-Daniel Dupas


Le 10 févr. 09 à 17:23, Michael Ash a écrit :

On Tue, Feb 10, 2009 at 10:31 AM, Jonathan Hendry  
jonhen...@mac.com wrote:
Is there any way to predict how the displays will be numbered? Or  
to force

the Mimo to be screen 3?

(I'd rather not add code to the app to account for my toy monitor.)


I realize this counts as adding code, but it seems to me that the best
solution would be to allow the user to choose which screen to show the
OpenGL stuff on. This will not only fix your problem but give more
choice to other users as well.

Mike


And you should present to the user, only the screens that support your  
required OpenGL Capabilities.



There is some tips about capability detection in the OpenGL  
programming guide


http://developer.apple.com/documentation/graphicsimaging/Conceptual/OpenGL-MacProgGuide/opengl_general/chapter_6_section_2.html

The sample use CGMainDisplayID, but you can also retreive the  
CGDirectDisplayID of each NSScreen from the NSScreen deviceDescription  
dictionary (this is the @NSScreenNumber key).




___

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

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

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

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


Re: Objective-C question

2009-02-10 Thread Jean-Daniel Dupas


Le 10 févr. 09 à 18:33, I. Savant a écrit :


On Tue, Feb 10, 2009 at 12:26 PM, Mike Abdullah
cocoa...@mikeabdullah.net wrote:
Read the documentation on -isKindOfClass: again. It does exactly  
what you

want. -isMemberOfClass: performs the more specific test of excluding
subclasses.


 In addition, a common gotcha (for me, anyway - it still gets me now
and again) is that you need to remember you're comparing instances
to classes with this method:

([value isKindOfClass:[NSString class]])

 ... not ...

([[value class] isKindOfClass:[NSString class]])

 The former is correct, the latter is what I sometimes find myself
doing (and of course it fails).


Just for the record, you can also compare class, but not with the  
isKindOfClass: method.


The method below is similar too ([value isKindOfClass:[NSString class]])

[[value class] isSubclassOfClass:[NSString class]]


___

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

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

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

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


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 11:43, Trygve Inda a écrit :


I call

ProcessInformationCopyDictionary
(psn, kProcessDictionaryIncludeAllInformationMask);

but if the application has moved since it was launched, the result  
of this
call in the CFBundleExecutable and BundlePath keys is wrong. The  
values

contain the original location of the application.

So...
NSString *bundlePath = [dict objectForKey:@BundlePath];
if (bundlePath)
{
  bundle = [NSBundle bundleWithPath:bundlePath];
}

Does not work.

How can I get the real current location of a file from the Process  
Serial

Number?

I need to do this because my app is a system pref pane and when one  
installs

a pref pane over the top of an existing one, the existing one is
automatically moved to a tmp location by System Preferences. I need to
determine if the running helper app is a different version form the  
one

being installed... And need to get at the help app's bundle.

I suppose I could assume that if I can't obtain a real location for  
the

running helper app, that it has been moved and I should send a quit
AppleEvent to it, but this doesn't seem like the best way.

Any ideas?

Thanks,

Trygve




I think it exists a standard Apple Event to retrieve a process  
version. (get «vers»)


But you can also add a custom get version Apple Event handler to  
your helper and use it to retrieve the version from your pref pane.






___

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

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

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

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


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 12:54, Trygve Inda a écrit :




I think it exists a standard Apple Event to retrieve a process
version. (get «vers»)

But you can also add a custom get version Apple Event handler to
your helper and use it to retrieve the version from your pref pane.



Hmmm... It seems keyAEVersion ('vers') only gets the version info  
for the

Apple Event Manager, not the target process.

Trygve



Using AppleScript, you can test what it returns.

tell app your application to get version

AFAK, it just sends a get vers event.

___

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

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

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

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


Re: ProcessInformationCopyDictionary

2009-02-11 Thread Jean-Daniel Dupas


Le 11 févr. 09 à 12:46, Trygve Inda a écrit :





I think it exists a standard Apple Event to retrieve a process
version. (get «vers»)

But you can also add a custom get version Apple Event handler to
your helper and use it to retrieve the version from your pref pane.


This works great for future versions, but not existing ones. I'll  
look at

the AE vers.



If the helper app does not respond to your get version request, so you  
can assume it is an older version than the one installed.



___

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

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

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

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


Re: newbie question on creating .png files

2009-02-12 Thread Jean-Daniel Dupas


Le 12 févr. 09 à 16:31, Smith, Steven (MCP) a écrit :


Hi folks,

I'm relatively new to Cocoa and need some direction on creating .png  
files.

I need to create 365 png files (one for each day of the year)
to be used as tags by other folks (eg JAN01.png  
JAN2.png...DEC31.png).


I think I understand the draw/graphics concept, but I've been unable  
to get
clear direction on how to transform(aka create) the picture to  
48x48 .png files.


I'm not looking for code (its welcome of course), but a direction on  
the 'bridge'

between create/displaying an image and saving it to a file.

Thanks in advance,



All drawing code require a valid graphic context.
When you draw on screen (in an NSView for example), the framework  
setups a valid 'on screen' context before calling the drawRect: method.


If you want to draw into an image, you just have to setup a graphic  
context on an image, and call your drawing code.


A simple way to do this it to create an NSImage, and then using  
lockFocus, you can get a graphics context to draw in this image (just  
like you draw on screen).


Conceptually:

NSImage *img = [[NSImage alloc] initWithSize:48, 48];
[img lockFocus];

// you drawing code goes here

[img unlockFocus]

// Now, you can save your image using standard NSImage functions.

Unfortunately, I don't think you can save an NSImage as a PNG (it only  
supports the TIFFRepresentation method).



To have a greater control over the output format, you have to create a  
bitmap (NSBitmapImageRep)


And so, you will have a chance to use the longuest Cocoa method name:

- (id)initWithBitmapDataPlanes:(unsigned char **)planes pixelsWide: 
(NSInteger)width pixelsHigh:(NSInteger)height bitsPerSample: 
(NSInteger)bpssamplesPerPixel:(NSInteger)spp hasAlpha:(BOOL)alpha  
isPlanar:(BOOL)isPlanar colorSpaceName:(NSString *)colorSpaceName  
bitmapFormat:(NSBitmapFormat)bitmapFormatbytesPerRow: 
(NSInteger)rowBytes bitsPerPixel:(NSInteger)pixelBits


Create your image rep using this method.
create a graphics context using +[NSGraphicsContext  
graphicsContextWithBitmapImageRep:]


Save the current graphic state +[NSGraphicsContext saveGraphicsState]
Set your new context as the current context [NSGraphicsContext  
setCurrentContext:myContext];


Call your drawing function.

restore the graphic state +[NSGraphicContext restoreGraphicsState];

And now, your bitmap image is ready to be saved (using  
representationUsingType:).




___

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

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

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

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


Re: NSRunLoop / CFRunLoop

2009-02-13 Thread Jean-Daniel Dupas


Le 13 févr. 09 à 21:54, Alexander Cohen a écrit :


Hi,

Not sure if this is the right place to ask since my question is  
about CFRunLoop, not Cocoa but CoreFoundation. If not, please direct  
me to the right list.


I'm looking for a way to get the main CFRunLoop on tiger. On  
leopard, there is a simple call for it but i'm stuck with tiger for  
now. And while i'm at it, i'd like to do something like [obj  
performSelectorOnMainThread...] in CoreFoundation using CFRunLoops.  
I'm sure it's possible but i'm not sure where to start.


thx


To get the main runloop, you can save it in a global variable at  
program startup, and return it when requested.


There is no easy way to mimic performSelectorOnMainThread: as there is  
no easy way to serialize a function call (unlike in Cocoa where you  
can easily serialize a method call using NSInvocation to send it on  
the main thread).


To do inter-thread messaging using only low-level frameworks, you are  
stuck with the traditional facilities (socket, pipes, etc.)


Just by curiosity, what prevent you to use the Foundation framework ?

___

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

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

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

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


Re: Getting better compression

2009-02-16 Thread Jean-Daniel Dupas


Le 16 févr. 09 à 10:51, Graham Cox a écrit :

I have a script that runs during my distribution build that  
compresses my app using zip. If I use the Finder's Compress  
command I get almost twice as much compression. Isn't the Finder  
using zip? If so, what command-line arguments would give me better  
compression that what I am getting (the script runs 'zip -qr'). If  
the Finder is using something else, can I use the something else  
in my script? If so, can somebody point me to some docs on how to do  
that...




man zip ?

-# Regulate  the  speed  of compression using the specified digit  
#, where -0 indicates no compression (store all files), -1 indicates  
the fastest com-
  pression method (less compression) and -9 indicates the  
slowest compression method (optimal compression, ignores the suffix  
list). The default  com-

  pression level is -6.


___

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

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

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

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


Re: Getting better compression

2009-02-16 Thread Jean-Daniel Dupas


Le 16 févr. 09 à 11:53, Graham Cox a écrit :



On 16 Feb 2009, at 9:48 pm, Jean-Daniel Dupas wrote:


man zip ?

-# Regulate  the  speed  of compression using the specified  
digit #, where -0 indicates no compression (store all files), -1  
indicates the fastest com-
pression method (less compression) and -9 indicates the  
slowest compression method (optimal compression, ignores the suffix  
list). The default  com-

pression level is -6.



I did look there first thing. I don't see that option or that text.

http://developer.apple.com/documentation/Darwin/Reference/ManPages/man1/zip.1.html



It is. Just before the example section. (fourth option from the bottom).

Search for Regulate the speed of compression in the page.


___

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

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

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

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


Re: Getting better compression

2009-02-16 Thread Jean-Daniel Dupas


Le 16 févr. 09 à 11:57, Graham Cox a écrit :



On 16 Feb 2009, at 9:53 pm, Graham Cox wrote:


man zip ?

-# Regulate  the  speed  of compression using the specified  
digit #, where -0 indicates no compression (store all files), -1  
indicates the fastest com-
   pression method (less compression) and -9 indicates the  
slowest compression method (optimal compression, ignores the  
suffix list). The default  com-

   pression level is -6.



I did look there first thing. I don't see that option or that text.



I tried it anyway - it slightly improves things, but nowhere near  
the extent that I get with Finder Compress.


e.g.

original:   9.6M
zip script: 6.9M (with -9, with default I get 7.3M)
Finder compress 3.4M


I think by default zip compresses symlink target instead of the link  
itself. If you have frameworks in your package, it's possible that zip  
duplicates you frameworks' headers, executables, and resources.


See the -y option:

-y Store symbolic links as such in the zip archive, instead of  
compressing and storing the file referred to by the link (UNIX only).



___

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

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

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

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


Re: NSTimer Question

2009-02-16 Thread Jean-Daniel Dupas


Le 16 févr. 09 à 13:44, Andreas Grosam a écrit :


Hello,


how does a NSTimer object that has been setup with a repeating time  
interval calculate the time when it fires an event?


There may be two possibilities:
Say, the initial time is at t0, the interval is T, and the time when  
it fires the first event is at t1, the second at t2, etc.

The time when it fires the ith event will be ti:
A)
ti = t (i-1) + T

B)
ti = i * T + t0


Reason:
If I need a tick that corresponds to a current time, I would  
prefer method B (mean error remains stable).
In case A the firing time may fade away with respect to the initial  
time due to inherent inaccuracies. Although this error is certainly  
small compared to the error that we have when we measure the time  
when we actually do handle the event, but it may accumulate over a  
long duration. That is the error increases with time.


The class overview in the NSTimer reference page adresses this topic  
in a detailed way.


A repeating timer reschedules itself based on the scheduled firing  
time, not the actual firing time. For example, if a timer is scheduled  
to fire at a particular time and every 5 seconds after that, the  
scheduled firing time will always fall on the original 5 second time  
intervals, even if the actual firing time gets delayed. If the firing  
time is delayed so far that it passes one or more of the scheduled  
firing times, the timer is fired only once for that time period; the  
timer is then rescheduled, after firing, for the next scheduled firing  
time in the future.



___

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

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

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

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


<    3   4   5   6   7   8   9   10   11   12   >