Create custom NSTableView with a button inside

2012-09-03 Thread Alfian Busyro

Hi guys,

I try to implement a list view using|NSTableView|cell-based, but having 
difficulty creating a button inside the cell column.


are there any examples of how to create a custom cell-based table view 
with a button inside of the column ?


ps: I have tried to create custom tableview example that display image 
and text, then I edit the code and add button and the result the button 
wasn't showing up


Best Regards,
Alfian

___

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

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

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

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


Re: Create custom NSTableView with a button inside

2012-09-03 Thread Koen van der Drift

On Sep 3, 2012, at 5:50 AM, Alfian Busyro alfian.bus...@kddi-web.com wrote:

 are there any examples of how to create a custom cell-based table view with a 
 button inside of the column ?


Did you look at the TableViewPlayground sample project from Apple?

- Koen.
___

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

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

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

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


UIDocument openWithCompletionHandler: called on what thread?

2012-09-03 Thread Roland King
Here's a small snippet from the docs for UIDocument's openWithCompletionHandler:

Parameters
completionHandler
A block with code to execute after the open operation concludes. The 
block returns no value and has one parameter:
success
YES if the open operation succeeds, otherwise NO.

The block is invoked on the main queue.

I have a subclass of UIDocument, this is my openWithCompletionHandler override, 
I need to cache something at the point the document is opened and closed ..

-(void)openWithCompletionHandler:(void (^)(BOOL))completionHandler
{
// after the open, recalcuate the topic
[ super openWithCompletionHandler:^(BOOL success){
[ self cacheTopic ];
if( completionHandler )
completionHandler( success );   // -- I'm here
} ];
}


I'm in the debugger right now at the 'completionHander( success )' call and I'm 
on Thread 11. That is not the main thread, harder to show but if I type this 
into LLDB  ..

(lldb) p (BOOL)[ NSThread isMainThread ]
(BOOL) $2 = NO
(lldb) 

Is there something entirely braindead I am missing here or should I be on the 
main queue and thus on the main thread if the documentation is correct? 





___

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

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

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

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


Re: UIDocument openWithCompletionHandler: called on what thread?

2012-09-03 Thread Luke Hiesterman
The documentation isn't entirely accurate. The completion handler will only be 
executed on the main queue if you call the method on the main queue. In 
general, the completion handler is executed on the same queue that the 
constituent method was called on. 

Luke

On Sep 3, 2012, at 6:29 AM, Roland King r...@rols.org wrote:

 Here's a small snippet from the docs for UIDocument's 
 openWithCompletionHandler:
 
Parameters
completionHandler
A block with code to execute after the open operation concludes. The block 
 returns no value and has one parameter:
success
YES if the open operation succeeds, otherwise NO.
 
The block is invoked on the main queue.
 
 I have a subclass of UIDocument, this is my openWithCompletionHandler 
 override, I need to cache something at the point the document is opened and 
 closed ..
 
-(void)openWithCompletionHandler:(void (^)(BOOL))completionHandler
{
// after the open, recalcuate the topic
[ super openWithCompletionHandler:^(BOOL success){
[ self cacheTopic ];
if( completionHandler )
completionHandler( success );// -- I'm here
} ];
}
 
 
 I'm in the debugger right now at the 'completionHander( success )' call and 
 I'm on Thread 11. That is not the main thread, harder to show but if I type 
 this into LLDB  ..
 
(lldb) p (BOOL)[ NSThread isMainThread ]
(BOOL) $2 = NO
(lldb) 
 
 Is there something entirely braindead I am missing here or should I be on the 
 main queue and thus on the main thread if the documentation is correct? 
 
 
 
 
 
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)

2012-09-03 Thread Koen van der Drift

On Aug 25, 2012, at 6:10 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 NSRectArrayrectArray = [[self layoutManager] 
 rectArrayForCharacterRange: aRange

 withinSelectedCharacterRange: selectedRange
 
 inTextContainer: [self textContainer]
   
 rectCount: rectCount];


For some reason, the height of the last rect in the NSRectArray is smaller than 
the other ones, and therefore the CALayer I draw behind the corresponding range 
of text looks wrong.

My font size is 16, and the line spacing is set to 12.   For most rects, the 
height returned is 31 (= 16 + 12 + 3), but for the last one, the height is 19 ( 
= 16 + 3).

