Re: NSTableView Column Count

2011-03-16 Thread Nicholas Zaccardi
Thanks for the suggestion. How would I check or correct that?


On Wed, Mar 16, 2011 at 1:13 AM, Scott Anguish  wrote:
>
> On Mar 15, 2011, at 1:13 PM, Nicholas Zaccardi wrote:
>
>> I am trying to make an NSTableView with only one column. Here is what I do:
>>
>> 1. Open nib
>> 2. Add TableView
>> 3. Decrease column count
>> 4. Save the NIB
>>
>> However if I build and run, I still get 2 columns. Any suggestions?
>
> are you sure you’re getting two columns, and not one that isn’t the full 
> width of the table?
>
>
___

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

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

2011-03-16 Thread Indragie Karunaratne
This is a weird solution that worked for me:

1. Decrease column count to one
2. Click the "Headers" checkbox to disable table headers
3. Click the "Headers" checkbox again to re-enable table headers, and it 
automatically sizes your single column to fill the entire width of the table

This seems to be more of a bug with Xcode but its a quick solution :)

On 2011-03-15, at 11:13 AM, Nicholas Zaccardi wrote:

> I am trying to make an NSTableView with only one column. Here is what I do:
> 
> 1. Open nib
> 2. Add TableView
> 3. Decrease column count
> 4. Save the NIB
> 
> However if I build and run, I still get 2 columns. Any suggestions?
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> 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%40indragie.com
> 
> This email sent to cocoa...@indragie.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


Books covering iOS security issues

2011-03-16 Thread Eric Gorr
I was just wondering if there were any books people would recommend, apart from 
Apple's documentation on the topic ( http://bit.ly/gz36Bn, etc. ), which 
discuss security issues and best-coding practices for iOS.

Thank you.


___

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

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


Debugging a sleepless Mac

2011-03-16 Thread Matt Gough
I've just been adding code to support NSWorkspaceWillSleepNotification. Having 
lowered my Computer sleep time right down and left the Mac untouched for 
several minutes, my code never fires and the Mac doesn't actually go to sleep. 
Even without my app running and leaving the Mac for several hours I notice that 
it still won't sleep.

So it seems that something else is preventing idle sleep, but I've no idea how 
to find the culprit. Is there some defaults setting I can use that will log 
what the OS wants to do at sleep time and what is blocking it?

Matt___

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

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

2011-03-16 Thread John Joyce

> I've just been adding code to support NSWorkspaceWillSleepNotification. 
> Having lowered my Computer sleep time right down and left the Mac untouched 
> for several minutes, my code never fires and the Mac doesn't actually go to 
> sleep. Even without my app running and leaving the Mac for several hours I 
> notice that it still won't sleep.
> 
> So it seems that something else is preventing idle sleep, but I've no idea 
> how to find the culprit. Is there some defaults setting I can use that will 
> log what the OS wants to do at sleep time and what is blocking it?
> 
> Matt___
> 
> 
You will of course want to look at System Logs, but you'd do well to try the 
same code on a vanilla install of the OS to be sure there is no other software 
interfering.

Could be hardware, network (wake on lan) etc...

___

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

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

2011-03-16 Thread Jean-Christophe Helary

On 16 mars 11, at 21:37, Matt Gough wrote:

> So it seems that something else is preventing idle sleep, but I've no idea 
> how to find the culprit. Is there some defaults setting I can use that will 
> log what the OS wants to do at sleep time and what is blocking it?

Do you have an external disk ?


Jean-Christophe Helary

fun: http://mac4translators.blogspot.com
work: http://www.doublet.jp (ja/en > fr)
tweets: http://twitter.com/brandelune

___

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

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

2011-03-16 Thread Nicholas Zaccardi
That did not work for me, I resized it manually and it works, but I
want to have IB do it automatically.

Thanks for any more suggestions.

On Wed, Mar 16, 2011 at 10:13 AM, Indragie Karunaratne
 wrote:
> This is a weird solution that worked for me:
>
> 1. Decrease column count to one
> 2. Click the "Headers" checkbox to disable table headers
> 3. Click the "Headers" checkbox again to re-enable table headers, and it 
> automatically sizes your single column to fill the entire width of the table
>
> This seems to be more of a bug with Xcode but its a quick solution :)
>
> On 2011-03-15, at 11:13 AM, Nicholas Zaccardi wrote:
>
>> I am trying to make an NSTableView with only one column. Here is what I do:
>>
>> 1. Open nib
>> 2. Add TableView
>> 3. Decrease column count
>> 4. Save the NIB
>>
>> However if I build and run, I still get 2 columns. Any suggestions?
>> ___
>>
>> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>>
>> Please do not post admin requests or moderator comments to the list.
>> 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%40indragie.com
>>
>> This email sent to cocoa...@indragie.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: NSTableView Column Count

2011-03-16 Thread Kyle Sluder
On Wed, Mar 16, 2011 at 8:09 AM, Nicholas Zaccardi
 wrote:
> That did not work for me, I resized it manually and it works, but I
> want to have IB do it automatically.

Have IB do what automatically? NSTableView doesn't autoresize its
columns unless they fit the exact visible width of the enclosing
scrollview. If you remove the last column, the tableview no longer
fills the scroll view, and therefore will not autosize its columns as
you resize it in Interface Builder.

--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: Debugging a sleepless Mac

2011-03-16 Thread Aaron Burghardt

On Mar 16, 2011, at 8:37 AM, Matt Gough wrote:

> So it seems that something else is preventing idle sleep, but I've no idea 
> how to find the culprit. Is there some defaults setting I can use that will 
> log what the OS wants to do at sleep time and what is blocking it?

Leaving a Terminal session/window open seems to prevent sleep for me.

Aaron

___

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

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

2011-03-16 Thread Kyle Sluder
On Wed, Mar 16, 2011 at 5:37 AM, Matt Gough  wrote:
> So it seems that something else is preventing idle sleep, but I've no idea 
> how to find the culprit. Is there some defaults setting I can use that will 
> log what the OS wants to do at sleep time and what is blocking it?

According to the I/O Kit Power Management Release Notes, `pmset -g`
should list all outstanding power management assertions.
http://developer.apple.com/library/mac/#releasenotes/Darwin/RN-IOKitPowerManagment/_index.html

I'd say try that and see if it tells you who's preventing system sleep.

--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: NSTableView Column Count

2011-03-16 Thread Nicholas Zaccardi
Okay.  This is not a problem per say, but let me make sure I understand you.

In order for a single column to fill the entire width of a scroll
view, I have to make the width of the column the width of the scroll
view - the scroll bars?

For example, a scroll view is 100 wide and my NSTableView is also 100
wide, but the one and only column is only 65 wide then I would have to
manually make it 100 in order for the column to make use of the full
NSTableView.  XCode/IB/Cocoa will not do that for me.

Then if I resize the window/Scroll/TableView will the column auto resize?

Thank you for helping me understand this!


On Wed, Mar 16, 2011 at 11:16 AM, Kyle Sluder  wrote:
> On Wed, Mar 16, 2011 at 8:09 AM, Nicholas Zaccardi
>  wrote:
>> That did not work for me, I resized it manually and it works, but I
>> want to have IB do it automatically.
>
> Have IB do what automatically? NSTableView doesn't autoresize its
> columns unless they fit the exact visible width of the enclosing
> scrollview. If you remove the last column, the tableview no longer
> fills the scroll view, and therefore will not autosize its columns as
> you resize it in Interface Builder.
>
> --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: NSTableView Column Count

2011-03-16 Thread Kyle Sluder
On Wed, Mar 16, 2011 at 8:44 AM, Nicholas Zaccardi
 wrote:
> In order for a single column to fill the entire width of a scroll
> view, I have to make the width of the column the width of the scroll
> view - the scroll bars?
>
> For example, a scroll view is 100 wide and my NSTableView is also 100
> wide, but the one and only column is only 65 wide then I would have to
> manually make it 100 in order for the column to make use of the full
> NSTableView.  XCode/IB/Cocoa will not do that for me.
>
> Then if I resize the window/Scroll/TableView will the column auto resize?

Yes. As Indragie mentioned, you might need to temporarily turn on
column headers so you have something to resize.

--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: Books covering iOS security issues

