Re: Is there a known bug in NSUrl?

2009-02-18 Thread Sherm Pendley
On Wed, Feb 18, 2009 at 12:00 AM, Robert Nicholson <
robert.nichol...@gmail.com> wrote:

> So, I often see this same behavior in Safari, iTunes etc whereby when it's
> downloading something and you try to resume. It simply will not resume or
> will say timeout _until_ you remove the file and start again. In iTunes the
> progress bar simply will not show any more progress until the previous
> partially downloaded file is removed.   I've seen this in Software Update as
> well where you'll have to go in it's cache to delete partially downloaded
> updates or it will never resume from where it's left off.
>
> The fact that I see these across so many apps tells me its possibly a
> framework issue.
>
> Anybody seen this behaviour on their machines?


I've seen it, but I wouldn't be so quick to assume it's a bug in NSURL -
resumed downloads requires a cooperative web server that understands and
responds appropriately to the HTTP Range: header. Also, with ADC downloads
for instance, your session key is part of the URL, so if your session times
out what you'll actually be requesting is a different URL, not a resumed
download of the same URL.

I'm not saying it *isn't* a bug - just that there are other possible
explanations, and I haven't seen any evidence to support one theory or
another.

sherm--

-- 
Cocoa programming in Perl: http://camelbones.sourceforge.net
___

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

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

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

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


Re: Trying to open a file

2009-02-18 Thread Ken Thomases

On Feb 18, 2009, at 1:15 AM, Christian Graus wrote:

I will look to see what fileURLWithPath returns tho, b/c the string  
is the
same as it was the last time I ran this, but last time it worked  
( the code

has not changed, so I am mystified )


It may have worked, but it is not a generally correct thing to do.  A  
file path may contain characters that a URL may not, like a space.   
So, taking a file path and prepending file:// does not necessarily  
make it a valid URL string.


It may be that an update to the system frameworks tightened up the  
validation of URL strings passed to -[NSURL initWithString:], causing  
something which used to work to now fail.  Such validation tightening  
is typical of security updates.


Cheers,
Ken

___

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

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

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

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


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-18 Thread Kyle Sluder
On Wed, Feb 18, 2009 at 1:52 AM, Jeff Johnson
 wrote:
> That's an odd request, because doesn't it make more sense to install to
> /Applications if the app is running from /Volumes/MyDMG rather than from
> ~/Downloads? :-) Indeed, one of the reasons to switch from dmg to zip
> distribution is that the app disappears when the dmg is unmounted.

Not if you use an internet-enabled DMG.  And I don't want my
applications trying to install themselves in /Applications; I have
apps installed in ~/Applications or other places on my network home
folder at work.

--Kyle Sluder
___

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

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

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

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


Re: NSMailDelivery API

2009-02-18 Thread Torsten Curdt
> I think I asked for an alternative to NSMailDelivery here before
> and someone recommended EDMessage. I looked into it, but for reasons I can't
> remember, it proved unsuitable.