So it seems for the last rect, the linespace is ignored.  I can test for that, 
and correct it, but I was wondering what is going on.  And where does the '3' 
come from?

- Koen.


___

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

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

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

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


Re: Create custom NSTableView with a button inside

2012-09-03 Thread Conrad Shultz
On 09/03/2012 05:11 AM, Koen van der Drift wrote:
 
 On Sep 3, 2012, at 5:50 AM, Alfian Busyro alfian.bus...@kddi-web.com wrote:
 
 are there any examples of how to create a custom cell-based table view with 
 a button inside of the column ?
 
 
 Did you look at the TableViewPlayground sample project from Apple?

TableViewPlayground covers view-based table views; the OP specified
cell-based table views.

My question to Alfian, however, is why a cell-based table view is
desired.  Are you targeting 10.6?

-- 
Conrad Shultz

Synthetiq Solutions
www.synthetiqsolutions.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


How to get multiple NSURLs from Finder drop.

2012-09-03 Thread Todd Freese
I'm trying to get my App Sandboxed. I need to be able to accept a multi-file 
finder drop to import files. However, how did I get multiple NSURLs from the 
finder? There only seems to be two finder pasteboard types: 
NSFilenamesPboardType  NSURLPboardType. 

NSFilenamesPboardType won't work because it is passing strings. NSURLPboardType 
only accepts one a single file.

What am I missing here?

Todd 

__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


System Menu Bar

2012-09-03 Thread Charlie Dickman
Is there a way to make the system menu bar transparent from within a cocoa app?

Charlie Dickman
3tothe...@comcast.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Network and DarkWake

2012-09-03 Thread Greg Parker
On Sep 2, 2012, at 7:31 AM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:
 On 2 Sep 2012, at 20:46, Matt Patenaude m...@mattpatenaude.com wrote:
 
 Are you using it in the asynchronous callback style, or the synchronous 
 GetFlags function?
 
 I am using:
 SCNetworkReachabilitySetCallback()
 SCNetworkReachabilityScheduleWithRunLoop()
 
 Typical case:
 2012-09-02 20:59:33.540 +0700 DidWakeNotification
 2012-09-02 20:59:33.611 Error getaddrinfo(time.euro.apple.com, ntp) - 
 nodename nor servname provided, or not known
 2012-09-02 20:59:37.354  lost   internet connection 
 2012-09-02 20:59:37.375  newinternet connection 
 2012-09-02 20:59:37.391 try again - now everything is ok
 
 Seems like it just takes some time after wake (DarkWake or normal wake) for 
 things to get sorted out.

One option would be to try the network during the DidWake notification, and if 
that fails then try again when the Reachability notification arrives. That 
should be more reliable and efficient than sleep/retry.


-- 
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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to get multiple NSURLs from Finder drop.

2012-09-03 Thread Kyle Sluder

On Sep 3, 2012, at 1:32 PM, Todd Freese applecocoal...@filmworkers.com wrote:

 I'm trying to get my App Sandboxed. I need to be able to accept a multi-file 
 finder drop to import files. However, how did I get multiple NSURLs from the 
 finder? There only seems to be two finder pasteboard types: 
 NSFilenamesPboardType  NSURLPboardType. 
 
 NSFilenamesPboardType won't work because it is passing strings. 
 NSURLPboardType only accepts one a single file.
 
 What am I missing here?

Use the modern NSPasteboardItem API instead. You can access multiple items, 
each one being an NSURL.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: System Menu Bar

2012-09-03 Thread Ken Thomases
On Sep 3, 2012, at 3:45 PM, Charlie Dickman wrote:

 Is there a way to make the system menu bar transparent from within a cocoa 
 app?

The following AppleScript does it.  You can use NSAppleScript or Scripting 
Bridge or the like to achieve the same thing:

tell application System Events
set translucent menu bar of current desktop to true
end tell

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread William Squires
  Why should sandboxing on MacOS X even be necessary, seeing as we already have 
the Unix file permissions (and ACLs) to handle who can/cannot read/write to a 
file or directory? The only time I can see needing an entitlement is if you 
write low-level stuff (IOKit, kext's, USB drivers, 'fixit' utility programs, 
etc…) that could be hijacked by malware (and that normally run as root, or that 
spawn or talk to low-level services/daemons that do.) User-land programs 
shouldn't be able to write anywhere but the user's folder and subfolders 
thereof anyway.
  I can see the benefit of taking a more security-related stance on a closed 