2011-03-16 Thread Sean McBride
On Wed, 16 Mar 2011 10:20:49 -0400, Eric Gorr said:

>I was just wondering if there were any books people would recommend,
>apart from Apple's documentation on the topic ( http://bit.ly/gz36Bn,
>etc. ), which discuss security issues and best-coding practices for iOS.

Since you're likely working in a C-based language, this could be educational:



--

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: [Moderator] Lion NDA reminder

2011-03-16 Thread Shawn Bakhtiar


In the jungle the quiet jungle...
The lion sleeps tonight...

In the jungle the quite jungle
The lion sleeps tonight

Owimboeh... owimboeh...
Owimboeh... owimboeh...

Owimboeh... owimboeh...
Owimboeh... owimboeh...

> From: sc...@cocoadoc.com
> Date: Wed, 16 Mar 2011 01:13:27 -0400
> To: cocoa-dev@lists.apple.com
> Subject: [Moderator] Lion NDA reminder
> 
> While there haven’t been any issues that I’m aware of I wanted to take an 
> opportunity to remind subscribers...
> 
> Lion APIs, features, changes, etc. are all covered by non-disclosure. So they 
> can’t be discussed here.
> 
> However, there are forums at devforums.apple.com that have facilities for 
> this.
> 
> So head over there for those questions/comments/etc.
> 
> Thanks in advance
> 
> [scott]
> moderator
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.com
  
___

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

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

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

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


RE: Books covering iOS security issues

2011-03-16 Thread Shawn Bakhtiar


http://developer.apple.com/library/ios/#documentation/iPhone/Conceptual/iPhoneOSProgrammingGuide/Introduction/Introduction.html#//apple_ref/doc/uid/TP40007072

I've looked. This is the best. The examples are all there, and it does a pretty 
good job of explaining how to do things. 

> From: s...@rogue-research.com
> To: mail...@ericgorr.net; cocoa-dev@lists.apple.com
> Date: Wed, 16 Mar 2011 12:10:06 -0400
> CC: 
> Subject: Re: Books covering iOS security issues
> 
> On Wed, 16 Mar 2011 10:20:49 -0400, Eric Gorr said:
> 
> >I was just wondering if there were any books people would recommend,
> >apart from Apple's documentation on the topic ( http://bit.ly/gz36Bn,
> >etc. ), which discuss security issues and best-coding practices for iOS.
> 
> Since you're likely working in a C-based language, this could be educational:
> 
>  +Secure+Coding+Standard>
> 
> -- 
> 
> 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/shashaness%40hotmail.com
> 
> This email sent to shashan...@hotmail.com
  
___

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

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

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

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


Re: Debugging a sleepless Mac

2011-03-16 Thread Matt Gough

On 16 Mar 2011, at 15:32, Kyle Sluder wrote:

> On Wed, Mar 16, 2011 at 5:37 AM, Matt Gough  wrote:
>> So it seems that something else is preventing idle sleep, but I've no idea 
>> how to find the culprit. Is there some defaults setting I can use that will 
>> log what the OS wants to do at sleep time and what is blocking it?
> 
> According to the I/O Kit Power Management Release Notes, `pmset -g`
> should list all outstanding power management assertions.
> http://developer.apple.com/library/mac/#releasenotes/Darwin/RN-IOKitPowerManagment/_index.html
> 
> I'd say try that and see if it tells you who's preventing system sleep.
> 
> --Kyle Sluder


Thanks to everyone for the suggestions so far.

Alas, pmset -g it doesn't show any active assertions (I know it can do as I 
slapped one in my code and it showed up).

I have also tried turning off ttyskeepawake, but to no avail.

I didn't mention in my previous email that I have no problem with display sleep 
working correctly, its just idle sleep that is misbehaving.

Looking through the logs, I can't see any power related ones.

Apart from user interactions, what other sorts of activity automatically 
prevent idle sleep?

Matt___

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

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

2011-03-16 Thread James Maxwell
Thanks Greg. The initWithCoder is indeed at launch, so Guard Malloc shouldn't 
be a huge problem. I'll give it a try.

cheers,

J.

On 2011-03-15, at 6:45 PM, Greg Parker wrote:

> On Mar 15, 2011, at 4:10 PM, James Maxwell wrote:
>> I'm getting a crash in initWithCoder, which seems related to decoding a 
>> property called "value", which is of type id. Sometimes this object is an 
>> NSString, sometimes it's an NSNumber, and sometimes it's an NSArray. The 
>> crash only occurs in cases where "value" is an NSArray. The last few lines 
>> in my backtrace are:
>> 
>> #0  0x963c4206 in szone_malloc_should_clear ()
>> #1  0x963c41a8 in malloc_zone_malloc ()
>> #2  0x94920a13 in _CFRuntimeCreateInstance ()
>> #3  0x94943482 in CFNumberCreate ()
>> #4  0x949586f2 in __CFBinaryPlistCreateObject2 ()
>> #5  0x94985fe0 in __CFBinaryPlistCreateObject ()
>> #6  0x9823eb11 in _decodeObjectBinary ()
>> #7  0x98240314 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] ()
>> #8  0x98240981 in -[NSArray(NSArray) initWithCoder:] ()
>> #9  0x9823f508 in _decodeObjectBinary ()
>> #10 0x9823e800 in _decodeObject ()
>> #11 0x000cdf05 in -[CbCM_Node initWithCoder:] (self=0x4098770, 
>> _cmd=0x9433805c, aDecoder=0x410f1c0) at 
>> /Volumes/Wheet-Docs/jamesmaxwell/Documents/xcode/rubato/ManuScore+MusiCOG/ManuScore
>>  Test Build/ManuScore/CbCM_Node.m:573
>> 
>> From this, I'm guessing that the problem is happening with one of the 
>> members of the "value" array. Does that seem right? (I should mention, 
>> though, that the trace isn't always the same...)
>> I am retaining "value" when I decode it, so it's not a simple memory bug. I 
>> have also run the code with Zombies (NSZombieEnabled=YES), which doesn't 
>> indicate any Zombied objects. Finally, the analyzer sees no memory errors 
>> (there are a number of "dead stores" - mostly unused variables - but these 
>> aren't likely to be real problems, are they?), so I'm stumped. I'm running 
>> Xcode 4, btw.
> 
> A crash inside malloc generally means that there's a memory error elsewhere 
> that corrupted malloc's data structures. (Actual bugs in malloc are rare.) 
> malloc may store information before or after each allocation, and inside 
> freed allocations.
> 
> The usual bugs are:
> * writing data before or after the bounds of an allocation. Usually this 
> comes from bounds errors in C arrays.
> * writing data into an allocation after freeing it. 
> 
> NSZombie catches the latter for Objective-C objects. But if the problem is a 
> non-object allocation, or a bounds error, then NSZombie won't help. 
> 
> The next tool to try is Guard Malloc. It catches both of the above errors for 
> any malloc allocation. On the down side, it is slow and memory intensive, but 
> if this -initWithCoder: is running early in app launch then you won't have 
> any trouble with it.
> 
> http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/guardmalloc.3.html
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler
> 
> 

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

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


Master Detail

2011-03-16 Thread Georg Seifert
Hi,

If I have a master detail interface bound to a array controller.

To explain my problem (the actual structure is different but as an explanation):
The list shows a some persons. Then I have a switch that selects if the detail 
view shows the private or the work address. Is there any easy way do that. 

Now I use another array controller. On every selection change I make an array 
of addresses and set as the content array.

Is there an easier solution?

Or can I change the keypath if the address switch changes?

Best
Georg___

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

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

2011-03-16 Thread James Maxwell
oops... How do I enable Guard Malloc in Xcode 4?

J.


On 2011-03-15, at 6:45 PM, Greg Parker wrote:

> On Mar 15, 2011, at 4:10 PM, James Maxwell wrote:
>> I'm getting a crash in initWithCoder, which seems related to decoding a 
>> property called "value", which is of type id. Sometimes this object is an 
>> NSString, sometimes it's an NSNumber, and sometimes it's an NSArray. The 
>> crash only occurs in cases where "value" is an NSArray. The last few lines 
>> in my backtrace are:
>> 
>> #0  0x963c4206 in szone_malloc_should_clear ()
>> #1  0x963c41a8 in malloc_zone_malloc ()
>> #2  0x94920a13 in _CFRuntimeCreateInstance ()
>> #3  0x94943482 in CFNumberCreate ()
>> #4  0x949586f2 in __CFBinaryPlistCreateObject2 ()
>> #5  0x94985fe0 in __CFBinaryPlistCreateObject ()
>> #6  0x9823eb11 in _decodeObjectBinary ()
>> #7  0x98240314 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] ()
>> #8  0x98240981 in -[NSArray(NSArray) initWithCoder:] ()
>> #9  0x9823f508 in _decodeObjectBinary ()
>> #10 0x9823e800 in _decodeObject ()
>> #11 0x000cdf05 in -[CbCM_Node initWithCoder:] (self=0x4098770, 
>> _cmd=0x9433805c, aDecoder=0x410f1c0) at 
>> /Volumes/Wheet-Docs/jamesmaxwell/Documents/xcode/rubato/ManuScore+MusiCOG/ManuScore
>>  Test Build/ManuScore/CbCM_Node.m:573
>> 
>> From this, I'm guessing that the problem is happening with one of the 
>> members of the "value" array. Does that seem right? (I should mention, 
>> though, that the trace isn't always the same...)
>> I am retaining "value" when I decode it, so it's not a simple memory bug. I 
>> have also run the code with Zombies (NSZombieEnabled=YES), which doesn't 
>> indicate any Zombied objects. Finally, the analyzer sees no memory errors 
>> (there are a number of "dead stores" - mostly unused variables - but these 
>> aren't likely to be real problems, are they?), so I'm stumped. I'm running 
>> Xcode 4, btw.
> 
> A crash inside malloc generally means that there's a memory error elsewhere 
> that corrupted malloc's data structures. (Actual bugs in malloc are rare.) 
> malloc may store information before or after each allocation, and inside 
> freed allocations.
> 
> The usual bugs are:
> * writing data before or after the bounds of an allocation. Usually this 
> comes from bounds errors in C arrays.
> * writing data into an allocation after freeing it. 
> 
> NSZombie catches the latter for Objective-C objects. But if the problem is a 
> non-object allocation, or a bounds error, then NSZombie won't help. 
> 
> The next tool to try is Guard Malloc. It catches both of the above errors for 
> any malloc allocation. On the down side, it is slow and memory intensive, but 
> if this -initWithCoder: is running early in app launch then you won't have 
> any trouble with it.
> 
> http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/guardmalloc.3.html
> 
> 
> -- 
> Greg Parker gpar...@apple.com Runtime Wrangler
> 
> 

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

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

2011-03-16 Thread Kyle Sluder
On Mar 16, 2011, at 9:35 AM, Matt Gough  wrote:

> Apart from user interactions, what other sorts of activity automatically 
> prevent idle sleep?

Time Machine, I think?

--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: Books covering iOS security issues

2011-03-16 Thread Stephane Sudre
I haven't read it so it's just to add a reference to the list:

Professional Cocoa Application Security
Graham J. Lee, Wrox, 2010
ISBN 978-0-470-52595-1, £33.99
http://eu.wiley.com/WileyCDA/WileyTitle/productCd-0470525959.html
___

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

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

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

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


Re: Books covering iOS security issues

2011-03-16 Thread Conrad Shultz
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

On 3/16/11 7:20 AM, Eric Gorr wrote:
> I was just wondering if there were any books people would recommend,
> apart from Apple's documentation on the topic ( http://bit.ly/gz36Bn,
> etc. ), which discuss security issues and best-coding practices for
> iOS.

Graham Lee's "Professional Cocoa Application Security"?

I've only read parts of it (e.g. on Keychain Services) but what I have
read was clear and useful.

(The author was the resident security guru on Scotty's various developer
podcasts, which I also recommend.)

- -- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.com
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.7 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iD8DBQFNgPJcaOlrz5+0JdURAv/AAJ9CXO+vWEriF3nFM9kp38TcCeJk5ACgio27
EFOFhC9VH+HSQFo/ErU02ck=
=f62E
-END PGP SIGNATURE-
___

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

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

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

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


Re: Debugging a sleepless Mac

2011-03-16 Thread Nick Zitzmann

On Mar 16, 2011, at 10:59 AM, Kyle Sluder wrote:

> On Mar 16, 2011, at 9:35 AM, Matt Gough  wrote:
> 
>> Apart from user interactions, what other sorts of activity automatically 
>> prevent idle sleep?
> 
> Time Machine, I think?

Also, I know that turning on Internet connection sharing in the Sharing 
preference pane disables idle sleep.

Nick Zitzmann


___

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

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

2011-03-16 Thread James Maxwell
Okay, strange discovery.

I wasn't sure how to enable Guard Malloc in Xcode 4, so I just ran it with the 
Allocations Instrument. Lo and behold, it doesn't crash. This didn't make much 
sense to me, so I tried running the release build, rather than the debug build. 
No crash. Switch back to debug boom.

Any thoughts on what this might mean?

J.


On 2011-03-16, at 10:00 AM, James Maxwell wrote:

> oops... How do I enable Guard Malloc in Xcode 4?
> 
> J.
> 
> 
> On 2011-03-15, at 6:45 PM, Greg Parker wrote:
> 
>> On Mar 15, 2011, at 4:10 PM, James Maxwell wrote:
>>> I'm getting a crash in initWithCoder, which seems related to decoding a 
>>> property called "value", which is of type id. Sometimes this object is an 
>>> NSString, sometimes it's an NSNumber, and sometimes it's an NSArray. The 
>>> crash only occurs in cases where "value" is an NSArray. The last few lines 
>>> in my backtrace are:
>>> 
>>> #0  0x963c4206 in szone_malloc_should_clear ()
>>> #1  0x963c41a8 in malloc_zone_malloc ()
>>> #2  0x94920a13 in _CFRuntimeCreateInstance ()
>>> #3  0x94943482 in CFNumberCreate ()
>>> #4  0x949586f2 in __CFBinaryPlistCreateObject2 ()
>>> #5  0x94985fe0 in __CFBinaryPlistCreateObject ()
>>> #6  0x9823eb11 in _decodeObjectBinary ()
>>> #7  0x98240314 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] ()
>>> #8  0x98240981 in -[NSArray(NSArray) initWithCoder:] ()
>>> #9  0x9823f508 in _decodeObjectBinary ()
>>> #10 0x9823e800 in _decodeObject ()
>>> #11 0x000cdf05 in -[CbCM_Node initWithCoder:] (self=0x4098770, 
>>> _cmd=0x9433805c, aDecoder=0x410f1c0) at 
>>> /Volumes/Wheet-Docs/jamesmaxwell/Documents/xcode/rubato/ManuScore+MusiCOG/ManuScore
>>>  Test Build/ManuScore/CbCM_Node.m:573
>>> 
>>> From this, I'm guessing that the problem is happening with one of the 
>>> members of the "value" array. Does that seem right? (I should mention, 
>>> though, that the trace isn't always the same...)
>>> I am retaining "value" when I decode it, so it's not a simple memory bug. I 
>>> have also run the code with Zombies (NSZombieEnabled=YES), which doesn't 
>>> indicate any Zombied objects. Finally, the analyzer sees no memory errors 
>>> (there are a number of "dead stores" - mostly unused variables - but these 
>>> aren't likely to be real problems, are they?), so I'm stumped. I'm running 
>>> Xcode 4, btw.
>> 
>> A crash inside malloc generally means that there's a memory error elsewhere 
>> that corrupted malloc's data structures. (Actual bugs in malloc are rare.) 
>> malloc may store information before or after each allocation, and inside 
>> freed allocations.
>> 
>> The usual bugs are:
>> * writing data before or after the bounds of an allocation. Usually this 
>> comes from bounds errors in C arrays.
>> * writing data into an allocation after freeing it. 
>> 
>> NSZombie catches the latter for Objective-C objects. But if the problem is a 
>> non-object allocation, or a bounds error, then NSZombie won't help. 
>> 
>> The next tool to try is Guard Malloc. It catches both of the above errors 
>> for any malloc allocation. On the down side, it is slow and memory 
>> intensive, but if this -initWithCoder: is running early in app launch then 
>> you won't have any trouble with it.
>> 
>> http://developer.apple.com/library/mac/#documentation/Darwin/Reference/ManPages/man3/guardmalloc.3.html
>> 
>> 
>> -- 
>> Greg Parker gpar...@apple.com Runtime Wrangler
>> 
>> 
> 
> James B Maxwell
> Composer/Doctoral Student
> School for the Contemporary Arts (SCA)
> School for Interactive Arts + Technology (SIAT)
> Simon Fraser University
> jbmaxw...@rubato-music.com
> jbmax...@sfu.ca
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jbmaxwell%40rubato-music.com
> 
> This email sent to jbmaxw...@rubato-music.com

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

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

2011-03-16 Thread Sean McBride
On Wed, 16 Mar 2011 10:31:26 -0700, James Maxwell said:

>Okay, strange discovery.
>
>I wasn't sure how to enable Guard Malloc in Xcode 4

Someone on the Xcode list could probably help there...

>, so I just ran it
>with the Allocations Instrument. Lo and behold, it doesn't crash. This
>didn't make much sense to me, so I tried running the release build,
>rather than the debug build. No crash. Switch back to debug boom.
>
>Any thoughts on what this might mean?

Have you looked at the Debugging Magic technote?  It's well worth
reading in its entirety.



All the bits about memory management should help you debug this.

--

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: Debugging a sleepless Mac

2011-03-16 Thread Dave Keck
> Apart from user interactions, what other sorts of activity automatically 
> prevent idle sleep?

I seem to recall an issue where a program's logging was preventing
sleep, which I believe was simply due to the file activity. fs_usage
may help there.
___

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

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

2011-03-16 Thread Alex Kac
Edit your Scheme and go to the "Run" section. Then go to the Diagnostics tab.

On Mar 16, 2011, at 12:35 PM, Sean McBride wrote:

> On Wed, 16 Mar 2011 10:31:26 -0700, James Maxwell said:
> 
>> Okay, strange discovery.
>> 
>> I wasn't sure how to enable Guard Malloc in Xcode 4
> 
> Someone on the Xcode list could probably help there...
> 
>> , so I just ran it
>> with the Allocations Instrument. Lo and behold, it doesn't crash. This
>> didn't make much sense to me, so I tried running the release build,
>> rather than the debug build. No crash. Switch back to debug boom.
>> 
>> Any thoughts on what this might mean?
> 
> Have you looked at the Debugging Magic technote?  It's well worth
> reading in its entirety.
> 
> 
> 
> All the bits about memory management should help you debug this.
> 
> --
> 
> 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/alex%40webis.net
> 
> This email sent to a...@webis.net

Alex Kac - President and Founder
Web Information Solutions, Inc. 

"It is useless for sheep to pass a resolution in favor of vegetarianism while 
wolves remain of a different opinion."
-- William Randolph Inge





___

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

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

2011-03-16 Thread Quincey Morris
On Mar 16, 2011, at 09:57, Georg Seifert wrote:

> If I have a master detail interface bound to a array controller.
> 
> To explain my problem (the actual structure is different but as an 
> explanation):
> The list shows a some persons. Then I have a switch that selects if the 
> detail view shows the private or the work address. Is there any easy way do 
> that. 
> 
> Now I use another array controller. On every selection change I make an array 
> of addresses and set as the content array.
> 
> Is there an easier solution?
> 
> Or can I change the keypath if the address switch changes?

You should be able to rebind the detail view table column according to the 
property you want it to display:

[tableColumn bind: @"value" toObject: arrayController withKeyPath: 
@"address property name 1 or 2" options: ...];

Or, you could create one table column for each address, and reconfigure the 
table to show the appropriate column:

[table addTableColumn: tableColumn1];
[table removeTableColumn: tableColumn2];

Or, you could just hide/show columns:

[tableColumn1 setHidden: NO];
[tableColumn2 setHidden: YES];

Or, you could have two separate tables, and hide/show the appropriate table:

[table1 setHidden: NO];
[table2 setHidden: YES];

It's also possible to create a derived data model "address1OrAddress2" 
property, but this is only useful if the address mode doesn't need to be set in 
different ways for different views of the data.


___

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

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

2011-03-16 Thread Laurent Daudelin
On Mar 16, 2011, at 09:35, Matt Gough wrote:

> On 16 Mar 2011, at 15:32, Kyle Sluder wrote:
> 
>> On Wed, Mar 16, 2011 at 5:37 AM, Matt Gough  wrote:
>>> So it seems that something else is preventing idle sleep, but I've no idea 
>>> how to find the culprit. Is there some defaults setting I can use that will 
>>> log what the OS wants to do at sleep time and what is blocking it?
>> 
>> According to the I/O Kit Power Management Release Notes, `pmset -g`
>> should list all outstanding power management assertions.
>> http://developer.apple.com/library/mac/#releasenotes/Darwin/RN-IOKitPowerManagment/_index.html
>> 
>> I'd say try that and see if it tells you who's preventing system sleep.
>> 
>> --Kyle Sluder
> 
> 
> Thanks to everyone for the suggestions so far.
> 
> Alas, pmset -g it doesn't show any active assertions (I know it can do as I 
> slapped one in my code and it showed up).
> 
> I have also tried turning off ttyskeepawake, but to no avail.
> 
> I didn't mention in my previous email that I have no problem with display 
> sleep working correctly, its just idle sleep that is misbehaving.
> 
> Looking through the logs, I can't see any power related ones.
> 
> Apart from user interactions, what other sorts of activity automatically 
> prevent idle sleep?

Many things can prevent sleep. On my MacBook Pro, when I do a clean install and 
don't run too many applications (Mail, Safari, iChat, Skype), the system will 
sometimes go to sleep according to my settings in Energy Saver. As soon as I 
start running additional processes like Growl or DropBox, the system will not 
go to sleep under any circumstances, even when running on battery. I think the 
problem is in the system. I did file a bug on this over a year ago. It was 
declared a duplicate of another and dev support told me it was a known issue. I 
checked the status a couple of months ago and it was still open. When I checked 
with them, they told me it was still being work on. That tells me that the 
engineers just simply gave up on Snow Leopard and are spending almost all their 
time on Lion. Still, that's a bit upsetting to have a laptop that won't go to 
sleep because there are a few processes running. What's the purpose of having a 
sleep feature if you have to quit all running processes?

And before someone says "you probably have something that keeps the system 
active", I went through a lot of analysis with developer support, providing 
them many pmset and console logs and among all processes that were running, 
there wasn't one keeping the system busy. It just seems that it's the addition 
of all processes that seems to fool the system. Heck, if I run a video from 
justin.tv full screen on battery, the system will not even shutdown but will 
just turn off, requiring a restart! So, something is seriously wrong in the 
power manager and/or the system. Now, I never leave my laptop unintended when 
running on battery for fear that it will be off if I take too long to come back.

So, all of this to say that if I was you, I would not beat this dead horse too 
much. Apple has already given up so don't waste your time. There is no way that 
if they had been serious, it wouldn't have been fixed by now.

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.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: crash in initWithCoder

2011-03-16 Thread Greg Parker
On Mar 16, 2011, at 10:31 AM, James Maxwell wrote:
> I wasn't sure how to enable Guard Malloc in Xcode 4, so I just ran it with 
> the Allocations Instrument. Lo and behold, it doesn't crash. This didn't make 
> much sense to me, so I tried running the release build, rather than the debug 
> build. No crash. Switch back to debug boom.

Memory smashers can be wildly variable. Perhaps the bug is an uninitialized 
variable that has a different value in debug vs release. Perhaps the memory 
overrun happens to corrupt a different area of memory that doesn't cause a 
crash (or at least doesn't cause a crash yet). In any case the bug may still be 
there, waiting to crash or corrupt customer data when you least expect it.


-- 
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: crash in initWithCoder

2011-03-16 Thread James Maxwell
Ah, got it. Thanks!
Unfortunately, Guard Malloc doesn't appear to reveal anything special. 
Here's the top several lines of my log:

GuardMalloc: Allocations will be placed on 16 byte boundaries.
GuardMalloc:  - Some buffer overruns may not be noticed.
GuardMalloc:  - Applications using vector instructions (e.g., SSE or Altivec) 
should work.
GuardMalloc: GuardMalloc version 23
2011-03-16 11:03:49.011 ManuScore[80074:903] Starting unarchive of CbCM 
hierarchy file...
warning: Unable to restore previously selected frame.
(gdb) bt
bt
#0  0x001648be in GMmalloc_zone_malloc_internal ()
#1  0x94920a13 in _CFRuntimeCreateInstance ()
#2  0x94943482 in CFNumberCreate ()
#3  0x949586f2 in __CFBinaryPlistCreateObject2 ()
#4  0x94985fe0 in __CFBinaryPlistCreateObject ()
#5  0x9823eb11 in _decodeObjectBinary ()
#6  0x98240314 in -[NSKeyedUnarchiver _decodeArrayOfObjectsForKey:] ()
#7  0x98240981 in -[NSArray(NSArray) initWithCoder:] ()
#8  0x9823f508 in _decodeObjectBinary ()
#9  0x9823e800 in _decodeObject ()
#10 0x000ced15 in -[CbCM_Node initWithCoder:] (self=0xc1f0ffa0, 
_cmd=0x9433805c, aDecoder=0x1d279fb0) at 
/Volumes/Wheet-Docs/jamesmaxwell/Documents/xcode/rubato/ManuScore+MusiCOG/ManuScore
 Test Build/ManuScore/CbCM_Node.m:552

J.

On 2011-03-16, at 10:43 AM, Alex Kac wrote:

> Edit your Scheme and go to the "Run" section. Then go to the Diagnostics tab.
> 
> On Mar 16, 2011, at 12:35 PM, Sean McBride wrote:
> 
>> On Wed, 16 Mar 2011 10:31:26 -0700, James Maxwell said:
>> 
>>> Okay, strange discovery.
>>> 
>>> I wasn't sure how to enable Guard Malloc in Xcode 4
>> 
>> Someone on the Xcode list could probably help there...
>> 
>>> , so I just ran it
>>> with the Allocations Instrument. Lo and behold, it doesn't crash. This
>>> didn't make much sense to me, so I tried running the release build,
>>> rather than the debug build. No crash. Switch back to debug boom.
>>> 
>>> Any thoughts on what this might mean?
>> 
>> Have you looked at the Debugging Magic technote?  It's well worth
>> reading in its entirety.
>> 
>> 
>> 
>> All the bits about memory management should help you debug this.
>> 
>> --
>> 
>> 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/alex%40webis.net
>> 
>> This email sent to a...@webis.net
> 
> Alex Kac - President and Founder
> Web Information Solutions, Inc. 
> 
> "It is useless for sheep to pass a resolution in favor of vegetarianism while 
> wolves remain of a different opinion."
> -- William Randolph Inge
> 
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
> 
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/jbmaxwell%40rubato-music.com
> 
> This email sent to jbmaxw...@rubato-music.com

James B Maxwell
Composer/Doctoral Student
School for the Contemporary Arts (SCA)
School for Interactive Arts + Technology (SIAT)
Simon Fraser University
jbmaxw...@rubato-music.com
jbmax...@sfu.ca

___

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

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


Creating an NSExpression with a keypath and variable

2011-03-16 Thread Kyle Sluder
Hi all,

Is it really impossible to create an NSExpression of the form
"$variableName.someKeyPath"? I can create an NSExpression for
$variableName, and I can create an NSExpression for someKeyPath, but I
can't create one that contains both.

The actual problem is that I'm trying to create an NSPredicate for
"SUBQUERY(events, $x, $x isKindOfClass: %@ AND $x.text CONTAINS[cd]
$searchString).@count != 0". Since the method in question is called
periodically (it's the action method of a filter control), I was
hoping to create a static variable-based NSPredicate, rather than
reconstruct the predicate every time this method gets called. But that
didn't work because it didn't descend into the subquery's subpredicate
to replace $searchString.

--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: Debugging a sleepless Mac

2011-03-16 Thread Jean-Daniel Dupas

Le 16 mars 2011 à 19:00, Laurent Daudelin a écrit :

> On Mar 16, 2011, at 09:35, Matt Gough wrote:
> 
>> On 16 Mar 2011, at 15:32, Kyle Sluder wrote:
>> 
>>> On Wed, Mar 16, 2011 at 5:37 AM, Matt Gough  wrote:
 So it seems that something else is preventing idle sleep, but I've no idea 
 how to find the culprit. Is there some defaults setting I can use that 
 will log what the OS wants to do at sleep time and what is blocking it?
>>> 
>>> According to the I/O Kit Power Management Release Notes, `pmset -g`
>>> should list all outstanding power management assertions.
>>> http://developer.apple.com/library/mac/#releasenotes/Darwin/RN-IOKitPowerManagment/_index.html
>>> 
>>> I'd say try that and see if it tells you who's preventing system sleep.
>>> 
>>> --Kyle Sluder
>> 
>> 
>> Thanks to everyone for the suggestions so far.
>> 
>> Alas, pmset -g it doesn't show any active assertions (I know it can do as I 
>> slapped one in my code and it showed up).
>> 
>> I have also tried turning off ttyskeepawake, but to no avail.
>> 
>> I didn't mention in my previous email that I have no problem with display 
>> sleep working correctly, its just idle sleep that is misbehaving.
>> 
>> Looking through the logs, I can't see any power related ones.
>> 
>> Apart from user interactions, what other sorts of activity automatically 
>> prevent idle sleep?
> 
> Many things can prevent sleep. On my MacBook Pro, when I do a clean install 
> and don't run too many applications (Mail, Safari, iChat, Skype), the system 
> will sometimes go to sleep according to my settings in Energy Saver. As soon 
> as I start running additional processes like Growl or DropBox, the system 
> will not go to sleep under any circumstances, even when running on battery. I 
> think the problem is in the system. I did file a bug on this over a year ago. 
> It was declared a duplicate of another and dev support told me it was a known 
> issue. I checked the status a couple of months ago and it was still open. 
> When I checked with them, they told me it was still being work on. That tells 
> me that the engineers just simply gave up on Snow Leopard and are spending 
> almost all their time on Lion. Still, that's a bit upsetting to have a laptop 
> that won't go to sleep because there are a few processes running. What's the 
> purpose of having a sleep feature if you have to quit all running processes?
> 
> And before someone says "you probably have something that keeps the system 
> active", I went through a lot of analysis with developer support, providing 
> them many pmset and console logs and among all processes that were running, 
> there wasn't one keeping the system busy.

Just calling UpdateSystemActivity() once every minute is enough to prevent 
sleeping. no need to keep the system busy nor to install PMNotification visible 
in pmset.
And checking if a running process call this function from time to time it is 
not trivial.

-- Jean-Daniel




___

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

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

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

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


Re: Creating an NSExpression with a keypath and variable

2011-03-16 Thread Dave DeLong
Directly, yes.  NSExpression stores a keypath as a single string, whereas 
variables are store in their own kind of NSExpression object.  When you replace 
variables with new values, it's only looking for the certain kinds of 
NSExpression objects to replace.  Everything else stays the same.

Some notes about your predicate:

- I'm not sure you can do "$x isKindOfClass: %@" as the predicate to a 
subquery, although I haven't tried it.  If it doesn't work, you could do this 
with a FUNCTION ("FUNCTION($x, 'ks_isKindOfClass:', %@)").  Note, however, that 
you'd have to create a category on NSObject that simply boxes the return value 
of isKindOfClass into an NSNumber.  FUNCTION()'s don't like methods that return 
primitives.

- If you want to use a keypath with a variable, you could do:

FUNCTION($x, 'text') CONTAINS[cd] $searchString

That preserves $x as a variable expression so that it will be replaced properly.

This would make your entire predicate:

SUBQUERY(events, $x, FUNCTION($x, 'ks_isKindOfClass:', %@) AND (FUNCTION($x, 
'text') CONTAINS[cd] $searchString)).@count != 0

Dave

On Mar 16, 2011, at 11:20 AM, Kyle Sluder wrote:

> Hi all,
> 
> Is it really impossible to create an NSExpression of the form
> "$variableName.someKeyPath"? I can create an NSExpression for
> $variableName, and I can create an NSExpression for someKeyPath, but I
> can't create one that contains both.
> 
> The actual problem is that I'm trying to create an NSPredicate for
> "SUBQUERY(events, $x, $x isKindOfClass: %@ AND $x.text CONTAINS[cd]
> $searchString).@count != 0". Since the method in question is called
> periodically (it's the action method of a filter control), I was
> hoping to create a static variable-based NSPredicate, rather than
> reconstruct the predicate every time this method gets called. But that
> didn't work because it didn't descend into the subquery's subpredicate
> to replace $searchString.
> 
> --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/davedelong%40me.com
> 
> This email sent to davedel...@me.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: Creating an NSExpression with a keypath and variable

2011-03-16 Thread Dave DeLong

On Mar 16, 2011, at 11:28 AM, Dave DeLong wrote:

> - If you want to use a keypath with a variable, you could do:
> 
> FUNCTION($x, 'text') CONTAINS[cd] $searchString

Or put another way:

FUNCTION($x, 'valueForKeyPath:', 'foo.bar.baz')

Dave
___

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

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

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

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


Re: Creating an NSExpression with a keypath and variable

2011-03-16 Thread Kyle Sluder
On Wed, Mar 16, 2011 at 11:28 AM, Dave DeLong  wrote:
> Directly, yes.  NSExpression stores a keypath as a single string, whereas 
> variables are store in their own kind of NSExpression object.  When you 
> replace variables with new values, it's only looking for the certain kinds of 
> NSExpression objects to replace.  Everything else stays the same.

Well that's a shame. That's also probably why [[NSPredicate
predicateWithFormat:@"SUBQUERY(events, $x, $x = $someVar)"]
predicateWithSubstitutionVariables:[NSDictionary
dictionaryWithObject:@"foo" forKey:@"someVar"]] doesn't work, either.
It skips over the subquery NSExpression.

>
> Some notes about your predicate:
>
> - I'm not sure you can do "$x isKindOfClass: %@" as the predicate to a 
> subquery, although I haven't tried it.

You can, but the syntax isn't documented. Then again, much of
NSPredicate is poorly documented.

>  If it doesn't work, you could do this with a FUNCTION ("FUNCTION($x, 
> 'ks_isKindOfClass:', %@)").  Note, however, that you'd have to create a 
> category on NSObject that simply boxes the return value of isKindOfClass into 
> an NSNumber.  FUNCTION()'s don't like methods that return primitives.

