Re: ANN: new open-source window manager for OS X

2013-04-17 Thread Charles Srstka
On Apr 17, 2013, at 11:44 AM, Steven Degutis  wrote:

> Called Windows.app.

... I think someone may have used the name "Windows" already...

Charles
___

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

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

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

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


Modeling a Linux USB Serial Driver with IOKit

2013-04-17 Thread Caylan Larson
Ahoy,

I've been working hard on a basic implementation of a userspace driver for the 
WCH341.  Would you mind offering some advice for where I may have gone astray?

I've got the device/interface endpoints setup correctly.  That is, _usbDevice 
and _usbInterface have been initialized properly.  I can't configure the device 
to get write/read to work.  My application is very simple, send one "W\n" and 
receive a basic string response from the serial device (9600 baud).

I'm modeling this after 
http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/drivers/usb/serial/ch341.c

Here is my home grown way to set control.

-(void)sendControlRequest:(int)requestValue
  inDirection:(int)direction
withValue:(int)bufferValue
  atIndex:(int)index
   bufferSize:(int)size
{
NSLog(@"-START");

IOReturnkr;

int writeBuffer[size];
writeBuffer[0] = bufferValue; // Status Request

USBDeviceAddress deviceAddress;
IOUSBDevRequest request;

kr = (*_usbDevice)->GetDeviceAddress(_usbDevice, &deviceAddress);

request.bmRequestType = USBmakebmRequestType(direction, kUSBVendor, 
kUSBDevice);
request.bRequest = requestValue;
request.wValue = deviceAddress;
request.wIndex = index;
request.wLength = size;
request.pData = &writeBuffer;

kr = (*_usbDevice)->DeviceRequest(_usbDevice, &request);

if (kr == kIOReturnSuccess)
{
NSLog(@"Success - Bytes are %x and %x", writeBuffer[0], writeBuffer[1]);
}else if ( kr == kIOReturnOverrun)
{
NSLog(@"Device request failed: overrun");
}else
{
NSLog(@"WriteToDevice reset returned err 0x%x\n", kr);

}
NSLog(@"-END");

}

… Then later, I set up the register/values from 
http://tomoyo.sourceforge.jp/cgi-bin/lxr/source/drivers/usb/serial/ch341.c…


// ch341_control_in(dev, 0x5f, 0, 0, buffer, size);
[self sendControlRequest:0x5f inDirection:kUSBIn withValue:0 atIndex:0 
bufferSize:2];

// ch341_control_out(dev, 0xa1, 0, 0);
[self sendControlRequest:0xa1 inDirection:kUSBOut withValue:0 atIndex:0 
bufferSize:2];

// ch341_control_out(dev, 0x9a, 0x1312, a);
[self sendControlRequest:0x9a
 inDirection:kUSBOut
   withValue:0x1312
 atIndex:[self calculateBaudrate]
  bufferSize:2];


// ch341_control_in(dev, 0x95, 0x2518, 0, buffer, size);
[self sendControlRequest:0x5f inDirection:kUSBIn withValue:0 atIndex:0 
bufferSize:2];

//ch341_control_out(dev, 0x9a, 0x2518, 0x0050);
[self sendControlRequest:0x9a inDirection:kUSBOut withValue:0x2518 
atIndex:0x0050 bufferSize:2];

// STATUS - EXPECT 0xff 0xee
[self sendControlRequest:0x95 inDirection:kUSBIn withValue:0x0706 atIndex:0 
bufferSize:2];

//ch341_control_out(dev, 0xa1, 0x501f, 0xd90a);
[self sendControlRequest:0xa1 inDirection:kUSBOut withValue:0x501f 
atIndex:0xd90a bufferSize:2];

// ch341_control_out(dev, 0x9a, 0x1312, a);
[self sendControlRequest:0x9a
 inDirection:kUSBOut
   withValue:0x1312
 atIndex:[self calculateBaudrate]
  bufferSize:2];

//  ch341_control_out(dev, 0xa4, ~(CH341_BIT_RTS | CH341_BIT_DTR), 0);
[self sendControlRequest:0xa4
 inDirection:kUSBOut
   withValue:~(CH341_BIT_RTS | CH341_BIT_DTR)
 atIndex:0
  bufferSize:2];

Then I write to pipe 2 using...

kr = (*_usbInterface)->WritePipe(_usbInterface,
 2,
 (void *) [stringToPrint UTF8String],
 (UInt32) strlen([stringToPrint UTF8String])
 );

2013-04-17 18:18:39.578 Balance[526:303] Attached Modem Device: USB2.0-Ser!
2013-04-17 18:18:39.580 Balance[526:303] Warning Nil - Vendor: (null) Product: 
USB2.0-Ser!
2013-04-17 18:18:39.585 Balance[526:303] device pointer before: 0
2013-04-17 18:18:39.586 Balance[526:303] device pointer after: 71304080
2013-04-17 18:18:39.586 Balance[526:303] Found device (vendor = 6790, product = 
29987)
2013-04-17 18:18:39.586 Balance[526:303] Iterating a USB interface
2013-04-17 18:18:39.587 Balance[526:303]   Interface class 255, subclass 1
2013-04-17 18:18:39.588 Balance[526:303]   Interface has 3 endpoints
2013-04-17 18:18:39.588 Balance[526:303] PipeRef 1: 
2013-04-17 18:18:39.588 Balance[526:303]   direction in, 
2013-04-17 18:18:39.588 Balance[526:303]   transfer type bulk, 
maxPacketSize 32
2013-04-17 18:18:39.589 Balance[526:303] PipeRef 2: 
2013-04-17 18:18:39.589 Balance[526:303]   direction out, 
2013-04-17 18:18:39.589 Balance[526:303]   transfer type bulk, 
maxPacketSize 32
2013-04-17 18:18:39.590 Balance[526:303] PipeRef 3: 
2013-04-17 18:18:39.590 