platform like iOS so as to make writing malware harder, but for a 
general-purpose computing platform, this'll just put unnecessary roadblocks in 
the way of newbies who want to develop for it… Unless Apple's geniuses can 
figure out a way to simplify the whole shooting match to a one-click solution! 
:)

i.e.

1) Request a CSR from the Keychain Access.app
2) Upload the certificate to Apple  – once you login, anyway – via 
developer.apple.com/devcenter/ios/index.html or 
developer.apple.com/devcenter/mac/index.html; whichever.
3) Get back – and download – a simple digital 'token' file you can put on any 
development machine you own or have (legal) access to (i.e. that's tied to your 
apple ID) and Xcode will take care of the rest, including separating out the 
important bits (public/private keys, talking to keychain access to update said 
keys, code signing, creating entitlements, etc…)
4) Compile your iOS/MacOS X program after setting the entitlements (select the 
'project' in the project pane, so you see the info panel in Xcode; a tab panel 
will then allow you to select the entitlements' – some selections will be 
pre-set based on static code analysis – checkboxes.)
5) Upload to a device (if iOS), or to the Mac/iOS App Store!
Presto!

As it is, there's a whole sh*tload of steps between 2 and 4 now (and that 
replace step 3). Boo!


___

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

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

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

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

Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread William Squires
This would be better handled with some sort of filter applied at I/O time (i.e. 
when you read/write the file) I would think. That is, let your model objects 
handle the translation, and let the view objects do what view objects are 
supposed to do. Trying to fiddle around with low-level NSTextStorage just seems 
to be a way to waste several afternoons pulling out your hair in frustration, 
methinks!


On Aug 31, 2012, at 10:24 AM, Koen van der Drift wrote:

 Is it possible to insert character/glyphs in an NSTextView without
 changing the underlying NSTextStorage ?  The goal is to have some
 special characters (eg a hyphen) at specific places in the string that
 is displayed in the view. So when the data is saved, the special
 characters are not part of it.
 
 Thanks,
 ___
 
 Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
 
 Please do not post admin requests or moderator comments to the list.
 Contact the moderators at cocoa-dev-admins(at)lists.apple.com
 
 Help/Unsubscribe/Update your Subscription:
 https://lists.apple.com/mailman/options/cocoa-dev/wsquires%40satx.rr.com
 
 This email sent to wsqui...@satx.rr.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Todd Heberlein
I suspect the moderator will shut this down as off topic, but I'll reiterate 
what I've said before.

On Sep 3, 2012, at 2:58 PM, William Squires wsqui...@satx.rr.com wrote:

  Why should sandboxing on MacOS X even be necessary, seeing as we already 
 have the Unix file permissions (and ACLs) to handle who can/cannot read/write 
 to a file or directory?

Case 1) To prevent your legitimate application with a vulnerability from being 
used as an attack vector.

Suppose you write a cool drawing program with your own file format. Your code 
has a bug when parsing your document. An attacker constructors a malicious 
document and sends it to one of your users. Your program reads the document, 
and the malicious document drops a command  control agent on the user's 
machine.

This command  control agent has all the privileges you would normally have, so 
it can send out all your email, all your email attachments, all your Pages and 
Keynote documents, etc.

In this way, sandboxing prevents us application developers from being 
embarrassed by having our code compromise the user. This is probably the 
primary benefit of sandboxing. You may want to sandbox your code even if you 
distribute it outside the Mac App Store to avoid the embarrassment of being 
used as an attack vector.

I put together a video demonstrating exactly this type of attack (I've posted 
it here before I think):

Glowing Embers: The Myth of the Nation State Requirement
http://www.netsq.com/Podcasts/Data/2012/GlowingEmbers/


Case 2) To prevent a malicious Trojan horse program from compromising the 
system.

Despite Apple's review process, they cannot detect malicious code buried inside 
an application. Once accepted by the Mac App Store and installed on a victim's 
computer, the evil application could silently (and perhaps slowly to stay below 
the radar) exfiltrate the user's email, email attachments, Pages, and Keynote 
documents. Again, it can do this because it runs with all the user's normal 
privileges, and that is all it needs.


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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)

2012-09-03 Thread Graham Cox