It seems to deal with BOOLs just fine; I believe it's internally
wrapping the value in an NSNumber, much like how arbitrary keypaths
are supported on 10.5 and up (they get wrapped in NSNumbers or
NSValues if necessary).

--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: Length of NSWindow's stringWithSavedFrame result?

2011-03-16 Thread John Bartleson

Thanks, Graham.

On Mar 8, 2011, at 12:39 AM, Graham Cox wrote:

You could just make it bigger - it's a very transient piece of  
memory on the stack (or, if that's a problem, just malloc and free a  
chunk). Since getxattr allows you to pass in the max size of the  
buffer, it's also safe from a buffer overflow attack.



Another solution was suggested offline:

On Mar 7, 2011, at 10:14 PM, Scott Ribe wrote:

From the xattr man page:
When value is set to NULL, getxattr() returns current size of the  
named attribute. This facility can be used to determine the size of  
a buffer sufficiently large to hold the data currently associated  
with the attribute.

--
Scott Ribe
scott_r...@elevated-dev.com
http://www.elevated-dev.com/
(303) 722-0567 voice



My response:


Thanks, Scott. Obviously I should RTFM 8-)

I coded it to get the attribute size as you've described, allocate a  
large enough buffer, and call getxattr() again for the data. It  
works great!




I found, though, that strangely I don't have any documentation of  
the getxattr() behaviour you've described.
1) I was using the book "Advanced Mac OS X Programming", by  
Dalrymple and Hillegass. It has a section on xattributes, but  
doesn't mention

 the ability to set value to NULL in getxattr().