What reasons could that be? Maybe because you need the SMTP server?
You can extract it from the Mail.app config if available. But in
general it's fair to assume that if that is a problem you are using
the wrong transport. That's for example the reason why
FeedbackReporter ( http://vafer.org/projects/feedbackreporter/ )
doesn't use mail but a HTTP connection to send the data and then the
server sends an email.

Just a thought

cheers
--
Torsten
___

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

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

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

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


Converting .wav files to MP3

2009-02-18 Thread Anshul jain
I am trying to convert the .wav files to MP3. I have tried to google  
it. I found a framework called LAME. but i don't know to use it. Can  
anybody help me out.


Thanks!
Anshul





___

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

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

2009-02-18 Thread Christian Graus
Ah - thanks for the explanation, I bet that's why it worked for me before
and not later when the path I selected, changed.  The space will be it, this
code worked 4 days ago and I've not done any updates.

On Wed, Feb 18, 2009 at 8:10 PM, Ken Thomases  wrote:

> On Feb 18, 2009, at 1:15 AM, Christian Graus wrote:
>
>  I will look to see what fileURLWithPath returns tho, b/c the string is the
>> same as it was the last time I ran this, but last time it worked ( the
>> code
>> has not changed, so I am mystified )
>>
>
> It may have worked, but it is not a generally correct thing to do.  A file
> path may contain characters that a URL may not, like a space.  So, taking a
> file path and prepending file:// does not necessarily make it a valid URL
> string.
>
> It may be that an update to the system frameworks tightened up the
> validation of URL strings passed to -[NSURL initWithString:], causing
> something which used to work to now fail.  Such validation tightening is
> typical of security updates.
>
> Cheers,
> Ken
>
>
___

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

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

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

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


Re: Converting .wav files to MP3

2009-02-18 Thread Mike Abdullah

You almost certainly want QTKit. Read up on it in the documentation.

On 18 Feb 2009, at 09:36, Anshul jain wrote:

I am trying to convert the .wav files to MP3. I have tried to google  
it. I found a framework called LAME. but i don't know to use it. Can  
anybody help me out.


Thanks!
Anshul





___

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

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

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

This email sent to cocoa...@mikeabdullah.net


___

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

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

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

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


Re: Converting .wav files to MP3

2009-02-18 Thread Anshul jain

Thanks Mike,
 But i need this for the IPhone. and as far i know IPhone does not  
support QTKit.

Is there any alternative.

On 18-Feb-09, at 3:13 PM, Mike Abdullah wrote:


You almost certainly want QTKit. Read up on it in the documentation.

On 18 Feb 2009, at 09:36, Anshul jain wrote:

I am trying to convert the .wav files to MP3. I have tried to  
google it. I found a framework called LAME. but i don't know to use  
it. Can anybody help me out.


Thanks!
Anshul





___

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

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

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

This email sent to cocoa...@mikeabdullah.net





Thanks & Regards

Anshul jain
anshul.j...@prithvisolutions.com





___

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

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

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

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


Re: Converting .wav files to MP3

2009-02-18 Thread Mike Abdullah
Um, perhaps you should have mentioned this originally? Besides, this  
list isn't really the best place. For iPhone stuff, head over to the  
Apple Developer Forums https://devforums.apple.com/login.jspa


On 18 Feb 2009, at 09:50, Anshul jain wrote:


Thanks Mike,
 But i need this for the IPhone. and as far i know IPhone does not  
support QTKit.

Is there any alternative.

On 18-Feb-09, at 3:13 PM, Mike Abdullah wrote:


You almost certainly want QTKit. Read up on it in the documentation.

On 18 Feb 2009, at 09:36, Anshul jain wrote:

I am trying to convert the .wav files to MP3. I have tried to  
google it. I found a framework called LAME. but i don't know to  
use it. Can anybody help me out.


Thanks!
Anshul





___

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

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

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

This email sent to cocoa...@mikeabdullah.net





Thanks & Regards

Anshul jain
anshul.j...@prithvisolutions.com







___

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

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

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

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


Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
Hi,

I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing because
this particular C++ method puts a huge amount of data on the stack.  I
am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
is responsible for doing one thing only: calling the go() method on an
instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts or an
array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++ method?

Thanks,
Leo

 TestOperation.h /
#import 

class TestOperationImpl {
private:
bool cancelled;
public:
TestOperationImpl();
void go();
void cancel();
};

@interface TestOperation : NSOperation {
TestOperationImpl* testOpImpl;
}
- initWithController: (TestOperationController*) controller;
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

TestOperationImpl::TestOperationImpl(TestOperationController* controller)
: cancelled(false)
{
}

void TestOperationImpl::go()
{
int bigArray[256000];

for (int j = 0 ; j < 256000 && !cancelled ; j ++)
{
bigArray[j] = 2*j;
}
}

void TestOperationImpl::cancel()
{
cancelled = true;
}

@implementation TestOperation
- initWithController: (TestOperationController*) ctrl
{
if (self = [self init])
testOpImpl = new TestOperationImpl(ctrl);
controller = ctrl;
return self;
}
- (void) dealloc
{
delete testOpImpl;
[super dealloc];
}
- (void) cancel
{
testOpImpl->cancel();
[super cancel];
}
- (void) main
{
testOpImpl->go();
}
@end

 End of TestOperation.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 arch...@mail-archive.com


Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
Actually, if the big array and the loop are moved from the C++ method
into the Objective C selector - (void) main then the same
EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
following source code still exhibits the same problem:

 TestOperation.h /
#import 

@interface TestOperation : NSOperation {
}
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

@implementation TestOperation
- (void) main
{
   int bigArray[256000];

   for (int j = 0 ; j < 256000 && ![self isCancelled] ; j ++)
   {
   bigArray[j] = 2*j;
   }
}
@end

 End of TestOperation.mm /

On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer  wrote:
> Hi,
>
> I have a C++ method that I am invoking from within the - (void) main
> selector of an NSOperation.  My Cocoa application is crashing because
> this particular C++ method puts a huge amount of data on the stack.  I
> am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
> works fine if I call it from within a command line C++ program.
>
> I have contrived some sample code to illustrate the problem.
> TestOperation is an (Objective C) subclass of NSOperation; I am
> running the NSOperation in a separate thread by putting it into an
> NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
> is responsible for doing one thing only: calling the go() method on an
> instance of TestOperationImpl.
>
> Note the very large array of ints that is declared inside
> TestOperationImpl::go().  If it is changed to an array of shorts or an
> array of chars, then this example code works fine, no EXEC_BAD_ACCESS.
>
> Is there any way for me to give my application more memory, or at
> least give more memory to the thread that is running this C++ method?
>
> Thanks,
> Leo
>
>  TestOperation.h /
> #import 
>
> class TestOperationImpl {
> private:
>bool cancelled;
> public:
>TestOperationImpl();
>void go();
>void cancel();
> };
>
> @interface TestOperation : NSOperation {
>TestOperationImpl* testOpImpl;
> }
> - initWithController: (TestOperationController*) controller;
> @end
>
>  End of TestOperation.h /
>
>  TestOperation.mm /
> #import "TestOperation.h"
>
> TestOperationImpl::TestOperationImpl(TestOperationController* controller)
> : cancelled(false)
> {
> }
>
> void TestOperationImpl::go()
> {
>int bigArray[256000];
>
>for (int j = 0 ; j < 256000 && !cancelled ; j ++)
>{
>bigArray[j] = 2*j;
>}
> }
>
> void TestOperationImpl::cancel()
> {
>cancelled = true;
> }
>
> @implementation TestOperation
> - initWithController: (TestOperationController*) ctrl
> {
>if (self = [self init])
>testOpImpl = new TestOperationImpl(ctrl);
>controller = ctrl;
>return self;
> }
> - (void) dealloc
> {
>delete testOpImpl;
>[super dealloc];
> }
> - (void) cancel
> {
>testOpImpl->cancel();
>[super cancel];
> }
> - (void) main
> {
>testOpImpl->go();
> }
> @end
>
>  End of TestOperation.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 arch...@mail-archive.com


Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Leo Singer
OK, so there is a way to change the size of the stack for an NSThread.
 But how do I do this for an NSOperationQueue?

NSThread has the following selector:
- (void) setStackSize:(NSInteger)s;

I need to find the equivalent selector for NSOperationQueue.  Any
ideas out there?

Leo

#import 

@interface MemoryTortureController : NSObject {
}
- (IBAction)memoryTortureBackground: (id) sender;
- (IBAction)memoryTorture: (id) sender;
@end

@implementation MemoryTortureController
- (IBAction)memoryTortureBackground: (id) sender
{
NSThread* thread;

thread = [[NSThread alloc] initWithTarget: self
 selector: @selector(memoryTorture:)
   object: sender];

// The magic line
[thread setStackSize:256000*8];

[thread start];
}
- (IBAction)memoryTorture: (id) sender
{
int bigmem[256000];
for (int i = 0 ; i < 256000 ; i ++)
bigmem[i] = 2*i;
}
@end



On Wed, Feb 18, 2009 at 3:31 AM, Leo Singer  wrote:
> Actually, if the big array and the loop are moved from the C++ method
> into the Objective C selector - (void) main then the same
> EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
> following source code still exhibits the same problem:
>
>  TestOperation.h /
> #import 
>
> @interface TestOperation : NSOperation {
> }
> @end
>
>  End of TestOperation.h /
>
>  TestOperation.mm /
> #import "TestOperation.h"
>
> @implementation TestOperation
> - (void) main
> {
>   int bigArray[256000];
>
>   for (int j = 0 ; j < 256000 && ![self isCancelled] ; j ++)
>   {
>   bigArray[j] = 2*j;
>   }
> }
> @end
>
>  End of TestOperation.mm /
>
> On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer  wrote:
>> Hi,
>>
>> I have a C++ method that I am invoking from within the - (void) main
>> selector of an NSOperation.  My Cocoa application is crashing because
>> this particular C++ method puts a huge amount of data on the stack.  I
>> am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
>> works fine if I call it from within a command line C++ program.
>>
>> I have contrived some sample code to illustrate the problem.
>> TestOperation is an (Objective C) subclass of NSOperation; I am
>> running the NSOperation in a separate thread by putting it into an
>> NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
>> is responsible for doing one thing only: calling the go() method on an
>> instance of TestOperationImpl.
>>
>> Note the very large array of ints that is declared inside
>> TestOperationImpl::go().  If it is changed to an array of shorts or an
>> array of chars, then this example code works fine, no EXEC_BAD_ACCESS.
>>
>> Is there any way for me to give my application more memory, or at
>> least give more memory to the thread that is running this C++ method?
>>
>> Thanks,
>> Leo
>>
>>  TestOperation.h /
>> #import 
>>
>> class TestOperationImpl {
>> private:
>>bool cancelled;
>> public:
>>TestOperationImpl();
>>void go();
>>void cancel();
>> };
>>
>> @interface TestOperation : NSOperation {
>>TestOperationImpl* testOpImpl;
>> }
>> - initWithController: (TestOperationController*) controller;
>> @end
>>
>>  End of TestOperation.h /
>>
>>  TestOperation.mm /
>> #import "TestOperation.h"
>>
>> TestOperationImpl::TestOperationImpl(TestOperationController* controller)
>> : cancelled(false)
>> {
>> }
>>
>> void TestOperationImpl::go()
>> {
>>int bigArray[256000];
>>
>>for (int j = 0 ; j < 256000 && !cancelled ; j ++)
>>{
>>bigArray[j] = 2*j;
>>}
>> }
>>
>> void TestOperationImpl::cancel()
>> {
>>cancelled = true;
>> }
>>
>> @implementation TestOperation
>> - initWithController: (TestOperationController*) ctrl
>> {
>>if (self = [self init])
>>testOpImpl = new TestOperationImpl(ctrl);
>>controller = ctrl;
>>return self;
>> }
>> - (void) dealloc
>> {
>>delete testOpImpl;
>>[super dealloc];
>> }
>> - (void) cancel
>> {
>>testOpImpl->cancel();
>>[super cancel];
>> }
>> - (void) main
>> {
>>testOpImpl->go();
>> }
>> @end
>>
>>  End of TestOperation.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 arch...@mail-archive.com


Re: Converting .wav files to MP3

2009-02-18 Thread Jean-Daniel Dupas
QuickTime (and OS X) does not provide an MP3 encoder (for licensing  
issue).

The only provided Mac OS X MP3 encoder is iTunes.


Le 18 févr. 09 à 10:43, Mike Abdullah a écrit :


You almost certainly want QTKit. Read up on it in the documentation.

On 18 Feb 2009, at 09:36, Anshul jain wrote:

I am trying to convert the .wav files to MP3. I have tried to  
google it. I found a framework called LAME. but i don't know to use  
it. Can anybody help me out.


Thanks!
Anshul





___

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

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

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

This email sent to cocoa...@mikeabdullah.net


___

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

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

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

This email sent to devli...@shadowlab.org



___

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

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

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

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


Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Mike Abdullah

Would this work?

- (void)main
{
[[NSThread currentThread] setStackSize:stackSize];

// Do usual work
}

Actually, with a bit more reading, apparently not. You'd need to set  
the stack size before starting the thread, not after. In which case  
your only option is to subclass NSOperation to create a custom  
concurrent operation which creates its own special thread.


However, I can't help thinking that there's probably a better way to  
achieve the desired result of the code without playing around like this.


On 18 Feb 2009, at 08:52, Leo Singer wrote:


OK, so there is a way to change the size of the stack for an NSThread.
But how do I do this for an NSOperationQueue?

NSThread has the following selector:
- (void) setStackSize:(NSInteger)s;

I need to find the equivalent selector for NSOperationQueue.  Any
ideas out there?

Leo

#import 

@interface MemoryTortureController : NSObject {
}
- (IBAction)memoryTortureBackground: (id) sender;
- (IBAction)memoryTorture: (id) sender;
@end

@implementation MemoryTortureController
- (IBAction)memoryTortureBackground: (id) sender
{
   NSThread* thread;

   thread = [[NSThread alloc] initWithTarget: self
selector:  
@selector(memoryTorture:)

  object: sender];

   // The magic line
   [thread setStackSize:256000*8];

   [thread start];
}
- (IBAction)memoryTorture: (id) sender
{
   int bigmem[256000];
   for (int i = 0 ; i < 256000 ; i ++)
   bigmem[i] = 2*i;
}
@end



On Wed, Feb 18, 2009 at 3:31 AM, Leo Singer   
wrote:

Actually, if the big array and the loop are moved from the C++ method
into the Objective C selector - (void) main then the same
EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
following source code still exhibits the same problem:

 TestOperation.h /
#import 

@interface TestOperation : NSOperation {
}
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

@implementation TestOperation
- (void) main
{
 int bigArray[256000];

 for (int j = 0 ; j < 256000 && ![self isCancelled] ; j ++)
 {
 bigArray[j] = 2*j;
 }
}
@end

 End of TestOperation.mm /

On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer   
wrote:

Hi,

I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing  
because
this particular C++ method puts a huge amount of data on the  
stack.  I

am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The  
NSOperation
is responsible for doing one thing only: calling the go() method  
on an

instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts  
or an
array of chars, then this example code works fine, no  
EXEC_BAD_ACCESS.


Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++  
method?


Thanks,
Leo

 TestOperation.h /
#import 

class TestOperationImpl {
private:
  bool cancelled;
public:
  TestOperationImpl();
  void go();
  void cancel();
};

@interface TestOperation : NSOperation {
  TestOperationImpl* testOpImpl;
}
- initWithController: (TestOperationController*) controller;
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

TestOperationImpl::TestOperationImpl(TestOperationController*  
controller)

: cancelled(false)
{
}

void TestOperationImpl::go()
{
  int bigArray[256000];

  for (int j = 0 ; j < 256000 && !cancelled ; j ++)
  {
  bigArray[j] = 2*j;
  }
}

void TestOperationImpl::cancel()
{
  cancelled = true;
}

@implementation TestOperation
- initWithController: (TestOperationController*) ctrl
{
  if (self = [self init])
  testOpImpl = new TestOperationImpl(ctrl);
  controller = ctrl;
  return self;
}
- (void) dealloc
{
  delete testOpImpl;
  [super dealloc];
}
- (void) cancel
{
  testOpImpl->cancel();
  [super cancel];
}
- (void) main
{
  testOpImpl->go();
}
@end

 End of TestOperation.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/coc

Re: display unicode string one character at a time, not at simple as it seems

2009-02-18 Thread Gerriet M. Denkmann


On 18 Feb 2009, at 14:18, mathew davis   
wrote:


ideally I'd like to break the string in to:

the smallest possible segments which do not need to horizontally
overlap when displayed in order to make sense to a reader.

so the composed character sequence:
g̈
U+0067 ( g ) latin small letter g
U+0308 ( ̈ ) combining diaeresis
would need to be one substring because the glyphs overlap horizontally
rangeOfComposedCharacterSequenceAtIndex sees this as one composed  
character. Just like you require.




the composed character sequence in Thai:
เก

(adj. mischievous)


U+0E40 ( เ ) thai character sara e
U+0E01 ( ก ) thai character ko kai

would ideally be broken into two substrings
rangeOfComposedCharacterSequenceAtIndex sees this as two composed  
characters.
ฺีBut why do you call it a composed character sequence? It is just  
a vowel + consonant.




but:
 กึ
would have to be one substring
rangeOfComposedCharacterSequenceAtIndex sees this as one composed  
character.


In Thai you can get composed character sequences that look a bit like
เกอะ


I do not think that this is a composed character. "เถอะ" which  
looks similar (but is a real word) is broken into 4 chars (just as you  
want it) by rangeOfComposedCharacterSequenceAtIndex.



At the moment i'm using rangeOfComposedCharacterSequenceAtIndex.
And if a sequence is too wide for my tile I scale it down.
Do you have an example where the result of  
rangeOfComposedCharacterSequenceAtIndex is too wide?



Kind regards,

Gerriet.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Michael Vannorsdel
Really it would be best to malloc the space, use it, and free it.   
Once you get to huge stack usage you gamble that you won't run out  
when there can be other higher up calls also consuming some  
(frameworks, libs, 3rd party code, ect).  Also if you only use the  
large amount once in a while then you have a bunch of unutilized  
memory sitting around.


In your test NSOperation's setup calls probably use just enough stack  
space to make your block run short.  It also doesn't help secondary  
threads usually have smaller stack sizes.


void TestOperationImpl::go()
{
   int * bigArray = malloc(sizeof(int) * 256000);

   for (int j = 0 ; j < 256000 && !cancelled ; j ++)
   {
   bigArray[j] = 2*j;
   }

  free(bigArray);
}



On Feb 18, 2009, at 1:16 AM, Leo Singer wrote:


I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing because
this particular C++ method puts a huge amount of data on the stack.  I
am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
is responsible for doing one thing only: calling the go() method on an
instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts or an
array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++ 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 arch...@mail-archive.com


Re: Moving oneself to /Applications (or ~/Applications)

2009-02-18 Thread Gregory Weston

Ben Lachman wrote:


I'm wanting to move away from DMGs to ZIP delivery.  As part of this
move I'd like to have my app, SousChef, prompt the user on first run
to move itself to /Applications (or ~/Applications as appropriate).
In a short search I can't find any code examples hanging about to do
something like this.  Would anyone mind sharing ideas/code on how to
do this?


If your application *needs* to run from /Applications, then I'd say:
1. You really need to revisit whatever aspect of your implementation  
is requiring that.
2. You should use an installer package, which is Apple's general  
recommendation for software distribution now anyway.


If your application doesn't need to run from /Applications, then don't  
worry about 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 arch...@mail-archive.com


Re: Is there a known bug in NSUrl?

2009-02-18 Thread Robert Nicholson
In the cases where I see this occur I'd say that the time from start  
to first resume attempt is less than 30 minutes. I do not believe it  
could be related to session timeouts. Secondly, in my mind it's a bug  
if the application simply refuses to continue. Often what you see is  
if it cannot continue / resume it will start again. I'm not seeing  
that I'm seeing it literally go no where when it sees that it cannot  
resume and only if I go out of your way to delete the file will it  
make any form of progress by starting again.


On Feb 18, 2009, at 2:22 AM, Sherm Pendley wrote:

On Wed, Feb 18, 2009 at 12:00 AM, Robert Nicholson > wrote:
So, I often see this same behavior in Safari, iTunes etc whereby  
when it's downloading something and you try to resume. It simply  
will not resume or will say timeout _until_ you remove the file and  
start again. In iTunes the progress bar simply will not show any  
more progress until the previous partially downloaded file is  
removed.   I've seen this in Software Update as well where you'll  
have to go in it's cache to delete partially downloaded updates or  
it will never resume from where it's left off.


The fact that I see these across so many apps tells me its possibly  
a framework issue.


Anybody seen this behaviour on their machines?

I've seen it, but I wouldn't be so quick to assume it's a bug in  
NSURL - resumed downloads requires a cooperative web server that  
understands and responds appropriately to the HTTP Range: header.  
Also, with ADC downloads for instance, your session key is part of  
the URL, so if your session times out what you'll actually be  
requesting is a different URL, not a resumed download of the same URL.


I'm not saying it *isn't* a bug - just that there are other possible  
explanations, and I haven't seen any evidence to support one theory  
or another.


sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net



___

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

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

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

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


Re: display unicode string one character at a time, actually quite simple after all

2009-02-18 Thread mathew davis
Do you have an example where the result of  
rangeOfComposedCharacterSequenceAtIndex is too wide?


um guess I was just plain wrong

Thank you Gerriet,

I'm actually not sure how I got that so wrong,
I've just run my code again and it's doing exactly what I want it to

I must have had a bug earlier today that just wasn't splitting strings  
at all.


thank you very much for taking the time to look at this for me and to  
write back.
I was absolutely convinced that  
rangeOfComposedCharacterSequenceAtIndex wasn't working the way I wanted.


regards Mathew

On 18/02/2009, at 10:02 PM, Gerriet M. Denkmann wrote:



On 18 Feb 2009, at 14:18, mathew davis   
wrote:


ideally I'd like to break the string in to:

the smallest possible segments which do not need to horizontally
overlap when displayed in order to make sense to a reader.

so the composed character sequence:
g̈
U+0067 ( g ) latin small letter g
U+0308 ( ̈ ) combining diaeresis
would need to be one substring because the glyphs overlap  
horizontally
rangeOfComposedCharacterSequenceAtIndex sees this as one composed  
character. Just like you require.




the composed character sequence in Thai:
เก

(adj. mischievous)


U+0E40 ( เ ) thai character sara e
U+0E01 ( ก ) thai character ko kai

would ideally be broken into two substrings
rangeOfComposedCharacterSequenceAtIndex sees this as two composed  
characters.
ฺีBut why do you call it a composed character sequence? It is  
just a vowel + consonant.




but:
 กึ
would have to be one substring
rangeOfComposedCharacterSequenceAtIndex sees this as one composed  
character.


In Thai you can get composed character sequences that look a bit like
เกอะ


I do not think that this is a composed character. "เถอะ"  
which looks similar (but is a real word) is broken into 4 chars  
(just as you want it) by rangeOfComposedCharacterSequenceAtIndex.



At the moment i'm using rangeOfComposedCharacterSequenceAtIndex.
And if a sequence is too wide for my tile I scale it down.
Do you have an example where the result of  
rangeOfComposedCharacterSequenceAtIndex is too wide?



Kind regards,

Gerriet.



___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Steve Christensen
Google is your friend. The first search result for "Mac OS X stack  
size" was , which  
says:


"Each Mac OS X process is launched with a default stack size of
 8 Megabytes. This allocation is used exclusively for the main
 thread's stack needs. Each subsequent thread created is allocated
 its own default stack, the size of which differs depending on the
 threading API used. For example, the Mac OS X implementation of
 Pthreads defines a default stack size of 512 Kilobytes, while
 Carbon MPTasks are created with a 4 Kilobyte stack."

That explains why your array of chars or shorts doesn't cause a crash  
since the allocation will be under 512K.


The document also mentions ways to adjust the thread stack size for  
pthreads and NSThreads, but it might just be better to allocate your  
array on the heap using malloc or new so you don't run into these  
sorts of problems. Then you have a way of testing whether or not the  
allocation succeeded, versus the crash method you're currently using. :)


steve


On Feb 18, 2009, at 12:16 AM, Leo Singer wrote:


I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing because
this particular C++ method puts a huge amount of data on the stack.  I
am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
is responsible for doing one thing only: calling the go() method on an
instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts or an
array of chars, then this example code works fine, no EXEC_BAD_ACCESS.

Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++ method?

 TestOperation.h /

[snip]

void TestOperationImpl::go()
{
int bigArray[256000];

for (int j = 0 ; j < 256000 && !cancelled ; j ++)
{
bigArray[j] = 2*j;
}
}

___

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

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


Custom Google Search Engine for Mac OS X Developers

2009-02-18 Thread Marc Liyanage


I set up a Google Custom Search Engine covering Mac OS X development  
related sites a few weeks ago. Since then I've been testing and using  
it while working on my OS X programs, and I found it to be helpful in  
locating relevant information quickly.


This article has the details, including a bookmarklet, LaunchBar  
search template etc.:


http://bit.ly/macdev-info

Let me know what you think, especially if you know other useful sites  
it should cover.




_
Marc Liyanage   http://www.entropy.ch


___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Is there a known bug in NSUrl?

2009-02-18 Thread Mike Abdullah
I think the only way to get anywhere then is to build yourself a test  
case and see if it is at all reproducible. In particular, whether the  
bug lies in NSURLDownload or NSURLConnection (or maybe even  
WebDownload).


On 18 Feb 2009, at 14:15, Robert Nicholson wrote:

In the cases where I see this occur I'd say that the time from start  
to first resume attempt is less than 30 minutes. I do not believe it  
could be related to session timeouts. Secondly, in my mind it's a  
bug if the application simply refuses to continue. Often what you  
see is if it cannot continue / resume it will start again. I'm not  
seeing that I'm seeing it literally go no where when it sees that it  
cannot resume and only if I go out of your way to delete the file  
will it make any form of progress by starting again.


On Feb 18, 2009, at 2:22 AM, Sherm Pendley wrote:

On Wed, Feb 18, 2009 at 12:00 AM, Robert Nicholson > wrote:
So, I often see this same behavior in Safari, iTunes etc whereby  
when it's downloading something and you try to resume. It simply  
will not resume or will say timeout _until_ you remove the file and  
start again. In iTunes the progress bar simply will not show any  
more progress until the previous partially downloaded file is  
removed.   I've seen this in Software Update as well where you'll  
have to go in it's cache to delete partially downloaded updates or  
it will never resume from where it's left off.


The fact that I see these across so many apps tells me its possibly  
a framework issue.


Anybody seen this behaviour on their machines?

I've seen it, but I wouldn't be so quick to assume it's a bug in  
NSURL - resumed downloads requires a cooperative web server that  
understands and responds appropriately to the HTTP Range: header.  
Also, with ADC downloads for instance, your session key is part of  
the URL, so if your session times out what you'll actually be  
requesting is a different URL, not a resumed download of the same  
URL.


I'm not saying it *isn't* a bug - just that there are other  
possible explanations, and I haven't seen any evidence to support  
one theory or another.


sherm--

--
Cocoa programming in Perl: http://camelbones.sourceforge.net



___

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

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

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

This email sent to cocoa...@mikeabdullah.net


___

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

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

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

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


Object -> NSTreeNode?

2009-02-18 Thread Tomas Franzén

Hi,

I'm transitioning my app from using a NSOutlineView data source to  
NSTreeController.
I want to start editing a row programmatically, so I need to call  
editColumn:row:withEvent:select:, but then I need the row index. I can  
get that with rowForItem:, but as far as the NSOutlineView is  
concerned, it deals with NSTreeNodes. So I need a way to get the  
NSTreeNode for a given object.


+ treeNodeWithRepresentedObject: doesn't help since it creates a new  
node.


This seems like something that should be easy, but I can't figure it  
out.

Thanks,

Tomas Franzén
Lighthead Software
http://www.lightheadsw.com/

___

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

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

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

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


Re: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Clark S. Cox III
I would strongly reccommend using std::vector instead of a raw array.  
That way you're immune from stack size issues.


Sent from my iPhone

On Feb 18, 2009, at 0:31, Leo Singer  wrote:


Actually, if the big array and the loop are moved from the C++ method
into the Objective C selector - (void) main then the same
EXEC_BAD_ACCESS occurs.  So the problem is not related to C++.  The
following source code still exhibits the same problem:

 TestOperation.h /
#import 

@interface TestOperation : NSOperation {
}
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

@implementation TestOperation
- (void) main
{
  int bigArray[256000];

  for (int j = 0 ; j < 256000 && ![self isCancelled] ; j ++)
  {
  bigArray[j] = 2*j;
  }
}
@end

 End of TestOperation.mm /

On Wed, Feb 18, 2009 at 3:16 AM, Leo Singer   
wrote:

Hi,

I have a C++ method that I am invoking from within the - (void) main
selector of an NSOperation.  My Cocoa application is crashing because
this particular C++ method puts a huge amount of data on the  
stack.  I

am getting an EXEC_BAD_ACCESS error.  However, the same C++ routine
works fine if I call it from within a command line C++ program.

I have contrived some sample code to illustrate the problem.
TestOperation is an (Objective C) subclass of NSOperation; I am
running the NSOperation in a separate thread by putting it into an
NSOperationQueue.  TestOperationImpl is a C++ class.  The NSOperation
is responsible for doing one thing only: calling the go() method on  
an

instance of TestOperationImpl.

Note the very large array of ints that is declared inside
TestOperationImpl::go().  If it is changed to an array of shorts or  
an
array of chars, then this example code works fine, no  
EXEC_BAD_ACCESS.


Is there any way for me to give my application more memory, or at
least give more memory to the thread that is running this C++ method?

Thanks,
Leo

 TestOperation.h /
#import 

class TestOperationImpl {
private:
  bool cancelled;
public:
  TestOperationImpl();
  void go();
  void cancel();
};

@interface TestOperation : NSOperation {
  TestOperationImpl* testOpImpl;
}
- initWithController: (TestOperationController*) controller;
@end

 End of TestOperation.h /

 TestOperation.mm /
#import "TestOperation.h"

TestOperationImpl::TestOperationImpl(TestOperationController*  
controller)

: cancelled(false)
{
}

void TestOperationImpl::go()
{
  int bigArray[256000];

  for (int j = 0 ; j < 256000 && !cancelled ; j ++)
  {
  bigArray[j] = 2*j;
  }
}

void TestOperationImpl::cancel()
{
  cancelled = true;
}

@implementation TestOperation
- initWithController: (TestOperationController*) ctrl
{
  if (self = [self init])
  testOpImpl = new TestOperationImpl(ctrl);
  controller = ctrl;
  return self;
}
- (void) dealloc
{
  delete testOpImpl;
  [super dealloc];
}
- (void) cancel
{
  testOpImpl->cancel();
  [super cancel];
}
- (void) main
{
  testOpImpl->go();
}
@end

 End of TestOperation.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/clarkcox3%40gmail.com

This email sent to clarkc...@gmail.com

___

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

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

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

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


iphone landscape problems

2009-02-18 Thread Memo Akten

Hi All, i have two problems regarding running my app in landscape mode:

1.  I would like my app to to start in landscape mode. In my root  
viewcontroller I have:


- (BOOL)shouldAutorotateToInterfaceOrientation: 
(UIInterfaceOrientation)interfaceOrientation {
return (interfaceOrientation ==  
UIInterfaceOrientationLandscapeLeft) || (interfaceOrientation ==  
UIInterfaceOrientationLandscapeRight);

}

 In my info.plist I have:
UIInterfaceOrientation
UIInterfaceOrientationLandscapeRight


In my applicationDidFinishLaunching I have:
[[UIApplication sharedApplication] setStatusBarOrientation:  
UIInterfaceOrientationLandscapeRight animated:NO];


In IB my view is laid out in landscape.

but still when I launch my app it starts in portrait and slides to  
landscape! Why does it not start directly in landscape?



2. when i create and show a UIAlertView it appears in portrait, even  
if I am holding my iphone in landscape and the views are in landscape.  
Is there no way to fix this?


cheers,


Memo (Mehmet S. Akten)
www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


___

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

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

2009-02-18 Thread Jeff Johnson

On Feb 18, 2009, at 3:16 AM, Kyle Sluder wrote:


On Wed, Feb 18, 2009 at 1:52 AM, Jeff Johnson
 wrote:
That's an odd request, because doesn't it make more sense to  
install to
/Applications if the app is running from /Volumes/MyDMG rather than  
from

~/Downloads? :-) Indeed, one of the reasons to switch from dmg to zip
distribution is that the app disappears when the dmg is unmounted.