On 04/09/2012, at 4:02 AM, Koen van der Drift koenvanderdr...@gmail.com wrote:

 For some reason, the height of the last rect in the NSRectArray is smaller 
 than the other ones, and therefore the CALayer I draw behind the 
 corresponding range of text looks wrong.
 
 My font size is 16, and the line spacing is set to 12.   For most rects, the 
 height returned is 31 (= 16 + 12 + 3), but for the last one, the height is 19 
 ( = 16 + 3).
 
 So it seems for the last rect, the linespace is ignored.  I can test for 
 that, and correct it, but I was wondering what is going on.  And where does 
 the '3' come from?


I think that's correct.

For the last line, there's no further line to space and so the bottom of the 
rectangle is at the bottom of the text. Or another way to think about it is 
that the line spacing is inserted above each line.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Todd Heberlein

On Sep 3, 2012, at 2:58 PM, William Squires wsqui...@satx.rr.com wrote:

  I can see the benefit of taking a more security-related stance on a closed 
 platform like iOS so as to make writing malware harder, but for a 
 general-purpose computing platform, this'll just put unnecessary roadblocks 
 in the way of newbies who want to develop for it… Unless Apple's geniuses can 
 figure out a way to simplify the whole shooting match to a one-click 
 solution! :)
 ...
 As it is, there's a whole sh*tload of steps between 2 and 4 now (and that 
 replace step 3). Boo!

I see two problems Apple must address. The first is similar to your list. Key 
management is a real pain. I just started compiling code on a new machine and 
couldn't figure out why I couldn't properly sign my code. I looked and I had 
the developer certificates in my keychain.

The problem was that I didn't have the private keys too. I went back to my old 
development machine, exported the certificate and private key combo, and 
imported them into my new machine. Bingo, the problem is solved.

I *really* *really* wish that this workflow process was simpler and easier to 
debug. It would have helped if Xcode would be smarter than me and say, Dummy, 
you have your developer certificates but not your private key. You need to sign 
code with the private key. Go get it. Here is a link explaining the process 
link.



Outside the issue of getting and managing private keys and public certificates, 
the process of Sandboxing is non-trivial. Apple is trying to capture user 
intent in code that is running outside your code, but user intent is kind of 
a nebulous concept. For file access, the primary approach is their PowerBox.  
For simple document-type apps this solution works OK, but there are a lot of 
cases where it fails.

There are far more talented and experienced Mac programmers than me who are 
running into limitations and planning on taking their next versions out of the 
Mac App Store (or so I've read). I hope they are able to provide constructive 
criticism to Apple for improving the current solution.


CONCLUSIONS:

(1) I wish Apple could simplify the key management process and make resolving 
problems easier. Key management is a baffling process to most people.

(2) I hope Apple listens to constructive criticism on improving their approach 
to capturing user intent. (constructive being the operative word)

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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

Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Graham Cox

On 04/09/2012, at 7:58 AM, William Squires wsqui...@satx.rr.com wrote:

 As it is, there's a whole sh*tload of steps between 2 and 4 now (and that 
 replace step 3). Boo!


I'm not certain, but it looks as if Xcode 4.4 does largely automate all of 
this, provided you have the right developer account set up with Apple. This 
feature is part of the Archive section of the Organizer, which seems to be 
the place that all the odd functionality ends up being thrown into in Xcode.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Kyle Sluder
On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:

 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view objects 
 are supposed to do. Trying to fiddle around with low-level NSTextStorage just 
 seems to be a way to waste several afternoons pulling out your hair in 
 frustration, methinks!

I disagree. NSTextStorage *is* a model object. It's far better to actually 
understand and and use the text system (including glyph generation) rather than 
fake it by transforming the model on read/write and ensuring your 
transformations are perfect mirrors, are applied at the right times, and 
correctly interact with the pasteboard, undo manager, Services, Input Methods, 
and VoiceOver.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Roland King
These exact points are explained at the start of the 2012 WWDC sand boxing 
video, which also introduces some of the terminology and thinking behind the 
design. I found that video well worth 45 or so minutes of my life. Won't help 
with the sand boxing bugs but it did give me a better idea of how the Apple 
engineers think about sandboxing and some terms to search the docs for. 