2) I tried to get the xattr man page, but typing 'man xattr' and  
'man getxattr()' into the terminal didn't return anything.
   a) I thought man pages were only for commands. Can we get man  
pages for C functions too?

   b) I'm still on OS X 10.5. Maybe that's why I don't get anything?



In further discussion with Scott, it looks like the xattribute docs  
aren't in the 10.5 man pages

___

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

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

2011-03-16 Thread Laurent Daudelin
On Mar 16, 2011, at 11:23, Jean-Daniel Dupas wrote:

> 
> Le 16 mars 2011 à 19:00, Laurent Daudelin a écrit :
> 
>> On Mar 16, 2011, at 09:35, Matt Gough wrote:
>> 
>>> On 16 Mar 2011, at 15:32, Kyle Sluder wrote:
>>> 
 On Wed, Mar 16, 2011 at 5:37 AM, Matt Gough  wrote:
> So it seems that something else is preventing idle sleep, but I've no 
> idea how to find the culprit. Is there some defaults setting I can use 
> that will log what the OS wants to do at sleep time and what is blocking 
> it?
 
 According to the I/O Kit Power Management Release Notes, `pmset -g`
 should list all outstanding power management assertions.
 http://developer.apple.com/library/mac/#releasenotes/Darwin/RN-IOKitPowerManagment/_index.html
 
 I'd say try that and see if it tells you who's preventing system sleep.
 
 --Kyle Sluder