ANN: new open-source window manager for OS X

2013-04-17 Thread Steven Degutis
Called Windows.app. Source is on github:
https://github.com/sdegutis/windowsapp

What's particularly neat about it is how you configure it. It looks for a
dotfile in your home dir, which can either be JavaScript or CoffeeScript.
In this config file you, bind your hot keys as you want, using a very
simple API that the app exposes in JS-land.

I managed to get JavaScript scripting working via JSCocoa, and CoffeeScript
via coffeescript.js and Coffeescript.compile(). Technically I hide the ObjJ
syntax away, since most people are much more comfortable in pure JS than in
ObjJ. I was looking into adding ClojureScript support, but I'm not yet sure
how to avoid the start-up delay when running java. Waiting 5 seconds each
time you reload your config isn't ideal.

My first choice for scripting was to use MacRuby, but it only works with GC
apps, and this one uses ARC. I hear they've got ARC in the works, so my
fingers are crossed for the future. Also, PyObjC is really hard to
integrate into an app. Ironically enough, when I was googling for how to do
it, I found an article I wrote about it 3 years ago when I was working at
BNR.

Also, I created a technique for generating appcasts statically from the
command line, and hosting the appcast on github, that might be interesting
to other open source authors who don't want to have any other hosting but
github. The details are in this build.sh file:
https://github.com/sdegutis/windowsapp/blob/master/build.sh

My apologies if new-app announcements are off-topic, but I think this one
is particularly suitable for cocoa-dev because of the technical details.

-Steven
___

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

Please do not post 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


NSScrollView in NSTabView autolayout problem

2013-04-17 Thread kwic...@wichry.net
Hi
I have an NSTabView with multiple tabs, each containing an NSScrollView. In the 
scrollviews I dynamically place custom views which are sized using autolayout 
and constraints.

Now if I add my custom views to a scrollview in tab1 and resize the window with 
this tab active everything works fine and autolayout does not complain.

On the other hand, if I add my custom views to a scrollview in tab1, switch to 
another tab, resize the window, and switch back to tab1 autolayout breaks with 
the following exemplar message:

Unable to simultaneously satisfy constraints: ( 
"", "", 
"", 
"", "" )


What I noticed in the message is this "H:[NSClipView:0x40120eb80(0)]". How come 
the NSClipView so in fact contentView of the scrollview has width = 0?
My question is, why does the autolayout work fine for the active tab and does 
for inactive?

Thanks

k.
___

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

Please do not post 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: File by index?

2013-04-17 Thread Steve Mills
On Apr 17, 2013, at 23:28:10, Scott Ribe  wrote:

> FSGetCatalogInfoBulk, or something like that...

I'm pretty sure that won't do it. That's for getting multiple files and there's 
no way to specify just a single file by its index.

--
Steve Mills
Drummer, Mac geek


___

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

Please do not post 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: File by index?

2013-04-17 Thread Scott Ribe
FSGetCatalogInfoBulk, or something like that...

On Apr 17, 2013, at 4:10 PM, Steve Mills wrote:

> Hmm, I can't find a more modern way to get the nth file of a folder than 
> PBGetCatInfoSync that's available in 64-bit. Anybody have a better idea?
> 
> --
> Steve Mills
> Drummer, Mac geek
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/scott_ribe%40elevated-dev.com
> 
> This email sent to scott_r...@elevated-dev.com
> 


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





___

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

Please do not post 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: Semaphore strangeness

2013-04-17 Thread Quincey Morris
On Apr 17, 2013, at 17:06 , Greg Parker  wrote:

> dispatch assumes you are using the semaphore in a lock-like pattern, where 
> all waiters are expected to signal when they are done with their work. In 
> that pattern, destroying a semaphore whose value is less than its original 
> value indicates a bug somewhere (because somebody should have signaled the 
> semaphore but has not yet done so). _dispatch_semaphore_dispose() is 
> enforcing that assumption and deliberately halting your process if it fails.

One example where the assumption doesn't hold is where the semaphore is 
controlling access to AudioQueueBuffers for an AudioQueue. Calling 
AudioQueueDispose suppresses further calls of the buffer release callback, 
where the semaphore is signaled. After that, you don't get any outstanding 
buffers back again, and your semaphore count is borked.

(If you try to use AudioQueueStop first, you then have to orchestrate a *wait* 
for all outstanding buffers to arrive at the callback, for no other purpose 
than satisfying the count requirement, before destroying the related semaphore. 
This adds *harder* synchronization code to solve a problem that never really 
existed.)

My assumption would be that, if you're destroying the semaphore, you're 
shutting some procedure down, so you likely have taken care of the waiters 
already. If you haven't, that's clearly a bug and they're going crash anyway 
when they try to signal a nil ivar or an invalid semaphore. There's no point in 
crashing at semaphore-disposal time.

Anyway, my workaround is now to signal the semaphore 'originalCount' times 
before disposing of it.

On Apr 17, 2013, at 17:55 , Greg Parker  wrote:

> There should be a message in the crash log.
> 
>if (dsema->dsema_value < dsema->dsema_orig) {
>DISPATCH_CLIENT_CRASH("Semaphore/group object deallocated while in 
> use");
>}


I couldn't find one. Maybe the "bad instruction" crash was a failed attempt to 
log this message?

___

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

Please do not post 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: NSOutlineView Travails

2013-04-17 Thread Quincey Morris
On Apr 17, 2013, at 18:08 , Gordon Apple  wrote:

> Our outlineView is not stable and it sometimes edits the wrong row. 

FWIW, the several times I saw instability and other odd behavior, it turned out 
I was doing something to the outline view on a non-main thread. The odd 
behavior didn't necessarily show up instantly.

___

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

Please do not post 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: NSOutlineView Travails

2013-04-17 Thread Gordon Apple
By now, I¹m sure you¹ve seen my second posting.  That at least got things
showing up in (mostly) the right place.  We always had a mixture of bindings
and data source, mainly because line numbers were hard to do with bindings.
With view=based tables and a little subclassing, it¹s not so hard.  For
tables, you need the data source because if gives you the item and you can
get rowFromItem and feed it back to it (offset by 1).  Things are still not
right.  Our outlineView is not stable and it sometimes edits the wrong row.

We want to add a hoverView to show popovers (works for tables), but we need
the basics working predictably first.

On 4/17/13 4:09 PM, "Quincey Morris" 
wrote:

> On Apr 17, 2013, at 10:50 , Gordon Apple  wrote:
> 
>> We are converting tables and outlines to view-based.  So far, so good, on
>> tables.  But NSOutlineView has been a pain.  First of all, there is no
>> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
>> Reference.  You have to rely on sample code and NSOutlineView.h.
> 
> Yup, the documentation situation for NSOutlineView is awful.
> 
>> Our outline view has a column/cell identifier ³LineNumber², one for
>> ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
>> NSTreeController.  Converting to views (yes, using
>> outlineView:viewForTableColumn:item:), we could not even get the nib to
>> load.  ObjectValue always came up nil.  We tried binding the tableView to
>> the tree controller ‹ still nil.
> 
> You can't "try" binding here. If you're using a data source, you don't bind
> the outline view to the tree controller, and in that case you need to set
> view.objectValue to the desired object before returning from
> 'outlineView:viewForTableColumn:item:'.
> 
> Otherwise, you *must* bind the outline view's "content" binding to the tree
> controller, and the outline view should then maintain "objectValue" for you.
> (But since I always use data sources these days, I can't swear that this is
> precisely correct.)
> 
>> Ok, after examining sample code, we
>> decided that just maybe there was something magic about the column/cell
>> identifier ³MainCell², so we changed our third column/cell identifier and
>> replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
>> loads.  However, still no values.
> 
> Since you're talking about loading nibs, I assume you've got code to register
> the nib, and I bet you forgot to ensure that the nib is registered with with
> the identifier that matches what you're actually using.
> 
> If I remember the details correctly, you're going to invoke
> 'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'.
> When you're using registered nibs, you must use the identifier that the nib is
> registered under, and the identifier assigned to the built-in cell view (that
> you're not using) is irrelevant. When you're using the built-in cell view, you
> must use its identifier, of course.
> 
> The column identifier is basically unrelated, unless you *choose* to configure
> it to match the actual cell view identifier. The table view documentation
> assumes this is desirable, but I've never found it makes anything much easier.
> All it does is provide the opportunity for things to get out of sync, as you
> discovered.
> 
>>  Even worse, the turn-down dingy appears
>> in the first column, not the third where we want it.  It does turn down the
>> right number of times and depths to match our outline, but is in the wrong
>> place and no values.
>> 
>> So how do I get the outline back into the third column and get my
>> objectValues to work?
> 
> Are you sure you aren't inadvertently returning a group row view, or a
> full-row view?
> 
> 

-- 
Gordon Apple
Ed4U
Little Rock, AR

___

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

Please do not post 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: Semaphore strangeness

2013-04-17 Thread Greg Parker
On Apr 17, 2013, at 5:44 PM, Charles Srstka  wrote:
> On Apr 17, 2013, at 7:06 PM, Greg Parker  wrote:
>> 
>> dispatch assumes you are using the semaphore in a lock-like pattern, where 
>> all waiters are expected to signal when they are done with their work. In 
>> that pattern, destroying a semaphore whose value is less than its original 
>> value indicates a bug somewhere (because somebody should have signaled the 
>> semaphore but has not yet done so). _dispatch_semaphore_dispose() is 
>> enforcing that assumption and deliberately halting your process if it fails.
> 
> Then why not use something like an assertion or an exception which could 
> actually let the user / developer know why you crashed, instead of just 
> EXC_BAD_INSTRUCTION?

There should be a message in the crash log.

if (dsema->dsema_value < dsema->dsema_orig) {
DISPATCH_CLIENT_CRASH("Semaphore/group object deallocated while in 
use");
}


-- 
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: Semaphore strangeness

2013-04-17 Thread Charles Srstka
On Apr 17, 2013, at 7:06 PM, Greg Parker  wrote:

> On Apr 17, 2013, at 4:14 PM, Quincey Morris 
>  wrote:
> 
>> I'm not sure if this is the right list for this, but then I'm not sure what 
>> is the right list.
>> 
>> I'm seeing a consistent problem disposing of GCD semaphores. For example, if 
>> I create a semaphore like this:
>> 
>>  semaphore = dispatch_semaphore_create (10);
>> 
>> and then use if for a while, then try to destroy it (using ARC):
>> 
>>  semaphore = nil;
>> 
>> If the semaphore's count is less than the original value (10 in the 
>> example), I get a EXC_BAD_INSTRUCTION crash.
>> 
>> It's not clear to me why it should matter whether the original count has 
>> been restored. There's nothing waiting on the semaphore -- the operations 
>> that decremented the count have themselves be disposed of already.
>> 
>> If I forcibly increment the count to 10 *or more*, there's no crash.
> 
> dispatch assumes you are using the semaphore in a lock-like pattern, where 
> all waiters are expected to signal when they are done with their work. In 
> that pattern, destroying a semaphore whose value is less than its original 
> value indicates a bug somewhere (because somebody should have signaled the 
> semaphore but has not yet done so). _dispatch_semaphore_dispose() is 
> enforcing that assumption and deliberately halting your process if it fails.

Then why not use something like an assertion or an exception which could 
actually let the user / developer know why you crashed, instead of just 
EXC_BAD_INSTRUCTION?

Charles

___

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

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

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

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


Re: Semaphore strangeness

2013-04-17 Thread Greg Parker

On Apr 17, 2013, at 4:14 PM, Quincey Morris 
 wrote:

> I'm not sure if this is the right list for this, but then I'm not sure what 
> is the right list.
> 
> I'm seeing a consistent problem disposing of GCD semaphores. For example, if 
> I create a semaphore like this:
> 
>   semaphore = dispatch_semaphore_create (10);
> 
> and then use if for a while, then try to destroy it (using ARC):
> 
>   semaphore = nil;
> 
> If the semaphore's count is less than the original value (10 in the example), 
> I get a EXC_BAD_INSTRUCTION crash.
> 
> It's not clear to me why it should matter whether the original count has been 
> restored. There's nothing waiting on the semaphore -- the operations that 
> decremented the count have themselves be disposed of already.
> 
> If I forcibly increment the count to 10 *or more*, there's no crash.

dispatch assumes you are using the semaphore in a lock-like pattern, where all 
waiters are expected to signal when they are done with their work. In that 
pattern, destroying a semaphore whose value is less than its original value 
indicates a bug somewhere (because somebody should have signaled the semaphore 
but has not yet done so). _dispatch_semaphore_dispose() is enforcing that 
assumption and deliberately halting your process if it fails.


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


Semaphore strangeness

2013-04-17 Thread Quincey Morris
I'm not sure if this is the right list for this, but then I'm not sure what is 
the right list.

I'm seeing a consistent problem disposing of GCD semaphores. For example, if I 
create a semaphore like this:

semaphore = dispatch_semaphore_create (10);

and then use if for a while, then try to destroy it (using ARC):

semaphore = nil;

If the semaphore's count is less than the original value (10 in the example), I 
get a EXC_BAD_INSTRUCTION crash:

> #0  0x7fff91fcfb5f in _dispatch_semaphore_dispose ()
> #1  0x7fff91fcc898 in _dispatch_dispose ()
> #2  0x7fff91fcc837 in -[OS_dispatch_object _xref_dispose] ()

> 0x7fff91fcfb3e  <+>  push   %rbp
> 0x7fff91fcfb3f  <+0001>  mov%rsp,%rbp
> 0x7fff91fcfb42  <+0004>  push   %rbx
> 0x7fff91fcfb43  <+0005>  push   %rax
> 0x7fff91fcfb44  <+0006>  mov%rdi,%rbx
> 0x7fff91fcfb47  <+0009>  mov0x38(%rbx),%rax
> 0x7fff91fcfb4b  <+0013>  cmp0x40(%rbx),%rax
> 0x7fff91fcfb4f  <+0017>  jge0x7fff91fcfb61 
> <_dispatch_semaphore_dispose+35>
> 0x7fff91fcfb51  <+0019>  lea0xa8a6(%rip),%rcx# 0x7fff91fda3fe
> 0x7fff91fcfb58  <+0026>  mov%rcx,-0x17cbe317(%rip)# 
> 0x7fff7a311848 
> 0x7fff91fcfb5f  <+0033>  ud2a   << Thread 1: Program received signal: 
> 'EXC_BAD_INSTRUCTION'

It's not clear to me why it should matter whether the original count has been 
restored. There's nothing waiting on the semaphore -- the operations that 
decremented the count have themselves be disposed of already.

If I forcibly increment the count to 10 *or more*, there's no crash.



___

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

Please do not post 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: Detecting application bundle being moved

2013-04-17 Thread Seth Willits
On Apr 17, 2013, at 4:07 PM, Ken Thomases wrote:

>> Question is: what's the easiest way to detect it having been moved? I 
>> thought I'd get lucky and somewhere there'd be a handy notification, but I 
>> don't see one. It looks like I'll have to use the FSEvent API? I'm not a fan 
>> of it, so I'm hoping there's a slimmer solution. 
> 
> You can use kqueue() to monitor a vnode for various modifications.  In this 
> case, you'd monitor the directory which contains your app bundle, since 
> moving it means removing the entry for it from there.  Obviously, not all 
> modifications will be your app being moved, so you'd have to check.

Yeah, same deal as FSEvent. 


> That said, this seems like checking that the user hasn't poured molasses into 
> their computer's vents.  If the user is determined to break their system, 
> there's nothing you'll be able to do to stop them.

They're not determined, they just don't know it'll break things — Finder didn't 
even warn me when I was doing it. This is not the user's fault and it's 
happening often enough I want to do something about it.



--
Seth Willits


___

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

Please do not post 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: Detecting application bundle being moved

2013-04-17 Thread Ken Thomases
On Apr 17, 2013, at 5:08 PM, Seth Willits wrote:

> I think I've finally figured out that a couple crash patterns are caused by 
> the user moving my application while it's still running. (I tested it and for 
> some reason Finder wasn't warning me when I moved it, which is kinda odd.)
> 
> How and why they're moving it is a bit unclear at the moment, but regardless 
> I'd like to detect it having been moved and throw up an alert and 
> quit/relaunch the app etc so it won't crash later on.
> 
> Question is: what's the easiest way to detect it having been moved? I thought 
> I'd get lucky and somewhere there'd be a handy notification, but I don't see 
> one. It looks like I'll have to use the FSEvent API? I'm not a fan of it, so 
> I'm hoping there's a slimmer solution. 

You can use kqueue() to monitor a vnode for various modifications.  In this 
case, you'd monitor the directory which contains your app bundle, since moving 
it means removing the entry for it from there.  Obviously, not all 
modifications will be your app being moved, so you'd have to check.

That said, this seems like checking that the user hasn't poured molasses into 
their computer's vents.  If the user is determined to break their system, 
there's nothing you'll be able to do to stop them.

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


Re: File by index?

2013-04-17 Thread Jens Alfke

On Apr 17, 2013, at 3:27 PM, Steve Mills  wrote:

> Bleah. That looks sufficiently complicated (didn't even show up in Terminal's 
> man search). I'll just stick with being inefficient if Apple can't provide a 
> high-level easy-to-use replacement for a routine I and many others used to 
> use often.

To me, readdir/seekdir look pretty darn simple, definitely much simpler than 
the old PBxxx APIs! I recall those being a real pain in the ass, with the 
requirement for setting up all those fields of the param block. There's also 
probably a ton of sample code you can search for, since these functions have 
been around for literally 30 years. (There's a basic example at the bottom of 
the man page, actually.)

The only issue seems to be that the the position parameter to seekdir may not 
be as simple as the index of the item in the directory listing; the man page 
implies it should be treated as an opaque value returned by telldir. If you 
want to pursue this, the darwin-userlevel list would be the best place to ask.

—Jens

___

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

Please do not post 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: File by index?

2013-04-17 Thread Steve Mills
On Apr 17, 2013, at 17:17:45, Jens Alfke  wrote:

> man 3 seekdir

Bleah. That looks sufficiently complicated (didn't even show up in Terminal's 
man search). I'll just stick with being inefficient if Apple can't provide a 
high-level easy-to-use replacement for a routine I and many others used to use 
often. Thanks for your help, Jens.

--
Steve Mills
Drummer, Mac geek


___

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

Please do not post 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: File by index?

2013-04-17 Thread Jens Alfke

On Apr 17, 2013, at 3:10 PM, Steve Mills  wrote:

> Hmm, I can't find a more modern way to get the nth file of a folder than 
> PBGetCatInfoSync that's available in 64-bit. Anybody have a better idea?

man 3 seekdir
?

—Jens
___

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

Please do not post 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: File by index?

2013-04-17 Thread Steve Mills
Hmm, I can't find a more modern way to get the nth file of a folder than 
PBGetCatInfoSync that's available in 64-bit. Anybody have a better idea?

--
Steve Mills
Drummer, Mac geek


___

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

Please do not post 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


Detecting application bundle being moved

2013-04-17 Thread Seth Willits

I think I've finally figured out that a couple crash patterns are caused by the 
user moving my application while it's still running. (I tested it and for some 
reason Finder wasn't warning me when I moved it, which is kinda odd.)

How and why they're moving it is a bit unclear at the moment, but regardless 
I'd like to detect it having been moved and throw up an alert and quit/relaunch 
the app etc so it won't crash later on.

Question is: what's the easiest way to detect it having been moved? I thought 
I'd get lucky and somewhere there'd be a handy notification, but I don't see 
one. It looks like I'll have to use the FSEvent API? I'm not a fan of it, so 
I'm hoping there's a slimmer solution. 


--
Seth Willits




___

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

Please do not post 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: File by index?

2013-04-17 Thread Jens Alfke

On Apr 17, 2013, at 1:25 PM, Steve Mills  wrote:

> Sheesh. So Apple has been telling us for years to "go Cocoa!" and "go 
> 64-bit!", then they go and give us half-baked systems that are nowhere near 
> close to being replacements for what we had before. Seems like Apple should 
> take their own advice.

The deprecated part of Carbon is the High-Level Toolbox; that's what Apple 
referred to by telling developers to switch to Cocoa. The CarbonCore APIs are a 
supported part of the system and there are times when it makes sense to use 
them, for edge cases or for performance. (Finding a file at a random index in a 
huge directory is kind of an edge case, you have to admit.)

Similarly, NSURLConnection doesn't do everything you can do with POSIX APIs 
(like UDP or Unix-domain sockets.) CoreAnimation doesn't replace OpenGL. Et 
cetera.

NSFileManager has been steadily gaining capabilities over the years. I remember 
having to dive into  a lot when writing for 10.2 or 10.3, but I 
haven't had to look at it in a long time.

—Jens
___

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

Please do not post 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

Core Data: IN with ordered set of keys?

2013-04-17 Thread Dan Treiman
I have a situation where I want to fetch an ordered array of managed objects 
which contain an ordered set of keys, and return the result in the same order 
as the input set:

NSOrderedSet * orderedIDs = ...;
NSFetchRequest * fetchRequest = [NSFetchRequest 
fetchRequestWithEntityName:@"MyEntityName"];
NSPredicate * predicate = [NSPredicate predicateWithFormat: @"uuid IN %@", 
orderedIDs];
NSArray * orderedObjects = [self.database.managedObjectContext 
executeFetchRequest:fetchRequest error:error];

By 'in the same order', I mean that I would like [[orderedIDs objectAtIndex:i] 
isEqual:[[orderedObjects objectAtIndex:i] uuid]] == YES for all valid indexes 
i.  I implemented a solution that orders the result after the fetch by 
iterating through orderedIDs and building a new array, but I feel like there 
should be a more elegant answer.  Any ideas?

Thanks!
- Dan Treiman
___

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

Please do not post 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: NSOutlineView Travails

2013-04-17 Thread Gordon Apple
We had assumed that outlineView:objectValueForTableColumn:item was not
called if the table was bound to a NSTreeController.  Wrong assumption.  If
we returned the correct value, or just eliminated this method, it mostly
works correctly.  However, there a few anomalies. The outline text indents
properly, but the disclosure indicator occasionally (and randomly) appears
anywhere it wants within the column/row.  Also, scrolling by clicking the
bar lower sometimes results in flipping down to the right level, then
immediately flipping back up to the view top.

On 4/17/13 2:00 PM, "cocoa-dev-requ...@lists.apple.com"
 wrote:

> We are converting tables and outlines to view-based.  So far, so good, on
> tables.  But NSOutlineView has been a pain.  First of all, there is no
> documentation on this, zero, zip, nada, zilch, in the NSOutlineView Reference.
> You have to rely on sample code and NSOutlineView.h. Our outline view has a
> column/cell identifier ³LineNumber², one for ³CheckBox², one for ³Outline².
> Previously, the latter two were bound to our NSTreeController.  Converting to
> views (yes, using outlineView:viewForTableColumn:item:), we could not even get
> the nib to load.  ObjectValue always came up nil.  We tried binding the
> tableView to the tree controller � still nil.  Ok, after examining sample
> code, we decided that just maybe there was something magic about the
> column/cell identifier ³MainCell², so we changed our third column/cell
> identifier and replaced @²Outline² with @²MainCell² in our code.  Amazing �
> now the nib loads.  However, still no values.  Even worse, the turn-down dingy
> appears in the first column, not the third where we want it.  It does turn
> down the right number of times and depths to match our outline, but is in the
> wrong place and no values. So how do I get the outline back into the third
> column and get my objectValues to work?


___

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

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

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

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


Re: NSOutlineView Travails

2013-04-17 Thread Quincey Morris
On Apr 17, 2013, at 10:50 , Gordon Apple  wrote:

> We are converting tables and outlines to view-based.  So far, so good, on
> tables.  But NSOutlineView has been a pain.  First of all, there is no
> documentation on this, zero, zip, nada, zilch, in the NSOutlineView
> Reference.  You have to rely on sample code and NSOutlineView.h.

Yup, the documentation situation for NSOutlineView is awful.

> Our outline view has a column/cell identifier ³LineNumber², one for
> ³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
> NSTreeController.  Converting to views (yes, using
> outlineView:viewForTableColumn:item:), we could not even get the nib to
> load.  ObjectValue always came up nil.  We tried binding the tableView to
> the tree controller ‹ still nil.  

You can't "try" binding here. If you're using a data source, you don't bind the 
outline view to the tree controller, and in that case you need to set 
view.objectValue to the desired object before returning from 
'outlineView:viewForTableColumn:item:'.

Otherwise, you *must* bind the outline view's "content" binding to the tree 
controller, and the outline view should then maintain "objectValue" for you. 
(But since I always use data sources these days, I can't swear that this is 
precisely correct.)

> Ok, after examining sample code, we
> decided that just maybe there was something magic about the column/cell
> identifier ³MainCell², so we changed our third column/cell identifier and
> replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
> loads.  However, still no values.

Since you're talking about loading nibs, I assume you've got code to register 
the nib, and I bet you forgot to ensure that the nib is registered with with 
the identifier that matches what you're actually using.

If I remember the details correctly, you're going to invoke 
'makeViewWithIdentifier:owner:' inside 'outlineView:viewForTableColumn:item:'. 
When you're using registered nibs, you must use the identifier that the nib is 
registered under, and the identifier assigned to the built-in cell view (that 
you're not using) is irrelevant. When you're using the built-in cell view, you 
must use its identifier, of course.

The column identifier is basically unrelated, unless you *choose* to configure 
it to match the actual cell view identifier. The table view documentation 
assumes this is desirable, but I've never found it makes anything much easier. 
All it does is provide the opportunity for things to get out of sync, as you 
discovered.

>  Even worse, the turn-down dingy appears
> in the first column, not the third where we want it.  It does turn down the
> right number of times and depths to match our outline, but is in the wrong
> place and no values.
> 
> So how do I get the outline back into the third column and get my
> objectValues to work?

Are you sure you aren't inadvertently returning a group row view, or a full-row 
view?

___

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

Please do not post 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: File by index?

2013-04-17 Thread Steve Mills
On Apr 17, 2013, at 14:42:25, Jens Alfke  wrote:

> Go ahead and use the CarbonCore or POSIX APIs (although I think there are 
> more modern replacements for the PBxxx functions!)

Thanks. Yeah, I'm sure there are newer ones - I just didn't spend the time to 
find them since I found what I was looking for in some really old commented-out 
code.

> NSFileManager is convenient, but it isn't the be-all and end-all of 
> filesystem access. Sometimes you need to go beneath it.

Sheesh. So Apple has been telling us for years to "go Cocoa!" and "go 64-bit!", 
then they go and give us half-baked systems that are nowhere near close to 
being replacements for what we had before. Seems like Apple should take their 
own advice. Yeah, I know they probably can't just rewrite everything all at 
once, but damn if it isn't annoying to us little folk when they do all this 
modernization and seemingly waste half their time renaming things (.Mac -> 
MobileMe -> iCloud) and then don't do the low level stuff. Sorry, I just need 
to vent once in a while. Still, could be worse - could be Microsoft.

--
Steve Mills
Drummer, Mac geek


___

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

Please do not post 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: File by index?

2013-04-17 Thread Jens Alfke

On Apr 17, 2013, at 11:40 AM, Steve Mills  wrote:

> Is there any better way to get an indexed file? Ya know, like we could easily 
> do in Carbon with something like PBGetCatInfoSync by supplying the index in 
> pb.dirInfo.ioFDirIndex?

Go ahead and use the CarbonCore or POSIX APIs (although I think there are more 
modern replacements for the PBxxx functions!)

NSFileManager is convenient, but it isn't the be-all and end-all of filesystem 
access. Sometimes you need to go beneath it.

—Jens
___

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

Please do not post 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

File by index?

2013-04-17 Thread Steve Mills
I'm picking random files in folders that might have thousands of files. The 
only way I can see to do this in Cocoaland is to get an array of the entire 
contents of the folder (NSFileManager contentsOfDirectoryAtPath:error:), then 
choose from that array by index. Isn't this terribly wasteful of CPU and memory?

The next best thing I could come up with was to iterate through until I got to 
my index. It seems less costly than the above for lower indices, but possibly 
more costly for higher indices.

NSDirectoryEnumerator*  enumer = [fileMan enumeratorAtPath:foldPath];
NSString*   path;
unsigned long   n = SSRandomUnsignedLongBetween(0, 
folderItem.numItems);

// Loop until our index:
for(i = 0; i < n; i++) {
path = [enumer nextObject];
[enumer skipDescendants];
}

imagePath = [foldPath stringByAppendingFormat:@"/%@", path];

And before anyone points out the uninitted path variable if n is 0, it will 
never be 0 due to empty folders being filtered out.

Is there any better way to get an indexed file? Ya know, like we could easily 
do in Carbon with something like PBGetCatInfoSync by supplying the index in 
pb.dirInfo.ioFDirIndex?

--
Steve Mills
Drummer, Mac geek


___

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

Please do not post 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


NSOutlineView Travails

2013-04-17 Thread Gordon Apple
We are converting tables and outlines to view-based.  So far, so good, on
tables.  But NSOutlineView has been a pain.  First of all, there is no
documentation on this, zero, zip, nada, zilch, in the NSOutlineView
Reference.  You have to rely on sample code and NSOutlineView.h.

Our outline view has a column/cell identifier ³LineNumber², one for
³CheckBox², one for ³Outline².  Previously, the latter two were bound to our
NSTreeController.  Converting to views (yes, using
outlineView:viewForTableColumn:item:), we could not even get the nib to
load.  ObjectValue always came up nil.  We tried binding the tableView to
the tree controller ‹ still nil.  Ok, after examining sample code, we
decided that just maybe there was something magic about the column/cell
identifier ³MainCell², so we changed our third column/cell identifier and
replaced @²Outline² with @²MainCell² in our code.  Amazing ‹ now the nib
loads.  However, still no values.  Even worse, the turn-down dingy appears
in the first column, not the third where we want it.  It does turn down the
right number of times and depths to match our outline, but is in the wrong
place and no values.

So how do I get the outline back into the third column and get my
objectValues to work?
___

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

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

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

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

Re: Core Animation with NSWindow

2013-04-17 Thread Jens Alfke

On Apr 16, 2013, at 9:40 PM, Ankuj Gupta  wrote:

> The problem that I have is I cant change the apis for creating the windows. 
> The only function which I can modify is when we are showing that window. That 
> is where I need to animate it

What exactly is the animation that you need to show?

—Jens
___

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

Please do not post 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

KVO on a managed object called twice in child context

2013-04-17 Thread Roland King
I have an NSManagedObject "masterObject" in my main context with an 
NSOrderedSet property on it "characterLists". I'm observing that property in a 
UITableView and making the necessary changes when things are inserted, deleted 
etc. This has worked fine up until now. I just wrote a data importer which 
takes the contents of a file and adds it to the database, potentially adding 
one or more objects to the characterLists property.

For ease of isolation I make a new MOC, parent it to the MOC masterObject is 
in, and then load masterObject into it using its object ID like this

NSManagedObjectContext *moc = [ [ NSManagedObjectContext alloc ] 
initWithConcurrencyType:NSMainQueueConcurrencyType ];
moc.parentContext   = database.managedObjectContext;

RKCHDBMasterObject  *masterObject   = database.masterObject;
RKCHDBMasterObject  *mocMasterObject= (RKCHDBMasterObject*)[ moc 
objectWithID:masterObject.objectID ];

Then I do all my adds in the child context, moc, and add any new characterLists 
to the mocMasterObject. If the file parses correctly, I save the child context, 
else I just toss it away and put up an appropriate error message, the line of 
code for that is

NSError *saveError = nil;
if( [ moc save:&saveError ] )   // < HERE
[ database saveContext ];

In the case where my file parse causes me to add to 'characterLists', adding 
just one object, I'm getting *two* KVO insert notifications on the original 
master object telling me the same object was inserted both times. They are 
exactly the same call and both of them are in the line highlighted, when saving 
the child context, it's not even one on the child and one on the master save. 
It's the same KVO notification, same index set, same type and the 'inserted' 
object is exactly the same as well, same address, everything. 

This of course breaks the world because I add a row in my tableview for the 
same thing twice but the actual characterLists property only gets bigger by 
one, so the tableview barfs. 

I'm not registering for KVO twice, I checked that. There are no other KVO 
messages removing or resetting the thing between the two inserts.

If I use the original parent MOC and original masterObject, not a problem, one 
KVO call. 

Is there anything obvious I could be doing wrong here or something else I could 
look for, or am I returning to bugreporter again? 


___

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

Please do not post 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


Preventing edits in Versions browser

2013-04-17 Thread Steve Mills
I assume that NSDocument's isInViewingMode is what I should be asking if the 
document being used is an actual opened doc or one in the Versions browser. 
Looking at TextEdit, its document class has an isReadOnly instance variable, 
but I don't see it getting set to YES even when browsing versions. Yet somehow 
the Save menu item gets disabled when a browsed version if the active window. 
But TextEdit doesn't seem to prevent any actual edits from happening, but 
instantly undoes each edit. So you see the change for a split second. That's 
not a very good user experience. What does everyone else do? Disable menu items 
and disallow edits based solely or in part on the isInViewingMode result? Does 
isInViewingMode ever return YES for reasons other than for docs being browsed 
in Versions? What about locked files?

--
Steve Mills
office: 952-818-3871
home: 952-401-6255
cell: 612-803-6157



___

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

Please do not post 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: iOS UI suggestions wanted - Date Picker

2013-04-17 Thread Alex Zavatone
Well, do a faux datepicker using a Table View and the gradient overlay to make 
it look like a datePicker, but one that you can customize a whole lot easier.

Yeah, you can't scroll the day/month/year separately, but you can scroll one 
set of items that represent a range of dates.

Lemmie cook up a quick sample for you.  Will email offline.

On Apr 17, 2013, at 11:21 AM, Rick Aurbach wrote:

> Alex,
> 
> You have my attention, I don't really understand what you're suggesting. How 
> would a gradient overlay to the selection-list UITableView aid the user in 
> scrolling to a particular date or making a selection? Could you elaborate??
> 
> Rick Aurbach
> 
> On Apr 17, 2013, at 8:50 AM, Alex Zavatone  wrote:
> 
>> What about a UITableView with a gradient overlay that is shaded at the top 
>> and bottom?
>> 
>> On Apr 17, 2013, at 12:35 AM, Rick Aurbach wrote:
>> 
>>> In my iPad app, I have a number of tableviews in various places which act 
>>> as selection lists. The user can scroll the list and select the item with a 
>>> tap, of course. But since some of the lists can be lengthy, I also include 
>>> navigation aids. In all but one of the lists, the items are alphabetized 
>>> and the navigation aid is a UISearchBar (I could equally well have used a 
>>> table index, but I've chosen a UISearchBar instead. I use "scroll to 
>>> closest text match" logic and it works very well -- the user can usually 
>>> scroll the list and make the desired selection by typing only one or two 
>>> characters In most cases.)
>>> 
>>> However, for one of the lists, the table items are items which are sorted 
>>> by date. The obvious navigation aid in this case is a UIDatePicker, but due 
>>> to limited screen real estate, I'd rather not use it (since is is so big 
>>> and can't be easily resized). So I am looking for alternatives.
>>> 
>>> One alternative is to put the UIDatePicker (or perhaps another date picker 
>>> such as SRMonthPicker or OCCalendar or ??) in a popover. (Presumably, the 
>>> popover would be triggered by tapping a button or tapping in a 
>>> UISearchBar.) This is do-able but what I really want is something that is 
>>> not a popover. Ideally, I'd like something that is permanently part of the 
>>> view but is only 44 pixels high (like a UISearchBar). Yet it should be easy 
>>> for users to select at least a year and a month (causing the tableview to 
>>> scroll the appropriate date range on screen for easy selection).
>>> 
>>> I would be interested to hear from anyone who has encountered a similar 
>>> situation and has implemented a solution which they find satisfactory.
>>> 
>>> Cheers,
>>> 
>>> Rick Aurbach
>>> Aurbach & Associates, Inc.
>>> 
> 
> 
> 
> 
> 


___

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

Please do not post 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: iOS UI suggestions wanted - Date Picker

2013-04-17 Thread Rick Aurbach
Alex,

You have my attention, I don't really understand what you're suggesting. How 
would a gradient overlay to the selection-list UITableView aid the user in 
scrolling to a particular date or making a selection? Could you elaborate??

Rick Aurbach

On Apr 17, 2013, at 8:50 AM, Alex Zavatone  wrote:

> What about a UITableView with a gradient overlay that is shaded at the top 
> and bottom?
> 
> On Apr 17, 2013, at 12:35 AM, Rick Aurbach wrote:
> 
>> In my iPad app, I have a number of tableviews in various places which act as 
>> selection lists. The user can scroll the list and select the item with a 
>> tap, of course. But since some of the lists can be lengthy, I also include 
>> navigation aids. In all but one of the lists, the items are alphabetized and 
>> the navigation aid is a UISearchBar (I could equally well have used a table 
>> index, but I've chosen a UISearchBar instead. I use "scroll to closest text 
>> match" logic and it works very well -- the user can usually scroll the list 
>> and make the desired selection by typing only one or two characters In most 
>> cases.)
>> 
>> However, for one of the lists, the table items are items which are sorted by 
>> date. The obvious navigation aid in this case is a UIDatePicker, but due to 
>> limited screen real estate, I'd rather not use it (since is is so big and 
>> can't be easily resized). So I am looking for alternatives.
>> 
>> One alternative is to put the UIDatePicker (or perhaps another date picker 
>> such as SRMonthPicker or OCCalendar or ??) in a popover. (Presumably, the 
>> popover would be triggered by tapping a button or tapping in a UISearchBar.) 
>> This is do-able but what I really want is something that is not a popover. 
>> Ideally, I'd like something that is permanently part of the view but is only 
>> 44 pixels high (like a UISearchBar). Yet it should be easy for users to 
>> select at least a year and a month (causing the tableview to scroll the 
>> appropriate date range on screen for easy selection).
>> 
>> I would be interested to hear from anyone who has encountered a similar 
>> situation and has implemented a solution which they find satisfactory.
>> 
>> Cheers,
>> 
>> Rick Aurbach
>> Aurbach & Associates, Inc.
>> 






___

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

Please do not post 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: iOS UI suggestions wanted - Date Picker

2013-04-17 Thread Alex Zavatone
What about a UITableView with a gradient overlay that is shaded at the top and 
bottom?

On Apr 17, 2013, at 12:35 AM, Rick Aurbach wrote:

> In my iPad app, I have a number of tableviews in various places which act as 
> selection lists. The user can scroll the list and select the item with a tap, 
> of course. But since some of the lists can be lengthy, I also include 
> navigation aids. In all but one of the lists, the items are alphabetized and 
> the navigation aid is a UISearchBar (I could equally well have used a table 
> index, but I've chosen a UISearchBar instead. I use "scroll to closest text 
> match" logic and it works very well -- the user can usually scroll the list 
> and make the desired selection by typing only one or two characters In most 
> cases.)
> 
> However, for one of the lists, the table items are items which are sorted by 
> date. The obvious navigation aid in this case is a UIDatePicker, but due to 
> limited screen real estate, I'd rather not use it (since is is so big and 
> can't be easily resized). So I am looking for alternatives.
> 
> One alternative is to put the UIDatePicker (or perhaps another date picker 
> such as SRMonthPicker or OCCalendar or ??) in a popover. (Presumably, the 
> popover would be triggered by tapping a button or tapping in a UISearchBar.) 
> This is do-able but what I really want is something that is not a popover. 
> Ideally, I'd like something that is permanently part of the view but is only 
> 44 pixels high (like a UISearchBar). Yet it should be easy for users to 
> select at least a year and a month (causing the tableview to scroll the 
> appropriate date range on screen for easy selection).
> 
> I would be interested to hear from anyone who has encountered a similar 
> situation and has implemented a solution which they find satisfactory.
> 
> Cheers,
> 
> Rick Aurbach
> Aurbach & Associates, Inc.
> 
> 
> 
> 
> ___
> 
> Cocoa-dev mailing list (Cocoa-dev@lists.apple.com)
> 
> Please do not post 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/zav%40mac.com
> 
> This email sent to z...@mac.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