On 4 Sep, 2012, at 6:17 AM, Todd Heberlein todd_heberl...@mac.com wrote:

 I suspect the moderator will shut this down as off topic, but I'll reiterate 
 what I've said before.
 
 On Sep 3, 2012, at 2:58 PM, William Squires wsqui...@satx.rr.com wrote:
 
 Why should sandboxing on MacOS X even be necessary, seeing as we already 
 have the Unix file permissions (and ACLs) to handle who can/cannot 
 read/write to a file or directory?
 
 Case 1) To prevent your legitimate application with a vulnerability from 
 being used as an attack vector.
 
 Suppose you write a cool drawing program with your own file format. Your code 
 has a bug when parsing your document. An attacker constructors a malicious 
 document and sends it to one of your users. Your program reads the document, 
 and the malicious document drops a command  control agent on the user's 
 machine.
 
 This command  control agent has all the privileges you would normally have, 
 so it can send out all your email, all your email attachments, all your Pages 
 and Keynote documents, etc.
 
 In this way, sandboxing prevents us application developers from being 
 embarrassed by having our code compromise the user. This is probably the 
 primary benefit of sandboxing. You may want to sandbox your code even if you 
 distribute it outside the Mac App Store to avoid the embarrassment of being 
 used as an attack vector.
 
 I put together a video demonstrating exactly this type of attack (I've posted 
 it here before I think):
 
Glowing Embers: The Myth of the Nation State Requirement
http://www.netsq.com/Podcasts/Data/2012/GlowingEmbers/
 
 
 Case 2) To prevent a malicious Trojan horse program from compromising the 
 system.
 
 Despite Apple's review process, they cannot detect malicious code buried 
 inside an application. Once accepted by the Mac App Store and installed on a 
 victim's computer, the evil application could silently (and perhaps slowly to 
 stay below the radar) exfiltrate the user's email, email attachments, Pages, 
 and Keynote documents. Again, it can do this because it runs with all the 
 user's normal privileges, and that is all it needs.
 
 
 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:
 https://lists.apple.com/mailman/options/cocoa-dev/rols%40rols.org
 
 This email sent to r...@rols.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)

2012-09-03 Thread Kyle Sluder
On Sep 3, 2012, at 11:02 AM, Koen van der Drift koenvanderdr...@gmail.com 
wrote:

 
 So it seems for the last rect, the linespace is ignored.  I can test for 
 that, and correct it, but I was wondering what is going on.  And where does 
 the '3' come from?

There was a WWDC 2012 session on Core Text that Ned Holbrook gave that did a 
decent job explaining the different components that make up a line's 
typographic bounds.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Alex Zavatone

On Sep 3, 2012, at 6:44 PM, Todd Heberlein wrote:

 
 On Sep 3, 2012, at 2:58 PM, William Squires wsqui...@satx.rr.com wrote:
 
 I can see the benefit of taking a more security-related stance on a closed 
 platform like iOS so as to make writing malware harder, but for a 
 general-purpose computing platform, this'll just put unnecessary roadblocks 
 in the way of newbies who want to develop for it… Unless Apple's geniuses 
 can figure out a way to simplify the whole shooting match to a one-click 
 solution! :)
 ...
 As it is, there's a whole sh*tload of steps between 2 and 4 now (and that 
 replace step 3). Boo!
 
 I see two problems Apple must address. The first is similar to your list. Key 
 management is a real pain. I just started compiling code on a new machine and 
 couldn't figure out why I couldn't properly sign my code. I looked and I had 
 the developer certificates in my keychain.

The issue here is that we as Apple users, (not developers) are used to 
processes being somewhat forgiving.

If you screw up at once point in the chain, with certs and keys, you are 
screwed.  There needs to be a step by step checklist that guides your through 
the whole process and a chart that illustrates what needs to be in place and if 
there is a failure anywhere within the steps, what you are likely to expect.  
Then we/someone makes a reverse lookup that says if you have this problem, 
these are the possible reasons why.

Currently, this is a mess of a process that ends up wasting immense amounts of 
time.  It's not painfully obvious that you're really got to start over, or at 
which part you need to start from, to get this to work every time.