>>> 
>>> 
>>> Thanks to everyone for the suggestions so far.
>>> 
>>> Alas, pmset -g it doesn't show any active assertions (I know it can do as I 
>>> slapped one in my code and it showed up).
>>> 
>>> I have also tried turning off ttyskeepawake, but to no avail.
>>> 
>>> I didn't mention in my previous email that I have no problem with display 
>>> sleep working correctly, its just idle sleep that is misbehaving.
>>> 
>>> Looking through the logs, I can't see any power related ones.
>>> 
>>> Apart from user interactions, what other sorts of activity automatically 
>>> prevent idle sleep?
>> 
>> Many things can prevent sleep. On my MacBook Pro, when I do a clean install 
>> and don't run too many applications (Mail, Safari, iChat, Skype), the system 
>> will sometimes go to sleep according to my settings in Energy Saver. As soon 
>> as I start running additional processes like Growl or DropBox, the system 
>> will not go to sleep under any circumstances, even when running on battery. 
>> I think the problem is in the system. I did file a bug on this over a year 
>> ago. It was declared a duplicate of another and dev support told me it was a 
>> known issue. I checked the status a couple of months ago and it was still 
>> open. When I checked with them, they told me it was still being work on. 
>> That tells me that the engineers just simply gave up on Snow Leopard and are 
>> spending almost all their time on Lion. Still, that's a bit upsetting to 
>> have a laptop that won't go to sleep because there are a few processes 
>> running. What's the purpose of having a sleep feature if you have to quit 
>> all running processes?
>> 
>> And before someone says "you probably have something that keeps the system 
>> active", I went through a lot of analysis with developer support, providing 
>> them many pmset and console logs and among all processes that were running, 
>> there wasn't one keeping the system busy.
> 
> Just calling UpdateSystemActivity() once every minute is enough to prevent 
> sleeping. no need to keep the system busy nor to install PMNotification 
> visible in pmset.
> And checking if a running process call this function from time to time it is 
> not trivial.
> 
> -- Jean-Daniel

Using a tool like "otool", wouldn't someone be able to find that symbol in a 
given binary?

-Laurent.
-- 
Laurent Daudelin
AIM/iChat/Skype:LaurentDaudelin 
http://www.nemesys-soft.com/
Logiciels Nemesys Software  
laur...@nemesys-soft.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: Debugging a sleepless Mac

2011-03-16 Thread Michael Nickerson

On Mar 16, 2011, at 8:37 AM, Matt Gough wrote:

> I've just been adding code to support NSWorkspaceWillSleepNotification. 
> Having lowered my Computer sleep time right down and left the Mac untouched 
> for several minutes, my code never fires and the Mac doesn't actually go to 
> sleep. Even without my app running and leaving the Mac for several hours I 
> notice that it still won't sleep.
> 
> So it seems that something else is preventing idle sleep, but I've no idea 
> how to find the culprit. Is there some defaults setting I can use that will 
> log what the OS wants to do at sleep time and what is blocking it?
> 
> 