Not if you use an internet-enabled DMG.  And I don't want my
applications trying to install themselves in /Applications; I have
apps installed in ~/Applications or other places on my network home
folder at work.

--Kyle Sluder


Well, if the app has already been automatically copied from the  
internet-enabled dmg, then it won't be running from the mounted dmg  
volume, so just as with zip distribution, there's not much reason to  
offer to re-install it elsewhere.


On the other hand, it was a terrible decision by Apple from a security  
perspective to have files downloaded from the internet automatically  
open, and everyone really ought to turn off this default setting.


-Jeff

___

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

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

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

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


Re: iphone landscape problems

2009-02-18 Thread Robert Marini

In my applicationDidFinishLaunching I have:
[[UIApplication sharedApplication] setStatusBarOrientation:  
UIInterfaceOrientationLandscapeRight animated:NO];


Out of curiosity, what version of iPhone OS are you building for?  If  
you're using 2.1 and later, it should just work.  If not, you'll need  
to do something like this as well (I typed this in Mail so there may  
be blood...err...typos).


CGAffineTransform transform = self.view.transform
CGRect statusBarFrame = [[UIApplication sharedApplication]  
statusBarFrame];
CGRect bounds = CGRectMake(0, 0, statusBarFrame.size.height,  
statusBarFrame.origin.x);
CGPoint centerPoint = CGPointMake(bounds.size.height / 2.0,  
bounds.size.width / 2.0);