Also, after adding devices to prov profiles, it's not painfully obvious that 
those devices are hardcoded in the profiles, the current profile on your Mac 
(or on your team's macs) doesn't automatically lookup and include the new 
devices, which seems rather straightforwards to do.



 The problem was that I didn't have the private keys too. I went back to my 
 old development machine, exported the certificate and private key combo, and 
 imported them into my new machine. Bingo, the problem is solved.
 
 I *really* *really* wish that this workflow process was simpler and easier to 
 debug. It would have helped if Xcode would be smarter than me and say, 
 Dummy, you have your developer certificates but not your private key. You 
 need to sign code with the private key. Go get it. Here is a link explaining 
 the process link.

I agree.  It's a painful time wasting mess.

We expect much better of Apple and Apple's processes.



 Outside the issue of getting and managing private keys and public 
 certificates, the process of Sandboxing is non-trivial. Apple is trying to 
 capture user intent in code that is running outside your code, but user 
 intent is kind of a nebulous concept. For file access, the primary approach 
 is their PowerBox.  For simple document-type apps this solution works OK, but 
 there are a lot of cases where it fails.
 
 There are far more talented and experienced Mac programmers than me who are 
 running into limitations and planning on taking their next versions out of 
 the Mac App Store (or so I've read). I hope they are able to provide 
 constructive criticism to Apple for improving the current solution.
 
 
 CONCLUSIONS:
 
 (1) I wish Apple could simplify the key management process and make resolving 
 problems easier. Key management is a baffling process to most people.
 
 (2) I hope Apple listens to constructive criticism on improving their 
 approach to capturing user intent. (constructive being the operative word)
 
 Todd

Well, the point is that when criticism gets beyond constructive, this should 
tell Apple just how frustrating and counterproductive the process actually is.  




___

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

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

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

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

Re: More sandblasting (oops, I mean sandboxing die die die)

2012-09-03 Thread Alex Zavatone

On Sep 3, 2012, at 6:57 PM, Roland King wrote:

 These exact points are explained at the start of the 2012 WWDC sand boxing 
 video, which also introduces some of the terminology and thinking behind the 
 design. I found that video well worth 45 or so minutes of my life. Won't help 
 with the sand boxing bugs but it did give me a better idea of how the Apple 
 engineers think about sandboxing and some terms to search the docs for. 

The fact that we have to wait 'til a bunch of the creators get together and 
make a video to explain a fundamental process shows a huge gap in the system.

Take this example from the WWDC 2011 video 1-16 Session 319 - Effective 
Debugging with Xcode 4.

At 15 minutes, 20 seconds in, the speaker mentions that the first thing people 
ask is how do I show the console in a separate window.  First of all, no 
developer should ever have to ask this question.  How to do this should be 
painfully obvious.

Besides watching this video, there is no way someone is going to find out how 
to open a full window console, which should be one of the simplest tasks to the 
developer, and one easily assignable to a shortcut key.

At too many important parts in the getting running and developing process are 
Apple's processes rather broken.  

Getting up and running with certs and keys should be handled by an assistant AS 
SOON AS someone opens Xcode, if everything is not in place.  There should be 
checks to make sure that everything is in place before moving to the next step.

And having to find a video that tells you the process on how to open a window 
that is only the console and then go through all those steps (which still to 
not result in a menu item that you can use to open a full window console) is 
just insane in a modern development tool.

There are easy to identify areas that must be improved.  It seems to make 
painfully obvious sense the most sense to work on these areas first if Apple's 
goal is to make us more productive.

FYI, I never had to go through as many hoops to get Xcode to work normally in 
xCode 3.1.3.



___

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

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

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

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


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Ross Carter
I think Kyle and William are saying the same thing: leave NSTextStorage alone 
and adjust the presentation as needed.


On Sep 3, 2012, at 6:57 PM, Kyle Sluder k...@ksluder.com wrote:

 On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:
 
 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view 
 objects are supposed to do. Trying to fiddle around with low-level 
 NSTextStorage just seems to be a way to waste several afternoons pulling out 
 your hair in frustration, methinks!
 
 I disagree. NSTextStorage *is* a model object. It's far better to actually 
 understand and and use the text system (including glyph generation) rather 
 than fake it by transforming the model on read/write and ensuring your 
 transformations are perfect mirrors, are applied at the right times, and 
 correctly interact with the pasteboard, undo manager, Services, Input 
 Methods, and VoiceOver.
 
 --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:
 https://lists.apple.com/mailman/options/cocoa-dev/rosscarterdev%40me.com
 
 This email sent to rosscarter...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to insert a screen-only character in an NSTextView?

2012-09-03 Thread Koen van der Drift
I've decided not to use this in my app and try something else to make 
annotations in my textView. Thanks all for the input though.

- Koen.

On Sep 3, 2012, at 18:57, Kyle Sluder k...@ksluder.com wrote:

 On Sep 3, 2012, at 3:06 PM, William Squires wsqui...@satx.rr.com wrote:
 
 This would be better handled with some sort of filter applied at I/O time 
 (i.e. when you read/write the file) I would think. That is, let your model 
 objects handle the translation, and let the view objects do what view 
 objects are supposed to do. Trying to fiddle around with low-level 
 NSTextStorage just seems to be a way to waste several afternoons pulling out 
 your hair in frustration, methinks!
 
 I disagree. NSTextStorage *is* a model object. It's far better to actually 
 understand and and use the text system (including glyph generation) rather 
 than fake it by transforming the model on read/write and ensuring your 
 transformations are perfect mirrors, are applied at the right times, and 
 correctly interact with the pasteboard, undo manager, Services, Input 
 Methods, and VoiceOver.
 
 --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:
 https://lists.apple.com/mailman/options/cocoa-dev/koenvanderdrift%40gmail.com
 
 This email sent to koenvanderdr...@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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: rectArrayForCharacterRange and lineSpacing (was: text highlighting with CALayer and NSTextView)

2012-09-03 Thread Koen van der Drift
Thanks, I'll have a look at that.

- Koen.

On Sep 3, 2012, at 19:01, Kyle Sluder k...@ksluder.com wrote:

 On Sep 3, 2012, at 11:02 AM, Koen van der Drift koenvanderdr...@gmail.com 
 wrote:
 
 
 So it seems for the last rect, the linespace is ignored.  I can test for 
 that, and correct it, but I was wondering what is going on.  And where does 
 the '3' come from?
 
 There was a WWDC 2012 session on Core Text that Ned Holbrook gave that did a 
 decent job explaining the different components that make up a line's 
 typographic bounds.
 
 --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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: How to get multiple NSURLs from Finder drop.

2012-09-03 Thread Todd Freese
Thanks, didn't see the new API.

Todd

On Sep 3, 2012, at 4:12 PM, Kyle Sluder k...@ksluder.com wrote:

 
 On Sep 3, 2012, at 1:32 PM, Todd Freese applecocoal...@filmworkers.com 
 wrote:
 
 I'm trying to get my App Sandboxed. I need to be able to accept a multi-file 
 finder drop to import files. However, how did I get multiple NSURLs from the 
 finder? There only seems to be two finder pasteboard types: 
 NSFilenamesPboardType  NSURLPboardType. 
 
 NSFilenamesPboardType won't work because it is passing strings. 
 NSURLPboardType only accepts one a single file.
 
 What am I missing here?
 
 Use the modern NSPasteboardItem API instead. You can access multiple items, 
 each one being an NSURL.
 
 --Kyle Sluder
 
 __
 This email has been scanned by the Symantec Email Security.cloud service.
 For more information please visit http://www.symanteccloud.com
 __
 



__
This email has been scanned by the Symantec Email Security.cloud service.
For more information please visit http://www.symanteccloud.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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Customising cells in IKImageBrowserView

2012-09-03 Thread Graham Cox
I want to customise the appearance of a selected cell in an IKImageBrowserView.

I'm subclassing IKIMageBrowserView, and overriding:


- (IKImageBrowserCell*) newCellForRepresentedItem:(id) anItem
{
IKImageBrowserCell* cell = [super newCellForRepresentedItem:anItem];

// set up the selection highlight colour by changing the layer 
characteristics

CALayer* selLayer = [cell 
layerForType:IKImageBrowserCellForegroundLayer];

selLayer.borderWidth = 1.0;
selLayer.backgroundColor = [[NSColor greenColor] CGColor];


return cell;
}


(the appearance isn't what I want, but this is just to see if it works).

The layer returned by -layerForType: is nil, and it is nil for all of the 
possible layer types. I also tried setting this when the selection changes in 
the delegate callback, but these layers are always nil. The cell is valid.

Has anyone managed to get this to work?


--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Create custom NSTableView with a button inside

2012-09-03 Thread Alfian Busyro

Did you look at the TableViewPlayground sample project from Apple?

as Conrad said, on this example only covers view-based tableview.


My question to Alfian, however, is why a cell-based table view is
desired.  Are you targeting 10.6?

Yes, My project still targeting OSX 10.6 (Snow Leopard) as a main target.

On 12/09/04 4:13, Conrad Shultz wrote:

On 09/03/2012 05:11 AM, Koen van der Drift wrote:

On Sep 3, 2012, at 5:50 AM, Alfian Busyro alfian.bus...@kddi-web.com wrote:


are there any examples of how to create a custom cell-based table view with a 
button inside of the column ?


Did you look at the TableViewPlayground sample project from Apple?

TableViewPlayground covers view-based table views; the OP specified
cell-based table views.

My question to Alfian, however, is why a cell-based table view is
desired.  Are you targeting 10.6?



___

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

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

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

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


Re: UIDocument openWithCompletionHandler: called on what thread?

2012-09-03 Thread Roland King

On 4 Sep, 2012, at 12:09 AM, Luke Hiesterman luket...@apple.com wrote:

 The documentation isn't entirely accurate. The completion handler will only 
 be executed on the main queue if you call the method on the main queue. In 
 general, the completion handler is executed on the same queue that the 
 constituent method was called on. 
 
 Luke
 

Ah - thanks - I will file a docs bug on that, in this case, that's exactly what 
I am doing, the entire thing is a background operation but I was relying on the 
documented behaviour to update the UI without pinging back to the main thread. 




___

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

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

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

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


Local Properties

2012-09-03 Thread Gerriet M. Denkmann
I have a class with a mutable array. But from outside it should be just a 
read-only non-mutable array.
My current solution:

MyClass.h file contains:

@property (readonly, nonatomic) NSArray *externalArray;

and MyClass.m file has:

@interface MyClass()
@property (strong)  NSMutableArray  *internalArray;
@end

@implementation MyClass
- (NSArray *) externalArray { return self.internalArray; }
@end

Is there a better (more elegant) way?


And another question:
I have a struct property like:
@property (assign)  some_Struct_t   myStruct;

But when I write:
self.myStruct.something = 7;
I get told Expression is not assignable. (Xcode 4.4.1)

This works:
some_Struct_t temp = self.myStruct;
temp.something = 7;
self.myStruct = temp;

But this is not really nice. There sure must be a better way.

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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


Re: Local Properties

2012-09-03 Thread David Duncan
On Sep 3, 2012, at 10:24 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 I have a class with a mutable array. But from outside it should be just a 
 read-only non-mutable array.
 My current solution:
 
 MyClass.h file contains:
 
 @property (readonly, nonatomic)   NSArray *externalArray;
 
 and MyClass.m file has:
 
 @interface MyClass()
 @property (strong)NSMutableArray  *internalArray;
 @end
 
 @implementation MyClass
 - (NSArray *) externalArray { return self.internalArray; }
 @end
 
 Is there a better (more elegant) way?

Not really. Although you may want to return a copy/autoreleased array for 
-externalArray as otherwise code that uses this accessor would see future 
mutations to the internalArray.

 And another question:
 I have a struct property like:
 @property (assign)some_Struct_t   myStruct;
 
 But when I write:
 self.myStruct.something = 7;
 I get told Expression is not assignable. (Xcode 4.4.1)
 
 This works:
 some_Struct_t temp = self.myStruct;
 temp.something = 7;
 self.myStruct = temp;
 
 But this is not really nice. There sure must be a better way.


There isn't. You get the message you get because self.myStruct.something = 7 
gets broken down to [self myStruct].something = 7, but the LHS of that is not 
assignable (its an R-value, not an L-value, and only L-values are assignable).
--
David Duncan


___

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

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

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

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


Re: Local Properties

2012-09-03 Thread Graham Cox

On 04/09/2012, at 3:24 PM, Gerriet M. Denkmann gerr...@mdenkmann.de wrote:

 I have a class with a mutable array. But from outside it should be just a 
 read-only non-mutable array.
[]

 Is there a better (more elegant) way?


Just return the internal (mutable) array as an NSArray. By typing it as an 
NSArray, you have documented your intent - that the returned value is immutable.

If a client of the code is caching this array, consider making THAT property a 
copy property.

 But when I write:
 self.myStruct.something = 7;
 I get told Expression is not assignable. (Xcode 4.4.1)

self.myStruct needs to be on the right hand side of an assignment expression, 
not the left. It's equivalent to [self myStruct] which returns a value. x = 
self.myStruct.something is legal, but not self.myStruct.something = x;

but anyway since self.myStruct returns a copy of the struct, assigning some 
value to it is not going to change the copy internal to your class.

A better way to do this is to make each field of the struct a property of the 
object and just set it that way. Why use structs anyway? Make it an object and 
add the intelligence/properties there.

--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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

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