I don't know of a way to log what might be blocking it, but I ran some tests a 
while back that showed the system has to be idle for 10 minutes before it will 
sleep.  Or, at least the disk has to be idle for 10 minutes, otherwise sleep is 
deferred.  I ran into this with one of my applications that is long running.  
It (can) access the disk frequently to open and read files.  It turned out that 
was causing my Mac not to sleep - definitely not something I wanted to happen.

What I ended up doing was writing a method that fires via a timer every minute, 
and checks the sleep time - if I'm within 10 minutes of it, I stop my 
application from reading anymore.  This stopped the problem, so far as my own 
application was concerned, though as others have pointed out there's plenty of 
other things that can keep the system from sleeping that you might not have 
control of.

So, here's a short version of the code I'm using to do this (typed in Mail):

#import 
#import 

- (void)checkIdleTime:(NSTimer *)timer
{
unsigned long mins = 0, systemIdleMinutes = 0;
CFTimeInterval idleSeconds = CGEventSourceSecondsSinceLastEventType( 
kCGEventSourceStateCombinedSessionState, kCGAnyInputEventType );
static CFTimeInterval lastSeconds = 0.0;

systemIdleMinutes = lrint(idleSeconds / 60.0); /* Gives minutes of 
inactivity */

if ( lastSeconds > idleSeconds ) {
/* User activity has occurred since last check, if you disabled 
anything you can re-enable it here. */
}

lastSeconds = idleSeconds;

/* No need to check this if the system isn't idle. */
if ( systemIdleMinutes ) {
mach_port_t master_device_port;
io_connect_t fb = 0;
kern_return_t kr = kIOReturnSuccess;
IOReturn err = kIOReturnSuccess;

kr = IOMasterPort( bootstrap_port, &master_device_port );
if ( kr == kIOReturnSuccess ) {
fb = IOPMFindPowerManagement( master_device_port );
if ( fb ) {
err = IOPMGetAggressiveness( fb, kPMMinutesToSleep, &mins );
if ( (err == kIOReturnSuccess) && (mins > 0) && ((mins - 
systemIdleMinutes) <= 10) ) {
/* Do whatever you want to notify your app it should stop 
disk access here */
}
/* If you want to find out how long until the screen dims, you 
can do the same as above but use kPMMinutesToDim instead. */
IOServiceClose( fb );
}
}
}
}


Do note one limitation of this as is: if the system is set to sleep in 10 
minutes or less, it will fire the condition as soon as the timer is hit and 
there has been no user activity for at least a minute.  This is something I've 
been meaning to look into but haven't as yet.


--
Darkshadow
(aka Michael Nickerson)
http://www.nightproductions.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: Debugging a sleepless Mac

2011-03-16 Thread Tony Romano
Not sure if it was mentioned, but did you look at the
/var/log/DiagnosticMessages log, it should have all the sleep activity
messages. 
Tony Romano












On 3/16/11 11:36 AM, "Michael Nickerson"  wrote:

>
>On Mar 16, 2011, at 8:37 AM, Matt Gough wrote:
>
>> I've just been adding code to support NSWorkspaceWillSleepNotification.
>>Having lowered my Computer sleep time right down and left the Mac
>>untouched for several minutes, my code never fires and the Mac doesn't
>>actually go to sleep. Even without my app running and leaving the Mac
>>for several hours I notice that it still won't sleep.
>> 
>> So it seems that something else is preventing idle sleep, but I've no
>>idea how to find the culprit. Is there some defaults setting I can use
>>that will log what the OS wants to do at sleep time and what is blocking
>>it?
>> 
>> 
>
>I don't know of a way to log what might be blocking it, but I ran some
>tests a while back that showed the system has to be idle for 10 minutes
>before it will sleep.  Or, at least the disk has to be idle for 10
>minutes, otherwise sleep is deferred.  I ran into this with one of my
>applications that is long running.  It (can) access the disk frequently
>to open and read files.  It turned out that was causing my Mac not to
>sleep - definitely not something I wanted to happen.
>
>What I ended up doing was writing a method that fires via a timer every
>minute, and checks the sleep time - if I'm within 10 minutes of it, I
>stop my application from reading anymore.  This stopped the problem, so
>far as my own application was concerned, though as others have pointed
>out there's plenty of other things that can keep the system from sleeping
>that you might not have control of.
>
>So, here's a short version of the code I'm using to do this (typed in
>Mail):
>
>#import 
>#import 
>
>- (void)checkIdleTime:(NSTimer *)timer
>{
>unsigned long mins = 0, systemIdleMinutes = 0;
>CFTimeInterval idleSeconds = CGEventSourceSecondsSinceLastEventType(
>kCGEventSourceStateCombinedSessionState, kCGAnyInputEventType );
>static CFTimeInterval lastSeconds = 0.0;
>
>systemIdleMinutes = lrint(idleSeconds / 60.0); /* Gives minutes of
>inactivity */
>
>if ( lastSeconds > idleSeconds ) {
>/* User activity has occurred since last check, if you disabled
>anything you can re-enable it here. */
>}
>
>lastSeconds = idleSeconds;
>
>/* No need to check this if the system isn't idle. */
>if ( systemIdleMinutes ) {
>mach_port_t master_device_port;
>io_connect_t fb = 0;
>kern_return_t kr = kIOReturnSuccess;
>IOReturn err = kIOReturnSuccess;
>
>kr = IOMasterPort( bootstrap_port, &master_device_port );
>if ( kr == kIOReturnSuccess ) {
>fb = IOPMFindPowerManagement( master_device_port );
>if ( fb ) {
>err = IOPMGetAggressiveness( fb, kPMMinutesToSleep, &mins
>);
>if ( (err == kIOReturnSuccess) && (mins > 0) && ((mins -
>systemIdleMinutes) <= 10) ) {
>/* Do whatever you want to notify your app it should
>stop disk access here */
>}
>/* If you want to find out how long until the screen
>dims, you can do the same as above but use kPMMinutesToDim instead. */
>IOServiceClose( fb );
>}
>}
>}
>}
>
>
>Do note one limitation of this as is: if the system is set to sleep in 10
>minutes or less, it will fire the condition as soon as the timer is hit
>and there has been no user activity for at least a minute.  This is
>something I've been meaning to look into but haven't as yet.
>
>
>--
>Darkshadow
>(aka Michael Nickerson)
>http://www.nightproductions.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/tonyrom%40hotmail.com
>
>This email sent to tony...@hotmail.com
>


___

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

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

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

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


Re: Debugging a sleepless Mac

2011-03-16 Thread Aaron Burghardt

On Mar 16, 2011, at 2:50 PM, Laurent Daudelin wrote:

>> Just calling UpdateSystemActivity() once every minute is enough to prevent 
>> sleeping. no need to keep the system busy nor to install PMNotification 
>> visible in pmset.
>> And checking if a running process call this function from time to time it is 
>> not trivial.
>> 
> 
> Using a tool like "otool", wouldn't someone be able to find that symbol in a 
> given binary?


"nm" dumps the linker symbol table. "otool -L" will list the libraries linked 
against.

Aaron

___

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

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


Quartz Debug: UI Resolution

2011-03-16 Thread Todd Heberlein
I am trying to use the Quartz Debug app to scale up my app (for a screenshot 
for MAS). My content looks great in the scaled up windows, but the window 
frames themselves look terrible. For example the title bar and title in it are 
all screwed up.

Is there a setting I can use to make the title bar scale up correctly?

Thanks,

Todd

___

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

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

2011-03-16 Thread Kyle Sluder
On Mar 16, 2011, at 2:25 PM, Todd Heberlein  wrote:

> Is there a setting I can use to make the title bar scale up correctly?

No, resolution independence has never worked completely.

--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


Symbol not found

2011-03-16 Thread koko
A customer running 10.5.8 gets this message when launching my app.  

Dyld Error Message:
Symbol not found: _OBJC_CLASS_$_NSURL
Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It 
Mac
Expected in: 
/System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation

The app is built 32/64 universal with a deployment target of 10.5 and an SDK of 
of 10.6.

NSURL is available form 10.0

Can someone shed light on this ?

-koko___

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

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