self.view.center = centerPoint;
transform = CGAffineTransformRotate (transform, (M_PI / 2.0));
self.view.transform = transform.

and then...

[window makeKeyAndVisible];

(otherwise the window will show and then rotate in a rather harsh  
fasion that the user would see)


2. when i create and show a UIAlertView it appears in portrait, even  
if I am holding my iphone in landscape and the views are in  
landscape. Is there no way to fix this?


If you've set your status bar orientation in  
applicationDidFinishLaunching and your view controllers are properly  
set up (overriding shouldAutorotateToInterfaceOrientation, etc) this  
should behave normally.  If you could build for 2.2.1 and have  
verified that this is the case, please file a bug report.  In the  
meantime one possible workaround is to rotate the view after it's been  
displayed in didPresentAlertView (though I've not heard of this since  
the 2.0 betas so I would double check my view controller related code).


-rob.
___

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

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

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

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


Re: iphone landscape problems

2009-02-18 Thread Memo Akten

Hi Thanks for the response. I was building for 2.2.

I am now trying for 2.2.1 and getting the exact same behavior.  
Regarding the 2nd point, if I use UIActionSheet it works correctly,  
but UIAlertView does not orient.


A bit of info about my setup.
- I create window manually in applicationDidFinishLaunching
- I create a EAGLView (based on the apple sample) and attach that  
directly to window
- I have a rootViewController and a bunch of other controllers and  
views which get attached to the rootViewController. And I attach the  
rootViewController.view to window