2011-03-16 Thread Stephen J. Butler
On Wed, Mar 16, 2011 at 6:08 PM, koko  wrote:
> A customer running 10.5.8 gets this message when launching my app.
>
> Dyld Error Message:
> Symbol not found: _OBJC_CLASS_$_NSURL
> Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It
> Mac
> Expected in:
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
>
> The app is built 32/64 universal with a deployment target of 10.5 and an SDK 
> of of 10.6.
>
> NSURL is available form 10.0
>
> Can someone shed light on this ?

Looks like in 10.5 NSURL was in Foundation.framework and in 10.6 they
moved it to CoreFoundation.framework. However, I don't know how to fix
this other than to build against the 10.5 SDK.

(not saying it's not fixable... just I don't know how)
___

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

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

2011-03-16 Thread Nick Zitzmann

On Mar 16, 2011, at 5:08 PM, koko wrote:

> A customer running 10.5.8 gets this message when launching my app.  
> 
> Dyld Error Message:
> Symbol not found: _OBJC_CLASS_$_NSURL
> Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It 
> Mac
> Expected in: 
> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
> 
> The app is built 32/64 universal with a deployment target of 10.5 and an SDK 
> of of 10.6.
> 
> NSURL is available form 10.0
> 
> Can someone shed light on this ?

That symbol says the user ran the 64-bit slice of the app. I can't really 
recommend allowing 64-bit apps to run under Leopard. Yes, the support was 
there, but the 64-bit environment wasn't really RFPT in Leopard. There were a 
lot of little to big problems back then that made it just not worth it.

You might want to ask the user if they could try running the app as a 32-bit 
app, which they can do by checking a box in the get info window in the Finder. 
And if that makes the app work, then I would recommend setting the minimum OS 
version per-architecture key in the app's Info.plist so that the 64-bit slice 
will only run in Snow Leopard.

Nick Zitzmann


___

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

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

2011-03-16 Thread koko
Thanks so much for all these informative answers!

-koko
On Mar 16, 2011, at 5:29 PM, Nick Zitzmann wrote:

> 
> On Mar 16, 2011, at 5:08 PM, koko wrote:
> 
>> A customer running 10.5.8 gets this message when launching my app.  
>> 
>> Dyld Error Message:
>> Symbol not found: _OBJC_CLASS_$_NSURL
>> Referenced from: /Applications/Convert It Mac.app/Contents/MacOS/Convert It 
>> Mac
>> Expected in: 
>> /System/Library/Frameworks/CoreFoundation.framework/Versions/A/CoreFoundation
>> 
>> The app is built 32/64 universal with a deployment target of 10.5 and an SDK 
>> of of 10.6.
>> 
>> NSURL is available form 10.0
>> 
>> Can someone shed light on this ?
> 
> That symbol says the user ran the 64-bit slice of the app. I can't really 
> recommend allowing 64-bit apps to run under Leopard. Yes, the support was 
> there, but the 64-bit environment wasn't really RFPT in Leopard. There were a 
> lot of little to big problems back then that made it just not worth it.
> 
> You might want to ask the user if they could try running the app as a 32-bit 
> app, which they can do by checking a box in the get info window in the 
> Finder. And if that makes the app work, then I would recommend setting the 
> minimum OS version per-architecture key in the app's Info.plist so that the 
> 64-bit slice will only run in Snow Leopard.
> 
> Nick Zitzmann
> 
> 
> 

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Faster text drawing with configurable stroke width

2011-03-16 Thread Martin Wierschin
> I'm currently drawing text one character at a time with -[NSAttributedString 
> drawWithRect:options:], and it is really slow. I'm looking for a faster 
> alternative.
> 
> I draw one character at a time because I need exact control over horizontal 
> positioning (regardless of whether the font is monospaced or not, I force 
> characters onto a grid--this is non-negotiable)

Without knowing your exact requirements, I can't say if this technique meets 
them (or is faster than what you're already doing), but you might try rigging 
up an NSTextStorage where each composed character sequence is separated by a 
tab character. To achieve the exact spacing you'd also apply an 
NSParagraphStyle with corresponding center-aligned uniformly-spaced NSTextTabs. 
Then just let NSLayoutManager do all the drawing for you all at once.

~Martin

___

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

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)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: Faster text drawing with configurable stroke width

2011-03-16 Thread Ken Ferry
On Sun, Mar 13, 2011 at 3:03 PM, George Nachman  wrote:

> Hi cocoa-dev,
>
> I'm currently drawing text one character at a time with
> -[NSAttributedString
> drawWithRect:options:], and it is really slow. I'm looking for a faster
> alternative.
>
> I draw one character at a time because I need exact control over horizontal
> positioning (regardless of whether the font is monospaced or not, I force
> characters onto a grid--this is non-negotiable) and I'm not aware of
> another
> way to achieve this that also supports my second requirement:
>
> I am using  -[NSAttributedString drawWithRect:options:]
> instead CGContextShowGlyphsWithAdvances() or CTLineDraw() because it
> supports NSStrokeWidthAttributeName.


Have you looked at CGContextSetTextDrawingMode and CGContextSetLineWidth?


> It also does a nice (but not as nice a
> NSTextView) job at rendering combining marks.
>
> My performance troubles are significant when there is a substantial amount
> of new text, so caching layouts would do me little good. I suspect there
> might be something lurking in NSLayoutManager/NSTypesetter/etc. that can
> help me, but I haven't found it.
>
> Thanks for your help,
> George
> ___
>
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
>
> Please do not post admin requests or moderator comments to the list.
> Contact the moderators at cocoa-dev-admins(at)lists.apple.com
>
> Help/Unsubscribe/Update your Subscription:
> http://lists.apple.com/mailman/options/cocoa-dev/kenferry%40gmail.com
>
> This email sent to kenfe...@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


about keystrokes out of the window

2011-03-16 Thread Jonathan Chacón Barbero
Hello everybody,

I want to develop an application that the user can manage it using some 
keystrokes but the user can use these keystrokes when the window of the 
application is not focused.
For example, my app is opened and the user is writing in pages. The user can 
activate a feature of my application pressing  caplocks+left arrow.
How can I do this? I searched abut managing keystrokes for Mac OSX but I didn't 
find anything about this.

thanks 




Regards
Jonathan Chacón Barbero
   Accessibility, usability and new technologies consultant

Phone: +34 679953948
e-Mail: jonathan.cha...@telefonica.net
Blog: http://www.programaraciegas.es
Twitter: http://www.twitter.com/jonathanchacon
LinkedIn: http://es.linkedin.com/in/jonathanchacon
Facebook: http://www.facebook.com/jonathan.chacon.barbero
Messenger: tyf...@hotmail.com
Skype: Tyflos_
FaceTime: jonathan.cha...@telefonica.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: about keystrokes out of the window

2011-03-16 Thread Nick Zitzmann

On Mar 16, 2011, at 10:56 PM, Jonathan Chacón Barbero wrote:

> I want to develop an application that the user can manage it using some 
> keystrokes but the user can use these keystrokes when the window of the 
> application is not focused.
> For example, my app is opened and the user is writing in pages. The user can 
> activate a feature of my application pressing  caplocks+left arrow.
> How can I do this? I searched abut managing keystrokes for Mac OSX but I 
> didn't find anything about this.

Have you tried the hotkey functions in the Carbon Event Manager?

Nick Zitzmann




___

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

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

2011-03-16 Thread Jonathan Chacón Barbero
Hello,

thanks for your answer.

I'm developing using Cocoa because I want to develop an accessible app. I 
didn't know Carbon Event Manager. I'll study it but Can I use it in a Cocoa 
application?

thanks and regards
Jonathan Chacón

El 17/03/2011, a las 06:15, Nick Zitzmann escribió:

> 
> On Mar 16, 2011, at 10:56 PM, Jonathan Chacón Barbero wrote:
> 
>> I want to develop an application that the user can manage it using some 
>> keystrokes but the user can use these keystrokes when the window of the 
>> application is not focused.
>> For example, my app is opened and the user is writing in pages. The user can 
>> activate a feature of my application pressing  caplocks+left arrow.
>> How can I do this? I searched abut managing keystrokes for Mac OSX but I 
>> didn't find anything about this.
> 
> Have you tried the hotkey functions in the Carbon Event Manager?
> 
> Nick Zitzmann
> 
> 
> 
> 

___

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

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