- the rootViewController returns YES for only landscape orientations
- so there are 2 views in my window. glView, and rootViewController on  
top. The latter is only visible when menu is activated.


Could this be why I'm having the problem? Should I set it up  
differently ?



Memo (Mehmet S. Akten)
www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


On 18 Feb 2009, at 19:25, Robert Marini wrote:


In my applicationDidFinishLaunching I have:
[[UIApplication sharedApplication] setStatusBarOrientation:  
UIInterfaceOrientationLandscapeRight animated:NO];


Out of curiosity, what version of iPhone OS are you building for?   
If you're using 2.1 and later, it should just work.  If not, you'll  
need to do something like this as well (I typed this in Mail so  
there may be blood...err...typos).


CGAffineTransform transform = self.view.transform
CGRect statusBarFrame = [[UIApplication sharedApplication]  
statusBarFrame];
CGRect bounds = CGRectMake(0, 0, statusBarFrame.size.height,  
statusBarFrame.origin.x);
CGPoint centerPoint = CGPointMake(bounds.size.height / 2.0,  
bounds.size.width / 2.0);

self.view.center = centerPoint;
transform = CGAffineTransformRotate (transform, (M_PI / 2.0));
self.view.transform = transform.

and then...

[window makeKeyAndVisible];

(otherwise the window will show and then rotate in a rather harsh  
fasion that the user would see)


2. when i create and show a UIAlertView it appears in portrait,  
even if I am holding my iphone in landscape and the views are in  
landscape. Is there no way to fix this?


If you've set your status bar orientation in  
applicationDidFinishLaunching and your view controllers are properly  
set up (overriding shouldAutorotateToInterfaceOrientation, etc) this  
should behave normally.  If you could build for 2.2.1 and have  
verified that this is the case, please file a bug report.  In the  
meantime one possible workaround is to rotate the view after it's  
been displayed in didPresentAlertView (though I've not heard of this  
since the 2.0 betas so I would double check my view controller  
related code).


-rob.
___

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

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

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

This email sent to m...@memo.tv


___

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

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

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

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


Getting a Unique File ID from MDItem

2009-02-18 Thread Mike Manzano

Hi all,

I'm doing some MDQuery stuff in my application, and it's working to  
the point where I'm getting the appropriate notifications for  
additions and removals to the subset of files that satisfy my query.   
When I get these notifications, there's a list of MDItemRefs in the  
notification's userInfo dictionary. I would like to use these  
notifications as a way to update an internal list of files. Some of  
the Apple examples pull an kMDItemPath out of the MDItemRefs, but the  
problem is that paths are not a good unique ID for files. E.g., the  
path provided for a file when it is first detected is different than  
the path provided when the file is moved to the Trash. Worse yet, if  
you delete the file from the terminal, the kMDItemPath is (null). In  
this case, I know a file was deleted, but have no clue as to which one  
without manually testing the existence of all files in my model.


Is there a unique ID for a file that I can extract from an MDItemRef  
regardless of where it is, or if it was just deleted? I wasn't able to  
find one after reading the docs several times. I'm probably missing  
something obvious.


Thanks,

Mike
___

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

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

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

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


Re: sticky video/audio files in NSTextView with GC on

2009-02-18 Thread Markus Guhe


On 17 Feb 2009, at 17:41, Bill Bumgarner wrote:


On Feb 17, 2009, at 12:52 AM, Markus Guhe wrote:

Follow up: I filed a bug report on this issue, number 6593625.


Thank you for the bug and especially for the easily reproducible  
test case.  Very much appreciated.


I stole the bug out of the inbound queue and had a look.


That's great, Bill, thanks so much!


[...]
Thus, what happens if we just rip it out?

Well... that works, but the movie view isn't actually gone if you  
poke about in memory.


Yes, that works (by setting the subviews array of the NSTextView to an  
empty array, for example), although it's a bit ugly -- considering  
that movies can require quite a lot of memory.


It appears that the attachment cell helper is hanging on to it;   
somewhere in the bowels of the layout manager.  To fully workaround  
the issue, you'd probably need to muck about with the layout  
manager's APIs to reset it.


That sounds like a lot of work. And it looks like an issue that might  
be fixed soon anyway. But, do you have a suggestion of where I could  
start with this? (Just to see whether it makes sense to try it ...)


Markus

--
m.g...@ed.ac.uk
http://markusguhe.net/prof/




The University of Edinburgh is a charitable body, registered in
Scotland, with registration number SC005336.

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Running out of memory on stack in C++ routine invoked within Cocoa NSOperation

2009-02-18 Thread Greg Parker

On Feb 18, 2009, at 3:22 AM, Michael Vannorsdel wrote:
Really it would be best to malloc the space, use it, and free it.   
Once you get to huge stack usage you gamble that you won't run out  
when there can be other higher up calls also consuming some  
(frameworks, libs, 3rd party code, ect).  Also if you only use the  
large amount once in a while then you have a bunch of unutilized  
memory sitting around.


Agreed: use malloc for large memory allocations.

One other limit that you apparently haven't run into yet: some  
architectures limit the maximum size of a single stack frame, even if  
there is lots of space on the stack. ppc has a maximum 64K stack frame  
size; arm may have a similar limit.



--
Greg Parker gpar...@apple.com Runtime Wrangler


___

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

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

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

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


Re: How to force a message to a overriding method from within an init method

2009-02-18 Thread Andreas Grosam


On Feb 12, 2009, at 2:31 AM, João Varela wrote:

João,


Hi all

I am porting most of my C++ code into Objective C and at the moment  
I have this problem:


In C++ to force a constructor to call a overriding method of a  
subclass I used pure virtual functions defined in an abstract  
(super) class.


hopefully it's not too late already, but I have to say that your code  
in C++ will not work as you expect.
Actually, if your virtual function in the base class is pure, you  
(should) get a linker error.


Fortunately, the behavior is well defined in the Standard. For more  
information please read:

http://www.research.att.com/~bs/bs_faq2.html#vcall

or read "polymorphic behavior of an object under construction" in the C 
++ Standard:


Member functions, including virtual functions, can be called during  
construction or destruction. When a virtual function is called  
directly or indirectly from a constructor, and the object to which the  
call applies is the object under construction, the function called is  
the one defined in the constructor's own class or in one of its bases,  
but not a function overriding it in a class derived from the  
constructor's class.



Regards
Andreas




An example:

class Foo
{
Foo();
virtual read( x, y ) = 0; // pure virtual
};

class Bar : public Foo
{
Bar();

virtual Read( x, y );   // implemented in the subclass
};

// Foo constructor
Foo::Foo()
{
Read( x, y ); // <-- this calls Bar::Read and not Foo::Read
  // because the latter is pure virtual
}

I know that the closest thing to a pure virtual function in  
Objective C is a formal protocol. My question is: can you implement  
such a behavior in objective C with a formal protocol?


Related to this, what method gets called inside the init method of  
the superclass: a) the superclass method? or b) the overriding  
method if there is one?


Although this is not strict Cocoa code, I think this is the best  
place to ask this kind of question. Sorry for the mild "OT-ness" of  
my question.


TIA

JV



___

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

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

Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/cocoa-dev/agrosam%40onlinehome.de

This email sent to agro...@onlinehome.de


___

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

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

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

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


Memory Leak, part I

2009-02-18 Thread John Love

[this is part I of a two-part plea for help]

I I have read Apple's "ManagingMemory.pdf" and am still having  
difficulty understanding the use of MallocDebug which is detailed in  
"MemoryMgmt.pdf".  I have 5 methods in the generation of a background  
thread and I cannot figure out where the memory leak is:


MallocDebug states that there is zero leakage for each of these  
methods, but there is a leakage = 480 bytes in 24 nodes for  
thread_start 


(1)
- (void) startBgCalculation {
/*
   setCalcStatus calls:
  itsDictionary = [[NSThread currentThread]  
threadDictionary];
  [itsDictionary setValue:[NSNumber  
numberWithInt:kCalculating] forKey:staticString#1];

*/
   [self setCalcStatus:kCalculating];

   [NSThread detachNewThreadSelector:@selector(bgCalcThread)  
toTarget:self withObject:nil];

}

(2)
- (void) bgCalcThread {
   NSAutoreleasePool *bgCalcThreadPool = [[NSAutoreleasePool  
alloc] init];


   [self doCalculation];

   [self performSelectorOnMainThread:@selector(endBgCalculation/ 
*:*/)
 withObject:nil  
waitUntilDone:YES];


   [bgCalcThreadPool release];
}
___

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

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


Large layers in Core Animation

2009-02-18 Thread bno20

Hello

I'm writing an application that requires a large scrollable view  
(about 500 x 8000) to display an appointments diary with lots of  
entries. I had a satisfactory version working using traditional cocoa  
objects but performance was a bit sluggish so I'd like to get it  
working using Core Animation.


My plan was to have a single root layer (CATiledLayer) and small  
sublayers (about 200 x 50) for each appointment. However, when I tried  
it out, I found that whenever the size of the root layer exceeded 2000  
or so in height (ie GPU limit), the sublayers became squashed rather  
than tiled.


I'd gratefully appreciate any suggestions.

Thanks
Brian


TEST CODE:

BigLayerView.m

This class is set as the custom view of an NSScrollView in IB

- (void)awakeFromNib
{
	CGFloat yHeight = 2000; // changing to 4000 results in squashed  
sublayers...


CGRect layerRect = CGRectMake(0, 0, 1000, yHeight);
[self setFrame:NSRectFromCGRect(layerRect)];
CATiledLayer *myTiledLayer = [CATiledLayer layer];
myTiledLayer.frame = layerRect;
myTiledLayer.backgroundColor = CGColorGetConstantColor(kCGColorClear);
[self setLayer:myTiledLayer];
[self setWantsLayer:YES];

CGRect textRect = CGRectMake(10, 10, 100, 50);
for ( NSInteger i = 0; i <= 200; i++ ) {
CATextLayer *textLayer = [CATextLayer layer];
textLayer.fontSize = 36.0;
textLayer.frame = textRect;
textLayer.backgroundColor = 
CGColorGetConstantColor(kCGColorWhite);
textLayer.foregroundColor =  
CGColorGetConstantColor(kCGColorBlack);
textLayer.string = [NSString stringWithFormat:@"%i", i];
[myTiledLayer addSublayer:textLayer];
textRect.origin.y += 60;
}
}

___

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

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

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

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


Windows vs View

2009-02-18 Thread Weydson Lima
Hi there,

 This is my first message here and I am already starting with a very newbie
question. I have a broad understanding what a view is - a button, a label,
etc... are views, right? But when I look at some sample codes from Apple,
the application doesn't have a "main" window.. instead, it has a view and a
view controller. So, what's the difference between a window and a view? Can
an application have no window but multiple views?

Thanks,
 Weydson
___

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

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

2009-02-18 Thread Shawn Erickson
On Tue, Feb 17, 2009 at 9:41 PM, Ankur Singhal
 wrote:
> I need to add a window inside another window so that I can drag them to any
> portion of my window and also to drag them out of my parent window.

Lets ignore the use of the word window in the above

Can you better describe what you are trying to do user interface wise?
What do these drag-able elements represent to the user? What does
dragging them out of their parent imply to the user?

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


Re: Windows vs View

2009-02-18 Thread Luke the Hiesterman
I'm guessing you're talking about iPhone sample code here. The answer  
to your question depends, somewhat, on whether you're talking about OS  
X programming, or iPhone programming. Please clarify.


Luke

On Feb 18, 2009, at 1:35 PM, Weydson Lima wrote:


Hi there,

This is my first message here and I am already starting with a very  
newbie
question. I have a broad understanding what a view is - a button, a  
label,
etc... are views, right? But when I look at some sample codes from  
Apple,
the application doesn't have a "main" window.. instead, it has a  
view and a
view controller. So, what's the difference between a window and a  
view? Can

an application have no window but multiple views?

Thanks,
Weydson
___

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

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

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

This email sent to luket...@apple.com


___

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

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

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

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


Memory Leak, part II

2009-02-18 Thread John Love

[part II of my plea for help]

(3)
- (void) doCalculation {
   for (row=1; row <= 1; row++) {  // many rows, therefore  
much time

  if ([self shouldExit])  break;
  [self doCalculationForEachRow];
   }
}

(4)
- (BOOL) shouldExit {
   [self pingWorkbook];  // calls –setExcelError  
(NSMutableDictionary, with 2nd key)

   int NoExcelAppOrNoWorkbookErr = [self itsExcelError];
   if (NoExcelAppOrNoWorkbookErr != kNoError) {  // kNoError = 0
  [self setCalcStatus:NoExcelAppOrNoWorkbookErr];
  return YES;
   }

   CalcStatus theCalcStatus = [self itsCalcStatus]; //  
(NSMutableDictionary, 1st key)

   if (theCalcStatus == kStopped) {  // = a 2nd int
  return YES;
   }
   else {
  return NO;
   }
}

 (5)
- (void) endBgCalculation/ {
   CalcStatus theCalcStatus = [self itsCalcStatus]; //  
(NSMutableDictionary, 1st key)

   if (theCalcStatus == kCalculating) {  // a 3rd int
  // do stuff
   }
   else {
  // do stuff
   }
}

John Love___

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

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

2009-02-18 Thread Gordon Apple
I guess that should have been obvious that a "value" object would be
returned a la dictionaries.  The "discussion" part actually confused rather
than enlightened me.

Although the properties individually state the defaults, I still haven't
found the addendum chapter you mentioned and I just updated my docs to the
Feb. disk.  Am I just missing it somewhere?

It sure would be nice to have those CG Geometry values included in Cocoa
and not just in iPhone.  CGColorRef to/from NSColor would be good also. (I
wrote my own for archiving a set of properties.)


On 2/17/09 1:59 PM, "Scott Anguish"  wrote:

> 
> On 15-Feb-09, at 6:07 PM, Gordon Apple wrote:
> 
>>The docs are a clear a mud on this.  What do you get from CALayer's
>> defaultValueForKey?  Is this the same as one would expect from
>> valueForKey
>> for an NSDictionary?  The return type is "id".
>> 
>> " If this method returns nil a suitable ³zero² default value for the
>> property is provided, based on the declared type of the key. For
>> example, if
>> key is a CGSize object, a size of (0.0,0.0) is returned. For a
>> CGRect an
>> empty rectangle is returned. For CGAffineTransform and
>> CATransform3D, the
>> appropriate identity matrix is returned."
>> 
>>What does that mean?  If you want a CGSize, does that mean you
>> have to
>> use "sizeValue" on what is returned and convert it?  Or
>> "CGSizeValue"?  But
>> wait, that's an iPhone SDK extension. Why isn't that in Cocoa?
>> 
> 
> Read the Core animation Programming Guide section on key-value coding
> extensions, it describes the wrapping for defaultValueForKey: and
> other similar methods.
> 
> also, there is an additional addendum like chapter that explains the
> default values for all the properties.
> 
> 

G. Apple



___

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

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

2009-02-18 Thread Scott Anguish


On 18-Feb-09, at 6:28 PM, Gordon Apple wrote:

   I guess that should have been obvious that a "value" object would  
be
returned a la dictionaries.  The "discussion" part actually confused  
rather

than enlightened me.

   Although the properties individually state the defaults, I still  
haven't
found the addendum chapter you mentioned and I just updated my docs  
to the

Feb. disk.  Am I just missing it somewhere?


Core Animation Extensions To Key-Value Coding

is the one with wrapping information

but it looks like the default values for the fields aren't where i  
thought I put them. Instead they're with the applicable property in  
the reference.  sorry about that.





   It sure would be nice to have those CG Geometry values included  
in Cocoa
and not just in iPhone.  CGColorRef to/from NSColor would be good  
also. (I

wrote my own for archiving a set of properties.)


file bugs.

___

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

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

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

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


Re: iphone landscape problems

2009-02-18 Thread Memo Akten
I've identified the problem for the first scenario (view appearing  
portrait then rotating).


I have a function [MyViewController show] and [MyViewController hide]  
which transition the view in and out:

[UIView beginAnimations:nil context:NULL];
[UIView setAnimationDuration:ANIMATION_TIME];
[UIView setAnimationTransition:UIViewAnimationTransitionCurlDown  
forView:window cache:YES];

[UIView setAnimationCurve: ANIMATION_CURVE];
[self viewWillAppear:YES];
[window addSubview:self.view];
[self viewDidAppear:YES];
[UIView commitAnimations];

I wasn't adding the view directly but was doing a transition. So  
instead of appearing with a transition directly in landscape it was  
transitioning in portrait, then rotating into landscape. After that  
when i trigger the show / hide it transitions in correctly in  
landscape. I guess this is a bug? I found two workarounds, I can  
either not transition it in when it first appears. Or create another  
viewcontroller with an empty view, add that to the window, and then  
add the animated view controller to that. It seems a bit unnessecary  
as there is an empty view on top of the window which contains my main  
view.



Memo (Mehmet S. Akten)
www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


On 18 Feb 2009, at 19:46, Memo Akten wrote:


Hi Thanks for the response. I was building for 2.2.

I am now trying for 2.2.1 and getting the exact same behavior.  
Regarding the 2nd point, if I use UIActionSheet it works correctly,  
but UIAlertView does not orient.


A bit of info about my setup.
- I create window manually in applicationDidFinishLaunching
- I create a EAGLView (based on the apple sample) and attach that  
directly to window
- I have a rootViewController and a bunch of other controllers and  
views which get attached to the rootViewController. And I attach the  
rootViewController.view to window

- the rootViewController returns YES for only landscape orientations
- so there are 2 views in my window. glView, and rootViewController  
on top. The latter is only visible when menu is activated.


Could this be why I'm having the problem? Should I set it up  
differently ?



Memo (Mehmet S. Akten)
www.memo.tv
www.twitter.com/memotv
www.vimeo.com/memotv


On 18 Feb 2009, at 19:25, Robert Marini wrote:


In my applicationDidFinishLaunching I have:
[[UIApplication sharedApplication] setStatusBarOrientation:  
UIInterfaceOrientationLandscapeRight animated:NO];


Out of curiosity, what version of iPhone OS are you building for?   
If you're using 2.1 and later, it should just work.  If not, you'll  
need to do something like this as well (I typed this in Mail so  
there may be blood...err...typos).


CGAffineTransform transform = self.view.transform
CGRect statusBarFrame = [[UIApplication sharedApplication]  
statusBarFrame];
CGRect bounds = CGRectMake(0, 0, statusBarFrame.size.height,  
statusBarFrame.origin.x);
CGPoint centerPoint = CGPointMake(bounds.size.height / 2.0,  
bounds.size.width / 2.0);

self.view.center = centerPoint;
transform = CGAffineTransformRotate (transform, (M_PI / 2.0));
self.view.transform = transform.

and then...

[window makeKeyAndVisible];

(otherwise the window will show and then rotate in a rather harsh  
fasion that the user would see)


2. when i create and show a UIAlertView it appears in portrait,  
even if I am holding my iphone in landscape and the views are in  
landscape. Is there no way to fix this?


If you've set your status bar orientation in  
applicationDidFinishLaunching and your view controllers are  
properly set up (overriding shouldAutorotateToInterfaceOrientation,  
etc) this should behave normally.  If you could build for 2.2.1 and  
have verified that this is the case, please file a bug report.  In  
the meantime one possible workaround is to rotate the view after  
it's been displayed in didPresentAlertView (though I've not heard  
of this since the 2.0 betas so I would double check my view  
controller related code).


-rob.
___

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

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

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

This email sent to m...@memo.tv


___

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

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

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

This email sent to m...@memo.tv


___

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

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

Help/

Memory Leak, Part I

2009-02-18 Thread John Love

[part II of my plea for help]

(3)
- (void) doCalculation {
   for (row=1; row <= 1; row++) {  // many rows, therefore  
much time

  if ([self shouldExit])  break;
  // do calculation for each row
   }
}

(4)
- (BOOL) shouldExit {
   [self pingWorkbook];  // calls –setExcelError  
(NSMutableDictionary, with 2nd key)

   int NoExcelAppOrNoWorkbookErr = [self itsExcelError];
   if (NoExcelAppOrNoWorkbookErr != kNoError) {  // kNoError = 0
  [self setCalcStatus:NoExcelAppOrNoWorkbookErr];
  return YES;
   }

   CalcStatus theCalcStatus = [self itsCalcStatus]; //  
(NSMutableDictionary, 1st key)

   if (theCalcStatus == kStopped) {
  return YES;
   }
   else {
  return NO;
   }
}

 (5)
- (void) endBgCalculation/ {
   CalcStatus theCalcStatus = [self itsCalcStatus];
   if (theCalcStatus == kCalculating) {
  // do stuff
   }
   else {
  // do stuff
   }
}

John Love
 ___

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

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

2009-02-18 Thread Sean McBride
On 2/18/09 11:40 AM, bn...@mac.com said:

>I'm writing an application that requires a large scrollable view
>(about 500 x 8000) to display an appointments diary with lots of
>entries. I had a satisfactory version working using traditional cocoa
>objects but performance was a bit sluggish so I'd like to get it
>working using Core Animation.
>
>My plan was to have a single root layer (CATiledLayer) and small
>sublayers (about 200 x 50) for each appointment. However, when I tried
>it out, I found that whenever the size of the root layer exceeded 2000
>or so in height (ie GPU limit), the sublayers became squashed rather
>than tiled.

See:



"Layer Size Limits and Tiled Layers" -> "On most current graphics
hardware the effective limit is 2046x2046 pixels"

--

Sean McBride, B. Eng s...@rogue-research.com
Rogue Researchwww.rogue-research.com
Mac Software Developer  Montréal, Québec, Canada


___

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

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

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

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


Re: Drop Down Toolbar Button

2009-02-18 Thread Graham Cox


On 19 Feb 2009, at 11:45 am, Walker Argendeli wrote:

'm just having a bit of trouble getting this to work.  First off, I  
wasn't 100% certain about which should be buttonCell and which  
should be self, although I think I got all of that right.  how does  
startTrackingAt:startPoint:inView: get called, however?


Again, sorry for my ignorance, but I'm just getting started with  
Cocoa.


Thanks for your help, and the code!




I'm not quite sure what you've done here. What's the outlet  
'buttonCell' refer to? This *IS* the button cell, it doesn't need to  
refer to another one. I'd get rid of that and replace all uses of it  
with 'self', as per the original code.


Note that you're not subclassing the button here, you are subclassing  
its cell. Your class name maybe ought to reflect that as it currently  
suggests that it's a subclass of a button, even though clearly it isn't.



In IB, let's say you've dragged a button into your window. To  
customise the cell class, drill down into the button (keep clicking  
it) until the cell is selected (keep an eye on the inspector palette  
so you know when this is). Then in the 'Identity' (i symbol) section  
of the inspector palette, enter the name of your custom class in the  
field marked 'Class'. That should be all you need to do to make the  
button use your custom cell subclass.


Don't forget to:

a) include the code in your project, and
b) hook up a menu to the cell so that it does have something to pop up.

You also need to set the 'showsMenuAfterDelay' to YES somewhere. It'll  
default to NO unless you set it, so you might also want to add an - 
awakeFromNib method to your code and set this to YES there.


-startTrackingAt:startPoint:inView: gets called when the mouse is  
clicked in the button. This is a method of the normal NSButtonCell  
that is being overridden here.




--Graham


___

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

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

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

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


Re: Object -> NSTreeNode?

2009-02-18 Thread Charles Srstka

On Feb 18, 2009, at 10:59 AM, Tomas Franzén wrote:


Hi,

I'm transitioning my app from using a NSOutlineView data source to  
NSTreeController.
I want to start editing a row programmatically, so I need to call  
editColumn:row:withEvent:select:, but then I need the row index. I  
can get that with rowForItem:, but as far as the NSOutlineView is  
concerned, it deals with NSTreeNodes. So I need a way to get the  
NSTreeNode for a given object.


+ treeNodeWithRepresentedObject: doesn't help since it creates a new  
node.


This seems like something that should be easy, but I can't figure it  
out.


AFAIK, there's no way to do this other than employing somewhat ugly  
and inefficient hacks such as iterating through the entire tree  
structure looking for the node whose represented object is the object  
you're looking for.


In my opinion, NSTreeController is still limited enough that it raises  
some questions about whether it really should be used.


Charles___

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

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

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

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


Re: Large layers in Core Animation

2009-02-18 Thread David Duncan

On Feb 18, 2009, at 4:19 PM, Sean McBride wrote:


See:



"Layer Size Limits and Tiled Layers" -> "On most current graphics
hardware the effective limit is 2046x2046 pixels"



This is mostly true. Layers with content are certainly limited by the  
GPU texture size (2048 is the minimum texture size supported by GPUs  
that are supported by Leopard). However, layers that are content-less  
(which is not the case for AppKit created layers in general, since  
they contain the content the view draws in -drawRect:) can have any  
dimensions, as they are purely geometric entities. So it is certainly  
plausible to create a CALayer (plain, not subclass) that is absolutely  
huge and use the style properties to give it "content" and it should  
render correctly. But the minute you give the layer contents (by  
setting the contents property or calling -setNeedsDisplay) then you  
are subject to the GPU texture limits.

--
David Duncan
Apple DTS Animation and Printing

___

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

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


FOLDERS and document based apps (Open Recent)

2009-02-18 Thread Chris Idou


If I add public.folder to my Info.plist as a valid type of document my app can 
open, some things don't work.

Open Document doesn't work, albeit its not too hard to get around by 
subclassing NSDocumentController and redefining the openDocument:

However Open Recent is more tricky because as far as I can tell its all hidden 
and invisible in the guts of NSDocumentController.

Has anyone got any tips about changing the behavior of Open Recent?


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
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 arch...@mail-archive.com


RE: Adding Multiple NSWindow or NSPanel into another NSWindow

2009-02-18 Thread Ankur Singhal

Actually I want to allow the user to fit a view at any place in the window
he wants by dragging the view. Also allowing him to hide it if required or
close it.

Thanks & Regards,
Ankur Singhal

-Original Message-
From: Shawn Erickson [mailto:shaw...@gmail.com] 
Sent: Thursday, February 19, 2009 4:54 Morning
To: Ankur Singhal
Cc: cocoa-dev@lists.apple.com
Subject: Re: Adding Multiple NSWindow or NSPanel into another NSWindow

On Tue, Feb 17, 2009 at 9:41 PM, Ankur Singhal
 wrote:
> I need to add a window inside another window so that I can drag them to
any
> portion of my window and also to drag them out of my parent window.

Lets ignore the use of the word window in the above

Can you better describe what you are trying to do user interface wise?
What do these drag-able elements represent to the user? What does
dragging them out of their parent imply to the user?

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


Re: Adding Multiple NSWindow or NSPanel into another NSWindow

2009-02-18 Thread Chris Idou


You can have an MDI interface on the Mac, but you have to do all the hard work 
yourself, because there is no MDI widgets provided.

One alternative is a tabbed interface. There is some free code somewhere that 
does a Safari-like tabbed interface.


  Make Yahoo!7 your homepage and win a trip to the Quiksilver Pro. Find out 
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 arch...@mail-archive.com


Re: Capture highlighted menu name

2009-02-18 Thread Cauvery K

Hi There,
[...]



 I'm going to ignore the approach you mentioned because it sounds
incredibly painful for what could very well turn out to be a very
simple thing. The problem is that it's hard to tell exactly what
you're trying to do because you didn't explain your goals very well.


We are developing a screen capture application and menu capture is one  
of the features. If you consider the default
Apple object capture, it captures the menu but not along with its  
title.  But we want to capture the menu  along with its title.


Guess an example would clear things up. Lets say a user clicks on the  
'File' menu on  the  Mail application menu bar.  Now the user will be  
able to see the menu items like 'New Message' , 'New Note'etc.  Now we  
would like to capture this File menu along with the menu name  -  
'File' in this case (i.e File highlighted using the selection color)



 You want the *title* of whatever menu item is selected. Do you mean
within your own application or any application at all?


As I mentioned earlier , it is a screen capture application.  So we  
want to capture anything that is

on the screen.

Thank you.

Regards,
Cauvery.



On 18-Feb-09, at 1:00 AM, I. Savant wrote:

On Tue, Feb 17, 2009 at 6:47 AM, Cauvery K  
 wrote:



--
I.S.



Thanks and Regards,

Cauvery K
cauver...@robosoftin.com




___

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

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

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

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